From 0a1e715fa4b3c8daa832e5b37baf90e39ae2d1db Mon Sep 17 00:00:00 2001 From: T-Dark Date: Tue, 18 Aug 2020 17:31:28 +0200 Subject: [PATCH] Fixed debug armor letting some damage through --- common/src/comp/damage.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/src/comp/damage.rs b/common/src/comp/damage.rs index d43268aa51..a1ad714ce0 100644 --- a/common/src/comp/damage.rs +++ b/common/src/comp/damage.rs @@ -30,10 +30,11 @@ impl Damage { self.healthchange *= 1.0 - BLOCK_EFFICIENCY } // Armor - self.healthchange *= 1.0 - loadout.get_damage_reduction(); + let damage_reduction = loadout.get_damage_reduction(); + self.healthchange *= 1.0 - damage_reduction; // Min damage - if self.healthchange > -10.0 { + if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 { self.healthchange = -10.0; } }, @@ -47,10 +48,11 @@ impl Damage { self.healthchange *= 1.0 - BLOCK_EFFICIENCY } // Armor - self.healthchange *= 1.0 - loadout.get_damage_reduction(); + let damage_reduction = loadout.get_damage_reduction(); + self.healthchange *= 1.0 - damage_reduction; // Min damage - if self.healthchange > -10.0 { + if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 { self.healthchange = -10.0; } }, @@ -64,10 +66,11 @@ impl Damage { self.healthchange *= 1.0 - BLOCK_EFFICIENCY } // Armor - self.healthchange *= 1.0 - loadout.get_damage_reduction(); + let damage_reduction = loadout.get_damage_reduction(); + self.healthchange *= 1.0 - damage_reduction; // Min damage - if self.healthchange > -10.0 { + if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 { self.healthchange = -10.0; } },