From 804d3397c7143a4859850fef56209632a1a8aef2 Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 11 Dec 2019 18:04:42 +1000 Subject: [PATCH] nuff of that --- core/fixme.md | 3 --- core/src/construct.rs | 2 -- core/src/game.rs | 54 +++++++++++++++++++------------------------ 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/core/fixme.md b/core/fixme.md index b706590f..4e496e5e 100644 --- a/core/fixme.md +++ b/core/fixme.md @@ -1,11 +1,8 @@ # FIXME - last round of animations skipped cause no skill phase to add new vec check silence skill multiplier game ready not auto starting resolve phase -cooldown events leak skills - purify conditional healing absorb post resolve diff --git a/core/src/construct.rs b/core/src/construct.rs index 0a3fdccb..cd69b493 100644 --- a/core/src/construct.rs +++ b/core/src/construct.rs @@ -893,8 +893,6 @@ impl Construct { pub fn effect_add(&mut self, effect: ConstructEffect) -> Vec { if self.is_ko() { return vec![Event::TargetKo { construct: self.id }] } - if self.affected(Effect::Banish) { panic!("banish immunity not fixt yet") } - if let Some(p) = self.effects.iter().position(|ce| ce.effect == effect.effect) { // duplicate effect // replace existing diff --git a/core/src/game.rs b/core/src/game.rs index df47b821..7d34e7eb 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -134,15 +134,6 @@ impl Game { .unwrap() } - fn copy_constructs(&self) -> Vec { - self.players.clone() - .into_iter() - .flat_map( - |t| t.constructs - .into_iter()) - .collect::>() - } - pub fn update_construct(&mut self, construct: &mut Construct) -> &mut Game { match self.players.iter_mut().find(|t| t.constructs.iter().any(|c| c.id == construct.id)) { Some(player) => { @@ -426,17 +417,19 @@ impl Game { } // find their statuses with ticks - let mut ticks = self.copy_constructs() + let mut ticks = self.players .iter() - .flat_map( - |c| c.effects - .iter() - .cloned() - .filter_map(|e| e.meta) - .filter_map(move |m| match m { - EffectMeta::CastTick { source, target, skill } => Some(Cast::new(source, c.account, target, skill)), - _ => None, - }) + .flat_map(|p| p.constructs.iter() + .flat_map( + |c| c.effects + .iter() + .cloned() + .filter_map(|e| e.meta) + .filter_map(move |m| match m { + EffectMeta::CastTick { source, target, skill } => Some(Cast::new(source, c.account, target, skill)), + _ => None, + }) + ) ).collect::>(); // add them to the stack @@ -736,18 +729,19 @@ impl Game { }) .collect::>(); - for mut construct in self.copy_constructs() { - if construct.is_ko() { - continue; + for player in self.players.iter_mut() { + for construct in player.constructs.iter_mut() { + if construct.is_ko() { + continue; + } + + if !used_cooldown.contains(&construct.id) { + construct.reduce_cooldowns(); + }; + + // always reduce durations + construct.reduce_effect_durations(); } - - if !used_cooldown.contains(&construct.id) { - construct.reduce_cooldowns(); - }; - - // always reduce durations - construct.reduce_effect_durations(); - self.update_construct(&mut construct); } self