ko checks

This commit is contained in:
ntr
2018-11-27 14:10:45 +11:00
parent fe6585e925
commit a222d87830
5 changed files with 14 additions and 6 deletions
+5
View File
@@ -179,6 +179,11 @@ impl Cryp {
}
pub fn immune(&self, skill: Skill) -> Immunity {
if self.is_ko() {
return Immunity { immune: true, effects: vec![Effect::Ko]};
}
let immunities = self.effects.iter()
.filter(|e| e.effect.immune(skill))
.map(|e| e.effect)
+3 -3
View File
@@ -436,6 +436,8 @@ impl Game {
// println!("progressing durations for {:?}", cryp.name);
if cryp.is_ko() {
self.log.push(format!("{:?} KO", cryp.name));
cryp.effects.clear();
continue;
}
@@ -1045,7 +1047,7 @@ mod tests {
assert!(game.resolved.iter().any(|r| r.skill == Skill::DrainTick));
// println!("{:#?}", game);
println!("{:#?}", game);
}
#[test]
@@ -1074,8 +1076,6 @@ mod tests {
assert!([Phase::Skill, Phase::Finish].contains(&game.phase));
println!("{:#?}", game);
return;
}
+5
View File
@@ -117,6 +117,8 @@ pub enum Effect {
SpeedDrain,
SpeedIncrease,
Ko,
}
impl Effect {
@@ -209,6 +211,8 @@ impl Effect {
Effect::SpeedDrain => Category::SpellDebuff,
Effect::SpeedIncrease => Category::SpellBuff,
Effect::Ko => Category::Ko,
}
}
}
@@ -225,6 +229,7 @@ pub enum Category {
SpellHeal,
SpellDebuff,
SpellBuff,
Ko,
}
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]