mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
[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:
@@ -288,3 +288,12 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
|
||||
|
||||
/// Proceed with the attack chain, but don't call the normal methods.
|
||||
#define SECONDARY_ATTACK_CONTINUE_CHAIN 3
|
||||
|
||||
/// Martial arts attack requested but is not available, allow a check for a regular attack.
|
||||
#define MARTIAL_ATTACK_INVALID -1
|
||||
|
||||
/// Martial arts attack happened but failed, do not allow a check for a regular attack.
|
||||
#define MARTIAL_ATTACK_FAIL FALSE
|
||||
|
||||
/// Martial arts attack happened and succeeded, do not allow a check for a regular attack.
|
||||
#define MARTIAL_ATTACK_SUCCESS TRUE
|
||||
|
||||
@@ -330,6 +330,14 @@
|
||||
if(istype(ML))
|
||||
ML.pulled(src)
|
||||
|
||||
/mob/living/CtrlClick(mob/user)
|
||||
if (isliving(user))
|
||||
var/mob/living/user_living = user
|
||||
if (user_living.apply_martial_art(src, null, is_grab=TRUE) == MARTIAL_ATTACK_SUCCESS)
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
/mob/living/carbon/human/CtrlClick(mob/user)
|
||||
if(ishuman(user) && Adjacent(user) && !user.incapacitated())
|
||||
if(world.time < user.next_move)
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
var/timerid
|
||||
|
||||
/datum/martial_art/proc/help_act(mob/living/A, mob/living/D)
|
||||
return FALSE
|
||||
return MARTIAL_ATTACK_INVALID
|
||||
|
||||
/datum/martial_art/proc/disarm_act(mob/living/A, mob/living/D)
|
||||
return FALSE
|
||||
return MARTIAL_ATTACK_INVALID
|
||||
|
||||
/datum/martial_art/proc/harm_act(mob/living/A, mob/living/D)
|
||||
return FALSE
|
||||
return MARTIAL_ATTACK_INVALID
|
||||
|
||||
/datum/martial_art/proc/grab_act(mob/living/A, mob/living/D)
|
||||
return FALSE
|
||||
return MARTIAL_ATTACK_INVALID
|
||||
|
||||
/datum/martial_art/proc/can_use(mob/living/L)
|
||||
return TRUE
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user