From adffd8ed5b2f6678401293fd1020ec53b3331d1b Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 28 Aug 2026 23:41:41 +0000 Subject: [PATCH] Migrate martial arts to the new attack chain and same files. (#32402) * Migrate martial arts to the new attack chain and same files. * Apply suggestions from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan * Apply suggestions from code review. Co-authored-by: warriorstar-orion Signed-off-by: Alan --------- Signed-off-by: Alan Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Co-authored-by: warriorstar-orion --- code/modules/martial_arts/adminfu.dm | 24 ++-- code/modules/martial_arts/cqc.dm | 61 ++++++++++ code/modules/martial_arts/martial.dm | 128 --------------------- code/modules/martial_arts/mimejutsu.dm | 23 ++-- code/modules/martial_arts/plasma_fist.dm | 20 ++++ code/modules/martial_arts/sleeping_carp.dm | 34 ++++++ code/modules/martial_arts/wrestling.dm | 30 +++++ 7 files changed, 168 insertions(+), 152 deletions(-) diff --git a/code/modules/martial_arts/adminfu.dm b/code/modules/martial_arts/adminfu.dm index da0351a7c83..913c5638ff8 100644 --- a/code/modules/martial_arts/adminfu.dm +++ b/code/modules/martial_arts/adminfu.dm @@ -42,17 +42,17 @@ desc = "An aged and frayed scrap of paper written in shifting runes. There are hand-drawn illustrations of pugilism." icon = 'icons/obj/wizard.dmi' icon_state ="scroll2" - var/used = FALSE + new_attack_chain = TRUE -/obj/item/adminfu_scroll/attack_self__legacy__attackchain(mob/user as mob) +/obj/item/adminfu_scroll/activate_self(mob/living/carbon/human/user) if(!ishuman(user)) - return - if(!used) - var/mob/living/carbon/human/H = user - var/datum/martial_art/adminfu/F = new/datum/martial_art/adminfu(null) - F.teach(H) - to_chat(H, SPAN_BOLDANNOUNCEIC("You have learned the ancient martial art of the Admins.")) - used = TRUE - desc = "It's completely blank." - name = "empty scroll" - icon_state = "blankscroll" + return ..() + + var/datum/martial_art/adminfu/F = new/datum/martial_art/adminfu(null) + F.teach(user) + to_chat(user, SPAN_BOLDANNOUNCEIC("You have learned the ancient martial art of the Admins.")) + user.drop_item_to_ground(src, TRUE) + visible_message(SPAN_WARNING("You eat [src] to ensure that no-one else can access its power!")) + playsound(loc, 'sound/items/eatfood.ogg', 50, 0) + qdel(src) + return ITEM_INTERACT_COMPLETE diff --git a/code/modules/martial_arts/cqc.dm b/code/modules/martial_arts/cqc.dm index 9b04ee43b9e..3249d4b7281 100644 --- a/code/modules/martial_arts/cqc.dm +++ b/code/modules/martial_arts/cqc.dm @@ -144,3 +144,64 @@ /datum/martial_art/cqc/explaination_footer(user) to_chat(user, "Your slaps hit considerably harder, and allow you to parry incoming melee attacks.") + +/obj/item/cqc_manual + name = "old manual" + desc = "A small, black manual. There are drawn instructions of tactical hand-to-hand combat." + icon = 'icons/obj/library.dmi' + icon_state = "cqcmanual" + new_attack_chain = TRUE + +/obj/item/cqc_manual/activate_self(mob/living/carbon/human/user) + if(!istype(user)) + return ..() + + if(!user.mind) + return ITEM_INTERACT_COMPLETE + + if(IS_CHANGELING(user) || IS_MINDFLAYER(user)) + to_chat(user, SPAN_WARNING("We try multiple times, but we simply cannot grasp the basics of CQC!")) + return ITEM_INTERACT_COMPLETE + + if(user.mind.has_antag_datum(/datum/antagonist/vampire)) + to_chat(user, SPAN_WARNING("Your blood lust distracts you from the basics of CQC!")) + return ITEM_INTERACT_COMPLETE + + if(IS_HERETIC(user)) + to_chat(user, SPAN_HIEROPHANT_WARNING("The mansus remembers the basics of CQC. You do not need to.")) + return ITEM_INTERACT_COMPLETE + + if(HAS_TRAIT(user, TRAIT_PACIFISM)) + to_chat(user, SPAN_WARNING("The mere thought of combat, let alone CQC, makes your head spin!")) + return ITEM_INTERACT_COMPLETE + + to_chat(user, SPAN_BOLDANNOUNCEIC("You remember the basics of CQC.")) + var/datum/martial_art/cqc/CQC = new(null) + CQC.teach(user) + user.drop_item_to_ground(src, TRUE) + visible_message(SPAN_WARNING("[src] beeps ominously, and a moment later it bursts up in flames.")) + new /obj/effect/decal/cleanable/ash(get_turf(src)) + qdel(src) + return ITEM_INTERACT_COMPLETE + +/datum/action/defensive_stance + name = "Defensive Stance - Ready yourself to be attacked, allowing you to parry incoming melee hits." + button_icon_state = "block" + +/datum/action/defensive_stance/Trigger(left_click) + var/mob/living/carbon/human/H = owner + var/datum/martial_art/MA = H.mind.martial_art // This should never be available to non-martial-arts users anyway. + if(!MA.can_parry) + to_chat(H, SPAN_WARNING("You can't parry right now!")) + return + if(H.incapacitated()) + to_chat(H, SPAN_WARNING("You can't defend yourself while you're incapacitated!")) + return + var/obj/item/slapper/parry/slap = new(H) + if(H.put_in_hands(slap)) + H.visible_message( + SPAN_DANGER("[H] assumes a defensive stance!"), + SPAN_NOTICE("You drop back into a defensive stance.") + ) + else + to_chat(H, SPAN_WARNING("Your hands are full!")) diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm index fcdfe8033a6..6e697e8088b 100644 --- a/code/modules/martial_arts/martial.dm +++ b/code/modules/martial_arts/martial.dm @@ -242,134 +242,6 @@ if(MARTIAL_COMBO_STEP_HELP) return "H" -/datum/action/defensive_stance - name = "Defensive Stance - Ready yourself to be attacked, allowing you to parry incoming melee hits." - button_icon_state = "block" - -/datum/action/defensive_stance/Trigger(left_click) - var/mob/living/carbon/human/H = owner - var/datum/martial_art/MA = H.mind.martial_art //This should never be available to non-martial-arts users anyway - if(!MA.can_parry) - to_chat(H, SPAN_WARNING("You can't parry right now.")) - return - if(H.incapacitated()) - to_chat(H, SPAN_WARNING("You can't defend yourself while you're incapacitated.")) - return - var/obj/item/slapper/parry/slap = new(H) - if(H.put_in_hands(slap)) - H.visible_message(SPAN_DANGER("[H] assumes a defensive stance!"), "You drop back into a defensive stance.") - else - to_chat(H, SPAN_WARNING("Your hands are full.")) - -/obj/item/storage/belt/champion/wrestling - name = "Wrestling Belt" - layer_over_suit = TRUE - var/datum/martial_art/wrestling/style - -/obj/item/storage/belt/champion/wrestling/Initialize(mapload) - . = ..() - style = new() - -/obj/item/storage/belt/champion/wrestling/equipped(mob/user, slot) - if(!ishuman(user)) - return - if(slot == ITEM_SLOT_BELT) - var/mob/living/carbon/human/H = user - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, SPAN_WARNING("In spite of the grandiosity of the belt, you don't feel like getting into any fights.")) - return - style.teach(H, TRUE) - to_chat(user, SPAN_SCIRADIO("You have an urge to flex your muscles and get into a fight. You have the knowledge of a thousand wrestlers before you. You can remember more by using the verb in the martial arts tab.")) - return - -/obj/item/storage/belt/champion/wrestling/dropped(mob/user) - ..() - if(!ishuman(user)) - return - var/mob/living/carbon/human/H = user - if(H.get_item_by_slot(ITEM_SLOT_BELT) == src) - style.remove(H) - to_chat(user, SPAN_SCIRADIO("You no longer have an urge to flex your muscles.")) - -/obj/item/plasma_fist_scroll - name = "frayed scroll" - desc = "An aged and frayed scrap of paper written in shifting runes. There are hand-drawn illustrations of pugilism." - icon = 'icons/obj/wizard.dmi' - icon_state ="scroll2" - var/used = FALSE - -/obj/item/plasma_fist_scroll/attack_self__legacy__attackchain(mob/user as mob) - if(!ishuman(user)) - return - - if(!used) - var/mob/living/carbon/human/H = user - var/datum/martial_art/plasma_fist/F = new/datum/martial_art/plasma_fist(null) - F.teach(H) - to_chat(H, SPAN_BOLDANNOUNCEIC("You have learned the ancient martial art of Plasma Fist.")) - used = TRUE - desc = "It's completely blank." - name = "empty scroll" - icon_state = "blankscroll" - -/obj/item/sleeping_carp_scroll - name = "mysterious scroll" - desc = "A scroll filled with strange markings. It seems to be drawings of some sort of martial art." - icon = 'icons/obj/wizard.dmi' - icon_state = "scroll2" - -/obj/item/sleeping_carp_scroll/attack_self__legacy__attackchain(mob/living/carbon/human/user as mob) - if(!istype(user) || !user) - return - if(user.mind) //Prevents changelings and vampires from being able to learn it - if(IS_CHANGELING(user) || IS_MINDFLAYER(user)) - to_chat(user, "We try multiple times, but we are not able to comprehend the contents of the scroll!") - return - else if(user.mind.has_antag_datum(/datum/antagonist/vampire)) //Vampires - to_chat(user, "Your blood lust distracts you too much to be able to concentrate on the contents of the scroll!") - return - else if(IS_HERETIC(user)) - to_chat(user, SPAN_HIEROPHANT_WARNING("You and everyone else are already dreaming. You need to wake up, not sleep more...")) - return - - var/datum/martial_art/the_sleeping_carp/theSleepingCarp = new(null) - theSleepingCarp.teach(user) - user.drop_item() - visible_message(SPAN_WARNING("[src] lights up in fire and quickly burns to ash.")) - new /obj/effect/decal/cleanable/ash(get_turf(src)) - qdel(src) - -/obj/item/cqc_manual - name = "old manual" - desc = "A small, black manual. There are drawn instructions of tactical hand-to-hand combat." - icon = 'icons/obj/library.dmi' - icon_state = "cqcmanual" - -/obj/item/cqc_manual/attack_self__legacy__attackchain(mob/living/carbon/human/user) - if(!istype(user) || !user) - return - if(user.mind) //Prevents changelings and vampires from being able to learn it - if(IS_CHANGELING(user) || IS_MINDFLAYER(user)) - to_chat(user, SPAN_WARNING("We try multiple times, but we simply cannot grasp the basics of CQC!")) - return - else if(user.mind.has_antag_datum(/datum/antagonist/vampire)) //Vampires - to_chat(user, SPAN_WARNING("Your blood lust distracts you from the basics of CQC!")) - return - else if(IS_HERETIC(user)) - to_chat(user, SPAN_HIEROPHANT_WARNING("The mansus remembers the basics of CQC. You do not need to.")) - return - else if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, SPAN_WARNING("The mere thought of combat, let alone CQC, makes your head spin!")) - return - - to_chat(user, SPAN_BOLDANNOUNCEIC("You remember the basics of CQC.")) - var/datum/martial_art/cqc/CQC = new(null) - CQC.teach(user) - user.drop_item() - visible_message(SPAN_WARNING("[src] beeps ominously, and a moment later it bursts up in flames.")) - new /obj/effect/decal/cleanable/ash(get_turf(src)) - qdel(src) - /atom/movable/screen/combo icon_state = "" mouse_opacity = MOUSE_OPACITY_TRANSPARENT diff --git a/code/modules/martial_arts/mimejutsu.dm b/code/modules/martial_arts/mimejutsu.dm index 1e78d1a4f06..2d3ef8c4fbd 100644 --- a/code/modules/martial_arts/mimejutsu.dm +++ b/code/modules/martial_arts/mimejutsu.dm @@ -18,20 +18,19 @@ desc = "Its a beret with a note stapled to it..." icon = 'icons/obj/clothing/head/beret.dmi' icon_state = "beret" - var/used = FALSE + new_attack_chain = TRUE -/obj/item/mimejutsu_scroll/attack_self__legacy__attackchain(mob/user as mob) +/obj/item/mimejutsu_scroll/activate_self(mob/living/carbon/human/user) if(!ishuman(user)) - return - if(!used) - var/mob/living/carbon/human/H = user - var/datum/martial_art/mimejutsu/F = new/datum/martial_art/mimejutsu(null) - F.teach(H) - to_chat(H, SPAN_BOLDANNOUNCEIC("You have learned the ancient martial art of mimes.")) - used = TRUE - desc = "It used to have something stapled to it..the staple is still there." - name = "beret with staple" - icon_state = "beret" + return ..() + + var/datum/martial_art/mimejutsu/F = new/datum/martial_art/mimejutsu(null) + F.teach(user) + to_chat(user, SPAN_BOLDANNOUNCEIC("You have learned the ancient martial art of mimes.")) + user.drop_item_to_ground(src, TRUE) + visible_message(SPAN_WARNING("[src] suddenly bursts into a silent inferno before turning into a pile of invisible ash!")) + qdel(src) + return ITEM_INTERACT_COMPLETE /datum/martial_art/mimejutsu/explaination_header(user) to_chat(user, "You make a invisible box around yourself and recall the teachings of Mimejutsu...") diff --git a/code/modules/martial_arts/plasma_fist.dm b/code/modules/martial_arts/plasma_fist.dm index fb7efce42a4..1a95fe5c8ae 100644 --- a/code/modules/martial_arts/plasma_fist.dm +++ b/code/modules/martial_arts/plasma_fist.dm @@ -21,3 +21,23 @@ /datum/martial_art/plasma_fist/explaination_header(user) to_chat(user, "You clench your fists and have a flashback of knowledge...") + +/obj/item/plasma_fist_scroll + name = "frayed scroll" + desc = "An aged and frayed scrap of paper written in shifting runes. There are hand-drawn illustrations of pugilism." + icon = 'icons/obj/wizard.dmi' + icon_state ="scroll2" + new_attack_chain = TRUE + +/obj/item/plasma_fist_scroll/activate_self(mob/living/carbon/human/user) + if(!ishuman(user)) + return ..() + + var/datum/martial_art/plasma_fist/F = new/datum/martial_art/plasma_fist(null) + F.teach(user) + to_chat(user, SPAN_BOLDANNOUNCEIC("You have learned the ancient martial art of Plasma Fist.")) + user.drop_item_to_ground(src, TRUE) + visible_message(SPAN_WARNING("[src] crumbles to dust!")) + new /obj/effect/decal/cleanable/ash(get_turf(src)) + qdel(src) + return ITEM_INTERACT_COMPLETE diff --git a/code/modules/martial_arts/sleeping_carp.dm b/code/modules/martial_arts/sleeping_carp.dm index acbff34bc34..ae9a365fd91 100644 --- a/code/modules/martial_arts/sleeping_carp.dm +++ b/code/modules/martial_arts/sleeping_carp.dm @@ -45,3 +45,37 @@ /datum/martial_art/the_sleeping_carp/try_deflect(mob/user) return user.in_throw_mode && ..() // in case an admin wants to var edit carp to have less deflection chance + +/obj/item/sleeping_carp_scroll + name = "mysterious scroll" + desc = "A scroll filled with strange markings. It seems to be drawings of some sort of martial art." + icon = 'icons/obj/wizard.dmi' + icon_state = "scroll2" + new_attack_chain = TRUE + +/obj/item/sleeping_carp_scroll/activate_self(mob/living/carbon/human/user) + if(!istype(user)) + return ..() + + if(!user.mind) + return ITEM_INTERACT_COMPLETE + + if(IS_CHANGELING(user) || IS_MINDFLAYER(user)) + to_chat(user, SPAN_WARNING("We try multiple times, but we are not able to comprehend the contents of the scroll!")) + return ITEM_INTERACT_COMPLETE + + if(user.mind.has_antag_datum(/datum/antagonist/vampire)) + to_chat(user, SPAN_WARNING("Your blood lust distracts you too much to be able to concentrate on the contents of the scroll!")) + return ITEM_INTERACT_COMPLETE + + if(IS_HERETIC(user)) + to_chat(user, SPAN_HIEROPHANT_WARNING("You and everyone else are already dreaming. You need to wake up, not sleep more...")) + return ITEM_INTERACT_COMPLETE + + var/datum/martial_art/the_sleeping_carp/theSleepingCarp = new(null) + theSleepingCarp.teach(user) + user.drop_item_to_ground(src, TRUE) + visible_message(SPAN_WARNING("[src] lights up in fire and quickly burns to ash.")) + new /obj/effect/decal/cleanable/ash(get_turf(src)) + qdel(src) + return ITEM_INTERACT_COMPLETE diff --git a/code/modules/martial_arts/wrestling.dm b/code/modules/martial_arts/wrestling.dm index 0b60fd2a283..ae3d95f92be 100644 --- a/code/modules/martial_arts/wrestling.dm +++ b/code/modules/martial_arts/wrestling.dm @@ -66,3 +66,33 @@ to_chat(user, "[SPAN_NOTICE("Clinch")]: Grab. Passively gives you a chance to immediately aggressively grab someone. Not always successful.") to_chat(user, "[SPAN_NOTICE("Suplex")]: Disarm someone you are grabbing. Suplexes your target to the floor. Greatly injures them and leaves both you and your target on the floor.") to_chat(user, "[SPAN_NOTICE("Advanced grab")]: Grab. Passively causes stamina damage when grabbing someone.") + +/obj/item/storage/belt/champion/wrestling + name = "Wrestling Belt" + layer_over_suit = TRUE + var/datum/martial_art/wrestling/style + +/obj/item/storage/belt/champion/wrestling/Initialize(mapload) + . = ..() + style = new() + +/obj/item/storage/belt/champion/wrestling/equipped(mob/user, slot) + if(!ishuman(user)) + return + if(slot == ITEM_SLOT_BELT) + var/mob/living/carbon/human/H = user + if(HAS_TRAIT(user, TRAIT_PACIFISM)) + to_chat(user, SPAN_WARNING("In spite of the grandiosity of the belt, you don't feel like getting into any fights.")) + return + style.teach(H, TRUE) + to_chat(user, SPAN_SCIRADIO("You have an urge to flex your muscles and get into a fight. You have the knowledge of a thousand wrestlers before you. You can remember more by using the verb in the martial arts tab.")) + return + +/obj/item/storage/belt/champion/wrestling/dropped(mob/user) + ..() + if(!ishuman(user)) + return + var/mob/living/carbon/human/H = user + if(H.get_item_by_slot(ITEM_SLOT_BELT) == src) + style.remove(H) + to_chat(user, SPAN_SCIRADIO("You no longer have an urge to flex your muscles."))