Skip to content

Commit

Permalink
[MIRROR] [NO GBP] Healing Virus Selfcure Hotfix [MDB IGNORE] (#25526)
Browse files Browse the repository at this point in the history
[NO GBP] Healing Virus Selfcure Hotfix

Co-authored-by: Higgin <[email protected]>
Co-authored-by: Giz <[email protected]>
  • Loading branch information
3 people authored and FFMirrorBot committed Dec 10, 2023
1 parent 4bec96b commit 9916aa2
Showing 1 changed file with 99 additions and 0 deletions.
99 changes: 99 additions & 0 deletions code/datums/diseases/_disease.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,105 @@
else if(SPT_PROB(stage_prob*slowdown, seconds_per_tick))
update_stage(min(stage + 1, max_stages))

<<<<<<< HEAD

Check failure on line 89 in code/datums/diseases/_disease.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got '<<', expected one of: newline, '/', identifier
=======
if(!(disease_flags & CHRONIC) && disease_flags & CURABLE && bypasses_immunity != TRUE)
switch(severity)
if(DISEASE_SEVERITY_POSITIVE) //good viruses don't go anywhere after hitting max stage - you can try to get rid of them by sleeping earlier
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_POSITIVE) //because of the way we later check for recovery_prob, we need to floor this at least equal to the scaling to avoid infinitely getting less likely to cure
if(((HAS_TRAIT(affected_mob, TRAIT_NOHUNGER)) || ((affected_mob.nutrition > NUTRITION_LEVEL_STARVING) && (affected_mob.satiety >= 0))) && slowdown == 1) //any sort of malnourishment/immunosuppressant opens you to losing a good virus
return TRUE
if(DISEASE_SEVERITY_NONTHREAT)
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_NONTHREAT)
if(DISEASE_SEVERITY_MINOR)
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_MINOR)
if(DISEASE_SEVERITY_MEDIUM)
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_MEDIUM)
if(DISEASE_SEVERITY_DANGEROUS)
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_DANGEROUS)
if(DISEASE_SEVERITY_HARMFUL)
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_HARMFUL)
if(DISEASE_SEVERITY_BIOHAZARD)
cycles_to_beat = max(DISEASE_RECOVERY_SCALING, DISEASE_CYCLES_BIOHAZARD)
peaked_cycles += stage/max_stages //every cycle we spend sick counts towards eventually curing the virus, faster at higher stages
recovery_prob += DISEASE_RECOVERY_CONSTANT + (peaked_cycles / (cycles_to_beat / DISEASE_RECOVERY_SCALING)) //more severe viruses are beaten back more aggressively after the peak
if(stage_peaked)
recovery_prob *= DISEASE_PEAKED_RECOVERY_MULTIPLIER
if(slowdown != 1) //using spaceacillin can help get them over the finish line to kill a virus with decreasing effect over time
recovery_prob += clamp((((1 - slowdown)*(DISEASE_SLOWDOWN_RECOVERY_BONUS * 2)) * ((DISEASE_SLOWDOWN_RECOVERY_BONUS_DURATION - chemical_offsets) / DISEASE_SLOWDOWN_RECOVERY_BONUS_DURATION)), 0, DISEASE_SLOWDOWN_RECOVERY_BONUS)
chemical_offsets = min(chemical_offsets + 1, DISEASE_SLOWDOWN_RECOVERY_BONUS_DURATION)
if(!HAS_TRAIT(affected_mob, TRAIT_NOHUNGER))
if(affected_mob.satiety < 0 || affected_mob.nutrition < NUTRITION_LEVEL_STARVING) //being malnourished makes it a lot harder to defeat your illness
recovery_prob -= DISEASE_MALNUTRITION_RECOVERY_PENALTY
else
if(affected_mob.satiety >= 0)
recovery_prob += round((DISEASE_SATIETY_RECOVERY_MULTIPLIER * (affected_mob.satiety/MAX_SATIETY)), 0.1)

if(affected_mob.mob_mood) // this and most other modifiers below a shameless rip from sleeping healing buffs, but feeling good helps make it go away quicker
switch(affected_mob.mob_mood.sanity_level)
if(SANITY_LEVEL_GREAT)
recovery_prob += 0.2
if(SANITY_LEVEL_NEUTRAL)
recovery_prob += 0.1
if(SANITY_LEVEL_DISTURBED)
recovery_prob += 0
if(SANITY_LEVEL_UNSTABLE)
recovery_prob += 0
if(SANITY_LEVEL_CRAZY)
recovery_prob += -0.1
if(SANITY_LEVEL_INSANE)
recovery_prob += -0.2

if((HAS_TRAIT(affected_mob, TRAIT_NOHUNGER) || !(affected_mob.satiety < 0 || affected_mob.nutrition < NUTRITION_LEVEL_STARVING)) && HAS_TRAIT(affected_mob, TRAIT_KNOCKEDOUT)) //resting starved won't help, but resting helps
var/turf/rest_turf = get_turf(affected_mob)
var/is_sleeping_in_darkness = rest_turf.get_lumcount() <= LIGHTING_TILE_IS_DARK

if(affected_mob.is_blind_from(EYES_COVERED) || is_sleeping_in_darkness)
recovery_prob += DISEASE_GOOD_SLEEPING_RECOVERY_BONUS

// sleeping in silence is always better
if(HAS_TRAIT(affected_mob, TRAIT_DEAF))
recovery_prob += DISEASE_GOOD_SLEEPING_RECOVERY_BONUS

// check for beds
if((locate(/obj/structure/bed) in affected_mob.loc))
recovery_prob += DISEASE_GOOD_SLEEPING_RECOVERY_BONUS
else if((locate(/obj/structure/table) in affected_mob.loc))
recovery_prob += (DISEASE_GOOD_SLEEPING_RECOVERY_BONUS / 2)

// don't forget the bedsheet
if(locate(/obj/item/bedsheet) in affected_mob.loc)
recovery_prob += DISEASE_GOOD_SLEEPING_RECOVERY_BONUS

// you forgot the pillow
if(locate(/obj/item/pillow) in affected_mob.loc)
recovery_prob += DISEASE_GOOD_SLEEPING_RECOVERY_BONUS

recovery_prob *= DISEASE_SLEEPING_RECOVERY_MULTIPLIER //any form of sleeping magnifies all effects a little bit

recovery_prob = clamp(recovery_prob, 0, 100)

if(recovery_prob)
if(SPT_PROB(recovery_prob, seconds_per_tick))
if(stage == 1 && prob(cure_chance * DISEASE_FINAL_CURE_CHANCE_MULTIPLIER)) //if we reduce FROM stage == 1, cure the virus - after defeating its cure_chance in a final battle
if(!HAS_TRAIT(affected_mob, TRAIT_NOHUNGER) && (affected_mob.satiety < 0 || affected_mob.nutrition < NUTRITION_LEVEL_STARVING))
if(stage_peaked == FALSE) //if you didn't ride out the virus from its peak, if you're malnourished when it cures, you don't get resistance
cure(add_resistance = FALSE)
return FALSE
else if(prob(50)) //if you rode it out from the peak, challenge cure_chance on if you get resistance or not
cure(add_resistance = TRUE)
return FALSE
else
cure(add_resistance = TRUE) //stay fed and cure it at any point, you're immune
return FALSE
update_stage(max(stage - 1, 1))

if(HAS_TRAIT(affected_mob, TRAIT_KNOCKEDOUT) || slowdown != 1) //sleeping and using spaceacillin lets us nosell applicable virus symptoms firing with decreasing effectiveness over time
if(prob(100 - min((100 * (symptom_offsets / DISEASE_SYMPTOM_OFFSET_DURATION)), 100 - cure_chance * DISEASE_FINAL_CURE_CHANCE_MULTIPLIER))) //viruses with higher cure_chance will ultimately be more possible to offset symptoms on
symptom_offsets = min(symptom_offsets + 1, DISEASE_SYMPTOM_OFFSET_DURATION)
return FALSE

>>>>>>> 854cee3d ([MIRROR] [NO GBP] Healing Virus Selfcure Hotfix [MDB IGNORE] (#25526))
return !carrier


Expand Down

0 comments on commit 9916aa2

Please sign in to comment.