:: Clinic Report [nobr]

<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.clinic)>>
<<set _DL = _slaves.length, _SL = $slaves.length, _healthBonus = 0, _idleBonus = 0, _FLsFetish = 0, _restedSlaves = 0>>

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

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

	<<if ($slaves[_FLs].health.condition < 100)>>
		<<run improveCondition($slaves[_FLs], 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].rules.living != "luxurious">>
		<<set $slaves[_FLs].rules.living = "luxurious">>
	<</if>>

	<<set $slaves[_FLs].devotion += _devBonus>>
	<<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>>
	<<set $Nurse = $slaves[_FLs]>>
	<<setLocalPronouns $Nurse>>
	&nbsp;&nbsp;&nbsp;&nbsp;<<= SlaveFullName($Nurse)>> is serving as the clinical nurse.
	<<if $Nurse.relationship == -3 && $Nurse.devotion > 50>>
		$He does $his best to be a caring and nurturing $wife.
		<<set _healthBonus += 2>>
	<</if>>
	<<if (_FLsFetish == 1)>>
		$His job involves giving naked sex slaves orders for their own good. Even though most of these commands are medical rather than sexual, $he can be forgiven for not always seeing the difference, and @@.lightsalmon;becomes more dominant.@@
	<<elseif (_FLsFetish == 2)>>
		Every new patient in the clinic is a new target for $his authority. @@.lightsalmon;$He becomes more dominant.@@
	<</if>>
	<<if setup.nurseCareers.includes($Nurse.career)>>
		$He has experience with medicine from $his life before $he was a slave, and can often recognize conditions before even the medical scanners can.
		<<set _idleBonus++, _healthBonus++>>
	<<elseif $Nurse.skill.nurse >= $masteredXP>>
		$He has experience with medicine from working for you, and can often recognize conditions before even the medical scanners can.
		<<set _idleBonus++, _healthBonus++>>
	<<else>>
		<<set $slaves[_FLs].skill.nurse += random(1,Math.ceil(($Nurse.intelligence+$Nurse.intelligenceImplant)/15) + 8)>>
	<</if>>
	<<if ($Nurse.fetish == "dom")>>
		$He raps out commands with the confidence of long and partly sexual experience, so patients are inclined to follow even unpleasant medical instructions.
		<<set _idleBonus++, _healthBonus++>>
	<</if>>
	<<if ($Nurse.muscles > 5)>>
		$He's strong enough to gently but firmly restrain resistant slaves, allowing $him to be sparing with the inescapable but less healthy restraints.
		<<set _idleBonus++, _healthBonus++>>
	<</if>>
	<<if ($Nurse.intelligence+$Nurse.intelligenceImplant > 50)>>
		The diagnostic equipment is state-of-the-art, but $he's smart and perceptive enough that on occasion, $he can add meaningfully to its medical scans.
		<<set _idleBonus++, _healthBonus++>>
	<</if>>
	<<if ($Nurse.face > 40)>>
		Patients rarely object to seeing $his gorgeous face hovering over them.
		<<set _idleBonus++, _devBonus++>>
	<</if>>
	<<if ($slaves[_FLs].devotion >= 60)>>
		<<set _healthBonus++>>
	<</if>>
	<<for _slave range _slaves>>
		<<set $i = $slaveIndices[_slave.ID]>>
		<<if $Nurse.rivalryTarget == _slave.ID>>
			<<setLocalPronouns _slave 2>>
			$He purposefully neglects the needs of $his <<print rivalryTerm($Nurse)>>, _slave.slaveName, hindering _his2 recovery and deepening their dislike for each other.
			<<set _slave.devotion--, _slave.trust-->>
			<<run healthDamage(_slave, 3)>>
			<<if random(1,100) > 65>>
				<<set $Nurse.rivalry++, $slaves[_FLs].rivalry++, _slave.rivalry++>>
			<</if>>
		<<elseif $Nurse.relationshipTarget == _slave.ID>>
			<<setLocalPronouns _slave 2>>
			$He dedicates most of $his attention to $his <<print relationshipTerm($Nurse)>>, _slave.slaveName, making sure _he2 has everything _he2 needs and more. This lavish attention detracts from $his overall effectiveness.
			<<set _idleBonus -= 3, _slave.devotion++, _slave.trust++>>
			<<run improveCondition(_slave, 3)>>
		<<elseif areRelated($Nurse, _slave)>>
			$He makes sure to spend extra time caring for $his <<print relativeTerm($Nurse,_slave)>>, _slave.slaveName.
			<<set _slave.trust++>>
			<<run improveCondition(_slave, 1)>>
		<</if>>
		<<switch _slave.prestigeDesc>>
		<<case "$He is a famed Free Cities whore, and commands top prices.">>
			<<setLocalPronouns _slave 2>>
			$He does $his best to aid the famous whore, _slave.slaveName, making sure to pay special attention to _his2 worn holes.
			<<run improveCondition(_slave, 2)>>
		<<case "$He is a famed Free Cities slut, and can please anyone.">>
			<<setLocalPronouns _slave 2>>
			$He does $his best to aid the famous entertainer, _slave.slaveName, making sure _he2 can show off as soon as possible.
			<<run improveCondition(_slave, 2)>>
		<<case "$He is remembered for winning best in show as a cockmilker.">>
			<<setLocalPronouns _slave 2>>
			<<if (_slave.balls > 4) && (_slave.dick != 0)>>
				$He does $his best to aid the dribbling _slave.slaveName, paying special attention to _his2 huge cock and balls as well as making sure to milk _his2 <<if canAchieveErection(_slave)>>erect <</if>>dick hourly.
				<<run improveCondition(_slave, 4)>>
				<<if (random(1,100) > 65) && (($Nurse.fetish == "none") || ($Nurse.fetish == "cumslut"))>>
					<<if $Nurse.fetish == "none">>
						<<set $Nurse.fetish = "cumslut", $slaves[_FLs].fetish = "cumslut">>
					<<else>>
						<<set $Nurse.fetishStrength += 4, $slaves[_FLs].fetishStrength += 4>>
					<</if>>
				<</if>>
			<</if>>
		<<case "$He is remembered for winning best in show as a dairy cow.">>
			<<setLocalPronouns _slave 2>>
			<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
				$He does $his best to aid the leaking _slave.slaveName, paying special attention to _his2 huge breasts as well as making sure to milk _him2 hourly.
				<<run improveCondition(_slave, 4)>>
				<<set _slave.lactationDuration = 2, _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
				<<if (random(1,100) > 65) && (($Nurse.fetish == "none") || ($Nurse.fetish == "boobs"))>>
					<<if $Nurse.fetish == "none">>
						<<set $Nurse.fetish = "boobs", $slaves[_FLs].fetish = "boobs">>
					<<else>>
						<<set $Nurse.fetishStrength += 4, $slaves[_FLs].fetishStrength += 4>>
					<</if>>
				<</if>>
			<</if>>
		<<case "$He is remembered for winning best in show as a breeder.">>
			<<setLocalPronouns _slave 2>>
			<<if _slave.bellyPreg >= 1500>>
				$He does $his best to aid the pregnant _slave.slaveName, paying special attention to _his2 swollen belly and the welfare of the life within.
				<<run improveCondition(_slave, 6)>>
			<<elseif _slave.ovaries == 1 || _slave.mpreg == 1>>
				$He does $his best to aid the breeder _slave.slaveName, paying special attention to _his2 fertility and reproductive organs.
				<<run improveCondition(_slave, 4)>>
			<<else>>
				$He lays out plans on how to restore the breeder _slave.slaveName to _his2 former gravid glory.
			<</if>>
		<</switch>>
		<<if _slave.bellyImplant > -1 && $clinicInflateBelly == 1>>
			<<setLocalPronouns _slave 2>>
			<br>''@@.pink;_slave.slaveName@@'' spent a lot of time during the week under IV-like stands with bags of inert filler steadily flowing into _his2 belly implant, slowly pushing _his2 belly further and further out. Careful attention, along with several drug injections, were used to make sure _his2 body was able to safely adjust to the implant's rapid growth.
			<<run healthDamage(_slave, 10)>>
			<<set _slave.bellyImplant += 5000>>
			<<if (_slave.devotion > 50)>>
				<<set _slave.devotion += 4, _slave.trust += 3>>
			<<elseif (_slave.devotion >= -20)>>
				<<set _slave.trust -= 5>>
			<<else>>
				<<set _slave.devotion -= 5, _slave.trust -= 10>>
			<</if>>
			<<if _slave.bellyImplant > ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)>>
				<<set _slave.bellyImplant = ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)>>
				_He2 is filled to the maximum that _his2 implant can stand.
			<</if>>
		<</if>>
		<<if _slave.pregKnown == 1 && _slave.preg < _slave.pregData.normalBirth && _slave.pregControl == "speed up">>
			<<setLocalPronouns _slave 2>>
			<br>''@@.pink;_slave.slaveName@@'' spends most of _his2 time on bedrest being filled with rapid gestation agents and concentrated slave food. All _he2 can do is <<if hasAnyArms(_slave) && canSee(_slave)>>watch and feel _his2 belly pushing further and further out with life<<elseif canSee(_slave)>>watch _his2 belly bulging further and further out with life<<elseif hasAnyArms(_slave)>>feel _his2 belly pushing further and further out with life beneath _his2 fingers<<else>>feel the every growing pressure inside _his2 abdomen<</if>>. Careful attention, along with numerous drug injections, are used to make sure _his2 body is able to safely adjust to _his2 pregnancy's rapid growth.
			<<run healthDamage(_slave, 10)>>
			<<if (_slave.devotion > 50)>>
				<<set _slave.devotion += 2, _slave.trust += 1>>
			<<elseif (_slave.devotion >= -20)>>
				<<set _slave.trust -= 5>>
			<<else>>
				<<set _slave.devotion -= 5, _slave.trust -= 10>>
			<</if>>
			<<if _slave.preg >= _slave.pregData.minLiveBirth && _slave.pregControl == "speed up">>
				<<set _slave.pregControl = "none">>
				''@@.pink;_slave.slaveName's@@'' child is ready to pop out of _his2 womb, ''@@.yellow;_his2 course of rapid gestation agents is finished@@''.
			<</if>>
		<<elseif _slave.preg > 2 && _slave.pregKnown == 0>>
			During $his tests, $he discovers that _slave.slaveName @@.lime;is pregnant.@@
			<<set _slave.pregKnown = 1>>
		<</if>>
	<</for>>
	<<if (_DL < $clinic)>>
		<<set _seed = random(1,10)+(($clinic-_DL)*(random(150,170)+(_idleBonus*10)))>>
		<<run cashX(_seed, "clinic", $Nurse)>>
		<br>&nbsp;&nbsp;&nbsp;&nbsp;Since $he doesn't have enough patients to occupy all $his time, the clinic takes in citizens' slaves on a contract basis and $he helps them too, earning @@.yellowgreen;<<print cashFormat(_seed)>>.@@
	<</if>>
	<<if (_DL > 0)>><br><br><</if>>
<</if>>

<<if (_DL > 0)>>
	&nbsp;&nbsp;&nbsp;&nbsp;<<if (_DL == 1)>>''There is one slave receiving treatment in the clinic.''<<else>>''There are _DL slaves receiving treatment in the clinic.''<</if>>
<</if>>

<<if ($Nurse != 0)>>
	<<set $i = _FLs>> /* apply following SA passages to facility leader */
	<<if $showEWD != 0>>
		<br><br>
		/* 000-250-006 */
		<<if $seeImages && $seeReportImages>>
		<div class="imageRef tinyImg">
			<<= SlaveArt($slaves[_FLs], 0, 0)>>
		</div>
		<</if>>
		/* 000-250-006 */
		<span class='slave-name'><<= SlaveFullName($slaves[_FLs])>></span> is serving as the clinical nurse.
		<br>&nbsp;&nbsp;&nbsp;
		<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
		<<run tired($slaves[$i])>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<= App.SlaveAssignment.drugs($slaves[$i])>>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<br><<include "SA devotion">>
	<<else>>
		<<silently>>
		<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
		<<run tired($slaves[$i])>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<run App.SlaveAssignment.drugs($slaves[$i])>>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<</if>>
	<<set $Nurse = $slaves[_FLs]>>
<</if>>

<<for _slave range _slaves>>
	<<set $i = $slaveIndices[_slave.ID]>>
	<<setLocalPronouns _slave>>

	<<if _slave.devotion < 45>>
		<<set _slave.devotion += 4>>
	<</if>>
	<<set _slave.devotion += _devBonus>>
	<<if _slave.trust < 45>>
		<<set _slave.trust += 4>>
	<</if>>

	<<if (_slave.health.condition < -80)>>
		<<run improveCondition(_slave, (20 + ($curativeUpgrade * 10) + _healthBonus))>>
	<<elseif (_slave.health.condition < -40)>>
		<<run improveCondition(_slave, (10 + ($curativeUpgrade * 7) + _healthBonus))>>
	<<elseif (_slave.health.condition < 0)>>
		<<run improveCondition(_slave, (7 + ($curativeUpgrade * 5) + _healthBonus))>>
	<<elseif (_slave.health.condition < 90)>>
		<<run improveCondition(_slave, (3 + ($curativeUpgrade * 3) + _healthBonus))>>
	<</if>>

	/* the clinic is a well-equipped medical facility and can allow the Nurse or player to
	* directly cure serious wounds caused by injury and surgery with minimal side effects */
	<<if _slave.health.shortDamage >= 10>>
		<<if ($Nurse != 0)>>
			<<run healthCure(_slave, 5 + _healthBonus)>>
		<<else>>
			<<run healthCure(_slave, $PC.skill.medicine / 15)>> /* maximum of 6...even a bad full-time nurse will be better than a player doctor */
		<</if>>
	<</if>>

	<<switch $clinicDecoration>>
	<<case "Eugenics" "Gender Fundamentalist" "Gender Radicalist" "Hedonistic" "Intellectual Dependency" "Maturity Preferentialist" "Paternalist" "Petite Admiration" "Repopulation Focus" "Slimness Enthusiast" "Statuesque Glorification" "Youth Preferentialist">>
		<<set _slave.rules.living = "luxurious">>
	<<case "Arabian Revivalist" "Aztec Revivalist" "Chattel Religionist" "Chinese Revivalist" "Edo Revivalist" "Egyptian Revivalist" "Roman Revivalist">>
		<<set _slave.rules.living = "normal">>
	<<default>>
		<<set _slave.rules.living = "spare">>
	<</switch>>

	<<if ($Nurse != 0)>>
		<<if ($clinicSpeedGestation == 1) && (_slave.pregKnown == 1)>>
			<<set _slave.pregControl = "speed up">>
		<</if>>
		<<if (_slave.chem > 10) && ($clinicUpgradeFilters >= 1)>>
			<<if _slave.health.health > -50 && ($clinicUpgradePurge > 0)>>
				<<set _slave.chem -= 100 * $clinicUpgradePurge>>
				<<run healthDamage(_slave, 15)>>
			<</if>>
			<<set _slave.chem = Math.max(_slave.chem - 5, 0)>>
		<</if>>
		<<if _slave.lactation == 1>>
			<<set _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
		<</if>>
	<</if>>
	<<if (_slave.health.illness > 0)>>
	<<elseif (_slave.health.shortDamage >= 20)>> /* shortDamage does no real harm, until it gets to 20 */
	<<elseif (_slave.health.condition <= 40)>>
	<<elseif ($Nurse != 0) && (_slave.chem > 15) && ($clinicUpgradeFilters == 1)>>
	<<elseif ($Nurse != 0) && (_slave.pregKnown == 1) && ($clinicSpeedGestation > 0 || _slave.pregControl == "speed up")>>
	<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && (_slave.pregAdaptation*1000 < _slave.bellyPreg || _slave.preg > _slave.pregData.normalBirth/1.33)>>
	<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && (_slave.bellyImplant >= 0) && (_slave.bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
	<<else>>
		<p>
			<span class="slave-name">_slave.slaveName</span> has been cured<<if ($Nurse != 0) && ($clinicUpgradeFilters == 1)>> and purified<</if>>,
			<span class="noteworthy">
				<<if $assignmentRecords[_slave.ID]>>
					<<set _oldJob = $assignmentRecords[_slave.ID]>>
					<<= assignJobSafely(_slave, _oldJob)>>
					<<if _slave.choosesOwnAssignment === 1>>
						and $he is resting before choosing another task.
					<<elseif _slave.assignment === "rest">>
						<<if _oldJob != "rest">>
							and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest.
						<<else>>
							so $he has returned to rest.
						<</if>>
					<<else>>
						so $he goes back to <<print _slave.assignment>>.
					<</if>>
				<<else>>
					so $his assignment has defaulted to rest.
					<<= removeJob(_slave, "get treatment in the clinic")>>
				<</if>>
			</span>
		</p>
		<<set _restedSlaves++, _dI--, _DL-->>
		<<continue>>
	<</if>>
	<<if $showEWD != 0>>
		<br><br>
		/* 000-250-006 */
		<<if $seeImages && $seeReportImages>>
			<div class="imageRef tinyImg">
				<<= SlaveArt(_slave, 0, 0)>>
			</div>
		<</if>>
		/* 000-250-006 */
		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
		<<if _slave.choosesOwnAssignment == 2>>
			<<include "SA chooses own job">>
		<<else>>
			is receiving treatment in $clinicName.
		<</if>>
		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.rest(_slave)>>
		<<if (_slave.health.illness > 0)>>
			$He stays in the clinic since $he is still sick.
		<<elseif (_slave.health.condition <= 40)>>
			$He stays in the clinic since $his health is still poor.
		<<elseif (_slave.health.shortDamage >= 20)>>
			$He stays in the clinic to recover from $his injuries.
		<<elseif ($Nurse != 0) && (_slave.chem > 15) && ($clinicUpgradeFilters == 1)>>
			$He stays in the clinic as unhealthy chemicals are still being flushed from $his system.
		<<elseif ($Nurse != 0) && (_slave.pregKnown == 1) && ($clinicSpeedGestation > 0 || _slave.pregControl == "speed up")>>
			$He stays in the clinic to hurry $his pregnancy along safely.
		<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && (_slave.bellyImplant >= 0) && (_slave.bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
			$He stays in the clinic as $his implants can still receive more filling.
		<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && (_slave.pregAdaptation*1000 < _slave.bellyPreg || _slave.preg > _slave.pregData.normalBirth/1.33)>>
			$He stays in the clinic waiting for the child to be born.
		<</if>>
		<br>&nbsp;&nbsp;&nbsp;
		<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<= App.SlaveAssignment.drugs(_slave)>>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<br><<include "SA devotion">>
	<<else>>
		<<silently>>
		<<include "SA chooses own job">>
		<<run App.SlaveAssignment.rest(_slave)>>
		<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<run App.SlaveAssignment.drugs(_slave)>>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<</if>>
<</for>>
<<if (_restedSlaves > 0)>>
	<br><br>&nbsp;&nbsp;&nbsp;&nbsp;
	<<if (_restedSlaves == 1)>>
		One slave has
	<<else>>
		_restedSlaves slaves have
	<</if>>
	been returned to @@.green;health<<if ($Nurse != 0) && ($clinicUpgradeFilters == 1)>> and purity<</if>>@@ and will be released from the clinic before the end of the week.
	<<if $clinicDecoration != "standard">>
		<br><br>&nbsp;&nbsp;&nbsp;&nbsp;$clinicNameCaps's $clinicDecoration atmosphere @@.hotpink;had an impact on them while they were@@ getting treatment.
	<</if>>
<</if>>
<<if _DL > 0 || $Nurse != 0>>
	<br><br>
<</if>>

src/uncategorized/clinicReport.tw