From f182eec6119cf4fd6b80afbad3afb8a3de2331e6 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 7 Jan 2022 10:15:37 -0500 Subject: [PATCH] Fixed bugs in piercing penetration and crushing poise damage calculations. --- common/src/combat.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/combat.rs b/common/src/combat.rs index 80ee62ac3a..4f376607f4 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -277,7 +277,7 @@ impl Attack { let reduced_damage = applied_damage * damage_reduction / (1.0 - damage_reduction); let poise = reduced_damage * CRUSHING_POISE_FRACTION; - let change = Poise::apply_poise_reduction(poise, target.inventory); + let change = -Poise::apply_poise_reduction(poise, target.inventory); let poise_change = PoiseChange { amount: change, impulse: *dir, @@ -777,7 +777,9 @@ impl Damage { let penetration = if let Some(damage) = damage { if let DamageKind::Piercing = damage.kind { - damage.value * PIERCING_PENETRATION_FRACTION + (damage.value * PIERCING_PENETRATION_FRACTION) + .min(protection.unwrap_or(0.0)) + .max(0.0) } else { 0.0 }