2029163d33
About The Pull Request Converts every single usage of playsound's vary parameter to use the boolean define instead of 1 or 0. I'm tired of people copypasting the incorrect usage. Also changes a couple of places where a list was picked from instead of using get_sfx internal calls This was done via regex: (playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\)) to match 1 (playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\)) to match 0 full sed commands: /(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\))/\1TRUE\2/ 1 to TRUE /(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\))/\1FALSE\2/ 0 to FALSE I'm not very good with regex and these could probably be optimized, but they worked. Why It's Good For The Game Code usability
123 lines
4.0 KiB
Plaintext
123 lines
4.0 KiB
Plaintext
/datum/martial_art
|
|
var/name = "Martial Art"
|
|
var/id = "" //ID, used by mind/has_martialart
|
|
var/streak = ""
|
|
var/max_streak_length = 6
|
|
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/help_verb
|
|
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 0
|
|
|
|
/datum/martial_art/proc/harm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
|
|
return 0
|
|
|
|
/datum/martial_art/proc/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
|
|
return 0
|
|
|
|
/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,2)
|
|
return
|
|
|
|
/datum/martial_art/proc/reset_streak(mob/living/carbon/human/new_target)
|
|
current_target = new_target
|
|
streak = ""
|
|
|
|
/datum/martial_art/proc/basic_hit(mob/living/carbon/human/A,mob/living/carbon/human/D)
|
|
|
|
var/damage = rand(A.dna.species.punchdamagelow, A.dna.species.punchdamagehigh)
|
|
|
|
var/atk_verb = A.dna.species.attack_verb
|
|
if(!(D.mobility_flags & MOBILITY_STAND))
|
|
atk_verb = "kick"
|
|
|
|
switch(atk_verb)
|
|
if("kick")
|
|
A.do_attack_animation(D, ATTACK_EFFECT_KICK)
|
|
if("slash")
|
|
A.do_attack_animation(D, ATTACK_EFFECT_CLAW)
|
|
if("smash")
|
|
A.do_attack_animation(D, ATTACK_EFFECT_SMASH)
|
|
else
|
|
A.do_attack_animation(D, ATTACK_EFFECT_PUNCH)
|
|
|
|
if(!damage)
|
|
playsound(D.loc, A.dna.species.miss_sound, 25, TRUE, -1)
|
|
D.visible_message("<span class='warning'>[A]'s [atk_verb] misses [D]!</span>", \
|
|
"<span class='userdanger'>[A]'s [atk_verb] misses you!</span>", null, COMBAT_MESSAGE_RANGE)
|
|
log_combat(A, D, "attempted to [atk_verb]")
|
|
return 0
|
|
|
|
var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected))
|
|
var/armor_block = D.run_armor_check(affecting, "melee")
|
|
|
|
playsound(D.loc, A.dna.species.attack_sound, 25, TRUE, -1)
|
|
D.visible_message("<span class='danger'>[A] [atk_verb]ed [D]!</span>", \
|
|
"<span class='userdanger'>[A] [atk_verb]ed you!</span>", null, COMBAT_MESSAGE_RANGE)
|
|
|
|
D.apply_damage(damage, A.dna.species.attack_type, affecting, armor_block)
|
|
|
|
log_combat(A, D, "punched")
|
|
|
|
if((D.stat != DEAD) && damage >= A.dna.species.punchstunthreshold)
|
|
D.visible_message("<span class='danger'>[A] knocks [D] down!!</span>", \
|
|
"<span class='userdanger'>[A] knocks you down!</span>")
|
|
D.apply_effect(40, EFFECT_KNOCKDOWN, armor_block)
|
|
D.forcesay(GLOB.hit_appends)
|
|
else if(!(D.mobility_flags & MOBILITY_STAND))
|
|
D.forcesay(GLOB.hit_appends)
|
|
return 1
|
|
|
|
/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
|