Skip to content

Commit

Permalink
[MIRROR] Fixes parrying
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SuhEugene committed Sep 14, 2023
1 parent a679cad commit 783321e
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
12 changes: 12 additions & 0 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ avoid code duplication. This includes items that may sometimes act as a standard
SPAN_WARNING("You felt something bounce off you harmlessly.")
)
return TRUE
<<<<<<< ours

var/hit_zone = resolve_item_attack(weapon, user, user.zone_sel? user.zone_sel.selecting : ran_zone())
if (!hit_zone)
Expand All @@ -323,6 +324,12 @@ avoid code duplication. This includes items that may sometimes act as a standard
"Was attacked with \a [weapon] (DAMTYE: [uppertext(weapon.damtype)])",
"used \a [weapon] (DAMTYE: [uppertext(weapon.damtype)]) to attack"
)
=======

var/hit_zone = resolve_item_attack(weapon, user, user.zone_sel? user.zone_sel.selecting : ran_zone())
if (!hit_zone)
return TRUE
>>>>>>> theirs

var/datum/attack_result/result = hit_zone
if (istype(result))
Expand Down Expand Up @@ -451,6 +458,11 @@ avoid code duplication. This includes items that may sometimes act as a standard
* Returns boolean to indicate whether or not damage was dealt.
*/
/obj/item/proc/apply_hit_effect(mob/living/target, mob/living/user, hit_zone)
<<<<<<< ours
=======
if (hitsound)
playsound(loc, hitsound, 75, TRUE)
>>>>>>> theirs
var/power = force
if (MUTATION_HULK in user.mutations && damtype == DAMAGE_BRUTE) //Repeat this check here because it is only used under use_weapon to check if it's even possible to damage the mob. Value not carried over here.
power *= 2
Expand Down
12 changes: 11 additions & 1 deletion code/modules/mob/living/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
if(!damage)
return FALSE

switch (damagetype)
if (DAMAGE_EMP, DAMAGE_FIRE)
return FALSE // These damages are handled separately by existing legacy code
if (DAMAGE_BIO)
damagetype = DAMAGE_TOXIN
if (DAMAGE_EXPLODE, DAMAGE_PSIONIC)
damagetype = DAMAGE_BRUTE

switch(damagetype)
if (DAMAGE_BRUTE)
adjustBruteLoss(damage)
Expand All @@ -31,12 +39,14 @@
adjustOxyLoss(damage)
if (DAMAGE_GENETIC)
adjustCloneLoss(damage)
if (DAMAGE_PAIN)
if (DAMAGE_STUN, DAMAGE_PAIN)
adjustHalLoss(damage)
if (DAMAGE_SHOCK)
electrocute_act(damage, used_weapon, 1, def_zone)
if (DAMAGE_RADIATION)
apply_radiation(damage)
if (DAMAGE_BRAIN)
adjustBrainLoss(damage)

updatehealth()
return TRUE
Expand Down
16 changes: 16 additions & 0 deletions code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@

///Called when the mob is hit with an item in combat. Returns the blocked result
/mob/living/proc/hit_with_weapon(obj/item/I, mob/living/user, effective_force, hit_zone)
<<<<<<< ours
=======
var/weapon_mention
if(I.attack_message_name())
weapon_mention = " with [I.attack_message_name()]"
visible_message(SPAN_DANGER("\The [src] has been [length(I.attack_verb)? pick(I.attack_verb) : "attacked"][weapon_mention] by \the [user]!"))

. = standard_weapon_hit_effects(I, user, effective_force, hit_zone)

if (I.damtype == DAMAGE_BRUTE && prob(33)) // Added blood for whacking non-humans too
var/turf/simulated/location = get_turf(src)
if(istype(location)) location.add_blood_floor(src)

///returns false if the effects failed to apply for some reason, true otherwise.
/mob/living/proc/standard_weapon_hit_effects(obj/item/I, mob/living/user, effective_force, hit_zone)
>>>>>>> theirs
if(!effective_force)
return FALSE

Expand Down
20 changes: 20 additions & 0 deletions code/modules/mob/living/simple_animal/defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@

return

<<<<<<< ours
=======

>>>>>>> theirs
/mob/living/simple_animal/use_tool(obj/item/tool, mob/user, list/click_params)
// Butcher's Cleaver - Butcher dead mob
if (istype(tool, /obj/item/material/knife/kitchen/cleaver))
Expand Down Expand Up @@ -121,14 +125,25 @@

return ..()

<<<<<<< ours
/mob/living/simple_animal/post_use_item(obj/item/tool, mob/living/user, interaction_handled, use_call)
=======
/mob/living/simple_animal/post_use_item(obj/item/tool, mob/living/user, interaction_handled, use_call, click_params)
>>>>>>> theirs
if (interaction_handled && ai_holder && (use_call == "attack" || use_call == "weapon"))
ai_holder.react_to_attack(user)
..()

<<<<<<< ours

/mob/living/simple_animal/hit_with_weapon(obj/item/O, mob/living/user, effective_force, hit_zone)
if(O.force <= resistance)
=======
/mob/living/simple_animal/hit_with_weapon(obj/item/O, mob/living/user, effective_force, hit_zone)

visible_message(SPAN_DANGER("\The [src] has been attacked with \the [O] by [user]!"))
if (O.force <= resistance)
>>>>>>> theirs
to_chat(user, SPAN_DANGER("This weapon is ineffective; it does no damage."))
return FALSE

Expand All @@ -143,6 +158,11 @@
adjustBruteLoss(damage)
if (O.edge || O.sharp)
adjustBleedTicks(damage)
<<<<<<< ours
=======
if (ai_holder)
ai_holder.react_to_attack(user)
>>>>>>> theirs
return TRUE

/mob/living/simple_animal/proc/reflect_unarmed_damage(mob/living/carbon/human/attacker, damage_type, description)
Expand Down

0 comments on commit 783321e

Please sign in to comment.