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

View File

@ -129,6 +129,7 @@ module.exports = {
'Strangle', // physical dot and disable 'Strangle', // physical dot and disable
'Stun', 'Stun',
'Throw',
'Evade', // actively evade 'Evade', // actively evade
'Evasion', // adds evasion to cryp 'Evasion', // adds evasion to cryp

View File

@ -12,9 +12,6 @@ function errorToast(err) {
}); });
} }
// Create WebSocket connection.
// requires the redux store in order to push updates
// to components
function createSocket(events) { function createSocket(events) {
let ws; let ws;

View File

@ -179,6 +179,11 @@ impl Cryp {
} }
pub fn immune(&self, skill: Skill) -> Immunity { pub fn immune(&self, skill: Skill) -> Immunity {
if self.is_ko() {
return Immunity { immune: true, effects: vec![Effect::Ko]};
}
let immunities = self.effects.iter() let immunities = self.effects.iter()
.filter(|e| e.effect.immune(skill)) .filter(|e| e.effect.immune(skill))
.map(|e| e.effect) .map(|e| e.effect)

View File

@ -436,6 +436,8 @@ impl Game {
// println!("progressing durations for {:?}", cryp.name); // println!("progressing durations for {:?}", cryp.name);
if cryp.is_ko() { if cryp.is_ko() {
self.log.push(format!("{:?} KO", cryp.name));
cryp.effects.clear();
continue; continue;
} }
@ -1045,7 +1047,7 @@ mod tests {
assert!(game.resolved.iter().any(|r| r.skill == Skill::DrainTick)); assert!(game.resolved.iter().any(|r| r.skill == Skill::DrainTick));
// println!("{:#?}", game); println!("{:#?}", game);
} }
#[test] #[test]
@ -1074,8 +1076,6 @@ mod tests {
assert!([Phase::Skill, Phase::Finish].contains(&game.phase)); assert!([Phase::Skill, Phase::Finish].contains(&game.phase));
println!("{:#?}", game);
return; return;
} }

View File

@ -117,6 +117,8 @@ pub enum Effect {
SpeedDrain, SpeedDrain,
SpeedIncrease, SpeedIncrease,
Ko,
} }
impl Effect { impl Effect {
@ -209,6 +211,8 @@ impl Effect {
Effect::SpeedDrain => Category::SpellDebuff, Effect::SpeedDrain => Category::SpellDebuff,
Effect::SpeedIncrease => Category::SpellBuff, Effect::SpeedIncrease => Category::SpellBuff,
Effect::Ko => Category::Ko,
} }
} }
} }
@ -225,6 +229,7 @@ pub enum Category {
SpellHeal, SpellHeal,
SpellDebuff, SpellDebuff,
SpellBuff, SpellBuff,
Ko,
} }
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)] #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]