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