add all cryps fn
This commit is contained in:
parent
4453f567ea
commit
c175e80817
@ -130,6 +130,15 @@ impl Game {
|
||||
};
|
||||
}
|
||||
|
||||
fn all_cryps(&self) -> Vec<Cryp> {
|
||||
self.teams.clone()
|
||||
.into_iter()
|
||||
.flat_map(
|
||||
|t| t.cryps
|
||||
.into_iter())
|
||||
.collect::<Vec<Cryp>>()
|
||||
}
|
||||
|
||||
fn update_cryp(&mut self, cryp: &mut Cryp) -> &mut Game {
|
||||
match self.teams.iter_mut().find(|t| t.cryps.iter().any(|c| c.id == cryp.id)) {
|
||||
Some(team) => {
|
||||
@ -340,16 +349,8 @@ impl Game {
|
||||
panic!("game not in Resolve phase");
|
||||
}
|
||||
|
||||
// get all the cryps
|
||||
let mut all_cryps = self.teams.clone()
|
||||
.into_iter()
|
||||
.flat_map(
|
||||
|t| t.cryps
|
||||
.into_iter())
|
||||
.collect::<Vec<Cryp>>();
|
||||
|
||||
// find their statuses with ticks
|
||||
let mut ticks = all_cryps
|
||||
let mut ticks = self.all_cryps()
|
||||
.iter_mut()
|
||||
.flat_map(
|
||||
|c| c.effects
|
||||
@ -391,15 +392,7 @@ impl Game {
|
||||
}
|
||||
|
||||
fn progress_durations(&mut self) -> &mut Game {
|
||||
// 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 {
|
||||
for mut cryp in self.all_cryps() {
|
||||
println!("progressing durations for {:?}", cryp.name);
|
||||
|
||||
// only reduce cooldowns if no cd was used
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user