From a80c398c857a563458c37181f4bea6e980f181f6 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 9 Dec 2019 16:41:20 +1000 Subject: [PATCH] removals --- core/fixme.md | 2 ++ core/src/construct.rs | 9 ++++++ core/src/game.rs | 20 +++++++------ core/src/skill.rs | 69 ++++++++++++++++++++++++++++++++----------- 4 files changed, 74 insertions(+), 26 deletions(-) diff --git a/core/fixme.md b/core/fixme.md index dc2542f5..806bb382 100644 --- a/core/fixme.md +++ b/core/fixme.md @@ -14,6 +14,8 @@ cooldown events leak skills hit event reqs moving eventconstruct into specific events +purify conditional healing + counter / absorb post resolve etc cooldown checking -> go through round and find all casters \ No newline at end of file diff --git a/core/src/construct.rs b/core/src/construct.rs index 69dd183d..d26a64b0 100644 --- a/core/src/construct.rs +++ b/core/src/construct.rs @@ -703,6 +703,10 @@ impl Construct { colour: Colour::Green, display: EventConstruct::new(self), }); + + if self.is_ko() { + events.push(Event::Ko { construct }); + } } } @@ -749,6 +753,7 @@ impl Construct { display: EventConstruct::new(self), } ); + if self.is_ko() { events.push(Event::Ko { construct }); } @@ -819,6 +824,10 @@ impl Construct { colour: Colour::Blue, display: EventConstruct::new(self), }); + + if self.is_ko() { + events.push(Event::Ko { construct }); + } }, true => { // events.push(Event::new(Event::Inversion { skill })); diff --git a/core/src/game.rs b/core/src/game.rs index d37724ed..0e6a39cc 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -523,6 +523,15 @@ impl Game { _ => dmg, }), + Value::Removals { construct, mult } => + events.iter().fold(0, |dmg, e| match e { + Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } => + match *construct == *event_construct { + true => dmg + amount.pct(*mult), + false => dmg, + } + _ => dmg, + }), // Skills { construct: Uuid, colour: Colour }, } }) @@ -617,13 +626,6 @@ impl Game { // }; // } // } - - // if target.is_ko() && event_target.green == 0 { - // // Make sure target ko is from this event - // target.effects.clear(); - // game.event(Event::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); - // } - // }, // _ => (), // }; // } @@ -859,11 +861,11 @@ pub enum Value { Cooldowns { construct: Uuid, mult: usize }, ColourSkills { construct: Uuid, colour: Colour, mult: usize }, Effects { construct: Uuid, mult: usize }, + Removals { construct: Uuid, mult: usize }, DamageTaken { construct: Uuid, colour: Colour, mult: usize }, - // Skills { construct: Uuid, colour: Colour }, } -#[derive(Debug,PartialEq)] +#[derive(Debug,Clone,PartialEq)] pub enum Action { Hit, Cast, diff --git a/core/src/skill.rs b/core/src/skill.rs index 3cc11b28..ff94c11c 100644 --- a/core/src/skill.rs +++ b/core/src/skill.rs @@ -579,6 +579,58 @@ impl Cast { }, ], + Skill::Purify => vec![ + Action::RemoveAll { + construct: self.target, + }, + Action::Heal { + construct: self.target, + colour: Colour::Green, + values: vec![ + Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }, + Value::Removals { construct: self.target, mult: self.skill.multiplier() }, + ], + }, + Action::Effect { + construct: self.target, + effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(150)), tick: None } + }, + ], + Skill::PurifyPlus => vec![ + Action::RemoveAll { + construct: self.target, + }, + Action::Heal { + construct: self.target, + colour: Colour::Green, + values: vec![ + Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }, + Value::Removals { construct: self.target, mult: self.skill.multiplier() }, + ], + }, + Action::Effect { + construct: self.target, + effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(175)), tick: None } + }, + ], + Skill::PurifyPlusPlus => vec![ + Action::RemoveAll { + construct: self.target, + }, + Action::Heal { + construct: self.target, + colour: Colour::Green, + values: vec![ + Value::Stat { construct: self.source, stat: Stat::GreenPower, mult: self.skill.multiplier() }, + Value::Removals { construct: self.target, mult: self.skill.multiplier() }, + ], + }, + Action::Effect { + construct: self.target, + effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(200)), tick: None } + }, + ], + Skill::Recharge | Skill::RechargePlus | Skill::RechargePlusPlus => vec![ @@ -800,23 +852,6 @@ impl Cast { fn end() {} -// fn purify(source: &mut Construct, target: &mut Construct, skill: Skill) { -// game.event(Event::new(source, target).event(Event::Skill { skill }).stages(EventStages::StartEnd)); -// if target.effects.len() > 0 { -// let amount = source.green_power().pct(skill.multiplier().saturating_mul(target.effects.len() as usize)); -// target.effects.clear(); -// game.event(Event::new(source, target) -// .event(Event::Remove { skill, effect: None, construct_effects: target.effects.clone() }) -// .stages(EventStages::PostOnly)); -// target.deal_green_damage(skill, amount) -// .into_iter() -// .for_each(|e| game.event(Event::new(source, target).event(e).stages(EventStages::PostOnly))); -// } -// let effect = skill.effect()[0]; -// game.event(Event::new(source, target).event(target.effect_remove(skill, effect)).stages(EventStages::PostOnly)); - -// } - // pub fn dev_resolve(a_id: Uuid, b_id: Uuid, skill: Skill) { // let mut resolutions =vec![];