Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nerfs to defibrillators, changes to heart damage & bloodloss #4137

Merged
merged 17 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions code/game/objects/items/devices/defibrillator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
w_class = SIZE_MEDIUM

var/blocked_by_suit = TRUE
var/heart_damage_to_deal = 5
/// Min damage defib deals to victims' heart
var/min_heart_damage_dealt = 3
/// Max damage defib deals to victims' heart
var/max_heart_damage_dealt = 5
var/ready = 0
var/damage_heal_threshold = 12 //This is the maximum non-oxy damage the defibrillator will heal to get a patient above -100, in all categories
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
Expand Down Expand Up @@ -191,8 +194,11 @@
shock_cooldown = world.time + 10 //1 second cooldown before you can shock again

var/datum/internal_organ/heart/heart = H.internal_organs_by_name["heart"]
/// Has the defib already caused the chance of heart damage, to not potentially double up later
var/heart_already_damaged = FALSE
if(heart && prob(25))
heart.take_damage(heart_damage_to_deal, TRUE) //Allow the defibrillator to possibly worsen heart damage. Still rare enough to just be the "clone damage" of the defib
heart.take_damage(rand(min_heart_damage_dealt, max_heart_damage_dealt), TRUE) // Make death and revival leave lasting consequences
heart_already_damaged = TRUE

if(!H.is_revivable())
playsound(get_turf(src), 'sound/items/defib_failed.ogg', 25, 0)
Expand Down Expand Up @@ -230,6 +236,9 @@
user.track_life_saved(user.job)
user.life_revives_total++
H.handle_revive()
if(heart && !heart_already_damaged)
heart.take_damage(rand(min_heart_damage_dealt, max_heart_damage_dealt), TRUE) // Make death and revival leave lasting consequences

to_chat(H, SPAN_NOTICE("You suddenly feel a spark and your consciousness returns, dragging you back to the mortal plane."))
if(H.client?.prefs.toggles_flashing & FLASH_CORPSEREVIVE)
window_flash(H.client)
Expand All @@ -239,13 +248,14 @@

/obj/item/device/defibrillator/compact_adv
name = "advanced compact defibrillator"
desc = "An advanced compact defibrillator that trades capacity for strong immediate power. Ignores armor and heals strongly and quickly, at the cost of very low charge."
desc = "An advanced compact defibrillator that trades capacity for strong immediate power. Ignores armor and heals strongly and quickly, at the cost of very low charge. It does not damage the heart."
icon = 'icons/obj/items/experimental_tools.dmi'
icon_state = "compact_defib"
item_state = "defib"
w_class = SIZE_MEDIUM
blocked_by_suit = FALSE
heart_damage_to_deal = 0
min_heart_damage_dealt = 0
BeagleGaming1 marked this conversation as resolved.
Show resolved Hide resolved
max_heart_damage_dealt = 0
damage_heal_threshold = 40
charge_cost = 198

Expand Down
5 changes: 3 additions & 2 deletions code/modules/cm_tech/implements/medical_czsp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@
/obj/item/device/defibrillator/upgraded
name = "upgraded emergency defibrillator"
icon_state = "adv_defib"
desc = "An advanced rechargeable defibrillator using induction to deliver shocks through metallic objects, such as armor, and does so with much greater efficiency than the standard variant."
desc = "An advanced rechargeable defibrillator using induction to deliver shocks through metallic objects, such as armor, and does so with much greater efficiency than the standard variant, not damaging the heart."

blocked_by_suit = FALSE
heart_damage_to_deal = 0
min_heart_damage_dealt = 0
BeagleGaming1 marked this conversation as resolved.
Show resolved Hide resolved
max_heart_damage_dealt = 0
damage_heal_threshold = 35

/obj/item/ammo_magazine/internal/pillgun
Expand Down
39 changes: 20 additions & 19 deletions code/modules/mob/living/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,43 @@
b_volume = 0
else if(chem_effect_flags & CHEM_EFFECT_ORGAN_STASIS)
b_volume *= 1
else if(heart.damage > 1 && heart.damage < heart.min_bruised_damage)
b_volume *= 0.8
else if(heart.damage >= heart.min_bruised_damage && heart.damage < heart.min_broken_damage)
b_volume *= 0.6
else if(heart.damage >= heart.min_broken_damage && heart.damage < INFINITY)
b_volume *= 0.3
else if(heart.damage >= heart.organ_status >= ORGAN_BRUISED)
b_volume *= Clamp(100 - (2 * heart.damage), 30, 100) / 100

//Effects of bloodloss
if(b_volume <= BLOOD_VOLUME_SAFE)
/// The blood volume turned into a %, with BLOOD_VOLUME_NORMAL being 100%
var/blood_percentage = b_volume / (BLOOD_VOLUME_NORMAL / 100)
/// How much oxyloss will there be from the next time blood processes
var/additional_oxyloss = (100 - blood_percentage) / 5
/// The limit of the oxyloss gained, ignoring oxyloss from the switch statement
var/maximum_oxyloss = Clamp((100 - blood_percentage) / 2, oxyloss, 100)
if(oxyloss < maximum_oxyloss)
oxyloss += max(additional_oxyloss, 0)

//Bloodloss effects on nutrition
if(nutrition >= 300)
nutrition -= 10
else if(nutrition >= 200)
nutrition -= 3

switch(b_volume)
if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE)
if(prob(1))
var/word = pick("dizzy","woozy","faint")
to_chat(src, SPAN_DANGER("You feel [word]."))
if(oxyloss < 20)
oxyloss += 3
if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY)
if(eye_blurry < 50)
AdjustEyeBlur(6)
if(oxyloss < 50)
oxyloss += 10
oxyloss += 2
oxyloss += 3
if(prob(15))
apply_effect(rand(1,3), PARALYZE)
var/word = pick("dizzy","woozy","faint")
to_chat(src, SPAN_DANGER("You feel very [word]."))
if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD)
if(eye_blurry < 50)
AdjustEyeBlur(6)
oxyloss += 5
oxyloss += 8
toxloss += 3
if(prob(15))
apply_effect(rand(1,3), PARALYZE)
Expand All @@ -66,13 +74,6 @@
if(0 to BLOOD_VOLUME_SURVIVE)
death(create_cause_data("blood loss"))

// Without enough blood you slowly go hungry.
if(blood_volume < BLOOD_VOLUME_SAFE)
if(nutrition >= 300)
nutrition -= 10
else if(nutrition >= 200)
nutrition -= 3

// Xeno blood regeneration
/mob/living/carbon/xenomorph/handle_blood()
if(stat != DEAD) //Only living xenos regenerate blood
Expand Down