invert wip

This commit is contained in:
ntr 2019-03-21 17:38:00 +11:00
parent a6fb81da0c
commit 25d5458ece
4 changed files with 35 additions and 16 deletions

View File

@ -19,13 +19,13 @@ cryp vbox
ensure all skills impl ensure all skills impl
Skill::Reflect -> reflect incoming attacks back to opponent Skill::Reflect -> reflect incoming attacks back to opponent
Skill::Ruin -> aoe stun Skill::Ruin -> aoe stun
Skill::Slay -> red attack with bonus somethingorother for blue Skill::Slay -> red attack with bonus somethingorother for blue / maim no healing
Skill::Strangle -> stun + dot Skill::Strangle -> stun + dot
Skill::Clutch -> cannot go below 1hp Skill::Clutch -> cannot go below 1hp
Skill::Taunt -> redirect incomnig attacks to self Skill::Taunt -> redirect incomnig attacks to self
Skill::Toxic -> apply debuff to attackers Skill::Toxic -> apply debuff to attackers
recharge colour speeds
make parry semi-aggressive make parry semi-aggressive
constants constants

View File

@ -122,7 +122,11 @@ impl CrypStat {
} }
pub fn increase(&mut self, amt: u64) -> &mut CrypStat { pub fn increase(&mut self, amt: u64) -> &mut CrypStat {
self.value = self.value.saturating_add(amt); self.value = *[
self.value.saturating_add(amt),
self.max
].iter().min().unwrap();
self self
} }
@ -447,7 +451,7 @@ impl Cryp {
ResolutionResult::Recharge { red, blue, immunity } ResolutionResult::Recharge { red, blue, immunity }
} }
pub fn heal(&mut self, skill: Skill, amount: u64) -> ResolutionResult { pub fn deal_green_damage(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
let immunity = self.immune(skill); let immunity = self.immune(skill);
let immune = immunity.immune; let immune = immunity.immune;
@ -469,15 +473,11 @@ impl Cryp {
let modified_healing = healing_mods.iter().fold(amount, |acc, m| m.apply(acc)); let modified_healing = healing_mods.iter().fold(amount, |acc, m| m.apply(acc));
let current_hp = self.hp(); let current_hp = self.hp();
let new_hp = *[ self.hp.increase(modified_healing);
self.hp().saturating_add(modified_healing), let new_hp = self.hp.value;
self.hp.max
].iter().min().unwrap();
let healing = new_hp - current_hp; let healing = new_hp - current_hp;
let overhealing = amount - healing; let overhealing = modified_healing - healing;
self.hp.increase(healing);
return ResolutionResult::Healing { return ResolutionResult::Healing {
amount: healing, amount: healing,

View File

@ -102,6 +102,8 @@ pub enum Effect {
Empower, Empower,
Invert,
// magic // magic
Hex, Hex,
Curse, Curse,
@ -239,6 +241,7 @@ impl Effect {
// magic immunity // magic immunity
Effect::Shield => Category::BlueBuff, Effect::Shield => Category::BlueBuff,
Effect::Invert => Category::GreenBuff,
// effects over time // effects over time
Effect::Triage => Category::BlueBuff, Effect::Triage => Category::BlueBuff,
@ -301,6 +304,8 @@ pub enum Category {
BlueDebuff, BlueDebuff,
BlueBuff, BlueBuff,
BlueTick, BlueTick,
Green,
GreenBuff,
Ko, Ko,
} }
@ -323,6 +328,7 @@ pub enum Skill {
Clutch, Clutch,
Taunt, Taunt,
Toxic, Toxic,
Invert,
Strike, Strike,
Stun, Stun,
@ -390,6 +396,7 @@ impl Skill {
Skill::Throw => Some(1), // no damage stun, adds vulnerable Skill::Throw => Some(1), // no damage stun, adds vulnerable
Skill::Blast => None, Skill::Blast => None,
Skill::Amplify => Some(1), Skill::Amplify => Some(1),
Skill::Invert => Some(1),
Skill::Decay => None, // dot Skill::Decay => None, // dot
Skill::DecayTick => None, Skill::DecayTick => None,
Skill::Siphon => Some(1), Skill::Siphon => Some(1),
@ -455,6 +462,7 @@ impl Skill {
// ----------------- // -----------------
// Destruction // Destruction
// ----------------- // -----------------
Skill::Invert => Category::Green,
Skill::Blast => Category::Blue, Skill::Blast => Category::Blue,
Skill::Amplify => Category::Blue, Skill::Amplify => Category::Blue,
Skill::Decay => Category::Blue, // dot Skill::Decay => Category::Blue, // dot
@ -530,6 +538,7 @@ impl Skill {
Skill::Decay => 5, // dot Skill::Decay => 5, // dot
// magic combat trickery // magic combat trickery
Skill::Invert => 3, // hot
Skill::Triage => 3, // hot Skill::Triage => 3, // hot
Skill::Slow => 3, Skill::Slow => 3,
Skill::Amplify => 3, Skill::Amplify => 3,
@ -614,6 +623,7 @@ impl Skill {
Skill::Haste => haste(source, target, resolution), // speed slow Skill::Haste => haste(source, target, resolution), // speed slow
Skill::Heal => heal(source, target, resolution), Skill::Heal => heal(source, target, resolution),
Skill::Hex => hex(source, target, resolution), // todo prevent casting Skill::Hex => hex(source, target, resolution), // todo prevent casting
Skill::Invert => invert(source, target, resolution), // todo prevent casting
Skill::Parry => parry(source, target, resolution), Skill::Parry => parry(source, target, resolution),
Skill::Purge => purge(source, target, resolution), // dispel all buffs Skill::Purge => purge(source, target, resolution), // dispel all buffs
Skill::Purify => purify(source, target, resolution), // dispel all debuffs Skill::Purify => purify(source, target, resolution), // dispel all debuffs
@ -722,7 +732,7 @@ fn empower(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> R
fn heal(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { fn heal(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.green_damage(); let amount = cryp.green_damage();
resolution.results.push(target.heal(Skill::Heal, amount)); resolution.results.push(target.deal_green_damage(Skill::Heal, amount));
return resolution; return resolution;
} }
@ -738,7 +748,7 @@ fn triage(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res
fn triage_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { fn triage_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.blue_damage().wrapping_div(2); let amount = cryp.blue_damage().wrapping_div(2);
resolution.results.push(target.heal(Skill::TriageTick, amount)); resolution.results.push(target.deal_green_damage(Skill::TriageTick, amount));
return resolution; return resolution;
} }
@ -794,6 +804,12 @@ fn curse(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res
return resolution;; return resolution;;
} }
fn invert(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let effect = CrypEffect { effect: Effect::Invert, duration: Effect::Invert.duration(), tick: None };
resolution.results.push(target.add_effect(Skill::Invert, effect));
return resolution;;
}
fn recharge(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { fn recharge(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
resolution.results.push(target.recharge()); resolution.results.push(target.recharge());
return resolution; return resolution;
@ -817,7 +833,7 @@ fn siphon_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -
match siphon_damage { match siphon_damage {
ResolutionResult::Damage { amount, mitigation: _, category: _, immunity } => { ResolutionResult::Damage { amount, mitigation: _, category: _, immunity } => {
if !immunity.immune { if !immunity.immune {
resolution.results.push(cryp.heal(Skill::Heal, amount)); resolution.results.push(cryp.deal_green_damage(Skill::Heal, amount));
} }
}, },
_ => panic!("siphon tick damage not dealt {:?}", siphon_damage), _ => panic!("siphon tick damage not dealt {:?}", siphon_damage),

View File

@ -57,6 +57,7 @@ pub enum Var {
Haste, Haste,
Heal, Heal,
Hex, Hex,
Invert,
Parry, Parry,
Purge, Purge,
Purify, Purify,
@ -151,6 +152,7 @@ impl Var {
Var::Haste => Some(Skill::Haste), Var::Haste => Some(Skill::Haste),
Var::Heal => Some(Skill::Heal), Var::Heal => Some(Skill::Heal),
Var::Hex => Some(Skill::Hex), Var::Hex => Some(Skill::Hex),
Var::Invert => Some(Skill::Invert),
Var::Parry => Some(Skill::Parry), Var::Parry => Some(Skill::Parry),
Var::Purge => Some(Skill::Purge), Var::Purge => Some(Skill::Purge),
Var::Purify => Some(Skill::Purify), Var::Purify => Some(Skill::Purify),
@ -206,6 +208,7 @@ impl From<Skill> for Var {
Skill::Haste => Var::Haste, Skill::Haste => Var::Haste,
Skill::Heal => Var::Heal, Skill::Heal => Var::Heal,
Skill::Hex => Var::Hex, Skill::Hex => Var::Hex,
Skill::Invert => Var::Invert,
Skill::Parry => Var::Parry, Skill::Parry => Var::Parry,
Skill::Purge => Var::Purge, Skill::Purge => Var::Purge,
Skill::Purify => Var::Purify, Skill::Purify => Var::Purify,
@ -282,9 +285,9 @@ fn get_combos() -> Vec<Combo> {
Combo { units: vec![Var::Debuff, Var::Red, Var::Red], var: Var::Snare }, Combo { units: vec![Var::Debuff, Var::Red, Var::Red], var: Var::Snare },
Combo { units: vec![Var::Debuff, Var::Green, Var::Green], var: Var::Purge }, Combo { units: vec![Var::Debuff, Var::Green, Var::Green], var: Var::Purge },
Combo { units: vec![Var::Debuff, Var::Blue, Var::Blue], var: Var::Curse }, Combo { units: vec![Var::Debuff, Var::Blue, Var::Blue], var: Var::Curse },
// Combo { units: vec![Var::Debuff, Var::Red, Var::Green], var: Var::Siphon }, Combo { units: vec![Var::Debuff, Var::Red, Var::Green], var: Var::Slow },
Combo { units: vec![Var::Debuff, Var::Green, Var::Blue], var: Var::Siphon }, Combo { units: vec![Var::Debuff, Var::Green, Var::Blue], var: Var::Siphon },
Combo { units: vec![Var::Debuff, Var::Red, Var::Blue], var: Var::Slow }, Combo { units: vec![Var::Debuff, Var::Red, Var::Blue], var: Var::Invert },
Combo { units: vec![Var::Stun, Var::Red, Var::Red], var: Var::Strangle }, Combo { units: vec![Var::Stun, Var::Red, Var::Red], var: Var::Strangle },
Combo { units: vec![Var::Stun, Var::Green, Var::Green], var: Var::Throw }, Combo { units: vec![Var::Stun, Var::Green, Var::Green], var: Var::Throw },