This commit is contained in:
ntr
2018-12-05 20:10:32 +11:00
parent 50e2c7b931
commit 3accbf5193
2 changed files with 45 additions and 41 deletions
+10 -5
View File
@@ -35,7 +35,7 @@ impl Team {
.filter(|c| !c.is_ko())
.filter(|c| c.available_skills().len() > 0)
.collect::<Vec<&Cryp>>().len();
println!("{:?} requires {:?} skills this turn", self.id, required);
// println!("{:?} requires {:?} skills this turn", self.id, required);
return required;
}
@@ -349,6 +349,8 @@ impl Game {
let active_cryps = active_cryps as u32 as f64;
let max_targets = (incoming / active_cryps).ceil();
println!("targets {:?} / {:?} = {:?}", incoming, active_cryps, max_targets);
let targeted = self.stack.iter()
.filter(|s| s.target_cryp_id.is_some())
.filter(|s| s.target_cryp_id.unwrap() == cryp_id)
@@ -491,11 +493,14 @@ impl Game {
// only reduce cooldowns if no cd was used
// have to borrow self for the skill check
{
let skill = self.stack.iter_mut().find(|s| s.source_cryp_id == cryp.id).unwrap();
if skill.used_cooldown() {
cryp.skill_set_cd(skill.skill);
if let Some(skill) = self.stack.iter_mut().find(|s| s.source_cryp_id == cryp.id) {
if skill.used_cooldown() {
cryp.skill_set_cd(skill.skill);
} else {
cryp.reduce_cooldowns();
}
} else {
cryp.reduce_cooldowns();
cryp.reduce_cooldowns();
}
}