Skip to content

Commit 0de065f

Browse files
committed
Psicodine buff
1 parent e0589ab commit 0de065f

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

code/modules/reagents/chemistry/reagents/medicine_reagents.dm

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,27 +1692,40 @@
16921692
overdose_threshold = 30
16931693
ph = 9.12
16941694
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
1695+
/// Running total of how much sanity we gained
1696+
VAR_FINAL/regained_sanity = 0
16951697

16961698
/datum/reagent/medicine/psicodine/on_mob_metabolize(mob/living/affected_mob)
16971699
. = ..()
16981700
ADD_TRAIT(affected_mob, TRAIT_FEARLESS, type)
1701+
// NON-MODULE CHANGE
16991702
ADD_TRAIT(affected_mob, TRAIT_HEART_RATE_SLOW, type)
1703+
for(var/datum/status_effect/psicodine_wear_off/debuff in affected_mob.status_effects)
1704+
regained_sanity += debuff.sanity_to_lose
1705+
qdel(debuff)
17001706

17011707
/datum/reagent/medicine/psicodine/on_mob_end_metabolize(mob/living/affected_mob)
17021708
. = ..()
17031709
REMOVE_TRAIT(affected_mob, TRAIT_FEARLESS, type)
1710+
// NON-MODULE CHANGE
17041711
REMOVE_TRAIT(affected_mob, TRAIT_HEART_RATE_SLOW, type)
17051712
REMOVE_TRAIT(affected_mob, TRAIT_HEART_RATE_SLOW, "[type]_overdose")
1713+
if(regained_sanity > 0)
1714+
affected_mob.apply_status_effect(/datum/status_effect/psicodine_wear_off, current_cycle, regained_sanity)
17061715

17071716
/datum/reagent/medicine/psicodine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired)
17081717
. = ..()
17091718
affected_mob.adjust_jitter(-12 SECONDS * REM * seconds_per_tick)
17101719
affected_mob.adjust_dizzy(-12 SECONDS * REM * seconds_per_tick)
17111720
affected_mob.adjust_confusion(-6 SECONDS * REM * seconds_per_tick)
17121721
affected_mob.adjust_disgust(-6 SECONDS * REM * seconds_per_tick)
1713-
if(affected_mob.mob_mood && affected_mob.mob_mood.sanity <= SANITY_NEUTRAL) // only take effect if in negative sanity and then...
1714-
affected_mob.mob_mood.set_sanity(min(affected_mob.mob_mood.sanity + (5 * REM * seconds_per_tick), SANITY_NEUTRAL)) // set minimum to prevent unwanted spiking over neutral
1722+
// NON-MODULE CHANGE
1723+
// boosts sanity directly up to neutral. tracks sanity regained this way. after the drug effect ends, sanity gained is lost over time.
1724+
var/pre_sanity = affected_mob.mob_mood?.sanity
1725+
affected_mob.mob_mood?.adjust_sanity(5 * REM * seconds_per_tick, maximum = SANITY_NEUTRAL, override = TRUE)
1726+
regained_sanity += max(0, affected_mob.mob_mood?.sanity - pre_sanity)
17151727

1728+
// NON-MODULE CHANGE
17161729
/datum/reagent/medicine/psicodine/overdose_start(mob/living/affected_mob)
17171730
. = ..()
17181731
ADD_TRAIT(affected_mob, TRAIT_HEART_RATE_SLOW, "[type]_overdose")
@@ -1723,6 +1736,35 @@
17231736
if(affected_mob.adjustToxLoss(1 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype))
17241737
return UPDATE_MOB_HEALTH
17251738

1739+
// NON-MODULE CHANGE
1740+
/datum/status_effect/psicodine_wear_off
1741+
id = "psicodine_wear_off"
1742+
duration = 2 MINUTES
1743+
tick_interval = 1 SECONDS
1744+
alert_type = null
1745+
remove_on_fullheal = TRUE
1746+
/// Base duration of the effect, calculated based on how much psicodine was metabolized
1747+
VAR_FINAL/base_duration = 0
1748+
/// Total sanity to lose over the course of the effect
1749+
VAR_FINAL/sanity_to_lose = 0
1750+
/// Sanity lost per tick, calculated based on total sanity to lose and base duration
1751+
VAR_FINAL/sanity_per_tick = 0
1752+
1753+
/datum/status_effect/psicodine_wear_off/on_creation(mob/living/new_owner, psicodine_cycle = 1, sanity_to_lose = 0)
1754+
src.base_duration = psicodine_cycle * SSmobs.wait
1755+
src.duration = src.base_duration
1756+
src.sanity_to_lose = sanity_to_lose * (HAS_TRAIT(new_owner, TRAIT_UNSTABLE) ? 1 : 0.2)
1757+
src.sanity_per_tick = src.sanity_to_lose / (src.base_duration / src.tick_interval)
1758+
return ..()
1759+
1760+
/datum/status_effect/psicodine_wear_off/tick(seconds_between_ticks)
1761+
if(sanity_to_lose <= 0)
1762+
qdel(src)
1763+
return
1764+
1765+
owner.mob_mood?.adjust_sanity(-1 * sanity_per_tick, override = TRUE)
1766+
sanity_to_lose -= sanity_per_tick
1767+
17261768
/datum/reagent/medicine/metafactor
17271769
name = "Mitogen Metabolism Factor"
17281770
description = "This enzyme catalyzes the conversion of nutricious food into healing peptides."

0 commit comments

Comments
 (0)