hatred fix

This commit is contained in:
ntr 2019-04-13 14:56:08 +10:00
parent 2e7e9d465d
commit ef84e620fe
5 changed files with 17 additions and 11 deletions

View File

@ -148,12 +148,8 @@ function GamePanel(props) {
); );
} }
function resolutionEl(r) {
return <div>{JSON.stringify(resolution)}</div>;
}
const selectedSkills = resolution const selectedSkills = resolution
? resolutionEl(resolution) ? <div>&nbsp;</div>
: playerTeam.cryps.map((c, i) => stackElement(c, i)); : playerTeam.cryps.map((c, i) => stackElement(c, i));
// const mobileSkills = activeCryp // const mobileSkills = activeCryp

View File

@ -188,7 +188,10 @@ function getCombatText(cryp, resolution) {
if (type === 'Damage') { if (type === 'Damage') {
const { skill, amount, mitigation, colour } = event; const { skill, amount, mitigation, colour } = event;
return amount; const mitigationText = mitigation
? `(${mitigation})`
: '';
return `${amount} ${mitigationText}`;
} }
if (type === 'Healing') { if (type === 'Healing') {

View File

@ -63,14 +63,14 @@ impl Player {
pub fn add_win(&mut self) -> &mut Player { pub fn add_win(&mut self) -> &mut Player {
self.score.wins += 1; self.score.wins += 1;
self.set_ready(false); self.set_ready(false);
self.vbox.balance_add(16); self.vbox.balance_add(12);
self self
} }
pub fn add_loss(&mut self) -> &mut Player { pub fn add_loss(&mut self) -> &mut Player {
self.score.losses += 1; self.score.losses += 1;
self.set_ready(false); self.set_ready(false);
self.vbox.balance_add(12); self.vbox.balance_add(9);
self self
} }

View File

@ -100,7 +100,7 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
} }
if target.affected(Effect::Hostility) { 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) { Event::Immunity { skill: _, immunity } => match immunity.contains(&Effect::Parry) {
@ -1343,7 +1343,15 @@ mod tests {
resolve(Skill::Attack, &mut x, &mut y, vec![]); 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] #[test]

View File

@ -406,7 +406,6 @@ pub struct Vbox {
impl Vbox { impl Vbox {
pub fn new(account_id: Uuid, instance_id: Uuid) -> Vbox { pub fn new(account_id: Uuid, instance_id: Uuid) -> Vbox {
// line them up with the columns of the vbox
let starting_items = vec![ let starting_items = vec![
Var::Attack, Var::Attack,
Var::Attack, Var::Attack,