Skip to content

Commit

Permalink
Fixes DamageEffect (#1664)
Browse files Browse the repository at this point in the history
* Update hostile.dm

* Adds logging and exception handling
  • Loading branch information
LanceSmites328 authored Nov 28, 2023
1 parent a7c199d commit 44fb5c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion code/modules/mob/living/simple_animal/animal_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@
/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, actuallydamage = TRUE)
var/temp_damage = damage

temp_damage *= damage_coeff.getCoeff(damagetype)
if(islist(damage_coeff))
temp_damage *= damage_coeff[damagetype]
stack_trace("[src] has a damage_coeff list and was hurt!")
else
temp_damage *= damage_coeff.getCoeff(damagetype)

if(temp_damage >= 0 && temp_damage <= force_threshold)
visible_message("<span class='warning'>[src] looks unharmed!</span>")
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/simple_animal/hostile/hostile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@
/mob/living/simple_animal/hostile/proc/DamageEffect(amount, damtype)
//Code stolen from attack_threshold_check() in animal_defense.dm
var/temp_damage = amount
if(!damage_coeff[damtype])
temp_damage = 0
else
if(islist(damage_coeff))
temp_damage *= damage_coeff[damtype]
else
temp_damage *= damage_coeff.getCoeff(damtype)

if(temp_damage > 0)
return FALSE
Expand Down

0 comments on commit 44fb5c7

Please sign in to comment.