diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index 0bfbe31fb1..043158da11 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -33,4 +33,8 @@ #define STATUS_EFFECT_SIGILMARK /datum/status_effect/sigil_mark #define STATUS_EFFECT_BELLIGERENT /datum/status_effect/belligerent //forces the affected to walk, doing damage if they try to run +#define STATUS_EFFECT_MANIAMOTOR /datum/status_effect/maniamotor //disrupts, damages, and confuses the affected as long as they're in range of the motor +#define MAX_MANIA_SEVERITY 100 //how high the mania severity can go +#define MANIA_DAMAGE_TO_CONVERT 90 //how much damage is required before it'll convert affected targets + #define STATUS_EFFECT_HISWRATH /datum/status_effect/his_wrath //His Wrath. diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 8eec853047..9f6e481edb 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -76,3 +76,89 @@ /datum/status_effect/belligerent/on_remove() if(owner.m_intent == MOVE_INTENT_WALK) owner.toggle_move_intent() + + +/datum/status_effect/maniamotor + id = "maniamotor" + duration = -1 + tick_interval = 10 + status_type = STATUS_EFFECT_MULTIPLE + alert_type = null + var/obj/structure/destructible/clockwork/powered/mania_motor/motor + var/severity = 0 //goes up to a maximum of MAX_MANIA_SEVERITY + var/warned_turnoff = FALSE //if we've warned that the motor is off + var/warned_outofsight = FALSE //if we've warned that the target is out of sight of the motor + var/static/list/mania_messages = list("Go nuts.", "Take a crack at crazy.", "Make a bid for insanity.", "Get kooky.", "Move towards mania.", "Become bewildered.", "Wax wild.", \ + "Go round the bend.", "Land in lunacy.", "Try dementia.", "Strive to get a screw loose.", "Advance forward.", "Approach the transmitter.", "Touch the antennae.", \ + "Move towards the mania motor.", "Come closer.", "Get over here already!", "Keep your eyes on the motor.") + var/static/list/flee_messages = list("Oh, NOW you flee.", "Get back here!", "If you were smarter, you'd come back.", "Only fools run.", "You'll be back.") + var/static/list/turnoff_messages = list("Why would they turn it-", "What are these idi-", "Fools, fools, all of-", "Are they trying to c-", "All this effort just f-") + var/static/list/powerloss_messages = list("\"Oh, the id**ts di***t s***e en**** pow**...\"", "\"D*dn't **ey mak* an **te***c*i*n le**?\"", "\"The** f**ls for**t t* make a ***** *f-\"", \ + "\"No, *O, you **re so cl***-\"", "You hear a yell of frustration, cut off by static.") + +/datum/status_effect/maniamotor/Destroy() + motor = null + return ..() + +/datum/status_effect/maniamotor/tick() + var/is_servant = is_servant_of_ratvar(owner) + var/span_part = severity > 50 ? "" : "_small" //let's save like one check + if(QDELETED(motor)) + if(!is_servant) + to_chat(owner, "You feel a frustrated voice quietly fade from your mind...") + qdel(src) + return + if(!motor.active) //it being off makes it fall off much faster + if(!is_servant && !warned_turnoff) + if(motor.total_accessable_power() > motor.mania_cost) + to_chat(owner, "\"[text2ratvar(pick(turnoff_messages))]\"") + else + to_chat(owner, "[text2ratvar(pick(powerloss_messages))]") + warned_turnoff = TRUE + severity = max(severity - 2, 0) + if(!severity) + qdel(src) + return + else + if(prob(severity * 2)) + warned_turnoff = FALSE + if(!(owner in viewers(7, motor))) //not being in range makes it fall off slightly faster + if(!is_servant && !warned_outofsight) + to_chat(owner, "\"[text2ratvar(pick(flee_messages))]\"") + warned_outofsight = TRUE + severity = max(severity - 1, 0) + if(!severity) + qdel(src) + return + else if(prob(severity * 2)) + warned_outofsight = FALSE + if(is_servant) //heals servants of braindamage, hallucination, druggy, dizziness, and confusion + if(owner.hallucination) + owner.hallucination = 0 + if(owner.druggy) + owner.adjust_drugginess(-owner.druggy) + if(owner.dizziness) + owner.dizziness = 0 + if(owner.confused) + owner.confused = 0 + severity = 0 + else if(!owner.null_rod_check() && owner.stat != DEAD && severity) + var/static/hum = get_sfx('sound/effects/screech.ogg') //same sound for every proc call + if(owner.getToxLoss() > MANIA_DAMAGE_TO_CONVERT) + if(is_eligible_servant(owner)) + to_chat(owner, "\"[text2ratvar("You are mine and his, now.")]\"") + add_servant_of_ratvar(owner) + owner.Paralyse(5) + else + if(prob(severity * 0.15)) + to_chat(owner, "\"[text2ratvar(pick(mania_messages))]\"") + owner.playsound_local(get_turf(motor), hum, severity, 1) + owner.adjust_drugginess(Clamp(max(severity * 0.075, 1), 0, max(0, 50 - owner.druggy))) //7.5% of severity per second, minimum 1 + if(owner.hallucination < 50) + owner.hallucination = min(owner.hallucination + max(severity * 0.075, 1), 50) //7.5% of severity per second, minimum 1 + if(owner.dizziness < 50) + owner.dizziness = min(owner.dizziness + round(severity * 0.05, 1), 50) //5% of severity per second above 10 severity + if(owner.confused < 25) + owner.confused = min(owner.confused + round(severity * 0.025, 1), 25) //2.5% of severity per second above 20 severity + owner.adjustToxLoss(severity * 0.02, TRUE, TRUE) //2% of severity per second + severity--