code:
:: Servants' Quarters [nobr]

<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Servants' Quarters", $showEncyclopedia = 1, $encyclopedia = "Servants' Quarters">>

<<if $servantsQuartersName != "the Servants' Quarters">>
	<<set $servantsQuartersNameCaps = $servantsQuartersName.replace("the ", "The ")>>
<</if>>
$servantsQuartersNameCaps
<<switch $servantsQuartersDecoration>>
<<case "Roman Revivalist">>
	are spartan, yet functional. At one end of the long dormitory there is an alcove with a shrine to the Roman goddess of domesticity.
<<case "Aztec Revivalist">>
	are simple, yet grandiose. In every corner stands a monument to a god, and as the sun peeks through, all the obsidian ornaments glisten with light.
<<case "Egyptian Revivalist">>
	are utilitarian, yet warm and well-kept. At one end of the long dormitory there is an alcove with a shrine to the Egyptian goddess of servility.
<<case "Edo Revivalist">>
	are spartan and functional. Fresh mats are laid across the floor every day, and the simple beds of blankets and wooden blocks are neatly stowed against the walls before sunrise.
<<case "Arabian Revivalist">>
	are utilitarian, yet warm and well-kept. They are floored with beautifully patterned tile; there are channels for clean running water that make it easy to keep clean and fresh, so long as one is willing to bathe in the open.
<<case "Chinese Revivalist">>
	are spartan, yet functional. At one end of the long dormitory there is an alcove with a shrine hosting a bronze statue of a watchful dragon.
<<case "Chattel Religionist">>
	are spartan, yet functional. Servants here are expected to be clean and hardworking, and there is a penitents cell ready for them if they are not.
<<case "Degradationist">>
	are severe and utilitarian. Servants sleep uncomfortably here, knowing that even on their meager bedrolls, they are fair game for abuse.
<<case "Repopulation Focus">>
	are comfortable and well-kept. Though there is little privacy here, the servants are provided for. There's even a small rest area for them to rest their pregnant bodies between shifts. A closet contains specialized cleaning tools to accommodate their distended bodies.
<<case "Eugenics">>
	are comfortable and well-kept. Though there is little privacy here, the servants are provided for. They are required to always be carrying prophylactics for other slaves and any low class citizens who require them.
<<case "Asset Expansionist">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting slaves with gigantic breasts earnestly enjoying huge cocks.
<<case "Transformation Fetishist">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting slaves with huge implants earnestly enjoying sex.
<<case "Gender Radicalist">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting all sorts of slaves earnestly enjoying taking cocks up their anuses.
<<case "Gender Fundamentalist">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting pretty female slaves being fucked by muscular men.
<<case "Physical Idealist">>
	are comfortable and well-kept. There are softcore pictures on the walls, depicting gorgeously muscled, oiled-up men and women, flexing and posing for the camera.
<<case "Supremacist">>
	are spartan, since that's all domestics from the inferior races need or deserve. There's a whipping post in the corner of the room so that whenever a slave is beaten, the rest must watch.
<<case "Subjugationist">>
	are spartan, since that's all $arcologies[0].FSSubjugationistRace domestics need or deserve. There's a whipping post in the corner of the room so that whenever a slave is beaten, the rest must watch.
<<case "Paternalist">>
	are comfortable and well-kept. Though there is little privacy here, the servants are provided for. There's even a small rest area for them to take their regular breaks in.
<<case "Pastoralist">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting lactating slaves earnestly enjoying sex. The servants are provided with milk to drink.
<<case "Maturity Preferentialist">>
	are comfortable, but functional. There are motivational posters on the walls featuring cheerful MILF servants, exhorting mature slaves to smile, serve, and get fucked like good girls.
<<case "Youth Preferentialist">>
	are comfortable, but well equipped to corral wayward slaves. There are instructional screens in the common areas reviewing basic slave tasks like scrubbing a floor and giving head.
<<case "Body Purist">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting gorgeous slaves earnestly enjoying sex.
<<case "Slimness Enthusiast">>
	are comfortable and well-kept. There are pornographic pictures on the walls, depicting slender slaves earnestly enjoying sex.
<<case "Hedonistic">>
	are comfortable and well-kept. There are plenty of soft couches to recline on between shifts and a number of feeders to keep servants full and happy. There are pornographic pictures on the walls, depicting fat slaves earnestly enjoying sex while stuffing their and their partners faces.
<<case "Intellectual Dependency">>
	are comfortable, but well equipped to corral wayward slaves. There are instructional screens in the common areas reviewing basic slave tasks like scrubbing a floor and not wandering off. Plenty of toys are available in an effort to keep minds focused on work and not solely on sex.
<<case "Slave Professionalism">>
	are comfortable and well-kept, assuming a slave is able to understand how to make use of the amenities. There are abundant menial tasks available to keep a mind busy and sharp.
<<case "Petite Admiration">>
	are comfortable and well-kept, assuming a slave is short enough, of course. Those that stand too tall find the accommodations cramped and the tools annoyingly short.
<<case "Statuesque Glorification">>
	are comfortable and well-kept, assuming a slave is tall enough, of course. Those that are too short find the accommodations out of reach and the tools painfully long.
<<default>>
	are comfortable. Servants sleep together in a dormitory, eat together in a little kitchen, bathe together in a communal shower, and then head out into the penthouse to serve.
<</switch>>

<<if $ServQiIDs.length > 2>>
	$servantsQuartersNameCaps are busy with hurrying slaves. One shift of servants is eating, cleaning the quarters, and bathing. The second is sleeping, and the third is out in the penthouse cleaning and serving.
<<elseif $ServQiIDs.length > 0>>
	A few slaves are working out of the servants' quarters. They must split their scant time between looking after their own needs and the superior needs of everyone else.
<<elseif $Stewardess != 0>>
	$Stewardess.slaveName is alone, and seems rather bereft without anyone to order around.
<<else>>
	None of your slaves are working out of the servants' quarters. [[Decommission the quarters|Main][$servantsQuarters = 0, $servantsQuartersUpgradeMonitoring = 0, $servantsQuartersDecoration = "standard"]]
<</if>>

<<if $ServQiIDs.length > 0>>
	<<removeFacilityWorkers "servantsQuarters" "rest" "be a servant">>
<</if>>

<<set _Tmult0 = Math.trunc($servantsQuarters*1000*$upgradeMultiplierArcology)>>

$servantsQuartersNameCaps has room to keep $servantsQuarters slaves while they serve. There <<if $ServQiIDs.length == 1>>is<<else>>are<</if>> currently $ServQiIDs.length slave<<if $ServQiIDs.length != 1>>s<</if>> serving in $servantsQuartersName.
[[Expand the Servants' Quarters|Servants' Quarters][cashX(forceNeg(_Tmult0), "capEx"), $servantsQuarters += 5, $PC.skill.engineering += .1]] //Costs <<print cashFormat(_Tmult0)>>//

<<if $servantsQuartersUpgradeMonitoring == 1>>
	The quarters have been upgraded with enhanced monitoring systems to make the servants work harder, improving their obedience and efficiency.
<<else>>
	<<set _Tmult1 = Math.trunc(10000*$upgradeMultiplierArcology*$HackingSkillMultiplier)>>
	The quarters are standard. [[Upgrade the monitoring systems to force harder work|Servants' Quarters][cashX(forceNeg(_Tmult1), "capEx"), $servantsQuartersUpgradeMonitoring = 1, $PC.skill.hacking += 0.1]] //Costs <<print cashFormat(_Tmult1)>> and will increase upkeep costs//
<</if>>

<<if $servantMilkers == 1>>

Since servants spend most of their time in the penthouse, any who are lactating will use the ubiquitous milkers.
<</if>>

<<set _facility = App.Entity.facilities.servantsQuarters>>
<<if $Stewardess != 0>>
	<<setLocalPronouns $Stewardess>>
	<<print App.UI.SlaveList.displayManager(_facility)>>
	<<if canAchieveErection($Stewardess) && $Stewardess.pubertyXY == 1>>

		<<if $stewardessImpregnates == 1>>
			Keeping the maids pregnant is part of $his job. [["Order " + $him + " to stop impregnating"|Servants' Quarters][$stewardessImpregnates = 0]]
		<<elseif $seePreg != 0>>
			$He could be directed to keep the maids pregnant $himself. [["Order " + $him + " to impregnate"|Servants' Quarters][$stewardessImpregnates = 1]]
		<</if>>
	<</if>>
<<else>>
	You do not have a slave serving as a Stewardess. [[Appoint one|Stewardess Select]]
<</if>>

<<print App.UI.SlaveList.listSJFacilitySlaves(_facility)>>

Rename $servantsQuartersName: <<textbox "$servantsQuartersName" $servantsQuartersName "Servants' Quarters">> //Use a noun or similar short phrase//

<<run App.UI.SlaveList.ScrollPosition.restore()>>


code:
:: Servants' Quarters Report [nobr]

<<SlaveIDSort $ServQiIDs>>
<<set _DL = $ServQiIDs.length, _SL = $slaves.length, _FLsFetish = 0, $stewardessBonus = 0>>

<<if $servantsQuartersDecoration != "standard">>
	<<set _devBonus = 1>>
<<else>>
	<<set _devBonus = 0>>
<</if>>

<<if ($Stewardess != 0)>>
	<<set _FLs = $slaveIndices[$Stewardess.ID]>>

	<<set $slaves[_FLs].devotion += _devBonus>>
	<<if ($slaves[_FLs].health.condition < -80)>>
		<<run improveCondition($slaves[_FLs], 20)>>
	<<elseif ($slaves[_FLs].health.condition < -40)>>
		<<run improveCondition($slaves[_FLs], 15)>>
	<<elseif ($slaves[_FLs].health.condition < 0)>>
		<<run improveCondition($slaves[_FLs], 10)>>
	<<elseif ($slaves[_FLs].health.condition < 90)>>
		<<run improveCondition($slaves[_FLs], 7)>>
	<</if>>
	<<if $slaves[_FLs].devotion <= 60>>
		<<set $slaves[_FLs].devotion++>>
	<</if>>
	<<if $slaves[_FLs].trust < 60>>
		<<set $slaves[_FLs].trust++>>
	<</if>>
	<<if $slaves[_FLs].fetishStrength <= 95>>
		<<if $slaves[_FLs].fetish != "dom">>
			<<if fetishChangeChance($slaves[_FLs]) > random(0,100)>>
				<<set _FLsFetish = 1, $slaves[_FLs].fetishKnown = 1, $slaves[_FLs].fetish = "dom">>
			<</if>>
		<<elseif $slaves[_FLs].fetishKnown == 0>>
			<<set _FLsFetish = 1, $slaves[_FLs].fetishKnown = 1>>
		<<else>>
			<<set _FLsFetish = 2, $slaves[_FLs].fetishStrength += 4>>
		<</if>>
	<</if>>
	<<if $slaves[_FLs].rules.living != "luxurious">>
		<<set $slaves[_FLs].rules.living = "luxurious">>
	<</if>>
	<<set $Stewardess = $slaves[_FLs]>>
	<<setLocalPronouns $Stewardess>>
	    <<= SlaveFullName($Stewardess)>> is serving as your Stewardess.<<if $Stewardess.relationship == -3 && $Stewardess.devotion > 50>> $He does $his best to be your perfect lovely house<<= $wife>>.<</if>>
	<<if ($stewardessImpregnates == 1) && (_DL > 0) && (canPenetrate($Stewardess)) && $Stewardess.pubertyXY == 1>>
		<<set _stewardessImpregnated = 0>>
		<<for _dI = 0; _dI < _DL; _dI++>>
			<<set $i = $slaveIndices[$ServQiIDs[_dI]]>>
			<<if (canImpreg($slaves[$i], $Stewardess))>>
				<<= knockMeUp($slaves[$i], 100, 2, $Stewardess.ID)>>
				<<set $slaves[$i].preg = 1, $slaves[$i].pregKnown = 1, $slaves[$i].pregWeek = 1, $slaves[$i].pregSource = $Stewardess.ID>><<set $slaves[$i].pregType = setPregType($slaves[$i])>>
				<<set WombImpregnate($slaves[$i], $slaves[$i].pregType, $slaves[$i].pregSource, 1)>>
				<<set $slaves[$i].vagina = Math.clamp($slaves[$i].vagina,1,10), _stewardessImpregnated++, $slaves[$i].counter.vaginal += 10, $vaginalTotal += 10>>
				<<set $slaves[$i].need = 0>>
			<</if>>
		<</for>>
		<<if _stewardessImpregnated > 0>>
			It's $his responsibility to keep $his charges pregnant, so
			<<if _stewardessImpregnated == 1>>
				$he cums in the only fertile slave's pussy all week.
			<<else>>
				$he ensures the _stewardessImpregnated fertile servants are full of $his cum at all times.
			<</if>>
			<<if $Stewardess.career == "a breeding bull">>
				$He was conditioned to fill empty wombs, so $he takes a @@.hotpink;deep pleasure@@ in $his job.
				<<set $slaves[_FLs].devotion++>>
			<</if>>
			<<set _Tmult = (_stewardessImpregnated * 10), $slaves[_FLs].counter.penetrative += _Tmult, $Stewardess.counter.penetrative += _Tmult, $penetrativeTotal += _Tmult>>
			<<set $slaves[_FLs].need = 0>>
		<</if>>
	<</if>>
	<<if _FLsFetish == 1>>
		$He's allowed and even expected to use $his charges for $his own gratification, and sometimes they'll even instigate submissive sex with $him just to ingratiate themselves. $He becomes comfortable with the role of a @@.lightcoral;sexual dominant.@@
	<<elseif _FLsFetish == 2>>
		Having a legion of servants jumping to obey $his daily commands @@.lightsalmon;makes $him more dominant.@@
	<</if>>
	<<if ($Stewardess.health.condition < 10)>>
		Though $he tries to watch the servants, $his lack of good health inhibits $him.
	<<elseif ($Stewardess.health.condition < 80)>>
		<<set $stewardessBonus += 50>>
		$His good health allows $him to work long hours and @@.yellowgreen;drive@@ the servants hard.
	<<else>>
		<<set $stewardessBonus += 75>>
		$His perfect health allows $him to work exhaustive hours and @@.yellowgreen;drive@@ the servants very hard.
	<</if>>
	<<if setup.stewardessCareers.includes($Stewardess.career)>>
		<<set $stewardessBonus += 25>>
		$He has applicable experience with daily sums and organizational trifles from $his life before $he was a slave.
	<<elseif $Stewardess.skill.stewardess >= $masteredXP>>
		<<set $stewardessBonus += 25>>
		$He has applicable experience with daily sums and organizational trifles from working for you.
	<<else>>
		<<set $slaves[_FLs].skill.stewardess += random(1,Math.ceil(($Stewardess.intelligence+$Stewardess.intelligenceImplant)/15) + 8)>>
	<</if>>
	<<if ($Stewardess.actualAge > 35)>>
		<<set $stewardessBonus += 25>>
		$His age and experience give $him added effectiveness.
	<<elseif $AgePenalty == 0>>
		<<set $stewardessBonus +=25>>
	<</if>>
	<<if ($Stewardess.intelligence+$Stewardess.intelligenceImplant > 15)>>
		<<set $stewardessBonus += $Stewardess.intelligence+$Stewardess.intelligenceImplant>>
		$He's smart enough that $he misses very little.
	<</if>>
	<<if ($Stewardess.energy > 95) || (($Stewardess.fetishKnown == 1) && ($Stewardess.fetish == "dom"))>>
		<<set _BonusToggle = 1>>
	<<else>>
		<<set _BonusToggle = 0>>
	<</if>>
	<<for _dI = 0; _dI < _DL; _dI++>>
		<<set $i = $slaveIndices[$ServQiIDs[_dI]]>>
		<<setLocalPronouns $slaves[$i] 2>>
		<<if $Stewardess.rivalryTarget == $slaves[$i].ID>>
			$He bears down on $his <<print rivalryTerm($Stewardess)>>, $slaves[$i].slaveName, forcing _him2 to work extra hard or suffer punishment.
			<<set $slaves[$i].devotion--, $slaves[$i].trust-->>
			<<if random(1,100) > 65>>
				<<set $Stewardess.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
			<</if>>
		<<elseif $Stewardess.relationshipTarget == $slaves[$i].ID>>
			$He dotes over $his <<print relationshipTerm($Stewardess)>>, $slaves[$i].slaveName, making sure _he2 knows how to do a good job and keeping _him2 well stocked with everything _he2 needs.
			<<set $slaves[$i].devotion++>>
		<<elseif $familyTesting == 1 && areRelated($Stewardess, $slaves[$i]) > 0>>
			$He pays special attention to $his <<print relativeTerm($Stewardess,$slaves[$i])>>, $slaves[$i].slaveName, making sure _he2 doesn't slack off just because they are related.
			<<set $slaves[$i].trust++>>
		<<elseif $Stewardess.relationTarget == $slaves[$i].ID && $familyTesting == 0>>
			$He pays special attention to $his $slaves[$i].relation, $slaves[$i].slaveName, making sure _he2 doesn't slack off just because they are related.
			<<set $slaves[$i].trust++>>
		<</if>>
		<<switch $slaves[$i].prestigeDesc>>
		<<case "$He is a famed Free Cities whore, and commands top prices.">>
			$He does $his best to motivate the famous whore, $slaves[$i].slaveName, though $he is uncertain why _he2 is here.
		<<case "$He is a famed Free Cities slut, and can please anyone.">>
			$He ignores $his duties in order the fawn over the famous entertainer, $slaves[$i].slaveName.
		<<case "$He is remembered for winning best in show as a cockmilker.">>
			<<if ($slaves[$i].dick != 0) && ($slaves[$i].balls != 0) && ($slaves[$i].prostate > 1)>>
				$slaves[$i].slaveName leaves a trail of cum wherever _he2 goes and frequently stops to masturbate, greatly annoying $Stewardess.slaveName.
				<<if random(1,100) > 90 && $Stewardess.rivalry == 0 && $slaves[$i].rivalry == 0>>
					<<set $Stewardess.rivalryTarget = $slaves[$i].ID, $Stewardess.rivalry++, $slaves[_FLs].rivalryTarget = $slaves[$i].ID, $slaves[_FLs].rivalry++>>
					<<set $slaves[$i].rivalryTarget = $Stewardess.ID, $slaves[$i].rivalry++>>
				<</if>>
			<</if>>
		<<case "$He is remembered for winning best in show as a dairy cow.">>
			<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
				$slaves[$i].slaveName's huge breasts frequently get in the way of _his2 work and _he2 leaks milk everywhere, greatly annoying $Stewardess.slaveName.
				<<if random(1,100) > 90 && $Stewardess.rivalry == 0 && $slaves[$i].rivalry == 0>>
					<<set $Stewardess.rivalryTarget = $slaves[$i].ID, $Stewardess.rivalry++, $slaves[_FLs].rivalryTarget = $slaves[$i].ID, $slaves[_FLs].rivalry++>>
					<<set $slaves[$i].rivalryTarget = $Stewardess.ID, $slaves[$i].rivalry++>>
				<</if>>
			<</if>>
		<<case "$He is remembered for winning best in show as a breeder.">>
			<<if $slaves[$i].bellyPreg >= 10000>>
				$slaves[$i].slaveName's big pregnant belly frequently gets in the way of _his2 work. However, $Stewardess.slaveName is willing to overlook it, as well as allow _him2 easy jobs, due to how valuable _his2 womb is.
			<</if>>
		<</switch>>
		<<if (_BonusToggle == 1) && ($slaves[$i].devotion < 45)>>
			<<set $slaves[$i].devotion += 5>>
		<</if>>
	<</for>>
	<<if (_DL > 0)>>
		<<if ($Stewardess.fetishKnown == 1) && ($Stewardess.fetish == "dom")>>
			$He walks among the cowering servants as a queen among peasants, playing the role of a dominant to perfection and increasing $his charges' @@.hotpink;obedience.@@
		<<elseif ($Stewardess.energy > 95)>>
			$He walks among the cowering servants looking for an excuse to extract sex from shirkers as @@.hotpink;punishment.@@
		<</if>>
		/% Get it out of the loop %/
		<<run cashX(($stewardessBonus * _DL), "servantsQuarters", $Stewardess)>>

	<</if>>
<</if>>

<<if $arcologies[0].FSRestart != "unset" && _stewardessImpregnated == 1 && $eugenicsFullControl != 1>>
	The Societal Elite know you've ordered $Stewardess.slaveName to impregnate your maids. @@.red;They are not amused by your disinterest in eugenics.@@
	<<set $failedElite += 10>>
<</if>>
<<if (_DL > 0)>>
	<<setLocalPronouns $slaves[$slaveIndices[$ServQiIDs[0]]]>>
	    <<if (_DL != 1)>>''There are _DL slaves working out of the servants' quarters.'' They work to<<else>>''There is one slave working out of the servants' quarters.'' $He works to<</if>> @@.yellowgreen;reduce@@ your household expenses; having a well-staffed house slightly @@.green;increases@@ your reputation.
<</if>>

<<if ($Stewardess != 0)>>
	<<set $i = _FLs>> /* apply following SA passages to facility leader */
	<<if $showEWD != 0>>

		/* 000-250-006 */
		<<if $seeImages && $seeReportImages>>

			<<= SlaveArt($slaves[_FLs], 0, 0)>>

		<</if>>
		/* 000-250-006 */
		''__@@.pink;<<= SlaveFullName($slaves[_FLs])>>@@__'' is serving as your Stewardess.

		<<= saChoosesOwnClothes($slaves[$i])>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>

<<include "SA devotion">>
	<<else>>
		<<silently>>
		<<run saChoosesOwnClothes($slaves[$i])>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<</if>>
	<<set $Stewardess = $slaves[_FLs]>>
<</if>>

<<set $servantMilkersMultiplier = 0.5, _SQMilk = 0, _SQMilkSale = 0>>

<<for _dI = 0; _dI < _DL; _dI++>>
	<<set $i = $slaveIndices[$ServQiIDs[_dI]], $slaves[$i].devotion += _devBonus>>
	<<setLocalPronouns $slaves[$i] 2>>
	<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
		<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 5>>
	<<elseif ($slaves[$i].devotion <= 10)>>
		<<set $slaves[$i].devotion += 2>>
	<<elseif ($slaves[$i].devotion >= 80)>>
		<<set $slaves[$i].devotion -= 2>>
	<</if>>
	<<if ($slaves[$i].devotion < -20)>>
		<<set $slaves[$i].trust += 3>>
	<<elseif ($slaves[$i].trust < -50)>>
		<<set $slaves[$i].trust += 2>>
	<<elseif ($slaves[$i].trust < -30)>>
		<<set $slaves[$i].trust += 1>>
	<</if>>
	<<if ($slaves[$i].health.condition < -80)>>
		<<run improveCondition($slaves[$i], 20)>>
	<<elseif ($slaves[$i].health.condition < -40)>>
		<<run improveCondition($slaves[$i], 10)>>
	<<elseif ($slaves[$i].health.condition < 0)>>
		<<run improveCondition($slaves[$i], 7)>>
	<<elseif ($slaves[$i].health.condition < 90)>>
		<<run improveCondition($slaves[$i], 3)>>
	<</if>>
	<<switch $servantsQuartersDecoration>>
	<<case "Arabian Revivalist" "Aztec Revivalist" "Chattel Religionist" "Chinese Revivalist" "Degradationist" "Edo Revivalist" "Egyptian Revivalist" "Roman Revivalist" "Subjugationist" "Supremacist">>
		<<set $slaves[$i].rules.living = "spare">>
	<<case "Slave Professionalism">>
		<<if $slaves[$i].intelligence+$slaves[$i].intelligenceImplant > 15>>
			<<set $slaves[$i].rules.living = "normal">>
		<<else>>
			<<set $slaves[$i].rules.living = "spare">>
		<</if>>
	<<case "Petite Admiration">>
		<<if heightPass($slaves[$i])>>
			<<set $slaves[$i].rules.living = "normal">>
		<<else>>
			<<set $slaves[$i].rules.living = "spare">>
		<</if>>
	<<case "Statuesque Glorification">>
		<<if heightPass($slaves[$i])>>
			<<set $slaves[$i].rules.living = "normal">>
		<<else>>
			<<set $slaves[$i].rules.living = "spare">>
		<</if>>
	<<default>>
		<<set $slaves[$i].rules.living = "normal">>
	<</switch>>
	<<if $showEWD != 0>>

		/* 000-250-006 */
		<<if $seeImages && $seeReportImages>>

			<<= SlaveArt($slaves[$i], 0, 0)>>

		<</if>>
		/* 000-250-006 */
		''__@@.pink;<<= SlaveFullName($slaves[$i])>>@@__''
		<<if $slaves[$i].choosesOwnAssignment == 2>>
			<<include "SA chooses own job">>
		<<else>>
			is working out of $servantsQuartersName.
		<</if>>

    _He2 <<= saServant($slaves[$i])>>
		<<if ($servantMilkers == 1) && ($slaves[$i].lactation > 0)>>

    _He2 <<= saGetMilked($slaves[$i])>>
			<<set _SQMilk += $milk, _SQMilkSale += $milkSale>>
		<</if>>

		<<= saChoosesOwnClothes($slaves[$i])>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>

<<include "SA devotion">>
	<<else>>
		<<silently>>
		<<include "SA chooses own job">>
		<<run saServant($slaves[$i])>>
		<<if ($servantMilkers == 1) && ($slaves[$i].lactation > 0)>>
			<<run saGetMilked($slaves[$i])>>
			<<set _SQMilk += $milk, _SQMilkSale += $milkSale>>
		<</if>>
		<<run saChoosesOwnClothes($slaves[$i])>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<</if>>
<</for>>

<<if _SQMilk > 0 || $servantsQuartersDecoration != "standard">>

	<<if _SQMilk > 0>>
		Since your lactating servants spend most of their time working in the penthouse, they use the milkers there, giving _SQMilk liters of milk over the week, which is sold for @@.yellowgreen;<<print cashFormat(_SQMilkSale)>>.@@
	<</if>>
<</if>>

<<if $servantsQuartersDecoration != "standard">>

    $servantsQuartersNameCaps's $servantsQuartersDecoration atmosphere @@.hotpink;has a minor impact on your servants.@@
<</if>>

<<set $servantMilkersMultiplier = 1>>
<<run repX(_DL*20, "servantsQuarters")>>

<<if _DL > 0 || $Stewardess != 0>>

<</if>>

license: mit


code:
:: Siblings Workaround

Your new pair of slaves look frightened and uncertain, but seem encouraged by each other's presence.

<<run newSlave($activeSlave)>>

<<set _secondSlave = clone($activeSlave)>>
<<unset $activeSlave>>
<<if _secondSlave.slaveSurname>><<set _familyName = _secondSlave.slaveSurname>><</if>>
<<set _familyBirthSurname = _secondSlave.birthSurname>>
<<run nationalityToName(_secondSlave)>>
<<if _familyName>><<set _secondSlave.slaveSurname = _familyName>><</if>>
<<set _secondSlave.birthSurname = _familyBirthSurname>>
<<run nationalityToAccent(_secondSlave)>>

<<set _secondSlave.ID = _secondSlave.ID + 1000>>
<<set _secondSlave.devotion -= random(5,-5)>>
<<set _secondSlave.oldDevotion = _secondSlave.devotion>>
<<set _secondSlave.trust -= random(5,-5)>>
<<set _secondSlave.oldTrust = _secondSlave.trust>>
<<set _secondSlave.oldDevotion = _secondSlave.devotion>>
<<set _secondSlave.actualAge -= random(1,5)>>
<<set _secondSlave.visualAge = _secondSlave.actualAge>>
<<set _secondSlave.physicalAge = _secondSlave.actualAge>>
<<set _secondSlave.ovaryAge = _secondSlave.actualAge>>

<<set WombFlush(_secondSlave)>>
<<if (($precociousPuberty == 1 && _secondSlave.actualAge < $fertilityAge) || _secondSlave.actualAge >= $fertilityAge) && $arcologies[0].FSRepopulationFocusSMR == 1>>
	<<set _secondSlave.preg = random(1,38)>>
	<<set _secondSlave.pregWeek = _secondSlave.preg>>
	<<set _secondSlave.pregKnown = 1>>
	<<set _secondSlave.pregType = setPregType(_secondSlave)>>
<</if>>
<<run SetBellySize(_secondSlave)>>

<<set _secondSlave.attrXX += random(-20,20)>>
<<set _secondSlave.attrXX = Math.clamp(_secondSlave.attrXX, 0, 100)>>
<<set _secondSlave.attrXY += random(-20,20)>>
<<set _secondSlave.attrXY = Math.clamp(_secondSlave.attrXY, 0, 100)>>
<<set _secondSlave.energy += random(-20,20)>>
<<set _secondSlave.fetishStrength = random(0,90)>>
<<set _secondSlave.fetish = either("buttslut", "cumslut", "dom", "humiliation", "masochist", "none", "none", "none", "none", "none", "none", "pregnancy", "sadist", "submissive")>>
<<set _secondSlave.behavioralFlaw = either("anorexic", "arrogant", "bitchy", "devout", "gluttonous", "hates men", "hates women", "hates women", "liberated", "masochist", "none", "none", "none", "odd")>>
<<if (_secondSlave.behavioralFlaw == "devout")>>
	<<set _secondSlave.sexualFlaw = either("apathetic", "none", "repressed", "shamefast")>>
<<else>>
	<<set _secondSlave.sexualFlaw = either("apathetic", "crude", "hates anal", "hates oral", "hates penetration", "idealistic", "judgemental", "none", "none", "none", "none", "repressed", "shamefast")>>
<</if>>

<<if $familyTesting == 0>>
	<<set _secondSlave.relation = "sister">>
	<<set _secondSlave.relationTarget = _secondSlave.ID - 1000>>
<</if>>

<<if _secondSlave.actualAge < $minimumSlaveAge>>
	<<set _secondSlave.actualAge = $minimumSlaveAge>>
	<<set _secondSlave.visualAge = _secondSlave.actualAge>>
	<<set _secondSlave.physicalAge = _secondSlave.actualAge>>
	<<set _secondSlave.ovaryAge = _secondSlave.actualAge>>
<</if>>

<<if _secondSlave.boobs > 200>>
	<<set _secondSlave.boobs += random (-100, 100)>>
<</if>>

<<if _secondSlave.butt > 1>>
	<<set _secondSlave.butt += random (-1, 1)>>
<</if>>

<<if _secondSlave.physicalAge <= 15>>
	<<run AgeAdjustYoungRelative(_secondSlave)>>
<</if>>

<<run setHealth(_secondSlave, _secondSlave.health.condition)>>

<<run newSlave(_secondSlave)>>


code:
:: Slave Assignments Report [nobr]

<<set $nextLink = "Economics", $nextButton = "Continue", _SL = $slaves.length>>

 $arcologies[0].name Weekly Slave Report - Week $week

/*Spa room*/
<<if $spa > 0>>
	<<set $spaSpots = ($spa - $SpaiIDs.length) * 20>>
	<<if $Attendant != 0>>
		<<set $spaSpots = Math.trunc($spaSpots * (1 + ($Attendant.skill.attendant / 400)))>> /*A skilled attendant improves available space by 25%*/
	<</if>>
<</if>>

/** silent pass for any reassignments before generating reports */
<<for $i = 0; $i < _SL; $i++>>
	<<set $slaves[$i].health.illness = 0, $slaves[$i].health.tired = 0>> /* temp */
	<<if $slaves[$i].choosesOwnAssignment == 1>>
		<<silently>>
			<<include "SA chooses own job">>
		<</silently>>
	<</if>>
<</for>>

/*Sexual services demand per class*/
/*We can add milk etc. to this as well, though this is a good that can be traded beyond the arcology and also needs its own market much like the slavemarket. TODO*/
/*In the default scenario these numbers indicate the amount of money each individual citizen of a particular class is looking to spend on sex (and milk) every week
Depending on the conditions they may derive more or less 'utility' out of their credits spent
i.e. a highly paternalist arcology with little choice for its lower class but Fuckdolls may still put money into them but not get the same satisfaction out of it*/
/*Low rent increases demand/available money for sexual services, high rent decreases it*/
<<set _lowerClassSexDemand = Math.trunc($lowerClass * $whoreBudget.lowerClass) * 2,
_lowerClassSexDemandRef = Math.max(_lowerClassSexDemand, 1),
_visitorsSexDemand = Math.trunc($visitors) * 40,
_middleClassSexDemand = Math.trunc($middleClass * $whoreBudget.middleClass + _visitorsSexDemand * 0.5) * 2,
_middleClassSexDemandRef = Math.max(_middleClassSexDemand, 1),
_upperClassSexDemand = Math.trunc($upperClass * $whoreBudget.upperClass + _visitorsSexDemand * 0.5) * 2,
_upperClassSexDemandRef = Math.max(_upperClassSexDemand, 1),
_topClassSexDemand = Math.trunc($topClass * $whoreBudget.topClass) * 2,
_topClassSexDemandRef = Math.max(_topClassSexDemand, 1),
_arcadeSupply = {lowerClass: 0, middleClass: 0, upperClass: 0},
_clubSupply = {lowerClass: 0, middleClass: 0},
$whorePriceAdjustment = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0},
$NPCMarketShare = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0},
$sexDemandResult = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0},
$slaveJobValues = slaveJobValues(_lowerClassSexDemandRef, _middleClassSexDemandRef, _upperClassSexDemandRef, _topClassSexDemandRef)>>

/*Arcade Specific Demand for Degradationists to give it higher priority*/
<<if $arcologies[0].FSDegradationist != "unset">>
	<<set _lowerClassArcadeSexDemand = Math.trunc(_lowerClassSexDemand * $arcologies[0].FSDegradationist * 0.0015),
	_middleClassArcadeSexDemand = Math.trunc(_middleClassSexDemand * $arcologies[0].FSDegradationist * 0.0002),
	_upperClassArcadeSexDemand = Math.trunc(_upperClassSexDemand * $arcologies[0].FSDegradationist * 0.000025),
	_arcadeDemandDeg = _lowerClassArcadeSexDemand + _middleClassArcadeSexDemand + _upperClassArcadeSexDemand>>
	<<if $arcologies[0].FSDegradationistLaw == 1>>
		<<set _arcadeDemandDeg += $ASlaves * 3>>
	<</if>>
	<<if $slaveJobValues.arcade < _arcadeDemandDeg>>
		<<if _arcadeDemandDeg > 20000 || $arcologies[0].FSDegradationist > 50>>
			<<set _degradationistPenalty = ((_arcadeDemandDeg - $slaveJobValues.arcade) / _arcadeDemandDeg),
			$arcologies[0].FSDegradationist -= Math.trunc(5 * _degradationistPenalty)>>
			<<run repX(forceNeg(100 * _degradationistPenalty), "futureSocieties")>>
			<<if _degradationistPenalty > 0.5>>
				<<set $arcadeDemandDegResult = 1>>
			<<else>>
				<<set $arcadeDemandDegResult = 2>>
			<</if>>
		<<else>>
			<<set $arcadeDemandDegResult = 3>>
		<</if>>
		<<set _arcadeSupply.lowerClass += Math.trunc(1.15 * $slaveJobValues.arcade * (_lowerClassArcadeSexDemand / _arcadeDemandDeg)),
		_lowerClassSexDemand -= _arcadeSupply.lowerClass,
		_arcadeSupply.middleClass += Math.trunc(1.15 * $slaveJobValues.arcade * (_middleClassArcadeSexDemand / _arcadeDemandDeg)),
		_middleClassSexDemand -= _arcadeSupply.middleClass,
		_arcadeSupply.upperClass += Math.trunc(1.15 * $slaveJobValues.arcade * (_upperClassArcadeSexDemand / _arcadeDemandDeg)),
		_upperClassSexDemand -= _arcadeSupply.upperClass>> /*There's a 15% satisfaction bonus from getting release in a societally approved way*/
	<<else>>
		<<if $slaveJobValues.arcade >= _arcadeDemandDeg * 1.5>>
			<<set $arcologies[0].FSDegradationist += 2,
			$arcadeDemandDegResult = 4>>
			<<run repX(500, "futureSocieties")>>
		<<else>>
			<<set $arcadeDemandDegResult = 5>>
		<</if>>
		<<set _arcadeSupply.lowerClass += Math.trunc(1.15 * _lowerClassArcadeSexDemand),
		_lowerClassSexDemand -= _arcadeSupply.lowerClass,
		_arcadeSupply.middleClass += Math.trunc(1.15 * _middleClassArcadeSexDemand),
		_middleClassSexDemand -= _arcadeSupply.middleClass,
		_arcadeSupply.upperClass += Math.trunc(1.15 * _upperClassArcadeSexDemand),
		_upperClassSexDemand -= _arcadeSupply.upperClass>>
	<</if>>
<<else>>
	<<set _arcadeDemandDeg = 0>>
<</if>>

/*Public slut sex supply. Top and upper class won't partake*/
<<set _clubDemand = _lowerClassSexDemand + _middleClassSexDemand,
_lowerClassClubRatio = _lowerClassSexDemand / _clubDemand,
_middleClassClubRatio = _middleClassSexDemand / _clubDemand>>
<<if $slaveJobValues.club * $slaveJobValues.clubSP < _clubDemand>>
	<<set _lowerClassSexDemand -= Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _lowerClassClubRatio),
	_middleClassSexDemand -= Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _middleClassClubRatio)>>
<<else>>
	<<set _lowerClassSexDemand = 0,
	_middleClassSexDemand = 0>>
<</if>>
<<set _clubSupply.lowerClass = Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _lowerClassClubRatio),
_clubSupply.middleClass = Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _middleClassClubRatio)>>

/*Brothel or street whore sex supply*/
<<if _lowerClassSexDemand < $slaveJobValues.brothel.lowerClass>>
	<<set $whorePriceAdjustment.lowerClass = Math.max(Math.pow(_lowerClassSexDemand / ($slaveJobValues.brothel.lowerClass + $NPCSexSupply.lowerClass), 1.513), 0.3),
	_lowerClassSexDemand = 0>> /*This accounts for people having too much choice and getting more picky how they spend their money*/
<<else>>
	<<set $whorePriceAdjustment.lowerClass = Math.pow(_lowerClassSexDemand / ($slaveJobValues.brothel.lowerClass + $NPCSexSupply.lowerClass), 0.5),
	_lowerClassSexDemand -= $slaveJobValues.brothel.lowerClass>> /* People are willing to pay more for a scarce good, but within reason */
<</if>>
<<if _middleClassSexDemand < $slaveJobValues.brothel.middleClass>>
	<<set $whorePriceAdjustment.middleClass = Math.max(Math.pow((_middleClassSexDemand * 1.1) / ($slaveJobValues.brothel.middleClass + $NPCSexSupply.middleClass), 1.513), 0.33),
	_middleClassSexDemand = 0>>
<<else>>
	<<set $whorePriceAdjustment.middleClass = Math.pow((_middleClassSexDemand * 1.1) / ($slaveJobValues.brothel.middleClass + $NPCSexSupply.middleClass), 0.5),
	_middleClassSexDemand -= $slaveJobValues.brothel.middleClass>>
<</if>>
<<if _upperClassSexDemand < $slaveJobValues.brothel.upperClass>>
	<<set $whorePriceAdjustment.upperClass = Math.max(Math.pow((_upperClassSexDemand * 1.21) / ($slaveJobValues.brothel.upperClass + $NPCSexSupply.upperClass), 1.513), 0.363),
	_upperClassSexDemand = 0>>
<<else>>
	<<set $whorePriceAdjustment.upperClass = Math.pow((_upperClassSexDemand * 1.21) / ($slaveJobValues.brothel.upperClass + $NPCSexSupply.upperClass), 0.5),
	_upperClassSexDemand -= $slaveJobValues.brothel.upperClass>>
<</if>>
<<if _topClassSexDemand < $slaveJobValues.brothel.topClass>>
	<<set $whorePriceAdjustment.topClass = Math.max(Math.pow((_topClassSexDemand * 1.331) / ($slaveJobValues.brothel.topClass + $NPCSexSupply.topClass), 1.513), 0.3993),
	_topClassSexDemand = 0>>
<<else>>
	<<set $whorePriceAdjustment.topClass = Math.pow((_topClassSexDemand * 1.331) / ($slaveJobValues.brothel.topClass + $NPCSexSupply.topClass), 0.5),
	_topClassSexDemand -= $slaveJobValues.brothel.topClass>>
<</if>>

/*Price for sex in the arcade or at a glory hole*/
<<if $arcologies[0].FSPaternalist != "unset">>
	<<set _arcadeDemand = Math.max((_arcadeDemandDeg + _lowerClassSexDemand) * (1 - $arcologies[0].FSPaternalist / 50), 0)>> /*Paternalists sap demand for the arcade*/
<<else>>
	<<set _arcadeDemand = _arcadeDemandDeg + _lowerClassSexDemand>>
<</if>>
<<if $slaveJobValues.arcade + $NPCSexSupply.lowerClass > 0>>
	<<set $arcadePrice = Math.clamp(Math.pow((_arcadeDemand / ($slaveJobValues.arcade + $NPCSexSupply.lowerClass)), 0.5), 0.5, 3)>> /*This calculates the price charged per fuck*/
<<else>>
	<<set $arcadePrice = 0.5>> /*minimum price no matter what*/
<</if>>

/*Arcade usage beyond degradationist demand*/
<<if $arcologies[0].FSDegradationist != "unset">>
	<<if $slaveJobValues.arcade > _arcadeDemandDeg>>
		<<set $slaveJobValues.arcade -= _arcadeDemandDeg>>
	<<else>>
		<<set $slaveJobValues.arcade = 0>>
	<</if>>
<</if>>
<<if $slaveJobValues.arcade > _lowerClassSexDemand>>
	<<set _lowerClassSexDemand = 0>>
<<else>>
	<<set _lowerClassSexDemand -= $slaveJobValues.arcade>>
<</if>>
<<set _arcadeSupply.lowerClass += $slaveJobValues.arcade>>

/*NPC sex supply*/
<<set $NPCSexSupply = NPCSexSupply(_lowerClassSexDemand, _lowerClassSexDemandRef, _middleClassSexDemand, _middleClassSexDemandRef, _upperClassSexDemand, _upperClassSexDemandRef, _topClassSexDemand, _topClassSexDemandRef),
$NPCMarketShare.lowerClass = Math.trunc(($NPCSexSupply.lowerClass * 1000) / _lowerClassSexDemandRef),
$NPCMarketShare.middleClass = Math.trunc(($NPCSexSupply.middleClass * 1000) / _middleClassSexDemandRef),
$NPCMarketShare.upperClass = Math.trunc(($NPCSexSupply.upperClass * 1000) / _upperClassSexDemandRef),
$NPCMarketShare.topClass = Math.trunc(($NPCSexSupply.topClass * 1000) / _topClassSexDemandRef)>>
<<if _lowerClassSexDemand < $NPCSexSupply.lowerClass>>
	<<set _lowerClassSexDemand = 0>>
<<else>>
	<<set _lowerClassSexDemand -= $NPCSexSupply.lowerClass>>
<</if>>

<<if _middleClassSexDemand < $NPCSexSupply.middleClass>>
	<<set _middleClassSexDemand = 0>>
<<else>>
	<<set _middleClassSexDemand -= $NPCSexSupply.middleClass>>
<</if>>

<<if _upperClassSexDemand < $NPCSexSupply.upperClass>>
	<<set _upperClassSexDemand = 0>>
<<else>>
	<<set _upperClassSexDemand -= $NPCSexSupply.upperClass>>
<</if>>

<<if _topClassSexDemand < $NPCSexSupply.topClass>>
	<<set _topClassSexDemand = 0>>
<<else>>
	<<set _topClassSexDemand -= $NPCSexSupply.topClass>>
<</if>>

<<if ($cheatMode == 1) || ($debugMode == 1)>>

Slave services supply and demand this week:

 /*title row */
			Client's class
			Lower
			Middle
			Upper
			Top

				Demand

				<<print commaNum(_lowerClassSexDemandRef)>>

				<<print commaNum(_middleClassSexDemandRef)>>

				<<print commaNum(_upperClassSexDemandRef)>>

				<<print commaNum(_topClassSexDemandRef)>>

				Brothel Supply

				<<print commaNum($slaveJobValues.brothel.lowerClass)>>

				<<print commaNum($slaveJobValues.brothel.middleClass)>>

				<<print commaNum($slaveJobValues.brothel.upperClass)>>

				<<print commaNum($slaveJobValues.brothel.topClass)>>

		<<if (_clubSupply.lowerClass || _clubSupply.middleClass)>>

					Club Supply

					<<print commaNum(_clubSupply.lowerClass)>>

					<<print commaNum(_clubSupply.middleClass)>>

					N/A

					N/A

		<</if>>

		<<if (_arcadeSupply.lowerClass || _arcadeSupply.middleClass || _arcadeSupply.upperClass)>>

					Arcade Supply

					<<print commaNum(_arcadeSupply.lowerClass)>>

					<<print commaNum(_arcadeSupply.middleClass)>>

					<<print commaNum(_arcadeSupply.upperClass)>>

					N/A

		<</if>>

		<<if ($cheatMode == 1) || ($debugMode == 1)>>

					NPC Supply

					<<print commaNum($NPCSexSupply.lowerClass)>>

					<<print commaNum($NPCSexSupply.middleClass)>>

					<<print commaNum($NPCSexSupply.upperClass)>>

					<<print commaNum($NPCSexSupply.topClass)>>

		<</if>>

				Unsatisfied

				<<print commaNum(_lowerClassSexDemand)>>

				<<print commaNum(_middleClassSexDemand)>>

				<<print commaNum(_upperClassSexDemand)>>

				<<print commaNum(_topClassSexDemand)>>

<</if>>

/*Sexual satisfaction effects*/
<<set $sexDemandResult.lowerClass = Math.trunc((($NPCSexSupply.lowerClass + $slaveJobValues.brothel.lowerClass + _clubSupply.lowerClass + _arcadeSupply.lowerClass) * 1000) / _lowerClassSexDemandRef),
$sexDemandResult.middleClass = Math.trunc((($NPCSexSupply.middleClass + $slaveJobValues.brothel.middleClass + _clubSupply.middleClass + _arcadeSupply.middleClass) * 1000) / _middleClassSexDemandRef),
$sexDemandResult.upperClass = Math.trunc((($NPCSexSupply.upperClass + $slaveJobValues.brothel.upperClass + _arcadeSupply.upperClass) * 1000) / _upperClassSexDemandRef),
$sexDemandResult.topClass = Math.trunc((($NPCSexSupply.topClass + $slaveJobValues.brothel.topClass) * 1000) / _topClassSexDemandRef)>>
<<if $sexDemandResult.lowerClass < 400>> /*You are providing < 40% of their desired amount of sex*/
	<<if $week <= 30>>
		<<set $classSatisfied.lowerClass = 0>>
	<<else>>
		<<set $classSatisfied.lowerClass = -1>>
	<</if>>
<<elseif $sexDemandResult.lowerClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
	<<if $week <= 40>>
		<<set $classSatisfied.lowerClass = 1>>
	<<elseif $week <= 60>>
		<<set $classSatisfied.lowerClass = 0>>
	<<else>>
		<<set $classSatisfied.lowerClass = -1>>
	<</if>>
<<elseif $sexDemandResult.lowerClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
	<<if $week <= 50>>
		<<set $classSatisfied.lowerClass = 1>>
	<<else>>
		<<set $classSatisfied.lowerClass = 0>>
	<</if>>
<<elseif $sexDemandResult.lowerClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
	<<set $classSatisfied.lowerClass = 2>>
<<else>> /*You are providing > 80% of their desired amount of sex*/
	<<set $classSatisfied.lowerClass = 1>>
<</if>>

<<if $sexDemandResult.middleClass < 400>> /*You are providing < 40% of their desired amount of sex*/
	<<if $week <= 30>>
		<<set $classSatisfied.middleClass = 0>>
	<<else>>
		<<set $classSatisfied.middleClass = -1>>
	<</if>>
<<elseif $sexDemandResult.middleClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
	<<if $week <= 40>>
		<<set $classSatisfied.middleClass = 1>>
	<<elseif $week <= 60>>
		<<set $classSatisfied.middleClass = 0>>
	<<else>>
		<<set $classSatisfied.middleClass = -1>>
	<</if>>
<<elseif $sexDemandResult.middleClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
	<<if $week <= 50>>
		<<set $classSatisfied.middleClass = 1>>
	<<else>>
		<<set $classSatisfied.middleClass = 0>>
	<</if>>
<<elseif $sexDemandResult.middleClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
	<<set $classSatisfied.middleClass = 2>>
<<else>> /*You are providing > 80% of their desired amount of sex*/
	<<set $classSatisfied.middleClass = 1>>
<</if>>

<<if $sexDemandResult.upperClass < 400>> /*You are providing < 40% of their desired amount of sex*/
	<<if $week <= 30>>
		<<set $classSatisfied.upperClass = 0>>
	<<else>>
		<<set $classSatisfied.upperClass = -1>>
	<</if>>
<<elseif $sexDemandResult.upperClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
	<<if $week <= 40>>
		<<set $classSatisfied.upperClass = 1>>
	<<elseif $week <= 60>>
		<<set $classSatisfied.upperClass = 0>>
	<<else>>
		<<set $classSatisfied.upperClass = -1>>
	<</if>>
<<elseif $sexDemandResult.upperClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
	<<if $week <= 50>>
		<<set $classSatisfied.upperClass = 1>>
	<<else>>
		<<set $classSatisfied.upperClass = 0>>
	<</if>>
<<elseif $sexDemandResult.upperClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
	<<set $classSatisfied.upperClass = 2>>
<<else>> /*You are providing > 80% of their desired amount of sex*/
	<<set $classSatisfied.upperClass = 1>>
<</if>>

<<if $sexDemandResult.topClass < 400>> /*You are providing < 40% of their desired amount of sex*/
	<<if $week <= 30>>
		<<set $classSatisfied.topClass = 0>>
	<<else>>
		<<set $classSatisfied.topClass = -1>>
	<</if>>
<<elseif $sexDemandResult.topClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
	<<if $week <= 40>>
		<<set $classSatisfied.topClass = 1>>
	<<elseif $week <= 60>>
		<<set $classSatisfied.topClass = 0>>
	<<else>>
		<<set $classSatisfied.topClass = -1>>
	<</if>>
<<elseif $sexDemandResult.topClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
	<<if $week <= 50>>
		<<set $classSatisfied.topClass = 1>>
	<<else>>
		<<set $classSatisfied.topClass = 0>>
	<</if>>
<<elseif $sexDemandResult.topClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
	<<set $classSatisfied.topClass = 2>>
<<else>> /*You are providing > 80% of their desired amount of sex*/
	<<set $classSatisfied.topClass = 1>>
<</if>>

<<for $i = 0; $i < _SL; $i++>>

<<if ndef $slaves[$i].skill.whoring>>
	@@.yellow;Reset bad whore skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[$i].skill.whoring = 0>>
<</if>>
<<if ndef $slaves[$i].skill.entertainment>>
	@@.yellow;Reset bad entertain skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[$i].skill.entertainment = 0>>
<</if>>
<<if ndef $slaves[$i].skill.vaginal>>
	@@.yellow;Reset bad vaginal skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[$i].skill.vaginal = 0>>
<</if>>
<<if ndef $slaves[$i].skill.anal>>
	@@.yellow;Reset bad anal skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[$i].skill.anal = 0>>
<</if>>
<<if ndef $slaves[$i].skill.oral>>
	@@.yellow;Reset bad skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.

	<<set $slaves[$i].skill.oral = 0>>
<</if>>

<<if ($seeDicks > 0) && canPenetrate($slaves[$i]) && App.Utils.hasNonassignmentSex($slaves[$i])>>
	<<set $averageDick += $slaves[$i].dick, $slavesWithWorkingDicks++>>
<</if>>

<<if ($slaves[$i].lactation == 1)>>
	<<set $slaves[$i].lactationDuration-->>
<</if>>

<<switch $slaves[$i].assignment>>
<<case "be your Head Girl">>
	<<set $HeadGirl = $slaves[$i]>>
	<<if $HeadGirl.fetish == "mindbroken">>
		''__@@.pink;$HeadGirl.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<<elseif !canTalk($HeadGirl)>>
		''__@@.pink;$HeadGirl.slaveName@@__'' can't give slaves verbal orders @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<<elseif !canWalk($HeadGirl)>>
		''__@@.pink;$HeadGirl.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<<elseif !canHold($HeadGirl)>>
		''__@@.pink;$HeadGirl.slaveName@@__'' is no longer able to handle your slaves @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<<elseif !canSee($HeadGirl)>>
		''__@@.pink;$HeadGirl.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<<elseif !canHear($HeadGirl)>>
		''__@@.pink;$HeadGirl.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<<elseif $HeadGirl.preg > 37 && $HeadGirl.broodmother == 2>>
		''__@@.pink;$HeadGirl.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Head Girl any longer.@@
		<<set $HeadGirl = 0>>
	<<elseif $HeadGirl.devotion <= 20>>
		''__@@.pink;$HeadGirl.slaveName@@__'' is no longer even accepting of you, @@.yellow;and cannot serve as your Head Girl any more.@@

		<<set $HeadGirl = 0>>
	<</if>>
	<<if $HeadGirl != 0>>
		<<set $HGEnergy++>>
		<<if $personalAttention == "HG">>
			<<set $HGEnergy++>>
			<<if $HeadGirl.trust > 95>>
				<<set $HGEnergy++>>
			<</if>>
		<</if>>
		<<if $arcologies[0].FSChineseRevivalistLaw == 1>>
			<<set $HGEnergy++>>
		<</if>>
		<<if canAchieveErection($HeadGirl)>>
			<<set $HGCum = 2+Math.trunc(($HeadGirl.balls/5)+($HeadGirl.energy/95)+($HeadGirl.health.condition/95)+($HeadGirl.devotion/95)+($reproductionFormula*5))>>
		<</if>>
	<<else>>
		<<= removeJob($slaves[$i], "be your Head Girl")>>
	<</if>>
<<case "live with your Head Girl">>
	<<if $slaves[$i].devotion >= random(-30,20)>>
		<<set $HGSlaveSuccess++, $HGEnergy++>>
	<<else>>
		<<set $HGSlaveSuccess-->>
	<</if>>
<<case "recruit girls">>
	<<set $Recruiter = $slaves[$i]>>
	<<if $Recruiter.fetish == "mindbroken">>
		''__@@.pink;$Recruiter.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter = 0>>
	<<elseif !canTalk($Recruiter)>>
		''__@@.pink;$Recruiter.slaveName@@__'' can't verbally entice marks @@.yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter = 0>>
	<<elseif $Recruiter.preg > 37 && $Recruiter.broodmother == 2>>
		''__@@.pink;$Recruiter.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your recruiter any longer.@@
		<<set $Recruiter = 0>>
	<<elseif !canWalk($Recruiter)>>
		''__@@.pink;$Recruiter.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter = 0>>
	<<elseif !canSee($Recruiter)>>
		''__@@.pink;$Recruiter.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your recruiter any more.@@

		<<set $Recruiter = 0>>
	<<elseif !canHear($Recruiter)>>
		''__@@.pink;$Recruiter.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Recruiter any more.@@

		<<set $Recruiter = 0>>
	<</if>>
	<<if $Recruiter == 0>>
		<<= removeJob($slaves[$i], "recruit girls")>>
	<</if>>
<<case "be the Madam">>
	<<if $unMadam == 1>>
		''__@@.pink;$Madam.slaveName@@__'' can't give whores verbal orders @@.yellow;and cannot serve as your Madam any more.@@

	<<elseif $unMadam == 2>>
		''__@@.pink;$Madam.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Madam any longer.@@
	<<elseif $unMadam == 3>>
		''__@@.pink;$Madam.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Madam any more.@@

	<<elseif $unMadam == 4>>
		''__@@.pink;$Madam.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Madam any more.@@

	<<elseif $unMadam == 5>>
		''__@@.pink;$Madam.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Madam any more.@@

	<<elseif $unMadam == 6>>
		''__@@.pink;$Madam.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Madam any more.@@

	<<elseif $unMadam == 7>>
		''__@@.pink;$Madam.slaveName@@__'' can no longer handle $his underlings @@.yellow;and cannot serve as your Madam any more.@@

	<</if>>
	<<if $Madam == 0>>
		<<= removeJob($slaves[$i], "be the Madam")>>
	<</if>>
<<case "be the DJ">>
	<<if $unDJ == 1>>
		''__@@.pink;$slaves[$i].slaveName@@__'' can't speak @@.yellow;and cannot serve as your DJ any more.@@

	<<elseif $unDJ == 2>>
		''__@@.pink;$slaves[$i].slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your DJ any longer@@.

	<<elseif $unDJ == 3>>
		''__@@.pink;$slaves[$i].slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your DJ any more.@@

	<<elseif $unDJ == 4>>
		''__@@.pink;$slaves[$i].slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your DJ any more.@@

	<<elseif $unDJ == 5>>
		''__@@.pink;$slaves[$i].slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your DJ any more.@@

	<</if>>
	<<if $DJ == 0>>
		<<= removeJob($slaves[$i], "be the DJ")>>
	<</if>>
<<case "be the Milkmaid">>
	<<set $Milkmaid = $slaves[$i]>>
	<<if $Milkmaid.fetish == "mindbroken">>
		''__@@.pink;$Milkmaid.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid = 0>>
	<<elseif $Milkmaid.preg > 37 && $Milkmaid.broodmother == 2>>
		''__@@.pink;$Milkmaid.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Milkmaid any longer.@@
		<<set $Milkmaid = 0>>
	<<elseif !canWalk($Milkmaid)>>
		''__@@.pink;$Milkmaid.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid = 0>>
	<<elseif !canHold($Milkmaid)>>
		''__@@.pink;$Milkmaid.slaveName@@__'' can no longer handle nor milk your slaves @@.yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid = 0>>
	<<elseif !canSee($Milkmaid)>>
		''__@@.pink;$Milkmaid.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid = 0>>
	<<elseif !canHear($Milkmaid)>>
		''__@@.pink;$Milkmaid.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Milkmaid any more.@@

		<<set $Milkmaid = 0>>
	<</if>>
	<<if $Milkmaid == 0>>
		<<= removeJob($slaves[$i], "be the Milkmaid")>>
	<</if>>
<<case "be the Farmer">>
	<<set $Farmer = $slaves[$i]>>
	<<if $Farmer.fetish == "mindbroken">>
		''__@@.pink;$Farmer.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Farmer any more.@@

		<<set $Farmer = 0>>
	<<elseif $Farmer.preg > 37 && $Farmer.broodmother == 2>>
		''__@@.pink;$Farmer.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Farmer any longer.@@
		<<set $Farmer = 0>>
	<<elseif !canWalk($Farmer)>>
		''__@@.pink;$Farmer.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Farmer any more.@@

		<<set $Farmer = 0>>
	<<elseif !canHold($Farmer)>>
		''__@@.pink;$Farmer.slaveName@@__'' can no longer grip things @@.yellow;and cannot serve as your Farmer any more.@@

		<<set $Farmer = 0>>
	<<elseif !canSee($Farmer)>>
		''__@@.pink;$Farmer.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Farmer any more.@@

		<<set $Farmer = 0>>
	<<elseif !canHear($Farmer)>>
		''__@@.pink;$Farmer.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Farmer any more.@@

		<<set $Farmer = 0>>
	<</if>>
	<<if $Farmer == 0>>
		<<= removeJob($slaves[$i], "be the Farmer")>>
	<</if>>
<<case "be the Stewardess">>
	<<set $Stewardess = $slaves[$i]>>
	<<if !canTalk($Stewardess)>>
		''__@@.pink;$Stewardess.slaveName@@__'' can't give servants verbal orders @@.yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess = 0>>
	<<elseif $Stewardess.preg > 37 && $Stewardess.broodmother == 2>>
		''__@@.pink;$Stewardess.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Stewardess any longer.@@
		<<set $Stewardess = 0>>
	<<elseif $Stewardess.fetish == "mindbroken">>
		''__@@.pink;$Stewardess.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess = 0>>
	<<elseif !canWalk($Stewardess)>>
		''__@@.pink;$Stewardess.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess = 0>>
	<<elseif !canHold($Stewardess)>>
		''__@@.pink;$Stewardess.slaveName@@__'' can no longer handle $his underlings nor effectively clean @@.yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess = 0>>
	<<elseif !canSee($Stewardess)>>
		''__@@.pink;$Stewardess.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess = 0>>
	<<elseif !canHear($Stewardess)>>
		''__@@.pink;$Stewardess.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Stewardess any more.@@

		<<set $Stewardess = 0>>
	<</if>>
	<<if $Stewardess == 0>>
		<<= removeJob($slaves[$i], "be the Stewardess")>>
	<</if>>
<<case "be the Schoolteacher">>
	<<set $Schoolteacher = $slaves[$i]>>
	<<if !canTalk($Schoolteacher)>>
		''__@@.pink;$Schoolteacher.slaveName@@__'' can't give verbal instruction @@.yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher = 0>>
	<<elseif $Schoolteacher.preg > 37 && $Schoolteacher.broodmother == 2>>
		''__@@.pink;$Schoolteacher.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Schoolteacher any longer.@@
		<<set $Schoolteacher = 0>>
	<<elseif $Schoolteacher.fetish == "mindbroken">>
		''__@@.pink;$Schoolteacher.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher = 0>>
	<<elseif !canSee($Schoolteacher)>>
		''__@@.pink;$Schoolteacher.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher = 0>>
	<<elseif !canHear($Schoolteacher)>>
		''__@@.pink;$Schoolteacher.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Schoolteacher any more.@@

		<<set $Schoolteacher = 0>>
	<</if>>
	<<if $Schoolteacher == 0>>
		<<= removeJob($slaves[$i], "be the Schoolteacher")>>
	<</if>>
<<case "be the Wardeness">>
	<<set $Wardeness = $slaves[$i]>>
	<<if !canWalk($Wardeness)>>
		''__@@.pink;$Wardeness.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Wardeness any more.@@

		<<set $Wardeness = 0>>
	<<elseif !canHold($Wardeness)>>
		''__@@.pink;$Wardeness.slaveName@@__'' can no longer handle $his charges @@.yellow;and cannot serve as your Wardeness any more.@@

		<<set $Wardeness = 0>>
	<<elseif $Wardeness.preg > 37 && $Wardeness.broodmother == 2>>
		''__@@.pink;$Wardeness.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Wardeness any longer.@@
		<<set $Wardeness = 0>>
	<<elseif !canSee($Wardeness)>>
		''__@@.pink;$Wardeness.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Wardeness any more.@@

		<<set $Wardeness = 0>>
	<<elseif !canHear($Wardeness)>>
		''__@@.pink;$Wardeness.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Wardeness any more.@@

		<<set $Wardeness = 0>>
	<</if>>
	<<if $Wardeness == 0>>
		<<= removeJob($slaves[$i], "be the Wardeness")>>
	<</if>>
<<case "be the Attendant">>
	<<set $Attendant = $slaves[$i]>>
	<<if $Attendant.fetish == "mindbroken">>
		''__@@.pink;$Attendant.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Attendant any more.@@

		<<set $Attendant = 0>>
	<<elseif $Attendant.preg > 37 && $Attendant.broodmother == 2>>
		''__@@.pink;$Attendant.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Attendant any longer.@@
		<<set $Attendant = 0>>
	<<elseif !canWalk($Attendant)>>
		''__@@.pink;$Attendant.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Attendant any more.@@

		<<set $Attendant = 0>>
	<<elseif !canHold($Attendant)>>
		''__@@.pink;$Attendant.slaveName@@__'' can no longer support $his charges @@.yellow;and cannot serve as your Attendant any more.@@

		<<set $Attendant = 0>>
	<<elseif !canHear($Attendant)>>
		''__@@.pink;$Attendant.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Attendant any more.@@

		<<set $Attendant = 0>>
	<</if>>
	<<if $Attendant == 0>>
		<<= removeJob($slaves[$i], "be the Attendant")>>
	<</if>>
<<case "be the Matron">>
	<<set $Matron = $slaves[$i]>>
	<<if $Matron.fetish == "mindbroken">>
		''__@@.pink;$Matron.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Matron any more.@@

		<<set $Matron = 0>>
	<<elseif $Matron.preg > 37 && $Matron.broodmother == 2>>
		''__@@.pink;$Matron.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Matron any longer.@@
		<<set $Matron = 0>>
	<<elseif !canWalk($Matron)>>
		''__@@.pink;$Matron.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Matron any more.@@

		<<set $Matron = 0>>
	<<elseif !canHold($Matron)>>
		''__@@.pink;$Matron.slaveName@@__'' can no longer hold infants @@.yellow;and cannot serve as your Matron any more.@@

		<<set $Matron = 0>>
	<<elseif !canHear($Matron)>>
		''__@@.pink;$Matron.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Matron any more.@@

		<<set $Matron = 0>>
	<<elseif !canSee($Matron)>>
		''__@@.pink;$Matron.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Matron any more.@@

		<<set $Matron = 0>>
	<</if>>
	<<if $Matron == 0>>
		<<= removeJob($slaves[$i], "be the Matron")>>
	<</if>>
<<case "be the Nurse">>
	<<set $Nurse = $slaves[$i]>>
	<<if $Nurse.fetish == "mindbroken">>
		''__@@.pink;$Nurse.slaveName@@__'' is mindbroken @@.yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse = 0>>
	<<elseif $Nurse.preg > 37 && $Nurse.broodmother == 2>>
		''__@@.pink;$Nurse.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Nurse any longer.@@
		<<set $Nurse = 0>>
	<<elseif !canWalk($Nurse)>>
		''__@@.pink;$Nurse.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse = 0>>
	<<elseif !canHold($Nurse)>>
		''__@@.pink;$Nurse.slaveName@@__'' can no longer hold onto patients @@.yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse = 0>>
	<<elseif !canSee($Nurse)>>
		''__@@.pink;$Nurse.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse = 0>>
	<<elseif !canHear($Nurse)>>
		''__@@.pink;$Nurse.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Nurse any more.@@

		<<set $Nurse = 0>>
	<</if>>
	<<if $Nurse == 0>>
		<<= removeJob($slaves[$i], "be the Nurse")>>
	<</if>>
<<case "guard you">>
	<<set $Bodyguard = $slaves[$i]>>
	<<if $Bodyguard.fetish == "mindbroken">>
		''__@@.pink;$Bodyguard.slaveName@@__'' is mindbroken @@.yellow;and cannot safely serve as your bodyguard any more.@@

		<<set $Bodyguard = 0>>
	<<elseif !canWalk($Bodyguard)>>
		''__@@.pink;$Bodyguard.slaveName@@__'' is no longer independently mobile @@.yellow;and cannot serve as your bodyguard any more.@@

		<<set $Bodyguard = 0>>
	<<elseif !canHold($Bodyguard)>>
		''__@@.pink;$Bodyguard.slaveName@@__'' is no longer able to hold a weapon @@.yellow;and cannot serve as your bodyguard any more.@@

		<<set $Bodyguard = 0>>
	<<elseif $Bodyguard.preg > 37 && $Bodyguard.broodmother == 2>>
		''__@@.pink;$Bodyguard.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your bodyguard any longer.@@
		<<set $Bodyguard = 0>>
	<<elseif !canSee($Bodyguard)>>
		''__@@.pink;$Bodyguard.slaveName@@__'' can no longer see @@.yellow;and cannot serve as your Bodyguard any more.@@

		<<set $Bodyguard = 0>>
	<<elseif !canHear($Bodyguard)>>
		''__@@.pink;$Bodyguard.slaveName@@__'' can no longer hear @@.yellow;and cannot serve as your Bodyguard any more.@@

		<<set $Bodyguard = 0>>
	<</if>>
	<<if $Bodyguard == 0>>
		<<= removeJob($slaves[$i], "guard you")>>
	<</if>>
<<case "be your Concubine">>
	<<set $Concubine = $slaves[$i], $fuckSlaves++>>
<<case "serve in the master suite" "please you">>
	<<set $fuckSlaves++>>
<</switch>>

<<if $Lurcher>>
	<<if $slaves[$i].ID == $Lurcher.ID>>
		<<set $Lurcher = $slaves[$i]>>
		<<if !canWalk($Lurcher)>>
			''__@@.pink;$Lurcher.slaveName@@__'' is no longer able to run @@.yellow;and cannot course as a lurcher.@@

			<<set $Lurcher = 0>>
		<<elseif !canHold($Lurcher)>>
			''__@@.pink;$Lurcher.slaveName@@__'' is no longer able to catch the hares @@.yellow;and cannot course as a lurcher.@@

			<<set $Lurcher = 0>>
		<<elseif !canHear($Lurcher) && !canSee($Lurcher)>>
			''__@@.pink;$Lurcher.slaveName@@__'' is no longer able to track the hares @@.yellow;and cannot course as a lurcher.@@

			<<set $Lurcher = 0>>
		<<elseif $Lurcher.bellyPreg >= 60000>>
			''__@@.pink;$Lurcher.slaveName@@__'' is too pregnant to run @@.yellow;and cannot course as a lurcher.@@
			<<set $Lurcher = 0>>
		<</if>>
	<</if>>
<</if>>

<<if $fighterIDs.includes($slaves[$i])>>
	<<if !canWalk($slaves[$i])>>
		''__@@.pink;$slaves[$i].slaveName@@__'' is no longer independently mobile @@.yellow;and cannot fight any more.@@ $He has been removed from $pitName roster
.
		<<set $fighterIDs.delete($slaves[$i].ID)>>
	<<elseif !canHold($slaves[$i])>>
		''__@@.pink;$slaves[$i].slaveName@@__'' is no longer able to strike @@.yellow;and cannot fight any more.@@ $He has been removed from $pitName roster
.
		<<set $fighterIDs.delete($slaves[$i].ID)>>
	<</if>>
<</if>>

<<if $slaves[$i].origin && $slaves[$i].origin.includes("Slave Shelter")>>
	<<set $shelterGirlsIDs.push($slaves[$i].ID)>>
<</if>>

<<if $slaves[$i].bellyPain != 0>>
	<<set $slaves[$i].bellyPain = 0>>
<</if>>

/* preg speed and advance*/

<<if $slaves[$i].preg > 0>>
	<<set _pregSpeed = 1>> /*base speed is normal*/
	<<if $slaves[$i].pregControl == "slow gestation">>
		<<set _pregSpeed = 0.5>>
	<<elseif $slaves[$i].pregControl == "speed up">>
		<<set _pregSpeed = 2>>
	<</if>>

	<<if $slaves[$i].broodmother == 1 && $slaves[$i].broodmotherOnHold != 1>> /* broodmother advance block */
		<<if ($week / $slaves[$i].broodmotherFetuses == Math.round($week / $slaves[$i].broodmotherFetuses)) && $slaves[$i].broodmotherFetuses < 1>>
			/*one fetus in few week - selection and adding*/
			<<set WombImpregnate($slaves[$i], 1, $slaves[$i].pregSource, 0)>>
		<<else>>
			/*one or more fetuses in one week*/
			<<set WombImpregnate($slaves[$i], Math.floor($slaves[$i].broodmotherFetuses), $slaves[$i].pregSource, 0)>> /* really 0, it's will be advanced right few lines down.*/
		<</if>>
		<<if $slaves[$i].ovaryAge >= 47>>
			<<set $slaves[$i].broodmotherOnHold = 1 >>
			<<set $slaves[$i].broodmotherCountDown = 37 - WombMinPreg($slaves[$i])>>
		<</if>>
	<</if>>

	<<set WombProgress($slaves[$i], _pregSpeed, 1)>> /* drugs can affect speed of gestation, but not a real time */

	<<set $slaves[$i].pregKnown = 1>>
	<<set $slaves[$i].pregWeek++>>
<</if>>
<<if $slaves[$i].pregWeek < 0 >> /*postpartum state*/
	<<set $slaves[$i].pregWeek++>>
<</if>>

<<run SetBellySize($slaves[$i])>> /* here will be also set through WombGetVolume .bellyPreg, .pregType, to current values. */

/* end of preg speed and advance*/

/* set up sexual need */
<<if $slaves[$i].devotion >= -50>>
	<<if $slaves[$i].energy > 20>>
		<<if $slaves[$i].physicalAge < $slaves[$i].pubertyAgeXY && $slaves[$i].genes == "XY" && $slaves[$i].energy <= 80>>
			<<set $slaves[$i].need = $slaves[$i].energy/3>>
		<<elseif $slaves[$i].physicalAge < $slaves[$i].pubertyAgeXX && $slaves[$i].genes == "XX" && $slaves[$i].energy <= 80>>
			<<set $slaves[$i].need = $slaves[$i].energy/3>>
		<<elseif $slaves[$i].physicalAge < 50>>
			<<set $slaves[$i].need = $slaves[$i].energy>>
		<<else>>
			<<set $slaves[$i].need = $slaves[$i].energy/5>>
		<</if>>
		<<if $slaves[$i].balls > 0 && $slaves[$i].pubertyXY == 1 && $slaves[$i].physicalAge <= ($slaves[$i].pubertyAgeXY + 1) && ($slaves[$i].physicalAge > $slaves[$i].pubertyAgeXY) && $slaves[$i].physicalAge < 18>>
			<<set $slaves[$i].need = ($slaves[$i].need*1.25)>>
		<</if>>
		<<if ($slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1) && $slaves[$i].pubertyXX == 1 && $slaves[$i].physicalAge <= ($slaves[$i].pubertyAgeXX + 1) && ($slaves[$i].physicalAge > $slaves[$i].pubertyAgeXX) && $slaves[$i].physicalAge < 18>>
			<<set $slaves[$i].need = ($slaves[$i].need*1.25)>>
		<</if>>
		<<if $slaves[$i].diet == "fertility">>
			<<set $slaves[$i].need += 10>>
		<</if>>
		<<if $slaves[$i].aphrodisiacs == -1>>
			<<set $slaves[$i].need = ($slaves[$i].need*0.5)>>
		<<elseif $slaves[$i].aphrodisiacs == 1>>
			<<set $slaves[$i].need = ($slaves[$i].need*1.5)>>
		<<elseif $slaves[$i].aphrodisiacs == 2>>
			<<set $slaves[$i].need = ($slaves[$i].need*2)>>
		<</if>>
		<<run poorHealthNeedReduction($slaves[$i])>>
		<<set $slaves[$i].need = Math.round($slaves[$i].need)>>
		<<set $slaves[$i].needCap = $slaves[$i].need>>
	<</if>>
<</if>>

<<if $slaves[$i].fetish == "mindbroken" && $slaves[$i].relationship == -3>>
	<<if (def $slaves[$i].kindness) && $slaves[$i].kindness > 0>>
		<<set $slaves[$i].kindness-->>
	<</if>>
<</if>>

<<if $slaves[$i].assignment == "be your agent" || $slaves[$i].assignment == "live with your agent">>
	<<include "SA agent">>
<</if>>

<</for>>

<<if $averageDick > 0>><<set $averageDick = $averageDick/$slavesWithWorkingDicks>><</if>>
<<set $freeSexualEnergy = $PC.sexualEnergy-$fuckSlaves>>
<<if $freeSexualEnergy > 0>>
	<<if $freeSexualEnergy > $slavesVisible/2>>
		<<set $freeSexualEnergy = 3>>
	<<elseif $freeSexualEnergy > $slavesVisible/4>>
		<<set $freeSexualEnergy = 2>>
	<<else>>
		<<set $freeSexualEnergy = 1>>
	<</if>>
<</if>>

<<if $HeadGirl>>
	<<set _HGPossibleSlaves = [[], [], [], [], [], []]>>
	<<for $i = 0; $i < _SL; $i++>>
		<<set _Slave = $slaves[$i]>>
		<<if !assignmentVisible(_Slave) || _Slave.fuckdoll == 1 || _Slave.ID == $Bodyguard.ID || _Slave.ID == $HeadGirl.ID || _Slave.fetish == "mindbroken">>
			<<continue>>
		<<elseif Array.isArray($personalAttention) && $personalAttention.findIndex(function(s) { return s.ID == _Slave.ID; }) != -1>>
			<<continue>>
		<</if>>

		<<if ($headGirlTrainsHealth && _Slave.health.condition < -20)>>
			<<set _HGPossibleSlaves[0].push({ID: _Slave.ID, training: "health"})>>
			<<continue>>
		<</if>>

		<<if _Slave.health.tired < 50>>
			<<set _hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(_Slave.sexualFlaw))>>
			<<if ($headGirlTrainsParaphilias && _hasParaphilia)>>
				<<set _HGPossibleSlaves[1].push({ID: _Slave.ID, training: "paraphilia"})>>
				<<continue>>
			<</if>>

			<<if $headGirlTrainsFlaws || $headGirlSoftensFlaws>>
				<<if _Slave.behavioralFlaw != "none" || (_Slave.sexualFlaw != "none" && !_hasParaphilia)>>
					<<if $headGirlSoftensFlaws>>
						<<if _Slave.devotion > 20>>
							<<if (_Slave.behavioralFlaw != "none" && _Slave.behavioralQuirk == "none") || (_Slave.sexualFlaw != "none" && _Slave.sexualQuirk == "none" && !_hasParaphilia)>>
								<<set _HGPossibleSlaves[3].push({ID: _Slave.ID, training: "soften"})>>
							<<else>>
								<<set _HGPossibleSlaves[3].push({ID: _Slave.ID, training: "flaw"})>>
							<</if>>
							<<continue>>
						<</if>>
					<<elseif $headGirlTrainsFlaws>>
						<<set _HGPossibleSlaves[2].push({ID: _Slave.ID, training: "flaw"})>>
						<<continue>>
					<</if>>
				<</if>>
			<</if>>

			<<if ($headGirlTrainsObedience && _Slave.devotion <= 20 && _Slave.trust >= -20)>>
				<<set _HGPossibleSlaves[4].push({ID: _Slave.ID, training: "obedience"})>>
				<<continue>>
			<</if>>

			<<if ($headGirlTrainsSkills)>>
				<<if (_Slave.skill.oral < $HeadGirl.skill.oral)>>
					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "oral skill"})>>
				<<elseif (_Slave.skill.vaginal < $HeadGirl.skill.vaginal) && (_Slave.vagina > 0) && (canDoVaginal(_Slave))>>
					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "fuck skill"})>>
				<<elseif (_Slave.skill.anal < $HeadGirl.skill.anal) && (_Slave.anus > 0) && (canDoAnal(_Slave))>>
					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "anal skill"})>>
				<<elseif (_Slave.skill.whoring < $HeadGirl.skill.whoring)>>
					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "whore skill"})>>
				<<elseif (_Slave.skill.entertainment < $HeadGirl.skill.entertainment) && !isAmputee(_Slave)>>
					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "entertain skill"})>>
				<</if>>
			<</if>>
		<</if>>
	<</for>>
	<<set $HGTrainSlavesIDs = _HGPossibleSlaves.flatten().slice(0, $HGEnergy)>>
<<else>>
	<<set $HGTrainSlavesIDs = []>>
<</if>>

/**
* Accordion
* @version 0.7RC
* @author 000-250-006
*
* @param array _facListArr $args
*	Multidimensional temporary array
*	0: The passage name for the facility's report
*	1: The facility name capitalized (@see todo)
*	2: max number of slaves allowed in facility - > 0 implies open
*	3: number of slaves assigned to facility
*	4: ID of the slave assigned to run the facility ("Boss")
*	5: Text title of the Boss
*
* @todo This is a proof of concept construct, if it works and cuts overhead, intended to create an object
*	for deeper use in multiple locations, including streamlining reports/facilities code to one widget
* @todo Figure out if this would be better as an object rather than an array for overhead
*	StoryInit also?
* @todo Figure out why we're not using ndef/-1 for a bunch of these story variables. Leaky conditionals
* @todo Figure out why we're using variable space with capitalized facility names when we can parse it from true name
*/

<<set _facListArr = [
	["Arcade Report", $arcadeNameCaps, $arcade, $ArcadeiIDs.length, -1, -1],
	["Brothel Report", $brothelNameCaps, $brothel, $BrothiIDs.length, $Madam, "Madam"],
	["Cellblock Report", $cellblockNameCaps, $cellblock, $CellBiIDs.length, $Wardeness, "Wardeness"],
	["Clinic Report", $clinicNameCaps, $clinic, $CliniciIDs.length, $Nurse, "Nurse"],
	["Club Report", $clubNameCaps, $club, $ClubiIDs.length, $DJ, "DJ"],
	["Dairy Report", $dairyNameCaps, $dairy, $DairyiIDs.length, $Milkmaid, "Milkmaid"],
	["Farmyard Report", $farmyardNameCaps, $farmyard, $FarmyardiIDs.length, $Farmer, "Farmer"],
	["Schoolroom Report", $schoolroomNameCaps, $schoolroom, $SchlRiIDs.length, $Schoolteacher, "Schoolteacher"],
	["Spa Report", $spaNameCaps, $spa, $SpaiIDs.length, $Attendant, "Attendant"],
	["Nursery Report", $nurseryNameCaps, $nurseryNannies, $NurseryiIDs.length, $Matron, "Matron"],
	["Servants' Quarters Report", $servantsQuartersNameCaps, $servantsQuarters, $ServQiIDs.length, $Stewardess, "Stewardess"],
	["Children Report", "Nursery Children", $nursery, $nurseryBabies, -1, -1],
	["Incubator Report", $incubatorNameCaps, $incubator, $incubatorSlaves, -1, -1],
	["Master Suite Report", $masterSuiteNameCaps, $masterSuite, $MastSiIDs.length, $Concubine, "Concubine"],
	["Penthouse Report", "The Penthouse", 1, $slavesVisible, -1, -1],
	["Rules Assistant Report", "Rules Assistant", $rulesAssistantAuto, 1, -1, -1] /** should be last — may reassign slaves **/
]>>

<<for _ii = 0; _ii < _facListArr.length; _ii++>>
	<<set _facSubArr = _facListArr[_ii], _accText = "", _disTxt = " disabled='disabled'">> /** Chunk the row from our array we're working on to make reading code easier, null some text vars we'll need */
	<<set _str = _facSubArr[0].replace(/\W+/g, '-').toLowerCase()>> /** Normalize the passage name to use as an element ID */
	<<if _facSubArr[2] > 0>> /** Do we have one of these facilities? */
		<<if $useAccordion > 0>> <<set _accText = " accordion", _disTxt = "">> <</if>> /** Is Accordion turned on? */
		<<if (_facSubArr[3] == 0) && (_facSubArr[4] <= 0)>> /** Is there anyone inside the facility? */
			''_facSubArr[1] Report''
 /** No — it's empty, so we display the heading without a button and with a thinner bar under it */
			@@.gray;_facSubArr[1] is currently empty.@@

			/** Old code: <<= '
' + _facSubArr[1] + ' is currently unstaffed
'>> */
		<<else>>
			<<if _facSubArr[1] == "Rules Assistant">>
				<<= '<button type="button"' + _disTxt + ' id="button-' + _str + '" class="buttonBar' + _accText + '" data-after="' + '">' + _facSubArr[1] + ' Report</button>'>> /** Yes, display the bar with information */
			<<else>>
				<<= '<button type="button"' + _disTxt + ' id="button-' + _str + '" class="buttonBar' + _accText + '" data-after="' + _facSubArr[3] + ' slaves in ' + _facSubArr[1] + '">' + _facSubArr[1] + ' Report</button>'>> /** Yes, display the bar with information */
			<</if>>
			<<if $useAccordion == 0>>

				<<include `_facSubArr[0]`>> /** not using accordion — just include the report under the disabled button above */

			<</if>>
		<</if>>

			<<if $useAccordion == 1>>
				<<include `_facSubArr[0]`>> /** OK, we're done with the pretty stuff, go get the guts and collapse it into the accordion */
			<</if>>

	<</if>>
	<<unset _facSubArr>>
<</for>>

/* IMPORTANT FOR REASONS!!! */
<<unset _ii>>
/** /Accordion */

<<if ($researchLab.level > 0)>>
	<<include "Lab Report">>

<</if>>