code:
:: Servants' Quarters Report [nobr]

<<SlaveSort $ServQiIDs>>
<<set _DL = $ServQiIDs.length, $servantsQuartersSlaves = _DL, _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 < -80)>>
		<<set $slaves[_FLs].health += 20>>
	<<elseif ($slaves[_FLs].health < -40)>>
		<<set $slaves[_FLs].health += 15>>
	<<elseif ($slaves[_FLs].health < 0)>>
		<<set $slaves[_FLs].health += 10>>
	<<elseif ($slaves[_FLs].health < 90)>>
		<<set $slaves[_FLs].health += 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].livingRules != "luxurious">>
		<<set $slaves[_FLs].livingRules = "luxurious">>
	<</if>>
	<<set $Stewardess = $slaves[_FLs]>>
	    <<= SlaveFullName($Stewardess)>> is serving as your Stewardess.<<if $Stewardess.relationship == -3 && $Stewardess.devotion > 50>> She does her best to be your perfect lovely housewife.<</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].vaginalCount += 10, $vaginalTotal += 10>>
				<<set $slaves[$i].need = 0>>
			<</if>>
		<</for>>
		<<if _stewardessImpregnated > 0>>
			It's her responsibility to keep her charges pregnant, so
			<<if _stewardessImpregnated == 1>>
				she cums in the only fertile slave's pussy all week.
			<<else>>
				she ensures the _stewardessImpregnated fertile servants are full of her cum at all times.
			<</if>>
			<<if $Stewardess.career == "a breeding bull">>
				She was conditioned to fill empty wombs, so she takes a @@.hotpink;deep pleasure@@ in her job.
				<<set $slaves[_FLs].devotion++>>
			<</if>>
			<<set _Tmult = (_stewardessImpregnated * 10), $slaves[_FLs].penetrativeCount += _Tmult, $Stewardess.penetrativeCount += _Tmult, $penetrativeTotal += _Tmult>>
			<<set $slaves[_FLs].need = 0>>
		<</if>>
	<</if>>
	<<if _FLsFetish == 1>>
		She's allowed and even expected to use her charges for her own gratification, and sometimes they'll even instigate submissive sex with her just to ingratiate themselves. She becomes comfortable with the role of a @@.lightcoral;sexual dominant.@@
	<<elseif _FLsFetish == 2>>
		Having a legion of girls jumping to obey her daily commands @@.lightsalmon;makes her more dominant.@@
	<</if>>
	<<if ($Stewardess.health < 10)>>
		Though she tries to watch the servants, her lack of good health inhibits her.
	<<elseif ($Stewardess.health < 80)>>
		<<set $stewardessBonus += 50>>
		Her good health allows her to work long hours and @@.yellowgreen;drive@@ the servants hard.
	<<else>>
		<<set $stewardessBonus += 75>>
		Her perfect health allows her to work exhaustive hours and @@.yellowgreen;drive@@ the servants very hard.
	<</if>>
	<<if setup.stewardessCareers.includes($Stewardess.career)>>
		<<set $stewardessBonus += 25>>
		She has applicable experience with daily sums and organizational trifles from her life before she was a slave.
	<<elseif $Stewardess.skillST >= $masteredXP>>
		<<set $stewardessBonus += 25>>
		She has applicable experience with daily sums and organizational trifles from working for you.
	<<else>>
		<<set $slaves[_FLs].skillST += random(1,Math.ceil(($Stewardess.intelligence+$Stewardess.intelligenceImplant)/15) + 8)>>
	<</if>>
	<<if ($Stewardess.actualAge > 35)>>
		<<set $stewardessBonus += 25>>
		Her age and experience give her added effectiveness.
	<<elseif $AgePenalty == 0>>
		<<set $stewardessBonus +=25>>
	<</if>>
	<<if ($Stewardess.intelligence+$Stewardess.intelligenceImplant > 15)>>
		<<set $stewardessBonus += $Stewardess.intelligence+$Stewardess.intelligenceImplant>>
		She's smart enough that she 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]]>>
		<<if $Stewardess.rivalryTarget == $slaves[$i].ID>>
			She bears down on her <<if $Stewardess.rivalry == 1>>growing rival<<elseif $Stewardess.rivalry == 2>>rival<<elseif $Stewardess.rivalry == 3>>bitter rival<</if>>, $slaves[$i].slaveName, forcing her 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>>
			She dotes over her <<if $Stewardess.relationship == 1>>friend<<elseif $Stewardess.relationship == 2>>best friend<<elseif $Stewardess.relationship == 3>>friend with benefits<<elseif $Stewardess.relationship == 4>>lover<<elseif $Stewardess.relationship == 5>>slave wife<</if>>, $slaves[$i].slaveName, making sure she knows how to do a good job and keeping her well stocked with everything she needs.
			<<set $slaves[$i].devotion++>>
		<<elseif $familyTesting == 1 && totalRelatives($slaves[$i]) > 0>>
			<<if $slaves[$i].mother == $Stewardess.ID || $slaves[$i].father == $Stewardess.ID>>
				She pays special attention to her daughter, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
				<<set $slaves[$i].trust++>>
			<<elseif $slaves[$i].ID == $Stewardess.mother>>
				She pays special attention to her mother, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
				<<set $slaves[$i].trust++>>
			<<elseif $slaves[$i].ID == $Stewardess.father>>
				She pays special attention to her father, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
				<<set $slaves[$i].trust++>>
			<<else>>
				<<switch areSisters($slaves[$i], $Stewardess)>>
				<<case 1>>
					She pays special attention to her twin sister, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
					<<set $slaves[$i].trust++>>
				<<case 2>>
					She pays special attention to her sister, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
					<<set $slaves[$i].trust++>>
				<<case 3>>
					She pays special attention to her half-sister, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
					<<set $slaves[$i].trust++>>
				<</switch>>
			<</if>>
		<<elseif $Stewardess.relationTarget == $slaves[$i].ID && $familyTesting == 0>>
			She pays special attention to her $slaves[$i].relation, $slaves[$i].slaveName, making sure she doesn't slack off just because they are related.
			<<set $slaves[$i].trust++>>
		<</if>>
		<<switch $slaves[$i].prestigeDesc>>
		<<case "She is a famed Free Cities whore, and commands top prices.">>
			She does her best to motivate the famous whore, $slaves[$i].slaveName, though she is uncertain why she is here.
		<<case "She is a famed Free Cities slut, and can please anyone.">>
			She ignores her duties in order the fawn over the famous entertainer, $slaves[$i].slaveName.
		<<case "She 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 she 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 "She 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 her work and she 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 "She 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 her work. However, $Stewardess.slaveName is willing to overlook it, as well as allow her easy jobs, due to how valuable her 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")>>
			She walks among the cowering servants as a queen among peasants, playing the role of dominant to perfection and increasing her charges' @@.hotpink;obedience.@@
		<<elseif ($Stewardess.energy > 95)>>
			She walks among the cowering servants looking for an excuse to extract sex from shirkers as @@.hotpink;punishment.@@
		<</if>>
		/% Get it out of the loop %/
		<<set $cash += ($stewardessBonus * _DL)>>

	<</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)>>
	    <<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.'' She 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>>
		<<set _chosenClothes = 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>>
	<<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 < -80)>>
		<<set $slaves[$i].health += 20>>
	<<elseif ($slaves[$i].health < -40)>>
		<<set $slaves[$i].health += 10>>
	<<elseif ($slaves[$i].health < 0)>>
		<<set $slaves[$i].health += 7>>
	<<elseif ($slaves[$i].health < 90)>>
		<<set $slaves[$i].health += 3>>
	<</if>>
	<<switch $servantsQuartersDecoration>>
	<<case "Roman Revivalist" "Aztec Revivalist" "Chinese Revivalist" "Chattel Religionist" "Edo Revivalist" "Supremacist" "Subjugationist" "Degradationist" "Arabian Revivalist" "Egyptian Revivalist">>
		<<set $slaves[$i].livingRules = "spare">>
	<<default>>
		<<set $slaves[$i].livingRules = "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>>

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

    She <<include "SA get milked">>
			<<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">>
		<<_dump = saServant($slaves[$i])>>
		<<if ($servantMilkers == 1) && ($slaves[$i].lactation > 0)>>
			<<include "SA get milked">>
			<<set _SQMilk += $milk, _SQMilkSale += $milkSale>>
		<</if>>
		<<set _chosenClothes = 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, $repGain += _DL*20>>

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

<</if>>


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("none", "none", "none", "none", "none", "none", "submissive", "cumslut", "humiliation", "buttslut", "pregnancy", "sadist", "dom", "masochist")>>
<<set _secondSlave.behavioralFlaw = either("none", "none", "none", "arrogant", "bitchy", "odd", "hates men", "hates women", "hates women", "anorexic", "masochist", "gluttonous", "devout", "liberated")>>
<<if (_secondSlave.behavioralFlaw == "devout")>>
	<<set _secondSlave.sexualFlaw = either("none", "repressed",  "shamefast", "apathetic")>>
<<else>>
	<<set _secondSlave.sexualFlaw = either("none", "none", "none", "none", "hates oral", "hates anal", "hates penetration", "repressed", "idealistic", "shamefast", "apathetic", "crude", "judgemental")>>
<</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>>

<<run newSlave(_secondSlave)>>


code:
:: Slave Assignments Report [nobr]

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

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

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

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

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

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

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

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

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

<<if ($seeDicks > 0) && (canPenetrate($slaves[$i])) && ($slaves[$i].releaseRules != "restrictive") && ($slaves[$i].releaseRules != "masturbation")>>
	<<set $averageDick += $slaves[$i].dick, $slavesWithWorkingDicks++>>
<</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 !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;she 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/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;she 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">>
	<<set $Madam = $slaves[$i]>>
	<<if !canTalk($Madam)>>
		''__@@.pink;$Madam.slaveName@@__'' can't give whores verbal orders @@.yellow;and cannot serve as your Madam any more.@@

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

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

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

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

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

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

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

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

		<<set $DJ = 0>>
	<</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;she 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 !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 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;she 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 !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;she 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 $Wardeness.preg > 37 && $Wardeness.broodmother == 2>>
		''__@@.pink;$Wardeness.slaveName@@__'' spends so much time giving birth and laboring that @@.yellow;she 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;she 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 !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;she 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 !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 server 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;she 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 !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 !canWalk($Bodyguard)>>
		''__@@.pink;$Bodyguard.slaveName@@__'' is no longer independently mobile @@.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;she 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 !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.@@ She 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].devotion <= 95>>
<<if $slaves[$i].energy <= 95>>
<<if !$slaves[$i].rivalry>>
<<if !$slaves[$i].fuckdoll>>
<<if $slaves[$i].fetish != "mindbroken">>
	<<set $RapeableIDs.push($slaves[$i].ID)>>
<</if>>
<</if>>
<</if>>
<</if>>
<</if>>

<<if $slaves[$i].bellyPain != 0>>
	<<set $slaves[$i].bellyPain = 0>>
<</if>>
/* preg speed and advance*/

<<if $slaves[$i].preg > 0>>
	<<if $slaves[$i].preg == 1 && $slaves[$i].broodmother == 0>>
		<<run fetalSplit($slaves[$i])>>
	<</if>>
	<<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)>>

	<<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*/

<<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 + 2) && $slaves[$i].physicalAge < 18>>
		<<set $slaves[$i].need = ($slaves[$i].need*2)>>
	<</if>>
	<<if ($slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1) && $slaves[$i].pubertyXX == 1 && $slaves[$i].physicalAge <= ($slaves[$i].pubertyAgeXX + 2) && $slaves[$i].physicalAge < 18>>
		<<set $slaves[$i].need = ($slaves[$i].need*2)>>
	<</if>>
	<<if $slaves[$i].diet == "fertility">>
		<<set $slaves[$i].need += 10>>
	<</if>>
<</if>>
<</if>>

/*
<<if ($slaves[$i].scars == 3)>>
	<<set $slaves[$i].scarheal += 1>>
<</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>>

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

<<if $HeadGirl>>
	<<set _HGPossibleSlaves = [[], [], [], [], [], []]>>
	<<for $i = 0; $i < _SL; $i++>>
		<<set _Slave = $slaves[$i]>>
		<<if _Slave.assignmentVisible == 0 || _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 < -20)>>
			<<set _HGPossibleSlaves[0].push({ID: _Slave.ID, training: "health"})>>
			<<continue>>
		<</if>>

		<<set _hasParaphilia = (["cum addict", "anal addict", "attention whore", "breast growth", "abusive", "malicious", "self hating", "neglectful", "breeder"].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.oralSkill < $HeadGirl.oralSkill)>>
				<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "oral skill"})>>
			<<elseif (_Slave.vaginalSkill < $HeadGirl.vaginalSkill) && (_Slave.vagina > 0) && (canDoVaginal(_Slave))>>
				<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "fuck skill"})>>
			<<elseif (_Slave.analSkill < $HeadGirl.analSkill) && (_Slave.anus > 0) && (canDoAnal(_Slave))>>
				<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "anal skill"})>>
			<<elseif (_Slave.whoreSkill < $HeadGirl.whoreSkill)>>
				<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "whore skill"})>>
			<<elseif (_Slave.entertainSkill < $HeadGirl.entertainSkill) && (_Slave.amp != 1)>>
				<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "entertain skill"})>>
			<</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, $arcadeSlaves, -1, -1],
	["Brothel Report", $brothelNameCaps, $brothel, $brothelSlaves, $Madam, "Madam"],
	["Cellblock Report", $cellblockNameCaps, $cellblock, $cellblockSlaves, $Wardeness, "Wardeness"],
	["Clinic Report", $clinicNameCaps, $clinic, $clinicSlaves, $Nurse, "Nurse"],
	["Club Report", $clubNameCaps, $club, $clubSlaves, $DJ, "DJ"],
	["Dairy Report", $dairyNameCaps, $dairy, $dairySlaves, $Milkmaid, "Milkmaid"],
	["Schoolroom Report", $schoolroomNameCaps, $schoolroom, $schoolroomSlaves, $Schoolteacher, "Schoolteacher"],
	["Spa Report", $spaNameCaps, $spa, $spaSlaves, $Attendant, "Attendant"],
	["Nursery Report", $nurseryNameCaps, $nursery, $nurserySlaves, $Matron, "Matron"],
/** ["Lab Report"], "Research Lab", $researchLab.built, $researchLab.hired + $researchLab.menials, -1, -1], **/
	["Servants' Quarters Report", $servantsQuartersNameCaps, $servantsQuarters, $servantsQuartersSlaves, $Stewardess, "Stewardess"],
	["Incubator Report", $incubatorNameCaps, $incubator, $incubatorSlaves, -1, -1],
	["Master Suite Report", $masterSuiteNameCaps, $masterSuite, $masterSuiteSlaves, $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.built == "true")>>
	<<include "Lab Report">>

<</if>>