fix cooldowns
This commit is contained in:
parent
4397ce2f2f
commit
14be48da24
@ -715,23 +715,25 @@ impl Game {
|
||||
|
||||
fn progress_durations(&mut self) -> &mut Game {
|
||||
let last = self.resolutions.len() - 1;
|
||||
let used_cooldown = self.resolutions[last].iter()
|
||||
.filter_map(|r| match r.event {
|
||||
Event::Cast { construct, player: _, direction: _ } => match r.skill.base_cd().is_some() {
|
||||
true => Some(construct),
|
||||
false => None,
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<Uuid>>();
|
||||
|
||||
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) {
|
||||
let cooldown = self.resolutions[last].iter()
|
||||
.find_map(|r| match r.event {
|
||||
Event::Cast { construct: caster, player: _, direction: _ } =>
|
||||
match caster == construct.id && r.skill.base_cd().is_some() {
|
||||
true => Some(r.skill),
|
||||
false => None,
|
||||
},
|
||||
_ => None,
|
||||
});
|
||||
|
||||
if let Some(skill) = cooldown {
|
||||
construct.skill_set_cd(skill);
|
||||
} else {
|
||||
construct.reduce_cooldowns();
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user