Skip to content

Commit

Permalink
Crit Rework Final Submission
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox-McCloud committed Mar 28, 2019
1 parent 290e913 commit d0ea5ee
Show file tree
Hide file tree
Showing 87 changed files with 798 additions and 481 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#define FAKEDEATH 8192 //Replaces stuff like changeling.changeling_fakedeath
#define XENO_HOST 16384 //Tracks whether we're gonna be a baby alien's mummy.

//Health Defines
#define HEALTH_THRESHOLD_CRIT 0
#define HEALTH_THRESHOLD_DEAD -100

//Grab levels
#define GRAB_PASSIVE 1
Expand Down
8 changes: 0 additions & 8 deletions code/controllers/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@

//game_options.txt configs

var/health_threshold_softcrit = 0
var/health_threshold_crit = 0
var/health_threshold_dead = -100

var/bones_can_break = 1

var/revival_pod_plants = 1
Expand Down Expand Up @@ -663,10 +659,6 @@
value = text2num(value)

switch(name)
if("health_threshold_crit")
config.health_threshold_crit = value
if("health_threshold_dead")
config.health_threshold_dead = value
if("revival_pod_plants")
config.revival_pod_plants = value
if("revival_cloning")
Expand Down
130 changes: 130 additions & 0 deletions code/datums/diseases/critical.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/datum/disease/critical

/datum/disease/critical/stage_act() //overriden to ensure unique behavior
stage = min(stage, max_stages)

if(prob(stage_prob))
stage = min(stage + 1, max_stages)

for(var/C_id in cures)
if(affected_mob.reagents.has_reagent(C_id))
if(prob(cure_chance))
cure()
return FALSE
return TRUE

/datum/disease/critical/shock
name = "Shock"
form = "Medical Emergency"
spread_text = "The patient is in shock"
max_stages = 3
spread_flags = SPECIAL
cure_text = "Saline Solution"
cures = list("salglu_solution")
cure_chance = 10
viable_mobtypes = list(/mob/living/carbon/human)
stage_prob = 6
severity = DANGEROUS
disease_flags = CURABLE
bypasses_immunity = TRUE
virus_heal_resistant = TRUE

/datum/disease/critical/shock/stage_act()
if(..())
if(affected_mob.health >= 25)
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
cure()
return
switch(stage)
if(1)
if(prob(1) && prob(10))
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
cure()
return
if(prob(8))
affected_mob.emote(pick("shiver", "pale", "moan"))
if(prob(5))
to_chat(affected_mob, "<span class='danger'>You feel weak!</span>")
if(2)
if(prob(1) && prob(10))
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
cure()
return
if(prob(8))
affected_mob.emote(pick("shiver", "pale", "moan", "shudder", "tremble"))
if(prob(5))
to_chat(affected_mob, "<span class='danger'>You feel absolutely terrible!</span>")
if(prob(5))
affected_mob.emote("faint", "collapse", "groan")
if(3)
if(prob(1) && prob(10))
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
cure()
return
if(prob(8))
affected_mob.emote(pick("shudder", "pale", "tremble", "groan", "bshake"))
if(prob(5))
to_chat(affected_mob, "<span class='danger'>You feel horrible!</span>")
if(prob(5))
affected_mob.emote(pick("faint", "collapse", "groan"))
if(prob(7))
to_chat(affected_mob, "<span class='danger'>You can't breathe!</span>")
affected_mob.AdjustLoseBreath(1)
if(prob(5))
var/datum/disease/D = new /datum/disease/critical/heart_failure
affected_mob.ForceContractDisease(D)

/datum/disease/critical/heart_failure
name = "Cardiac Failure"
form = "Medical Emergency"
spread_text = "The patient is having a cardiac emergency"
max_stages = 3
spread_flags = SPECIAL
cure_text = "Cardiac Stimulants"
cures = list("atropine", "epinephrine")
cure_chance = 10
needs_all_cures = FALSE
viable_mobtypes = list(/mob/living/carbon/human)
stage_prob = 5
severity = DANGEROUS
disease_flags = CURABLE
required_organs = list(/obj/item/organ/internal/heart)
bypasses_immunity = TRUE
virus_heal_resistant = TRUE

/datum/disease/critical/heart_failure/stage_act()
if(..())
switch(stage)
if(1)
if(prob(1) && prob(10))
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
cure()
return
if(prob(8))
affected_mob.emote(pick("pale", "shudder"))
if(prob(5))
to_chat(affected_mob, "<span class='danger'>Your arm hurts!</span>")
else if(prob(5))
to_chat(affected_mob, "<span class='danger'>Your chest hurts!</span>")
if(2)
if(prob(1) && prob(10))
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
cure()
return
if(prob(8))
affected_mob.emote(pick("pale", "groan"))
if(prob(5))
to_chat(affected_mob, "<span class='danger'>Your heart lurches in your chest!</span>")
affected_mob.AdjustLoseBreath(1)
if(prob(3))
to_chat(affected_mob, "<span class='danger'>Your heart stops beating!</span>")
affected_mob.AdjustLoseBreath(3)
if(prob(5))
affected_mob.emote(pick("faint", "collapse", "groan"))
if(3)
affected_mob.adjustOxyLoss(1)
if(prob(8))
affected_mob.emote(pick("twitch", "gasp"))
if(prob(5) && ishuman(affected_mob))
var/mob/living/carbon/human/H = affected_mob
H.set_heartattack(TRUE)
12 changes: 2 additions & 10 deletions code/datums/diseases/food_poisoning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,12 @@
disease_flags = CURABLE
spread_flags = NON_CONTAGIOUS
virus_heal_resistant = TRUE
var/remissive = 0

/datum/disease/food_poisoning/stage_act()
if(!remissive)
..()
if(affected_mob.sleeping && prob(33))
to_chat(affected_mob, "<span class='notice'>You feel better.</span>")
remissive = 1
if(remissive)
if(prob(stage_prob))
stage--
if(stage == 0)
cure()
return
cure()
return
switch(stage)
if(1)
if(prob(5))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/inflict_handler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
else if(amt_dam_fire <= 0)
target.heal_overall_damage(amt_dam_brute,amt_dam_fire)
target.adjustToxLoss(amt_dam_tox)
target.oxyloss += amt_dam_oxy
target.adjustOxyLoss(amt_dam_oxy)
//disabling
target.Weaken(amt_weakened)
target.Paralyse(amt_paralysis)
Expand Down
6 changes: 3 additions & 3 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,10 @@ var/list/blood_splatter_icons = list()
return pass_flags&passflag

/atom/proc/isinspace()
if(istype(get_turf(src), /turf/space))
return 1
if(isspaceturf(get_turf(src)))
return TRUE
else
return 0
return FALSE

/atom/proc/handle_fall()
return
Expand Down
17 changes: 9 additions & 8 deletions code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@
return 1
return 0

//helper for getting the appropriate health status UPDATED BY PUCKABOO2 TO INCLUDE NEGATIVES.
//helper for getting the appropriate health status
/proc/RoundHealth(mob/living/M)
if(M.stat == DEAD || (M.status_flags & FAKEDEATH))
return "health-100" //what's our health? it doesn't matter, we're dead, or faking
return "health-100-dead" //what's our health? it doesn't matter, we're dead, or faking

var/maxi_health = M.maxHealth
if(iscarbon(M) && M.health < 0)
maxi_health = 100 //so crit shows up right for aliens and other high-health carbon mobs; noncarbons don't have crit.
Expand All @@ -91,7 +92,7 @@
if(100 to INFINITY)
return "health100"
if(95 to 100)
return "health95" //For telling patients to eat a warm donk pocket and go on with their shift.
return "health95"
if(90 to 95)
return "health90"
if(80 to 90)
Expand Down Expand Up @@ -127,13 +128,13 @@
if(-70 to -60)
return "health-60"
if(-80 to -70)
return "health-70" //Doc?
return "health-70"
if(-90 to -80)
return "health-80" //Hey, doc?
return "health-80"
if(-100 to -90)
return "health-90" //HURRY UP, DOC!
return "health-90"
else
return "health-100" //doc u had 1 job
return "health-100" //past this point, you're just in trouble
return "0"


Expand Down Expand Up @@ -438,4 +439,4 @@
if(weedlevel < 1) // You don't want to see these icons if the value is small
holder.icon_state = ""
return
holder.icon_state = "hudweed[RoundPlantBar(weedlevel/10)]"
holder.icon_state = "hudweed[RoundPlantBar(weedlevel/10)]"
2 changes: 1 addition & 1 deletion code/game/dna/dna_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@
occupantData["isViableSubject"] = 0
occupantData["health"] = connected.occupant.health
occupantData["maxHealth"] = connected.occupant.maxHealth
occupantData["minHealth"] = config.health_threshold_dead
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
occupantData["uniqueEnzymes"] = connected.occupant.dna.unique_enzymes
occupantData["uniqueIdentity"] = connected.occupant.dna.uni_identity
occupantData["structuralEnzymes"] = connected.occupant.dna.struc_enzymes
Expand Down
3 changes: 0 additions & 3 deletions code/game/gamemodes/changeling/powers/fleshmend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
// The healing itself - doesn't heal toxin damage
// (that's anatomic panacea) and the effectiveness decreases with
// each use in a short timespan
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.shock_stage = 0
for(var/i in 1 to healing_ticks)
if(user)
var/healpertick = -(total_healing / healing_ticks)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/changeling/powers/revive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.restore_blood()
H.traumatic_shock = 0
H.shock_stage = 0
H.next_pain_time = 0
H.dna.species.create_organs(H)
// Now that recreating all organs is necessary, the rest of this organ stuff probably
Expand All @@ -51,6 +49,8 @@
IO.rejuvenate()
IO.trace_chemicals.Cut()
H.remove_all_embedded_objects()
for(var/datum/disease/critical/C in user.viruses)
C.cure()
user.status_flags &= ~(FAKEDEATH)
user.updatehealth("revive sting")
user.update_blind_effects()
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/guardian/guardian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
if(summoner)
var/resulthealth
if(iscarbon(summoner))
resulthealth = round((abs(config.health_threshold_dead - summoner.health) / abs(config.health_threshold_dead - summoner.maxHealth)) * 100)
resulthealth = round((abs(HEALTH_THRESHOLD_DEAD - summoner.health) / abs(HEALTH_THRESHOLD_DEAD - summoner.maxHealth)) * 100)
else
resulthealth = round((summoner.health / summoner.maxHealth) * 100)
if(hud_used)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/scoreboard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
score_richestjob = E.job
score_richestkey = E.key

dmg_score = E.bruteloss + E.fireloss + E.toxloss + E.oxyloss
dmg_score = E.getBruteLoss() + E.getFireLoss() + E.getToxLoss() + E.getOxyLoss()
if(dmg_score > score_dmgestdamage)
score_dmgestdamage = dmg_score
score_dmgestname = E.real_name
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
occupantData["stat"] = occupant.stat
occupantData["health"] = occupant.health
occupantData["maxHealth"] = occupant.maxHealth
occupantData["minHealth"] = config.health_threshold_dead
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
occupantData["bruteLoss"] = occupant.getBruteLoss()
occupantData["oxyLoss"] = occupant.getOxyLoss()
occupantData["toxLoss"] = occupant.getToxLoss()
Expand Down
3 changes: 1 addition & 2 deletions code/game/machinery/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

var/obj/effect/countdown/clonepod/countdown

var/list/brine_types = list("corazone", "salbutamol", "hydrocodone")
var/list/brine_types = list("corazone", "salbutamol", "epinephrine", "salglu_solution") //stops heart attacks, heart failure, shock, and keeps their O2 levels normal
var/list/missing_organs
var/organs_number = 0

Expand Down Expand Up @@ -479,7 +479,6 @@
occupant.forceMove(get_turf(src))
occupant.update_body()
domutcheck(occupant) //Waiting until they're out before possible notransform.
occupant.shock_stage = 0 //Reset Shock
occupant.special_post_clone_handling()
occupant = null
update_icon()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
occupantData["stat"] = occupant.stat
occupantData["health"] = occupant.health
occupantData["maxHealth"] = occupant.maxHealth
occupantData["minHealth"] = config.health_threshold_dead
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
occupantData["bruteLoss"] = occupant.getBruteLoss()
occupantData["oxyLoss"] = occupant.getOxyLoss()
occupantData["toxLoss"] = occupant.getToxLoss()
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/cryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
occupantData["stat"] = occupant.stat
occupantData["health"] = occupant.health
occupantData["maxHealth"] = occupant.maxHealth
occupantData["minHealth"] = config.health_threshold_dead
occupantData["minHealth"] = HEALTH_THRESHOLD_DEAD
occupantData["bruteLoss"] = occupant.getBruteLoss()
occupantData["oxyLoss"] = occupant.getOxyLoss()
occupantData["toxLoss"] = occupant.getToxLoss()
Expand Down Expand Up @@ -378,17 +378,17 @@
occupant.Paralyse(max(5/efficiency, (1/occupant.bodytemperature)*3000/efficiency))
if(air_contents.oxygen > 2)
if(occupant.getOxyLoss())
occupant.adjustOxyLoss(-10)
occupant.adjustOxyLoss(-6)
else
occupant.adjustOxyLoss(-2)
occupant.adjustOxyLoss(-1.2)
if(beaker && next_trans == 0)
var/proportion = 10 * min(1/beaker.volume, 1)
// Yes, this means you can get more bang for your buck with a beaker of SF vs a patch
// But it also means a giant beaker of SF won't heal people ridiculously fast 4 cheap
beaker.reagents.reaction(occupant, TOUCH, proportion)
beaker.reagents.trans_to(occupant, 1, 10)
next_trans++
if(next_trans == 10)
if(next_trans == 17)
next_trans = 0

/obj/machinery/atmospherics/unary/cryo_cell/proc/heat_gas_contents()
Expand Down
Loading

0 comments on commit d0ea5ee

Please sign in to comment.