From 81636a6c0dfd597cffdfea56ef25f13e74c87709 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 10 Jul 2021 19:33:16 -0400
Subject: [PATCH] p merc romeo

---
 src/events/nonRandom/mercs/pMercenaryRomeo.js | 275 +++++++++---------
 src/events/nonRandomEvent.js                  |   9 +-
 2 files changed, 142 insertions(+), 142 deletions(-)

diff --git a/src/events/nonRandom/mercs/pMercenaryRomeo.js b/src/events/nonRandom/mercs/pMercenaryRomeo.js
index 5443c0a110d..e546ae4b40e 100644
--- a/src/events/nonRandom/mercs/pMercenaryRomeo.js
+++ b/src/events/nonRandom/mercs/pMercenaryRomeo.js
@@ -1,31 +1,39 @@
-		:: P mercenary romeo [nobr]
+App.Events.PMercenaryRomeo = class PMercenaryRomeo extends App.Events.BaseEvent {
+	eventPrerequisites() {
+		return [
+			() => App.Events.effectiveWeek() >= 44,
+			() => V.mercenaries > 0,
+			() => V.mercRomeo !== 1,
+		];
+	}
 
-		V.nextButton = "Continue", V.nextLink = "Random Nonindividual Event", _name = 0;
+	actorPrerequisites() {
+		return [[
+			(s) => ([Job.PUBLIC, Job.CLUB, Job.WHORE, Job.BROTHEL].includes(s.assignment) || s.counter.publicUse >= 50),
+			(s) => s.fetish !== "mindbroken",
+			(s) => s.fuckdoll === 0
+		]]
+	}
 
-		_romeoSlaves = V.slaves.filter(function(s) { return s.fetish !== "mindbroken" && s.fuckdoll === 0 && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment); });
-		if (_romeoSlaves.length === 0) {
-			_romeoSlaves = V.slaves.filter(function(s) { return (s.counter.publicUse > 0) && (s.newGamePlus === 0) && (s.relationship > -3) && !["be your Concubine", "serve in the master suite"].includes(s.assignment); });
-			if (_romeoSlaves.length === 0) {
-				_name = setup.whiteAmericanSlaveNames.random();
-			} else {
-				_juliet = _romeoSlaves.random();
-			}
-		} else {
-			_juliet = _romeoSlaves.random();
-		}
-		if (ndef _juliet) {
-			_name = setup.whiteAmericanSlaveNames.random();
-		}
+	execute(node) {
+		let r = [];
+		V.nextButton = "Continue";
+		V.nextLink = "Random Nonindividual Event";
+		let _name = 0;
 
-		if (_name === 0) {
-			_slaveCost = slaveCost(_juliet);
-			_slaveCost = (random(60,70)*Math.trunc(_slaveCost/100));
-			_slaveCost = 100*Math.trunc(_slaveCost/100);
-			<<setLocalPronouns _juliet>>
-		}
-		<<setNonlocalPronouns V.seeDicks>>
+		const _juliet = getSlave(this.actors[0]);
 
-		One of your mercenaries requests an interview. He's a worn, grey-haired tank of a man, made bulkier still by heavy ceramic plate armor and lots of ammunition and gear. The murderous submachine gun favored for city fighting looks like a toy in his hands. But as he sits at your invitation and accepts a
+		let _slaveCost = slaveCost(_juliet);
+		_slaveCost = (random(60, 70) * Math.trunc(_slaveCost / 100));
+		_slaveCost = 100 * Math.trunc(_slaveCost / 100);
+		const {
+
+		} = getPronouns(_juliet);
+		const {
+
+		} = getNonlocalPronouns(V.seeDicks).appendSuffix("U")
+
+		r.push(`One of your mercenaries requests an interview.He's a worn, grey-haired tank of a man, made bulkier still by heavy ceramic plate armor and lots of ammunition and gear. The murderous submachine gun favored for city fighting looks like a toy in his hands. But as he sits at your invitation and accepts a`);
 		if (V.PC.refreshmentType === 0) {
 			r.push(`${V.PC.refreshment}`);
 		} else if (V.PC.refreshmentType === 1) {
@@ -41,135 +49,134 @@
 		} else if (V.PC.refreshmentType === 6) {
 			r.push(`tab of ${V.PC.refreshment}`);
 		}
-		proffered by an attentive slave _girlU, he seems almost bashful.
+		r.push(`proffered by an attentive slave _girlU, he seems almost bashful.`);
 
-		<br><br>
+		App.Events.addParagraph(node, r);
+		r = [];
 
-		"V.properTitle()
-			r.push(`, I'll say this straight. I'd like to buy one of your slaves.`);
+
+		r.push(`"${properTitle()}, I'll say this straight. I'd like to buy one of your slaves.`);
 		if (_name !== 0) {
-			<<setNonlocalPronouns V.seeDicks>>
-			r.push(`I've been seeing${  _name} a lot, and _heU makes the years sit a little lighter on me. I've scraped together what I can, and I can pay`);
-		V.cashFormat(50000)
-			r.push(`." It's a huge sum for a mercenary; it's probably his entire savings, but there is a slight problem; the slave he is looking for isn't one of yours. "Well then," he says in embarrassment, "Have to say this is a little awkward." He gives a fake cough, "You wouldn't happen to, you know, know who _hisU owner is?" You shake your head. A run in with a _girlU named _name isn't much to go by and it really isn't your problem. "Ah well, I'm sure I'll see _himU around again. Anyway, that was a fine victory the other day,`);
-		V.properTitle(); come down to the bar and join the boys and I. We'll buy you a drink. Devil knows, thanks to you we can afford to. Hell, maybe you'll even get to meet _name too, get to see just how much of a looker _heU is."
+			r.push(`I've been seeing ${_name} a lot, and ${_heU} makes the years sit a little lighter on me. I've scraped together what I can, and I can pay ${cashFormat(50000)}." It's a huge sum for a mercenary; it's probably his entire savings, but there is a slight problem; the slave he is looking for isn't one of yours. "Well then," he says in embarrassment, "Have to say this is a little awkward." He gives a fake cough, "You wouldn't happen to, you know, know who _hisU owner is?" You shake your head. A run in with a _girlU named _name isn't much to go by and it really isn't your problem. "Ah well, I'm sure I'll see _himU around again. Anyway, that was a fine victory the other day, properTitle(); come down to the bar and join the boys and I. We'll buy you a drink. Devil knows, thanks to you we can afford to. Hell, maybe you'll even get to meet _name too, get to see just how much of a looker _heU is."`);
+
 		} else {
 			if (["serve in the club", "serve the public", "whore", "work in the brothel"].includes(_juliet.assignment)) {
 				r.push(`I've been seeing`);
-		App.UI.slaveDescriptionDialog(_juliet)
-			r.push(`a lot, and ${he} makes the years sit a little lighter on me.`);
+				App.UI.slaveDescriptionDialog(_juliet)
+				r.push(`a lot, and ${he} makes the years sit a little lighter on me.`);
 			} else {
 				r.push(`I've seen`);
-		App.UI.slaveDescriptionDialog(_juliet)
-			r.push(`here and there and I can't stop thinking about ${him}. I feel ${he}'d make the years sit a little lighter on me.`);
+				App.UI.slaveDescriptionDialog(_juliet)
+				r.push(`here and there and I can't stop thinking about ${him}. I feel ${he}'d make the years sit a little lighter on me.`);
 			}
 			r.push(`I've scraped together what I can, and I can pay`);
-		V.cashFormat(_slaveCost)
+			V.cashFormat(_slaveCost)
 			r.push(`." It's a decent price, probably a little less than you could get at auction. It's a huge sum for a mercenary; it's probably his entire savings. You ask what he would do with ${him}. "Well," he says, actually blushing, "I'd free ${him}. And marry ${him}, if ${he}'d have me."`);
 
-			<br><br>
+			//<br><br>
 
-			<span id="result">
-			<<link "Decline, and tell ${him} not to see him">>
-				<<replace "#result">>
-					_juliet.slaveName obeys your orders not to see the old mercenary. Though neither he or _juliet.slaveName says a word about it, his squadmates are not so closemouthed. Soon the tragic story of The Mercenary and the Slave ${Girl} is being told in bars and brothels across the Free City, with you naturally playing <span class="red">the role of the villain.</span>
-					repX(-1000, "event");
-				<</replace>>
-			<</link>>
-			<br>
-		<<link "Politely decline">>
-				<<replace "#result">>
-					"Ah well," he says, "didn't think you would, but I had to ask. If you'd be so kind as to keep ${him} assigned so's I can see ${him}, I would be grateful. That was a fine victory, 
-		V.properTitle(); come down to the bar and join the boys and I. We'll buy you a drink. Devil knows, thanks to you we can afford to."
-					if (_juliet.relationship === -3 && _juliet.fetish !== "mindbroken" && _juliet.devotion+_juliet.trust > 190) {_juliet.slaveName politely thanks you for not letting him take ${him} away.
+			//<span id="result">
+			//<<link "Decline, and tell ${him} not to see him">>
+			//<<replace "#result">>
+			_juliet.slaveName obeys your orders not to see the old mercenary.Though neither he or _juliet.slaveName says a word about it, his squadmates are not so closemouthed.Soon the tragic story of The Mercenary and the Slave ${ Girl } is being told in bars and brothels across the Free City, with you naturally playing < span class="red" > the role of the villain.</span >
+				repX(-1000, "event");
+			//<</replace>>
+			//<</link>>
+			//<br>
+			//<<link "Politely decline">>
+			//<<replace "#result">>
+			"Ah well," he says, "didn't think you would, but I had to ask. If you'd be so kind as to keep ${him} assigned so's I can see ${him}, I would be grateful. That was a fine victory,
+			V.properTitle(); come down to the bar and join the boys and I.We'll buy you a drink. Devil knows, thanks to you we can afford to."
+			if (_juliet.relationship === -3 && _juliet.fetish !== "mindbroken" && _juliet.devotion + _juliet.trust > 190) {
+				_juliet.slaveName politely thanks you for not letting him take ${ him } away.
 		}
-				<</replace>>
-			<</link>>
-			<br>
-		<<link "Accept">>
-				<<replace "#result">>
-					r.push(`The mercenary leaves to collect his purchase. On the video feeds, you see that${  _juliet.slaveName} can hardly believe what's`);
-					if (_juliet.relationship === -3 && _juliet.fetish !== "mindbroken" && _juliet.devotion+_juliet.trust > 190) {
-						r.push(`happening. You can't hear what he says as he takes out a ring, but ${his} reaction speaks clearly. ${He} says "No."`);
-						if (canWalk(_juliet) && hasAnyArms(_juliet)) {
-							r.push(`${He} points back into your penthouse and returns to ${his} home.`);
-						} else {
-							r.push(`${He} gestures towards the nearest camera and he helps ${him} back into your penthouse.`);
-						}
-						r.push(`The only thing ${he} wants after being freed is to return to your side.`);
-						"I thought I was giving ${him} a better life... But ${he} already had everything ${he} wanted. I'm sorry for putting you in such a position." You can hear the sadness in his voice. "Thank you for your time. I'm sorry to have bothered you."
-						r.push(`Since ${he} returned to slavery, it's only fair to return the credits he paid for ${him}. He thanks you hollowly before heading on his way.`);
+			//<</replace>>
+			//<</link>>
+			//<br>
+			//<<link "Accept">>
+			//<<replace "#result">>
+			r.push(`The mercenary leaves to collect his purchase. On the video feeds, you see that${_juliet.slaveName} can hardly believe what's`);
+			if (_juliet.relationship === -3 && _juliet.fetish !== "mindbroken" && _juliet.devotion + _juliet.trust > 190) {
+				r.push(`happening. You can't hear what he says as he takes out a ring, but ${his} reaction speaks clearly. ${He} says "No."`);
+				if (canWalk(_juliet) && hasAnyArms(_juliet)) {
+					r.push(`${He} points back into your penthouse and returns to ${his} home.`);
+				} else {
+					r.push(`${He} gestures towards the nearest camera and he helps ${him} back into your penthouse.`);
+				}
+				r.push(`The only thing ${he} wants after being freed is to return to your side.`);
+				"I thought I was giving ${him} a better life... But ${he} already had everything ${he} wanted. I'm sorry for putting you in such a position." You can hear the sadness in his voice. "Thank you for your time. I'm sorry to have bothered you."
+				r.push(`Since ${he} returned to slavery, it's only fair to return the credits he paid for ${him}. He thanks you hollowly before heading on his way.`);
+			} else {
+				r.push(`happened.`);
+				if (hasAnyArms(_juliet) && hasBothLegs(_juliet)) {
+					r.push(`${He} hugs him, sobbing into his shoulder. As they walk hand in hand down towards his quarters,`);
+				} else {
+					r.push(`As he`);
+					if (!isAmputee(_juliet)) {
+						r.push(`gives`);
 					} else {
-						r.push(`happened.`);
-						if (hasAnyArms(_juliet) && hasBothLegs(_juliet)) {
-							r.push(`${He} hugs him, sobbing into his shoulder. As they walk hand in hand down towards his quarters,`);
-						} else {
-							r.push(`As he`);
-		if (!isAmputee(_juliet)) {
-			r.push(`gives`);
-		} else {
-			r.push(`picks up ${his} limbless form to give`);
-		}
-			r.push(`${him} a hug,`);
-						}
-						r.push(`${he} gives the nearest camera a little nod and silently mouths the words "Thank you,`);
-		V.getWrittenTitle(_juliet)
-			r.push(`." Soon the romantic story of The Mercenary and the Slave ${Girl} is being told in bars and brothels across the Free City, with you naturally playing <span class="green">a supporting role.</span>`);
-						cashX(_slaveCost, "slaveTransfer");
-						removeSlave(_juliet);
+						r.push(`picks up ${his} limbless form to give`);
 					}
-				<</replace>>
-			<</link>>
-			<br>
-		<<link "Give ${him} to him as a gift">>
-				<<replace "#result">>
-					r.push(`The mercenary cannot believe his ears. After you repeat yourself twice, he leaves to collect your gift, thanking you clumsily. On the video feeds, you see that${  _juliet.slaveName} can hardly believe what's`);
-					if (_juliet.relationship === -3 && _juliet.fetish !== "mindbroken" && _juliet.devotion+_juliet.trust > 190) {
-						r.push(`happening. You can't hear what he says as he takes out a ring, but ${his} reaction speaks clearly. ${He} says "No."`);
-						if (canWalk(_juliet) && hasAnyArms(_juliet)) {
-							r.push(`${He} points back into your penthouse and returns to ${his} home.`);
-						} else {
-							r.push(`${He} gestures towards the nearest camera and he helps ${him} back into your penthouse.`);
-						}
-						r.push(`The only thing ${he} wants after being freed is to return to your side.`);
-						"I thought I was giving ${him} a better life... But ${he} already had everything ${he} wanted. I'm sorry for putting you in such a position." You can hear the sadness in his voice. "Thank you for your time. I'm sorry to have bothered you."
+					r.push(`${him} a hug,`);
+				}
+				r.push(`${he} gives the nearest camera a little nod and silently mouths the words "Thank you,`);
+				V.getWrittenTitle(_juliet)
+				r.push(`." Soon the romantic story of The Mercenary and the Slave ${Girl} is being told in bars and brothels across the Free City, with you naturally playing <span class="green">a supporting role.</span>`);
+				cashX(_slaveCost, "slaveTransfer");
+				removeSlave(_juliet);
+			}
+			//<</replace>>
+			//<</link>>
+			//<br>
+			//<<link "Give ${him} to him as a gift">>
+			//<<replace "#result">>
+			r.push(`The mercenary cannot believe his ears. After you repeat yourself twice, he leaves to collect your gift, thanking you clumsily. On the video feeds, you see that${_juliet.slaveName} can hardly believe what's`);
+			if (_juliet.relationship === -3 && _juliet.fetish !== "mindbroken" && _juliet.devotion + _juliet.trust > 190) {
+				r.push(`happening. You can't hear what he says as he takes out a ring, but ${his} reaction speaks clearly. ${He} says "No."`);
+				if (canWalk(_juliet) && hasAnyArms(_juliet)) {
+					r.push(`${He} points back into your penthouse and returns to ${his} home.`);
+				} else {
+					r.push(`${He} gestures towards the nearest camera and he helps ${him} back into your penthouse.`);
+				}
+				r.push(`The only thing ${he} wants after being freed is to return to your side.`);
+				"I thought I was giving ${him} a better life... But ${he} already had everything ${he} wanted. I'm sorry for putting you in such a position." You can hear the sadness in his voice. "Thank you for your time. I'm sorry to have bothered you."
+			} else {
+				r.push(`happened.`);
+				if (hasAnyArms(_juliet) && hasAnyLegs(_juliet)) {
+					r.push(`${He} hugs him, sobbing into his shoulder. As they walk hand in hand down towards his quarters,`);
+				} else {
+					r.push(`As he`);
+					if (!isAmputee(_juliet)) {
+						r.push(`gives`);
 					} else {
-						r.push(`happened.`);
-						if (hasAnyArms(_juliet) && hasAnyLegs(_juliet)) {
-							r.push(`${He} hugs him, sobbing into his shoulder. As they walk hand in hand down towards his quarters,`);
-						} else {
-							r.push(`As he`);
-		if (!isAmputee(_juliet)) {
-			r.push(`gives`);
-		} else {
-			r.push(`picks up ${his} limbless form to give`);
-		}
-			r.push(`${him} a hug,`);
-						}
-						r.push(`${he} gives the nearest camera a little nod and silently mouths the words "Thank you,`);
-		V.getWrittenTitle(_juliet)
-			r.push(`." You smile to yourself; when they get there they'll find flowers and a paid reservation at the arcology's best restaurant. Soon the story is being told in bars and brothels across the Free City, with you naturally playing <span class="green">a starring role.</span> Some days later, you hear a dramatization is being filmed, with an aging action star playing the mercenary, a rising starlet playing _juliet.slaveName, and a noted character actor playing you.`);
-						repX(15000, "event");
-						_poster = "a poster for the movie that was made about the love between one of your mercenaries and " + _juliet.slaveName;
-						V.trinkets.push(_poster);
-						removeSlave(_juliet);
+						r.push(`picks up ${his} limbless form to give`);
 					}
-				<</replace>>
-			<</link>>
-			</span>
+					r.push(`${him} a hug,`);
+				}
+				r.push(`${he} gives the nearest camera a little nod and silently mouths the words "Thank you,`);
+				V.getWrittenTitle(_juliet)
+				r.push(`." You smile to yourself; when they get there they'll find flowers and a paid reservation at the arcology's best restaurant. Soon the story is being told in bars and brothels across the Free City, with you naturally playing <span class="green">a starring role.</span> Some days later, you hear a dramatization is being filmed, with an aging action star playing the mercenary, a rising starlet playing _juliet.slaveName, and a noted character actor playing you.`);
+				repX(15000, "event");
+				_poster = "a poster for the movie that was made about the love between one of your mercenaries and " + _juliet.slaveName;
+				V.trinkets.push(_poster);
+				removeSlave(_juliet);
+			}
+			//<</replace>>
+			//<</link>>
+			//</span>
 
-			<h3>${His} records...</h3>
-			<div class="note">
-				<div class="indent">
-					r.push(`${His} current task is to`);
-		V._juliet.assignment
-		if (V.assignmentRecords[_juliet.ID]) {
-			r.push(`, and before that to`);
-		V.V.assignmentRecords[_juliet.ID]
-		}
+			//<h3>${His} records...</h3>
+			//<div class="note">
+			//<div class="indent">
+			r.push(`${His} current task is to`);
+			V._juliet.assignment
+			if (V.assignmentRecords[_juliet.ID]) {
+				r.push(`, and before that to`);
+				V.V.assignmentRecords[_juliet.ID]
+			}
 			r.push(`.`);
-				</div>
-				<<includeDOM slaveImpactLongTerm(_juliet)>>
-			</div>
+			//</div>
+			//<<includeDOM slaveImpactLongTerm(_juliet)>>
+			//</div>
 
 		}
diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js
index 69fa401ef3c..cfc792730f5 100644
--- a/src/events/nonRandomEvent.js
+++ b/src/events/nonRandomEvent.js
@@ -103,6 +103,7 @@ App.Events.getNonrandomEvents = function() {
 
 		new App.Events.PEPitFight(),
 		new App.Events.PMercsHelpCorp(),
+		new App.Events.PMercenaryRomeo(),
 	];
 };
 
@@ -255,14 +256,6 @@ globalThis.nonRandomEvent = function() {
 			V.assholeKnight = 1;
 			V.imperialEventWeek = effectiveWeek;
 			setTimeout(() => Engine.play("SE assholeknight"), Engine.minDomActionDelay);
-		} else if ((effectiveWeek >= 44) && (V.mercenaries > 0) && V.mercRomeo !== 1) {
-			const valid = V.slaves.find(function(s) { return (["serve the public", "serve in the club", "whore", "work in the brothel"].includes(s.assignment) || s.counter.publicUse >= 50) && s.fetish !== "mindbroken" && s.fuckdoll === 0; });
-			V.mercRomeo = 1;
-			if (valid) {
-				setTimeout(() => Engine.play("P mercenary romeo"), Engine.minDomActionDelay);
-			} else {
-				setTimeout(() => Engine.play("Nonrandom Event"), Engine.minDomActionDelay);
-			}
 		} else if (effectiveWeek === 54 && (V.peacekeepers) && V.peacekeepers.attitude >= 0) {
 			setTimeout(() => Engine.play("P peacekeepers deficit"), Engine.minDomActionDelay);
 		} else if (V.SF.Toggle && V.SF.Active === -1 && effectiveWeek >= 72) {
-- 
GitLab