[MIRROR] Proper MaxHealth checks and Crit Point (#10881)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-05-16 00:25:21 -07:00
committed by GitHub
parent 901dc552fc
commit 4ce45f8cc4
46 changed files with 92 additions and 94 deletions

View File

@@ -298,10 +298,10 @@
H.updatehealth()
if(H.isSynthetic())
if(H.health + H.getOxyLoss() + H.getToxLoss() <= CONFIG_GET(number/health_threshold_dead))
if(H.health + H.getOxyLoss() + H.getToxLoss() <= -(H.getMaxHealth()))
return "buzzes, \"Resuscitation failed - Severe damage detected. Begin damage restoration before further attempts.\""
else if(H.health + H.getOxyLoss() <= CONFIG_GET(number/health_threshold_dead)) //They need to be healed first.
else if(H.health + H.getOxyLoss() <= -(H.getMaxHealth())) //They need to be healed first.
return "buzzes, \"Resuscitation failed - Severe tissue damage detected. Repair of anatomical damage required.\""
else if(HUSK in H.mutations) //Husked! Need to fix their husk status first.
@@ -434,7 +434,7 @@
H.apply_damage(burn_damage_amt, BURN, BP_TORSO)
//set oxyloss so that the patient is just barely in crit, if possible
var/barely_in_crit = CONFIG_GET(number/health_threshold_crit) - 1
var/barely_in_crit = H.get_crit_point() - 1
var/adjust_health = barely_in_crit - H.health //need to increase health by this much
H.adjustOxyLoss(-adjust_health)

View File

@@ -44,7 +44,7 @@
if(user == owner && bound_mob)
. += span_notice("[bound_mob]'s crystal")
if(isanimal(bound_mob))
. += span_notice("[bound_mob.health / bound_mob.maxHealth * 100]%")
. += span_notice("[bound_mob.health / bound_mob.getMaxHealth() * 100]%")
if(bound_mob.ooc_notes)
. += span_deptradio("OOC Notes:") + " <a href='byond://?src=\ref[bound_mob];ooc_notes=1'>\[View\]</a> - <a href='byond://?src=\ref[src];print_ooc_notes_chat=1'>\[Print\]</a>"
. += span_deptradio("<a href='byond://?src=\ref[bound_mob];vore_prefs=1'>\[Mechanical Vore Preferences\]</a>")
@@ -275,10 +275,10 @@
/obj/item/capture_crystal/proc/capture_chance(mob/living/M, user)
if(capture_chance_modifier >= 100) //Master crystal always work
return 100
var/capture_chance = ((1 - (M.health / M.maxHealth)) * 100) //Inverted health percent! 100% = 0%
var/capture_chance = ((1 - (M.health / M.getMaxHealth())) * 100) //Inverted health percent! 100% = 0%
//So I don't know how this works but here's a kind of explanation
//Basic chance + ((Mob's max health - minimum calculated health) / (Max allowed health - Min allowed health)*(Chance at Max allowed health - Chance at minimum allowed health)
capture_chance += 35 + ((M.maxHealth - 5)/ (1000-5)*(-100 - 35))
capture_chance += 35 + ((M.getMaxHealth() - 5)/ (1000-5)*(-100 - 35))
//Basically! Mobs over 1000 max health will be unable to be caught without using status effects.
//Thanks Aronai!
var/effect_count = 0 //This will give you a smol chance to capture if you have applied status effects, even if the chance would ordinarily be <0