code:
:: Brothel Advertisement

<<nobr>>

<<if $arcologies[0].FSRomanRevivalistDecoration >= 60>>
	The brothel is decorated as a Roman whorehouse. Refreshments are served at a bar, and someone is playing pipes in the back.
<<elseif $arcologies[0].FSEgyptianRevivalistDecoration >= 60>>
	The brothel is decorated as an ancient Egyptian fertility temple. Customers are bade relax on couches next to running water so that slaves may dance to entice them.
<<elseif $arcologies[0].FSEdoRevivalistDecoration >= 60>>
	The brothel is furnished as an Edo period pleasure house, seedy by the standards of the time. Still, girls usually keep their clothes on until they lead patrons back behind the sliding paper screens, though this does not stop silhouettes of the activities within from being visible on them.
<<elseif $arcologies[0].FSArabianRevivalistDecoration >= 60>>
	The brothel is furnished as an Arabian slave market, with the merchandise standing on little platforms, prices visible. Customers are permitted to fondle before making a decision and dragging a girl back behind a curtain.
<<elseif $arcologies[0].FSChineseRevivalistDecoration >= 60>>
	The brothel is furnished as an old Chinese pleasure house, with each girl set up in her own low room. They stand outside the doors, luring customers back one by one.
<<elseif $arcologies[0].FSChattelReligionistDecoration >= 60>>
	The brothel is decorated as a place of worship. The air is scented by censers, and the slaves here maintain an air of holiness even when being sodomized in public.
<<elseif $arcologies[0].FSDegradationistDecoration >= 60>>
	The brothel is decorated to look like a dungeon. The decor involves a lot of black leather and burnished steel, and the slaves on offer are mostly chained to beds and walls.
<<elseif $arcologies[0].FSRepopulationFocusDecoration >= 60>>
  $brothelNameCaps is clean and full of soft couches and chairs for its' pregnant whores to lounge upon while showing off their assets. Several of the rooms are prepped to allow a whore to give birth in front of an audience. A supply of freshly squeezed breast milk is available on tap.
<<elseif $arcologies[0].FSRestartDecoration >= 60>>
	The brothel is decorated to look like a club. Loud music is playing, and the whores that aren't with customers are stripping and poledancing on a stage. Safe sex is greatly encouraged. The real action happens in several reserved rooms dedicated to society's best, since the loud music drowns out private conversations.
<<elseif $arcologies[0].FSAssetExpansionistDecoration >= 60>>
	The brothel is decorated to look like a club. Loud music is playing, and the whores that aren't with customers are stripping and poledancing on a stage.
<<elseif $arcologies[0].FSTransformationFetishistDecoration >= 60>>
	The brothel is sterile and clean. Interactive screens on the walls list the whores and their modifications in clinical detail.
<<elseif $arcologies[0].FSGenderRadicalistDecoration >= 60>>
	The brothel is decorated to look like an old world bordello. The rich decor includes erotic photography and pornographic statuary, depicting every possible combination of human sexual congress.
<<elseif $arcologies[0].FSGenderFundamentalistDecoration >= 60>>
	The brothel is decorated to look like an old world whorehouse. Screens on the walls are showing pornography starring the whores, with prices flashing after each sex act.
<<elseif $arcologies[0].FSPhysicalIdealistDecoration >= 60>>
	The brothel is decorated to look like a club. Loud music is playing, and the whores that aren't with customers are stripping on a stage. There is a distinct smell of sweat, and there is as much emphasis on the strippers' muscles as their breasts.
<<elseif $arcologies[0].FSSubjugationistDecoration >= 60>>
	The brothel is decorated to celebrate the degradation of $arcologies[0].FSSubjugationistRace whores. The whores greet customers in stereotypical $arcologies[0].FSSubjugationistRace accents.
<<elseif $arcologies[0].FSSupremacistDecoration >= 60>>
	The brothel is decorated like an old world gentleman's club. The pictures on the wall depict degradation of every race on earth, except $arcologies[0].FSSupremacistRace people.
<<elseif $arcologies[0].FSPaternalistDecoration >= 60>>
	The brothel is decorated to look like a normal bar. Whores are encouraged to meet customers for a drink and get to know them a little before heading back into a private room.
<<elseif $arcologies[0].FSBodyPuristDecoration >= 60>>
	The brothel is decorated to look like an old world bordello. The rich decor includes erotic photography and pornographic statuary, depicting idealized human forms in the act of love.
<<elseif $arcologies[0].FSSlimnessEnthusiastDecoration >= 60>>
	The brothel is decorated to look like an old world bordello. The rich decor includes erotic photography and pornographic statuary, depicting slim, girlish figures playing, dancing, and loving.
<<elseif $arcologies[0].FSPastoralistDecoration >= 60>>
	The brothel is decorated to look like a dairy. Though it isn't one, there is an intense sexual focus on boobs and lactation, and all the whores have their sizes proudly posted.
<</if>>

<<if $brothelAdsSpending > 0>>
	Screens outside the entrance are showing porn to advertise the brothel.
	<<if $brothelAdsOld == 1>>
	The featured slave actresses are all MILFs.
	<<elseif $brothelAdsOld is -1>>
	The featured slave actresses are all nice and young.
	<<elseif $brothelAdsOld is -2>>
	The featured slave actresses are all teenagers.
	<<elseif $brothelAdsOld is -3>>
	The featured slave actresses are all lolis.
	<<else>>
	The featured slave actresses vary in age.
	<</if>>
	<<if $brothelAdsStacked == 1>>
	Lots of bouncing breasts and butts
	<<elseif $brothelAdsStacked is -1>>
	Lots of trim breasts and shapely butts
	<<else>>
	A variety of breast and butt sizes and shapes
	<</if>>
	are on display, and
	<<if $brothelAdsImplanted == 1>>
	most of these are augmented by implants.
	<<elseif $brothelAdsImplanted is -1>>
	they're all natural.
	<<else>>
	some are augmented by implants.
	<</if>>
	<<if $brothelAdsPreg == 1>>
		Most of slaves have firm, rounded bellies.
	<<elseif $brothelAdsPreg is -1>>
		Most of the slaves have firm, flat bellies.
	<<else>>
		Some of the slaves are pregnant.
	<</if>>
	<<if $brothelAdsModded == 1>>
	Everything is heavily pierced and tattooed.
	<<elseif $brothelAdsModded is -1>>
	Everything is free of tattoos and piercings.
	<<else>>
	Some of these assets are tattooed and pierced, and some aren't.
	<</if>>
	The slaves in the ads are
	<<if $brothelAdsXX == 1>>
	sucking dick and taking cock in their pussies and asses.
	<<elseif $brothelAdsXX is -1>>
	sucking cock and being assfucked while their dicks flop around.
	<<else>>
	sucking dick and taking anal, and the ones that have pussies are being fucked there, too.
	<</if>>
<</if>>

<<if $brothelAdsSpending >= 5000>>
	Advertisements based on these scenes run constantly in media across the arcology, and there's an active merchandising campaign underway to promote your whores.
<<elseif $brothelAdsSpending >= 4000>>
	Advertisements based on these scenes run constantly in media across the arcology.
<<elseif $brothelAdsSpending >= 3000>>
	Advertisements based on these scenes are run in media across the arcology.
<<elseif $brothelAdsSpending >= 2000>>
	Advertisements based on these scenes run regularly in arcology media.
<<elseif $brothelAdsSpending >= 1000>>
	Advertisements based on these scenes run occasionally in arcology media.
<<else>>
	$arcologies[0].name has a robust internal media that could be used to bring customers into the brothel.
<</if>>

<</nobr>>

<<nobr>>

You are spending ¤$brothelAdsSpending each week to advertise the brothel.

<<if $brothelAdsSpending > 900>>
	<<link "Decrease">><<set $brothelAdsSpending -= 1000>><<goto "Brothel Advertisement">><</link>> |
<<else>>
	Decrease |
<</if>>
<<if $brothelAdsSpending < 5000>>
	<<link "Increase">><<set $brothelAdsSpending += 1000>><<goto "Brothel Advertisement">><</link>>
<<else>>
	Increase
<</if>>

<</nobr>>

__Design Brothel Ad Campaign__ //Will replace relevant variety bonuses//
<<nobr>>

Asset size:
<<if $brothelAdsStacked != 1>><<link "Stacked">><<set $brothelAdsStacked to 1>><<goto "Brothel Advertisement">><</link>> | <<else>>Stacked | <</if>>
<<if $brothelAdsStacked != -1>><<link "Slim">><<set $brothelAdsStacked to -1>><<goto "Brothel Advertisement">><</link>> | <<else>>Slim | <</if>>
<<if $brothelAdsStacked != 0>><<link "Variety">><<set $brothelAdsStacked to 0>><<goto "Brothel Advertisement">><</link>><<else>>Variety<</if>>

Asset origin:
<<if $brothelAdsImplanted != 1>><<link "Implants">><<set $brothelAdsImplanted to 1>><<goto "Brothel Advertisement">><</link>> | <<else>>Implants | <</if>>
<<if $brothelAdsImplanted != -1>><<link "All natural">><<set $brothelAdsImplanted to -1>><<goto "Brothel Advertisement">><</link>> | <<else>>All natural | <</if>>
<<if $brothelAdsImplanted != 0>><<link "Variety">><<set $brothelAdsImplanted to 0>><<goto "Brothel Advertisement">><</link>><<else>>Variety<</if>>

Body mods:
<<if $brothelAdsModded != 1>><<link "Modded">><<set $brothelAdsModded to 1>><<goto "Brothel Advertisement">><</link>> | <<else>>Modded | <</if>>
<<if $brothelAdsModded != -1>><<link "Unmodded">><<set $brothelAdsModded to -1>><<goto "Brothel Advertisement">><</link>> | <<else>>Unmodded | <</if>>
<<if $brothelAdsModded != 0>><<link "Variety">><<set $brothelAdsModded to 0>><<goto "Brothel Advertisement">><</link>><<else>>Variety<</if>>

Pregnancy:
<<if $brothelAdsPreg != 1>><<link "Gravid">><<set $brothelAdsPreg to 1>><<goto "Brothel Advertisement">><</link>> | <<else>>Gravid | <</if>>
<<if $brothelAdsPreg != -1>><<link "None">><<set $brothelAdsPreg to -1>><<goto "Brothel Advertisement">><</link>> | <<else>>None | <</if>>
<<if $brothelAdsPreg != 0>><<link "Variety">><<set $brothelAdsPreg to 0>><<goto "Brothel Advertisement">><</link>><<else>>Variety<</if>>

Age:
<<if $brothelAdsOld != 1>><<link "MILF">><<set $brothelAdsOld to 1>><<goto "Brothel Advertisement">><</link>> | <<else>>MILF | <</if>>
<<if $brothelAdsOld != -1>><<link "Young">><<set $brothelAdsOld to -1>><<goto "Brothel Advertisement">><</link>> | <<else>>Young | <</if>>
<<if $minimumSlaveAge < 18>>
<<if $brothelAdsOld != -2>><<link "Teen">><<set $brothelAdsOld to -2>><<goto "Brothel Advertisement">><</link>> | <<else>>Teen | <</if>>
<</if>>
<<if $minimumSlaveAge < 13>>
<<if $brothelAdsOld != -3>><<link "Loli">><<set $brothelAdsOld to -3>><<goto "Brothel Advertisement">><</link>> | <<else>>Loli | <</if>>
<</if>>
<<if $brothelAdsOld != 0>><<link "Variety">><<set $brothelAdsOld to 0>><<goto "Brothel Advertisement">><</link>> <<else>>Variety<</if>>

<<if $seeDicks != 0>>
	Genitalia:
	<<if $brothelAdsXX != 1>><<link "Pussies">><<set $brothelAdsXX to 1>><<goto "Brothel Advertisement">><</link>> | <<else>>Pussies | <</if>>
	<<if $brothelAdsXX != -1>><<link "Dicks">><<set $brothelAdsXX to -1>><<goto "Brothel Advertisement">><</link>> | <<else>>Dicks | <</if>>
	<<if $brothelAdsXX != 0>><<link "Variety">><<set $brothelAdsXX to 0>><<goto "Brothel Advertisement">><</link>> <<else>>Variety<</if>>

<</if>>

<</nobr>>


code:
:: Brothel Report [nobr]

<<set $brothelSlaves = 0, $implanted = 0, $legendaryWhoreID = 0, $madamCashBonus = 0, $modded = 0, $old = 0, $pure = 0, $slim = 0, $stacked = 0, $unmodded = 0, $XX = 0, $XY = 0, $young = 0, _madamFetish = 0, _profits = 0, _SL = $slaves.length, _MDM = -1>>

<<set $legendaryWombID = 0, $pregYes to 0, $pregNo to 0>>

<<set $facility = $facility || {}, $facility.brothel = initFacilityStatistics($facility.brothel)>>

<<for _i = 0; _i < _SL; _i++>>
<<if ($slaves[_i].assignment == "work in the brothel")>>
	<<set $brothelSlaves++>>
<</if>>
<<if ($Madam != 0)>>
<<if ($slaves[_i].ID == $Madam.ID)>>
	<<set _MDM = _i>>
<</if>>
<</if>>
<</for>>

<<if (_MDM > -1)>>
	<<silently>>
	<<set $i = _MDM>>
	<<if $slaves[_MDM].choosesOwnClothes == 1>>
	<<include "SA chooses own clothes">>
	<<if ($slaves[_MDM].devotion <= 20)>>
		<<set $slaves[_MDM].devotion -= 5>>
	<<else>>
		<<set $slaves[_MDM].devotion += 1>>
	<</if>>
	<</if>>
	<<include "SA diet">>
	<<include "SA long term effects">>
	<<include "SA drugs">>
	<<include "SA relationships">>
	<<include "SA rivalries">>
	<<include "SA devotion">>
	<</silently>>
	<<if ($slaves[_MDM].health < -80)>>
	<<set $slaves[_MDM].health += 20>>
	<<elseif $slaves[_MDM].health < -40>>
	<<set $slaves[_MDM].health += 15>>
	<<elseif $slaves[_MDM].health < 0>>
	<<set $slaves[_MDM].health += 10>>
	<<elseif $slaves[_MDM].health < 90>>
	<<set $slaves[_MDM].health += 7>>
	<</if>>
	<<if $slaves[_MDM].devotion <= 45>>
	<<set $slaves[_MDM].devotion += 5>>
	<</if>>
	<<if $slaves[_MDM].trust < 45>>
	<<set $slaves[_MDM].trust += 5>>
	<</if>>
	<<if $slaves[_MDM].fetishStrength <= 95>>
	<<if $slaves[_MDM].fetish != "dom">>
		<<fetishChangeChance $slaves[_MDM]>>
		<<if $fetishChangeChance > random(0,100)>>
			<<set _madamFetish = 1, $slaves[_MDM].fetishKnown = 1, $slaves[_MDM].fetish = "dom">>
		<</if>>
	<<elseif $slaves[_MDM].fetishKnown == 0>>
		<<set _madamFetish = 1, $slaves[_MDM].fetishKnown = 1>>
	<<else>>
		<<set _madamFetish = 2, $slaves[_MDM].fetishStrength += 4>>
	<</if>>
	<</if>>
	<<set $Madam = $slaves[_MDM]>>
	/% Make sure we have registered living expenses as for any other slave %/
	<<run getSlaveStatisticData($Madam, $facility.brothel)>>
    $Madam.slaveName is serving as the madam.
<<if $Madam.relationship == -3>>
	As your wife, she does her best to attract attention to your brothel.
	<<set $madamCashBonus += 0.25>>
<</if>>
<<if (_madamFetish == 1)>>
	She isn't above sampling the merchandise herself; before long it's obvious to her girls that she @@color:lightcoral;really likes fucking them.@@
<<elseif (_madamFetish == 2)>>
	She's careful that all of the whores under her supervision are all warmed up and ready to get fucked every morning, and she @@color:lightsalmon;becomes more dominant.@@
<</if>>
<<if ($Madam.whoreSkill <= 10)>>
	Though $Madam.slaveName does her best to manage the brothel, with her lack of skill she can do little.
<<elseif ($Madam.whoreSkill <= 30)>>
	$Madam.slaveName's basic skills marginally @@color:yellowgreen;improve@@ business at $brothelName.
	<<set $madamCashBonus += 0.05>>
<<elseif ($Madam.whoreSkill <= 60)>>
	$Madam.slaveName's skills @@color:yellowgreen;improve@@ business at $brothelName.
	<<set $madamCashBonus += 0.1>>
<<elseif ($Madam.whoreSkill < 100)>>
	$Madam.slaveName's skills greatly @@color:yellowgreen;improve@@ business at $brothelName.
	<<set $madamCashBonus += 0.15>>
<<else>>
	$Madam.slaveName's mastery immensely @@color:yellowgreen;improves@@ business at $brothelName.
	<<set $madamCashBonus += 0.20>>
<</if>>
<<if ($Madam.actualAge > 35)>>
	Her age and experience also contribute.
	<<set $madamCashBonus += 0.05>>
<</if>>
<<if $madamCareers.contains($Madam.career)>>
	She has experience from her life before she was a slave that helps her in the seedy business of selling other people's bodies for sex.
	<<set $madamCashBonus += 0.05>>
<</if>>
<<if ($Madam.intelligence > 0)>>
	She is a clever manager.
	<<set $madamCashBonus += 0.05*$Madam.intelligence>>
<</if>>
<<if ($Madam.dick > 2) && (canPenetrate($Madam))>>
	Her turgid dick helps her manage the bitches.
	<<set $madamCashBonus += 0.05>>
<</if>>
<<if $brothelSlaves > 0>>
<<for _i = 0; _i < _SL; _i++>>
	<<if ($slaves[_i].assignment != "work in the brothel")>><<continue>><</if>>
	<<if $familyTesting == 1>>
		<<if $slaves[_i].mother == $Madam.ID>>
			She pays special attention to her daughter, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<</if>>
		<<if $slaves[_i].father == $Madam.ID>>
			She pays special attention to her daughter, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<</if>>
		<<if $slaves[_i].ID == $Madam.father>>
			She pays special attention to her father, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<</if>>
		<<if $slaves[_i].ID == $Madam.mother>>
			She pays special attention to her mother, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<</if>>
		<<if areSisters($slaves[_i], $Madam) == 1>>
			She pays special attention to her twin sister, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<<elseif areSisters($slaves[_i], $Madam) == 2>>
			She pays special attention to her sister, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<<elseif areSisters($slaves[_i], $Madam) == 3>>
			She pays special attention to her half-sister, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
			<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
		<</if>>
	<<else>>
	<<if $Madam.relationTarget == $slaves[_i].ID>>
		She pays special attention to her $slaves[_i].relation, $slaves[_i].slaveName, making sure she is treated well and showing off her skills.
		<<set $slaves[_i].trust += 1, $madamCashBonus += 0.05>>
	<</if>>
	<</if>> /*closes extended family mode*/
	<<if $Madam.relationshipTarget == $slaves[_i].ID>>
		She dotes over her <<if $Madam.relationship == 1>>friend<<elseif $Madam.relationship == 2>>best friend<<elseif $Madam.relationship == 3>>friend with benefits<<elseif $Madam.relationship == 4>>lover<<elseif $Madam.relationship == 5>>slave wife<</if>>, $slaves[_i].slaveName, making sure she is safe, but unfortunately driving potential costumers away from her.
		<<set $slaves[_i].devotion += 1, $madamCashBonus -= 0.05>>
	<</if>>
	<<if $Madam.rivalryTarget == $slaves[_i].ID>>
		She forces her <<if $Madam.rivalry == 1>>growing rival<<elseif $Madam.rivalry == 2>>rival<<elseif $Madam.rivalry == 3>>bitter rival<</if>>, $slaves[_i].slaveName, to service all the men in the brothel.
		<<set $slaves[_i].devotion -= 2, $slaves[_i].trust -= 2>>
		<<if canDoVaginal($slaves[_i])>>
			<<set $slaves[_i].vaginalCount += 10, $vaginalTotal += 10>>
			<<if $slaves[_i].publicCount>><<set $slaves[_i].publicCount += 10>><<else>><<set $slaves[_i].publicCount = 10>><</if>>
		<</if>>
		<<if canDoAnal($slaves[_i])>>
			<<set $slaves[_i].analCount += 10, $analTotal += 10>>
			<<if $slaves[_i].publicCount>><<set $slaves[_i].publicCount += 10>><<else>><<set $slaves[_i].publicCount = 10>><</if>>
		<</if>>
		<<set $slaves[_i].oralCount += 10, $oralTotal += 10>>
		<<if $slaves[_i].publicCount>><<set $slaves[_i].publicCount += 10>><<else>><<set $slaves[_i].publicCount = 10>><</if>>
		<<if random(1,100) > 65>>
			<<set $slaves[_MDM].rivalry += 1, $Madam.rivalry += 1, $slaves[_i].rivalry += 1>>
		<</if>>
	<</if>>
	<<if $slaves[_i].prestigeDesc == "She is a famed Free Cities whore, and commands top prices.">>
		She makes sure to promote $slaves[_i].slaveName, the famed whore, in order to capitalize on her popularity.
		<<set $madamCashBonus += 0.15>>
	<</if>>
	<<if $slaves[_i].prestigeDesc == "She is a famed Free Cities slut, and can please anyone.">>
		She makes sure to promote $slaves[_i].slaveName, the famed entertainer, in order to capitalize on her popularity.
		<<set $madamCashBonus += 0.15>>
	<</if>>
	<<if $slaves[_i].prestigeDesc == "She is remembered for winning best in show as a dairy cow.">>
		She makes sure to massage $slaves[_i].slaveName's huge breasts to get the milk flowing before enticing clients to suckle and play with her.
		<<set $madamCashBonus += 0.10>>
	<</if>>
	<<if $slaves[_i].prestigeDesc == "She is remembered for winning best in show as a cockmilker.">>
		She shows off $slaves[_i].slaveName's copious loads by putting a condom over her dick and teasing her till she bursts it.  The show draws multiple clients that want to play with her oversized junk and messy orgasms.
		<<set $madamCashBonus += 0.15>>
	<</if>>
	<<if $slaves[_i].prestigeDesc == "She is remembered for winning best in show as a breeder." && $slaves[$i].preg > 10>>
		She makes sure $slaves[_i].slaveName's growing pregnancy is well taken care of, even if it means driving away potential customers away when the mother-to-be needs a rest.
		<<set $madamCashBonus -= 0.05>>
	<</if>>
	<<if $slaves[_i].prestigeDesc == "She is remembered for winning best in show as a breeder.">>
		She makes sure to play off $slaves[_i].slaveName's fame and fertility by enticing potential customers to be the one to claim her womb by filling it with their child.
		<<set $madamCashBonus += 0.15>>
	<</if>>
<</for>>
<</if>>

<<set $oldCash = $cash, _profits += $cash-$oldCash>>
<<if ($brothelSlaves < 5)>>
	<<set $slavesGettingHelp = 0>>
	<<if $universalRulesFacilityWork == 1>>
	<<for _i to 0; _i < _SL; _i++>>
		<<if ($slaves[_i].assignment == "whore")>>
		<<set $slavesGettingHelp++>>
		<</if>>
	<</for>>
	<</if>>
	<<if ($brothelSlaves+$slavesGettingHelp < 5)>>
	<<set $oldCash = $cash, $i = _MDM>>
	<<silently>><<include "SA whore">><</silently>>
	<<set $Madam = $slaves[_MDM], _seed = $cash-$oldCash, $cash += Math.trunc(0.5*_seed), _seed = Math.trunc(1.5*_seed), _profits += _seed, getSlaveStatisticData($Madam, $facility.brothel).income += _seed>>

    Since she doesn't have enough whores to manage to keep her busy, she sees $beauty customers herself (<<print Math.trunc($beauty/7)>> a day), earning you @@color:yellowgreen;¤_seed@@. She can charge more for her time, since many citizens find it erotic to fuck the Madam.
	<</if>>
<</if>>

<</if>>

<<if $brothelSlaves > 0>>
	<<if $seeImages == 1>>
<</if>>
	    <<if $brothelSlaves == 1>>''There is one slave whore working out of $brothelName.''<<else>>''There are $brothelSlaves slave whores working out of $brothelName.''<</if>>

	/% stuff that does not need to be in the for loop %/
	<<set _healthBonus = 0, _aphrod = 0>>
	<<if ($brothelUpgradeDrugs == 1)>>
		<<set _healthBonus += 3, _aphrod = 2>>
	<</if>>
	<<if ($brothelUpgradeHealth == 1)>>
		<<set _healthBonus += 10>>
	<</if>>
<<for _i = 0; _i < _SL; _i++>>
	<<if ($slaves[_i].assignment != "work in the brothel")>><<continue>><</if>>
	<<if ($legendaryWombID == 0) && ($slaves[_i].amp != 1) && ($slaves[_i].preg > 30) && ($slaves[_i].pregType < 50) && ($slaves[_i].eggType == "human") && ($slaves[_i].births > 10) && ($slaves[_i].devotion > 50) && ($slaves[_i].prestige == 0)>>
	<<set $legendaryWombID = $slaves[_i].ID>>
	<</if>>
	<<if ($legendaryWhoreID == 0) && ($slaves[_i].whoreSkill >= 100) && ($slaves[_i].devotion > 50) && ($slaves[_i].prestige == 0)>>
	<<set $legendaryWhoreID = $slaves[_i].ID>>
	<</if>>
	<<silently>>
	<<set $i = _i>>
	<<if $slaves[_i].choosesOwnClothes == 1>>
		<<include "SA chooses own clothes">>
		<<if ($slaves[_i].devotion <= 20)>>
			<<set $slaves[_i].devotion -= 5>>
		<<else>>
			<<set $slaves[_i].devotion += 1>>
		<</if>>
	<</if>>
	<<set $slaves[_i].health += _healthBonus, $slaves[_i].aphrodisiacs = _aphrod>>
	<<include "SA diet">>
	<<include "SA long term effects">>
	<<include "SA drugs">>
	<<set $oldCash = $cash>>
	<<include "SA whore">>
	<<if $brothelAdsSpending != 0>>
	<<set _seed = 0>>
	<<if $brothelAdsStacked == 1>>
		<<if ($slaves[_i].butt > 4) && ($slaves[_i].boobs > 800)>>
		<<set _seed++>>
		<</if>>
	<<elseif $brothelAdsStacked == -1>>
		<<if ($slaves[_i].boobs < 500) && ($slaves[_i].butt < 3) && ($slaves[_i].weight <= 10) && ($slaves[_i].muscles <= 95)>>
		<<set _seed++>>
		<</if>>
	<</if>>
	<<set _PierceC = ($slaves[_i].lipsPiercing + $slaves[_i].nipplesPiercing + $slaves[_i].vaginaPiercing + $slaves[_i].clitPiercing + $slaves[_i].anusPiercing + $slaves[_i].earPiercing + $slaves[_i].eyebrowPiercing + $slaves[_i].nosePiercing + $slaves[_i].navelPiercing)>>
	<<if $brothelAdsModded == 1>>
		<<if (_PierceC > 8)>>
		<<if ($slaves[_i].lipsTat != 0) && ($slaves[_i].buttTat != 0) && ($slaves[_i].anusTat != 0) && ($slaves[_i].vaginaTat != 0) && ($slaves[_i].boobsTat != 0)>>
			<<set _seed++>>
		<</if>>
		<</if>>
	<<elseif $brothelAdsModded == -1>>
		<<if (_PierceC < 3)>>
		<<if ($slaves[_i].lipsTat == 0) && ($slaves[_i].buttTat == 0) && ($slaves[_i].vaginaTat == 0) && ($slaves[_i].boobsTat == 0)>>
			<<set _seed++>>
		<</if>>
		<</if>>
	<</if>>
	<<if $brothelAdsPreg == 1>>
		<<if ($slaves[$i].preg > 10) || ($slaves[$i].bellyImplant >= 4000)>>
			<<set _seed++>>
		<</if>>
	<<elseif $brothelAdsPreg == -1>>
		<<if ($slaves[$i].pregType < 10) && ($slaves[$i].preg < 1) && ($slaves[$i].weight < 30) && (!$fakeBellies.contains($bellyAccessory)) && ($slaves[$i].bellyImplant == 0) && ($slaves[$i].inflation == 0)>>
			<<set _seed++>>
		<</if>>
	<</if>>
	<<if $brothelAdsImplanted == 1>>
		<<if ($slaves[_i].boobsImplant > 0) && ($slaves[_i].buttImplant > 0) && ($slaves[_i].waist > 0) && ($slaves[_i].lipsImplant > 0) && ($slaves[$i].bellyImplant > 0)>>
			<<set _seed++>>
		<</if>>
	<<elseif $brothelAdsImplanted == -1>>
		<<if ($slaves[_i].boobsImplant == 0) && ($slaves[_i].buttImplant == 0) && ($slaves[_i].waist < 2) && ($slaves[_i].lipsImplant == 0) && ($slaves[_i].faceImplant < 2) &&  ($slaves[$i].bellyImplant == 0)>>
			<<set _seed++>>
		<</if>>
	<</if>>
	<<if $brothelAdsOld == 1>>
		<<if ($slaves[_i].physicalAge >= 30)>>
		<<set _seed++>>
		<</if>>
	<<elseif $brothelAdsOld == -1>>
		<<if ($slaves[_i].physicalAge < 30) && ($slaves[_i].physicalAge >= 18)>>
		<<set _seed++>>
		<</if>>
	<<elseif $brothelAdsOld == -2>>
		<<if ($slaves[_i].physicalAge <= 18) && ($slaves[_i].physicalAge >= 13)>>
		<<set $seed++>>
		<</if>>
	<<elseif $brothelAdsOld == -3>>
		<<if ($slaves[_i].physicalAge < 13)>>
		<<set $seed++>>
		<</if>>
	<</if>>
	<<if $brothelAdsXX == 1>>
		<<if ($slaves[_i].dick == 0)>>
		<<set _seed++>>
		<</if>>
	<<elseif $brothelAdsXX == -1>>
		<<if ($slaves[_i].dick > 0)>>
		<<set _seed++>>
		<</if>>
	<</if>>
	<<if _seed > 0>>
		<<set _adsIncome = _seed * random(50,60) * Math.trunc($brothelAdsSpending/1000), $cash += _adsIncome, getSlaveStatisticData($slaves[_i], $facility.brothel).adsIncome += _adsIncome>>
	<<else>>
		<<set _adsIncome = random(50,60) * Math.trunc($brothelAdsSpending/1000), $cash += _adsIncome, getSlaveStatisticData($slaves[_i], $facility.brothel).adsIncome += _adsIncome>>
	<</if>>
	<</if>>
	<<set _profits += $cash-$oldCash>>
	<<include "SA relationships">>
	<<include "SA rivalries">>
	<<include "SA devotion">>
	<</silently>>
	<<if ($slaves[_i].health < -80)>>
	<<set $slaves[_i].health += 20>>
	<<elseif $slaves[_i].health < -40>>
	<<set $slaves[_i].health += 15>>
	<<elseif $slaves[_i].health < 0>>
	<<set $slaves[_i].health += 10>>
	<<elseif $slaves[_i].health < 90>>
	<<set $slaves[_i].health += 7>>
	<</if>>
	<<if ($slaves[_i].devotion <= 20) && ($slaves[_i].trust > -20)>>
	<<set $slaves[_i].devotion -= 5>>
	<<set $slaves[_i].trust -= 5>>
	<<elseif ($slaves[_i].devotion < 45)>>
	<<set $slaves[_i].devotion += 4>>
	<<elseif ($slaves[_i].devotion >= 50)>>
	<<set $slaves[_i].devotion -= 4>>
	<</if>>
	<<if ($slaves[_i].trust < 30)>>
	<<set $slaves[_i].trust += 5>>
	<</if>>
	<<if $slaves[_i].energy > 40 && $slaves[_i].energy < 95>>
	<<set $slaves[_i].energy += 1>>
	<</if>>
<</for>>

	<<set $oldCash = $cash, _possibleBonuses = 0, _brothelBonuses = 0>>
	<<if $brothelAdsSpending != 0>>
	An ad campaign is supporting business there, and whores that match it make more ¤.
	<</if>>
	<<if ($arcologies[0].FSAssetExpansionist == "unset") && ($arcologies[0].FSSlimnessEnthusiast == "unset")>>
	<<if ($brothelAdsSpending == 0) || ($brothelAdsStacked == 0)>>
		<<set _possibleBonuses++>>
		<<if ($slim > 0) && ($stacked > 0) && (Math.abs($slim-$stacked) <= ($brothelSlaves/3))>>
		<<set _adsIncome = $brothelSlaves*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
		The brothel offers a @@color:yellowgreen;wide@@ variety of slim and stacked slaves.
		<</if>>
	<</if>>
	<</if>>
	<<if ($arcologies[0].FSRepopulationFocus == "unset") && ($arcologies[0].FSRestart == "unset")>>
	<<if ($brothelAdsSpending == 0) || ($brothelAdsPreg == 0)>>
		<<set _possibleBonuses++>>
		<<if ($pregYes > 0) && ($pregNo > 0) && (Math.abs($pregYes-$pregNo) <= ($brothelSlaves/3))>>
		<<set _adsIncome = $brothelSlaves*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
		The brothel offers a @@color:yellowgreen;wide@@ variety of slaves with big bellies and slaves with flat bellies.
		<</if>>
	<</if>>
	<</if>>
	<<if ($arcologies[0].FSDegradationist == "unset") && ($arcologies[0].FSBodyPurist == "unset")>>
	<<if ($brothelAdsSpending == 0) || ($brothelAdsModded == 0)>>
		<<set _possibleBonuses++>>
		<<if ($modded > 0) && ($unmodded > 0) && (Math.abs($modded-$unmodded) <= ($brothelSlaves/3))>>
		<<set _adsIncome = $brothelSlaves*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
		The brothel offers a @@color:yellowgreen;both@@ heavily pierced and tattooed slaves and slaves with more natural bodies.
		<</if>>
	<</if>>
	<</if>>
	<<if ($arcologies[0].FSTransformationFetishist == "unset") && ($arcologies[0].FSBodyPurist == "unset")>>
	<<if ($brothelAdsSpending == 0) || ($brothelAdsImplanted == 0)>>
		<<set _possibleBonuses++>>
		<<if ($implanted > 0) && ($pure > 0) && (Math.abs($implanted-$pure) <= ($brothelSlaves/3))>>
		<<set _adsIncome = $brothelSlaves*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
		The brothel offers @@color:yellowgreen;both@@ all-natural girls, and slaves whose beauty has been improved by surgical means.
		<</if>>
	<</if>>
	<</if>>
	<<if $seeDicks != 0>>
	<<if ($brothelAdsSpending == 0) || ($brothelAdsXX == 0)>>
		<<set _possibleBonuses++>>
		<<if ($XX > 0) && ($XY > 0) && (Math.abs($XX-$XY) <= ($brothelSlaves/3))>>
		<<set _adsIncome = $brothelSlaves*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
		The brothel offers a @@color:yellowgreen;mix@@ of whores that can appeal to varied tastes in genitalia.
		<</if>>
	<</if>>
	<</if>>
	<<if ($arcologies[0].FSMaturityPreferentialist == "unset") && ($arcologies[0].FSYouthPreferentialist == "unset")>>
	<<if ($brothelAdsSpending == 0) || ($brothelAdsOld == 0)>>
		<<set _possibleBonuses++>>
		<<if ($young > 0) && ($old > 0) && (Math.abs($young-$old) <= ($brothelSlaves/3))>>
		<<set _adsIncome = $brothelSlaves*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
		The brothel offers girls @@color:yellowgreen;both@@ young and mature.
		<</if>>
	<</if>>
	<</if>>

	<<if (_possibleBonuses > 0) && (_brothelBonuses >= _possibleBonuses)>>
		<<set _adsIncome = $brothelSlaves*random(40,60), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome>>
		There is a ''@@color:yellowgreen;perfect variety@@'' of slave whores working in the brothel.
	<</if>>

	<<set _profits += $cash-$oldCash>>

	<>
	$brothelNameCaps makes you @@color:yellowgreen;¤_profits@@ this week.

	<<if $brothel < $brothelSlaves>>
	<<set $brothelSpots = 0>>
	<<else>>
	<<set $brothelSpots = $brothel - $brothelSlaves>>
	<</if>>

	<<if $brothelDecoration != "standard">>
	$brothelNameCaps's customers enjoy @@color:green;fucking whores in $brothelDecoration surroundings.@@
	<</if>>

	<<BrothelStatistics 0>>
<<else>>
	''$brothelNameCaps is empty''<<if (_MDM > -1)>> except for the Madam<</if>>.
	<<set $brothelSpots = $brothel>>
<</if>>

repo_name: TooSlow/fc


code:
:: Buy Slaves [nobr]

<<set $nextButton to "Back">>
<<set $nextLink to "Main">>

<<set $activeArcology to 0>>

__Sex Slave Purchase Options__

//There are many different organizations to purchase slaves from, but many of them are selective about their customers and will only sell to you if you are reputable.//
<<if ($slaveCostFactor > 1.1)>>
	@@color:yellow;There is a bull market for slaves; the price of slaves is very high.@@
<<elseif ($slaveCostFactor > 1)>>
	@@color:yellow;The slave market is bullish; the price of slaves is high.@@
<<elseif ($slaveCostFactor < 0.9)>>
	@@color:yellow;There is a bear market for slaves; the price of slaves is very low.@@
<<elseif ($slaveCostFactor < 1)>>
	@@color:yellow;The slave market is bearish; the price of slaves is low.@@
<<else>>
	The slave market is stable; the price of slaves is average.
<</if>>

<<if $corpIncorporated != 0>>

[[Corporate Market|Slave Markets][$slaveMarket to "corporate", $slavesSeen += 1]] | //Slaves from your corporation purchased at a discounted rate.//
<</if>>

[[The Flesh Heap|Slave Markets][$slaveMarket to "heap", $slavesSeen += 1]] | //Broken and discarded slaves. Near useless, but cheap.//

<<if ($rep > 500)>>

[[Kidnappers' Market|Slave Markets][$slaveMarket to "kidnappers", $slavesSeen += 1]] | //Slaves will tend to be low quality and resistant.//
<</if>>

<<set $seed to 0>>
<<for $i to 0; $i < $arcologies.length; $i++>>
	<<if $arcologies[$i].direction != 0>>

<<print "[[Slaves from|Slave Markets][$activeArcology to $arcologies[" + $i + "]]]">>
	''$arcologies[$i].name''
	<<if $seed == 0>>
		| //The arcology's prosperity and culture will affect slaves who have lived there.//
		<<set $seed to 1>>
	<</if>>
	<</if>>
<</for>>

<<if ($rep > 1000)>>

[[Runaway Hunters' Market|Slave Markets][$slaveMarket to "hunters", $slavesSeen += 1]] | //Slaves will tend to be skilled but rebellious.//
<</if>>

<<if ($rep > 2000)>>

[[Indentures Market|Slave Markets][$slaveMarket to "indentures", $slavesSeen += 1]] | //Temporary enslavement and restrictions on treatment.//
<</if>>

<<if ($rep > 3000)>>

[[Raiders' Market|Slave Markets][$slaveMarket to "raiders", $slavesSeen += 1]] | //Slaves will always be sold immediately upon reaching majority.//
<</if>>

<<if ($pedo_mode == 1 || ($minimumSlaveAge <= 13 && $minimumSlaveAge <= $fertilityAge)) && ($rep > 3500)>>

[[Raiders' Black Market|Slave Markets][$slaveMarket to "underage raiders", $slavesSeen += 1]] | //Very young slaves.//
<</if>>

<<if ($rep > 4000)>>

[[Trainers' Market|Slave Markets][$slaveMarket to "trainers", $slavesSeen += 1]] | //Slaves will tend to be good quality and obedient.//
<</if>>

<<if ($rep > 5500)>>

''Slave Schools:'' //High prices; will be young and healthy.//
	<<if ($seeDicks != 2)>>

    [[The Slavegirl School][$slavesSeen += 1]] | //Straightforward slaves with good training.//<<if $TSS.schoolSale == 1>> //@@color:yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[Growth Research Institute][$slavesSeen += 1]] | //Poorly trained slaves with huge assets.//<<if $GRI.schoolSale == 1>> //@@color:yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[St. Claver Preparatory][$slavesSeen += 1]] | //Slaves with basic training and solid implants.//<<if $SCP.schoolSale == 1>> //@@color:yellow;Offering your first purchase at half price this week.@@//<</if>>
	<</if>>
	<<if ($seeDicks != 0)>>

    [[L'école des Enculées][$slavesSeen += 1]] | //Slaves optimized and trained for anal.//<<if $LDE.schoolSale == 1>> //@@color:yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[The Gymnasium-Academy][$slavesSeen += 1]] | //Well trained slaves with dicks.//<<if $TGA.schoolSale == 1>> //@@color:yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[The Futanari Sisters][$slavesSeen += 1]] | //Highly skilled, highly feminine hermaphrodites.//<<if $TFS.schoolSale == 1>> //@@color:yellow;Offering your first purchase at half price this week.@@//<</if>>
	<</if>>
<</if>>

<<if ($arcologies[0].FSDegradationist != "unset")>>

//The Slave Shelter does not place slaves into Degradationist arcologies.//
<<elseif ($shelterAbuse > 10)>>

//The Slave Shelter has banned you due to dark rumors about you.//
<<elseif ($shelterAbuse > 5)>>

//The Slave Shelter has banned you due to rumors that you resell its slaves.//
<<elseif ($shelterSlaveBought == 1)>>

//The Slave Shelter will not offer another slave for placement until next week.//
<<elseif ($rep > 7000)>>

[[Take in a shelter slave|Slave Shelter]] | //Presents charity cases for a nominal fee.//
<</if>>

<<if ($rep > 9000)>>

[[Consult the household liquidator|Household Liquidator][$slavesSeen += 2]] | //Offers slaves close to one another at a very high price.//
<</if>>

<<if ($rep > 11000)>>

[[Place a special order|Custom Slave]] | //Customizable but very expensive.//
<</if>>

<<if ($rep > 14000)>>

[[Attend an auction of a prestigious slave|Prestigious Slave]] | //Variable and expensive.//
<</if>>

<<if ($rep > 17000)>>

[[Acquire other slaveowners' stock|Special Slave]] | //Variable and expensive.//
<</if>>

<<if ($rep <= 500)>>

//You are not reputable enough to buy kidnapped slaves.//
<<elseif ($rep <= 1000)>>

//You are not reputable enough to buy recaptured slaves.//
<<elseif ($rep <= 2000)>>

//You are not reputable enough to buy indentured servants.//
<<elseif ($rep <= 3000)>>

//You are not reputable enough to buy teenaged slaves.//
<<elseif ($pedo_mode == 1 || ($minimumSlaveAge <= 13 && $minimumSlaveAge <= $fertilityAge)) && ($rep <= 3500)>>

//You are not reputable enough to buy underaged slaves.//
<<elseif ($rep <= 4000)>>

//You are not reputable enough to buy trained slaves.//
<<elseif ($rep <= 5500)>>

//You are not reputable enough to acquire fresh school slaves.//
<<elseif ($rep <= 7000)>>

//You are not reputable enough to take in Shelter slaves.//
<<elseif ($rep <= 9000)>>

//You are not reputable enough to consult the household liquidator.//
<<elseif ($rep <= 11000)>>

//You are not reputable enough to order custom slaves.//
<<elseif ($rep <= 14000)>>

//You are not reputable enough to bid on prestigious slaves.//
<<elseif ($rep <= 17000)>>

//You are not reputable enough to acquire other slaveowners' stock.//
<<else>>

You are so reputable that you can access all of the Free Cities' slaving markets.
<</if>>

__Menial Slaves__

The parts of your arcology you own can house a total of <<print 100*Math.trunc(($arcologies[0].ownership*$AProsperityCap)/1000)>> menial slaves.
<<MenialPopCap>>

<<set $seed = Math.trunc(($slaveCostFactor*1000)/100)*100>>
<<set $seed to Math.clamp($seed, 500, 1500)>>

<<if $helots > 1>>
	You own $helots menial slaves.
<<elseif $helots > 0>>
	You own one menial slave.
<<else>>
	You do not own any menial slaves.
<</if>>
The market price of menials is ¤$seed.
[[Buy|Buy Slaves][$helots+=1,$menialDemandFactor+=1,$cash-=$seed]]
<<if $cash > $seed*10>>
	[[(x10)|Buy Slaves][$helots+=10,$menialDemandFactor+=10,$cash-=$seed*10]]
<</if>>
<<if $cash > $seed*100>>
	[[(x100)|Buy Slaves][$helots+=100,$menialDemandFactor+=100,$cash-=$seed*100]]
<</if>>
<<if $cash > $seed*2>>
	[[(max)|Buy Slaves][$helots+=Math.trunc($cash/($seed)),$menialDemandFactor+=Math.trunc($cash/($seed)),$cash-=Math.trunc($cash/($seed))*($seed)]]
<</if>>
<<if $helots >= 1>>
	| [[Sell|Buy Slaves][$helots-=1,$menialDemandFactor-=1,$cash+=$seed]]
<<if $helots >= 10>>
	[[(x10)|Buy Slaves][$helots-=10,$menialDemandFactor-=10,$cash+=$seed*10]]
<<if $helots >= 100>>
	[[(x100)|Buy Slaves][$helots-=100,$menialDemandFactor-=100,$cash+=$seed*100]]
<</if>>
<</if>>
[[(all)|Buy Slaves][$cash+=$helots*($seed),$menialDemandFactor-=$helots*($seed),$helots to 0]]
	<<if $arcologies[0].FSPaternalist is "unset">>
	<<if $arcadeUpgradeFuckdolls == 1>>

    [[Convert to Fuckdoll|Buy Slaves][$helots-=1,$fuckdolls+=1,$cash-=1000]]
		<<if $helots >= 10>>
			[[(x10)|Buy Slaves][$helots-=10,$fuckdolls+=10,$cash-=10000]]
		<<if $helots >= 100>>
			[[(x100)|Buy Slaves][$helots-=100,$fuckdolls+=100,$cash-=100000]]
		<</if>>
		<</if>>
		[[(all)|Buy Slaves][$fuckdolls+=$helots,$cash-=1000*$helots,$helots=0]]
		//Costs ¤1000//
	<</if>>
	<<if $dairyFeedersUpgrade > 0>>

    [[Convert to Bioreactor|Buy Slaves][$helots-=1,$menialBioreactors+=1,$cash-=500]]
		//Costs ¤500//
		<<if $helots >= 10>>
			[[(x10)|Buy Slaves][$helots-=10,$menialBioreactors+=10,$cash-=5000]]
		<<if $helots >= 100>>
			[[(x100)|Buy Slaves][$helots-=100,$menialBioreactors+=100,$cash-=50000]]
		<</if>>
		<</if>>
		[[(all)|Buy Slaves][$menialBioreactors+=$helots,$cash-=500*$helots,$helots=0]]
		//Costs ¤500//
	<</if>>
	<</if>>
<</if>>

<<if $fuckdolls > 1>>

You own $fuckdolls standard Fuckdolls.
<<elseif $fuckdolls > 0>>

You own one standard Fuckdoll.
<<elseif $arcologies[0].FSPaternalist is "unset">>

You do not own any standard Fuckdolls.
<</if>>
<<if ($fuckdolls > 0) || ($arcologies[0].FSPaternalist is "unset")>>
The market price of standard fuckdolls is ¤<<print $seed*2>>.
<<if $arcologies[0].FSPaternalist is "unset">>
[[Buy|Buy Slaves][$fuckdolls+=1,$menialDemandFactor+=1,$cash-=$seed*2]]
<<if $cash > $seed*20>>
	[[(x10)|Buy Slaves][$fuckdolls+=10,$menialDemandFactor+=10,$cash-=$seed*20]]
<</if>>
<<if $cash > $seed*200>>
	[[(x100)|Buy Slaves][$fuckdolls+=100,$menialDemandFactor+=100,$cash-=$seed*200]]
<</if>>
<<if $cash > $seed*4>>
	[[(max)|Buy Slaves][$fuckdolls+=Math.trunc($cash/($seed*2)),$menialDemandFactor+=Math.trunc($cash/($seed*2)),$cash-=Math.trunc($cash/($seed*2))*($seed*2)]]
<</if>>
<</if>>
<<if $fuckdolls >= 1>>
	| [[Sell|Buy Slaves][$fuckdolls-=1,$menialDemandFactor-=1,$cash+=$seed*2]]
<<if $fuckdolls >= 10>>
	[[(x10)|Buy Slaves][$fuckdolls-=10,$menialDemandFactor-=10,$cash+=$seed*20]]
<<if $fuckdolls >= 100>>
	[[(x100)|Buy Slaves][$fuckdolls-=100,$menialDemandFactor-=100,$cash+=$seed*200]]
<</if>>
<</if>>
[[(all)|Buy Slaves][$cash+=$fuckdolls*($seed*2),$menialDemandFactor-=$fuckdolls*($seed*2),$fuckdolls to 0]]
<</if>>
<</if>>

<<if $menialBioreactors > 1>>

You own $menialBioreactors standard bioreactors.
<<elseif $menialBioreactors > 0>>

You own one standard bioreactor.
<<elseif $arcologies[0].FSPaternalist is "unset">>

You do not own any standard bioreactors.
<</if>>
<<if ($menialBioreactors > 0) || ($arcologies[0].FSPaternalist is "unset")>>
The market price of standard bioreactors is ¤<<print ($seed-100)>>.
<<if $arcologies[0].FSPaternalist is "unset">>
[[Buy|Buy Slaves][$menialBioreactors+=1,$menialDemandFactor+=1,$cash-=($seed-100)]]
<<if $cash > ($seed-100)*10>>
	[[(x10)|Buy Slaves][$menialBioreactors+=10,$menialDemandFactor+=10,$cash-=($seed-100)*10]]
<</if>>
<<if $cash > ($seed-100)*100>>
	[[(x100)|Buy Slaves][$menialBioreactors+=100,$menialDemandFactor+=100,$cash-=($seed-100)*100]]
<</if>>
<<if $cash > ($seed-100)*2>>
	[[(max)|Buy Slaves][$menialBioreactors+=Math.trunc($cash/($seed-100)),$menialDemandFactor+=Math.trunc($cash/($seed-100)),$cash-=Math.trunc($cash/($seed-100))*($seed-100)]]
<</if>>
<</if>>
<<if $menialBioreactors >= 1>>
	| [[Sell|Buy Slaves][$menialBioreactors-=1,$menialDemandFactor-=1,$cash+=($seed-100)]]
<<if $menialBioreactors >= 10>>
	[[(x10)|Buy Slaves][$menialBioreactors-=10,$menialDemandFactor-=10,$cash+=($seed-100)*10]]
<<if $menialBioreactors >= 100>>
	[[(x100)|Buy Slaves][$menialBioreactors-=100,$menialDemandFactor-=100,$cash+=($seed-100)*100]]
<</if>>
<</if>>
[[(all)|Buy Slaves][$cash+=$menialBioreactors*($seed-100),$menialDemandFactor-=$menialBioreactors*($seed-100),$menialBioreactors to 0]]
<</if>>
<</if>>


code:
:: Cellblock

<<nobr>>
<<set $nextButton to "Back to Main", $nextLink to "Main", $returnTo to "Cellblock">>

<<if $cellblockName != "the Cellblock">>
	<<set $cellblockNameCaps to $cellblockName.replace("the ", "The ")>>
<</if>>

<<set $cellblockSlaves to 0>>
<<set $notCellblockSlaves to 0>>
<<for _i to 0; _i < $slaves.length; _i++>>
	<<if $slaves[_i].assignment is "be confined in the cellblock">>
		<<set $cellblockSlaves++>>
	<<else>>
		<<set $notCellblockSlaves++>>
	<</if>>
<</for>>

$cellblockNameCaps
<<switch $cellblockDecoration>>
<<case "Roman Revivalist">>
	is designed to resemble the holding pens beneath the old Coliseum. Whenever there's a fight in the arcology, screens in each cell helpfully keep inmates informed of what awaits (otherwise) useless slaves.
<<case "Egyptian Revivalist">>
	uses the climate of Egypt as an additional source of discomfort. The air here is hot and dry, and inmates can easily imagine themselves confined in mud brick cells in a baking desert.
<<case "Edo Revivalist">>
	is furnished in a severely medieval Japanese style. There is one refinement, but it's of exquisite cruelty. At the end of the hall, there's a fountain with a traditional bamboo boar scarer. As it fills with water, it tips against a stone with a thunk... thunk... thunk... thunk...
<<case "Arabian Revivalist">>
	is furnished as imagined Arabian slave pens, all set around a central pillar. This pillar is capped by shackles, so that slaves can be bound by their hands and whipped on the backs, buttocks, and thighs in clear view of all their fellow chattel.
<<case "Chinese Revivalist">>
	is furnished in a severely medieval Chinese style. There is one refinement, but it's of exquisite cruelty. Somewhere out of sight, water is dripping into an urn, drop by drop... drop... drop... drop...
<<case "Chattel Religionist">>
	is built of cold stone. Most of the cells are unfurnished little cubes inside which the only bed is the bare floor. A few are smaller still, so that the inmates can neither stand nor lie flat.
<<case "Degradationist">>
	is a nightmare. Everything is made of metal, and almost everything menaces with spikes of steel. Inmates must carefully avoid the walls of their own cells if they wish to avoid being stabbed.
<<case "Asset Expansionist">>
	is a straightforward prison, with one exception. Each cell features a screen displaying plans for its inmate's expansion. Day and night, inmates are confronted with the sight of themselves transformed.
<<case "Transformation Fetishist">>
	is a straightforward prison, with one exception. Each cell features a screen displaying plans for its inmate's expansion. Day and night, inmates are confronted with the sight of themselves transformed.
<<case "Gender Radicalist">>
	is a straightforward prison, with one exception. Each cell features a screen displaying plans for its inmate's bimbofication. Day and night, inmates are confronted with the sight of themselves dyed, pierced, tattooed, gaped, filled with implants, or all of these.
<<case "Gender Fundamentalist">>
	is a block of barred cells whose sides, offering a clear view of the whole prison, provide much menace. Anyone who abuses an inmate does so in full view of every other slave here, keeping the jailbirds in a state of constant fear that they're next.
<<case "Physical Idealist">>
	is a block of barred cells whose sides, offering a clear view of the whole prison, provide much menace. Anyone who assrapes an inmate does so in full view of every other slave here, keeping the bitches in a state of constant fear that their asses are next.
<<case "Supremacist">>
	is a straightforward prison whose menace is provided by context that, although subtle, adds up to a nightmare. Everyone outside the cells is $arcologies[0].FSSupremacistRace, and everyone inside them is not. The darkness of history is palpable here.
<<case "Subjugationist">>
	is a straightforward prison whose menace is provided by context that, although subtle, adds up to a nightmare. The inmates inside the cells are $arcologies[0].FSSubjugationistRace, and everyone outside them is not. The darkness of history is palpable here.
<<case "Repopulation Focus">>
	is a straightforward prison, with two exceptions. One cell style features a screen displaying plans for its inmate's impregnation, the other is covered with mirrors for its inmate to watch her pregnancy grow. Day and night, inmates are confronted with the sight of themselves transformed.
<<case "Eugenics">>
	is designed to make very clear to its inmates that they are subhuman. Many screens showcasing their inadequacy intermingled with propaganda play on nonstop loops.
<<case "Paternalist">>
	is a prison, but a modern and scientific one. The cells, the common areas, and even the color of the walls are all carefully designed to communicate the feeling that inmates can better themselves.
<<case "Pastoralist">>
	requires its inmates to drink as much breast milk as they can hold. This sounds like a small thing, but for an unbroken slave, conquering the revulsion of drinking another girl's milk is an important step.
<<case "Maturity Preferentialist">>
	is subtly designed to make very clear to its inmates that they are sex objects. Many screens showing pornography make it clear to the maturest girl here that she's still an object of lust, and will be used to slake others' pleasure.
<<case "Youth Preferentialist">>
	is subtly designed to make the breadth of sex acts performed in the arcology clear to its inmates. A cacophony of pornography makes clear to the most innocent inmate that her pussy is a fuck hole, her mouth is a fuck hole, her anus is a fuck hole, and, in fact, all three can be fuck holes at once.
<<case "Body Purist">>
	requires its inmates to drink as much filtered water as they can, all the time. This sounds like a petty thing, but most inmates are very aware that they're being flushed out. Cleaned. It is an oddly menacing thought.
<<case "Slimness Enthusiast">>
	is torture for chubby slaves. Fat bitches that pass through here soon learn that they're going to be slim and pretty one day, but that it isn't going to be much fun getting there.
<<default>>
	could be mistaken for a modern prison. A close inspection, however, reveals restraints in each cell that will hold inmates in sexually compromising positions, and compliance systems to force them to place their wrists and ankles in them.
<</switch>>

<<if $cellblockSlaves > 2>>
	$cellblockNameCaps is full of slaves, though it's difficult to tell at first. The row of cell doors is closed as always, and the soundproofed little rooms let no noise escape. Through each little window, though, a scene of loneliness and misery may be witnessed.
<<elseif $cellblockSlaves > 0>>
	$cellblockNameCaps holds a few slaves, though it's difficult to tell at first. The row of cell doors is closed as always, and the soundproofed little rooms let no noise escape. Through several of the little windows, though, a scene of loneliness and misery may be witnessed.
<<elseif $Wardeness != 0>>
	$Wardeness.slaveName is alone in the cellblock, and seems rather lonely without anyone to oppress.
<<else>>
	None of your slaves are confined in the cellblock. [[Decommission the cellblock|Main][$cellblock to 0, $cellblockDecoration to "standard"]]
<</if>>

$cellblockNameCaps has room for $cellblock slaves to be kept in close confinement.
[[Expand the cellblock|Cellblock][$cash -=  Math.trunc($cellblock*1000*$upgradeMultiplierArcology), $cellblock += 5]] //Costs ¤<<print Math.trunc($cellblock*1000*$upgradeMultiplierArcology)>>//

<<if $cellblockUpgrade == 1>>
	Its compliance systems have been upgraded to allow slaves no mental respite, painstakingly correcting the tiniest misbehaviors to soften flaws into quirks at the cost of considerable anguish to inmates denied any rest from correction.
<<else>>
	Its compliance systems are standard. [[Upgrade them to soften slave flaws|Cellblock][$cash -= 20000, $cellblockUpgrade to 1]] //Costs ¤20000//
<</if>>

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

<<if $cellblockSlaves > 0>>

''Let a slave out of the cellblock:''
	<<set $Flag to 1>>
	<<include "Slave Summary">>
<</if>>

<<if $notCellblockSlaves > 0>>

''Send a resistant slave to be broken in the cellblock:''
	<<set $Flag to 0>>
	<<include "Slave Summary">>
<</if>>
<<unset $Flag>>

Rename $cellblockName: <<textbox "$cellblockName" $cellblockName "Cellblock">> //Use a noun or similar short phrase//
<</nobr>>


code:
:: Cellblock Report [nobr]

<<set $cellblockSlaves = 0, _brokenSlaves = 0, _devBonus = 0, _idleBonus = 0, _softenedQuirks = 0, _trustMalis = 0, _wardenessFetish = 0, _SL = $slaves.length, _WDS = -1>>

/% No need to be in for loop %/
<<if $cellblockDecoration != "standard">>
	<<set _devBonus++>>
<</if>>

<<if ($Wardeness != 0)>>
<<for _WDS = 0; _WDS < _SL; _WDS++>>
<<if ($slaves[_WDS].ID == $Wardeness.ID)>>
	<<break>>
<</if>>
<</for>>
<</if>>

<<if _WDS > -1>>
	<<if ($slaves[_WDS].health < -80)>>
	<<set $slaves[_WDS].health += 20>>
	<<elseif ($slaves[_WDS].health < -40)>>
	<<set $slaves[_WDS].health += 15>>
	<<elseif ($slaves[_WDS].health < 0)>>
	<<set $slaves[_WDS].health += 10>>
	<<elseif ($slaves[_WDS].health < 90)>>
	<<set $slaves[_WDS].health += 7>>
	<</if>>
	<<if ($slaves[_WDS].devotion <= 60)>>
	<<set $slaves[_WDS].devotion += 2>>
	<</if>>
	<<set $slaves[_WDS].devotion += _devBonus>>
	<<if $slaves[_WDS].trust < 60>>
	<<set $slaves[_WDS].trust += 3>>
	<</if>>
	<<if $slaves[_WDS].fetishStrength <= 95>>
	<<if $slaves[_WDS].fetish != "sadist">>
		<<fetishChangeChance $slaves[_WDS]>>
		<<if $fetishChangeChance > random(0,100)>>
			<<set _wardenessFetish = 1, $slaves[_WDS].fetishKnown = 1, $slaves[_WDS].fetish = "sadist">>
		<</if>>
	<<elseif $slaves[_WDS].fetishKnown == 0>>
		<<set _wardenessFetish = 1, $slaves[_WDS].fetishKnown = 1>>
	<<else>>
		<<set _wardenessFetish = 2, $slaves[_WDS].fetishStrength += 4>>
	<</if>>
	<</if>>
	<<set $Wardeness = $slaves[_WDS]>>
	<<if $wardenessCareers.contains($Wardeness.career)>>
		<<set _devBonus++, _trustMalis++, _idleBonus++>>
	<</if>>
	<<if ($Wardeness.energy > 95) || ($Wardeness.fetish == "sadist")>>
		<<set _devBonus++, _trustMalis++, _idleBonus++>>
	<</if>>
	<<if $Wardeness.sexualFlaw == "malicious">>
		<<set _devBonus++, _trustMalis += 2, _idleBonus += 2>>
	<</if>>
	<<if ($Wardeness.muscles > 35)>>
		<<set _devBonus++, _trustMalis++, _idleBonus++>>
	<</if>>
	<<if $Wardeness.relationship == -3>>
		<<set _devBonus++, _trustMalis++, _idleBonus++>>
	<</if>>
	<<if ($Wardeness.devotion > 95)>>
		<<set _devBonus++, _trustMalis++, _idleBonus++>>
	<</if>>
	<<if ($Wardeness.dick > 2) && (canPenetrate($Wardeness))>>
		<<set _devBonus++, _trustMalis++, _idleBonus++>>
	<</if>>
	    $Wardeness.slaveName is serving as the wardeness.<<if $Wardeness.relationship == -3>> As your wife, she tries her best to break the disobedient slaves to your will.<</if>>
	<<if (_wardenessFetish == 1)>>
		One day she demands obedience. The next day she strikes a slave when it isn't given. The next, she seems more excited than embarrassed when beating a prisoner. Soon, she's looking for an excuse to punish. She's @@color:pink;become more of a sadist.@@
	<<elseif (_wardenessFetish == 2)>>
		Being not only allowed but encouraged to get off while punishing prisoners @@color:lightsalmon;deepens her sadism.@@
	<</if>>
	<<if $wardenessCareers.contains($Wardeness.career)>>
		She has experience with detecting security issues and grinding down potential miscreants from her life before she was a slave, making her more effective.
	<</if>>
	<<if $Wardeness.fetish == "sadist">>
		She uses the prisoners to gratify her sadism, terrifying them and quickly breaking their resistance.
	<<elseif $Wardeness.energy > 95>>
		She is so sexually depraved that she constantly molests the prisoners, breaking them to a life of servitude.
	<</if>>
	<<if $Wardeness.sexualFlaw == "malicious">>
		Sexual abuse of prisoners has become an end for her, not a means. She inspires her prisoners to do everything possible to qualify to get away from her, even as she slowly grinds away their interest in sex to do it.
	<</if>>
	<<if ($Wardeness.dick > 2) && (canPenetrate($Wardeness))>>
		Her molestation of the prisoners is more varied and effective because she has a dick to fuck them with.
	<</if>>
	<<if ($Wardeness.muscles > 35)>>
		She is strong enough to restrain anyone that tries anything with her own hands.
	<</if>>
	<<if ($Wardeness.devotion > 95)>>
		Her devotion to you is so absolute that she sees breaking bitches for your service as a noble calling.
	<</if>>
<</if>>

<<for _i = 0; _i < _SL; _i++>>
	<<if ($slaves[_i].assignment != "be confined in the cellblock")>><<continue>><</if>>
	<<set $cellblockSlaves++>>
	<<if ($slaves[_i].devotion <= 20)>>
	<<if ($slaves[_i].trust > -20)>>
		<<set $slaves[_i].devotion -= 4, $slaves[_i].trust -= 4>>
	<<else>>
		<<set $slaves[_i].devotion++>>
	<</if>>
	<</if>>
	<<if $cellblockUpgrade == 1>>
	<<if ($slaves[_i].behavioralFlaw != "none") && ($slaves[_i].behavioralQuirk == "none")>>
		<<switch $slaves[_i].behavioralFlaw>>
		<<case "arrogant">>
			<<set $slaves[_i].behavioralQuirk = "confident", _softenedQuirks++>>
		<<case "bitchy">>
			<<set $slaves[_i].behavioralQuirk = "cutting", _softenedQuirks++>>
		<<case "odd">>
			<<set $slaves[_i].behavioralQuirk = "funny", _softenedQuirks++>>
		<<case "hates men">>
			<<set $slaves[_i].behavioralQuirk = "adores women", _softenedQuirks++>>
		<<case "hates women">>
			<<set $slaves[_i].behavioralQuirk = "adores men", _softenedQuirks++>>
		<<case "gluttonous">>
			<<set $slaves[_i].behavioralQuirk = "fitness", _softenedQuirks++>>
		<<case "anorexic">>
			<<set $slaves[_i].behavioralQuirk = "insecure", _softenedQuirks++>>
		<<case "devout">>
			<<set $slaves[_i].behavioralQuirk = "sinful", _softenedQuirks++>>
		<<case "liberated">>
			<<set $slaves[_i].behavioralQuirk = "advocate", _softenedQuirks++>>
		<</switch>>
		<<set $slaves[_i].behavioralFlaw to "none", $slaves[_i].devotion -= 10>>
	<<elseif ($slaves[_i].sexualFlaw != "none") && ($slaves[_i].sexualQuirk == "none")>>
		<<switch $slaves[_i].sexualFlaw>>
		<<case "hates oral">>
			<<set $slaves[_i].sexualQuirk = "gagfuck queen", _softenedQuirks++>>
		<<case "hates anal">>
			<<set $slaves[_i].sexualQuirk = "painal queen", _softenedQuirks++>>
		<<case "hates penetration">>
			<<set $slaves[_i].sexualQuirk = "strugglefuck queen", _softenedQuirks++>>
		<<case "shamefast">>
			<<set $slaves[_i].sexualQuirk = "tease", _softenedQuirks++>>
		<<case "idealistic">>
			<<set $slaves[_i].sexualQuirk = "romantic", _softenedQuirks++>>
		<<case "repressed">>
			<<set $slaves[_i].sexualQuirk = "perverted", _softenedQuirks++>>
		<<case "apathetic">>
			<<set $slaves[_i].sexualQuirk = "caring", _softenedQuirks++>>
		<<case "crude">>
			<<set $slaves[_i].sexualQuirk = "unflinching", _softenedQuirks++>>
		<<case "judgemental">>
			<<set $slaves[_i].sexualQuirk = "size queen", _softenedQuirks++>>
		<</switch>>
		<<set $slaves[_i].sexualFlaw = "none", $slaves[_i].devotion -= 10>>
	<</if>>
	<</if>>
	<<set $slaves[_i].devotion += _devBonus, $slaves[_i].trust -= _trustMalis>>
	<<if ($Wardeness != 0)>>
		<<if ($Wardeness.sexualFlaw == "malicious") && ($slaves[_i].energy >= 2)>>
			<<set $slaves[_i].energy -= 2>>
		<</if>>
	<</if>>
	<<if ($slaves[_i].health < -80)>>
	<<set $slaves[_i].health += 20>>
	<<elseif ($slaves[_i].health < -40)>>
	<<set $slaves[_i].health += 15>>
	<<elseif ($slaves[_i].health < 0)>>
	<<set $slaves[_i].health += 10>>
	<<elseif ($slaves[_i].health < 40)>>
	<<set $slaves[_i].health += 7>>
	<<elseif ($slaves[_i].health < 100)>>
	<<set $slaves[_i].health += 3>>
	<</if>>
	<<if ($slaves[_i].devotion > 20) || (($slaves[_i].devotion >= -20) && ($slaves[_i].trust < -20)) || (($slaves[_i].devotion >= -50) && ($slaves[_i].trust < -50))>>
		<<set $slaves[_i].assignment = "rest", $slaves[_i].assignmentVisible = 1, _brokenSlaves++, $cellblockSlaves-->>
	<</if>>
	<<if _WDS > -1>>
	<<if $familyTesting == 1>>
		<<if $slaves[_i].mother == $Wardeness.ID>>
			She spares no mercy for her daughter, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<</if>>
		<<if $slaves[_i].father == $Wardeness.ID>>
			She spares no mercy for her daughter, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<</if>>
		<<if $slaves[_i].ID == $Wardeness.father>>
			She spares no mercy for her father, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<</if>>
		<<if $slaves[_i].ID == $Wardeness.mother>>
			She spares no mercy for her mother, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<</if>>
		<<if areSisters($slaves[_i], $Wardeness) == 1>>
			She spares no mercy for her twin, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<<elseif areSisters($slaves[_i], $Wardeness) == 2>>
			She spares no mercy for her sister, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<<elseif areSisters($slaves[_i], $Wardeness) == 3>>
			She spares no mercy for her half-sister, $slaves[_i].slaveName, making sure she understands her place.
			<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
		<</if>>
	<<else>>
	<<if $Wardeness.relationTarget == $slaves[_i].ID>>
		She spares no mercy for her $slaves[_i].relation, $slaves[_i].slaveName, making sure she understands her place.
		<<set $slaves[_i].devotion++, $slaves[_i].trust-->>
	<</if>>
	<</if>> /*closes extended family mode*/
	<<if $Wardeness.relationshipTarget == $slaves[_i].ID>>
		She hates having to break her <<if $Wardeness.relationship == 1>>friend<<elseif $Wardeness.relationship == 2>>best friend<<elseif $Wardeness.relationship == 3>>friend with benefits<<elseif $Wardeness.relationship == 4>>lover<<elseif $Wardeness.relationship == 5>>slave wife<</if>>, $slaves[_i].slaveName, but her devotion to you wins out in the end.
		<<set $slaves[_i].devotion++, $slaves[_i].trust -= 3>>
		<<if random(1,100) >= 50>>
		Her and $slaves[_i].slaveName's relationship has been shattered by these events.
			<<set $Wardeness.relationship = 0, $Wardeness.relationshipTarget = 0, $slaves[_WDS].relationship = 0, $slaves[_WDS].relationshipTarget = 0, $slaves[_i].relationship = 0, $slaves[_i].relationshipTarget = 0>>
		<</if>>
	<</if>>
	<<if $Wardeness.rivalryTarget == $slaves[_i].ID>>
		She greatly enjoys breaking her <<if $Wardeness.rivalry == 1>>growing rival<<elseif $Wardeness.rivalry == 2>>rival<<elseif $Wardeness.rivalry >= 3>>bitter rival<</if>>, $slaves[_i].slaveName's will.
		<<set $slaves[_i].devotion++, $slaves[_i].trust -= 3>>
		<<if random(1,100) > 30>>
			<<set $Wardeness.rivalry++, $slaves[_WDS].rivalry++, $slaves[_i].rivalry++>>
		<</if>>
	<</if>>
	<</if>>
<</for>>

<<if ($cellblockSlaves < $cellblock) && (_WDS > -1)>>
	<<set _seed to random(1,10)+(($cellblock-$cellblockSlaves)*(random(150,170)+(_idleBonus*10)))>>
	<<set $cash += _seed>>

    Since she doesn't have enough prisoners to manage to keep her busy, she works on citizens' slaves, earning @@color:yellowgreen;¤_seed.@@

<</if>>

<<if ($cellblockSlaves > 0)>>
	<<if $seeImages == 1>>
<</if>>
	    <<if ($cellblockSlaves == 1)>>''One slave is being confined in $cellblockName until she is willing to obey.''<<else>>''$cellblockSlaves slaves are being confined in $cellblockName until they are willing to obey.''<</if>>

	<<if (_softenedQuirks > 0)>>
	<<if (_softenedQuirks == 1)>>
		$cellblockName's advanced compliance systems successfully softened one slave's mental flaw into an @@color:green;appealing quirk,@@ though the constant correction caused her @@color:mediumorchid;considerable anguish.@@
	<<else>>
		$cellblockName's advanced compliance systems successfully softened _softenedQuirks slaves' mental flaws into @@color:green;appealing quirks,@@ though the constant correction caused them @@color:mediumorchid;considerable anguish.@@
	<</if>>
	<</if>>
	<<if (_brokenSlaves > 0)>>
	<<if (_brokenSlaves == 1)>>
		One slave is now willing to @@color:hotpink;do as she's told@@ and has been released.
	<<else>>
		_brokenSlaves slaves are now willing to @@color:hotpink;do as they're told@@ and have been released.
	<</if>>
	<<if $cellblockDecoration != "standard">>
		$cellblockNameCaps's $cellblockDecoration atmosphere @@color:hotpink;had an impact on <<if _brokenSlaves == 1>>her while she<<else>>them while they<</if>>@@ were imprisoned.
	<</if>>
	<</if>>
<</if>>

<<if _WDS > -1>>
	<<set $i = _WDS>>

''__@@color:pink;$slaves[$i].slaveName@@__'' is serving as the Wardeness in $cellblockName.
	<<if $showEWD == 0>>
		<<silently>>
		<<if $slaves[$i].choosesOwnClothes == 1>>
		<<include "SA chooses own clothes">>
		<<if ($slaves[$i].devotion <= 20)>>
			<<set $slaves[$i].devotion -= 5>>
		<<else>>
			<<set $slaves[$i].devotion += 1>>
		<</if>>
		<</if>>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<<else>>
		/* 000-250-006 */
		/* <<if $seeImages == 1>><<SlaveArt $slaves[_WDS] 0 0>><</if>> */
		<<if $seeImages == 1 && $imageChoice == 0>>

		    <<SlaveArt $slaves[_WDS] 0 0>>

		<</if>>
		/* 000-250-006 */

		<<if $slaves[$i].choosesOwnClothes == 1>>
		<<include "SA chooses own clothes">>
		<<if ($slaves[$i].devotion <= 20)>>
			<<set $slaves[$i].devotion -= 5>>
		<<else>>
			<<set $slaves[$i].devotion += 1>>
		<</if>>
		<</if>>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>

<<include "SA devotion">>

	<</if>>
	<<set $Wardeness = $slaves[_WDS]>>
<</if>>

<<if ($cellblockSlaves > 0)>>
	<<if _WDS == -1>>

	 <</if>>
	<<for $i = 0; $i < _SL; $i++>>
	<<if ($slaves[$i].assignment != "be confined in the cellblock")>><<continue>><</if>>
	<<if $showEWD == 0>>
		''__@@color:pink;$slaves[$i].slaveName@@__'' is confined in $cellblockName.

		<<silently>>
		<<include "SA stay confined">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<<else>>
		/* 000-250-006 */
		/* <<if $seeImages == 1>><<SlaveArt $slaves[$i] 0 0>><</if>> */
		<<if $seeImages == 1 && $imageChoice == 0>>

		    <<SlaveArt $slaves[$i] 0 0>>

		<</if>>
		/* 000-250-006 */
		''__@@color:pink;$slaves[$i].slaveName@@__'' is confined in $cellblockName.

		    She<<include "SA stay confined">>

    <<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>

<<include "SA devotion">>

	<</if>>
	<</for>>
<<else>>
	''$cellblockNameCaps is empty''<<if _WDS > -1>> except for the wardeness<</if>>.

<</if>>


code:
:: Change Language

<<nobr>>

<<set $nextButton to "Confirm changes">>
<<set $nextLink to "Manage Arcology">>

<<set $revivalistLanguage to 0>>
<<if $arcologies[0].FSRomanRevivalist != "unset">>
	<<if $language != "Latin">>
	<<set $revivalistLanguage to "Latin">>
	<</if>>
<<elseif $arcologies[0].FSEgyptianRevivalist != "unset">>
	<<if $language != "Ancient Egyptian">>
	<<set $revivalistLanguage to "Ancient Egyptian">>
	<</if>>
<<elseif $arcologies[0].FSEdoRevivalist != "unset">>
	<<if $language != "Japanese">>
	<<set $revivalistLanguage to "Japanese">>
	<</if>>
<<elseif $arcologies[0].FSArabianRevivalist != "unset">>
	<<if $language != "Arabic">>
	<<set $revivalistLanguage to "Arabic">>
	<</if>>
<<elseif $arcologies[0].FSChineseRevivalist != "unset">>
	<<if $language != "Chinese">>
	<<set $revivalistLanguage to "Chinese">>
	<</if>>
<</if>>

The lingua franca of the arcology is ''$language''.

//Changing the lingua franca of the arcology is a difficult process. Doing so will slightly reduce the arcology's prosperity due to the difficulty changing languages will impose on businesses. It will also cost ¤500 for each mentally competent slave you own, since it will be necessary to build time into their schedules for them to learn basic commands in the new language. Slaves' starting fluency in the new language will depend on their intelligence, nationality, education, and in some cases, ethnicity. Previous linguistic experience will not be saved, meaning that repeated language changes will wipe out slaves' previous language skills.//

Select a custom language to be applied: <<textbox "$seed" $seed "Change Language">> //A single capitalized word is recommended.//

<</nobr>>\
\

<<nobr>>

<<if $language != "English">>

<<link "English">>
	<<replace "#result">>
	<<set $language to "English">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>>
<</if>>
<<if $language != "Spanish">>

<<link "Spanish">>
	<<replace "#result">>
	<<set $language to "Spanish">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>>
<</if>>
<<if $language != "Portuguese">>

<<link "Portuguese">>
	<<replace "#result">>
	<<set $language to "Portuguese">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>>
<</if>>
<<if $language != "Arabic">>

<<link "Arabic">>
	<<replace "#result">>
	<<set $language to "Arabic">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>>
<</if>>
<<if $language != "Chinese">>

<<link "Chinese">>
	<<replace "#result">>
	<<set $language to "Chinese">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>>
<</if>>
<<if $language != $seed>>

<<link "Apply custom language">>
	<<replace "#result">>
	<<set $language to $seed>>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>>
<</if>>
<<if $revivalistLanguage != 0>>

<<link "Match language to Revivalist future society">>
	<<replace "#result">>
	<<set $language to $revivalistLanguage>>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i to 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].fetish != "mindbroken">>
			<<NationalityToAccent $slaves[$i]>>
			<<if ($slaves[$i].intelligenceImplant == 1)>>
			<<if ($slaves[$i].accent >= 3)>>
			<<if (3+$slaves[$i].intelligence) > random(0,6)>>
				<<set $slaves[$i].accent -= 1>>
			<</if>>
			<</if>>
			<</if>>
			<<set $cash -= 500>>
		<</if>>
	<</for>>

//Language changed.//
	<</replace>>
	<</link>> //Failing to take this step will retard adoption of Revivalism//
<</if>>

<</nobr>>


code:
:: Check Auto Rules Activate

<<nobr>>

<<if (ndef $activeSlave.currentRules) || ($activeSlave.currentRules.length < 1)>>
	<<set $activeSlave.currentRules to []>>
<</if>>

<<for _r to 0; _r < $defaultRules.length; _r++>>
<<set _currentRule to $defaultRules[_r]>>
<<set _rule to _r+1>>

<<if (def _currentRule.excludedSlaves) && (_currentRule.excludedSlaves.length > 0)>>
	<<if ruleSlaveExcluded($activeSlave, _currentRule)>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.selectedSlaves) && (_currentRule.selectedSlaves.length > 0)>>
	<<if !ruleSlaveSelected($activeSlave, _currentRule)>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.facility) && (_currentRule.facility.length > 0)>>
	<<if !ruleAppliedToSlaveFacility(_currentRule, $activeSlave)>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.excludeFacility) && (_currentRule.excludeFacility.length > 0)>>
	<<if ruleExcludeSlaveFacility(_currentRule, $activeSlave)>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<if (def _currentRule.assignment) && (_currentRule.assignment.length > 0)>>
	<<if !ruleAssignment(_currentRule.assignment, $activeSlave.assignment)>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>
<<if (def _currentRule.excludeAssignment) && (_currentRule.excludeAssignment.length > 0)>>
	<<if ruleAssignment(_currentRule.excludeAssignment, $activeSlave.assignment)>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
		<<continue>>
	<</if>>
<</if>>

<<switch _currentRule.activation>>
<<case "custom">>	/* for betterRA */
	<<set _isActive to parseAndEvaluate(_currentRule.customActivationText, $activeSlave)>>
	<<if _isActive>>
    	<<if !ruleApplied($activeSlave, _currentRule.ID)>>
        	<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
    	<</if>>
	<<else>>
    	<<if ruleApplied($activeSlave, _currentRule.ID)>>
        	<<RARemoveRule>>
    	<</if>>
	<</if>>
<<case "always">>
	<<if !ruleApplied($activeSlave, _currentRule.ID)>>
		<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
	<</if>>
<<case "none">>
	<<if ruleApplied($activeSlave, _currentRule.ID)>>
		<<RARemoveRule>>
	<</if>>
<<case "devotion">>
	<<if checkThresholds($activeSlave.devotion, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "trust">>
	<<if checkThresholds($activeSlave.trust, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "health">>
	<<if ($activeSlave.assignment is "live with your Head Girl") && ($activeSlave.health <= 100)>>
		<<if checkThresholds($activeSlave.health, _currentRule)>>
			<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
			<</if>>
		<<else>>
			<<if ruleApplied($activeSlave, _currentRule.ID)>>
				<<RARemoveRule>>
			<</if>>
		<</if>>
	<<elseif $activeSlave.health <= 90>>
		<<if checkThresholds($activeSlave.health, _currentRule)>>
			<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
			<</if>>
		<<else>>
			<<if ruleApplied($activeSlave, _currentRule.ID)>>
				<<RARemoveRule>>
			<</if>>
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "sex drive">>
	<<if checkThresholds($activeSlave.energy, _currentRule)>>
		<<if ($activeSlave.attrKnown == 1) and (ruleApplied($activeSlave, _currentRule.ID) == false)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "age">>
	<<if checkThresholds($activeSlave.physicalAge, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "weight">>
	<<if checkThresholds($activeSlave.weight, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>

Rule _rule (_currentRule.name) is now applying to $activeSlave.slaveName.
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<RARemoveRule>>
		<</if>>
	<</if>>
<<case "lactation">>
	<<if checkThresholds($activeSlave.lactation, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $dump to $activeSlave.currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<<case "pregnancy week">>
	<<if checkThresholds($activeSlave.preg, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $dump to $activeSlave.currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<<case "pregnancy foetuses">>
	<<if (checkThresholds($activeSlave.pregType, _currentRule) && $activeSlave.preg > 10)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $dump to $activeSlave.currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<<case "belly implant volume">>
	<<if checkThresholds($activeSlave.bellyImplant, _currentRule)>>
		<<if !ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $activeSlave.currentRules.push(_currentRule.ID)>>
		<</if>>
	<<else>>
		<<if ruleApplied($activeSlave, _currentRule.ID)>>
			<<set $dump to $activeSlave.currentRules.pluck([_r])>>
			<<include "Rules Facility Remove">>
			<<continue>>
		<</if>>
	<</if>>
<</switch>>
<</for>>

<<set $activeSlave.currentRules to  $activeSlave.currentRules.sort(function(a, b) { return a-b; });>>

<</nobr>>


code:
:: Checkin Checks [nobr]

<<if $activeSlave.dick > 0>>
	<<if $activeSlave.balls > 0>>
	<<if $activeSlave.devotion <= 50>>
	<<if ($activeSlave.fetish != "buttslut") || ($activeSlave.fetishKnown != 1)>>
	<<if $activeSlave.sexualFlaw != "hates women">>
	<<set $REFeminizationCheckinIDs.push($activeSlave.ID)>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
<</if>>

<<if $activeSlave.physicalAge > 35>>
	<<if $activeSlave.face < 2>>
	<<if $activeSlave.analSkill <= 30>>
	<<set $REMILFCheckinIDs.push($activeSlave.ID)>>
	<</if>>
	<</if>>
<</if>>

<<if $activeSlave.attrXY <= 60>>
	<<if $activeSlave.attrXX > 0>>
		<<set $REOrientationCheckinIDs.push($activeSlave.ID)>>
	<</if>>
<</if>>

<<if $activeSlave.face < 0>>
	<<set $REUglyCheckinIDs.push($activeSlave.ID)>>
<</if>>

<<if $activeSlave.anus < 2>>
	<<set $REButtholeCheckinIDs.push($activeSlave.ID)>>
<</if>>

<<if $activeSlave.boobs < 800>>
	<<set $REReductionCheckinIDs.push($activeSlave.ID)>>
<</if>>


code:
:: Classes Workaround

<<set $activeSlave.assignment to "take classes">>
<<set $activeSlave.choosesOwnAssignment to 0>>
<<for $i to 0; $i < $slaves.length; $i++>>
	<<if $activeSlave.ID == $slaves[$i].ID>>
	<<set $slaves[$i] to $activeSlave>>
	<<break>>
	<</if>>
<</for>>

<<goto "Main">>


code:
:: Clinic

<<nobr>>
<<set $nextButton to "Back to Main", $nextLink to "Main", $returnTo to "Clinic">>

<<if $clinicName != "the Clinic">>
	<<set $clinicNameCaps to $clinicName.replace("the ", "The ")>>
<</if>>

<<set $clinicSlaves to 0>>
<<set $notClinicSlaves to 0>>
<<for _i to 0; _i < $slaves.length; _i++>>
	<<if $slaves[_i].assignment is "get treatment in the clinic">>
		<<set $clinicSlaves++>>
		<<if $clinicSpeedGestation == 1>>
			<<if $slaves[_i].preg > 0>>
				<<set $slaves[_i].pregControl = "speed up">>
			<</if>>
		<</if>>
	<<else>>
		<<set $notClinicSlaves++>>
	<</if>>
<</for>>

<<for _i to 0; _i < $slaves.length; _i++>>
	<<if $slaves[_i].preg is "get treatment in the clinic">>
		<<set $clinicSlaves++>>
	<<else>>
		<<set $notClinicSlaves++>>
	<</if>>
<</for>>

$clinicNameCaps
<<switch $clinicDecoration>>
<<case "Roman Revivalist">>
	is open and airy; a breeze wafts through the space, and Roman theories on natural cleanliness are very much on display.
<<case "Egyptian Revivalist">>
	is open and airy; clean rushes are strewn across the floor, making a gentle susurration when anyone crosses the space.
<<case "Edo Revivalist">>
	is clean and spartan to the point of featurelessness. Spotless tatami mats cover the floor, and partitions divide the space into cubicles.
<<case "Arabian Revivalist">>
	is open and airy; a thin trail of smoke wafts through the space on a gentle breeze, coming from a brazier burning incense.
<<case "Chinese Revivalist">>
	is open and airy; a thin trail of smoke wafts through the space on a gentle breeze, coming from a brazier burning medicinal herbs.
<<case "Chattel Religionist">>
	is open and airy; shaded beams of sunlight shine through skylights to bathe each bed in a pool of healing warmth.
<<case "Degradationist">>
	is clean and cold, all scrubbed tile and cool steel. The beds have prominent restraint attachment points to force patients into any position desired.
<<case "Repopulation Focus">>
	is warm and inviting, with wide corridors and ample seating for its pregnant clientele. All the equipement is designed to accommodate heavily pregnant women.
<<case "Eugenics">>
	is warm and inviting on one side, cold and utilitarian on the other. Only the toys of the elite are allowed the best of care.
<<case "Asset Expansionist">>
	is utilitarian, without any concession to style. Every available centimeter of space is used for equipment specialized to support growth.
<<case "Transformation Fetishist">>
	is utilitarian, without any concession to style. Every available centimeter of space is used for equipment specialized to support radical surgery.
<<case "Gender Radicalist">>
	is comfortable and feminine. Its curving walls and soft colors are designed to present slaves coming out of anaesthesia with an impression of girlishness.
<<case "Gender Fundamentalist">>
	is comfortable and feminine. Its curving walls and soft colors are designed to keep slaves here for their female health nice and comfortable.
<<case "Physical Idealist">>
	is utilitarian, without any concession to style. Every available centimeter of space is used for some piece of equipment useful in making the human body faster or stronger.
<<case "Supremacist">>
	is clean and cold, all scrubbed tile and cool steel. The only hint of its radical uses are the pseudoscientific racialist charts on the walls.
<<case "Subjugationist">>
	is clean and cold, all scrubbed tile and cool steel. The only hint of its radical uses are the pseudoscientific racialist charts on the walls.
<<case "Paternalist">>
	is warm and inviting, with curved walls and warm colors designed to put patients at their ease. Each bed is well provided with entertainment options.
<<case "Pastoralist">>
	is utilitarian, without any concession to style. Every available centimeter of space is used for equipment specialized for human veterinary medicine.
<<case "Maturity Preferentialist">>
	is comfortable and soothing, with curved walls and cool colors designed to keep patients relaxed. Each bed is provided with refined yet invariably pornographic entertainment options.
<<case "Youth Preferentialist">>
	is bright and cheerful, with curved walls and pastel colors designed to keep patients in good spirits. Each bed is provided with light entertainment options.
<<case "Body Purist">>
	is utilitarian, without any concession to style. Every available centimeter of space is filled with equipment designed to make medicine as low-impact as possible.
<<case "Slimness Enthusiast">>
	is warm and inviting, with curved walls and warm colors designed to put patients at their ease. Each bed is well provided with entertainment options.
<<default>>
	is a well-equipped modern medical facility. Each patient has her own area, with heavy automation to provide her treatment without any human intervention at all.
<</switch>>

<<if $clinicSlaves > 2>>
	$clinicNameCaps is busy. Patients occupy many of the beds; most are alert, but a few are dozing under medication designed to promote healing through deep rest.
<<elseif $clinicSlaves > 0>>
	$clinicNameCaps is sparsely populated. Patients occupy a few of the beds; most are alert, but a few are dozing under medication designed to promote healing through deep rest.
<<elseif $Nurse != 0>>
	$Nurse.slaveName is alone in the clinic, and has nothing to do but keep the place spotlessly clean and ready for its next patients.
<<else>>
	$clinicNameCaps is empty and quiet. [[Decommission the Clinic|Main][$clinic to 0, $clinicDecoration to "standard"]]
<</if>>

$clinicNameCaps has room to support $clinic slaves while they receive treatment.
[[Expand the clinic|Clinic][$cash -=  Math.trunc($clinic*1000*$upgradeMultiplierArcology), $clinic += 5]] //Costs ¤<<print Math.trunc($clinic*1000*$upgradeMultiplierArcology)>>//

<<if $clinicUpgradeScanner == 1>>
	$clinicNameCaps's scanners have been upgraded with a sampling system that can estimate carcinogenic damage to a slave's genome.
<<else>>
	It mounts powerful medical scanning technology. [[Upgrade the scanners to help detect genomic damage|Clinic][$cash -=  Math.trunc(10000*$upgradeMultiplierArcology), $clinicUpgradeScanner to 1]] //Costs ¤<<print Math.trunc(10000*$upgradeMultiplierArcology)>>//
<</if>>

<<if $clinicUpgradeFilters == 1>>
	<<if $clinicUpgradePurge == 1>>
		The entire floor beneath $clinicName is occupied by a huge filtration plant that constantly cycles out the patients' blood to remove impurities. The blood is intensely cleaned to greatly decrease the presence of impurities at the cost of compatability. Patients will likely be ill for the duration of the treatment.
	<<else>>
		The entire floor beneath $clinicName is occupied by a huge filtration plant that constantly cycles out the patients' blood to remove impurities. [[Increase the effectiveness of the impurity purging|Clinic][$cash -= Math.trunc(150000*$upgradeMultiplierArcology), $clinicUpgradePurge to 1]] //Costs ¤<<print Math.trunc(150000*$upgradeMultiplierArcology)>> and may cause health problems in slaves//
	<</if>>
<<else>>
	It includes standard dialysis equipment. [[Install advanced blood treatment equipment to help address drug side effects|Clinic][$cash -= Math.trunc(50000*$upgradeMultiplierArcology), $clinicUpgradeFilters to 1]] //Costs ¤<<print Math.trunc(50000*$upgradeMultiplierArcology)>>//
<</if>>

<<if $bellyImplants == 1 && $clinicInflateBelly == 1>>
	$clinicNameCaps is useful for keeping slaves healthy during long term procedures. Slaves in $clinicName with inflantable belly implants will be filled during their time under $Nurse.slaveName's supervision to maximize growth with minimized health complications. [[Do not fill belly implants|Clinic][$clinicInflateBelly = 0]]
<<elseif $bellyImplants == 1 && $Nurse == 0>>
	A resident nurse could be used to safely regulate the rate a slave's fillable belly implant for maximum size with minimum health loss.
<<elseif $bellyImplants == 1 && $Nurse != 0 && $clinicInflateBelly != 1>>
	$clinicNameCaps is useful for keeping slaves healthy during long term procedures. $Nurse.slaveName can supervise weekly filling regiments for clinic slaves with fillable belly implants during their stay to maximize growth with minimal health complications. [[Fill belly implants|Clinic][$clinicInflateBelly = 1]]
<</if>>

<<if $pregSpeedControl == 1 && $clinicSpeedGestation == 1>>
	It's exceedingly dangerous to speed up gestation without constant supervision. In $clinicName, $Nurse.slaveName will monitor slaves on rapid gestation agents; making sure the growing patients' food demands are met, monitoring their skin and womb and, if need be, perform an emergency c-section should the need arise. [[Limit rapid gestation agents to slected slaves only|Clinic][$clinicSpeedGestation = 0]]
<<elseif $pregSpeedControl == 1 && $Nurse == 0>>
	A resident nurse could be used to supervise patients under rapid gestation agents while minimizing strain and health complications.
<<elseif $pregSpeedControl == 1 && $Nurse != 0 && $clinicSpeedGestation != 1>>
	$clinicNameCaps is currently not applying rapid gestation agents to pregnant patients. Only individually selected slaves will undergo this procedure [[Speed up gestation for all pregnant patients|Clinic][$clinicSpeedGestation = 1]]
<</if>>

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

<<if $clinicSlaves > 0>>

''Take a slave out of the clinic:''
	<<set $Flag to 1>>
	<<include "Slave Summary">>
<</if>>

<<if $notClinicSlaves > 0>>

''Send a slave to get treatment in the clinic:''
	<<set $Flag to 0>>
	<<include "Slave Summary">>
<</if>>
<<unset $Flag>>

Rename $clinicName: <<textbox "$clinicName" $clinicName "Clinic">> //Use a noun or similar short phrase//
<</nobr>>