[MIRROR] Fix issues with martial arts attacks not registering (#3979)

* Fix issues with martial arts attacks not registering (#57131)

* Fix issues with martial arts attacks not registering

Co-authored-by: Jack LeCroy <3073035+jacklecroy@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-03-08 01:30:14 +00:00
committed by GitHub
co-authored by Jack LeCroy
parent 6a7b4356fb
commit c3085db1ad
9 changed files with 52 additions and 33 deletions
@@ -52,6 +52,10 @@ In all, this is a lot like the monkey code. /N
if(.) //to allow surgery to return properly.
return FALSE
var/martial_result = user.apply_martial_art(src, modifiers)
if (martial_result != MARTIAL_ATTACK_INVALID)
return martial_result
if(user.combat_mode)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
user.do_attack_animation(src, ATTACK_EFFECT_DISARM)
@@ -176,9 +176,6 @@
if(W.try_handling(user))
return TRUE
if (user.apply_martial_art(src, modifiers))
return TRUE
return FALSE
@@ -219,6 +219,9 @@
if(!affecting)
affecting = get_bodypart(BODY_ZONE_CHEST)
var/martial_result = user.apply_martial_art(src, modifiers)
if (martial_result != MARTIAL_ATTACK_INVALID)
return martial_result
if(LAZYACCESS(modifiers, RIGHT_CLICK)) //Always drop item in hand, if no item, get stunned instead.
var/obj/item/I = get_active_held_item()
@@ -1347,7 +1347,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
"<span class='userdanger'>You block [user]'s grab!</span>", "<span class='hear'>You hear a swoosh!</span>", COMBAT_MESSAGE_RANGE, user)
to_chat(user, "<span class='warning'>Your grab at [target] was blocked!</span>")
return FALSE
if(attacker_style?.grab_act(user,target))
if(attacker_style?.grab_act(user,target) == MARTIAL_ATTACK_SUCCESS)
return TRUE
else
target.grabbedby(user)
@@ -1363,7 +1363,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
"<span class='userdanger'>You block [user]'s attack!</span>", "<span class='hear'>You hear a swoosh!</span>", COMBAT_MESSAGE_RANGE, user)
to_chat(user, "<span class='warning'>Your attack at [target] was blocked!</span>")
return FALSE
if(attacker_style?.harm_act(user,target))
if(attacker_style?.harm_act(user,target) == MARTIAL_ATTACK_SUCCESS)
return TRUE
else
@@ -1447,7 +1447,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
"<span class='danger'>You block [user]'s shove!</span>", "<span class='hear'>You hear a swoosh!</span>", COMBAT_MESSAGE_RANGE, user)
to_chat(user, "<span class='warning'>Your shove at [target] was blocked!</span>")
return FALSE
if(attacker_style?.disarm_act(user,target))
if(attacker_style?.disarm_act(user,target) == MARTIAL_ATTACK_SUCCESS)
return TRUE
if(user.body_position != STANDING_UP)
return FALSE
+14 -19
View File
@@ -1975,24 +1975,19 @@
* It is also used to process martial art attacks by nonhumans, even against humans
* Human vs human attacks are handled in species code right now.
*/
/mob/living/proc/apply_martial_art(mob/living/target, modifiers, is_grab)
/mob/living/proc/apply_martial_art(mob/living/target, modifiers, is_grab = FALSE)
if(HAS_TRAIT(target, TRAIT_MARTIAL_ARTS_IMMUNE))
return FALSE
if(ishuman(target) && ishuman(src)) //Human vs human are handled in species code
return FALSE
return MARTIAL_ATTACK_INVALID
var/datum/martial_art/style = mind?.martial_art
var/attack_result = FALSE
if (style)
if (is_grab)
attack_result = style.grab_act(src, target)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
attack_result = style.disarm_act(src, target)
if(combat_mode)
if (HAS_TRAIT(src, TRAIT_PACIFISM))
return FALSE
attack_result = style.harm_act(src, target)
else
attack_result = style.help_act(src, target)
return attack_result
if (!style)
return MARTIAL_ATTACK_INVALID
// will return boolean below since it's not invalid
if (is_grab)
return style.grab_act(src, target)
if (LAZYACCESS(modifiers, RIGHT_CLICK))
return style.disarm_act(src, target)
if(combat_mode)
if (HAS_TRAIT(src, TRAIT_PACIFISM))
return FALSE
return style.harm_act(src, target)
return style.help_act(src, target)
+7 -4
View File
@@ -254,16 +254,19 @@
/mob/living/attack_hand(mob/living/carbon/human/user, list/modifiers)
. = ..()
if (user.apply_martial_art(src, modifiers))
return TRUE
var/martial_result = user.apply_martial_art(src, modifiers)
if (martial_result != MARTIAL_ATTACK_INVALID)
return martial_result
/mob/living/attack_paw(mob/living/carbon/human/user, list/modifiers)
if(isturf(loc) && istype(loc.loc, /area/start))
to_chat(user, "No attacking people at spawn, you jackass.")
return FALSE
if (user.apply_martial_art(src, modifiers))
return TRUE
var/martial_result = user.apply_martial_art(src, modifiers)
if (martial_result != MARTIAL_ATTACK_INVALID)
return martial_result
if(LAZYACCESS(modifiers, RIGHT_CLICK))
if (user != src)
user.disarm(src)