From a222d87830b15c9a6ae5006b972dbc7c155b0432 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 27 Nov 2018 14:10:45 +1100 Subject: [PATCH] ko checks --- client/src/scenes/constants.js | 1 + client/src/socket.js | 3 --- server/src/cryp.rs | 5 +++++ server/src/game.rs | 6 +++--- server/src/skill.rs | 5 +++++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/client/src/scenes/constants.js b/client/src/scenes/constants.js index a7b52d58..374a0761 100644 --- a/client/src/scenes/constants.js +++ b/client/src/scenes/constants.js @@ -129,6 +129,7 @@ module.exports = { 'Strangle', // physical dot and disable 'Stun', + 'Throw', 'Evade', // actively evade 'Evasion', // adds evasion to cryp diff --git a/client/src/socket.js b/client/src/socket.js index 53c07114..5f5c2a21 100644 --- a/client/src/socket.js +++ b/client/src/socket.js @@ -12,9 +12,6 @@ function errorToast(err) { }); } -// Create WebSocket connection. -// requires the redux store in order to push updates -// to components function createSocket(events) { let ws; diff --git a/server/src/cryp.rs b/server/src/cryp.rs index fbe75b83..ce317541 100755 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -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) diff --git a/server/src/game.rs b/server/src/game.rs index 983c2f65..d54c5a90 100755 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -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; } diff --git a/server/src/skill.rs b/server/src/skill.rs index 875687bc..b6591b4a 100755 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -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)]