Martial arts now use a weight system to determine which one is active (#21037)

* martial arts have a weight system now

* remove unneeded variable

* carp cannot be deactivated once learned

* i love documentingtation

* krav can no longer delete other combos

* now ill be embarassed if i dont make it better

* i know how istype works i promise

* implement sirryan's changes

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
BiancaWilkson
2023-06-03 01:24:42 -04:00
committed by GitHub
parent 30cd47b94a
commit edef576f2e
11 changed files with 45 additions and 19 deletions
+1
View File
@@ -2,6 +2,7 @@
name = "Way of the Dancing Admin"
has_explaination_verb = TRUE
combos = list(/datum/martial_combo/adminfu/healing_palm)
weight = 99999999 //Matt Malvor?
/datum/martial_art/adminfu/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
MARTIAL_ARTS_ACT_CHECK
+2
View File
@@ -1,5 +1,6 @@
/datum/martial_art/boxing
name = "Boxing"
weight = 1
/datum/martial_art/boxing/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
to_chat(A, "<span class='warning'>Can't disarm while boxing!</span>")
@@ -43,6 +44,7 @@
/datum/martial_art/drunk_brawling
name = "Drunken Brawling"
weight = 2
/datum/martial_art/drunk_brawling/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(prob(70))
+3
View File
@@ -1,5 +1,6 @@
/datum/martial_art/cqc
name = "CQC"
weight = 6
has_explaination_verb = TRUE
can_parry = TRUE
combos = list(/datum/martial_combo/cqc/slam, /datum/martial_combo/cqc/kick, /datum/martial_combo/cqc/restrain, /datum/martial_combo/cqc/pressure, /datum/martial_combo/cqc/consecutive)
@@ -26,8 +27,10 @@
for(var/obj/item/slapper/parry/smacking_hand in held_items)
qdel(smacking_hand)
can_parry = FALSE
weight = 0
else
can_parry = TRUE
weight = 5
/datum/martial_art/cqc/under_siege/can_use(mob/living/carbon/human/H)
var/area/A = get_area(H)
+1
View File
@@ -1,5 +1,6 @@
/datum/martial_art/grav_stomp
name = "Gravitational Boots"
weight = 4
/datum/martial_art/grav_stomp/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
MARTIAL_ARTS_ACT_CHECK
+13 -3
View File
@@ -1,5 +1,6 @@
/datum/martial_art/krav_maga
name = "Krav Maga"
weight = 7 //Higher weight, since you can choose to put on or take off the gloves
var/datum/action/neck_chop/neckchop = new/datum/action/neck_chop()
var/datum/action/leg_sweep/legsweep = new/datum/action/leg_sweep()
var/datum/action/lung_punch/lungpunch = new/datum/action/lung_punch()
@@ -24,12 +25,15 @@
button_icon_state = "neckchop"
/datum/action/neck_chop/Trigger()
var/mob/living/carbon/human/H = owner //This is a janky solution, but I want to refactor krav anyway and un-jank this (written in may 2023)
if(!istype(H.mind.martial_art, /datum/martial_art/krav_maga))
to_chat(owner, "<span class='warning'>You don't know how to do that right now.</span>")
return
if(owner.incapacitated())
to_chat(owner, "<span class='warning'>You can't use Krav Maga while you're incapacitated.</span>")
return
to_chat(owner, "<b><i>Your next attack will be a Neck Chop.</i></b>")
owner.visible_message("<span class='danger'>[owner] assumes the Neck Chop stance!</span>")
var/mob/living/carbon/human/H = owner
H.mind.martial_art.combos.Cut()
H.mind.martial_art.combos.Add(/datum/martial_combo/krav_maga/neck_chop)
H.mind.martial_art.reset_combos()
@@ -39,6 +43,10 @@
button_icon_state = "legsweep"
/datum/action/leg_sweep/Trigger()
var/mob/living/carbon/human/H = owner
if(!istype(H.mind.martial_art, /datum/martial_art/krav_maga))
to_chat(owner, "<span class='warning'>You don't know how to do that right now.</span>")
return
if(owner.incapacitated())
to_chat(owner, "<span class='warning'>You can't use Krav Maga while you're incapacitated.</span>")
return
@@ -47,7 +55,6 @@
return
to_chat(owner, "<b><i>Your next attack will be a Leg Sweep.</i></b>")
owner.visible_message("<span class='danger'>[owner] assumes the Leg Sweep stance!</span>")
var/mob/living/carbon/human/H = owner
H.mind.martial_art.combos.Cut()
H.mind.martial_art.combos.Add(/datum/martial_combo/krav_maga/leg_sweep)
H.mind.martial_art.reset_combos()
@@ -58,12 +65,15 @@
button_icon_state = "lungpunch"
/datum/action/lung_punch/Trigger()
var/mob/living/carbon/human/H = owner
if(!istype(H.mind.martial_art, /datum/martial_art/krav_maga))
to_chat(owner, "<span class='warning'>You don't know how to do that right now.</span>")
return
if(owner.incapacitated())
to_chat(owner, "<span class='warning'>You can't use Krav Maga while you're incapacitated.</span>")
return
to_chat(owner, "<b><i>Your next attack will be a Lung Punch.</i></b>")
owner.visible_message("<span class='danger'>[owner] assumes the Lung Punch stance!</span>")
var/mob/living/carbon/human/H = owner
H.mind.martial_art.combos.Cut()
H.mind.martial_art.combos.Add(/datum/martial_combo/krav_maga/lung_punch)
H.mind.martial_art.reset_combos()
+20 -16
View File
@@ -33,6 +33,8 @@
var/in_stance = FALSE
/// If the martial art allows parrying.
var/can_parry = FALSE
/// The priority of which martial art is picked from all the ones someone knows, the higher the number, the higher the priority.
var/weight = 0
/datum/martial_art/New()
. = ..()
@@ -136,27 +138,29 @@
/datum/martial_art/proc/teach(mob/living/carbon/human/H, make_temporary = FALSE)
if(!H.mind)
return
for(var/datum/martial_art/MA in H.mind.known_martial_arts)
if(istype(MA, src))
return
if(has_explaination_verb)
H.verbs |= /mob/living/carbon/human/proc/martial_arts_help
if(make_temporary)
temporary = TRUE
if(temporary)
if(H.mind.martial_art)
base = H.mind.martial_art.base
else
base = src
H.mind.martial_art = src
H.mind.known_martial_arts.Add(src)
H.mind.martial_art = get_highest_weight(H)
/datum/martial_art/proc/remove(mob/living/carbon/human/H)
var/datum/martial_art/MA = src
if(!H.mind)
return
if(H.mind.martial_art != src)
return
H.mind.martial_art = null // Remove reference
H.mind.known_martial_arts.Remove(MA)
H.mind.martial_art = get_highest_weight(H)
H.verbs -= /mob/living/carbon/human/proc/martial_arts_help
if(base)
base.teach(H)
base = null
/// Returns the martial art with the highest weight from all the ones someone knows.
/datum/martial_art/proc/get_highest_weight(mob/living/carbon/human/H)
var/datum/martial_art/highest_weight = null
for(var/datum/martial_art/MA in H.mind.known_martial_arts)
if(!highest_weight || MA.weight > highest_weight.weight)
highest_weight = MA
return highest_weight
/mob/living/carbon/human/proc/martial_arts_help()
set name = "Show Info"
@@ -220,7 +224,7 @@
return
if(slot == slot_gloves)
var/mob/living/carbon/human/H = user
style.teach(H,1)
style.teach(H, TRUE)
return
/obj/item/clothing/gloves/boxing/dropped(mob/user)
@@ -243,7 +247,7 @@
if(HAS_TRAIT(user, TRAIT_PACIFISM))
to_chat(user, "<span class='warning'>In spite of the grandiosity of the belt, you don't feel like getting into any fights.</span>")
return
style.teach(H,1)
style.teach(H, TRUE)
to_chat(user, "<span class='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 Recall teaching verb in the wrestling tab.</span>")
return
+1
View File
@@ -1,5 +1,6 @@
/datum/martial_art/mimejutsu
name = "Mimejutsu"
weight = 6
has_explaination_verb = TRUE
combos = list(/datum/martial_combo/mimejutsu/mimechucks, /datum/martial_combo/mimejutsu/smokebomb, /datum/martial_combo/mimejutsu/silent_palm)
+1
View File
@@ -1,5 +1,6 @@
/datum/martial_art/plasma_fist
name = "Plasma Fist"
weight = 6
combos = list(/datum/martial_combo/plasma_fist/tornado_sweep, /datum/martial_combo/plasma_fist/throwback, /datum/martial_combo/plasma_fist/plasma_fist)
has_explaination_verb = TRUE
@@ -1,5 +1,6 @@
//Used by the gang of the same name. Uses combos. Basic attacks bypass armor and never miss
/datum/martial_art/the_sleeping_carp
weight = 8
name = "The Sleeping Carp"
deflection_chance = 100
reroute_deflection = TRUE
+1
View File
@@ -1,5 +1,6 @@
/datum/martial_art/wrestling
name = "Wrestling"
weight = 3
help_verb = /mob/living/carbon/human/proc/wrestling_help
// combo refence since wrestling uses a different format to sleeping carp and plasma fist.