Skip to content

Commit

Permalink
Merge pull request #2538 from Superlagg/puttclaw-buttclaw
Browse files Browse the repository at this point in the history
fixes melee ignoring mob armor
  • Loading branch information
Tk420634 committed Jun 23, 2023
2 parents a4aa6bd + 82589ad commit 9b24028
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
22 changes: 21 additions & 1 deletion code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,30 @@
if((user != src) && mob_run_block(I, totitemdamage, "the [I.name]", ((attackchain_flags & ATTACK_IS_PARRY_COUNTERATTACK)? ATTACK_IS_PARRY_COUNTERATTACK : NONE) | ATTACK_TYPE_MELEE, I.armour_penetration, user, null, block_return) & BLOCK_SUCCESS)
return FALSE
totitemdamage = block_calculate_resultant_damage(totitemdamage, block_return)
var/armorcheck = "melee"
switch(I.damtype)
if(BRUTE)
armorcheck = "melee"
if(BURN)
armorcheck = "laser"
var/armor = run_armor_check(null, armorcheck, null, null, 0, null)
var/dt = max(run_armor_check(null, "damage_threshold", null, null, 0, null), 0)
send_item_attack_message(I, user, null, totitemdamage)
I.do_stagger_action(src, user, totitemdamage)
if(I.force)
apply_damage(totitemdamage, I.damtype)
apply_damage(
totitemdamage,
I.damtype,
BODY_ZONE_CHEST,
armor,
FALSE,
FALSE,
0,
0,
I.sharpness,
dt,
TRUE
)
if(I.damtype == BRUTE)
if(prob(33))
I.add_mob_blood(src)
Expand Down
11 changes: 1 addition & 10 deletions code/modules/mob/living/simple_animal/animal_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,9 @@
return ..()

/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = "melee")
var/temp_damage = damage
if(!damage_coeff[damagetype])
temp_damage = 0
else
temp_damage *= damage_coeff[damagetype]
if(temp_damage <= 0)
visible_message(span_warning("[src] looks unharmed!"))
return FALSE

var/armor = run_armor_check(null, armorcheck, null, null, 0, null)
var/dt = max(run_armor_check(null, "damage_threshold", null, null, 0, null), 0)
apply_damage(temp_damage, damagetype, null, armor, null, null, null, damage_threshold = dt)
apply_damage(damage, damagetype, null, armor, null, null, null, damage_threshold = dt)
return TRUE

/mob/living/simple_animal/bullet_act(obj/item/projectile/P)
Expand Down

0 comments on commit 9b24028

Please sign in to comment.