sort specs so they are applied properly

This commit is contained in:
ntr 2019-03-14 22:16:33 +11:00
parent e6986d57cd
commit 2c89db4f01
2 changed files with 7 additions and 2 deletions

View File

@ -266,6 +266,7 @@ impl Cryp {
fn recalculate_stats(&mut self) -> &mut Cryp {
self.specs.sort_unstable();
self.red_damage.recalculate(&self.specs);
self.red_shield.recalculate(&self.specs);
self.blue_damage.recalculate(&self.specs);

View File

@ -2,10 +2,12 @@ use rand::prelude::*;
use cryp::{Stat};
#[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq)]
#[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq,PartialOrd,Ord,Eq)]
pub enum Spec {
SpeedI,
// Pure redShield has to come first as it applies the base amount
// that is multiplied
LifeI,
RedShieldI,
BlueShieldI,
@ -24,9 +26,11 @@ impl Spec {
Spec::RedDamageI => vec![Stat::RedDamage],
Spec::GreenDamageI => vec![Stat::GreenDamage],
Spec::BlueDamageI => vec![Stat::BlueDamage],
Spec::SpeedI => vec![Stat::Speed],
Spec::RedShieldI => vec![Stat::RedShield],
Spec::BlueShieldI => vec![Stat::BlueShield],
Spec::SpeedI => vec![Stat::Speed],
Spec::LifeI => vec![Stat::Hp],
Spec::LRSI => vec![Stat::Hp, Stat::RedShield],
Spec::LBSI => vec![Stat::Hp, Stat::BlueShield],