mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* Set max version * Updates most references to .proc (Leaves a couple to check check_grep) * Actually add check * Oops * Hopefully exclude the one place we do want .proc * AAAAAAA * Trying this instead * Hopefully checks go green * Switch to NAMEOF_STATIC * Makes 515 acutally build * LIBCALL
134 lines
5.1 KiB
Plaintext
134 lines
5.1 KiB
Plaintext
//Brain Traumas are the new actual brain damage. Brain damage itself acts as a way to acquire traumas: every time brain damage is dealt, there's a chance of receiving a trauma.
|
|
//This chance gets higher the higher the mob's brainloss is. Removing traumas is a separate thing from removing brain damage: you can get restored to full brain operativity,
|
|
// but keep the quirks, until repaired by neurine, surgery, lobotomy or magic; depending on the resilience
|
|
// of the trauma.
|
|
|
|
/datum/brain_trauma
|
|
var/name = "Brain Trauma"
|
|
var/desc = "A trauma caused by brain damage, which causes issues to the patient."
|
|
var/scan_desc = "generic brain trauma" //description when detected by a health scanner
|
|
var/mob/living/carbon/owner //the poor bastard
|
|
var/obj/item/organ/brain/brain //the poor bastard's brain
|
|
var/gain_text = span_notice("You feel traumatized.")
|
|
var/lose_text = span_notice("You no longer feel traumatized.")
|
|
var/can_gain = TRUE
|
|
var/random_gain = TRUE //can this be gained through random traumas?
|
|
var/resilience = TRAUMA_RESILIENCE_BASIC //how hard is this to cure?
|
|
var/clonable = TRUE // will this transfer if the brain is cloned?
|
|
// Therapy
|
|
var/random_cure_chance = 0 // This will be multiplied by a random amount; more resilient traumas should have less chance
|
|
var/flash_therapy_cd_time = 5 MINUTES // Flashing the patient, most effective method
|
|
COOLDOWN_DECLARE(flash_therapy_cd)
|
|
var/laser_therapy_cd_time = 8 MINUTES // Shining a laser into the patient's eyes, second most effective
|
|
COOLDOWN_DECLARE(laser_therapy_cd)
|
|
var/pen_therapy_cd_time = 3 MINUTES // Shining a light (usually penlight) into the patient's eyes, third most effective
|
|
COOLDOWN_DECLARE(pen_therapy_cd)
|
|
var/hug_therapy_cd_time = 1 MINUTES // Hugging the patient, lowest chance method but easiest. Hugs!
|
|
COOLDOWN_DECLARE(hug_therapy_cd)
|
|
|
|
/datum/brain_trauma/Destroy()
|
|
if(brain && brain.traumas)
|
|
brain.traumas -= src
|
|
if(owner)
|
|
on_lose()
|
|
brain = null
|
|
owner = null
|
|
return ..()
|
|
|
|
/datum/brain_trauma/proc/on_clone()
|
|
if(clonable)
|
|
return new type
|
|
|
|
//Called on life ticks
|
|
/datum/brain_trauma/proc/on_life()
|
|
return
|
|
|
|
//Called on death
|
|
/datum/brain_trauma/proc/on_death()
|
|
return
|
|
|
|
//Called when given to a mob
|
|
/datum/brain_trauma/proc/on_gain()
|
|
to_chat(owner, gain_text)
|
|
RegisterSignal(owner, COMSIG_MOB_SAY, PROC_REF(handle_speech))
|
|
RegisterSignal(owner, COMSIG_MOVABLE_HEAR, PROC_REF(handle_hearing))
|
|
random_cure_chance *= rand(6, 15) / 10 // 0.6-1.5x
|
|
|
|
//Called when removed from a mob
|
|
/datum/brain_trauma/proc/on_lose(silent)
|
|
if(!silent)
|
|
to_chat(owner, lose_text)
|
|
UnregisterSignal(owner, COMSIG_MOB_SAY)
|
|
UnregisterSignal(owner, COMSIG_MOVABLE_HEAR)
|
|
|
|
//Called when hearing a spoken message
|
|
/datum/brain_trauma/proc/handle_hearing(datum/source, list/hearing_args)
|
|
UnregisterSignal(owner, COMSIG_MOVABLE_HEAR)
|
|
|
|
//Called when speaking
|
|
/datum/brain_trauma/proc/handle_speech(datum/source, list/speech_args)
|
|
UnregisterSignal(owner, COMSIG_MOB_SAY)
|
|
|
|
|
|
//Called when hugging. expand into generally interacting, where future coders could switch the intent?
|
|
/datum/brain_trauma/proc/on_hug(mob/living/hugger, mob/living/hugged)
|
|
if(resilience >= TRAUMA_RESILIENCE_WOUND)
|
|
return
|
|
if(!COOLDOWN_FINISHED(src, hug_therapy_cd))
|
|
return
|
|
COOLDOWN_START(src, hug_therapy_cd, hug_therapy_cd_time)
|
|
var/cure_chance = random_cure_chance / 6
|
|
if(HAS_TRAIT(hugger, TRAIT_FRIENDLY))
|
|
cure_chance *= 1.25
|
|
cure_chance *= psych_bonus(hugger) * 0.35 // hugging is not that good at curing trauma but it helps
|
|
cure_chance *= check_hypno_vulnerable(hugged)
|
|
if(prob(cure_chance))
|
|
qdel(src) // Sometimes, all you need is a good hug..
|
|
|
|
/datum/brain_trauma/proc/on_flash(mob/living/flasher, mob/living/flashed)
|
|
if(resilience >= TRAUMA_RESILIENCE_WOUND)
|
|
return
|
|
if(!COOLDOWN_FINISHED(src, flash_therapy_cd))
|
|
return
|
|
COOLDOWN_START(src, flash_therapy_cd, flash_therapy_cd_time)
|
|
var/cure_chance = random_cure_chance / 10
|
|
cure_chance *= psych_bonus(flasher)
|
|
cure_chance *= check_hypno_vulnerable(flashed)
|
|
if(prob(cure_chance))
|
|
qdel(src)
|
|
|
|
/datum/brain_trauma/proc/on_shine_laser(mob/living/laserer, mob/living/lasered)
|
|
if(resilience >= TRAUMA_RESILIENCE_WOUND)
|
|
return
|
|
if(!COOLDOWN_FINISHED(src, laser_therapy_cd))
|
|
return
|
|
COOLDOWN_START(src, laser_therapy_cd, laser_therapy_cd_time)
|
|
var/cure_chance = random_cure_chance / 11
|
|
cure_chance *= psych_bonus(laserer)
|
|
cure_chance *= check_hypno_vulnerable(lasered)
|
|
if(prob(cure_chance))
|
|
qdel(src)
|
|
|
|
/datum/brain_trauma/proc/on_shine_light(mob/living/shiner, mob/living/shined, obj/item/flashlight/the_light)
|
|
if(resilience >= TRAUMA_RESILIENCE_WOUND)
|
|
return
|
|
if(!COOLDOWN_FINISHED(src, pen_therapy_cd))
|
|
return
|
|
COOLDOWN_START(src, pen_therapy_cd, pen_therapy_cd_time)
|
|
var/cure_chance = random_cure_chance / 15
|
|
if(istype(the_light, /obj/item/flashlight/pen)) // Use a proper penlight!
|
|
cure_chance *= 1.25
|
|
cure_chance *= psych_bonus(shiner)
|
|
cure_chance *= check_hypno_vulnerable(shined)
|
|
if(prob(cure_chance))
|
|
qdel(src)
|
|
|
|
/datum/brain_trauma/proc/psych_bonus(mob/living/psych)
|
|
return HAS_TRAIT(psych.mind, TRAIT_PSYCH) ? 10 : 1
|
|
|
|
/datum/brain_trauma/proc/check_hypno_vulnerable(mob/living/carbon/victim)
|
|
if(istype(victim))
|
|
return victim.hypnosis_vulnerable() ? 1.5 : 1
|
|
else
|
|
return 1
|