ko checks
This commit is contained in:
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user