From ef84e620fe7a2aa49d01e104bf268d25a455f85e Mon Sep 17 00:00:00 2001 From: ntr Date: Sat, 13 Apr 2019 14:56:08 +1000 Subject: [PATCH] hatred fix --- client/src/components/game.component.jsx | 6 +----- client/src/utils.jsx | 5 ++++- server/src/player.rs | 4 ++-- server/src/skill.rs | 12 ++++++++++-- server/src/vbox.rs | 1 - 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx index 496c867f..e35d4bb6 100644 --- a/client/src/components/game.component.jsx +++ b/client/src/components/game.component.jsx @@ -148,12 +148,8 @@ function GamePanel(props) { ); } - function resolutionEl(r) { - return
{JSON.stringify(resolution)}
; - } - const selectedSkills = resolution - ? resolutionEl(resolution) + ?
 
: playerTeam.cryps.map((c, i) => stackElement(c, i)); // const mobileSkills = activeCryp diff --git a/client/src/utils.jsx b/client/src/utils.jsx index 647c9ff2..00a24307 100644 --- a/client/src/utils.jsx +++ b/client/src/utils.jsx @@ -188,7 +188,10 @@ function getCombatText(cryp, resolution) { if (type === 'Damage') { const { skill, amount, mitigation, colour } = event; - return amount; + const mitigationText = mitigation + ? `(${mitigation})` + : ''; + return `${amount} ${mitigationText}`; } if (type === 'Healing') { diff --git a/server/src/player.rs b/server/src/player.rs index 539f4f18..1c7f9328 100644 --- a/server/src/player.rs +++ b/server/src/player.rs @@ -63,14 +63,14 @@ impl Player { pub fn add_win(&mut self) -> &mut Player { self.score.wins += 1; self.set_ready(false); - self.vbox.balance_add(16); + self.vbox.balance_add(12); self } pub fn add_loss(&mut self) -> &mut Player { self.score.losses += 1; self.set_ready(false); - self.vbox.balance_add(12); + self.vbox.balance_add(9); self } diff --git a/server/src/skill.rs b/server/src/skill.rs index f98c570e..d30ecf52 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -100,7 +100,7 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio } if target.affected(Effect::Hostility) { - resolutions = hatred(target, source, resolutions, skill, amount); + resolutions = hatred(source, target, resolutions, skill, amount); } }, Event::Immunity { skill: _, immunity } => match immunity.contains(&Effect::Parry) { @@ -1343,7 +1343,15 @@ mod tests { resolve(Skill::Attack, &mut x, &mut y, vec![]); - assert!(x.affected(Effect::Hatred)); + assert!(y.affected(Effect::Hatred)); + + let mut results = resolve(Skill::Attack, &mut y, &mut x, vec![]); + + let Resolution { source: _, target: _, event } = results.remove(0); + match event { + Event::Damage { amount, skill: _, mitigation: _, colour: _} => assert_eq!(amount, 512), + _ => panic!("not damage hatred"), + }; } #[test] diff --git a/server/src/vbox.rs b/server/src/vbox.rs index 5f348b1c..20c6de72 100644 --- a/server/src/vbox.rs +++ b/server/src/vbox.rs @@ -406,7 +406,6 @@ pub struct Vbox { impl Vbox { pub fn new(account_id: Uuid, instance_id: Uuid) -> Vbox { - // line them up with the columns of the vbox let starting_items = vec![ Var::Attack, Var::Attack,