cooldown increase single event
This commit is contained in:
parent
cbc0846f4d
commit
de5724de97
@ -470,24 +470,26 @@ impl Construct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn increase_cooldowns(&mut self, turns: usize) -> Vec<Event> {
|
pub fn increase_cooldowns(&mut self, turns: usize) -> Vec<Event> {
|
||||||
let mut events = vec![];
|
let mut cd_event = false;
|
||||||
|
|
||||||
for skill in self.skills.iter_mut() {
|
for skill in self.skills.iter_mut() {
|
||||||
if skill.skill.base_cd().is_some() { // if has a cooldown
|
if skill.skill.base_cd().is_some() { // if has a cooldown
|
||||||
|
cd_event = true;
|
||||||
match skill.cd {
|
match skill.cd {
|
||||||
Some(cd) => {
|
Some(cd) => {
|
||||||
skill.cd = Some(cd.saturating_add(turns));
|
skill.cd = Some(cd.saturating_add(turns));
|
||||||
events.push(Event::CooldownIncrease { construct: self.id, turns })
|
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
skill.cd = Some(turns);
|
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 {
|
pub fn reduce_cooldowns(&mut self) -> &mut Construct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user