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
+16 -2
View File
@@ -320,7 +320,19 @@ impl Item {
let combos = get_combos();
let combo = combos.iter().find(|c| c.item == *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::BreakPlusPlus => vec![Item::BreakPlus, Item::BreakPlus, Item::BreakPlus],
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::BanishPlusPlus => vec![Item::BanishPlus, Item::BanishPlus, Item::BanishPlus],
@@ -1425,6 +1437,7 @@ pub fn get_combos() -> Vec<Combo> {
#[derive(Debug,Clone,Serialize,Deserialize)]
pub struct ItemInfo {
pub item: Item,
pub cost: usize,
pub spec: bool,
pub skill: bool,
pub values: Option<SpecValues>,
@@ -1455,6 +1468,7 @@ pub fn item_info() -> ItemInfoCtr {
.into_iter()
.map(|v| ItemInfo {
item: v,
cost: v.cost(),
spec: v.into_spec().is_some(),
skill: v.into_skill().is_some(),
description: v.into_description(),
+1 -1
View File
@@ -14,7 +14,7 @@ use cookie::Cookie;
use stripe::{Client as StripeClient, Subscription};
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;
+1 -1
View File
@@ -240,7 +240,7 @@ mod tests {
let mut vbox = Vbox::new();
vbox.bound = vec![Item::Strike];
vbox.reclaim(0).unwrap();
assert_eq!(vbox.bits, 22);
assert_eq!(vbox.bits, 20);
}
#[test]