:: Random Nonindividual Event

<<silently>>

<<set $showEncyclopedia = 0>>

<<set $events = []>>
<<set $RecETSevent = []>>
<<set $REFIevent = []>>
<<set $PESSevent = []>>
<<set $PETSevent = []>>
<<set $activeSlave = 0>>
<<set $groomSlave = 0>>
<<set $brideSlave = 0>>

<<set $seed = 0>>
<<set $eventSlave = $slaves.random()>>

<<if $eventSlave.fuckdoll == 0>>

<<if $nicknamesAllowed == 1>>
<<if $eventSlave.assignment != "be confined in the arcade">>
<<set $toSearch = $eventSlave.slaveName.toLowerCase();>>
<<if ($toSearch.indexOf("'") == -1)>>
	<<if ($week-$eventSlave.weekAcquired >= 4)>>
	<<if ($eventSlave.devotion >= -20)>>
	<<set $events.push("RE nickname")>>
	<<set $events.push("RE nickname")>>
	<<set $events.push("RE nickname")>>
	<<set $events.push("RE nickname")>>
	<<set $seed = 1>>
	<<else>>
	<<set $events.push("RE nickname")>>
	<<set $events.push("RE nickname")>>
	<<set $seed = 1>>
	<</if>>
	<</if>>
<</if>> /* closes nickname check */
<</if>>
<</if>> /* closes no nicknames option */

<</if>> /* CLOSES FUCKDOLL CHECK */

<<set $legendaryFacility = 1>>
<<if $legendaryWhoreID != 0>>
	<<set $events.push("RE legendary whore")>>
<</if>>
<<if $legendaryEntertainerID != 0>>
	<<set $events.push("RE legendary entertainer")>>
<</if>>
<<if $legendaryCowID != 0>>
	<<set $events.push("RE legendary cow")>>
<</if>>
<<if $legendaryBallsID != 0>>
	<<set $events.push("RE legendary balls")>>
<</if>>
<<if $legendaryWombID != 0>>
	<<set $events.push("RE legendary womb")>>
<</if>>
<<if $legendaryAbolitionistID != 0>>
<<set $events.push("RE former abolitionist")>>
<</if>>

<<if $shelterAbuse <= 5>>
<<if $shelterGirlsIDs.length > 0>>
<<set $events.push("RE shelter inspection")>>
<</if>>
<</if>>

/* Relationship Events */

<<if $familyTesting == 1>>

<<set $used = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($used == 0)>>
<<if ($slaves[$i].daughters > 0)>>
<<if ($slaves[$i].devotion > 50)>>
	<<set $mother = $slaves[$i]>>
	<<set $daughter = RandomDaughter($slaves[$i])>>
	<<if ($daughter.devotion > 50)>>
	<<if canWalk($daughter)>>
		<<if canWalk($mother)>>
		<<if ($daughter.anus != 0)>>
			<<if ($mother.anus != 0)>>
			<<set $events.push("RE devoted mother daughter")>>
			<<set $used = 1>>
			<</if>>
		<</if>>
		<</if>>
	<</if>>
	<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<<set $used = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($used == 0)>>
<<if ($slaves[$i].sisters > 0)>>
<<if ($slaves[$i].dick == 1)>>
	<<set $youngerSister = $slaves[$i]>>
	<<set $olderSister = randomSister($slaves[$i])>>
<<if ($olderSister.anus == 0)>>
<<if ($youngerSister.devotion > ($olderSister.devotion+20))>>
<<set $events.push("RE sibling revenge")>>
<<set $used = 1>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<<set $used = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($used == 0)>>
<<if ($slaves[$i].sisters > 0)>>
	<<set $alphaTwin = $slaves[$i]>>
	<<set $betaTwin = randomTwinSister($slaves[$i])>>
<<if ($alphaTwin.anus > 0)>>
<<if ($betaTwin.anus > 0)>>
<<if ($alphaTwin.devotion > 50)>>
<<if ($betaTwin.devotion > 50)>>
<<if canWalk($alphaTwin)>>
<<if canWalk($betaTwin)>>
<<set $events.push("RE devoted twins")>>
<<set $used = 1>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<<else>>

<<set $used = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($used == 0)>>
<<if ($slaves[$i].relation == "mother")>>
<<if ($slaves[$i].relationshipTarget != $slaves[$i].relationTarget)>>
<<if ($slaves[$i].devotion > 50)>>
	<<set $mother = $slaves[$i]>>
	<<for $j = 0; $j < $slaves.length; $j++>>
	<<if $slaves[$j].ID == $mother.relationTarget>>
		<<set $daughter = $slaves[$j]>>
		<<break>>
	<</if>>
	<</for>>
	<<if ($daughter.devotion > 50)>>
	<<if canWalk($daughter)>>
		<<if canWalk($mother)>>
		<<if ($daughter.anus != 0)>>
			<<if ($mother.anus != 0)>>
			<<set $events.push("RE devoted mother daughter")>>
			<<set $used = 1>>
			<</if>>
		<</if>>
		<</if>>
	<</if>>
	<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<<set $used = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($used == 0)>>
<<if ($slaves[$i].relation == "sister")>>
<<if ($slaves[$i].dick == 1)>>
	<<set $youngerSister = $slaves[$i]>>
	<<for $j = 0; $j < $slaves.length; $j++>>
		<<if $slaves[$j].ID == $slaves[$i].relationTarget>>
			<<set $olderSister = $slaves[$j]>>
			<<break>>
		<</if>>
	<</for>>
<<if ($olderSister.anus == 0)>>
<<if ($youngerSister.devotion > ($olderSister.devotion+20))>>
<<set $events.push("RE sibling revenge")>>
<<set $used = 1>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<<set $used = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($used == 0)>>
<<if ($slaves[$i].relation == "twin")>>
	<<set $alphaTwin = $slaves[$i]>>
	<<for $j = 0; $j < $slaves.length; $j++>>
		<<if $slaves[$j].ID == $slaves[$i].relationTarget>>
			<<set $betaTwin = $slaves[$j]>>
			<<break>>
		<</if>>
	<</for>>
<<if ($alphaTwin.anus > 0)>>
<<if ($betaTwin.anus > 0)>>
<<if ($alphaTwin.devotion > 50)>>
<<if ($betaTwin.devotion > 50)>>
<<if canWalk($alphaTwin)>>
<<if canWalk($betaTwin)>>
<<set $events.push("RE devoted twins")>>
<<set $used = 1>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<</if>>  /* closes extended family mode */

/* Fetish Interest Events */

<<set $buttslutID = 0>>
<<set $cumslutID = 0>>
<<set $humiliationID = 0>>
<<set $subID = 0>>
<<set $pregnancyID = 0>>
<<set $masochistID = 0>>
<<set $boobsID = 0>>
<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($slaves[$i].fetishKnown == 1)>>
<<if ($slaves[$i].fetishStrength > 95)>>
<<if ($slaves[$i].fetish == "buttslut")>>
	<<if ($slaves[$i].anus > 0)>>
	<<if ($buttslutID == 0)>>
		<<set $buttslutID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<<elseif ($slaves[$i].fetish == "cumslut")>>
	<<if ($cumslutID == 0)>>
		<<set $cumslutID = $slaves[$i].ID>>
	<</if>>
<<elseif ($slaves[$i].fetish == "submissive")>>
	<<if ($slaves[$i].anus > 0)>>
	<<if ($subID == 0)>>
		<<set $subID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<<elseif ($slaves[$i].fetish == "humiliation")>>
	<<if ($slaves[$i].anus > 0)>>
	<<if ($humiliationID == 0)>>
		<<set $humiliationID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<<elseif ($slaves[$i].fetish == "boobs")>>
	<<if ($slaves[$i].lactation > 0)>>
	<<if ($boobsID == 0)>>
		<<set $boobsID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<<elseif ($slaves[$i].fetish == "pregnancy")>>
	<<if ($slaves[$i].preg > 15)>>
	<<if ($pregnancyID == 0)>>
		<<set $pregnancyID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<<elseif ($slaves[$i].fetish == "masochist")>>
	<<if ($slaves[$i].anus != 0)>>
	<<if ($masochistID == 0)>>
		<<set $masochistID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

<<for $i = 0; $i < $slaves.length; $i++>>
<<if ($slaves[$i].speechRules != "restrictive")>>
<<if ($slaves[$i].assignment != "work in the dairy") || ($dairyRestraintsSetting < 2)>>
<<if ($slaves[$i].fetish == "none") || ($slaves[$i].fetishStrength <= 60)>>
	<<if ($buttslutID != 0)>>
	<<if ($slaves[$i].anus != 0)>>
		<<set $REFIevent.push("buttslut")>>
		<<set $buttslutInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<</if>>
	<<if ($cumslutID != 0)>>
		<<set $REFIevent.push("cumslut")>>
		<<set $cumslutInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<<if ($subID != 0)>>
		<<set $REFIevent.push("submissive")>>
		<<set $submissiveInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<<if ($humiliationID != 0)>>
		<<set $REFIevent.push("humiliation")>>
		<<set $humiliationInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<<if ($boobsID != 0)>>
		<<set $REFIevent.push("boobs")>>
		<<set $boobsInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<<if ($pregnancyID != 0)>>
	<<if ($slaves[$i].anus != 0)>>
		<<set $REFIevent.push("pregnancy")>>
		<<set $pregnancyInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<</if>>
	<<if ($masochistID != 0)>>
	<<if ($slaves[$i].anus != 0)>>
		<<set $REFIevent.push("masochist")>>
		<<set $masochistInterestTargetID = $slaves[$i].ID>>
	<</if>>
	<</if>>
<</if>>
<</if>>
<</if>>
<</for>>

/* Multislave Events */

<<if def $slaves[3]>>
<<if ($slaves[3].devotion > 50)>>
<<if canWalk($slaves[3])>>
<<if canWalk($slaves[2])>>
<<if canWalk($slaves[1])>>
<<if canWalk($slaves[0])>>
	<<set $events.push("RE devotees")>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if $fuckSlaves > 1>>
	<<set $events.push("RE full bed")>>
<</if>>
<<if $fuckSlaves > 3>>
	<<set $events.push("RE staffed morning")>>
<</if>>

<<if $slaves.length > 2>>
<<if ($slaves[$slaves.length-2].devotion < -20)>>
<<if canWalk($slaves[$slaves.length-2])>>
<<if ($slaves[$slaves.length-2].assignment != "be confined in the arcade")>>
<<if ($slaves[$slaves.length-2].assignment != "work in the dairy") || ($dairyRestraintsSetting < 2)>>
<<if canWalk($slaves[$slaves.length-1])>>
<<if ($slaves[$slaves.length-1].assignment != "be confined in the arcade")>>
<<if ($slaves[$slaves.length-1].assignment != "work in the dairy") || ($dairyRestraintsSetting < 2)>>
	<<set $events.push("RE rebels")>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if $brothelSlaves > 3>>
	<<set $events.push("RE busy brothel")>>
<</if>>
<<if $clubSlaves > 3>>
	<<set $events.push("RE busy club")>>
<</if>>
<<if $dairySlaves > 3>>
<<if $dairyRestraintsSetting < 2>>
	<<set $events.push("RE busy dairy")>>
<</if>>
<</if>>
<<if $servantsQuartersSlaves > 3>>
	<<set $events.push("RE busy servants quarters")>>
<</if>>
<<if $arcadeSlaves > 3>>
	<<set $events.push("RE busy arcade")>>
<</if>>
<<if $masterSuiteSlaves > 3>>
	<<if $Concubine != 0>>
	<<set $events.push("RE busy master suite")>>
	<</if>>
<</if>>

/* Position Events */

<<if ($HeadGirl != 0)>>

	<<if ($Concubine != 0)>>
	<<if $fuckSlaves > 1>>
	<<if canTalk($Concubine)>>
	<<if canSee($Concubine)>>
	<<if canWalk($Concubine)>>
		<<set $events.push("PE headgirl concubine")>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>

	<<if ($HeadGirl.dick > 0)>>
	<<if ($HeadGirl.hormones < 1)>>
	<<if ($slaves[$slaves.length-1].devotion <= 20)>>
		<<set $PESSevent.push("headgirl dickgirl")>>
	<</if>>
	<</if>>
	<<if ($universalRuleImpregnation == "HG")>>
	<<if ($HeadGirl.devotion > 95)>>
	<<if ($HeadGirl.balls > 0)>>
		<<set $PESSevent.push("worshipful impregnatrix")>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>

	<<if ($HeadGirl.devotion > 95)>>
	<<if ($slaves.length > 4)>>
		<<set $PESSevent.push("loving headgirl")>>
	<</if>>
	<<if ($week > 20)>>
	<<if ($HeadGirl.trust > 95)>>
	<<if ($HeadGirl.intelligence > 1)>>
		<<set $PESSevent.push("worried headgirl")>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>

<</if>>

<<if ($Bodyguard != 0)>>

	<<set $events.push("PE pit fight invite")>>

	<<if ($Bodyguard.combatSkill != 0)>>
		<<set $PESSevent.push("bodyguard bedtime")>>
	<</if>>

	<<if ($Bodyguard.relationship == 0)>>
	<<if ($Bodyguard.relationshipRules == "permissive")>>
	<<if ($Bodyguard.fetish != "mindbroken")>>
	<<set $seed = 0>>
	<<for $j = 0; $j < $slaves.length; $j++>>
	<<if ($slaves[$j].relationship == 0)>>
		<<set $seed = 1>>
		<<break>>
	<</if>>
	<</for>>
	<<if ($seed == 1)>>
		<<set $events.push("PE lonely bodyguard")>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>

	<<if ($Bodyguard.combatSkill == 0)>>
		<<set $events.push("PE combat training")>>
		<<set $events.push("PE combat training")>>
		<<set $events.push("PE combat training")>>
	<</if>>

<</if>>

<<if ($Milkmaid != 0)>>

	<<if ($dairySlaves >= 5)>>
	<<if ($Milkmaid.health >= 70)>>
	<<if ($Milkmaid.muscles > 5)>>
		<<set $PESSevent.push("tired milkmaid")>>
	<</if>>
	<<if canAchieveErection($Milkmaid)>>
		<<set $PESSevent.push("tired collectrix")>>
	<</if>>
	<</if>>
	<</if>>

<</if>>

<<if ($Stewardess != 0)>>

	<<if ($servantsQuartersSlaves >= 1)>>
	<<if ($Stewardess.actualAge >= 35)>>
		<<set $PETSevent.push("stewardess beating")>>
	<</if>>
	<</if>>

<</if>>

<<if ($Madam != 0)>>

	<<if ($brothelSlaves >= 5)>>
	<<if ($Madam.actualAge >= 35)>>
	<<if ($Madam.whoreSkill >= 100)>>
		<<set $PESSevent.push("madam strategy")>>
	<</if>>
	<</if>>
	<</if>>

<</if>>

<<if ($DJ != 0)>>

	<<if ($clubSlaves >= 5)>>
	<<if ($DJ.face > 95)>>
	<<if ($DJ.entertainSkill >= 100)>>
		<<set $PESSevent.push("DJ publicity")>>
	<</if>>
	<</if>>
	<</if>>

<</if>>

<<if ($Schoolteacher != 0)>>
	<<if ($schoolroomSlaves >= 1)>>
	<<if ($Schoolteacher.intelligence >= 1)>>
	<<if ($Schoolteacher.actualAge >= 35)>>
		<<set $PETSevent.push("aggressive schoolteacher")>>
	<</if>>
	<</if>>
	<</if>>
<</if>>

<<if ($Wardeness != 0)>>
	<<if ($cellblockSlaves > 0)>>
	<<if canTalk($Wardeness)>>
		<<set $PETSevent.push("abusive wardeness")>>
	<</if>>
	<</if>>
<</if>>

<<if ($Attendant != 0)>>
	<<if ($spaSlaves > 0)>>
	<<if canTalk($Attendant)>>
		<<set $PETSevent.push("comforting attendant")>>
	<</if>>
	<</if>>
<</if>>

<<if ($Nurse != 0)>>
<<if ($clinicSlaves > 0)>>
	<<set $nurseMolestationSubIDs = []>>
	<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].assignment == "get treatment in the clinic">>
	<<if $slaves[$i].anus != 0>>
		<<set $nurseMolestationSubIDs.push($slaves[$i].ID)>>
	<</if>>
	<</if>>
	<</for>>
	<<if ($nurseMolestationSubIDs.length > 0)>>
	<<if ($Nurse.energy > 95) || (($Nurse.fetishStrength > 60) && (($Nurse.fetish == "sadist") || ($Nurse.fetish == "dom")))>>
		<<set $PETSevent.push("nurse molestation")>>
		<<set $nurseMolestationSubIDs = $slaves[$i].ID>>
	<</if>>
	<</if>>
<</if>>
<</if>>

<<if ($Concubine != 0)>>
	<<if canWalk($Concubine)>>
	<<if canSee($Concubine)>>
	<<set $PESSevent.push("loving concubine")>>
	<</if>>
	<<if canTalk($Concubine)>>
		<<set $events.push("PE concubine interview")>>
	<</if>>
	<</if>>
<</if>>

/* Acquisition Events */

<<set $events.push("RE recruit")>>
<<if random(1,100) < $rep/200>>
	<<set $events.push("RE recruit")>>
<</if>>
<<if $ProRecruitment == 1>>
<<if random(1,100) < $rep/200>>
	<<set $events.push("RE recruit")>>
<</if>>
<</if>>
<<if $AntiEnslavementRep == 0>>
<<if random(1,100) < $rep/300>>
	<<set $events.push("RE recruit")>>
<</if>>
<</if>>
<<if $AntiEnslavementCash == 0>>
<<if random(1,100) < $rep/300>>
	<<set $events.push("RE recruit")>>
<</if>>
<</if>>
<<set $recruit = []>>

<<if $seeDicks != 2>> /*XX ACQUISITIONS*/

<<set $recruit.push("female debtor")>>
<<set $recruit.push("desperate milf")>>
<<if $arcologies[0].FSRestart == "unset">>
	<<set $recruit.push("desperate preg")>>
<</if>>
<<set $recruit.push("blind homeless")>>
<<set $recruit.push("female SD")>>
<<set $recruit.push("female SE")>>
<<set $recruit.push("CCS angel")>>
<<set $recruit.push("CCS DA")>>
<<set $recruit.push("racer loser")>>
<<set $recruit.push("racer winner")>>
<<set $recruit.push("repo housekeeper")>>
<<set $recruit.push("repo nanny")>>
<<set $recruit.push("farm cow")>>
<<set $recruit.push("farm virgin cow")>>
<<set $recruit.push("orphan rebellious female")>>
<<set $recruit.push("captured teen")>>
<<if ($mercenaries > 5)>>
	<<set $recruit.push("female runaway")>>
<</if>>
<<if ($cash > 20000)>>
	<<set $recruit.push("school sale")>>
<</if>>
<<if ($HeadGirl.devotion > 50) && ($HeadGirl.entertainSkill >= 100)>>
	<<set $recruit.push("female recruit")>>
<</if>>
<<if ($HeadGirl.devotion > 50) && ($HeadGirl.whoreSkill >= 100)>>
	<<set $recruit.push("whore recruit")>>
<</if>>
<<if ($AProsperityCap > 60)>>
	<<set $events.push("RE malefactor")>>
	<<set $malefactor = ["liberator", "whore", "businesswoman", "addict", "anchorBaby"]>>
	<<if $seeDicks != 0>>
	<<set $malefactor.push("rapist")>>
	<</if>>
	<<if $minimumSlaveAge <= 12>>
	<<set $malefactor.push("orphanloli")>>
	<</if>>
	<<if $arcologies[0].FSPaternalist < 50>>
	<<set $malefactor.push("escapee")>>
	<</if>>
	<<set $malefactor = $malefactor.random()>>
	<<if ($rep/150) > random(1,100)>>
	<<set $events.push("RE malefactor")>>
	<</if>>
<</if>>

<</if>>

<<if $seeDicks != 0>> /*XY ACQUISITIONS*/

<<set $recruit.push("male debtor")>>
<<set $recruit.push("tg addict")>>
<<set $recruit.push("male SD")>>
<<set $recruit.push("MTF SE")>>
<<set $recruit.push("DG SE")>>
<<set $recruit.push("gang leader")>>
<<set $recruit.push("racer DG chaser")>>
<<set $recruit.push("farm bull")>>
<<set $recruit.push("orphan femboy")>>
<<if ($mercenaries > 5)>>
	<<set $recruit.push("DG runaway")>>
	<<set $recruit.push("herm runaway")>>
<</if>>
<<if ($cash > 20000)>>
	<<set $recruit.push("school trap")>>
<</if>>
<<if ($HeadGirl.devotion > 50) && ($HeadGirl.dick > 0)>>
	<<set $recruit.push("male recruit")>>
<</if>>
<<if $seeDicks != 2>>
	<<if ($HeadGirl.devotion > 50)>>
		<<set $RecETSevent.push("mismatched pair")>>
	<</if>>
	<<if ($rep/250) > random(1,100)>>
		<<set $RecETSevent.push("matched pair")>>
	<</if>>
	<<if ($rep/250) > random(1,100) && $arcologies[0].FSRestart == "unset">>
		<<set $RecETSevent.push("identical herm pair")>>
	<</if>>
	<<if ($rep/250) > random(1,100) && $arcologies[0].FSRestart == "unset">>
		<<set $RecETSevent.push("incest mother son")>>
	<</if>>
	<<if ($rep/250) > random(1,100) && $arcologies[0].FSRestart == "unset">>
		<<set $RecETSevent.push("incest father daughter")>>
	<</if>>
<</if>>

<<else>> /*XX ACQUISITIONS*/

<<if ($rep/250) > random(1,100)>>
	<<set $RecETSevent.push("identical pair")>>
<</if>>
<<if ($rep/250) > random(1,100)>>
	<<set $RecETSevent.push("posh mother daughter")>>
<</if>>

<</if>>

<<if ($rep/250) > random(1,100)>>
	<<set $RecETSevent.push("addict mother daughter")>>
<</if>>
<<if ($rep/250) > random(1,100)>>
	<<set $recruit.push("immigrant")>>
<</if>>

<<if ($PC.dick == 1) && ($PC.vagina == 0) && ($PC.boobs == 0) && ($PC.title == 1)>>
	<<if ($rep/250) > random(1,100)>>
	<<set $recruit.push("handsome PC")>>
	<<set $recruit.push("handsome PC")>>
	<</if>>
<<elseif ($PC.dick == 0) && ($PC.boobs == 1) && ($PC.title == 0)>>
	<<if ($rep/250) > random(1,100)>>
	<<set $recruit.push("womanly PC")>>
	<<set $recruit.push("womanly PC")>>
	<</if>>
<<elseif ($PC.dick == 1) && ($PC.boobs == 1)>>
	<<if ($rep/250) > random(1,100)>>
	<<set $recruit.push("shemale PC")>>
	<<set $recruit.push("shemale PC")>>
	<</if>>
<</if>>

<<if $familyTesting == 1>>

<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].fuckdoll == 0>>
	<<if $slaves[$i].canRecruit == 1>>
	<<if ($slaves[$i].devotion > 50)>>
	<<if canWalk($slaves[$i])>>
	<<if random(1,100) > 90+(totalRelatives($slaves[$i])*2)>>
		<<for $j = 0; $j < $slavesOriginal.length; $j++>>
			<<if $slaves[$i].ID == $slavesOriginal[$j].ID>>
				<<set $events.push("RE relative recruiter")>>
				<<break>>
			<</if>>
		<</for>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
<</for>>

<<else>>

<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].recruiter != 0>>
	<<if $slaves[$i].canRecruit == 1>>
	<<if ($slaves[$i].devotion > 50)>>
	<<if ($slaves[$i].relation == 0)>>
	<<if canWalk($slaves[$i])>>
		<<for $j = 0; $j < $recruiters.length; $j++>>
			<<if $slaves[$i].ID == $recruiters[$j].ID>>
				<<set $seed = 1>>
				<<set $events.push("RE relative recruiter")>>
				<<break>>
			<</if>>
		<</for>>
		<<if $seed != 1>><<set $slaves[$i].recruiter = 0>><</if>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
<</for>>

<</if>>

<<if $FSAnnounced == 1>>
	<<set $FSAcquisitionEvents = []>>
	<<if $arcologies[0].FSSupremacist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Supremacist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSSubjugationist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Subjugationist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSGenderRadicalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Gender Radicalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSRepopulationFocus > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Repopulation Efforts")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSRestart > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Eugenics")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSGenderFundamentalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Gender Fundamentalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSPaternalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Paternalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSDegradationist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Degradationist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSBodyPurist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Body Purist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSTransformationFetishist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Transformation Fetishist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSYouthPreferentialist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Youth Preferentialist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSMaturityPreferentialist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Maturity Preferentialist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSSlimnessEnthusiast > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Slimness Enthusiast")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSAssetExpansionist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Asset Expansionist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSPastoralist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Pastoralist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSPhysicalIdealist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Physical Idealist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSChattelReligionist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Chattel Religionist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSRomanRevivalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Roman Revivalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSEdoRevivalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Edo Revivalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSArabianRevivalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Arabian Revivalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSChineseRevivalist > random(1,100)>>
		<<set $FSAcquisitionEvents.push("Chinese Revivalist")>>
		<<set $events.push("RE FS acquisition")>>
	<</if>>
	<<if $arcologies[0].FSEgyptianRevivalist > random(1,100)>>
		<<set $events.push("RE FSEgyptianRevivalist acquisition")>>
	<</if>>
	<<set $FSNonconformistEvents = []>>
	<<if $arcologies[0].FSSupremacist < 95>><<if $arcologies[0].FSSupremacist > 50>>
		<<set $FSNonconformistEvents.push("Supremacist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSSubjugationist < 95>><<if $arcologies[0].FSSubjugationist > 50>>
		<<set $FSNonconformistEvents.push("Subjugationist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $seeHyperPreg == 1>>
	<<if $arcologies[0].FSRepopulationFocus < 95>><<if $arcologies[0].FSRepopulationFocus > 50>>
		<<set $FSNonconformistEvents.push("Repopulation Efforts")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<</if>>
	<<if $arcologies[0].FSRestart < 95>><<if $arcologies[0].FSRestart > 50>>
		<<set $FSNonconformistEvents.push("Eugenics")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSGenderRadicalist < 95>><<if $arcologies[0].FSGenderRadicalist > 50>>
		<<set $FSNonconformistEvents.push("Gender Radicalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSGenderFundamentalist < 95>><<if $arcologies[0].FSGenderFundamentalist > 50>>
		<<set $FSNonconformistEvents.push("Gender Fundamentalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSPaternalist < 95>><<if $arcologies[0].FSPaternalist > 50>>
		<<set $FSNonconformistEvents.push("Paternalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSDegradationist < 95>><<if $arcologies[0].FSDegradationist > 50>>
		<<set $FSNonconformistEvents.push("Degradationist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSBodyPurist < 95>><<if $arcologies[0].FSBodyPurist > 50>>
		<<set $FSNonconformistEvents.push("Body Purist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSTransformationFetishist < 95>><<if $arcologies[0].FSTransformationFetishist > 50>>
		<<set $FSNonconformistEvents.push("Transformation Fetishist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSYouthPreferentialist < 95>><<if $arcologies[0].FSYouthPreferentialist > 50>>
		<<set $FSNonconformistEvents.push("Youth Preferentialist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSMaturityPreferentialist < 95>><<if $arcologies[0].FSMaturityPreferentialist > 50>>
		<<set $FSNonconformistEvents.push("Maturity Preferentialist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSSlimnessEnthusiast < 95>><<if $arcologies[0].FSSlimnessEnthusiast > 50>>
		<<set $FSNonconformistEvents.push("Slimness Enthusiast")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSAssetExpansionist < 95>><<if $arcologies[0].FSAssetExpansionist > 50>>
		<<set $FSNonconformistEvents.push("Asset Expansionist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSPastoralist < 95>><<if $arcologies[0].FSPastoralist > 50>>
		<<set $FSNonconformistEvents.push("Pastoralist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSPhysicalIdealist < 95>><<if $arcologies[0].FSPhysicalIdealist > 50>>
		<<set $FSNonconformistEvents.push("Physical Idealist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSChattelReligionist < 95>><<if $arcologies[0].FSChattelReligionist > 50>>
		<<set $FSNonconformistEvents.push("Chattel Religionist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSRomanRevivalist < 95>><<if $arcologies[0].FSRomanRevivalist > 50>>
		<<set $FSNonconformistEvents.push("Roman Revivalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSEdoRevivalist < 95>><<if $arcologies[0].FSEdoRevivalist > 50>>
		<<set $FSNonconformistEvents.push("Edo Revivalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSArabianRevivalist < 95>><<if $arcologies[0].FSArabianRevivalist > 50>>
		<<set $FSNonconformistEvents.push("Arabian Revivalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSChineseRevivalist < 95>><<if $arcologies[0].FSChineseRevivalist > 50>>
		<<set $FSNonconformistEvents.push("Chinese Revivalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
	<<if $arcologies[0].FSEgyptianRevivalist < 95>><<if $arcologies[0].FSEgyptianRevivalist > 50>>
		<<set $FSNonconformistEvents.push("Egyptian Revivalist")>>
		<<set $events.push("RE FS nonconformist")>>
	<</if>><</if>>
<</if>>

/* SCHOOL EVENTS */

<<if $cash > 50000>>
	<<set $RESEndowment = []>>
	<<if $TSS.schoolUpgrade == 0>>
	<<if ($TSS.studentsBought > 1) || ($TSS.schoolPresent != 0)>>
		<<set $events.push("RES Endowment")>>
		<<if $TSS.studentsBought > 2>>
		<<set $events.push("RES Endowment")>>
		<</if>>
		<<set $RESEndowment.push("TSS")>>
	<</if>>
	<</if>>
	<<if $GRI.schoolUpgrade == 0>>
	<<if ($GRI.studentsBought > 1) || ($GRI.schoolPresent != 0)>>
		<<set $events.push("RES Endowment")>>
		<<if $GRI.studentsBought > 2>>
		<<set $events.push("RES Endowment")>>
		<</if>>
		<<set $RESEndowment.push("GRI")>>
	<</if>>
	<</if>>
	<<if $SCP.schoolUpgrade == 0>>
	<<if ($SCP.studentsBought > 1) || ($SCP.schoolPresent != 0)>>
		<<set $events.push("RES Endowment")>>
		<<if $SCP.studentsBought > 2>>
		<<set $events.push("RES Endowment")>>
		<</if>>
		<<set $RESEndowment.push("SCP")>>
	<</if>>
	<</if>>
	<<if $LDE.schoolUpgrade == 0>>
	<<if ($LDE.studentsBought > 1) || ($LDE.schoolPresent != 0)>>
		<<set $events.push("RES Endowment")>>
		<<if $LDE.studentsBought > 2>>
		<<set $events.push("RES Endowment")>>
		<</if>>
		<<set $RESEndowment.push("LDE")>>
	<</if>>
	<</if>>
	<<if $TGA.schoolUpgrade == 0>>
	<<if ($TGA.studentsBought > 1) || ($TGA.schoolPresent != 0)>>
		<<set $events.push("RES Endowment")>>
		<<if $TGA.studentsBought > 2>>
		<<set $events.push("RES Endowment")>>
		<</if>>
		<<set $RESEndowment.push("TGA")>>
	<</if>>
	<</if>>
	<<if $TFS.schoolUpgrade == 0>>
	<<if ($TFS.studentsBought > 1) || ($TFS.schoolPresent != 0) || (($TFS.studentsBought > 0) && ($PC.dick == 1) && ($PC.vagina == 1) && ($PC.boobs == 1))>>
		<<set $events.push("RES Endowment")>>
		<<set $RESEndowment.push("TFS")>>
		<<if $TFS.studentsBought > 2>>
			<<set $events.push("RES Endowment")>>
			<<set $RESEndowment.push("TFS")>>
		<</if>>
		<<if ($PC.dick == 1) && ($PC.vagina == 1) && ($PC.boobs == 1)>>
			<<set $events.push("RES Endowment")>>
			<<set $RESEndowment.push("TFS")>>
		<</if>>
	<</if>>
	<</if>>
<</if>>

<<set $RESMove = []>>
<<if $TSS.schoolUpgrade != 0>>
<<if $TSS.schoolPresent == 0>>
<<if $TSS.schoolAnnexed == 0>>
	<<set $events.push("RES Move")>>
	<<set $events.push("RES Move")>>
	<<set $RESMove.push("TSS")>>
<</if>>
<</if>>
<</if>>
<<if $GRI.schoolUpgrade != 0>>
<<if $GRI.schoolPresent == 0>>
<<if $GRI.schoolAnnexed == 0>>
	<<set $events.push("RES Move")>>
	<<set $events.push("RES Move")>>
	<<set $RESMove.push("GRI")>>
<</if>>
<</if>>
<</if>>
<<if $SCP.schoolUpgrade != 0>>
<<if $SCP.schoolPresent == 0>>
<<if $SCP.schoolAnnexed == 0>>
	<<set $events.push("RES Move")>>
	<<set $events.push("RES Move")>>
	<<set $RESMove.push("SCP")>>
<</if>>
<</if>>
<</if>>
<<if $LDE.schoolUpgrade != 0>>
<<if $LDE.schoolPresent == 0>>
<<if $LDE.schoolAnnexed == 0>>
	<<set $events.push("RES Move")>>
	<<set $events.push("RES Move")>>
	<<set $RESMove.push("LDE")>>
<</if>>
<</if>>
<</if>>
<<if $TGA.schoolUpgrade != 0>>
<<if $TGA.schoolPresent == 0>>
<<if $TGA.schoolAnnexed == 0>>
	<<set $events.push("RES Move")>>
	<<set $events.push("RES Move")>>
	<<set $RESMove.push("TGA")>>
<</if>>
<</if>>
<</if>>
<<if $TFS.schoolUpgrade != 0>>
<<if $TFS.schoolPresent == 0>>
<<if $TFS.schoolAnnexed == 0>>
	<<set $events.push("RES Move")>>
	<<set $events.push("RES Move")>>
	<<set $RESMove.push("TFS")>>
	<<if ($PC.dick == 1) && ($PC.vagina == 1) && ($PC.boobs == 1)>>
		<<set $events.push("RES Move")>>
		<<set $events.push("RES Move")>>
		<<set $RESMove.push("TFS")>>
		<<set $RESMove.push("TFS")>>
	<</if>>
<</if>>
<</if>>
<</if>>

<<if $cash > 10000>>
<<if $rep > 6000>>
	<<set $RESSale = []>>
<<if $seeDicks != 2>>
<<if $TSS.studentsBought == 0>>
	<<set $events.push("RES Sale")>>
	<<set $RESSale.push("TSS")>>
<</if>>
<<if $GRI.studentsBought == 0>>
	<<set $events.push("RES Sale")>>
	<<set $RESSale.push("GRI")>>
<</if>>
<<if $SCP.studentsBought == 0>>
	<<set $events.push("RES Sale")>>
	<<set $RESSale.push("SCP")>>
<</if>>
<</if>>
<<if $seeDicks != 0>>
<<if $LDE.studentsBought == 0>>
	<<set $events.push("RES Sale")>>
	<<set $RESSale.push("LDE")>>
<</if>>
<<if $TGA.studentsBought == 0>>
	<<set $events.push("RES Sale")>>
	<<set $RESSale.push("TGA")>>
<</if>>
<<if ($TFS.studentsBought == 0)>>
	<<set $events.push("RES Sale")>>
	<<set $RESSale.push("TFS")>>
	<<if ($PC.dick == 1) && ($PC.vagina == 1) && ($PC.boobs == 1)>>
		<<set $events.push("RES Sale")>>
		<<set $events.push("RES Sale")>>
		<<set $RESSale.push("TFS")>>
		<<set $RESSale.push("TFS")>>
	<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if $justiceEvents.length > 0>>
	<<if ($seeExtreme == 0) || ($seeDicks == 0)>>
	<<for $x = 0; $x < $justiceEvents.length; $x++>>
		<<if "slave training" == $justiceEvents[$x]>>
		<<set $dump = $justiceEvents.pluck([$x], [$x])>>
		<<break>>
		<</if>>
	<</for>>
	<</if>>
	<<if $justiceEvents.length > 2>>
	<<set $events.push("JE slave dispute")>>
	<<set $events.push("JE slave dispute")>>
	<<else>>
	<<set $events.push("JE slave dispute")>>
	<</if>>
<</if>>

<<if $minimumSlaveCost > 3000>>
	<<set $events.push("RE shipping container")>>
<</if>>

<<if $corpCash > 50000>>
	<<set $events.push("REM merger")>>
<</if>>

<<if $RegularParties == 1>>
	<<if ($PC.vagina == 1 && $PC.title == 0) && (random(0,99) < $seeDicks)>>
		<<set $events.push("RE male citizen hookup")>>
	<<else>>
		<<set $events.push("RE citizen hookup")>>
	<</if>>
	<<if $rep-10000 > random(1,10000)>>
	<<if ($PC.vagina == 1 && $PC.boobs == 1 && $PC.title == 0) && (random(0,99) < $seeDicks)>>
		<<set $events.push("RE male arcology owner")>>
	<<else>>
		<<set $events.push("RE female arcology owner")>>
	<</if>>
	<</if>>
<</if>>

<<set $REM = []>>
<<if random(1,100) > $slaveCostFactor*40>>
	<<set $events.push("REM fluctuations")>>
	<<set $events.push("REM fluctuations")>>
	<<set $REM = 1>>
<</if>>
<<if random(1,100) < $slaveCostFactor*60>>
	<<set $events.push("REM fluctuations")>>
	<<set $events.push("REM fluctuations")>>
	<<set $REM = -1>>
<</if>>

/* EVENT RANDOMIZATION */

<<for $i = 0; $i < $RecETSevent.length; $i++>>
  <<set $events.push("RecETS")>>
<</for>>
<<for $i = 0; $i < $REFIevent.length; $i++>>
  <<set $events.push("REFI")>>
<</for>>
<<for $i = 0; $i < $PESSevent.length; $i++>>
  <<set $events.push("PESS")>>
<</for>>
<<for $i = 0; $i < $PETSevent.length; $i++>>
  <<set $events.push("PETS")>>
<</for>>
<<if $cheatMode == 1>>
	<<goto "random event select">>
<<else>>
	<<goto "random event roll">>
<</if>>

<</silently>>
