From 0fef47ec3bb03444483aed161a299fe688fe21a9 Mon Sep 17 00:00:00 2001
From: kopareigns <kopareigns@gmail.com>
Date: Mon, 20 Jul 2020 21:57:45 -0400
Subject: [PATCH] Obedient Shemale to JS

---
 src/events/RESS/obedientShemale.js | 113 +++++++++++++++++++++++++++++
 src/events/randomEvent.js          |   1 +
 src/js/eventSelectionJS.js         |  28 -------
 src/uncategorized/RESS.tw          |  55 --------------
 4 files changed, 114 insertions(+), 83 deletions(-)
 create mode 100644 src/events/RESS/obedientShemale.js

diff --git a/src/events/RESS/obedientShemale.js b/src/events/RESS/obedientShemale.js
new file mode 100644
index 00000000000..4aa6bffd953
--- /dev/null
+++ b/src/events/RESS/obedientShemale.js
@@ -0,0 +1,113 @@
+App.Events.RESSObedientShemale = class RESSObedientShemale extends App.Events.BaseEvent {
+	eventPrerequisites() {
+		return [];
+	}
+
+	actorPrerequisites() {
+		return [
+			[ // single event slave
+				s => s.fetish !== "mindbroken",
+				hasAnyArms,
+				hasAnyLegs,
+				canTalk,
+				canDoAnal,
+				s => s.devotion <= 50,
+				s => s.devotion > 20 || s.trust < -20,
+				s => s.vagina < 0,
+				s => s.dick > 0,
+				s => s.anus > 0,
+				s => s.skill.anal <= 30
+			]
+		];
+	}
+
+	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, title: Master} = getEnunciation(eventSlave);
+		const anusDesc = ["tight", "loose", "gaping"][Math.ceil(Math.clamp(eventSlave.anus, 1, 3)) - 1];
+
+		/** @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(`has been doing ${his} best to be a good slave ${girl} recently. Since ${he} doesn't have a pussy, that means ${he}'s been doing ${his} best to take it up the ass like a good slave. ${He} isn't all that used to it yet, but ${he} tries. ${He}'s trying right now, bent over the arm of the couch in your office with your ${PC.dick === 0 ? "vibrating strap-on" : "cock"} pumping in and out of ${him}. ${He} looks like ${he} wants to ask something, so you tell ${him} to spit it out.`);
+		if (canTalk(eventSlave)) {
+			if (eventSlave.lips > 70) {
+				t.push(`${He} begs meekly through ${his} massive dick-sucking lips,`);
+			} else if (eventSlave.lipsPiercing + eventSlave.tonguePiercing > 2) {
+				t.push(`${He} begs meekly through ${his} mouthful of piercings,`);
+			} else {
+				t.push(`${He} begs meekly,`);
+			}
+			t.push(`"${Master}, may I plea${s}e, plea${s}e touch my${s}elf?"`);
+		} else {
+			t.push(`${He} uses gestures to ask if ${he} can masturbate while you sodomize ${him}.`);
+		}
+		App.Events.addParagraph(node, t);
+		t = [];
+
+		App.Events.addResponses(node, [
+			new App.Events.Result(`Let ${him}`, permit),
+			new App.Events.Result(`Train ${him} to be a skilled anal bottom`, bottom),
+			(eventSlave.fetish !== "buttslut" || eventSlave.fetishKnown !== 1) && eventSlave.prostate > 0
+				? new App.Events.Result(`Train ${him} to orgasm anally`, orgasm)
+				: new App.Events.Result()
+		]);
+
+		function permit() {
+			t = [];
+
+			t.push(`${He} moans with gratitude and relief. ${He} masturbates furiously as you continue to use ${his} butt. ${He} was clearly near the edge anyway, and`);
+			if (eventSlave.balls > 0) {
+				t.push("spatters the couch with cum");
+			} else if (eventSlave.prostate > 0) {
+				t.push("spatters the couch with ejaculate");
+			} else {
+				t.push("shakes with release");
+			}
+			t.push(`after just a few strokes of your ${PC.dick === 0 ? "strap-on" : "cock"} up ${his} butt. ${His} ${anusDesc} ass spasms and tightens with ${his} climax${PC.dick !== 0 ? ", a wonderful sensation" : ""}. You aren't finished with ${him}, but ${he} rubs ${him}self languidly and enjoys the hard anal reaming more than ${he} ever has previously. ${His} devotion to you <span class="hotpink">has increased.</span>`);
+
+			eventSlave.devotion += 4;
+			VCheck.Anal(1, eventSlave);
+			return t;
+		}
+
+		function bottom() {
+			t = [];
+
+			t.push(`${He} obeys your orders to keep ${his} ${hasBothArms(eventSlave) ? "hands" : "hand"} off ${his} dick, but can't hide ${his} disappointment and frustration. You keep a close watch on ${him}, and buttfuck ${him} every chance you get, teaching ${him} the finer points of taking a ${PC.dick === 0 ? "strap-on" : "dick"} up the butt. You focus entirely on your pleasure, teaching ${him} how to use ${his} ${anusDesc} anal ring to extract orgasms from cocks. This experience was hard for ${him} but has increased ${his} anal skill.`);
+
+			SkillIncrease.Anal(eventSlave, 10);
+			VCheck.Anal(9, eventSlave);
+			return t;
+		}
+
+		function orgasm() {
+			t = [];
+
+			t.push(`${He} obeys your orders to keep ${his} ${hasBothArms(eventSlave) ? "hands" : "hand"} off ${his} dick, but can't hide ${his} disappointment and frustration. You keep a close watch on ${him}, and fuck ${his} ${anusDesc} anus every chance you get, keeping ${him} desperately aroused and desperately sodomized. After some days of this, ${he} finally reaches a point of desperate arousal that permits ${him} to orgasm to prostate stimulation alone.`);
+			if (fetishChangeChance(eventSlave) > jsRandom(1,100)) {
+				t.push(`Before ${he} realizes what's happening, <span class="lightcoral">${he}'s getting aroused at the thought of anal sex.</span>`);
+
+				eventSlave.fetishStrength = 10;
+				eventSlave.fetish = "buttslut";
+				eventSlave.fetishKnown = 1;
+			} else {
+				t.push(`Despite being used as an anal slut for a whole week, ${he} was not significantly affected.`);
+			}
+
+			VCheck.Anal(9, eventSlave);
+			return t;
+		}
+	}
+};
diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js
index ec625c1f7c0..5e48f298c59 100644
--- a/src/events/randomEvent.js
+++ b/src/events/randomEvent.js
@@ -19,6 +19,7 @@ App.Events.getIndividualEvents = function() {
 		new App.Events.RESSMuscles(),
 		new App.Events.RESSObedientBitchy(),
 		new App.Events.RESSObedientIdiot(),
+		new App.Events.RESSObedientShemale(),
 		new App.Events.RESSRetchingCum(),
 		new App.Events.RESSSuppositoryResistance(),
 		new App.Events.RESSWaistlineWoes(),
diff --git a/src/js/eventSelectionJS.js b/src/js/eventSelectionJS.js
index a7dfab27dd7..ba6698674f8 100644
--- a/src/js/eventSelectionJS.js
+++ b/src/js/eventSelectionJS.js
@@ -489,20 +489,6 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					}
 				}
 
-				if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
-					if (eventSlave.devotion <= 50) {
-						if (eventSlave.vagina < 0) {
-							if (canDoAnal(eventSlave)) {
-								if (eventSlave.anus > 0) {
-									if (eventSlave.skill.anal <= 30) {
-										V.RESSevent.push("obedient shemale");
-									}
-								}
-							}
-						}
-					}
-				}
-
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.physicalAge > 37) {
@@ -1924,20 +1910,6 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					}
 				}
 
-				if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
-					if (eventSlave.devotion <= 50) {
-						if (eventSlave.vagina < 0) {
-							if (canDoAnal(eventSlave)) {
-								if (eventSlave.anus > 0) {
-									if (eventSlave.skill.anal <= 30) {
-										V.RESSevent.push("obedient shemale");
-									}
-								}
-							}
-						}
-					}
-				}
-
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.physicalAge > 37) {
diff --git a/src/uncategorized/RESS.tw b/src/uncategorized/RESS.tw
index 6c3f7cd67fc..7e2741480e1 100644
--- a/src/uncategorized/RESS.tw
+++ b/src/uncategorized/RESS.tw
@@ -1388,22 +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 shemale">>
-
-<<= App.UI.slaveDescriptionDialog($activeSlave)>> has been doing $his best to be a good slave $girl recently. Since $he doesn't have a pussy, that means $he's been doing $his best to take it up the ass like a good slave. $He isn't all that used to it yet, but $he tries. $He's trying right now, bent over the arm of the couch in your office with your <<if $PC.dick == 0>>vibrating strap-on<<else>>cock<</if>> pumping in and out of $him. $He looks like $he wants to ask something, so you tell $him to spit it out.
-<<if !canTalk($activeSlave)>>
-	$He uses gestures to ask if $he can masturbate while you sodomize $him.
-<<else>>
-	<<if ($activeSlave.lips > 70)>>
-		$He begs meekly through $his massive dick-sucking lips,
-	<<elseif ($activeSlave.lipsPiercing+$activeSlave.tonguePiercing > 2)>>
-		$He begs meekly through $his mouthful of piercings,
-	<<else>>
-		$He begs meekly,
-	<</if>>
-	"<<Master>>, may I plea<<s>>e, plea<<s>>e touch my<<s>>elf?"
-<</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.
@@ -8913,45 +8897,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 shemale">>
-
-<<link "Let $him">>
-	<<replace "#result">>
-		$He moans with gratitude and relief. $He masturbates furiously as you continue to use $his butt. $He was clearly near the edge anyway, and
-		<<if ($activeSlave.balls > 0)>>
-			spatters the couch with cum
-		<<elseif $activeSlave.prostate > 0>>
-			spatters the couch with ejaculate
-		<<else>>
-			shakes with release
-		<</if>>
-		after just a few strokes of your <<if $PC.dick == 0>>strap-on<<else>>dick<</if>> up $his butt. $His <<if ($activeSlave.anus > 2)>>gaping<<elseif ($activeSlave.anus > 1)>>loose<<else>>tight<</if>> ass spasms and tightens with $his climax<<if $PC.dick != 0>>, a wonderful sensation<</if>>. You aren't finished with $him, but $he rubs $himself languidly and enjoys the hard anal reaming more than $he ever has previously. $His devotion to you @@.hotpink;has increased.@@
-		<<set $activeSlave.devotion += 4>>
-		<<= VCheck.Anal()>>
-	<</replace>>
-<</link>>
-<br><<link "Train $him to be a skilled anal bottom">>
-	<<replace "#result">>
-		$He obeys your orders to keep $his hand<<if hasBothArms($activeSlave)>>s<</if>> off $his dick, but can't hide $his disappointment and frustration. You keep a close watch on $him, and buttfuck $him every chance you get, teaching $him the finer points of taking a <<if $PC.dick == 0>>strap-on<<else>>dick<</if>> up the butt. You focus entirely on your pleasure, teaching $him how to use $his <<if ($activeSlave.anus > 2)>>gaping<<elseif ($activeSlave.anus > 1)>>loose<<else>>tight<</if>> anal ring to extract orgasms from cocks. This experience was hard for $him but has increased $his anal skill.
-		<<= SkillIncrease.Anal($activeSlave, 10)>>
-		<<= VCheck.Anal(9)>>
-	<</replace>>
-<</link>>
-<<if (($activeSlave.fetish != "buttslut") || ($activeSlave.fetishKnown != 1)) && $activeSlave.prostate > 0>>
-	<br><<link "Train $him to orgasm anally">>
-		<<replace "#result">>
-			$He obeys your orders to keep $his hand<<if hasBothArms($activeSlave)>>s<</if>> off $his dick, but can't hide $his disappointment and frustration. You keep a close watch on $him, and fuck $his <<if ($activeSlave.anus > 2)>>gaping<<elseif ($activeSlave.anus > 1)>>loose<<else>>tight<</if>> anus every chance you get, keeping $him desperately aroused and desperately sodomized. After some days of this, $he finally reaches a point of desperate arousal that permits $him to orgasm to prostate stimulation alone.
-			<<= VCheck.Anal(9)>>
-			<<if random(1,100) > 50>>
-				<<set $activeSlave.fetishStrength = 10, $activeSlave.fetish = "buttslut", $activeSlave.fetishKnown = 1>>
-				Before $he realizes what's happening, @@.lightcoral;$he's getting aroused at the thought of anal sex.@@
-			<<else>>
-				Despite being used as an anal slut for a whole week, $he was not significantly affected.
-			<</if>>
-		<</replace>>
-	<</link>>
-<</if>>
-
 <<case "obedient addict">>
 
 <<link "Make an example by forcing $him to take a massive dose">>
-- 
GitLab