From b15ff2d65364fef27f3fad56c3ab2486d94d9990 Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Mon, 23 Sep 2019 21:05:53 -0400
Subject: [PATCH] pUndergroundRailroad.tw fixes

---
 src/uncategorized/pUndergroundRailroad.tw | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/uncategorized/pUndergroundRailroad.tw b/src/uncategorized/pUndergroundRailroad.tw
index a73c89f24fe..b72fcc4f6e0 100644
--- a/src/uncategorized/pUndergroundRailroad.tw
+++ b/src/uncategorized/pUndergroundRailroad.tw
@@ -2,17 +2,17 @@
 
 <<set $nextButton = " ", $nextLink = "Random Nonindividual Event">> /* hide button until user makes a selection */
 
-<<set $activeSlave = $slaves.find(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && s.devotion < 75 && s.trust < 75 && s.indenture == -1 && canWalk(s) && canTalk(s) && canSee($activeSlave) && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment); })>>
+<<set $activeSlave = $slaves.filter(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && s.devotion < 75 && s.trust < 75 && s.indenture == -1 && canWalk(s) && canTalk(s) && canSee(s) && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment); }).random()>>
 <<if (ndef $activeSlave)>> /* search again without assignments limitation */
-	<<set $activeSlave = $slaves.find(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && s.indenture == -1 && canSee($activeSlave) && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment); })>>
+	<<set $activeSlave = $slaves.filter(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && s.indenture == -1 && canSee(s) && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment); }).random()>>
 	<<if (ndef $activeSlave)>> /* we will find one */
-		<<set $activeSlave = $slaves.find(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && s.devotion < 20 && canTalk(s) && canSee($activeSlave); })>>
+		<<set $activeSlave = $slaves.filter(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && s.devotion < 20 && canTalk(s) && canSee(s); }).random()>>
 		<<if (ndef $activeSlave)>> /* we will find one */
-			<<set $activeSlave = $slaves.find(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && canTalk(s) && canSee($activeSlave); })>>
+			<<set $activeSlave = $slaves.filter(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && canTalk(s) && canSee(s); }).random()>>
 			<<if (ndef $activeSlave)>> /* anyone out there? */
-				<<set $activeSlave = $slaves.find(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && canSee($activeSlave); })>>
+				<<set $activeSlave = $slaves.filter(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken" && canWalk(s) && canSee(s); }).random()>>
 				<<if (ndef $activeSlave)>> /* still no match */
-					<<set $activeSlave = $slaves.find(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken"; })>>
+					<<set $activeSlave = $slaves.filter(function(s) { return s.fuckdoll == 0 && s.fetish != "mindbroken"; }).random()>>
 					<<if (ndef $activeSlave)>> /* STILL no match */
 						<<set $activeSlave = $slaves.random()>>
 					<</if>>
@@ -24,8 +24,6 @@
 <<setAssistantPronouns>>
 <<set $fcnn.push("...you believe a slave has been contacted by the Daughters of Liberty, please call...")>>
 
-<<set $traitorType = "standard">>
-/*
 <<if $activeSlave.devotion+$activeSlave.trust >= 175>>
 	<<set $traitorType = "agent">>
 <<elseif $activeSlave.trust <= -75>>
@@ -35,7 +33,6 @@
 <<else>>
 	<<set $traitorType = "standard">>
 <</if>>
-*/
 
 One fine day, as normal as any day surrounded by your slaves can be, you're sitting at your desk when
 <<if $traitorType == "agent">>
-- 
GitLab