Merge pull request #5698 from Citadel-Station-13/upstream-merge-35938
[MIRROR] Adds limitations to brain traumas
This commit is contained in:
@@ -219,7 +219,7 @@
|
||||
A.Refresh() //just in case someone already made and named the same disease
|
||||
return A
|
||||
|
||||
/obj/item/organ/heart/gland/trauma //TODO : Replace with something more interesting
|
||||
/obj/item/organ/heart/gland/trauma
|
||||
cooldown_low = 800
|
||||
cooldown_high = 1200
|
||||
uses = 5
|
||||
@@ -230,12 +230,12 @@
|
||||
/obj/item/organ/heart/gland/trauma/activate()
|
||||
to_chat(owner, "<span class='warning'>You feel a spike of pain in your head.</span>")
|
||||
if(prob(33))
|
||||
owner.gain_trauma_type(BRAIN_TRAUMA_SPECIAL, TRAUMA_RESILIENCE_LOBOTOMY)
|
||||
owner.gain_trauma_type(BRAIN_TRAUMA_SPECIAL, rand(TRAUMA_RESILIENCE_BASIC, TRAUMA_RESILIENCE_LOBOTOMY))
|
||||
else
|
||||
if(prob(20))
|
||||
owner.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
|
||||
owner.gain_trauma_type(BRAIN_TRAUMA_SEVERE, rand(TRAUMA_RESILIENCE_BASIC, TRAUMA_RESILIENCE_LOBOTOMY))
|
||||
else
|
||||
owner.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_LOBOTOMY)
|
||||
owner.gain_trauma_type(BRAIN_TRAUMA_MILD, rand(TRAUMA_RESILIENCE_BASIC, TRAUMA_RESILIENCE_LOBOTOMY))
|
||||
|
||||
/obj/item/organ/heart/gland/spiderman
|
||||
cooldown_low = 450
|
||||
|
||||
@@ -185,9 +185,43 @@
|
||||
if(istype(BT, brain_trauma_type) && (BT.resilience <= resilience))
|
||||
return BT
|
||||
|
||||
/obj/item/organ/brain/proc/can_gain_trauma(datum/brain_trauma/trauma, resilience)
|
||||
if(!ispath(trauma))
|
||||
trauma = trauma.type
|
||||
if(!initial(trauma.can_gain))
|
||||
return FALSE
|
||||
if(!resilience)
|
||||
resilience = initial(trauma.resilience)
|
||||
|
||||
var/resilience_tier_count = 0
|
||||
for(var/X in traumas)
|
||||
if(istype(X, trauma))
|
||||
return FALSE
|
||||
var/datum/brain_trauma/T = X
|
||||
if(resilience == T.resilience)
|
||||
resilience_tier_count++
|
||||
|
||||
var/max_traumas
|
||||
switch(resilience)
|
||||
if(TRAUMA_RESILIENCE_BASIC)
|
||||
max_traumas = TRAUMA_LIMIT_BASIC
|
||||
if(TRAUMA_RESILIENCE_SURGERY)
|
||||
max_traumas = TRAUMA_LIMIT_SURGERY
|
||||
if(TRAUMA_RESILIENCE_LOBOTOMY)
|
||||
max_traumas = TRAUMA_LIMIT_LOBOTOMY
|
||||
if(TRAUMA_RESILIENCE_MAGIC)
|
||||
max_traumas = TRAUMA_LIMIT_MAGIC
|
||||
if(TRAUMA_RESILIENCE_ABSOLUTE)
|
||||
max_traumas = TRAUMA_LIMIT_ABSOLUTE
|
||||
|
||||
if(resilience_tier_count >= max_traumas)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
//Add a specific trauma
|
||||
/obj/item/organ/brain/proc/gain_trauma(datum/brain_trauma/trauma, resilience, list/arguments)
|
||||
if(!can_gain_trauma(trauma, resilience))
|
||||
return
|
||||
var/trauma_type
|
||||
if(ispath(trauma))
|
||||
trauma_type = trauma
|
||||
@@ -204,9 +238,12 @@
|
||||
var/list/datum/brain_trauma/possible_traumas = list()
|
||||
for(var/T in subtypesof(brain_trauma_type))
|
||||
var/datum/brain_trauma/BT = T
|
||||
if(initial(BT.can_gain))
|
||||
if(can_gain_trauma(BT, resilience))
|
||||
possible_traumas += BT
|
||||
|
||||
if(!LAZYLEN(possible_traumas))
|
||||
return
|
||||
|
||||
var/trauma_type = pick(possible_traumas)
|
||||
SSblackbox.record_feedback("tally", "traumas", 1, trauma_type)
|
||||
traumas += new trauma_type(src, resilience)
|
||||
|
||||
@@ -215,11 +215,11 @@
|
||||
if(amount <= 0) //cut this early
|
||||
return
|
||||
var/brainloss = getBrainLoss()
|
||||
if(brainloss > BRAIN_DAMAGE_MILD && !has_trauma_type(BRAIN_TRAUMA_MILD))
|
||||
if(prob((amount * 2) + ((brainloss - BRAIN_DAMAGE_MILD) / 5))) //1 damage|50 brain damage = 4% chance
|
||||
if(brainloss > BRAIN_DAMAGE_MILD)
|
||||
if(prob((amount * 2) + (brainloss - BRAIN_DAMAGE_MILD - (20 * LAZYLEN(get_traumas())) / 5))) //1 damage|50 brain damage = 4% chance
|
||||
gain_trauma_type(BRAIN_TRAUMA_MILD)
|
||||
if(brainloss > BRAIN_DAMAGE_SEVERE && !has_trauma_type(BRAIN_TRAUMA_SEVERE) && !has_trauma_type(BRAIN_TRAUMA_SPECIAL))
|
||||
if(prob(amount + ((brainloss - BRAIN_DAMAGE_SEVERE) / 15))) //1 damage|150 brain damage = 3% chance
|
||||
if(brainloss > BRAIN_DAMAGE_SEVERE)
|
||||
if(prob(amount + (brainloss - BRAIN_DAMAGE_SEVERE - (20 * LAZYLEN(get_traumas())) / 15))) //1 damage|150 brain damage = 3% chance
|
||||
if(prob(20))
|
||||
gain_trauma_type(BRAIN_TRAUMA_SPECIAL)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user