|
25 | 25 | return 0 |
26 | 26 | if(damage_type != BRUTE && damage_type != BURN) |
27 | 27 | return 0 |
28 | | - var/armor_protection = 0 |
| 28 | + var/armor_protection |
29 | 29 | if(damage_flag) |
30 | 30 | armor_protection = armor.getRating(damage_flag) |
31 | | - if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. |
32 | | - armor_protection = clamp((armor_protection * ((100 - armor_penetration_percentage) / 100)) - armor_penetration_flat, min(armor_protection, 0), 100) |
33 | | - var/damage_multiplier = (100 - armor_protection) / 100 |
34 | | - return round(damage_amount * damage_multiplier, DAMAGE_PRECISION) |
| 31 | + if(armor_protection > 0) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor. |
| 32 | + armor_protection = clamp(armor_protection * (100 - armor_penetration_percentage) / 100 - armor_penetration_flat, 0, 100) |
| 33 | + return round(damage_amount * (100 - armor_protection) / 100, DAMAGE_PRECISION) |
35 | 34 |
|
36 | 35 | /// returns the amount of damage required to destroy this object in a single hit. |
37 | 36 | /obj/proc/calculate_oneshot_damage(damage_type, damage_flag = 0, attack_dir, armor_penetration_flat = 0, armor_penetration_percentage = 0) |
|
42 | 41 | if(damage_type != BRUTE && damage_type != BURN) |
43 | 42 | return INFINITY |
44 | 43 |
|
45 | | - var/armor_protection = 0 |
| 44 | + var/armor_protection |
46 | 45 | if(damage_flag) |
47 | 46 | armor_protection = armor.getRating(damage_flag) |
48 | | - if(armor_protection) // Only apply weak-against-armor/hollowpoint effects if there actually IS armor. |
49 | | - armor_protection = clamp((armor_protection * ((100 - armor_penetration_percentage) / 100)) - armor_penetration_flat, min(armor_protection, 0), 100) |
| 47 | + if(armor_protection > 0) // Only apply weak-against-armor/hollowpoint effects if there actually IS armor. |
| 48 | + armor_protection = clamp(armor_protection * (100 - armor_penetration_percentage) / 100 - armor_penetration_flat, 0, 100) |
50 | 49 |
|
51 | 50 | var/damage_multiplier = (100 - armor_protection) / 100 |
52 | 51 | if(damage_multiplier <= 0) |
|
0 commit comments