reduce the cooldowns of all cryps in the game, not just the ones on the stack

This commit is contained in:
ntr 2018-11-13 17:14:16 +11:00
parent bec35ca46b
commit 4453f567ea

View File

@ -391,14 +391,15 @@ impl Game {
} }
fn progress_durations(&mut self) -> &mut Game { fn progress_durations(&mut self) -> &mut Game {
// FIXME // get all the cryps
// need to get all the cryps let all_cryps = self.teams.clone()
// and check if they cast anything .into_iter()
// do it once for every cryp .flat_map(
for mut cryp in self.stack.clone().iter() |t| t.cryps
.map(|s| self.cryp_by_id(s.source_cryp_id).unwrap().clone()) .into_iter())
.collect::<Vec<Cryp>>() { .collect::<Vec<Cryp>>();
for mut cryp in all_cryps {
println!("progressing durations for {:?}", cryp.name); println!("progressing durations for {:?}", cryp.name);
// only reduce cooldowns if no cd was used // only reduce cooldowns if no cd was used
@ -420,7 +421,6 @@ impl Game {
self self
} }
fn is_finished(&self) -> bool { fn is_finished(&self) -> bool {
self.teams.iter().any(|t| t.cryps.iter().all(|c| c.is_ko())) self.teams.iter().any(|t| t.cryps.iter().all(|c| c.is_ko()))
} }