From cda045479516285b290e61aa0bf53f1fae53e398 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 26 Jun 2021 22:21:06 -0400
Subject: [PATCH] invite

---
 src/events/PE/pePitFight.js                   |  1 -
 src/events/PE/pePitFightInvite.js             | 41 ++++++++++++++++++
 src/events/randomEvent.js                     |  1 +
 src/uncategorized/pePitFightInvite.tw         | 42 -------------------
 src/uncategorized/randomNonindividualEvent.tw |  2 -
 5 files changed, 42 insertions(+), 45 deletions(-)
 create mode 100644 src/events/PE/pePitFightInvite.js
 delete mode 100644 src/uncategorized/pePitFightInvite.tw

diff --git a/src/events/PE/pePitFight.js b/src/events/PE/pePitFight.js
index 873e87b869c..de7b9865747 100644
--- a/src/events/PE/pePitFight.js
+++ b/src/events/PE/pePitFight.js
@@ -3,7 +3,6 @@ App.Events.PEPitFight = class PEPitFight extends App.Events.BaseEvent {
 		return [
 			() => V.eventResults.pit === 1,
 			() => V.BodyguardID !== 0,
-
 		];
 	}
 
diff --git a/src/events/PE/pePitFightInvite.js b/src/events/PE/pePitFightInvite.js
new file mode 100644
index 00000000000..9b7e82dbf74
--- /dev/null
+++ b/src/events/PE/pePitFightInvite.js
@@ -0,0 +1,41 @@
+App.Events.PEPitFightInvite = class PEPitFightInvite extends App.Events.BaseEvent {
+	eventPrerequisites() {
+		return [
+			() => V.BodyguardID !== 0,
+		];
+	}
+
+	execute(node) {
+		let r = [];
+		V.nextButton = "Continue";
+		V.nextLink = "RIE Eligibility Check";
+		const slave = S.Bodyguard;
+		const {he} = getPronouns(slave);
+
+		V.eventResults.pit = 0;
+
+		r.push(`Gladiatorial combat between slaves has not yet reached the level of social acceptability it once enjoyed in Rome, but it's growing in popularity. For now, most fights are discreet affairs limited to select guests. Displaying a slave bodyguard is an excellent way to get yourself invited to participate, and V.assistant.name has just passed on an invitation to a private fight next week, should you be willing to hazard a bodyguard.`);
+		App.Events.addParagraph(node, r);
+		r = [];
+		if (V.pit) {
+			r.push(`Of course, ${capFirstChar(V.pit.name)} in ${V.arcologies[0].name} sees regular fights${(V.pit.lethal) ? " to the death" : ""}, but there's something extra special about attending these outside fights${(V.pit.lethal) ? ", especially with the very real risk of violent death" : ""}.`);
+		}
+		App.Events.addParagraph(node, r);
+
+		App.Events.addResponses(node, [
+			new App.Events.Result(`Enter your bodyguard as a gladiatrix`, enterBG),
+			new App.Events.Result(`Politely decline`, decline),
+		]);
+
+		function enterBG() {
+			App.Events.drawEventArt(node, S.Bodyguard);
+			V.eventResults.pit = 1;
+			return `You receive a brief confirmation. It looks like ${he}'s got a fight.`;
+		}
+
+		function decline() {
+			return `You decline the invitation.`;
+		}
+	}
+};
+
diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js
index 59fa02636c0..1fe5b527a71 100644
--- a/src/events/randomEvent.js
+++ b/src/events/randomEvent.js
@@ -109,6 +109,7 @@ App.Events.getNonindividualEvents = function() {
 		new App.Events.PEConcubineInterview(),
 		new App.Events.PEUnderageConcubine(),
 		new App.Events.PEHeadgirlConcubine(),
+		new App.Events.PEPitFightInvite(),
 
 		new App.Events.REDevotees(),
 		new App.Events.RERelativeRecruiter(),
diff --git a/src/uncategorized/pePitFightInvite.tw b/src/uncategorized/pePitFightInvite.tw
deleted file mode 100644
index 3554979101c..00000000000
--- a/src/uncategorized/pePitFightInvite.tw
+++ /dev/null
@@ -1,42 +0,0 @@
-:: PE pit fight invite [nobr]
-
-<<set $nextButton = "Continue">>
-<<set $nextLink = "RIE Eligibility Check">>
-
-<<set $eventResults.pit = 0>>
-<<setLocalPronouns _S.Bodyguard>>
-<span id="art-frame">
-</span>
-
-<p>Gladiatorial combat between slaves has not yet reached the level of social acceptability it once enjoyed in Rome, but it's growing in popularity. For now, most fights are discreet affairs limited to select guests. Displaying a slave bodyguard is an excellent way to get yourself invited to participate, and $assistant.name has just passed on an invitation to a private fight next week, should you be willing to hazard a bodyguard.</p>
-
-<<if $pit>>
-	<p>Of course, <<= capFirstChar($pit.name)>> in $arcologies[0].name sees regular fights<<if $pit.lethal>> to the death<</if>>, but there's something extra special about attending these outside fights<<if !$pit.lethal>>, especially with the very real risk of violent death<</if>>.</p>
-<</if>>
-
-<span id="result">
-<<link "Enter your bodyguard as a gladiatrix">>
-	<<replace "#art-frame">>
-	<span id="art-frame">
-	/* 000-250-006 */
-	<<if $seeImages == 1>>
-		<<if $imageChoice == 1>>
-			<div class="imageRef lrgVector"><div class="mask">&nbsp;</div><<SlaveArt _S.Bodyguard 3 0>></div>
-		<<else>>
-			<div class="imageRef lrgRender"><div class="mask">&nbsp;</div><<SlaveArt _S.Bodyguard 3 0>></div>
-		<</if>>
-	<</if>>
-	/* 000-250-006 */
-	</span>
-	<</replace>>
-	<<replace "#result">>
-	You receive a brief confirmation. It looks like $he's got a fight.
-	<<set $eventResults.pit = 1>>
-	<</replace>>
-<</link>>
-<br><<link "Politely decline">>
-	<<replace "#result">>
-	You decline the invitation.
-	<</replace>>
-<</link>>
-</span>
diff --git a/src/uncategorized/randomNonindividualEvent.tw b/src/uncategorized/randomNonindividualEvent.tw
index 9531617802b..fd2d54b2a4b 100644
--- a/src/uncategorized/randomNonindividualEvent.tw
+++ b/src/uncategorized/randomNonindividualEvent.tw
@@ -211,8 +211,6 @@
 
 	<<if _S.Bodyguard>>
 
-		<<set $events.push("PE pit fight invite")>>
-
 		<<if (_S.Bodyguard.skill.combat != 0)>>
 			<<set $PESSevent.push("bodyguard bedtime")>>
 		<</if>>
-- 
GitLab