|
1692 | 1692 | overdose_threshold = 30 |
1693 | 1693 | ph = 9.12 |
1694 | 1694 | chemical_flags = REAGENT_CAN_BE_SYNTHESIZED |
| 1695 | + /// Running total of how much sanity we gained |
| 1696 | + VAR_FINAL/regained_sanity = 0 |
1695 | 1697 |
|
1696 | 1698 | /datum/reagent/medicine/psicodine/on_mob_metabolize(mob/living/affected_mob) |
1697 | 1699 | . = ..() |
1698 | 1700 | ADD_TRAIT(affected_mob, TRAIT_FEARLESS, type) |
| 1701 | + // NON-MODULE CHANGE |
1699 | 1702 | 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) |
1700 | 1706 |
|
1701 | 1707 | /datum/reagent/medicine/psicodine/on_mob_end_metabolize(mob/living/affected_mob) |
1702 | 1708 | . = ..() |
1703 | 1709 | REMOVE_TRAIT(affected_mob, TRAIT_FEARLESS, type) |
| 1710 | + // NON-MODULE CHANGE |
1704 | 1711 | REMOVE_TRAIT(affected_mob, TRAIT_HEART_RATE_SLOW, type) |
1705 | 1712 | 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) |
1706 | 1715 |
|
1707 | 1716 | /datum/reagent/medicine/psicodine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) |
1708 | 1717 | . = ..() |
1709 | 1718 | affected_mob.adjust_jitter(-12 SECONDS * REM * seconds_per_tick) |
1710 | 1719 | affected_mob.adjust_dizzy(-12 SECONDS * REM * seconds_per_tick) |
1711 | 1720 | affected_mob.adjust_confusion(-6 SECONDS * REM * seconds_per_tick) |
1712 | 1721 | 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) |
1715 | 1727 |
|
| 1728 | +// NON-MODULE CHANGE |
1716 | 1729 | /datum/reagent/medicine/psicodine/overdose_start(mob/living/affected_mob) |
1717 | 1730 | . = ..() |
1718 | 1731 | ADD_TRAIT(affected_mob, TRAIT_HEART_RATE_SLOW, "[type]_overdose") |
|
1723 | 1736 | if(affected_mob.adjustToxLoss(1 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)) |
1724 | 1737 | return UPDATE_MOB_HEALTH |
1725 | 1738 |
|
| 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 | + |
1726 | 1768 | /datum/reagent/medicine/metafactor |
1727 | 1769 | name = "Mitogen Metabolism Factor" |
1728 | 1770 | description = "This enzyme catalyzes the conversion of nutricious food into healing peptides." |
|
0 commit comments