From de5724de97708b2ebb0e4b63f81de6ae38e76bd6 Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 13 Jan 2020 16:45:58 +1000 Subject: [PATCH] cooldown increase single event --- core/src/construct.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/construct.rs b/core/src/construct.rs index 2c45b7be..16b13c63 100644 --- a/core/src/construct.rs +++ b/core/src/construct.rs @@ -470,24 +470,26 @@ impl Construct { } pub fn increase_cooldowns(&mut self, turns: usize) -> Vec { - let mut events = vec![]; - + let mut cd_event = false; for skill in self.skills.iter_mut() { if skill.skill.base_cd().is_some() { // if has a cooldown + cd_event = true; match skill.cd { Some(cd) => { skill.cd = Some(cd.saturating_add(turns)); - events.push(Event::CooldownIncrease { construct: self.id, turns }) }, None => { skill.cd = Some(turns); - events.push(Event::CooldownIncrease { construct: self.id, turns }) }, } } } - return events; + if cd_event { + return vec![Event::CooldownIncrease { construct: self.id, turns }]; + } + + return vec![]; } pub fn reduce_cooldowns(&mut self) -> &mut Construct {