[MIRROR] MMA (#2808)

* Monkey Martial Arts (#55583)

Moves martial arts to mob/living and lets monkeys use them.

Monkeys have got arms so they should be able to do cool martial arts.

* MMA

Co-authored-by: Jack LeCroy <3073035+jacklecroy@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-01-21 04:37:54 +00:00
committed by GitHub
co-authored by Jack LeCroy
parent 92f84ad44e
commit 72b2b5de0e
18 changed files with 287 additions and 223 deletions
+8
View File
@@ -1337,5 +1337,13 @@
return ..()
/mob/living/carbon/get_attack_type()
var/datum/species/species = dna?.species
if (species)
return species.attack_type
return ..()
/mob/living/carbon/proc/attach_rot(mapload)
AddComponent(/datum/component/rot/corpse)
@@ -165,6 +165,9 @@
if(W.try_handling(user))
return TRUE
if (user.apply_martial_art(src))
return TRUE
return FALSE
+32
View File
@@ -1902,3 +1902,35 @@
/mob/living/proc/on_handsblocked_end()
REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_HANDS_BLOCKED)
REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED)
/// Returns the attack damage type of a living mob such as [BRUTE].
/mob/living/proc/get_attack_type()
return BRUTE
/**
* Apply a martial art move from src to target.
*
* This is used to process martial art attacks against nonhumans.
* 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)
if(HAS_TRAIT(target, TRAIT_MARTIAL_ARTS_IMMUNE))
return FALSE
var/datum/martial_art/style = mind?.martial_art
var/attack_result = FALSE
if (style)
switch (a_intent)
if (INTENT_GRAB)
attack_result = style.grab_act(src, target)
if (INTENT_HARM)
if (HAS_TRAIT(src, TRAIT_PACIFISM))
return FALSE
attack_result = style.harm_act(src, target)
if (INTENT_DISARM)
attack_result = style.disarm_act(src, target)
if (INTENT_HELP)
attack_result = style.help_act(src, target)
return attack_result
+33 -18
View File
@@ -223,32 +223,47 @@
log_combat(M, src, "attacked")
return TRUE
/mob/living/attack_hand(mob/living/carbon/human/user)
. = ..()
if (user.apply_martial_art(src))
return TRUE
/mob/living/attack_paw(mob/living/carbon/human/M)
if(isturf(loc) && istype(loc.loc, /area/start))
to_chat(M, "No attacking people at spawn, you jackass.")
return FALSE
if (M.a_intent == INTENT_HARM)
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "<span class='warning'>You don't want to hurt anyone!</span>")
return FALSE
if (M.apply_martial_art(src))
return TRUE
if(M.is_muzzled() || M.is_mouth_covered(FALSE, TRUE))
to_chat(M, "<span class='warning'>You can't bite with your mouth covered!</span>")
switch (M.a_intent)
if (INTENT_HARM)
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "<span class='warning'>You don't want to hurt anyone!</span>")
return FALSE
if(M.is_muzzled() || M.is_mouth_covered(FALSE, TRUE))
to_chat(M, "<span class='warning'>You can't bite with your mouth covered!</span>")
return FALSE
M.do_attack_animation(src, ATTACK_EFFECT_BITE)
if (prob(75))
log_combat(M, src, "attacked")
playsound(loc, 'sound/weapons/bite.ogg', 50, TRUE, -1)
visible_message("<span class='danger'>[M.name] bites [src]!</span>", \
"<span class='userdanger'>[M.name] bites you!</span>", "<span class='hear'>You hear a chomp!</span>", COMBAT_MESSAGE_RANGE, M)
to_chat(M, "<span class='danger'>You bite [src]!</span>")
return TRUE
else
visible_message("<span class='danger'>[M.name]'s bite misses [src]!</span>", \
"<span class='danger'>You avoid [M.name]'s bite!</span>", "<span class='hear'>You hear the sound of jaws snapping shut!</span>", COMBAT_MESSAGE_RANGE, M)
to_chat(M, "<span class='warning'>Your bite misses [src]!</span>")
if (INTENT_GRAB)
grabbedby(M)
return FALSE
M.do_attack_animation(src, ATTACK_EFFECT_BITE)
if (prob(75))
log_combat(M, src, "attacked")
playsound(loc, 'sound/weapons/bite.ogg', 50, TRUE, -1)
visible_message("<span class='danger'>[M.name] bites [src]!</span>", \
"<span class='userdanger'>[M.name] bites you!</span>", "<span class='hear'>You hear a chomp!</span>", COMBAT_MESSAGE_RANGE, M)
to_chat(M, "<span class='danger'>You bite [src]!</span>")
return TRUE
else
visible_message("<span class='danger'>[M.name]'s bite misses [src]!</span>", \
"<span class='danger'>You avoid [M.name]'s bite!</span>", "<span class='hear'>You hear the sound of jaws snapping shut!</span>", COMBAT_MESSAGE_RANGE, M)
to_chat(M, "<span class='warning'>Your bite misses [src]!</span>")
if (INTENT_DISARM)
if (M != src)
M.disarm(src)
return TRUE
return FALSE
/mob/living/attack_larva(mob/living/carbon/alien/larva/L)
@@ -59,6 +59,7 @@
diag_hud_set_health()
add_sensors()
ADD_TRAIT(src, TRAIT_ADVANCEDTOOLUSER, ROUNDSTART_TRAIT)
ADD_TRAIT(src, TRAIT_MARTIAL_ARTS_IMMUNE, ROUNDSTART_TRAIT)
/mob/living/silicon/Destroy()
QDEL_NULL(radio)
@@ -1,7 +1,9 @@
/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M)
..()
// so that martial arts don't double dip
if (..())
return TRUE
switch(M.a_intent)
if("help")
if (stat == DEAD)
@@ -61,6 +61,7 @@
AddComponent(/datum/component/gps, gps_name)
ADD_TRAIT(src, TRAIT_NO_TELEPORT, MEGAFAUNA_TRAIT)
ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_MARTIAL_ARTS_IMMUNE, MEGAFAUNA_TRAIT)
for(var/action_type in attack_action_types)
var/datum/action/innate/megafauna_attack/attack_action = new action_type()
attack_action.Grant(src)