buff blue dmg spec
This commit is contained in:
commit
10848b1239
@ -4,23 +4,30 @@ use cryp::{Stat, Colours};
|
||||
|
||||
#[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq,PartialOrd,Ord,Eq)]
|
||||
pub enum Spec {
|
||||
SpeedI,
|
||||
|
||||
Speed,
|
||||
RedSpeedI,
|
||||
BlueSpeedI,
|
||||
GreenSpeedI,
|
||||
GRSpeedI,
|
||||
GBSpeedI,
|
||||
RBSpeedI,
|
||||
// Pure redShield has to come first as it applies the base amount
|
||||
// that is multiplied
|
||||
Hp,
|
||||
LifeI,
|
||||
RedShieldI,
|
||||
BlueShieldI,
|
||||
LRSI,
|
||||
LBSI,
|
||||
RBSI,
|
||||
GRDI,
|
||||
GBDI,
|
||||
RBDI,
|
||||
|
||||
Damage,
|
||||
RedDamageI,
|
||||
GreenDamageI,
|
||||
BlueDamageI,
|
||||
GRDI,
|
||||
GBDI,
|
||||
RBDI,
|
||||
}
|
||||
|
||||
pub trait IntPct {
|
||||
@ -36,6 +43,7 @@ impl IntPct for u64 {
|
||||
impl Spec {
|
||||
pub fn affects(&self) -> Vec<Stat> {
|
||||
match *self {
|
||||
Spec::Damage => vec![Stat::BlueDamage, Stat::RedDamage, Stat::GreenDamage],
|
||||
Spec::RedDamageI => vec![Stat::RedDamage],
|
||||
Spec::GreenDamageI => vec![Stat::GreenDamage],
|
||||
Spec::BlueDamageI => vec![Stat::BlueDamage],
|
||||
@ -43,8 +51,15 @@ impl Spec {
|
||||
Spec::GBDI => vec![Stat::GreenDamage, Stat::BlueDamage],
|
||||
Spec::RBDI => vec![Stat::RedDamage, Stat::BlueDamage],
|
||||
|
||||
Spec::SpeedI => vec![Stat::Speed],
|
||||
Spec::Speed => vec![Stat::Speed],
|
||||
Spec::RedSpeedI => vec![Stat::Speed],
|
||||
Spec::BlueSpeedI => vec![Stat::Speed],
|
||||
Spec::GreenSpeedI => vec![Stat::Speed],
|
||||
Spec::GRSpeedI => vec![Stat::Speed],
|
||||
Spec::GBSpeedI => vec![Stat::Speed],
|
||||
Spec::RBSpeedI => vec![Stat::Speed],
|
||||
|
||||
Spec::Hp => vec![Stat::Hp],
|
||||
Spec::RedShieldI => vec![Stat::RedShield],
|
||||
Spec::BlueShieldI => vec![Stat::BlueShield],
|
||||
Spec::LifeI => vec![Stat::Hp],
|
||||
@ -56,74 +71,139 @@ impl Spec {
|
||||
}
|
||||
|
||||
pub fn apply(&self, modified: u64, base: u64, team_colours: &Colours) -> u64 {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
let i_min = 32;
|
||||
let i_max = 64;
|
||||
|
||||
fn apply_bonus(base: u64, colours: Vec<u8>, reqs: Vec<u8>, bonuses: Vec<u64>) -> u64 {
|
||||
base + bonuses.iter().enumerate().fold(0, |acc, (i, b)| {
|
||||
acc + match (colours.iter().all(|colour| colour >= &reqs[i])) {
|
||||
true => bonuses[i],
|
||||
false => 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
match *self {
|
||||
// Upgrades to Damage Spec
|
||||
Spec::Damage => modified + base.pct(5),
|
||||
Spec::RedDamageI => modified + {
|
||||
apply_bonus(base.pct(5), vec![team_colours.red], vec![5, 10, 20],
|
||||
vec![base.pct(5), base.pct(10), base.pct(20)])
|
||||
let mut pct = 5;
|
||||
if team_colours.red >= 5 { pct += 5 };
|
||||
if team_colours.red >= 10 { pct += 10 };
|
||||
if team_colours.red >= 20 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::GreenDamageI => modified + {
|
||||
apply_bonus(base.pct(5), vec![team_colours.green], vec![5, 10, 20],
|
||||
vec![base.pct(5), base.pct(10), base.pct(20)])
|
||||
let mut pct = 5;
|
||||
if team_colours.green >= 5 { pct += 5 };
|
||||
if team_colours.green >= 10 { pct += 10 };
|
||||
if team_colours.green >= 20 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::BlueDamageI => modified + {
|
||||
apply_bonus(base.pct(5), vec![team_colours.blue], vec![5, 10, 20],
|
||||
vec![base.pct(5), base.pct(10), base.pct(20)])
|
||||
let mut pct = 5;
|
||||
if team_colours.blue >= 5 { pct += 10 };
|
||||
if team_colours.blue >= 10 { pct += 20 };
|
||||
if team_colours.blue >= 20 { pct += 30 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::GRDI => modified + {
|
||||
apply_bonus(base.pct(5), vec![team_colours.green, team_colours.red],
|
||||
vec![2, 5, 10], vec![base.pct(5), base.pct(10), base.pct(20)])
|
||||
let mut pct = 5;
|
||||
if team_colours.green >= 2 && team_colours.red >= 2 { pct += 5 };
|
||||
if team_colours.green >= 5 && team_colours.red >= 5 { pct += 10 };
|
||||
if team_colours.green >= 10 && team_colours.red >= 10 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::GBDI => modified + {
|
||||
apply_bonus(base.pct(5), vec![team_colours.green, team_colours.blue],
|
||||
vec![2, 5, 10], vec![base.pct(5), base.pct(10), base.pct(20)])
|
||||
let mut pct = 5;
|
||||
if team_colours.green >= 2 && team_colours.blue >= 2 { pct += 5 };
|
||||
if team_colours.green >= 5 && team_colours.blue >= 5 { pct += 10 };
|
||||
if team_colours.green >= 10 && team_colours.blue >= 10 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::RBDI => modified + {
|
||||
apply_bonus(base.pct(5), vec![team_colours.red, team_colours.blue],
|
||||
vec![2, 5, 10], vec![base.pct(5), base.pct(10), base.pct(20)])
|
||||
let mut pct = 5;
|
||||
if team_colours.blue >= 2 && team_colours.red >= 2 { pct += 5 };
|
||||
if team_colours.blue >= 5 && team_colours.red >= 5 { pct += 10 };
|
||||
if team_colours.blue >= 10 && team_colours.red >= 10 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
// Upgrades to speed Spec
|
||||
Spec::Speed => modified + base.pct(5),
|
||||
Spec::RedSpeedI => modified + {
|
||||
let mut pct = 5;
|
||||
if team_colours.red >= 5 { pct += 5 };
|
||||
if team_colours.red >= 10 { pct += 10 };
|
||||
if team_colours.red >= 20 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::GreenSpeedI => modified + {
|
||||
let mut pct = 5;
|
||||
if team_colours.green >= 5 { pct += 5 };
|
||||
if team_colours.green >= 10 { pct += 10 };
|
||||
if team_colours.green >= 20 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::BlueSpeedI => modified + {
|
||||
let mut pct = 5;
|
||||
if team_colours.blue >= 5 { pct += 5 };
|
||||
if team_colours.blue >= 10 { pct += 10 };
|
||||
if team_colours.blue >= 20 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::GRSpeedI => modified + {
|
||||
let mut pct = 5;
|
||||
if team_colours.green >= 2 && team_colours.red >= 2 { pct += 5 };
|
||||
if team_colours.green >= 5 && team_colours.red >= 5 { pct += 10 };
|
||||
if team_colours.green >= 10 && team_colours.red >= 10 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::GBSpeedI => modified + {
|
||||
let mut pct = 5;
|
||||
if team_colours.green >= 2 && team_colours.blue >= 2 { pct += 5 };
|
||||
if team_colours.green >= 5 && team_colours.blue >= 5 { pct += 10 };
|
||||
if team_colours.green >= 10 && team_colours.blue >= 10 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
Spec::RBSpeedI => modified + {
|
||||
let mut pct = 5;
|
||||
if team_colours.blue >= 2 && team_colours.red >= 2 { pct += 5 };
|
||||
if team_colours.blue >= 5 && team_colours.red >= 5 { pct += 10 };
|
||||
if team_colours.blue >= 10 && team_colours.red >= 10 { pct += 20 };
|
||||
base.pct(pct)
|
||||
},
|
||||
|
||||
Spec::SpeedI => modified + base.pct(5),
|
||||
|
||||
// Upgrades to HP Spec
|
||||
Spec::Hp => modified + base.pct(5),
|
||||
Spec::LifeI => modified + {
|
||||
let bonus = 10 * team_colours.green as u64;
|
||||
apply_bonus(bonus, vec![team_colours.green], vec![5, 10, 20], vec![bonus, bonus * 2, bonus * 3])
|
||||
let mut mult = 10;
|
||||
if team_colours.red >= 5 { mult += 20 };
|
||||
if team_colours.red >= 10 { mult += 30 };
|
||||
if team_colours.red >= 20 { mult += 50 };
|
||||
mult * team_colours.green as u64
|
||||
},
|
||||
Spec::RedShieldI => modified + {
|
||||
let bonus = 10 * team_colours.red as u64;
|
||||
apply_bonus(bonus, vec![team_colours.red], vec![5, 10, 20], vec![bonus, bonus * 2, bonus * 3])
|
||||
let mut mult = 10;
|
||||
if team_colours.red >= 5 { mult += 20 };
|
||||
if team_colours.red >= 10 { mult += 30 };
|
||||
if team_colours.red >= 20 { mult += 50 };
|
||||
mult * team_colours.red as u64
|
||||
},
|
||||
Spec::BlueShieldI => modified + {
|
||||
let bonus = 10 * team_colours.blue as u64;
|
||||
apply_bonus(bonus, vec![team_colours.blue], vec![5, 10, 20], vec![bonus, bonus * 2, bonus * 3])
|
||||
let mut mult = 10;
|
||||
if team_colours.red >= 5 { mult += 20 };
|
||||
if team_colours.red >= 10 { mult += 30 };
|
||||
if team_colours.red >= 20 { mult += 50 };
|
||||
(mult * team_colours.blue) as u64
|
||||
},
|
||||
Spec::LRSI => modified + {
|
||||
let bonus = 5 * (team_colours.green + team_colours.red) as u64;
|
||||
apply_bonus(bonus, vec![team_colours.green, team_colours.red],
|
||||
vec![2, 5, 10], vec![bonus, bonus * 2, bonus * 3])
|
||||
let mut mult = 5;
|
||||
if team_colours.green >= 2 && team_colours.red >= 2 { mult += 5 };
|
||||
if team_colours.green >= 5 && team_colours.red >= 5 { mult += 10 };
|
||||
if team_colours.green >= 10 && team_colours.red >= 10 { mult += 20 };
|
||||
mult * (team_colours.green + team_colours.red) as u64
|
||||
},
|
||||
Spec::LBSI => modified + {
|
||||
let bonus = 5 * (team_colours.green + team_colours.blue) as u64;
|
||||
apply_bonus(bonus, vec![team_colours.green, team_colours.blue],
|
||||
vec![2, 5, 10], vec![bonus, bonus * 2, bonus * 3])
|
||||
let mut mult = 5;
|
||||
if team_colours.green >= 2 && team_colours.red >= 2 { mult += 5 };
|
||||
if team_colours.green >= 5 && team_colours.red >= 5 { mult += 10 };
|
||||
if team_colours.green >= 10 && team_colours.red >= 10 { mult += 20 };
|
||||
mult * (team_colours.green + team_colours.red) as u64
|
||||
},
|
||||
Spec::RBSI => modified + {
|
||||
let bonus = 5 * (team_colours.red + team_colours.blue) as u64;
|
||||
apply_bonus(bonus, vec![team_colours.red, team_colours.blue],
|
||||
vec![2, 5, 10], vec![bonus, bonus * 2, bonus * 3])
|
||||
let mut mult = 5;
|
||||
if team_colours.blue >= 2 && team_colours.red >= 2 { mult += 5 };
|
||||
if team_colours.blue >= 5 && team_colours.red >= 5 { mult += 10 };
|
||||
if team_colours.blue >= 10 && team_colours.red >= 10 { mult += 20 };
|
||||
mult * (team_colours.blue + team_colours.red) as u64
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ pub enum Var {
|
||||
// Base
|
||||
Damage,
|
||||
Hp,
|
||||
SpeedI,
|
||||
Speed,
|
||||
|
||||
// Shields Upgrades
|
||||
LifeI,
|
||||
@ -54,6 +54,14 @@ pub enum Var {
|
||||
GBDI,
|
||||
RBDI,
|
||||
|
||||
// Speed Upgrades
|
||||
RedSpeedI,
|
||||
BlueSpeedI,
|
||||
GreenSpeedI,
|
||||
GRSpeedI,
|
||||
GBSpeedI,
|
||||
RBSpeedI,
|
||||
|
||||
Amplify,
|
||||
Banish,
|
||||
Blast,
|
||||
@ -126,7 +134,7 @@ impl Var {
|
||||
|
||||
Var::Damage => 3,
|
||||
Var::Hp => 3,
|
||||
Var::SpeedI => 3,
|
||||
Var::Speed => 3,
|
||||
|
||||
_ => {
|
||||
let combos = get_combos();
|
||||
@ -183,8 +191,15 @@ impl Var {
|
||||
|
||||
fn into_spec(&self) -> Option<Spec> {
|
||||
match *self {
|
||||
Var::SpeedI => Some(Spec::SpeedI),
|
||||
Var::Speed => Some(Spec::Speed),
|
||||
Var::RedSpeedI => Some(Spec::RedSpeedI),
|
||||
Var::BlueSpeedI => Some(Spec::BlueSpeedI),
|
||||
Var::GreenSpeedI => Some(Spec::GreenSpeedI),
|
||||
Var::GRSpeedI => Some(Spec::GRSpeedI),
|
||||
Var::GBSpeedI => Some(Spec::GBSpeedI),
|
||||
Var::RBSpeedI => Some(Spec::RBSpeedI),
|
||||
|
||||
Var::Damage => Some(Spec::Damage),
|
||||
Var::RedDamageI => Some(Spec::RedDamageI),
|
||||
Var::BlueDamageI => Some(Spec::BlueDamageI),
|
||||
Var::GreenDamageI => Some(Spec::GreenDamageI),
|
||||
@ -192,6 +207,7 @@ impl Var {
|
||||
Var::GBDI => Some(Spec::GBDI),
|
||||
Var::RBDI => Some(Spec::RBDI),
|
||||
|
||||
Var::Hp => Some(Spec::Hp),
|
||||
Var::LifeI => Some(Spec::LifeI),
|
||||
Var::LRSI => Some(Spec::LRSI),
|
||||
Var::LBSI => Some(Spec::LBSI),
|
||||
@ -245,8 +261,15 @@ impl From<Skill> for Var {
|
||||
impl From<Spec> for Var {
|
||||
fn from(spec: Spec) -> Var {
|
||||
match spec {
|
||||
Spec::SpeedI => Var::SpeedI,
|
||||
Spec::Speed => Var::Speed,
|
||||
Spec::RedSpeedI => Var::RedSpeedI,
|
||||
Spec::BlueSpeedI => Var::BlueSpeedI,
|
||||
Spec::GreenSpeedI => Var::GreenSpeedI,
|
||||
Spec::GRSpeedI => Var::GRSpeedI,
|
||||
Spec::GBSpeedI => Var::GBSpeedI,
|
||||
Spec::RBSpeedI => Var::RBSpeedI,
|
||||
|
||||
Spec::Damage => Var::Damage,
|
||||
Spec::RedDamageI => Var::RedDamageI,
|
||||
Spec::BlueDamageI => Var::BlueDamageI,
|
||||
Spec::GreenDamageI => Var::GreenDamageI,
|
||||
@ -254,6 +277,7 @@ impl From<Spec> for Var {
|
||||
Spec::GBDI => Var::GBDI,
|
||||
Spec::RBDI => Var::RBDI,
|
||||
|
||||
Spec::Hp => Var::Hp,
|
||||
Spec::LifeI => Var::LifeI,
|
||||
Spec::LRSI => Var::LRSI,
|
||||
Spec::LBSI => Var::LBSI,
|
||||
@ -321,6 +345,14 @@ fn get_combos() -> Vec<Combo> {
|
||||
Combo { units: vec![Var::Hp, Var::Red, Var::Green], var: Var::LRSI },
|
||||
Combo { units: vec![Var::Hp, Var::Green, Var::Blue], var: Var::LBSI },
|
||||
Combo { units: vec![Var::Hp, Var::Red, Var::Blue], var: Var::RBSI },
|
||||
|
||||
Combo { units: vec![Var::Speed, Var::Red, Var::Red], var: Var::RedSpeedI },
|
||||
Combo { units: vec![Var::Speed, Var::Green, Var::Green], var: Var::GreenSpeedI },
|
||||
Combo { units: vec![Var::Speed, Var::Blue, Var::Blue], var: Var::BlueSpeedI },
|
||||
Combo { units: vec![Var::Speed, Var::Red, Var::Green], var: Var::GRSpeedI },
|
||||
Combo { units: vec![Var::Speed, Var::Green, Var::Blue], var: Var::GBSpeedI },
|
||||
Combo { units: vec![Var::Speed, Var::Red, Var::Blue], var: Var::RBSpeedI },
|
||||
|
||||
];
|
||||
|
||||
combinations.iter_mut().for_each(|set| set.units.sort_unstable());
|
||||
@ -347,7 +379,7 @@ impl Vbox {
|
||||
Var::Hp,
|
||||
Var::Green,
|
||||
Var::Attack,
|
||||
Var::SpeedI,
|
||||
Var::Speed,
|
||||
Var::Blue,
|
||||
Var::Attack,
|
||||
Var::Damage,
|
||||
@ -400,7 +432,7 @@ impl Vbox {
|
||||
let specs = vec![
|
||||
(Var::Damage, 1),
|
||||
(Var::Hp, 1),
|
||||
(Var::SpeedI, 1),
|
||||
(Var::Speed, 1),
|
||||
];
|
||||
|
||||
let mut rng = thread_rng();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user