diff --git a/client/src/components/game.construct.life.jsx b/client/src/components/game.construct.life.jsx index a7670603..6a2cd37b 100644 --- a/client/src/components/game.construct.life.jsx +++ b/client/src/components/game.construct.life.jsx @@ -10,7 +10,7 @@ class GameConstructLife extends preact.Component { if (newProps.resolution && newProps.resolution !== this.props.resolution) { const [type, variant] = newProps.resolution.event; if (variant.construct === this.props.construct.id - && (type === 'Damage' || type === 'Healing' || type === 'Recharge')) return true; + && (type === 'Damage' || type === 'Healing')) return true; } if (newProps.construct !== this.props.construct) return true; return false; diff --git a/core/src/construct.rs b/core/src/construct.rs index 7191c832..d032bb8c 100644 --- a/core/src/construct.rs +++ b/core/src/construct.rs @@ -606,6 +606,7 @@ impl Construct { construct, amount: green_healing, overhealing: 0, + display: EventConstruct::new(self), colour: Colour::Green } ); @@ -617,6 +618,7 @@ impl Construct { construct, amount: recharge, overhealing, + display: EventConstruct::new(self), colour: Colour::Red } ); @@ -678,6 +680,7 @@ impl Construct { construct, amount: green_healing, overhealing: 0, + display: EventConstruct::new(self), colour: Colour::Green } ); @@ -689,6 +692,7 @@ impl Construct { construct, amount: recharge, overhealing, + display: EventConstruct::new(self), colour: Colour::Blue } ); @@ -727,7 +731,13 @@ impl Construct { let overhealing = modified_amount - healing; if healing != 0 { - events.push(Event::Healing { construct: self.id, amount: healing, overhealing, colour: Colour::Red }); + events.push(Event::Healing { + construct: self.id, + amount: healing, + overhealing, + display: EventConstruct::new(self), + colour: Colour::Red + }); } }, true => { @@ -781,6 +791,7 @@ impl Construct { amount: healing, overhealing, colour: Colour::Green, + display: EventConstruct::new(self), }); }, true => { @@ -826,7 +837,13 @@ impl Construct { let overhealing = modified_amount - healing; if healing != 0 { - events.push(Event::Healing { construct: self.id, amount: healing, overhealing, colour: Colour::Red }); + events.push(Event::Healing { + construct: self.id, + amount: healing, + overhealing, + colour: Colour::Red, + display: EventConstruct::new(self), + }); } }, true => { diff --git a/core/src/game.rs b/core/src/game.rs index 66e39805..8171ff52 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -437,9 +437,6 @@ impl Game { let mut r_animation_ms = 0; while let Some(cast) = self.stack.pop() { // info!("{:} casts ", cast); - - // r_animation_ms = Resolutions.iter().fold(r_animation_ms, |acc, r| acc + r.clone().get_delay()); - // if theres no resolution Resolutions, the skill didn't trigger (disable etc) // if Resolutions.len() > 0 && cast.used_cooldown() { // casters.push(cast); @@ -456,8 +453,8 @@ impl Game { let mut iter = self.resolutions[last].iter_mut().peekable(); while let Some(res) = iter.next() { res.set_delay(iter.peek()); + r_animation_ms += res.delay; } - // info!("{:#?}", self.casts); // handle cooldowns and statuses @@ -898,7 +895,7 @@ pub enum Event { Effect { construct: Uuid, effect: Effect, duration: u8, display: EventConstruct }, Removal { construct: Uuid, effect: Effect, display: EventConstruct }, - Healing { construct: Uuid, amount: usize, overhealing: usize, colour: Colour }, + Healing { construct: Uuid, amount: usize, overhealing: usize, colour: Colour, display: EventConstruct }, Inversion { construct: Uuid }, Reflection { construct: Uuid }, Ko { construct: Uuid }, @@ -1689,13 +1686,13 @@ mod tests { let resolutions = &game.resolutions[last]; assert!(resolutions.iter().any(|r| match r.event { - Event::Healing { construct, colour, amount, overhealing: _ } => + Event::Healing { construct, colour, amount, overhealing: _, display: _, } => construct == target && amount > 0 && colour == Colour::Green, _ => false, })); assert!(resolutions.iter().any(|r| match r.event { - Event::Healing { construct, colour, amount, overhealing: _ } => + Event::Healing { construct, colour, amount, overhealing: _, display: _ } => construct == target && amount > 0 && colour == Colour::Red, _ => false, })); @@ -1709,21 +1706,21 @@ mod tests { let target = game.players[1].constructs[0].id; game.resolve(Cast::new(source, player_id, target, Skill::Siphon)); - - // assert!(resolutions.iter().any(|r| match r.event { - // Event::Damage { construct, colour, amount, mitigation: _, display: _ } => - // construct == target && amount > 0 && colour == Colour::Blue, - // _ => false, - // })); - - // assert!(resolutions.iter().any(|r| match r.event { - // Event::Healing { construct, colour, amount, overhealing: _ } => - // construct == source && amount > 0 && colour == Colour::Green, - // _ => false, - // })); game = game.resolve_phase_start(); + let last = game.resolutions.len() - 1; let resolutions = &game.resolutions[last]; - println!("{:#?}", resolutions); + + assert!(resolutions.iter().any(|r| match r.event { + Event::Damage { construct, colour, amount, mitigation: _, display: _ } => + construct == target && amount > 0 && colour == Colour::Blue, + _ => false, + })); + + assert!(resolutions.iter().any(|r| match r.event { + Event::Healing { construct, colour, amount, overhealing: _, display: _ } => + construct == source && amount > 0 && colour == Colour::Green, + _ => false, + })); } } diff --git a/core/src/skill.rs b/core/src/skill.rs index 60e5c8c1..5bfe2ed9 100644 --- a/core/src/skill.rs +++ b/core/src/skill.rs @@ -732,7 +732,7 @@ impl Cast { values: vec![Value::Stat { construct: self.source, stat: Stat::RedPower, mult: self.skill.multiplier() }], }, Action::Heal { - construct: self.target, + construct: self.source, colour: Colour::Green, values: vec![Value::DamageReceived { construct: self.target, colour: Colour::Red, mult: 50 }], },