From cd2055cf6a2829ce0aebd85777b620a3ae5222f9 Mon Sep 17 00:00:00 2001
From: kopareigns <kopareigns@gmail.com>
Date: Mon, 20 Jul 2020 21:58:03 -0400
Subject: [PATCH] Obedient Addict to JS

---
 src/events/RESS/obedientAddict.js | 121 ++++++++++++++++++++++++++++++
 src/events/randomEvent.js         |   1 +
 src/js/eventSelectionJS.js        |  16 ----
 src/uncategorized/RESS.tw         |  64 ----------------
 4 files changed, 122 insertions(+), 80 deletions(-)
 create mode 100644 src/events/RESS/obedientAddict.js

diff --git a/src/events/RESS/obedientAddict.js b/src/events/RESS/obedientAddict.js
new file mode 100644
index 00000000000..af3136923ea
--- /dev/null
+++ b/src/events/RESS/obedientAddict.js
@@ -0,0 +1,121 @@
+App.Events.RESSObedientAddict = class RESSObedientAddict extends App.Events.BaseEvent {
+	eventPrerequisites() {
+		return [
+			() => V.suppository === 0
+		];
+	}
+
+	actorPrerequisites() {
+		return [
+			[ // single event slave
+				s => s.fetish !== "mindbroken",
+				hasAnyArms,
+				hasAnyLegs,
+				s => s.aphrodisiacs > 0 || s.inflationType === "aphrodisiac",
+				s => s.addict > 20,
+				s => s.devotion > 20 || s.trust < -20
+			]
+		];
+	}
+
+	execute(node) {
+		/** @type {Array<App.Entity.SlaveState>} */
+		let [eventSlave] = this.actors.map(a => getSlave(a));
+		const {
+			He, he, His, his, him, girl
+		} = getPronouns(eventSlave);
+		const {S, s, c, sh, title: Master} = getEnunciation(eventSlave);
+
+		/** @type {App.Entity.PlayerState} */
+		let PC = V.PC;
+
+		V.nextLink = "Next Week";
+
+		App.Events.drawEventArt(node, eventSlave);
+
+		let t = [];
+
+		t.push(App.UI.DOM.slaveDescriptionDialog(eventSlave));
+		t.push(`takes ${his} aphrodisiacs in pill form, with ${his} food. They're dispensed alongside ${his} nutrition in the kitchen. You happen to be passing by when ${he}'s being issued ${his} drugs, and you see ${him} ${canSee(eventSlave) ? "staring" : "gazing"} thoughtfully at the insignificant-looking little pill, just holding it in ${his} hand and considering it for a long time. When ${he} realizes you're watching, ${he} turns to you and you realize ${his} eyes are moist.`);
+		if (canTalk(eventSlave)) {
+			t.push(`${He} ${SlaveStatsChecker.checkForLisp(eventSlave) ? "lisps through huge, quivering lips" : "mutters"}, "${Master}, I hate thi${s} ${sh}it. I come and come and come but it'${s} ju${s}t phy${s}ical. I haven't felt clo${s}e to anyone ever ${s}in${c}e I've been on the${s}e fucking aphrodi${s}iac${s}." ${He} shrugs bitterly. "${S}till crave them though."`);
+		} else {
+			t.push(`${He} uses trembling gestures to pour out dissatisfaction with life as an aphrodisiac addict. ${He} is emotionally unsatisfied with the mechanical orgasms ${he} gets on the drugs, but craves them intensely.`);
+		}
+		App.Events.addParagraph(node, t);
+		t = [];
+
+		App.Events.addResponses(node, [
+			new App.Events.Result(`Make an example by forcing ${him} to take a massive dose`, forceful),
+			canDoVaginal(eventSlave) || canDoAnal(eventSlave)
+				? new App.Events.Result(`Have caring sex with ${him} before ${he} takes the aphrodisiacs`, caring, virginityCheck())
+				: new App.Events.Result()
+		]);
+
+		function forceful() {
+			t = [];
+
+			if (hasAnyEyes(eventSlave)) {
+				t.push(`You take ${him} by the shoulders, look into ${his} ${hasBothEyes(eventSlave) ? "eyes" : "eye"},`);
+			} else {
+				t.push(`You take ${him} by the shoulders`);
+			}
+			t.push(`and tell ${him} you'll fix things so ${he} doesn't mind so much. ${He} looks hopeful, even when you tell ${him} to take ${his} pill. ${He} does, and you hand ${him} another. And another. ${He}'s crying with dread by the fourth pill, knowing that this is ${his} punishment for complaining. ${His} pupils dilate, ${he} begins to breathe hard, and ${his} ${eventSlave.skin} skin flushes badly. ${He} tries to beg you to fuck ${him} but can't seem to find the words. ${He} begins to masturbate compulsively, so hard that ${he} collapses to the kitchen floor with ${his} first spastic orgasm.`);
+			if (eventSlave.chastityPenis === 1) {
+				t.push(`${His} cock is painfully compressed by ${his} chastity cage, but it does nothing to stop ${his} frantic efforts to come.`);
+			} else if (canAchieveErection(eventSlave)) {
+				if (eventSlave.dick > 9) {
+					t.push(`${His} inhuman cock is as engorged as physically possible given its size, threatens to knock ${him} unconscious from the sheer amount of blood diverted into it, and doesn't shrink at all when cum weakly splurts from its tip.`);
+				} else if (eventSlave.dick > 6) {
+					t.push(`${His} monstrous cock is agonizingly erect, threatens to knock ${him} unconscious from the sheer amount of blood is takes ${him} to get hard, and doesn't soften at all when ${he} spatters ${his} own chest with cum.`);
+				} else if (eventSlave.dick > 4) {
+					t.push(`${His} huge cock is agonizingly erect and doesn't soften at all when ${he} spatters ${his} own chest with cum.`);
+				} else if (eventSlave.dick > 3) {
+					t.push(`${His} big cock is agonizingly erect and doesn't soften at all when ${he} spatters ${his} own chest with cum.`);
+				} else if (eventSlave.dick > 1) {
+					t.push(`${His} cock is agonizingly erect and doesn't soften at all when ${he} spatters ${his} own chest with cum.`);
+				} else if (eventSlave.dick > 0) {
+					t.push(`${His} pathetic dick is agonizingly erect and doesn't soften at all when ${he} weakly dribbles cum.`);
+				}
+			} else if (canDoVaginal(eventSlave)) {
+				t.push(`${His} pussy is dripping with moisture and ${his} ragingly stiff clit doesn't soften at all when ${he} comes.`);
+			} else if (canDoAnal(eventSlave)) {
+				t.push(`${His} hungry asshole spasms with orgasm, but ${he} doesn't even pause ${his} anal masturbation.`);
+			} else {
+				t.push(`${His} whole body spasms with orgasm, but ${he} doesn't even pause ${his} efforts to draw out an orgasm by any means possible.`);
+			}
+			t.push(`For the hour or so it takes ${him} to pass out, slaves using the kitchen have to step over ${his} prostrate, orgasming body, lying in a pool of ${his} own drool, tears, sweat, and fluids. The next time you see ${him} in the kitchen, ${he} takes ${his} medicine like a <span class="gold">good ${girl}.</span> All your aphrodisiac addicts recognize the symptoms and the punishment, and <span class="gold">avoid even thinking</span> about resisting the system.`);
+
+			V.slaves.forEach(function(s) { if (s.aphrodisiacs > 0 || s.inflationType === "aphrodisiac") { s.trust -= 5; } });
+			return t;
+		}
+
+		function caring() {
+			t = [];
+
+			t.push(`You back ${him} up against the wall of the kitchen, kissing ${him}, touching ${his} body with care, and quietly shushing ${his} attempts to ask questions. You deftly extract the pill form ${his} hand and put it on the counter for later. With time and skill you bring ${him} to a fine state of arousal, not to mention <span class="hotpink">emotional need;</span> ${he} begins to kiss you back with almost frantic enthusiasm. When ${he}'s clearly ready, you lay ${him} across the kitchen table and ${PC.dick === 0 ? `work your groin up between ${his} legs` : `enter ${him}`}, drawing out a lusty moan. As the sex continues, however, ${he} begins to look doubtful, then distracted, and then to twitch occasionally. Finally ${he} bursts into tears.`);
+			if (canTalk(eventSlave)) {
+				t.push(`"I — I — fucking need my fix to come, ${Master}," ${he} sobs.`);
+			} else {
+				t.push(`${He} indicates through ${his} weeping that ${he} can't climax without the drugs.`);
+			}
+			t.push(`You pass ${him} the pill, and ${he} continues to weep inconsolably, apologizing all the while, until the drug takes away ${his} ability to care about anything but getting fucked. When you finish and extract ${PC.dick === 0 ? `yourself from between ${his} legs` : `your cock from ${his} well-used hole`}, though, you think you can detect a deep sadness in ${his} eyes that it cannot reach.`);
+
+			eventSlave.devotion += 4;
+			if (canDoVaginal(eventSlave)) {
+				VCheck.Vaginal(1, eventSlave);
+			} else {
+				VCheck.Anal(1, eventSlave);
+			}
+			return t;
+		}
+
+		function virginityCheck() {
+			if (canDoVaginal(eventSlave) && eventSlave.vagina === 0) {
+				return `This option will take ${his} virginity`;
+			} else if (!canDoVaginal(eventSlave) && eventSlave.anus === 0) {
+				return `This option will take ${his} anal virginity`;
+			}
+		}
+	}
+};
diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js
index 5e48f298c59..bb7b0ef448f 100644
--- a/src/events/randomEvent.js
+++ b/src/events/randomEvent.js
@@ -17,6 +17,7 @@ App.Events.getIndividualEvents = function() {
 		new App.Events.RESSLazyEvening(),
 		new App.Events.RESSMoistPussy(),
 		new App.Events.RESSMuscles(),
+		new App.Events.RESSObedientAddict(),
 		new App.Events.RESSObedientBitchy(),
 		new App.Events.RESSObedientIdiot(),
 		new App.Events.RESSObedientShemale(),
diff --git a/src/js/eventSelectionJS.js b/src/js/eventSelectionJS.js
index ba6698674f8..20ab7a595da 100644
--- a/src/js/eventSelectionJS.js
+++ b/src/js/eventSelectionJS.js
@@ -1001,14 +1001,6 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 			}
 
-			if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
-				if (eventSlave.addict > 20) {
-					if (eventSlave.aphrodisiacs > 0 || eventSlave.inflationType === "aphrodisiac") {
-						V.RESSevent.push("obedient addict");
-					}
-				}
-			}
-
 			if (eventSlave.devotion <= 50) {
 				if (eventSlave.trust >= -50) {
 					if (eventSlave.behavioralFlaw === "gluttonous") {
@@ -2260,14 +2252,6 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				}
 			}
 
-			if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
-				if (eventSlave.addict > 20) {
-					if (eventSlave.aphrodisiacs > 0 || eventSlave.inflationType === "aphrodisiac") {
-						V.RESSevent.push("obedient addict");
-					}
-				}
-			}
-
 			if (eventSlave.devotion <= 50) {
 				if (eventSlave.trust >= -50) {
 					if (eventSlave.behavioralFlaw === "gluttonous") {
diff --git a/src/uncategorized/RESS.tw b/src/uncategorized/RESS.tw
index 7e2741480e1..2540ab75119 100644
--- a/src/uncategorized/RESS.tw
+++ b/src/uncategorized/RESS.tw
@@ -1388,15 +1388,6 @@ During a routine inspection, <<= App.UI.slaveDescriptionDialog($activeSlave)>> r
 	Can I get fucked in the pu<<ss>>y, to <<s>>pread it out a little?"
 <</if>>
 
-<<case "obedient addict">>
-
-<<= App.UI.slaveDescriptionDialog($activeSlave)>> takes $his aphrodisiacs in pill form, with $his food. They're dispensed alongside $his nutrition in the kitchen. You happen to be passing by when $he's being issued $his drugs, and you see $him <<if canSee($activeSlave)>>staring<<else>>gazing<</if>> thoughtfully at the insignificant-looking little pill, just holding it in $his hand and considering it for a long time. When $he realizes you're watching, $he turns to you and you realize $his eyes are moist.
-<<if !canTalk($activeSlave)>>
-	$He uses trembling gestures to pour out dissatisfaction with life as an aphrodisiac addict. $He is emotionally unsatisfied with the mechanical orgasms $he gets on the drugs, but craves them intensely.
-<<else>>
-	$He <<if SlaveStatsChecker.checkForLisp($activeSlave)>>lisps through huge, quivering lips,<<else>>mutters,<</if>> "<<Master>>, I hate thi<<s>> <<sh>>it. I come and come and come but it'<<s>> ju<<s>>t phy<<s>>ical. I haven't felt clo<<s>>e to anyone ever <<s>>in<<c>>e I've been on the<<s>>e fucking aphrodi<<s>>iac<<s>>." $He shrugs bitterly. "<<S>>till crave them though."
-<</if>>
-
 <<case "impregnation please">>
 
 <<set _faceUp = 1>>
@@ -8897,61 +8888,6 @@ brought in to you. This time <<= App.UI.slaveDescriptionDialog($activeSlave)>> h
 	<</replace>>
 <</link>><<if ($activeSlave.chastityVagina)>> //This option will remove $his chastity belt//<</if>>
 
-<<case "obedient addict">>
-
-<<link "Make an example by forcing $him to take a massive dose">>
-	<<replace "#result">>
-		You take $him by the shoulders<<if hasAnyEyes($activeSlave)>>,
-			look into $his eye<<if hasBothEyes($activeSlave)>>s<</if>>,
-		<</if>>
-		and tell $him you'll fix things so $he doesn't mind so much. $He looks hopeful, even when you tell $him to take $his pill. $He does, and you hand $him another. And another. $He's crying with dread by the fourth pill, knowing that this is $his punishment for complaining. $His pupils dilate, $he begins to breathe hard, and $his $activeSlave.skin skin flushes badly. $He tries to beg you to fuck $him but can't seem to find the words. $He begins to masturbate compulsively, so hard that $he collapses to the kitchen floor with $his first spastic orgasm.
-		<<if ($activeSlave.chastityPenis == 1)>>
-			$His cock is painfully compressed by $his chastity cage, but it does nothing to stop $his frantic efforts to come.
-		<<elseif canAchieveErection($activeSlave)>>
-			<<if $activeSlave.dick > 9>>
-				$His inhuman cock is as engorged as physically possible given its size, threatens to knock $him unconscious from the sheer amount of blood diverted into it, and doesn't shrink at all when cum weakly splurts from its tip.
-			<<elseif $activeSlave.dick > 6>>
-				$His monstrous cock is agonizingly erect, threatens to knock $him unconscious from the sheer amount of blood is takes $him to get hard, and doesn't soften at all when $he spatters $his own chest with cum.
-			<<elseif $activeSlave.dick > 4>>
-				$His huge cock is agonizingly erect and doesn't soften at all when $he spatters $his own chest with cum.
-			<<elseif $activeSlave.dick > 3>>
-				$His big cock is agonizingly erect and doesn't soften at all when $he spatters $his own chest with cum.
-			<<elseif $activeSlave.dick > 1>>
-				$His cock is agonizingly erect and doesn't soften at all when $he spatters $his own chest with cum.
-			<<elseif $activeSlave.dick > 0>>
-				$His pathetic dick is agonizingly erect and doesn't soften at all when $he weakly dribbles cum.
-			<</if>>
-		<<elseif canDoVaginal($activeSlave)>>
-			$His pussy is dripping with moisture and $his ragingly stiff clit doesn't soften at all when $he comes.
-		<<elseif canDoAnal($activeSlave)>>
-			$His hungry asshole spasms with orgasm, but $he doesn't even pause $his anal masturbation.
-		<<else>>
-			$His whole body spasms with orgasm, but $he doesn't even pause $his efforts to draw out an orgasm by any means possible.
-		<</if>>
-		For the hour or so it takes $him to pass out, slaves using the kitchen have to step over $his prostrate, orgasming body, lying in a pool of $his own drool, tears, sweat, and fluids. The next time you see $him in the kitchen, $he takes $his medicine like a @@.gold;good $girl.@@ All your aphrodisiac addicts recognize the symptoms and the punishment, and @@.gold;avoid even thinking@@ about resisting the system.
-		<<set $slaves.forEach(function(s) { if (s.aphrodisiacs > 0 || s.inflationType == "aphrodisiac") { s.trust -= 5; } })>>
-	<</replace>>
-<</link>>
-<<if canDoVaginal($activeSlave) || canDoAnal($activeSlave)>>
-	<br><<link "Have caring sex with $him before $he takes the aphrodisiacs">>
-		<<replace "#result">>
-			You back $him up against the wall of the kitchen, kissing $him, touching $his body with care, and quietly shushing $his attempts to ask questions. You deftly extract the pill form $his hand and put it on the counter for later. With time and skill you bring $him to a fine state of arousal, not to mention @@.hotpink;emotional need;@@ $he begins to kiss you back with almost frantic enthusiasm. When $he's clearly ready, you lay $him across the kitchen table and <<if $PC.dick == 0>>work your groin up between $his legs<<else>>enter $him<</if>>, drawing out a lusty moan. As the sex continues, however, $he begins to look doubtful, then distracted, and then to twitch occasionally. Finally $he bursts into tears.
-			<<if !canTalk($activeSlave)>>
-				$He indicates through $his weeping that $he can't climax without the drugs.
-			<<else>>
-				"I — I — fucking need my fix to come, <<Master>>," $he sobs.
-			<</if>>
-			You pass $him the pill, and $he continues to weep inconsolably, apologizing all the while, until the drug takes away $his ability to care about anything but getting fucked. When you finish and extract <<if $PC.dick == 0>>yourself from between $his legs<<else>>your cock from $his well-used hole<</if>>, though, you think you can detect a deep sadness in $his eyes that it cannot reach.
-			<<set $activeSlave.devotion += 4>>
-			<<if canDoVaginal($activeSlave)>>
-				<<= VCheck.Vaginal()>>
-			<<else>>
-				<<= VCheck.Anal()>>
-			<</if>>
-		<</replace>>
-	<</link>><<if canDoVaginal($activeSlave) && ($activeSlave.vagina == 0)>> //This option will take $his virginity//<<elseif !canDoVaginal($activeSlave) && ($activeSlave.anus == 0)>> //This option will take $his anal virginity//<</if>>
-<</if>>
-
 <<case "impregnation please">>
 
 <<link "Put a slave in $him">>
-- 
GitLab