mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-05 14:32:52 +00:00
* Refactor several log lines to use datum_info_line and atom_loc_line * Add default return strings from datum_info_line and atom_loc_line * Add parentheses around atom_loc_line data * Change more logs to use atom_loc_line * Add check in atom_loc_line for turfs to avoid calling get_turf on them * Re-add removed 'at' * Replace datum_info_line with key_name and atom_loc_line with loc_name * Refactor logging functions * Avoid double-logging self-interactions * Fallback to simple stringification if all else fails in key_name() * Rewrite muscle spasm logging to use log_message * Standardize logging of martial arts * Tweak individual logging panel look * Fix individual logging panel source * When I typed || I really meant && * Fix Telecomms logging always showing client logs in the panel * Reverts addition of buggy ownership log to panel * Remove colon * Fix missing log_directed_talk tag * Add warning for missing type in log_direted_talk * Change warnings to stack_traces * Add square brackets around fallthrough key_name() case to help parsing * Allow atom arguments/src in log_*() functions * Change log_combat call with null argument to log_message * Change mecha types' log_message() arguments to match atom and mob version * Add key_name() case for atoms * Fix resist_grab() unsetting pulledby before log_combat gets a chance to use it * Fix log_globally logic * Add logging for hitting objects with items * Move log_combat() to atoms.dm * Use utility functions for object stringification in log_combat() * Use utility functions for object stringification in log_combat() * Add missing logs for interacting with display cases * Rewrite log_combat() comment * Add missing space in log_combat() * Add logging for hitting grilles barehanded * Add missing ..()
119 lines
3.8 KiB
Plaintext
119 lines
3.8 KiB
Plaintext
/datum/martial_art
|
|
var/name = "Martial Art"
|
|
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/deflection_chance = 0 //Chance to deflect projectiles
|
|
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/no_guns = FALSE
|
|
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)
|
|
current_target = D
|
|
streak = ""
|
|
restraining = 0
|
|
streak = streak+element
|
|
if(length(streak) > max_streak_length)
|
|
streak = copytext(streak,2)
|
|
return
|
|
|
|
/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.lying)
|
|
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, 1, -1)
|
|
D.visible_message("<span class='warning'>[A] has attempted to [atk_verb] [D]!</span>", \
|
|
"<span class='userdanger'>[A] has attempted to [atk_verb] [D]!</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, 1, -1)
|
|
D.visible_message("<span class='danger'>[A] has [atk_verb]ed [D]!</span>", \
|
|
"<span class='userdanger'>[A] has [atk_verb]ed [D]!</span>", null, COMBAT_MESSAGE_RANGE)
|
|
|
|
D.apply_damage(damage, BRUTE, affecting, armor_block)
|
|
|
|
log_combat(A, D, "punched")
|
|
|
|
if((D.stat != DEAD) && damage >= A.dna.species.punchstunthreshold)
|
|
D.visible_message("<span class='danger'>[A] has knocked [D] down!!</span>", \
|
|
"<span class='userdanger'>[A] has knocked [D] down!</span>")
|
|
D.apply_effect(40, EFFECT_KNOCKDOWN, armor_block)
|
|
D.forcesay(GLOB.hit_appends)
|
|
else if(D.lying)
|
|
D.forcesay(GLOB.hit_appends)
|
|
return 1
|
|
|
|
/datum/martial_art/proc/teach(mob/living/carbon/human/H,make_temporary=0)
|
|
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
|