diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index e3370676edb..0d8cb40b684 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -25,13 +25,12 @@ return 0 if(damage_type != BRUTE && damage_type != BURN) return 0 - var/armor_protection = 0 + var/armor_protection if(damage_flag) armor_protection = armor.getRating(damage_flag) - if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. - armor_protection = clamp((armor_protection * ((100 - armor_penetration_percentage) / 100)) - armor_penetration_flat, min(armor_protection, 0), 100) - var/damage_multiplier = (100 - armor_protection) / 100 - return round(damage_amount * damage_multiplier, DAMAGE_PRECISION) + if(armor_protection > 0) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. + armor_protection = clamp(armor_protection * (100 - armor_penetration_percentage) / 100 - armor_penetration_flat, 0, 100) + return round(damage_amount * (100 - armor_protection) / 100, DAMAGE_PRECISION) /// returns the amount of damage required to destroy this object in a single hit. /obj/proc/calculate_oneshot_damage(damage_type, damage_flag = 0, attack_dir, armor_penetration_flat = 0, armor_penetration_percentage = 0) @@ -42,11 +41,11 @@ if(damage_type != BRUTE && damage_type != BURN) return INFINITY - var/armor_protection = 0 + var/armor_protection if(damage_flag) armor_protection = armor.getRating(damage_flag) - if(armor_protection) // Only apply weak-against-armor/hollowpoint effects if there actually IS armor. - armor_protection = clamp((armor_protection * ((100 - armor_penetration_percentage) / 100)) - armor_penetration_flat, min(armor_protection, 0), 100) + if(armor_protection > 0) // Only apply weak-against-armor/hollowpoint effects if there actually IS armor. + armor_protection = clamp(armor_protection * (100 - armor_penetration_percentage) / 100 - armor_penetration_flat, 0, 100) var/damage_multiplier = (100 - armor_protection) / 100 if(damage_multiplier <= 0) diff --git a/code/modules/mob/living/silicon/silicon_mob.dm b/code/modules/mob/living/silicon/silicon_mob.dm index d2982e22930..c7e4c15d6c1 100644 --- a/code/modules/mob/living/silicon/silicon_mob.dm +++ b/code/modules/mob/living/silicon/silicon_mob.dm @@ -312,12 +312,12 @@ /mob/living/silicon/proc/run_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armor_penetration_flat = 0, armor_penetration_percentage = 0) if(damage_type != BRUTE && damage_type != BURN) return 0 - var/armor_protection = 0 + var/armor_protection if(damage_flag) armor_protection = armor.getRating(damage_flag) - if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. - armor_protection = clamp((armor_protection * ((100 - armor_penetration_percentage) / 100)) - armor_penetration_flat, min(armor_protection, 0), 100) - return round(damage_amount * (100 - armor_protection) * 0.01, DAMAGE_PRECISION) + if(armor_protection > 0) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. + armor_protection = clamp(armor_protection * (100 - armor_penetration_percentage) / 100 - armor_penetration_flat, 0, 100) + return round(damage_amount * (100 - armor_protection) / 100, DAMAGE_PRECISION) /mob/living/silicon/apply_effect(effect = 0, effecttype = STUN, blocked = 0) return FALSE //The only effect that can hit them atm is flashes and they still directly edit so this works for now