Files
GS13NG/code/datums/martial/_martial.dm
2020-03-10 20:09:31 +11:00

79 lines
3.1 KiB
Plaintext

/datum/martial_art
var/name = "Martial Art"
var/streak = ""
var/max_streak_length = 6
var/id = "" //ID, used by mind/has_martialartcode\game\objects\items\granters.dm:345:error: user.mind.has_martialart: undefined proccode\game\objects\items\granters.dm:345:error: user.mind.has_martialart: undefined proccode\game\objects\items\granters.dm:345:error: user.mind.has_martialart: undefined proccode\game\objects\items\granters.dm:345:error: user.mind.has_martialart: undefined proccode\game\objects\items\granters.dm:345:error: user.mind.has_martialart: undefined proc
var/current_target
var/datum/martial_art/base // The permanent style. This will be null unless the martial art is temporary
var/block_chance = 0 //Chance to block melee attacks using items while on throw mode.
var/restraining = 0 //used in cqc's disarm_act to check if the disarmed is being restrained and so whether they should be put in a chokehold or not
var/help_verb
var/pacifism_check = TRUE //are the martial arts combos/attacks unable to be used by pacifist.
var/allow_temp_override = TRUE //if this martial art can be overridden by temporary martial arts
/datum/martial_art/proc/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
return FALSE
/datum/martial_art/proc/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
return FALSE
/datum/martial_art/proc/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
return FALSE
/datum/martial_art/proc/can_use(mob/living/carbon/human/H)
return TRUE
/datum/martial_art/proc/add_to_streak(element,mob/living/carbon/human/D)
if(D != current_target)
reset_streak(D)
streak = streak+element
if(length(streak) > max_streak_length)
streak = copytext(streak, 1 + length(streak[1]))
return
/datum/martial_art/proc/reset_streak(mob/living/carbon/human/new_target)
current_target = new_target
streak = ""
/datum/martial_art/proc/teach(mob/living/carbon/human/H, make_temporary = FALSE)
if(!istype(H) || !H.mind)
return FALSE
if(H.mind.martial_art)
if(make_temporary)
if(!H.mind.martial_art.allow_temp_override)
return FALSE
store(H.mind.martial_art,H)
else
H.mind.martial_art.on_remove(H)
else if(make_temporary)
base = H.mind.default_martial_art
if(help_verb)
H.verbs += help_verb
H.mind.martial_art = src
return TRUE
/datum/martial_art/proc/store(datum/martial_art/M,mob/living/carbon/human/H)
M.on_remove(H)
if(M.base) //Checks if M is temporary, if so it will not be stored.
base = M.base
else //Otherwise, M is stored.
base = M
/datum/martial_art/proc/remove(mob/living/carbon/human/H)
if(!istype(H) || !H.mind || H.mind.martial_art != src)
return
on_remove(H)
if(base)
base.teach(H)
else
var/datum/martial_art/X = H.mind.default_martial_art
X.teach(H)
/datum/martial_art/proc/on_remove(mob/living/carbon/human/H)
if(help_verb)
H.verbs -= help_verb
return
///Gets called when a projectile hits the owner. Returning anything other than BULLET_ACT_HIT will stop the projectile from hitting the mob.
/datum/martial_art/proc/on_projectile_hit(mob/living/carbon/human/A, obj/item/projectile/P, def_zone)
return BULLET_ACT_HIT