speed rework
This commit is contained in:
parent
cbe83b3a1e
commit
53adf5a2d9
@ -204,23 +204,44 @@ impl Item {
|
|||||||
|
|
||||||
pub fn speed(&self) -> u8 {
|
pub fn speed(&self) -> u8 {
|
||||||
match self {
|
match self {
|
||||||
Item::Red => 3,
|
|
||||||
Item::Green => 2,
|
|
||||||
Item::Blue => 1,
|
|
||||||
|
|
||||||
Item::Attack => 1,
|
Item::Attack => 1,
|
||||||
Item::Stun => 2,
|
Item::Stun => 2,
|
||||||
Item::Block => 3,
|
Item::Block => 3,
|
||||||
Item::Buff => 4,
|
Item::Buff |
|
||||||
Item::Debuff => 4,
|
Item::Debuff => 4,
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
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.speed());
|
|
||||||
},
|
let mut colour_speed = 0;
|
||||||
|
let mut skill_speed = 0;
|
||||||
|
let mut component_speed = 0;
|
||||||
|
|
||||||
|
combo.components.iter().for_each(|unit| {
|
||||||
|
colour_speed += match unit {
|
||||||
|
Item::Red => 3,
|
||||||
|
Item::Green => 2,
|
||||||
|
Item::Blue => 1,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
skill_speed += match unit {
|
||||||
|
Item::Attack => 1,
|
||||||
|
Item::Stun => 2,
|
||||||
|
Item::Block => 3,
|
||||||
|
Item::Buff |
|
||||||
|
Item::Debuff => 4,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
if colour_speed == 0 && skill_speed == 0 {
|
||||||
|
component_speed = unit.speed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if component_speed > 0 { return component_speed };
|
||||||
|
return 24 + colour_speed * skill_speed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn effect(&self) -> Option<ItemEffect> {
|
pub fn effect(&self) -> Option<ItemEffect> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user