Fix armor penetration increasing negative object's and mob silicon's armor (#30105)

* fix

* no src allowed
This commit is contained in:
kyunkyunkyun
2025-09-07 11:34:29 +00:00
committed by GitHub
parent 8851f9b0ef
commit 11962e1b94
2 changed files with 11 additions and 12 deletions
+7 -8
View File
@@ -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)