vbox show costs, penalty for combo sale

This commit is contained in:
Mashy 2019-09-20 12:22:48 +10:00
parent 4a640784f1
commit 3ad679cb02
5 changed files with 23 additions and 10 deletions

View File

@ -27,7 +27,7 @@
* fuck magic * fuck magic
* empower on ko * empower on ko
var / skill info rpc -> sell cost / cooldown var / skill info rpc -> cooldown
* rework vecs into sets * rework vecs into sets
* remove names so games/instances are copy * remove names so games/instances are copy

View File

@ -52,7 +52,7 @@ function InfoComponent(args) {
const speed = <div> Speed {shapes.SpeedStat()} multiplier {calcSpeed}% </div>; const speed = <div> Speed {shapes.SpeedStat()} multiplier {calcSpeed}% </div>;
return ( return (
<div class="info-skill"> <div class="info-skill">
<h2>{fullInfo.item}</h2> <h2>{fullInfo.item} - {fullInfo.cost}b</h2>
<h3>SKILL</h3> <h3>SKILL</h3>
{itemSourceDescription} {itemSourceDescription}
<div>{infoDescription}</div> <div>{infoDescription}</div>
@ -133,7 +133,6 @@ function InfoComponent(args) {
} }
return false; return false;
}); });
console.log(info);
const bonusObj = info.includes('Life') const bonusObj = info.includes('Life')
? <div class={`${reqClass} bonus`} > + {bonus.bonus}</div> ? <div class={`${reqClass} bonus`} > + {bonus.bonus}</div>
: <div class={`${reqClass} bonus`} > + {bonus.bonus}%</div>; : <div class={`${reqClass} bonus`} > + {bonus.bonus}%</div>;
@ -157,7 +156,7 @@ function InfoComponent(args) {
return ( return (
<div class="info-spec"> <div class="info-spec">
<h2>{info}</h2> <h2>{info} - {fullInfo.cost}b</h2>
<h3>SPEC</h3> <h3>SPEC</h3>
{itemSourceDescription} {itemSourceDescription}
<div>{infoDescription}</div> <div>{infoDescription}</div>
@ -167,10 +166,10 @@ function InfoComponent(args) {
</div> </div>
); );
} }
const cost = fullInfo.cost ? `- ${fullInfo.cost}b` : false;
return ( return (
<div class="info-item"> <div class="info-item">
<h2>{fullInfo.item}</h2> <h2>{fullInfo.item} {cost}</h2>
<div>{fullInfo.description}</div> <div>{fullInfo.description}</div>
</div> </div>
); );

View File

@ -320,7 +320,19 @@ impl Item {
let combos = get_combos(); let combos = get_combos();
let combo = combos.iter().find(|c| c.item == *self) let combo = combos.iter().find(|c| c.item == *self)
.unwrap_or_else(|| panic!("unable to find components for {:?}", self)); .unwrap_or_else(|| panic!("unable to find components for {:?}", self));
return combo.components.iter().fold(0, |acc, c| acc + c.cost()); return combo.components.iter().fold(0, |acc, c| {
match c {
Item::Attack |
Item::Block |
Item::Buff |
Item::Debuff |
Item::Stun => acc,
Item::Power |
Item::Life |
Item::Speed => acc + 1,
_ => acc + c.cost(),
}
});
}, },
} }
} }
@ -960,7 +972,7 @@ impl Item {
Item::BreakPlus => vec![Item::Break, Item::Break, Item::Break], Item::BreakPlus => vec![Item::Break, Item::Break, Item::Break],
Item::BreakPlusPlus => vec![Item::BreakPlus, Item::BreakPlus, Item::BreakPlus], Item::BreakPlusPlus => vec![Item::BreakPlus, Item::BreakPlus, Item::BreakPlus],
Item::LinkPlus => vec![Item::Link, Item::Link, Item::Link], Item::LinkPlus => vec![Item::Link, Item::Link, Item::Link],
Item::LinkPlusPlus => vec![Item::LinkPlusPlus, Item::LinkPlusPlus, Item::LinkPlusPlus], Item::LinkPlusPlus => vec![Item::LinkPlus, Item::LinkPlus, Item::LinkPlus],
Item::BanishPlus => vec![Item::Banish, Item::Banish, Item::Banish], Item::BanishPlus => vec![Item::Banish, Item::Banish, Item::Banish],
Item::BanishPlusPlus => vec![Item::BanishPlus, Item::BanishPlus, Item::BanishPlus], Item::BanishPlusPlus => vec![Item::BanishPlus, Item::BanishPlus, Item::BanishPlus],
@ -1425,6 +1437,7 @@ pub fn get_combos() -> Vec<Combo> {
#[derive(Debug,Clone,Serialize,Deserialize)] #[derive(Debug,Clone,Serialize,Deserialize)]
pub struct ItemInfo { pub struct ItemInfo {
pub item: Item, pub item: Item,
pub cost: usize,
pub spec: bool, pub spec: bool,
pub skill: bool, pub skill: bool,
pub values: Option<SpecValues>, pub values: Option<SpecValues>,
@ -1455,6 +1468,7 @@ pub fn item_info() -> ItemInfoCtr {
.into_iter() .into_iter()
.map(|v| ItemInfo { .map(|v| ItemInfo {
item: v, item: v,
cost: v.cost(),
spec: v.into_spec().is_some(), spec: v.into_spec().is_some(),
skill: v.into_skill().is_some(), skill: v.into_skill().is_some(),
description: v.into_description(), description: v.into_description(),

View File

@ -14,7 +14,7 @@ use cookie::Cookie;
use stripe::{Client as StripeClient, Subscription}; use stripe::{Client as StripeClient, Subscription};
use crossbeam_channel::{unbounded, Sender as CbSender}; use crossbeam_channel::{unbounded, Sender as CbSender};
use ws::{Builder, listen, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender}; use ws::{Builder, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender};
use account::{Account}; use account::{Account};
use account; use account;

View File

@ -240,7 +240,7 @@ mod tests {
let mut vbox = Vbox::new(); let mut vbox = Vbox::new();
vbox.bound = vec![Item::Strike]; vbox.bound = vec![Item::Strike];
vbox.reclaim(0).unwrap(); vbox.reclaim(0).unwrap();
assert_eq!(vbox.bits, 22); assert_eq!(vbox.bits, 20);
} }
#[test] #[test]