clutch delta hps

This commit is contained in:
ntr 2019-03-22 18:44:40 +11:00
parent 8bdf2d576d
commit d814e20656
2 changed files with 16 additions and 7 deletions

View File

@ -504,10 +504,12 @@ impl Cryp {
},
true => {
// there is no green shield (yet)
let current_hp = self.hp();
self.reduce_hp(modified_healing);
let delta = current_hp - self.hp();
return ResolutionResult::Inversion {
damage: modified_healing,
damage: delta,
healing: 0,
recharge: 0,
category: Category::GreenDamage,
@ -552,10 +554,12 @@ impl Cryp {
self.red_shield.reduce(mitigation);
// deal remainder to hp
let current_hp = self.hp();
self.reduce_hp(remainder);
let delta = current_hp - self.hp();
return ResolutionResult::Damage {
amount: remainder,
amount: delta,
mitigation,
category: Category::RedDamage,
immunity,
@ -610,10 +614,13 @@ impl Cryp {
let mitigation = modified_damage.saturating_sub(remainder);
self.blue_shield.reduce(mitigation);
let current_hp = self.hp();
self.reduce_hp(remainder);
let delta = current_hp - self.hp();
return ResolutionResult::Damage {
amount: remainder,
amount: delta,
mitigation,
category: Category::BlueDamage,
immunity,
@ -811,6 +818,4 @@ mod tests {
return;
}
}

View File

@ -984,9 +984,13 @@ mod tests {
clutch(&mut y.clone(), &mut y, Resolution::new(Skill::Clutch));
assert!(y.is_clutch());
attack(&mut x, &mut y, Resolution::new(Skill::Attack));
let res = attack(&mut x, &mut y, Resolution::new(Skill::Attack));
assert!(y.hp() == 1);
match res.results[0] {
ResolutionResult::Damage { amount, mitigation: _, category: _, immunity: _ } => assert_eq!(amount, 1023),
_ => panic!("not damage"),
};
}
#[test]