code:
:: Slave Summary [nobr]

<<set setup.passagePreFilters = setup.passagePreFilters || {
	"Main":                      s => (s.assignmentVisible == 1),
	"Personal Attention Select": s => (s.assignmentVisible == 1 && s.fuckdoll <= 0),
	"Agent Select":              s => (s.fuckdoll == 0 && s.devotion > 20 && s.intelligence+s.intelligenceImplant > 15 && s.intelligenceImplant >= 15 && canWalk(s) && canSee(s) && canTalk(s) && s.broodmother < 2 && (s.breedingMark != 1 || $propOutcome == 0)),
	"BG Select":                 s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.assignment != "guard you" && canWalk(s) && canSee(s) && (s.breedingMark != 1 || $propOutcome == 0)),
	"Recruiter Select":          s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.assignment != "recruit girls" && canWalk(s) && canSee(s) && canTalk(s)),
	"HG Select":                 s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.assignment != "be your Head Girl" && canWalk(s) && canSee(s) && canTalk(s)),
	"Head Girl Suite":           s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "be your Head Girl" && s.indentureRestrictions <= 0 && (s.breedingMark != 1 || $propOutcome == 0))
		|| ($Flag != 0 && s.assignment == "live with your Head Girl"))),
	"Subordinate Targeting":     s => (s.devotion >= -20 && s.fuckdoll == 0 && $activeSlave.ID != s.ID && ($activeSlave.amp != 1 || s.amp != 1)),
	"Spa":                       s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "rest in the spa")
		|| ($Flag == 1 && s.assignment == "rest in the spa")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Attendant.ID))),
	"Attendant Select":          s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && canWalk(s)),
	"Nursery":                   s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (s.devotion > 20 || s.trust > 20) && (
		   ($Flag == 0 && s.assignment != "work as a nanny")
		|| ($Flag == 1 && s.assignment == "work as a nanny")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Matron.ID))),
	"Matron Select":             s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && canWalk(s)) && s.fetish != "mindbroken",
	"Brothel":                   s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "work in the brothel")
		|| ($Flag == 1 && s.assignment == "work in the brothel")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Madam.ID))),
	"Madam Select":              s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.intelligence+s.intelligenceImplant >= -50 && canWalk(s) && canSee(s) && (s.breedingMark != 1 || $propOutcome == 0)),
	"Club":                      s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "serve in the club")
		|| ($Flag == 1 && s.assignment == "serve in the club")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $DJ.ID))),
	"DJ Select":                 s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.intelligence+s.intelligenceImplant >= -50 && canTalk(s) && canWalk(s) && (s.breedingMark != 1 || $propOutcome == 0)),
	"Clinic":                    s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "get treatment in the clinic")
		|| ($Flag == 1 && s.assignment == "get treatment in the clinic")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Nurse.ID))),
	"Nurse Select":              s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && canWalk(s) && canSee(s)),
	"Schoolroom":                s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && s.fetish != "mindbroken" && (
		   ($Flag == 0 && s.assignment != "learn in the schoolroom")
		|| ($Flag == 1 && s.assignment == "learn in the schoolroom")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Schoolteacher.ID))),
	"Schoolteacher Select":      s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && canTalk(s) && canWalk(s) && canSee(s)),
	"Dairy":                     s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "work in the dairy")
		|| ($Flag == 1 && s.assignment == "work in the dairy")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Milkmaid.ID))),
	"Milkmaid Select":           s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 20 && canWalk(s) && canSee(s)),
	"Farmyard":                  s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && canWalk(s) && (
		   ($Flag == 0 && s.assignment != "work as a farmhand")
		|| ($Flag == 1 && s.assignment == "work as a farmhand")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Farmer.ID))),
	"Farmer Select":             s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && canWalk(s) && canSee(s)),
	"Servants' Quarters":        s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "work as a servant")
		|| ($Flag == 1 && s.assignment == "work as a servant")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Stewardess.ID))),
	"Stewardess Select":         s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.intelligence+s.intelligenceImplant >= -50 && canWalk(s) && canSee(s)),
	"Master Suite":              s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && (
		   ($Flag == 0 && s.assignment != "serve in the master suite")
		|| ($Flag == 1 && s.assignment == "serve in the master suite")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Concubine.ID))),
	"Concubine Select":          s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && s.amp != 1),
	"Cellblock":                 s => (s.assignmentVisible == 1 && s.fuckdoll <= 0 && s.fetish != "mindbroken" && (
		   ($Flag == 0 && s.assignment != "be confined in the cellblock")
		|| ($Flag == 1 && s.assignment == "be confined in the cellblock")
		|| ($Flag != 0 && $Flag != 1 && s.ID == $Wardeness.ID))),
	"Wardeness Select":          s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && s.devotion > 50 && canWalk(s) & canSee(s)),
	"Arcade":                    s => (s.assignmentVisible == 1 && ($arcade >= $arcadeSlaves || $arcadeUpgradeFuckdolls == 1) && (
		   ($Flag == 0 && s.assignment != "be confined in the arcade")
		|| ($Flag != 0 && s.assignment == "be confined in the arcade"))),
	"Pit":                       s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && (
		   ($Flag == 0 && !$fighterIDs.includes(s.ID) && canWalk(s) && (s.assignment != "guard you") && (s.assignment != "work in the dairy" || $dairyRestraintsSetting < 2))
		|| ($Flag != 0 && $fighterIDs.includes(s.ID)))),
	"Coursing Association":      s => (s.assignmentVisible == 1 && s.fuckdoll == 0 && (
		   ($Flag == 0 && canWalk(s) && $Lurcher.ID != s.ID)
		|| ($Flag != 0 && $Lurcher.ID == s.ID))),
	"New Game Plus":             s => (($Flag == 0 && s.assignment != "be imported") || ($Flag != 0 && s.assignment == "be imported")),
	"Rules Slave Select":        s => (($Flag == 0 && !ruleSlaveSelected(s, $currentRule)) || ($Flag != 0 && ruleSlaveSelected(s, $currentRule))),
	"Rules Slave Exclude":       s => (($Flag == 0 && !ruleSlaveExcluded(s, $currentRule)) || ($Flag != 0 && ruleSlaveExcluded(s, $currentRule))),
	"Matchmaking":               s => (s.devotion >= 100 && s.relationship == $activeSlave.relationship && s.ID != $activeSlave.ID),
	"Dinner Party Preperations": s => (s.assignmentVisible == 1 && s.fuckdoll == 0),
}>>
<<set _Pass = passage(), _SL = $slaves.length, $assignTo = _Pass, _indexed = 0,
	_passagePreFilter = (s => s.assignment != "be your agent" && s.assignment != "live with your agent" && (!setup.passagePreFilters.hasOwnProperty(_Pass) || setup.passagePreFilters[_Pass](s))),
	_filteredSlaveIdxs = $slaves.map(function(slave, idx) { return _passagePreFilter(slave) ? idx : null; }).filter(function(idx) { return idx !== null; }),
	_indexSlavesIdxs = $slaves.map(function(slave, idx) { return _passagePreFilter(slave) ? idx : null; }).filter(function(idx) { return idx !== null; })>>
<<for !_.isUndefined(_ssi = _filteredSlaveIdxs.shift())>>
<<set _Slave = $slaves[_ssi]>>
<<set _slaveName = SlaveFullName(_Slave);>>

<<capture _ssi>>

<<if $useSlaveListInPageJSNavigation == 1>>
	<<set _Count = _indexSlavesIdxs.length>>
	/* Useful for finding weird combinations -- usages of this passage that don't yet generate the quick index.
	*   <<print 'pass/count/indexed/flag::[' + _Pass + '/' + _Count + '/' + _indexed + '/' + $Flag + ']'>>
	*/
	<<if ((_Count > 1) && (_indexed == 0) && (((_Pass == 'Main') && (ndef $Flag) && (($useSlaveSummaryTabs == 0) || ($slaveAssignmentTab == "all"))) || ($Flag == 1)))>>
		<<set _indexed = 1, _counter = 0, _buttons = [], _offset = -50>>
		<<if (/Select/i.test(_Pass))>>
				<<set _offset = -25>>
		<</if>>

		<<set _tableCount = _tableCount || 0>>
		<<set _tableCount++>>
		/*
		 *  we want <button data-quick-index="<<= _tableCount>>"> ...
		 */
		<<set _buttonAttributes = { 'data-quick-index': _tableCount }>>
		<<htag _buttonAttributes 'button'>>Quick Index<</htag>>
		/*
		 *  we want
...
		 */
		<<set _divAttributes = { id: 'list_index' + _tableCount, class: 'hidden'}>>
		<<htag _divAttributes>>
			<<for !_.isUndefined(_ssii = _indexSlavesIdxs.shift())>>
				<<set _IndexSlave = $slaves[_ssii]>>
				<<set _indexSlaveName = SlaveFullName(_IndexSlave);>>
				<<set _devotionClass = getSlaveDevotionClass(_IndexSlave);>>
				<<set _trustClass = getSlaveTrustClass(_IndexSlave);>>
				<<set _buttons.push({'data-name': _indexSlaveName, 'data-scroll-to': '#slave-' + _IndexSlave.ID, 'data-scroll-offset': _offset, 'data-devotion': _IndexSlave.devotion, 'data-trust': _IndexSlave.trust, class: _devotionClass + ' ' + _trustClass });>>
			<</for>>
			<<if !_.isUndefined(_buttons[0])>>
				<<set $sortQuickList = $sortQuickList || 'Devotion'>>
				//Sorting:// ''$sortQuickList.''
				<<link "Sort by Devotion">>
					<<set $sortQuickList = 'Devotion'>>
					<<replace "#qlSort">>$sortQuickList<</replace>>
					<>
				<</link>> |
				<<link "Sort by Trust">>
					<<set $sortQuickList = 'Trust'>>
					<<replace "#qlSort">>$sortQuickList<</replace>>
					<>
				<</link>>

					<<for !_.isUndefined(_buttons[0])>>
						<<set _button = _buttons.shift()>>
						<<if !_.isUndefined(_button)>>
							<<set _buttonSlaveName = _button['data-name'];>>
							<<htag _button 'button'>>_buttonSlaveName<</htag>>
						<</if>>
					<</for>>

			<</if>>
		<</htag>>
	<</if>>
<</if>>
<<switch _Pass>>
<<case "Main">>

	<<if $useSlaveSummaryTabs == 1>>
		<<if $slaveAssignmentTab == "overview">>
			<<if $showOneSlave == "Head Girl">>
				<<if (_Slave.assignment != "be your Head Girl")>><<continue>><</if>>
			<<elseif $showOneSlave == "recruit girls">>
				<<if (_Slave.assignment != "recruit girls")>><<continue>><</if>>
			<<elseif $showOneSlave == "guard you">>
				<<if (_Slave.assignment != "guard you")>><<continue>><</if>>
			<</if>>

		<<elseif $slaveAssignmentTab == "resting">>
			<<if _Slave.assignment != "rest">><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "stay confined">>
			<<if (_Slave.assignment != "stay confined")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "take classes">>
			<<if (_Slave.assignment != "take classes")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "please you">>
			<<if (_Slave.assignment != "please you")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "whore">>
			<<if (_Slave.assignment != "whore")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "serve the public">>
			<<if (_Slave.assignment != "serve the public")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "be a servant">>
			<<if (_Slave.assignment != "be a servant")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "be a nanny">>
			<<if (_Slave.assignment != "be a nanny")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "get milked">>
			<<if (_Slave.assignment != "get milked")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "work a glory hole">>
			<<if (_Slave.assignment != "work a glory hole")>><<continue>><</if>>
		<<elseif $slaveAssignmentTab == "be a subordinate slave">>
			<<if (_Slave.assignment != "be a subordinate slave")>><<continue>><</if>>
		<</if>>
	<</if>>

	<<if (_Slave.choosesOwnClothes == 1) && (_Slave.clothes == "choosing her own clothes")>>
		<<set _oldDevotion = _Slave.devotion>>
		<<set _chosenClothes = saChoosesOwnClothes(_Slave)>>
		<<set $slaves[_ssi].devotion = _oldDevotion, _Slave = $slaves[_ssi]>> /* restore devotion value so repeatedly changing clothes isn't an exploit */
	<</if>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	<<if "be your Head Girl" == _Slave.assignment>>''@@.lightcoral;HG@@''
	<<elseif "recruit girls" == _Slave.assignment>>''@@.lightcoral;RC@@''
	<<elseif "guard you" == _Slave.assignment>>''@@.lightcoral;BG@@''
	<</if>>
	<<if Array.isArray($personalAttention) && $personalAttention.findIndex(function(s) { return s.ID == _Slave.ID; }) != -1>>''@@.lightcoral;PA@@''<</if>>
	[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]] /* lists their names */

<<case "Personal Attention Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	<<link _slaveName>>
		<<if !Array.isArray($personalAttention)>> /* first PA target */
			<<set $personalAttention = [{ID: $slaves[_ssi].ID, trainingRegimen: "undecided"}]>>
		<<else>>
			<<set _pai = $personalAttention.findIndex(function(s) { return s.ID == $slaves[_ssi].ID; })>>
			<<if _pai == -1>> /* not already a PA target; add */
				<<set $activeSlave = $slaves[_ssi], $personalAttention.push({ID: $slaves[_ssi].ID, trainingRegimen: "undecided"})>>
			<<else>> /* already a PA target; remove */
				<<set $personalAttention.deleteAt(_pai)>>
				<<if $personalAttention.length == 0>>
					<<set $personalAttention = "sex">>
				<</if>>
			<</if>>
		<</if>>
		<<goto "Personal Attention Select">>
	<</link>>
<<case "Agent Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Agent Workaround][$i = _ssi]]
<<case "BG Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Bodyguard Workaround][$i = _ssi]]
<<case "Recruiter Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Recruiter Workaround][$i = _ssi]]
<<case "HG Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|HG Workaround][$i = _ssi]]
<<case "Head Girl Suite">>
<<if $Flag == 0>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Subordinate Targeting">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Subordinate Targeting][$activeSlave.subTarget = $slaves[_ssi].ID]]
<<case "Spa">>
<<if $Flag == 0>>
	<<if $spa <= $spaSlaves>><<continue>><</if>>
	<<if (_Slave.health < 20) || (_Slave.trust < 60) || (_Slave.devotion <= 60) || (_Slave.fetish == "mindbroken") || _Slave.sexualFlaw !== "none" || _Slave.behavioralFlaw !== "none">>
	<<if _Slave.devotion >= -20 || _Slave.fetish == "mindbroken">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName cannot be trusted in the spa//
		<<continue>>
	<</if>>
	<<else>>

//_Slave.slaveName cannot benefit from the spa//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>
		<<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Attendant Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Attendant Workaround][$i = _ssi]]
<<case "Nursery">>
<<if $Flag == 0>>
	<<if $nurseryNannies <= $nurserySlaves>><<continue>><</if>>
	<<if (_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust <= 20)) || (_Slave.trust < -20)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName must be either more fearful of you or devoted to you//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>
		<<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Matron Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Matron Workaround][$i = _ssi]]
<<case "Brothel">>
<<if $Flag == 0>>
	<<if $brothel <= $brothelSlaves>><<continue>><</if>>
	<<if (_Slave.breedingMark != 1 || $propOutcome == 0)>>
	<<if (_Slave.devotion > 50) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50) || (_Slave.trust > 50)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName must be either more fearful of you or devoted to you//
		<<continue>>
	<</if>>
	<<else>>

//_Slave.slaveName is for private use only//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>
		<<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
                [[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Madam Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Madam Workaround][$i = _ssi]]
<<case "Club">>
<<if $Flag == 0>>
	<<if $club <= $clubSlaves>><<continue>><</if>>
	<<if (_Slave.breedingMark != 1 || $propOutcome == 0)>>
	<<if (_Slave.devotion > 50) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50) || (_Slave.trust > 50)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
 		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName must be either more fearful of you or devoted to you//
		<<continue>>
	<</if>>
	<<else>>

//_Slave.slaveName is for private use only//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "DJ Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|DJ Workaround][$i = _ssi]]
<<case "Clinic">>
<<if $Flag == 0>>
	<<if $clinic <= $clinicSlaves>><<continue>><</if>>
	<<if (_Slave.health < 20) || ($Nurse != 0 && ((_Slave.chem > 15 && $clinicUpgradeFilters == 1) || ($bellyImplants == 1 && _Slave.bellyImplant > -1) || (_Slave.pregKnown == 1 && ($clinicSpeedGestation >= 0 || _Slave.pregControl == "speed up")) || (_Slave.pregAdaptation*1000 < _Slave.bellyPreg || _Slave.preg > 30)))>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName cannot benefit from the clinic//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Nurse Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Nurse Workaround][$i = _ssi]]
<<case "Schoolroom">>
<<if $Flag == 0>>
	<<if $schoolroom <= $schoolroomSlaves>><<continue>><</if>>
	<<if (_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50)>>
		<<if (_Slave.intelligenceImplant < 30) || (_Slave.voice != 0 && _Slave.accent+$schoolroomUpgradeLanguage > 2) || (_Slave.oralSkill <= 10+$schoolroomUpgradeSkills*20) || (_Slave.whoreSkill <= 10+$schoolroomUpgradeSkills*20) || (_Slave.entertainSkill <= 10+$schoolroomUpgradeSkills*20) || (_Slave.analSkill < 10+$schoolroomUpgradeSkills*20) || ((_Slave.vagina >= 0) && (_Slave.vaginalSkill < 10+$schoolroomUpgradeSkills*20))>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
 			[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
		<<else>>

//_Slave.slaveName already has a basic education//
			<<continue>>
		<</if>>
	<<else>>

//_Slave.slaveName is too resistant to learn//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Schoolteacher Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Schoolteacher Workaround][$i = _ssi]]
<<case "Dairy">>
<<if $Flag == 0>>
	<<set _dairySeed = $bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
	<<if _Slave.assignment == "work in the dairy">><<continue>><</if>>
	<<if $dairy <= $dairySlaves+_dairySeed>><<continue>><</if>>
	<<if (_Slave.indentureRestrictions > 0) && ($dairyRestraintsSetting > 1)>>

//_Slave.slaveName's indenture forbids extractive Dairy service.//
		<<continue>>
	<<elseif (_Slave.indentureRestrictions > 1) && ($dairyRestraintsSetting > 0)>>

//_Slave.slaveName's indenture allows only free range milking.//
		<<continue>>
	<<elseif _Slave.breedingMark == 1 && $propOutcome == 1 && $dairyRestraintsSetting > 0>>

//_Slave.slaveName may only be a free range cow//
		<<continue>>
	<<elseif ($dairyPregSetting > 0) && ((_Slave.bellyImplant != -1) || (_Slave.broodmother != 0))>>

//_Slave.slaveName's womb cannot accommodate current machine settings//
		<<continue>>
	<<else>>
		<<if (_Slave.lactation > 0 || (($dairySlimMaintainUpgrade == 0 || $dairySlimMaintain == 0) && (_Slave.boobs > 300 || _Slave.dick == 0 || $dairyImplantsSetting == 1) && $dairyImplantsSetting != 2)) || (_Slave.balls > 0)>>
			<<if (_Slave.devotion > 20) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) ||  (_Slave.trust < -50) || (_Slave.amp == 1) || ($dairyRestraintsUpgrade == 1)>>
				<<if ($dairyStimulatorsSetting < 2) || (_Slave.anus > 2) || ($dairyPrepUpgrade == 1)>>
					<<if ($dairyPregSetting < 2) || (_Slave.vagina > 2) || (_Slave.ovaries == 0) || ($dairyPrepUpgrade == 1)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
						[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
						<<else>>

//_Slave.slaveName's vagina cannot accommodate current machine settings//
							<<continue>>
						<</if>>
					<<else>>

//_Slave.slaveName's anus cannot accommodate current machine settings//
						<<continue>>
				<</if>>
			<<else>>

//_Slave.slaveName must be obedient in order to be milked here//
				<<continue>>
			<</if>>
		<<elseif (($dairySlimMaintainUpgrade == 1 && $dairySlimMaintain == 1) || ($dairyImplantsSetting == 2) || (_Slave.boobs <= 300 && _Slave.dick > 0 && $dairyImplantsSetting == 0))>>

//_Slave.slaveName is not lactating<<if $seeDicks > 0>> or producing semen<</if>>, and <<print $dairyName>>'s current settings forbid the automatic implantation of lactation inducing drugs, so she cannot be a cow//
			<<continue>>
		<<else>>

//_Slave.slaveName is not lactating<<if $seeDicks > 0>> or producing semen<</if>> and cannot be a cow//
			<<continue>>
		<</if>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Milkmaid Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Milkmaid Workaround][$i = _ssi]]
<<case "Farmyard">>		/*THIS WILL NEED TO BE REWORKED - CURRENTLY AN AMALGAMATION OF THE SERVANTS' QUARTERS AND THE DAIRY REQUIREMENTS (but mostly the servant's quarters)*/
<<if $Flag == 0>>
	<<if _Slave.assignment == "work in the farmyard">><<continue>><</if>>
	<<if $farmyard <= $farmyardSlaves>><<continue>><</if>>
	<<if (_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust <= 20)) || (_Slave.trust < -20)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName must be either more fearful of you or devoted to you//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Farmer Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Farmer Workaround][$i = _ssi]]
<<case "Servants' Quarters">>
<<if $Flag == 0>>
	<<if $servantsQuarters <= $servantsQuartersSlaves>><<continue>><</if>>
	<<if (_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust <= 20)) || (_Slave.trust < -20)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName must be either more fearful of you or devoted to you//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Stewardess Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Stewardess Workaround][$i = _ssi]]
<<case "Master Suite">>
<<if $Flag == 0>>
	<<if $masterSuite <= $masterSuiteSlaves>><<continue>><</if>>
	<<if (_Slave.devotion > 20) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName is not sufficiently broken for the master suite//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Concubine Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Concubine Workaround][$i = _ssi]]
<<case "Cellblock">>
<<if _Slave.assignmentVisible != 1>><<continue>><</if>>
<<if $Flag == 0>>
	<<if $cellblock <= $cellblockSlaves>><<continue>><</if>>
	<<if (_Slave.devotion < -20 && _Slave.trust >= -20) || (_Slave.devotion < -50 && _Slave.trust >= -50)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName is sufficiently broken in so that the cellblock would have no effect//
		<<continue>>
	<</if>>
<<elseif $Flag == 1>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Wardeness Select">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Wardeness Workaround][$i = _ssi]]
<<case "Arcade">>
<<if $Flag == 0>>
	<<if _Slave.assignment == "be confined in the arcade">><<continue>><</if>>
	<<if $arcade <= $arcadeSlaves && $arcadeUpgradeFuckdolls != 1>><<continue>><</if>>
	<<if (_Slave.breedingMark != 1 || $propOutcome == 0)>>
	<<if (_Slave.indentureRestrictions <= 0)>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
	<<else>>

//_Slave.slaveName's indenture forbids arcade service.//
		<<continue>>
	<</if>>
	<<else>>

//_Slave.slaveName is for private use only//
		<<continue>>
	<</if>>
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</if>>
<<case "Pit">>
<<if $Flag == 0>>
	<<if (_Slave.indentureRestrictions > 0) && ($pitLethal == 1)>>

//_Slave.slaveName's indenture forbids lethal fights.//
		<<continue>>
	<<elseif (_Slave.indentureRestrictions > 1)>>

//_Slave.slaveName's indenture forbids fighting.//
		<<continue>>
	<<elseif _Slave.breedingMark == 1 && $propOutcome == 1>>

//_Slave.slaveName may not participate in combat//
		<<continue>>
	<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Assign][$i = _ssi]]
	<</if>>
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Retrieve][$i = _ssi]]
<</if>>
<<case "Coursing Association">>
<<if $Flag == 0>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Assign][$i = _ssi]]
<<else>>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
		[[_slaveName|Retrieve][$i = _ssi]]
<</if>>
<<case "New Game Plus">>
<<if $Flag == 0>>

__''@@.pink;_Slave.slaveName@@''__
<<else>>

__''@@.pink;_Slave.slaveName@@''__
<</if>>
<<case "Rules Slave Select">>
<<if $Flag == 0>>

__''
		[[_slaveName|Rules Slave Select Workaround][$activeSlave = $slaves[_ssi]]]''__
<<else>>

__''
		[[_slaveName|Rules Slave Deselect Workaround][$activeSlave = $slaves[_ssi]]]''__
<</if>>
<<case "Rules Slave Exclude">>
<<if $Flag == 0>>

__''
		[[_slaveName|Rules Slave Exclude Workaround][$activeSlave = $slaves[_ssi]]]''__
<<else>>

__''
		[[_slaveName|Rules Slave NoExclude Workaround][$activeSlave = $slaves+_ssi]]]''__
<</if>>
<<case "Matchmaking">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<<case "Dinner Party Preperations">>

<<if $lineSeparations == 0>>
<<else>>
<</if>><<if ($seeImages == 1) && ($seeSummaryImages == 1)>>
<<SlaveArt _Slave 1>>
<</if>>
	[[_slaveName|Slave Interact][$activeSlave = $slaves[_ssi]]]
<</switch>>

<<run SlaveStatClamp(_Slave)>>

<<set _Slave.trust = Math.trunc(_Slave.trust), _Slave.devotion = Math.trunc(_Slave.devotion), _Slave.health = Math.trunc(_Slave.health)>>

<<set $slaves[_ssi] = _Slave>>

will
<<if (_Slave.assignment == "rest") && (_Slave.health >= -20)>>
	''__@@.lawngreen;rest.@@__''
<<elseif (_Slave.assignment == "stay confined") && ((_Slave.devotion > 20) || ((_Slave.trust < -20) && (_Slave.devotion >= -20)) || ((_Slave.trust < -50) && (_Slave.devotion >= -50)))>>
	''__@@.lawngreen;stay confined.@@__''<<if _Slave.sentence > 0>> (_Slave.sentence weeks)<</if>>
<<else>>
	<<if _Slave.choosesOwnAssignment == 1>>choose her own job<<else>>_Slave.assignment<<if _Slave.sentence > 0>> (_Slave.sentence weeks)<</if>><</if>>.
<</if>>

<<if ($displayAssignments == 1) && (_Pass == "Main") && (_Slave.ID != $HeadGirl.ID) && (_Slave.ID != $Recruiter.ID) && (_Slave.ID != $Bodyguard.ID)>>
	<<if _Slave.assignment != "rest">>
		<<link "Rest" "Main">><<= removeJob($slaves[_ssi], $slaves[_ssi].assignment)>><</link>>
	<<else>>
		Rest
	<</if>>
	<<if _Slave.assignment != "please you">>
		| <<link "Fucktoy" "Main">><<= assignJob($slaves[_ssi], "please you")>><</link>>
	<<else>>
		| Fucktoy
	<</if>>
	<<if _Slave.indentureRestrictions <= 0 && (_Slave.breedingMark != 1 || $propOutcome == 0)>>
		<<if _Slave.assignment != "work a glory hole">>
			| <<link "Gloryhole" "Main">><<= assignJob($slaves[_ssi], "work a glory hole")>><</link>>
		<<else>>
			| Hole
		<</if>>
	<</if>>
	<<if _Slave.fuckdoll == 0>> /* NON-FUCKDOLL ASSIGNMENTS */
		<<if (_Slave.assignment != "take classes")>>
			<<if (_Slave.intelligenceImplant < 15) && ((_Slave.devotion >= -20) || ((_Slave.trust < -20) && (_Slave.devotion >= -50)) || (_Slave.trust < -50)) && (_Slave.fetish != "mindbroken")>>
				| <<link "Classes" "Main">><<= assignJob($slaves[_ssi], "take classes")>><</link>>
			<</if>>
		<<else>>
			| Classes
		<</if>>
		<<if (_Slave.assignment != "be a servant")>>
			<<if ((_Slave.devotion >= -20) || ((_Slave.trust < -20) && (_Slave.devotion >= -50)) || (_Slave.trust < -50)) && canWalk(_Slave) && canSee(_Slave)>>
				| <<link "House Servant" "Main">><<= assignJob($slaves[_ssi], "be a servant")>><</link>>
			<</if>>
		<<else>>
			| House Servant
		<</if>>
		<<if (_Slave.assignment != "whore") && (_Slave.breedingMark != 1 || $propOutcome == 0)>>
			| <<link "Whore" "Main">><<= assignJob($slaves[_ssi], "whore")>><</link>>
		<<else>>
			| Whore
		<</if>>
		<<if (_Slave.assignment != "serve the public") && (_Slave.breedingMark != 1 || $propOutcome == 0)>>
			| <<link "Public Servant" "Main">><<= assignJob($slaves[_ssi], "serve the public")>><</link>>
		<<else>>
			| Public Servant
		<</if>>
		<<if (_Slave.lactation > 0) || (_Slave.balls > 0)>>
			<<if (_Slave.assignment != "get milked")>>
				| <<link "Milked" "Main">><<= assignJob($slaves[_ssi], "get milked")>><</link>>
			<<else>>
				| Milked
			<</if>>
		<</if>>
		<<if (_Slave.assignment != "stay confined")>>
			| <<link "Confinement" "Main">><<= assignJob($slaves[_ssi], "stay confined")>><</link>>
		<<else>>
			| Confinement
		<</if>>
		<<if (_Slave.assignment != "choose her own job")>>
			| <<link "Let _Slave.object choose" "Main">><<= assignJob($slaves[_ssi], "choose her own job")>><</link>>
		<<else>>
			| Let _Slave.object choose
		<</if>>
	<</if>> /* CLOSES FUCKDOLL CHECK */
<</if>>

<<set _numFacilities = $brothel+$club+$dairy+$farmyard+$servantsQuarters+$masterSuite+$spa+$clinic+$schoolroom+$cellblock+$arcade+$HGSuite>>

<<if _numFacilities > 0>>

	<<if _Pass == "Main" || _Pass == "Head Girl Suite" || _Pass == "Spa" || _Pass == "Brothel" || _Pass == "Club" || _Pass == "Arcade" || _Pass == "Clinic" || _Pass == "Schoolroom" || _Pass == "Dairy" || _Pass == "Farmyard" || _Pass == "Servants' Quarters" || _Pass == "Master Suite" || _Pass == "Cellblock" >>
	<<set $returnTo=_Pass >>

Transfer to:

	<<if _Slave.assignment != "rest" && _Slave.assignment != "please you" && _Slave.assignment != "take classes" && _Slave.assignment != "be a servant" && _Slave.assignment != "whore" && _Slave.assignment != "serve the public" && _Slave.assignment != "get milked" && _Slave.assignment != "stay confined">>
		<<link "Penthouse" "Main">><<= removeJob($slaves[_ssi], $slaves[_ssi].assignment)>><</link>> |
	<<else>>
		Penthouse |
	<</if>>

	<<if $arcade != 0>>
		<<if $arcade > $arcadeSlaves && (_Slave.indentureRestrictions <= 0) && (_Slave.breedingMark != 1 || $propOutcome == 0)>>
			[[Arcade|Assign][$assignTo = "Arcade", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Arcade<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if _Slave.fuckdoll == 0>> /* NON-FUCKDOLL FACILITIES */

	<<if $clinic != 0>>
		<<if $clinic > $clinicSlaves && (_Slave.health < 20 || ($Nurse != 0 && ((_Slave.chem > 15 && $clinicUpgradeFilters == 1) || ($bellyImplants == 1 && _Slave.bellyImplant > -1) || (_Slave.pregKnown == 1 && ($clinicSpeedGestation >= 0 || _Slave.pregControl == "speed up")) || (_Slave.pregAdaptation*1000 < _Slave.bellyPreg || _Slave.preg > 30))))>>
			[[Clinic|Assign][$assignTo = "Clinic", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Clinic<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $masterSuite != 0>>
		<<if $masterSuite > $masterSuiteSlaves && ((_Slave.devotion > 20) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50))>>
			[[Master Suite|Assign][$assignTo = "Master Suite", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Master Suite<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $cellblock != 0>>
		<<if $cellblock > $cellblockSlaves && ((_Slave.devotion < -20 && _Slave.trust >= -20) || (_Slave.devotion < -50 && _Slave.trust >= -50))>>
			[[Cellblock|Assign][$assignTo = "Cellblock", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Cellblock<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $schoolroom != 0>>
		<<if $schoolroom > $schoolroomSlaves && (_Slave.fetish != "mindbroken" && (_Slave.devotion >= -20 || (_Slave.devotion >= -50 && _Slave.trust < -20) || _Slave.trust < -50) && ((_Slave.intelligenceImplant < 30) || (_Slave.voice != 0 && _Slave.accent+$schoolroomUpgradeLanguage > 2) || (_Slave.oralSkill <= 10+$schoolroomUpgradeSkills*20) || (_Slave.whoreSkill <= 10+$schoolroomUpgradeSkills*20) || (_Slave.entertainSkill <= 10+$schoolroomUpgradeSkills*20) || (_Slave.analSkill < 10+$schoolroomUpgradeSkills*20) || (_Slave.vagina >= 0 && _Slave.vaginalSkill < 10+$schoolroomUpgradeSkills*20)))>>
			[[Schoolroom|Assign][$assignTo = "Schoolroom", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Schoolroom<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $servantsQuarters != 0>>
		<<if $servantsQuarters > $servantsQuartersSlaves && (canWalk(_Slave) && canSee(_Slave) && (_Slave.devotion >= -20 || (_Slave.devotion >= -50 && _Slave.trust <= 20) || _Slave.trust < -20))>>
			[[Servants' Quarters|Assign][$assignTo = "Servants' Quarters", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Servants' Quarters<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $brothel != 0>>
		<<if $brothel > $brothelSlaves && (((_Slave.devotion > 50) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50) || (_Slave.trust > 50)) && (_Slave.breedingMark != 1 || $propOutcome == 0))>>
			[[Brothel|Assign][$assignTo = "Brothel", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Brothel<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $club != 0>>
		<<if $club > $clubSlaves && (((_Slave.devotion > 50) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50) || (_Slave.trust > 50)) && (_Slave.breedingMark != 1 || $propOutcome == 0))>>
			[[Club|Assign][$assignTo = "Club", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Club<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $dairy != 0>>
		<<set _dairySeed = $bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
		<<if $dairy <= $dairySlaves+_dairySeed>>
			Dairy
		<<elseif (((_Slave.indentureRestrictions > 0) && ($dairyRestraintsSetting > 1)) || ((_Slave.indentureRestrictions > 1) && ($dairyRestraintsSetting > 0)) || (_Slave.breedingMark == 1 && $propOutcome == 1 && $dairyRestraintsSetting > 0) || (($dairyPregSetting > 0) && ((_Slave.bellyImplant != -1) || (_Slave.broodmother > 0))))>>
			Dairy
		<<elseif ((_Slave.lactation > 0) || (_Slave.balls > 0)) || (($dairyFeedersUpgrade == 1) && ($dairyFeedersSetting > 0) && ($dairySlimMaintainUpgrade == 0))>>
			 [[Dairy|Assign][$assignTo = "Dairy", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Dairy<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $farmyard != 0>>
		<<if $farmyard > $farmyardSlaves>>	/*the requirement will need to be expanded, but I'm not sure what they should be at the moment*/
			[[Farmyard|Assign][$assignTo = "Farmyard", $i = _ssi]]
		<<else>>Farmyard<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $spa != 0>>
		<<if $spa > $spaSlaves && ((_Slave.devotion >= -20 || _Slave.fetish == "mindbroken") && (_Slave.health < 20 || _Slave.trust <= 60 || _Slave.devotion <= 60 || _Slave.fetish == "mindbroken" || _Slave.sexualFlaw !== "none" || _Slave.behavioralFlaw !== "none"))>>
			[[Spa|Assign][$assignTo = "Spa", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Spa<</if>>
		<<if _numFacilities-- > 1>>|<</if>>
	<</if>>

	<<if $nursery != 0>>
		<<if $nurseryNannies > $nurserySlaves && (_Slave.devotion > 20 || _Slave.trust > 20 || _Slave.fetish == "mindbroken")>>
			[[Nursery|Assign][$assignTo = "Nursery", $i = _ssi]] /* $i = -1 tells Assign to use _Slave as-is */
		<<else>>Nursery<</if>>
	<</if>>

	<</if>> /* Closes transfer options check */

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

<</if>> /* closes _numFacilities */

<<if ((_Pass != 'Main') || (def $Flag) || ($useSlaveSummaryTabs == 0) || ($slaveAssignmentTab == "all"))>>
	<<print ' '>>
<</if>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>

<<run clearSummaryCache()>>
<<= SlaveSummary(_Slave)>>

<<set $slaves[_ssi] = _Slave>>

<<switch _Pass>>
<<case "Main">>
	<<continue>>
<<case "HG Select">>
	<<if setup.HGCareers.includes(_Slave.career) || (_Slave.skillHG >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Head Girl Suite">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		[[Send her to live with your Head Girl|Assign][$i = _ssi]]
	<<else>>
		[[Bring her out of the Head Girl's suite|Retrieve][$i = _ssi]]
		<<break>>
	<</if>>
<<case "Recruiter Select">>
	<<if setup.recruiterCareers.includes(_Slave.career) || (_Slave.skillRC >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "BG Select">>
	<<if setup.bodyguardCareers.includes(_Slave.career) || (_Slave.skillBG >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Spa">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $spaName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Remove $him from $spaName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Attendant|Attendant Select]]
		<<break>>
	<</if>>
<<case "Attendant Select">>
	<<if setup.attendantCareers.includes(_Slave.career) || (_Slave.skillAT >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Nursery">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $nurseryName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Remove $him from $nurseryName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Matron|Matron Select]]
		<<break>>
	<</if>>
<<case "Matron Select">>
	<<if setup.matronCareers.includes(_Slave.career) || (_Slave.skillMT >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Brothel">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $brothelName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Release $him from $brothelName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Madam|Madam Select]]
		<<break>>
	<</if>>
<<case "Madam Select">>
	<<if setup.madamCareers.includes(_Slave.career) || (_Slave.skillMD >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Club">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $clubName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Remove $him from $clubName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove DJ|DJ Select]]
		<<break>>
	<</if>>
<<case "Arcade">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Confine $him in $arcadeName" "Assign">><<set $i = _ssi>><</link>>
	<<else>>
		<<link "Release $him from $arcadeName" "Retrieve">><<set $i = _ssi>><</link>>
	<</if>>
<<case "DJ Select">>
	<<if setup.DJCareers.includes(_Slave.career) || (_Slave.skillDJ >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Clinic">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $clinicUpgradeScanner == 1>>
		@@.cyan;Estimated DNA error value: <<print Math.ceil(_Slave.chem/10)>>@@
	<</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $clinicName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Take $him out of $clinicName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Nurse|Nurse Select]]
		<<break>>
	<</if>>
<<case "Nurse Select">>
	<<if setup.nurseCareers.includes(_Slave.career) || (_Slave.skillNU >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Schoolroom">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Assign $him to $schoolroomName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Release $him from $schoolroomName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Schoolteacher|Schoolteacher Select]]
		<<break>>
	<</if>>
<<case "Schoolteacher Select">>
	<<if setup.schoolteacherCareers.includes(_Slave.career) || (_Slave.skillTE >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Dairy">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $dairyName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Release $him from $dairyName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Milkmaid|Milkmaid Select]]
		<<break>>
	<</if>>
<<case "Milkmaid Select">>
	<<if setup.milkmaidCareers.includes(_Slave.career) || (_Slave.skillMM >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Farmyard">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Send $him to $farmyardName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Release $him from $farmyardName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Farmer|Farmer Select]]
		<<break>>
	<</if>>
<<case "Farmer Select">>
	<<if setup.farmerCareers.includes(_Slave.career) || (_Slave.skillFA >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Servants' Quarters">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Assign $him to $servantsQuartersName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Release $him from $servantsQuartersName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Stewardess|Stewardess Select]]
		<<break>>
	<</if>>
<<case "Stewardess Select">>
	<<if setup.stewardessCareers.includes(_Slave.career) || (_Slave.skillST >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "Master Suite">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Add $him to $masterSuiteName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Send $him out of $masterSuiteName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Concubine|Concubine Select]]
		<<break>>
	<</if>>
<<case "Cellblock">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag == 0>>
		<<link "Confine $him in $cellblockName" "Assign">><<set $i = _ssi>><</link>>
	<<elseif $Flag == 1>>
		<<link "Release $him from $cellblockName" "Retrieve">><<set $i = _ssi>><</link>>
	<<else>>
		[[Change or remove Wardeness|Wardeness Select]]
		<<break>>
	<</if>>
<<case "Wardeness Select">>
	<<if setup.wardenessCareers.includes(_Slave.career) || (_Slave.skillWA >= $masteredXP)>>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>@@.lime;Has applicable career experience.@@
	<</if>>
<<case "New Game Plus">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	<<if $Flag === 0>>
	<<link "Add to import list" "New Game Plus">>
		<<set $slavesToImport += 1,$Flag = 1>>
		<<= assignJob($slaves[_ssi], "be imported")>>
	<</link>>
<<else>>
	<<link "Remove from import list" "New Game Plus">>
		<<set $slavesToImport -= 1,$Flag = 0>>
		<<= removeJob($slaves[_ssi], $slaves[_ssi].assignment)>>
	<</link>>
<</if>>
<<case "Matchmaking">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	[[Match them|Matchmaking][$subSlave = $slaves[_ssi]]]
<<case "Dinner Party Preperations">>

<<if $seeImages != 1 || $seeSummaryImages != 1 || $imageChoice == 1>>    <</if>>
	[[Make her the main course|Dinner Party Execution][$activeSlave = $slaves[_ssi]]]
<</switch>>

<</capture>>

<</for>>
<<set $activeSlave = 0, _Slave = 0>>


code:
:: Spa [nobr]

<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Spa", $showEncyclopedia = 1, $encyclopedia = "Spa", $spaSlaves = $SpaiIDs.length>>

<<if $spaName != "the Spa">>
	<<set $spaNameCaps = $spaName.replace("the ", "The ")>>
<</if>>
<<spaAssignmentFilter>>
$spaNameCaps
<<switch $spaDecoration>>
<<case "Roman Revivalist">>
	is built as a Roman bath. The flooring is pleasantly warm due to a modernized version of hypocaust heating, and is covered in mosaic depicting slaves enjoying sex.
<<case "Aztec Revivalist">>
	is built as an Aztec bathhouse. Water steams from the middle of the room and the air is heavy with the scent of herbs and essences. The idols by the door glisten with moisture.
<<case "Egyptian Revivalist">>
	is decorated like an Egyptian water garden. All but the hottest pools include aquatic plants around their edges, and the atmosphere is heavy with perfume.
<<case "Edo Revivalist">>
	is decorated like a traditional onsen. The stone-lined pools are surrounded by meticulously kept gardens, and there are proper provisions for bathing in the old Japanese style.
<<case "Arabian Revivalist">>
	looks like a dream of an Arabian palace garden. Every surface is richly tiled in vibrant colors, and the beguiling scents of perfumes from the Levant hang in the air.
<<case "Chinese Revivalist">>
	is gloomy and hot, filled with an oppressive steam that immediately dulls the senses. Though relaxation is possible and indeed easy here, it is a stultifying relaxation whose humid warmth seems to suppress independence.
<<case "Chattel Religionist">>
	is dedicated to the purification of the body and the spirit. The pools are arranged for the completion of self-purification procedures which include ritual masturbation.
<<case "Degradationist">>
	is utilitarian. There are waterproof cameras positioned throughout the spa so that anyone who wants to can watch the nude slaves. One wall has a screen showing the current viewer count to keep the slaves aware of this.
<<case "Asset Expansionist">>
	is utilitarian. It is equipped with all sorts of devices to help slaves care for huge assets, including lifts to help them in and out of the water, and all around showers to help clean and moisturize difficult to reach spots.
<<case "Transformation Fetishist">>
	is utilitarian. It is equipped with special devices to help speed surgical recovery, including a series of baths designed to prevent scarring.
<<case "Repopulation Focus">>
	is comfortable, with waterproof cushions lining the pools. It is equipped with all sorts of devices to aid pregnant slaves, including lifts to help them in and out of the water, baths just for their feet, and all around showers to help clean and moisturize difficult to reach spots.
<<case "Eugenics">>
	is comfortable, albeit split in half. One side for the lower classes' slaves, and the other for the elite and their pets.
<<case "Gender Radicalist">>
	is comfortable, with waterproof cushions lining the pools. There are screens on the walls showing slave girls with all different varieties of genitalia orgasming from penetration, to keep the idea at the forefront of the slaves' minds.
<<case "Gender Fundamentalist">>
	is comfortable, with waterproof cushions lining the pools. There are screens on the walls showing light entertainment featuring a lot of beautiful women and handsome men for the slaves' edification.
<<case "Physical Idealist">>
	is not the gym, but it does have some workout equipment, mostly low-impact machines designed to speed recovery. There are special hot baths to ease sore muscles.
<<case "Supremacist">>
	is comfortable, with waterproof cushions lining the pools. There are screens on the walls showing light entertainment featuring $arcologies[0].FSSupremacistRace main characters.
<<case "Subjugationist">>
	is comfortable, with waterproof cushions lining the pools. There are screens on the walls showing light entertainment featuring $arcologies[0].FSSubjugationistRace characters in comic relief roles.
<<case "Paternalist">>
	is comfortable, with waterproof cushions lining the pools. There are screens on the walls showing light entertainment written by and intended for smart, loyal slaves.
<<case "Pastoralist">>
	is utilitarian. It is equipped with all sorts of devices to help slaves care for huge assets, including lifts to help them in and out of the water, and all around showers to help clean and moisturize difficult to reach spots.
<<case "Maturity Preferentialist">>
	is comfortable, but surprisingly businesslike. It's all about beautification here; there's a bewildering array of mud baths, resting pools, and massage setups, all designed to keep mature slaves looking their very best.
<<case "Youth Preferentialist">>
	is comfortable and fun. There are hot tubs and massage tables for slaves who feel like relaxing, but there's also a colder pool with pool toys for girls who want to play. It even has a small waterslide.
<<case "Body Purist">>
	is comfortable, with waterproof cushions lining the pools. Everything is designed for the slaves' comfort; there are even special mud baths to perfect skin clarity.
<<case "Slimness Enthusiast">>
	is comfortable, with waterproof cushions lining the pools. Everything is designed for the slaves' comfort; there are even special mud baths to perfect skin clarity.
<<case "Hedonistic">>
	is comfortable, with waterproof cushions lining the pools. It is equipped with all sorts of devices to aid hefty slaves, including lifts to help them in and out of the water, specialized moisturizers to keep their skin healthy and smooth, and all around showers to help clean difficult to reach spots and between folds. <<if $arcologies[0].FSHedonisticDecadenceResearch == 1>>Platters of food and treats are readily available around the tubs so that relaxing slaves never have to strain to grab a bite to eat<<else>>Feeders connected to the slave food reserves line the pools so that  so that relaxing slaves never have to strain to suck down their fill of food<</if>>.
<<default>>
	is well-appointed, with massage tables, hot tubs, and a cold pool.
<</switch>>

<<if $spaSlaves > 3>>
	It's busy in here. Slaves are relaxing in the warm water, splashing around or just floating. Here and there some of the more sex-starved are in the early stages of intercourse, but most prefer to take time off from it all.
<<elseif $spaSlaves > 0>>
	It's sparsely populated; though the few slaves here have little company they like having the water to themselves.
<<elseif $Attendant != 0>>
	$Attendant.slaveName is alone here, and has nothing to do but keep the place (and her own soft, wet body) spotlessly clean.
<<else>>
	It's empty and quiet. [[Decommission the Spa|Main][$spa = 0, $spaDecoration = "standard", $spaUpgrade = 0, $spaFix = 0]]
<</if>>

<<if $spaSlaves > 0>>
	<<if $Attendant != 0>><<set _X = 1>><<else>><<set _X = 0>><</if>>
	<<set _NewPop = $spaSlaves+$dormitoryPopulation+_X>>
	<<link "Remove all slaves" "Spa">>
		<<if $Attendant != 0>>
			<<= assignJob($Attendant, "rest")>>
		<</if>>
		<<for $spaSlaves > 0>>
			<<= assignJob($slaves[$slaveIndices[$SpaiIDs[0]]], "rest")>>
		<</for>>
	<</link>>
	<<if _NewPop > $dormitory>>
		@@.red;Dormitory capacity will be exceeded.@@
	<</if>>
<</if>>

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

$spaNameCaps can house $spa slaves while they recuperate here. Currently $spaSlaves <<if $spaSlaves == 1>>is<<else>>are<</if>> recuperating.
[[Expand the spa|Spa][$cash -= _Tmult0, $spa += 5]] //Costs <<print cashFormat(_Tmult0)>>//

<<if $spaUpgrade == 1>>
	$spaNameCaps has been upgraded with state of the art temperature treatment options, from hot and cold mineral water pools to baking saunas and dense steam rooms.
<<else>>
	<<set _Tmult1 = Math.trunc($spa*1000*$upgradeMultiplierArcology)>>
	$spaNameCaps is a standard spa. [[Upgrade the spa with saunas, steam rooms, and mineral water baths|Spa][$cash -= _Tmult1, $spaUpgrade = 1]] //Costs <<print cashFormat(_Tmult1)>>//
<</if>>

<<if $Attendant != 0>>

<<if $spaFix == 2>>
	$Attendant.slaveName is focusing only on the health and wellness of the slaves under her care, obeying your orders to avoid attempting to right mental flaws.
	[[Order her to only fix mindbroken slaves|Spa][$spaFix = 1]] |
	[[Let her tend as she sees fit|Spa][$spaFix = 0]]
<<elseif $spaFix == 1>>
	$Attendant.slaveName is focusing on the health and wellness of the slaves under her care, as well as trying to bring mindbroken slaves back, while ignoring any mental hangups a slave may have.
	[[Order her to not fix flaws|Spa][$spaFix = 2]] |
	[[Let her tend as she sees fit|Spa][$spaFix = 0]]
<<else>>
	$Attendant.slaveName is not following any special orders and is tending to your slaves as she sees fit.
	[[Order her to not fix any flaws|Spa][$spaFix = 2]] |
	[[Order her to only fix mindbroken slaves|Spa][$spaFix = 1]]
<</if>>
<</if>>

<<if $Attendant != 0>>
	<<set $Flag = 2>>
	<<include "Slave Summary">>
<<else>>
	You do not have a slave serving as a spa Attendant. [[Appoint one|Attendant Select]]
<</if>>

<<if ($spa <= $spaSlaves)>>
	''$spaNameCaps is full and cannot hold any more slaves''
<<elseif ($slaves.length > $spaSlaves)>>
	<<link "''Let an obedient slave rest in $spaName''">>
		<<replace #ComingGoing>>
			<<resetAssignmentFilter>>
			<<set $Flag = 0>>
			<<include "Slave Summary">>
		<</replace>>
	<</link>>
<</if>>

<<if $spaSlaves > 0>>
	 | <<link "''Prise a slave out of $spaName''">>
		<<replace #ComingGoing>>
			<<spaAssignmentFilter>>
			<<set $Flag = 1>>
			<<include "Slave Summary">>
			<<resetAssignmentFilter>>
		<</replace>>
	<</link>>
<<else>>

//$spaNameCaps is empty at the moment.
//
<</if>>

	<<spaAssignmentFilter>>
	<<set $Flag = 1>>
	<<include "Slave Summary">>
	<<resetAssignmentFilter>>

Rename $spaName: <<textbox "$spaName" $spaName "Spa">> //Use a noun or similar short phrase//

repo_name: nook/fc


code:
:: Spa Report [nobr]

<<SlaveSort $SpaiIDs>>
<<set _DL = $SpaiIDs.length, $spaSlaves = _DL, _SL = $slaves.length, _bonusToggle = 0, _healthBonus = 0, _idleBonus = 0, _restedSlaves = 0, _trustBonus = 0>>

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

<<if $Attendant != 0>>
	<<set _FLs = $slaveIndices[$Attendant.ID]>>

	<<if ($slaves[_FLs].health < 100)>>
		<<set $slaves[_FLs].health += 20>>
	<</if>>
	<<if ($slaves[_FLs].devotion <= 60)>>
		<<set $slaves[_FLs].devotion++>>
	<</if>>
	<<if $slaves[_FLs].trust < 60>>
		<<set $slaves[_FLs].trust++>>
	<</if>>
	<<if $slaves[_FLs].livingRules != "luxurious">>
		<<set $slaves[_FLs].livingRules = "luxurious">>
	<</if>>
	<<set _FLsFetish = 0>>
	<<if $slaves[_FLs].fetishStrength <= 95>>
		<<if $slaves[_FLs].fetish != "submissive">>
			<<if fetishChangeChance($slaves[_FLs]) > random(0,100)>>
				<<set _FLsFetish = 1, $slaves[_FLs].fetishKnown = 1, $slaves[_FLs].fetish = "submissive">>
			<</if>>
		<<elseif $slaves[_FLs].fetishKnown == 0>>
			<<set _FLsFetish = 1, $slaves[_FLs].fetishKnown = 1>>
		<<else>>
			<<set _FLsFetish = 2, $slaves[_FLs].fetishStrength += 4>>
		<</if>>
	<</if>>
	<<if ($Attendant.fetish == "none") || ($Attendant.fetish == "submissive")>>
		<<set _devBonus++>>
	<</if>>
	<<set $slaves[_FLs].devotion += _devBonus, $Attendant = $slaves[_FLs]>>
	    <<= SlaveFullName($Attendant)>> is serving as the spa attendant.<<if $Attendant.relationship == -3 && $Attendant.devotion > 50>> She tries her best to be your perfect attentive, caring and loving wife.<</if>>
	<<if (_FLsFetish == 1)>>
		When she is paid a visit by a slave with sexual issues to work out, she provides her with an understanding, willing, giving partner. She finds real satisfaction in helping your slaves find sexual gratification, and @@.lightsalmon;becomes a submissive.@@
	<<elseif (_FLsFetish == 2)>>
		Every new slave in the spa is a new girl she gets to connect with and serve. Sexually. @@.lightsalmon;She becomes more submissive.@@
	<</if>>
	<<if setup.attendantCareers.includes($Attendant.career)>>
		She has experience with counseling from her life before she was a slave, making her better at building rapport with troubled slaves, and giving her a better chance of softening flaws into beneficial quirks.
		<<set _bonusToggle = 1, _idleBonus++>>
	<<elseif $Attendant.skillAT >= $masteredXP>>
		She has experience with counseling from working for you, making her better at building rapport with troubled slaves, and giving her a better chance of softening flaws into beneficial quirks.
		<<set _bonusToggle = 1, _idleBonus++>>
	<<else>>
		<<set $slaves[_FLs].skillAT += random(1,Math.ceil(($Attendant.intelligence+$Attendant.intelligenceImplant)/15) + 8)>>
	<</if>>
	<<if ($Attendant.eyes == -2)>>
		Her blindness allows her to deeply connect with her girls.
		<<set _idleBonus++>>
	<</if>>
	<<if ($Attendant.fetish == "none")>>
		$Attendant.slaveName respects the slaves lounging in the spa, allowing them to relax completely.
		<<set _idleBonus++>>
	<<elseif ($Attendant.fetish == "submissive")>>
		$Attendant.slaveName lets the slaves resting in the spa take the lead sexually, doing her best to please them.
		<<set _idleBonus++>>
	<<elseif ($Attendant.fetishKnown == 1)>>
		$Attendant.slaveName can't keep her hands to herself, preventing the slaves in the spa from relaxing completely.
	<</if>>
	<<if ($Attendant.visualAge > 35)>>
		Her apparent maturity encourages the slaves in the spa to relax and pour out their troubles to her.
		<<set _healthBonus++, _idleBonus++>>
	<</if>>
	<<if ($Attendant.intelligence+$Attendant.intelligenceImplant > 15)>>
		She's so intelligent she can suss out the cause of slaves' emotional issues and counsel them effectively.
		<<set _idleBonus++>>
	<</if>>
	<<if isFertile($Attendant) || ($Attendant.bellyPreg >= 1500) || ($Attendant.birthsTotal > 0) || ($Attendant.bellyImplant >= 1500)>>
		She has a natural mothering instinct and really makes her girls feel at home.
		<<set _idleBonus++, _healthBonus++>>
	<</if>>
	<<set _attendantUsedCure = 0>>
	<<for _dI = 0; _dI < _DL; _dI++>>
		<<set $i = $slaveIndices[$SpaiIDs[_dI]]>>
		<<if ($slaves[$i].fetish == "mindbroken") && ($slaves[$i].health > 20) && (_attendantUsedCure == 0) && ($spaFix != 2)>>
			<<set _attendantUsedCure = 1>>
			<<if (random(1,100) > 90-$Attendant.devotion)>>

    @@.green;Something almost miraculous has happened.@@ $Attendant.slaveName has always refused to believe that $slaves[$i].slaveName could not be reached, and has lavished patient tenderness on her in $spaName. $slaves[$i].slaveName has begun to respond, and is stirring from her mental torpor.
				<<set $slaves[$i].devotion = -3, $slaves[$i].sexualFlaw = "apathetic", $slaves[$i].behavioralFlaw = either("hates men", "odd"), $slaves[$i].fetish = "none", $slaves[$i].fetishKnown = 1>>
				<<set _spr = $genePool.findIndex(function(s) { return s.ID == $slaves[$i].ID; })>>
				<<if $genePool[_spr].intelligence >= -95>>
					<<set $slaves[$i].intelligence = $genePool[_spr].intelligence-30>>
				<</if>>
				<<if ($arcologies[0].FSPaternalist > 0)>>
					Society @@.green;strongly approves@@ of $slaves[$i].slaveName being restored to sanity, which advances ideals about enlightened slave ownership.
					<<set $repGain += 2*$FSSingleSlaveRep*($arcologies[0].FSPaternalist/$FSLockinLevel), $arcologies[0].FSPaternalist += 0.01*$FSSingleSlaveRep>>
				<</if>>
			<</if>>
		<</if>>
		<<set _seed = _bonusToggle * 10>>
		<<if _bonusToggle == 1 && $slaves[$i].trust < 60>>
			<<set $slaves[$i].trust++>>
		<</if>>
		<<if $Attendant.rivalryTarget == $slaves[$i].ID>>
			She constantly harasses her <<print rivalryTerm($Stewardess)>>, $slaves[$i].slaveName, preventing her from getting comfortable and forcing her to keep her guard up.
			<<set $slaves[$i].devotion -= 4, $slaves[$i].trust -= 4>>
			<<if random(1,100) > 35>>
				<<set $Attendant.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
			<</if>>
		<<elseif $Attendant.relationshipTarget == $slaves[$i].ID>>
			She dedicates most of her attention to her <<print relationshipTerm($Attendant)>>, $slaves[$i].slaveName, making her stress, both physical and mental, wash away.
			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
		<<elseif $familyTesting == 1 && areRelated($Attendant, $slaves[$i]) > 0>>
			She makes sure to spend extra time caring for her <<print relativeTerm($Attendant.ID,$slaves[$i].ID)>>, $slaves[$i].slaveName.
			<<set $slaves[$i].trust++, $slaves[$i].health++>>
		<<elseif $Attendant.relationTarget == $slaves[$i].ID && $familyTesting == 0>>
			She makes sure to spend extra time caring for her $slaves[$i].relation, $slaves[$i].slaveName.
			<<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 relax the famous whore, $slaves[$i].slaveName, making sure to
			<<if $slaves[$i].vagina > 2 || $slaves[$i].anus > 2>>
				pay special attention to her worn holes.
			<<else>>
				get her clean and relaxed for her next usage.
			<</if>>
			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
		<<case "She is a famed Free Cities slut, and can please anyone.">>
			She does her best to soothe the famous entertainer, $slaves[$i].slaveName, letting her relax in blissful peace.
			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
		<<case "She is remembered for winning best in show as a cockmilker.">>
			<<if ($slaves[$i].balls > 6) && ($slaves[$i].dick != 0)>>
				<<if $Attendant.fetish == "cumslut">>
					She can't keep her hands off $slaves[$i].slaveName's cock and balls, but she doesn't mind being milked constantly. Before long, strands of cum can be found floating all throughout the bath.
					<<set $Attendant.fetishStrength += 4, $slaves[_FLs].fetishStrength += 4>>
				<<else>>
					She does her best to accommodate $slaves[$i].slaveName's massive genitals and tends to her whenever she feels a need for release.
					<<if random(1,100) > 65 && $Attendant.fetish == "none">>
						After taking several massive loads to the face, $Attendant.slaveName begins to find satisfaction in being coated in cum.
						<<set $Attendant.fetish = "cumslut", $slaves[_FLs].fetish = "cumslut">>
					<</if>>
				<</if>>
			<</if>>
			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
		<<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)>>
				<<if $Attendant.fetish == "boobs">>
					She can't keep her hands off $slaves[$i].slaveName's huge breasts, but she doesn't mind being milked constantly. Before long the bath gains a white tint.
					<<set $Attendant.fetishStrength += 4, $slaves[_FLs].fetishStrength += 4>>
				<<else>>
					She does her best to accommodate $slaves[$i].slaveName's massive breasts and tends to her whenever she feels a need for release.
					<<if random(1,100) > 65 && $Attendant.fetish == "none">>
						After multiple milking sessions, $Attendant.slaveName begins to find herself fantasizing about having giant milky breasts too.
						<<set $Attendant.fetish = "boobs", $slaves[_FLs].fetish = "boobs">>
					<</if>>
				<</if>>
				<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
			<</if>>
		<<case "She is remembered for winning best in show as a breeder.">>
			<<if $slaves[$i].bellyPreg >= 5000>>
				<<if $Attendant.fetish == "pregnancy">>
				She can't keep her hands off $slaves[$i].slaveName's pregnancy, but she doesn't mind her full belly being fondled.
				<<set $Attendant.fetishStrength += 4, $slaves[_FLs].fetishStrength += 4>>
				<<else>>
					She does her best to accommodate $slaves[$i].slaveName's pregnancy and to make sure the mother-to-be is happy and comfortable.
					<<if random(1,100) > 65 && $Attendant.fetish == "none">>
						After massaging $slaves[$i].slaveName's growing belly multiple times, $Attendant.slaveName begins to find herself fantasizing about being swollen with life too.
						<<set $Attendant.fetish = "pregnancy", $slaves[_FLs].fetish = "pregnancy">>
					<</if>>
				<</if>>
				<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
			<<else>>
				<<if $Attendant.fetish == "pregnancy">>
					She can't help but pester $slaves[$i].slaveName with questions about her famous pregnancy, limiting her ability to truly relax.
					<<set $slaves[$i].devotion += 1, $slaves[$i].trust += 1>>
				<<elseif canGetPregnant($slaves[$i])>>
					She does her best to encourage $slaves[$i].slaveName's fertilization by performing any fertility boosting actions she can.
					<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
				<</if>>
			<</if>>
		<</switch>>
		<<if ($Attendant.intelligence+$Attendant.intelligenceImplant > 15) && (_attendantUsedCure == 0) && (($Attendant.intelligence+$Attendant.intelligenceImplant)+_seed) > random(1,200) && ($spaFix == 0)>>
			<<if $slaves[$i].behavioralFlaw != "none">>
				<<run SoftenBehavioralFlaw($slaves[$i])>>
				<<set _attendantUsedCure += 1>>

    $Attendant.slaveName works carefully with $slaves[$i].slaveName, and successfully @@.green;softens her behavioral flaw@@ into an appealing quirk.
			<<elseif $slaves[$i].sexualFlaw != "none">>
				<<run SoftenSexualFlaw($slaves[$i])>>
				<<set _attendantUsedCure += 1>>

    $Attendant.slaveName works carefully with $slaves[$i].slaveName, and successfully @@.green;softens her sexual flaw@@ into an appealing quirk.
			<</if>>
		<</if>>
	<</for>>
	<<if (_DL < $spa)>>
		<<set _seed = random(1,10)+(($spa-_DL)*(random(150,170)+(_idleBonus*10)))>>
		<<set $cash += _seed>>

    Since she doesn't have enough girls to occupy all her time, the spa takes in citizens' slaves on a contract basis and she helps them too, earning @@.yellowgreen;<<print cashFormat(_seed)>>.@@
		<<if ($arcologies[0].FSHedonisticDecadence > 0) && (_DL == 0)>>
			Society @@.green;loves@@ being allowed to lounge in your spa, greatly advancing your laid back culture.
			<<= FSChange("Hedonism", 2)>>
		<</if>>
	<</if>>
	<<if (_DL > 0)>>

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

<<if (_DL > 0)>>
	    ''<<if (_DL > 1)>>There are _DL slaves<<else>>There is one slave<</if>> resting and recuperating in the spa.''
	<<if ($arcologies[0].FSHedonisticDecadence > 0) && (_DL == 0)>>
		Society @@.green;approves@@ of your slaves being pampered this way, greatly advancing your laid back culture.
		<<= FSChange("Hedonism", 1)>>
	<</if>>
<</if>>

<<if $Attendant != 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[$i])>>@@__'' is serving as the Attendant in $spaName.

		<<= 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 $Attendant = $slaves[_FLs]>>
<</if>>

<<for _dI = 0; _dI < _DL; _dI++>>
	<<set $i = $slaveIndices[$SpaiIDs[_dI]]>>
	<<set $slaves[$i].devotion += _devBonus, $slaves[$i].trust += _trustBonus, $slaves[$i].health += _healthBonus>>
	<<if ($slaves[$i].devotion < 60) && ($slaves[$i].trust < 60)>>
		<<set $slaves[$i].devotion++, $slaves[$i].trust++>>
	<<elseif ($slaves[$i].trust < 40)>>
		<<set $slaves[$i].trust += 10>>
	<<elseif ($slaves[$i].devotion < 40)>>
		<<set $slaves[$i].devotion += 10>>
	<</if>>
	<<if ($spaUpgrade == 1) && ($slaves[$i].health < 20)>>
		<<set $slaves[$i].health += 3>>
	<</if>>
	<<switch $spaDecoration>>
	<<case "Chattel Religionist" "Chinese Revivalist">>
		<<set $slaves[$i].livingRules = "normal">>
	<<case "Degradationist">>
		<<set $slaves[$i].livingRules = "spare">>
	<<default>>
		<<set $slaves[$i].livingRules = "luxurious">>
	<</switch>>
	<<if ($slaves[$i].health >= 20) && ($slaves[$i].trust > 60) && ($slaves[$i].devotion > 60) && ($slaves[$i].fetish != "mindbroken") && ($slaves[$i].sexualFlaw == "none") && ($slaves[$i].behavioralFlaw == "none")>>

''__@@.pink;$slaves[$i].slaveName@@__'' is feeling well enough to leave $spaName, so @@.yellow;her assignment has defaulted to rest@@.
		<<= removeJob($slaves[$i], "rest in the spa")>>
		<<set _restedSlaves++, _DL--, _dI-->>
		<<continue>>
	<</if>>
	<<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 resting in $spaName.
		<</if>>

    She <<= saRest($slaves[$i])>>

		<<= 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">>
		<<set _chosenClothes = saChoosesOwnClothes($slaves[$i])>>
		<<set _dump = saRest($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 (_restedSlaves > 0)>>

	<<if (_restedSlaves == 1)>>
		One slave has rested until she reached a state of @@.hotpink;devotion@@ and @@.mediumaquamarine;trust@@ and will leave the spa before the end of the week.
	<<else>>
		_restedSlaves slaves have rested until they reached a state of @@.hotpink;devotion@@ and @@.mediumaquamarine;trust@@ and will leave the spa before the end of the week.
	<</if>>
	<<if $spaDecoration != "standard">>

    $spaNameCaps's $spaDecoration atmosphere @@.hotpink;had an impact on <<if _restedSlaves == 1>>her while she was<<else>>them while they were<</if>>@@ resting.
	<</if>>
<</if>>
<<if _DL > 0 || $Attendant != 0>>

<</if>>


code:
:: Special Slave [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $showEncyclopedia = 1, $encyclopedia = "Direct Sales">>

<<if $heroSlaves.length == 0>>
	Unfortunately, the catalog is empty.
<<else>>

	You review a piece of merchandise via video call, making a few lewd demands to gauge her obedience. The background of the video feed is luxurious and plush; somewhere offscreen someone is moaning rapturously.

	<<run slaveSortMinor($heroSlaves)>>
	<<set $activeSlave = getHeroSlave($heroSlaves.random(), $baseHeroSlave)>>
	<<set $activeSlave.weekAcquired = $week>>
	<<if ndef $activeSlave.pubicHColor>>
		<<set $activeSlave.pubicHColor = $activeSlave.hColor>>
	<</if>>
	<<if ndef $activeSlave.underArmHColor>>
		<<set $activeSlave.underArmHColor = $activeSlave.hColor>>
	<</if>>

	<<if ($activeSlave.override_Eye_Color != 1)>>
		<<switch ($activeSlave.eyeColor)>>
			<<case "blind blue">>
				<<set $activeSlave.origEye = "deep blue">>
			<<case "milky white" "implant">>
				<<set $activeSlave.origEye = random("blue", "green", "brown", "hazel", "light blue", "light green", "dark green", "dark blue")>>
			<<default>>
				<<set $activeSlave.origEye = $activeSlave.eyeColor>>
		<</switch>>
	<</if>>
	<<if ($activeSlave.override_Race != 1)>>
		<<set $activeSlave.origRace = $activeSlave.race>>
	<</if>>
	<<if ($activeSlave.override_H_Color != 1)>>
		<<set $activeSlave.origHColor = $activeSlave.hColor>>
	<</if>>
	<<if ($activeSlave.override_Arm_H_Color != 1)>>
		<<set $activeSlave.underArmHColor = $activeSlave.hColor>>
	<</if>>
	<<if ($activeSlave.override_Pubic_H_Color != 1)>>
		<<set $activeSlave.pubicHColor = $activeSlave.hColor>>
	<</if>>
	<<if ($activeSlave.override_Brow_H_Color != 1)>>
		<<set $activeSlave.eyebrowHColor = $activeSlave.hColor>>
	<</if>>
	<<if ($activeSlave.override_Skin != 1)>>
		<<set $activeSlave.origSkin = $activeSlave.skin>>
	<</if>>

	<<run SetBellySize($activeSlave)>>
	<<if $familyTesting == 1>>
		/* special slaves exceptions to keep siblings sensible */
		<<if $activeSlave.mother == -9999 && $activeSlave.father == -9998>> /* The twins - Camille & Kennerly */
			<<for _k = 0; _k < $slaves.length; _k++>>
				<<if areSisters($slaves[_k], $activeSlave) > 0>>
					<<set $activeSlave.actualAge = $slaves[_k].actualAge, $activeSlave.physicalAge = $activeSlave.actualAge, $activeSlave.visualAge = $activeSlave.actualAge, $activeSlave.ovaryAge = $activeSlave.actualAge, $activeSlave.birthWeek = $slaves[_k].birthWeek>>
				<</if>>
			<</for>>
		<</if>>
		<<if $activeSlave.mother == -9997 && $activeSlave.father == -9996>> /* The siblings - Elisa & Martin */
			<<for _k = 0; _k < $slaves.length; _k++>>
				<<if areSisters($slaves[_k], $activeSlave) > 0>>
					<<if $activeSlave.birthName == "Elisa">>
						<<set $activeSlave.actualAge = $slaves[_k].actualAge-1, $activeSlave.physicalAge = $activeSlave.actualAge, $activeSlave.visualAge = $activeSlave.actualAge, $activeSlave.ovaryAge = $activeSlave.actualAge>>
					<<elseif $activeSlave.birthName == "Martin">>
						<<set $activeSlave.actualAge = $slaves[_k].actualAge+1, $activeSlave.physicalAge = $activeSlave.actualAge, $activeSlave.visualAge = $activeSlave.actualAge, $activeSlave.ovaryAge = $activeSlave.actualAge>>
					<</if>>
				<</if>>
			<</for>>
		<</if>>
		<<if $activeSlave.mother == -9995 && $activeSlave.father == -9994>> /* The fruit siblings - Green & Purple Grape */
			<<for _k = 0; _k < $slaves.length; _k++>>
				<<if areSisters($slaves[_k], $activeSlave) > 0>>
					<<if $activeSlave.birthName == "Green Grape">>
						<<set $activeSlave.actualAge = $slaves[_k].actualAge-5, $activeSlave.physicalAge = $activeSlave.actualAge, $activeSlave.visualAge = $activeSlave.actualAge, $activeSlave.ovaryAge = $activeSlave.actualAge>>
					<<elseif $activeSlave.birthName == "Purple Grape">>
						<<set $activeSlave.actualAge = $slaves[_k].actualAge+5, $activeSlave.physicalAge = $activeSlave.actualAge, $activeSlave.visualAge = $activeSlave.actualAge, $activeSlave.ovaryAge = $activeSlave.actualAge>>
					<</if>>
				<</if>>
			<</for>>
		<</if>>
	<</if>>
	<<run nationalityToAccent($activeSlave)>>
	<<set $specialSlavesPriceOverride = 1>>
	<<slaveCost $activeSlave>>
	<<set $slaveCost = (10*Math.trunc(($slaveCost/10)*2))>>
	<<if $slaveCost < 20000>>
		<<set $slaveCost += random(5000,30000)>>
	<</if>>

	The offered price is <<print cashFormat($slaveCost)>>.

	[[Buy her slave contract|New Slave Intro][$cash -= $slaveCost,$nextButton = "Continue",$nextLink = "AS Dump",$returnTo = "Main",$specialSlave = 1]]

	[[Pay to access complete catalog of slaves|Complete Catalog][$cash -= 1000]] //Costs <<print cashFormat(1000)>>.//

	//Best regards to /d/, whose fine denizens came up with most of the slaves in the "previously owned" database.//

	<<set $saleDescription = 1>><<include "Long Slave Description">>
	<<set $specialSlavesPriceOverride = 0>>

<</if>>


code:
:: Stewardess Select [nobr]

<<set $nextButton = "Back", $nextLink = "Servants' Quarters", $showEncyclopedia = 1, $encyclopedia = "Stewardesses">>
<<showallAssignmentFilter>>
<<if ($Stewardess != 0)>>
	''__@@.pink;<<= SlaveFullName($Stewardess)>>@@__'' is serving as your Stewardess.

She will manage the Servants' Quarters.
<<else>>
	You have not selected a Stewardess.
<</if>>

''Appoint a Stewardess from your devoted slaves:''

[[None|Stewardess Workaround][$i = -1]]

<<assignmentFilter>>

	<<showallAssignmentFilter>>
	<<include "Slave Summary">>
	<<resetAssignmentFilter>>


code:
:: Stewardess Workaround [silently]

<<if $Stewardess != 0>>
	<<= removeJob($Stewardess, "be the Stewardess")>>
<</if>>
<<if $i > -1>>
	<<= assignJob($slaves[$i], "be the Stewardess")>>
	<<set $slaves[$i].livingRules = "luxurious">>
	<<set $Stewardess = $slaves[$i]>>
<</if>>

<<goto "Servants' Quarters">>