code:
:: Brothel Advertisement

<<nobr>>

<<switch $brothelDecoration>>
<<case "Roman Revivalist">>
	$brothelNameCaps is decorated as a Roman whorehouse. Refreshments are served at a bar, and someone is playing pipes in the back.
<<case "Aztec Revivalist">>
	$brothelNameCaps is decorated as an Aztec ode to fertility and nature. Clients may sacrifice a bit of blood to honor the goddess of Filth or to partake in a fertility ritual before joining the girl of their choosing.
<<case "Egyptian Revivalist">>
	$brothelNameCaps 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.
<<case "Edo Revivalist">>
	$brothelNameCaps 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.
<<case "Arabian Revivalist">>
	$brothelNameCaps 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.
<<case "Chinese Revivalist">>
	$brothelNameCaps 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.
<<case "Chattel Religionist">>
	$brothelNameCaps 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.
<<case "Degradationist">>
	$brothelNameCaps 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.
<<case "Repopulation Focus">>
	$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.
<<case "Eugenics">>
	$brothelNameCaps 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.
<<case "Asset Expansionist">>
	$brothelNameCaps 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.
<<case "Transformation Fetishist">>
	$brothelNameCaps is sterile and clean. Interactive screens on the walls list the whores and their modifications in clinical detail.
<<case "Gender Radicalist">>
	$brothelNameCaps 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.
<<case "Gender Fundamentalist">>
	$brothelNameCaps 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.
<<case "Physical Idealist">>
	$brothelNameCaps 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.
<<case "Subjugationist">>
	$brothelNameCaps is decorated to celebrate the degradation of $arcologies[0].FSSubjugationistRace whores. The whores greet customers in stereotypical $arcologies[0].FSSubjugationistRace accents.
<<case "Supremacist">>
	$brothelNameCaps 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.
<<case "Paternalist">>
	$brothelNameCaps 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.
<<case "Maturity Preferentialist">>
	$brothelNameCaps is decorated to look like a refined bar. It has a row of sturdy backless barstools, perfect for a delectable selection of succulent MILFs to perch on.
<<case "Youth Preferentialist">>
	$brothelNameCaps is decorated to look like a the sort of bar old world students visit on spring break. Vapid music is playing, and when whores aren't with customers, they dance and make out with each other to attract some.
<<case "Body Purist">>
	$brothelNameCaps 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.
<<case "Slimness Enthusiast">>
	$brothelNameCaps 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.
<<case "Pastoralist">>
	$brothelNameCaps 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.
<<case "Hedonistic">>
	$brothelNameCaps is comfortable and full of soft couches and chairs for its' overweight whores to lounge upon between clients <<if $arcologies[0].HedonisticDecadenceResearch == 1>>and enjoy a plate of snacks<<else>>and enjoy a big cup of slave food<</if>>. The smells of fresh baked goods are pumped into the facility to mask the smell of sweat. It's not unusual for a client to fuck a whore right on her chosen couch, since the effort of moving is often too much.
<</switch>>

<<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 == -1>>
	The featured slave actresses are all nice and young.
	<<elseif $brothelAdsOld == -2>>
	The featured slave actresses are all teenagers.
	<<elseif $brothelAdsOld == -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 == -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 == -1>>
	they're all natural.
	<<else>>
	some are augmented by implants.
	<</if>>
	<<if $brothelAdsPreg == 1>>
		Most of slaves have firm, rounded bellies.
	<<elseif $brothelAdsPreg == -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 == -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 == -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 = 1>><<goto "Brothel Advertisement">><</link>> | <<else>>Stacked | <</if>>
<<if $brothelAdsStacked != -1>><<link "Slim">><<set $brothelAdsStacked = -1>><<goto "Brothel Advertisement">><</link>> | <<else>>Slim | <</if>>
<<if $brothelAdsStacked != 0>><<link "Variety">><<set $brothelAdsStacked = 0>><<goto "Brothel Advertisement">><</link>><<else>>Variety<</if>>

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

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

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

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

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

<</if>>

<</nobr>>


code:
:: Brothel Report [nobr]

<<SlaveSort $BrothiIDs>>
<<set _DL = $BrothiIDs.length, $brothelSlaves = _DL, _SL = $slaves.length, $implanted = 0, $legendaryWhoreID = 0, $madamCashBonus = 0, $modded = 0, $old = 0, $pure = 0, $slim = 0, $stacked = 0, $unmodded = 0, $XX = 0, $XY = 0, $young = 0, _FLsFetish = 0, _profits = 0>>

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

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

<<if ($Madam != 0)>>
	<<set _FLs = $slaves.findIndex(function(s) { return s.ID == $Madam.ID; })>>

	<<if ($slaves[_FLs].health < -80)>>
		<<set $slaves[_FLs].health += 20>>
	<<elseif $slaves[_FLs].health < -40>>
		<<set $slaves[_FLs].health += 15>>
	<<elseif $slaves[_FLs].health < 0>>
		<<set $slaves[_FLs].health += 10>>
	<<elseif $slaves[_FLs].health < 90>>
		<<set $slaves[_FLs].health += 7>>
	<</if>>
	<<if $slaves[_FLs].devotion <= 45>>
		<<set $slaves[_FLs].devotion += 5>>
	<</if>>
	<<if $slaves[_FLs].trust < 45>>
		<<set $slaves[_FLs].trust += 5>>
	<</if>>
	<<if $slaves[_FLs].fetishStrength <= 95>>
		<<if $slaves[_FLs].fetish != "dom">>
			<<fetishChangeChance $slaves[_FLs]>>
			<<if $fetishChangeChance > 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>>
	/% Make sure we have registered living expenses as for any other slave %/
	<<run getSlaveStatisticData($Madam, $facility.brothel)>>
	<<set $Madam = $slaves[_FLs]>>
	    <<SlaveFullName $Madam>> is serving as the Madam.
	<<if $Madam.relationship == -3 && $Madam.devotion > 50>>
		As your loving wife, she does her best to attract attention to your brothel.
		<<set $madamCashBonus += 0.25>>
	<</if>>
	<<if (_FLsFetish == 1)>>
		She isn't above sampling the merchandise herself; before long it's obvious to her girls that she @@.lightcoral;really likes fucking them.@@
	<<elseif (_FLsFetish == 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 @@.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 @@.yellowgreen;improve@@ business at $brothelName.
		<<set $madamCashBonus += 0.05>>
	<<elseif ($Madam.whoreSkill <= 60)>>
		$Madam.slaveName's skills @@.yellowgreen;improve@@ business at $brothelName.
		<<set $madamCashBonus += 0.1>>
	<<elseif ($Madam.whoreSkill < 100)>>
		$Madam.slaveName's skills greatly @@.yellowgreen;improve@@ business at $brothelName.
		<<set $madamCashBonus += 0.15>>
	<<else>>
		$Madam.slaveName's mastery immensely @@.yellowgreen;improves@@ business at $brothelName.
		<<set $madamCashBonus += 0.20>>
	<</if>>
	<<if ($Madam.actualAge > 35)>>
		Her age and experience also contribute.
		<<set $madamCashBonus += 0.05>>
	<<elseif $AgePenalty == 0>>
		<<set $madamCashBonus += 0.05>>
	<</if>>
	<<if setup.madamCareers.includes($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>>
	<<for _dI = 0; _dI < _DL; _dI++>>
		<<set $i = $slaveIndices[$BrothiIDs[_dI]]>>
		<<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>>, 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[_FLs].rivalry++, $Madam.rivalry++, $slaves[$i].rivalry++>>
			<</if>>
		<<elseif $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++, $madamCashBonus -= 0.05>>
		<<elseif $familyTesting == 1 && totalRelatives($slaves[$i]) > 0>>
			<<if $slaves[$i].mother == $Madam.ID || $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++, $madamCashBonus += 0.05>>
			<<elseif $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++, $madamCashBonus += 0.05>>
			<<elseif $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++, $madamCashBonus += 0.05>>
			<<elseif 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++, $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++, $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++, $madamCashBonus += 0.05>>
			<</if>>
		<<elseif $Madam.relationTarget == $slaves[$i].ID && $familyTesting == 0>>
			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++, $madamCashBonus += 0.05>>
		<</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>>
		<<elseif $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>>
		<<elseif $slaves[$i].prestigeDesc == "She is remembered for winning best in show as a dairy cow.">>
			<<if ($arcologies[0].FSPhysicalIdealist != "unset")>>
				<<if ($slaves[$i].muscles > 60) && ($slaves[$i].weight < 30) && ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
					She shows off how even a cow like $slaves[$i].slaveName can achieve physical perfection.
					<<set $madamCashBonus += 0.15>>
				<<else>>
					 A<<if ($slaves[$i].muscles < 30)>>n unmuscled,<</if>><<if ($slaves[$i].weight > 30)>> fat,<</if>> 'prestigious' <<if ($slaves[$i].lactation > 0)>>cow<<elseif (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>mass of titflesh<<else>>slave<</if>> like $slaves[$i].slaveName is woefully out of fashion, so $Milkmaid.slaveName tries to draw attention away from her.
				<</if>>
			<<else>>
				<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
					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>>
				<<else>>
					She would like to show off $slaves[$i].slaveName's huge udders, but $slaves[$i].slaveName <<if ($slaves[$i].lactation == 0)>> isn't producing milk anymore. <<else>> doesn't exactly have huge udders anymore. <</if>>
				<</if>>
			<</if>>
		<<elseif $slaves[$i].prestigeDesc == "She is remembered for winning best in show as a cockmilker.">>
			<<if $arcologies[0].FSGenderFundamentalist != "unset">>
				<<if ($slaves[$i].balls == 0) && ($slaves[$i].dick == 0) && ($slaves[$i].vagina > -1)>>
					She uses $slaves[$i].slaveName as an example of how even a huge-balled freak like her can be restored to proper femininity.
					<<set $madamCashBonus += 0.20>>
				<<else>>
					She tries to hide $slaves[$i].slaveName, 'her' body being notorious for defiance of conventional femininity.
				<</if>>
			<<else>>
				<<if (($slaves[$i].balls > 5) && ($slaves[$i].dick != 0)) || (($slaves[$i].balls > 4) && ($slaves[$i].dick != 0) && ($slaves[$i].prostate > 1))>>
					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>>
				<<else>>
					She would love to show off $slaves[$i].slaveName's copious loads, but $slaves[$i].slaveName<<if $slaves[$i].dick == 0>> doesn't have a dick.<<elseif $slaves[$i].balls == 0>>'s not producing cum. <<else>>'s orgasms just aren't messy enough. <</if>>
				<</if>>
			<</if>>
		<<elseif $slaves[$i].prestigeDesc == "She is remembered for winning best in show as a breeder.">>
			<<if $slaves[$i].bellyPreg >= 5000>>
				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>>
			<<elseif canGetPregnant($slaves[$i])>>
				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>>
			<<else>>
				She would love to play off of $slaves[$i].slaveName's fame and fertility, but unfortunately she <<if $slaves[$i].pregKnown == 1 && $slaves[$i].bellyPreg < 1500>>is already pregnant and not far enough along to show it<<elseif $slaves[$i].pregKnown == 1 && $slaves[$i].bellyPreg < 5000>>already pregnant, but not enough to be exciting<<else>>is unable to get knocked up<</if>>.
			<</if>>
		<</if>>
	<</for>>

	<<set _oldCash = $cash>>
	<<if (_DL < 5)>>
		<<set $slavesGettingHelp = 0>>
		<<if $universalRulesFacilityWork == 1>>
			<<for $i = 0; $i < _SL; $i++>>
				<<if ($slaves[$i].assignment == "whore")>>
					<<set $slavesGettingHelp++>>
				<</if>>
			<</for>>
		<</if>>
		<<if (_DL+$slavesGettingHelp < 5)>>
			<<set $i = _FLs>> /* apply following SA passages to facility leader */
			<<if $showEWD != 0>>

    She <<include "SA whore">>
			<<else>>
				<<silently>><<include "SA whore">><</silently>>
			<</if>>
			<<set _seed = $cash-_oldCash, $cash += Math.trunc(0.5*_seed), _seed = Math.trunc(1.5*_seed), _profits += _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 @@.yellowgreen;¤_seed@@. She can charge more for her time, since many citizens find it erotic to fuck the Madam.
		<</if>>
	<</if>>
	<<if (_DL > 0)>>

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

<<if (_DL > 0)>>
	    <<if _DL != 1>>''There are _DL slave whores working out of $brothelName.''<<else>>''There is one slave whore working out of $brothelName.''<</if>>
<</if>>

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

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

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

		<</if>>
		/* 000-250-006 */
		''__@@.pink;<<SlaveFullName $slaves[_FLs]>>@@__'' is serving as the Madam.

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

<<include "SA devotion">>
	<<else>>
		<<silently>>
		<<include "SA chooses own clothes">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<</if>>
	<<set $Madam = $slaves[_FLs]>>
<</if>>

<<if (_DL > 0)>>
	<<set _healthBonus = 0, _aphrod = 0>>
    <<if ($brothelUpgradeDrugs == 1)>>
        <<set _healthBonus += 1, _aphrod = 1>>
    <<elseif ($brothelUpgradeDrugs == 2)>>
        <<set _healthBonus += 3, _aphrod = 2>>
    <</if>>
	<<set _oldCash = $cash>>
	<<for _dI = 0; _dI < _DL; _dI++>>
		<<set $i = $slaveIndices[$BrothiIDs[_dI]]>>
		<<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>>

		/* Perform facility based rule changes */
		<<set $slaves[$i].health += _healthBonus, $slaves[$i].aphrodisiacs = _aphrod>>

		<<if $showEWD != 0>>

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

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

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

    She <<include "SA whore">>

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

<<include "SA devotion">>
		<<else>>
			<<silently>>
			<<include "SA chooses own job">>
			<<include "SA whore">>
			<<include "SA chooses own clothes">>
			<<include "SA diet">>
			<<include "SA long term effects">>
			<<include "SA drugs">>
			<<include "SA relationships">>
			<<include "SA rivalries">>
			<<include "SA devotion">>
			<</silently>>
		<</if>>
		<<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].bellyPreg >= 5000) || ($slaves[$i].bellyImplant >= 4000)>>
					<<set _seed++>>
				<</if>>
			<<elseif $brothelAdsPreg == -1>>
				<<if ($slaves[$i].belly < 100) && ($slaves[$i].weight < 30) && (!setup.fakeBellies.includes($bellyAccessory)) && ($slaves[$i].bellyImplant <= 0)>>
					<<set _seed++>>
				<</if>>
			<</if>>
			<<if $brothelAdsImplanted == 1>>
				<<if ($slaves[$i].boobsImplant > 0) && ($slaves[$i].buttImplant > 0) && ($slaves[$i].waist < -95) && ($slaves[$i].lipsImplant > 0) && ($slaves[$i].bellyImplant >= 2000)>>
					<<set _seed++>>
				<</if>>
			<<elseif $brothelAdsImplanted == -1>>
				<<if $slaves[$i].boobsImplant == 0 && $slaves[$i].buttImplant == 0 && $slaves[$i].waist >= -95 && $slaves[$i].lipsImplant == 0 && $slaves[$i].faceImplant < 30 &&  $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)>>
				<<set $cash += _adsIncome , getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
			<<else>>
				<<set _adsIncome = random(50,60) * Math.trunc($brothelAdsSpending/1000)>>
				<<set $cash += _adsIncome, getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
			<</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 < 90>>
			<<set $slaves[$i].health += 7>>
		<</if>>
		<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust > -20)>>
			<<set $slaves[$i].devotion -= 5, $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++>>
		<</if>>
	<</for>>
	<<set _profits += $cash-_oldCash, _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) <= (_DL/3))>>
				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
				The brothel offers a @@.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) <= (_DL/3))>>
				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
				The brothel offers a @@.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) <= (_DL/3))>>
				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
				The brothel offers a @@.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) <= (_DL/3))>>
				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
				The brothel offers @@.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) <= (_DL/3))>>
				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
				The brothel offers a @@.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) <= (_DL/3))>>
				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
				The brothel offers girls @@.yellowgreen;both@@ young and mature.
			<</if>>
		<</if>>
	<</if>>

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

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

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

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

	<<BrothelStatistics 0>>
	<<timed 50ms>>
		<<replace #brothelstats>>
			<<BrothelStatistics 1>>
		<</replace>>
	<</timed>>
<</if>>

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

<</if>>

license: mit


code:
:: building widgets [nobr widget]

/%
Call as <<DisplayBuilding>>
Displays the arcology as a table.
Yes, I am aware this is horrible. If anyone can figure out how to get widgets to play nice with tables, or otherwise unfuck this, tell me and I'll implement it.
%/
<<widget "DisplayBuilding">>

<<set _Pass = passage()>>

<>

 /* Level 9, penthouse, sector 0 */

			<<link "Penthouse">><<set $nextButton = "Back", $nextLink = _Pass>><<goto "Manage Penthouse">><</link>> @@.cyan;[P]@@
			<<if $masterSuite||$servantsQuarters||$spa||$clinic||$schoolroom||$cellblock||$incubator||$HGSuite||$researchLab.built=="true">>

				<<if $masterSuite>>[[Suite|Master Suite]] ($masterSuiteSlaves/$masterSuite<<if $Concubine>>, C<</if>>)<</if>>
				<<if $servantsQuarters>>[[Quarters|Servants' Quarters]] ($servantsQuartersSlaves/$servantsQuarters<<if $Stewardess>>, L<</if>>)<</if>>
				<<if $spa>>[[Spa]] ($spaSlaves/$spa<<if $Attendant>>, L<</if>>)<</if>>
				<<if $clinic>>[[Clinic]] ($clinicSlaves/$clinic<<if $Nurse>>, L<</if>>)<</if>>
				<<if $schoolroom>>[[Schoolroom]] ($schoolroomSlaves/$schoolroom<<if $Schoolteacher>>, L<</if>>)<</if>>
				<<if $cellblock>>[[Cellblock]] ($cellblockSlaves/$cellblock<<if $Wardeness>>, L<</if>>)<</if>>
				<<if $incubator>>[[Incubator]] (<<if $incubator-$incubatorSlaves == 0>>No empty tanks<<elseif $incubator-$incubatorSlaves == 1>>1 empty tank<<else>><<print $incubator-$incubatorSlaves>> empty tanks<</if>>)<</if>>
				<<if $HGSuite>>[[HG Suite|Head Girl Suite]] ($HGSuiteSlaves)<</if>>
				<<if $researchLab.built == "true">>[[Research Lab][$temp = 0]]<</if>>
			<</if>>

	<<if $arcologyUpgrade.spire == 1>>

 /* Level 8, spire, sectors 1-2 */

			<<for _i = 1; _i <= 2; _i++>><<sectorblock $sectors[_i] _i>><</for>>

 /* Level 7, spire, sectors 3-4 */

			<<for _i = 3; _i <= 4; _i++>><<sectorblock $sectors[_i] _i>><</for>>

	<</if>>

 /* Level 6, promenade, sectors 5-7 */

		<<for _i = 5; _i <= 7; _i++>><<sectorblock $sectors[_i] _i>><</for>>

 /* Level 5, apartments, sectors 8-11 */

		<<for _i = 8; _i <= 11; _i++>><<sectorblock $sectors[_i] _i>><</for>>

 /* Level 4, apartments, sectors 12-15 */

		<<for _i = 12; _i <= 15; _i++>><<sectorblock $sectors[_i] _i>><</for>>

 /* Level 3, apartments, sectors 16-19 */

		<<for _i = 16; _i <= 19; _i++>><<sectorblock $sectors[_i] _i>><</for>>

 /* Level 2, concourse, sectors 20-24 */
		<<for _i = 20; _i <= 24; _i++>><<sectorblock $sectors[_i] _i>><</for>>

 /* Level 1, service area, sectors 25-29 */
		<<for _i = 25; _i <= 29; _i++>><<sectorblock $sectors[_i] _i>><</for>>

<</widget>>

<<widget "SectorSell">>

<<set $price = 1000*Math.trunc($arcologies[0].prosperity*(1+($arcologies[0].demandFactor/100)))>>
Selling this sector would relenquish a 4% interest in $arcologies[0].name. Such an interest is worth ¤$price.
<<if $arcologies[0].ownership >= 4>>
	[[Sell|Main][$cash += $price, $arcologies[0].ownership -= 4, $arcologies[0].demandFactor -= 20, $sectors[$AS].ownership = 0]]
<</if>>

<</widget>>

/%
 Call as <<SectorCounts>>
 Updates $ACitizenLimit, $ASlaveLimit, $AProsperityCap, $Sweatshops.
%/
<<widget "SectorCounts">>

<<if $arcologyUpgrade.drones != 1>>
	<<set $AProsperityCap = 0>>
<<elseif $arcologyUpgrade.hydro != 1>>
	<<set $AProsperityCap = 10>>
<<elseif $arcologyUpgrade.apron != 1>>
	<<set $AProsperityCap = 30>>
<<elseif $arcologyUpgrade.grid != 1>>
	<<set $AProsperityCap = 60>>
<<elseif $arcologyUpgrade.spire != 1>>
	<<set $AProsperityCap = 100>>
<<else>>
	<<set $AProsperityCap = 150>>
<</if>>
<<set $ACitizenLimit = 0, $ASlaveLimit = 0, $Sweatshops = 0>>
<<for _i = 8; _i <= 19; _i++>>
	<<if $sectors[_i].type == "DenseApartments">>
		<<set $ACitizenLimit += 600, $ASlaveLimit += 1000, $AProsperityCap += 10>>
	<<elseif $sectors[_i].type == "LuxuryApartments">>
		<<set $ACitizenLimit += 400, $ASlaveLimit += 2000, $AProsperityCap += 15>>
	<<else>>
		<<set $ACitizenLimit += 400, $ASlaveLimit += 1000, $AProsperityCap += 10>>
	<</if>>
<</for>>
<<for _i = 25; _i <= 29; _i++>>
	<<if $sectors[_i].type == "Sweatshops">>
		<<set $Sweatshops++>>
	<</if>>
<</for>>

<</widget>>

/%
 Call as <<UpdateOwnership>>
 Updates $arcologies[0].ownership.
%/
<<widget "UpdateOwnership">>

<<set $arcologies[0].ownership = 0>>
<<if $arcologyUpgrade.spire == 1>>
	<<for _i = 1; _i <= 29; _i++>>
		<<if $sectors[_i].ownership == 1>><<set $arcologies[0].ownership += 3.45>><</if>>
	<</for>>
	<<set $arcologies[0].ownership = Math.trunc($arcologies[0].ownership)>>
<<else>>
	<<for _i = 5; _i <= 29; _i++>>
		<<if $sectors[_i].ownership == 1>><<set $arcologies[0].ownership += 4>><</if>>
	<</for>>
<</if>>

<</widget>>


code:
:: Bulk Slave Generate [nobr]

<<set $newSlaves = [], $returnTo = "Main", $newSlavesDone = 0, $spent = 0, $newSlaveIndex = 0>>

<<if ndef $numSlaves>>
	<<set $numSlaves = 5>>
<</if>>
<<if ndef $numArcology>>
	<<set $numArcology = 1>>
<</if>>

/* Discount calculation.  Gives 5% on top of slave school discount */
<<set $discount = 475>>
<<switch $slaveMarket>>
<<case "TSS">>
	<<if $TSS.schoolUpgrade != 0>>
		<<set $discount = 375>>
	<</if>>

<<case "GRI">>
	<<if $GRI.schoolUpgrade != 0>>
		<<set $discount = 375>>
	<</if>>

<<case "SCP">>
	<<if $SCP.schoolUpgrade != 0>>
		<<set $discount = 375>>
	<</if>>

<<case "LDE">>
	<<if $LDE.schoolUpgrade != 0>>
		<<set $discount = 375>>
	<</if>>

<<case "TGA">>
	<<if $TGA.schoolUpgrade != 0>>
		<<set $discount = 375>>
	<</if>>

<<case "TCR">>
	<<if $TCR.schoolUpgrade != 0>>
		<<set $discount = 375>>
	<</if>>

<<case "TFS">>
	<<if $TFS.schoolUpgrade != 0>>
		<<set $discount = 300>>
	<<else>>
		<<set $discount = 380>>
	<</if>>

<<case "corporate">>
	<<if $publicShares <= $personalShares*0.2>>
		<<set $discount = 350>>
	<<elseif $publicShares <= $personalShares*0.5>>
		<<set $discount = 400>>
	<<else>>
		<<set $discount = 450>>
	<</if>>

<<case "neighbor">>
	<<set $activeArcology = $arcologies[0]>>
	<<if $numArcology >= $arcologies.length>>
		<<set $numArcology = 1>>
	<</if>>
	<<set $targetArcology = $arcologies[$numArcology]>>
	<<include "Arcology Opinion">>
	<<set $opinion = Math.trunc($opinion/20)>>
	<<set $opinion = Math.clamp($opinion, -10, 10)>>
	<<set $discount -= ($opinion * 25)>>

<</switch>>

/* Determine if Law Compliance effects must be applied to this transaction */
<<switch $slaveMarket>>
<<case "indentures" "neighbor" "heap" "TSS" "GRI" "SCP" "LDE" "TGA" "TCR" "TFS">> /* these markets are exempt from law compliance */
	<<set $applyLaw = 0>>
<<default>> /* all other markets are not exempt: corporate, hunters, kidnappers, neighbor, raiders, trainers, TSS, GRI, SCP, LDE, TGA, TFS */
	<<set $applyLaw = 1>>
<</switch>>

<<for _i = 0; _i < $numSlaves; _i++>>
	<<silently>>
		<<GenerateMarketSlave $slaveMarket $numArcology>>
	<</silently>>
	<<set $slavesSeen += 1>>
	<<if $applyLaw == 0>>
		<<slaveCost $activeSlave>>
	<<else>>
		<<set _backup = $activeSlave>> /* backup newly generated slave */
		<<silently>>
			<<include "Law Compliance">> /* includes CheckForGingering - slave stats may change, affecting price */
		<</silently>>
		<<slaveCost $activeSlave>>
		<<RemoveGingering>> /* remove gingered state, if applied, so we can apply it again later */
		<<set $activeSlave = _backup>> /* restore backup so we can apply Law Compliance again later */
	<</if>>

	/* Adjust $slaveCost according to $slavesSeen */
	<<if $slavesSeen > $slaveMarketLimit>>
		<<set $slaveCost += $slaveCost*(($slavesSeen-$slaveMarketLimit)*0.1)>>
		<<if $introType == "inStock">>
			<<break>>
		<</if>>
	<</if>>

	/* Apply discount modifier */
	<<set $slaveCost = $discount*Math.trunc($slaveCost/500)>>

	/* Charge the Player for the slave, or break out if cannot afford */
	<<if $cash < $slaveCost>>
		<<set _i = $numSlaves>>
		<<break>>
	<<else>>
		<<set $cash -= $slaveCost>>
		<<set $newSlaves.push($activeSlave)>>
		<<set $spent += $slaveCost>>
	<</if>>
<</for>>

/* Max Buy clean-up */
<<if $numSlaves == 9999>>
	<<set $numSlaves = $newSlaves.length>>
<</if>>

/* increment Slave school purchase counts if needed */
<<switch $slaveMarket>>
<<case "TSS">>
	<<set $TSS.studentsBought += $newSlaves.length>>
<<case "GRI">>
	<<set $GRI.studentsBought += $newSlaves.length>>
<<case "SCP">>
	<<set $SCP.studentsBought += $newSlaves.length>>
<<case "LDE">>
	<<set $LDE.studentsBought += $newSlaves.length>>
<<case "TGA">>
	<<set $TGA.studentsBought += $newSlaves.length>>
<<case "TCR">>
	<<set $TCR.studentsBought += $newSlaves.length>>
<<case "TFS">>
	<<set $TFS.studentsBought += $newSlaves.length>>
<</switch>>

<<goto "Bulk Slave Intro">>


code:
:: Bulk Slave Intro [nobr]

<<if ndef $introType>>
	<<set $introType = "">>
<</if>>
<<if $newSlaves.length == 0>>
	<<set $introType = "">>
<</if>>

<<switch $introType>>
<<case "">>
	/* No message to give */
<<case "multi">>
	<<if $newSlaves.length > 1>>
		Your selection of $newSlaves.length slaves arrives from <<MarketNamePeriod $slaveMarket $numArcology>>
	<<else>>
		Your new slave from <<MarketName $slaveMarket $numArcology>> has arrived.
	<</if>>

<<case "bulk">>
	Your delivery of $newSlaves.length slaves arrives from <<MarketNamePeriod $slaveMarket $numArcology>>
	<<if $newSlaves.length != $numSlaves>>
		You were going to order $numSlaves, but $assistantName lowered it on financial grounds.
	<</if>>
	<<set _seed = Math.ceil($slavesSeen - $slaveMarketLimit)>>
	<<if _seed > $newSlaves.length>>
		You have cast such a wide net for slaves this week that all are more expensive than normal.
	<<elseif _seed > 0>>
		You have cast such a wide net for slaves this week that some (_seed) are more expensive than normal.
	<</if>>
	<<if $slaveMarket == "TFS">>
		/* Put line about The Futanari Sisters discount & pricing */
	<<elseif $discount == 475>>
		Your bulk delivery came with a @@.yellowgreen;5%@@ discount.
	<<else>>
		With all your discounts factored in you got a @@.yellowgreen;<<print (500-$discount)/5>>%@@ discount;
	<</if>>
	You spent @@.yellowgreen;¤$spent@@ on your new slaves.

<<case "inStock">>
	You clear out <<MarketName $slaveMarket $numArcology>> of its stock of $newSlaves.length slaves.
	<<if $slaveMarket == "TFS">>
		/* Put line about The Futanari Sisters discount & pricing */
	<<elseif $discount == 475>>
		Your bulk delivery came with a @@.yellowgreen;5%@@ discount.
	<<else>>
		With all your discounts factored in you got a @@.yellowgreen;<<print (500-$discount)/5>>%@@ discount;
	<</if>>
	You spent @@.yellowgreen;¤$spent@@ on your new slaves.

<<case "event">>
	This is placeholder event info.

<</switch>>
/* remove the below line to make the intro blurb show up for every slave, not just the first */
<<set $introType = "">>

<<if ($newSlaveIndex >= $newSlaves.length) || ($newSlavesDone == 1)>>
	<<if $newSlaves.length > 0>>
		/* Push the induction changes for the final slave to the newSlave array */
		<<AddSlave $activeSlave>>

		/* Variable Clean-up */
		<<set $newSlaves = []>>
		<<set $newSlavesDone = 0>>
		<<set $introType = "">>
	<</if>>
	<<goto $returnTo>>
<<else>>
	/* If looking at 2nd slave, push the induction changes for the prior slave to the newSlave array */
	<<if $newSlaveIndex > 0>>
		<<AddSlave $activeSlave>>
	<</if>>
	<<if $newSlaves.length > 1>>
		Showing new slave <<print $newSlaveIndex+1>> of <<print $newSlaves.length>>:
	<</if>>

	/* Set activeSlave to the desired newSlave so that existing code can be used */
	<<set $activeSlave = $newSlaves[$newSlaveIndex]>>

	/* Due to possible gingering, the Long Slave Description must be displayed before the New Slave Intro */
	<<set $saleDescription = 1>> /* policies were applied earlier, if needed */
	<<include "Long Slave Description">>

	/* Use existing New Slave Intro */
	<<include "New Slave Intro">> /* calls <<RemoveGingering>> if needed */

	/* Override nextButton setting from New Slave Intro */
	<<set $nextButton = "Continue">>
	<<set $nextLink = "Bulk Slave Intro">>

	/* Add an option = goto the next slave below the New Slave Intro section */

	<<if $newSlaveIndex < ($newSlaves.length - 1)>>
		[[Next Slave|Bulk Slave Intro]]
	<<else>>
		[[Finish introducing slaves|Bulk Slave Intro][$newSlavesDone = 1]]
	<</if>>

<</if>> /* Closes no new Slaves check */

<<set $newSlaveIndex++>>


code:
:: Buy Slaves [nobr]

<<set $nextButton = "Back">>
<<set $nextLink = "Main">>
<<set _minimumFive = $minimumSlaveCost * 5>>

<<set $activeArcology = 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)>>
	@@.yellow;There is a bull market for slaves; the price of slaves is very high.@@
<<elseif ($slaveCostFactor > 1)>>
	@@.yellow;The slave market is bullish; the price of slaves is high.@@
<<elseif ($slaveCostFactor < 0.9)>>
	@@.yellow;There is a bear market for slaves; the price of slaves is very low.@@
<<elseif ($slaveCostFactor < 1)>>
	@@.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 $corpMarket != 0>>

[[Corporate Market][$slavesSeen += 1]] | //Slaves from your corporation purchased at a discounted rate.//
	<<if $cash > _minimumFive>>
		[[(x5)|Bulk Slave Generate][$slaveMarket = "corporate", $introType = "bulk", $numSlaves = 5]] |
	<</if>>
<</if>>

[[The Flesh Heap|Slave Markets][$slaveMarket = "heap", $slavesSeen += 1]] | //Broken and discarded slaves. Near useless, but cheap. No longer does bulk orders after complaints.//

<<if $bodyswapAnnounced == 1>>

[[Order a custom husk slave from the Flesh Heap|Husk Slave]] | //Will need to be used on arrival.//
<</if>>

<<if ($rep > 500)>>

[[Kidnappers' Market|Slave Markets][$slaveMarket = "kidnappers", $slavesSeen += 1]] |
<<if $cash > _minimumFive>>
	[[(x5)|Bulk Slave Generate][$slaveMarket = "kidnappers", $introType = "bulk", $numSlaves = 5]] |
<</if>>
//Slaves will tend to be low quality and resistant.//
<</if>>

''Neighboring Arcologies:'' //The arcology's prosperity and culture will affect slaves who have lived there.//
<<for _i = 0; _i < $arcologies.length; _i++>>
	<<if $arcologies[_i].direction != 0>>

    <<print '[[Slaves from|Slave Markets][$slaveMarket = "neighbor", $numArcology = ' + _i + ']]'>>
		''$arcologies[_i].name''
		<<if $cash > _minimumFive>>
			| <<print '[[(x5)|Bulk Slave Generate][$slaveMarket = "neighbor", $introType = "bulk", $numSlaves = 5, $numArcology = '+_i+']]'>>
		<</if>>
	<</if>>
<</for>>

<<if ($rep > 1000)>>

[[Runaway Hunters' Market|Slave Markets][$slaveMarket = "hunters", $slavesSeen += 1]] |
	<<if $cash > _minimumFive>>
		[[(x5)|Bulk Slave Generate][$slaveMarket = "hunters", $introType = "bulk", $numSlaves = 5]] |
	<</if>>
	//Slaves will tend to be skilled but rebellious.//
<</if>>

<<if ($rep > 2000)>>

[[Indentures Market|Slave Markets][$slaveMarket = "indentures", $slavesSeen += 1]] |
	<<if $cash > _minimumFive>>
		[[(x5)|Bulk Slave Generate][$slaveMarket = "indentures", $introType = "bulk", $numSlaves = 5]] |
	<</if>>
	//Temporary enslavement and restrictions on treatment.//
<</if>>

<<if ($rep > 3000)>>

[[Raiders' Market|Slave Markets][$slaveMarket = "raiders", $slavesSeen += 1]] |
	<<if $cash > _minimumFive>>
		[[(x5)|Bulk Slave Generate][$slaveMarket = "raiders", $introType = "bulk", $numSlaves = 5]] |
	<</if>>
	//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 = "underage raiders", $slavesSeen += 1]] |
	<<if $cash > _minimumFive>>
		[[(x5)|Bulk Slave Generate][$slaveMarket = "underage raiders", $introType = "bulk", $numSlaves = 5]] |
	<</if>>
	//Very young slaves.//
<</if>>

<<if ($rep > 4000)>>

[[Trainers' Market|Slave Markets][$slaveMarket = "trainers", $slavesSeen += 1]] |
	<<if $cash > _minimumFive>>
		[[(x5)|Bulk Slave Generate][$slaveMarket = "trainers", $introType = "bulk", $numSlaves = 5]] |
	<</if>>
	//Slaves will tend to be good quality and obedient.//
<</if>>

<<if ($rep > 5500)>>

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

    [[The Slavegirl School][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "TSS", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Straightforward slaves with good training.//<<if $TSS.schoolSale == 1>> //@@.yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[Growth Research Institute][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "GRI", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Poorly trained slaves with huge assets.//<<if $GRI.schoolSale == 1>> //@@.yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[St. Claver Preparatory][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "SCP", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Slaves with basic training and solid implants.//<<if $SCP.schoolSale == 1>> //@@.yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[The Cattle Ranch][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "TCR", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Mentally conditioned free-range cowgirls.//<<if $TCR.schoolSale == 1>> //@@.yellow;Offering your first purchase at half price this week.@@//<</if>>
	<</if>>
	<<if ($seeDicks != 0)>>

    [[L'école des Enculées][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "LDE", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Slaves optimized and trained for anal.//<<if $LDE.schoolSale == 1>> //@@.yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[The Gymnasium-Academy][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "TGA", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Well trained slaves with dicks.//<<if $TGA.schoolSale == 1>> //@@.yellow;Offering your first purchase at half price this week.@@//<</if>>

    [[The Futanari Sisters][$slavesSeen += 1]] |
		<<if $cash > _minimumFive>>
			[[(x5)|Bulk Slave Generate][$slaveMarket = "TFS", $introType = "bulk", $numSlaves = 5]] |
		<</if>>
		//Highly skilled, highly feminine hermaphrodites.//<<if $TFS.schoolSale == 1>> //@@.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__

<<MenialPopCap>>
The parts of your arcology you own can house a total of $PopCap menial slaves.

<<set _menialPrice = Math.trunc(($slaveCostFactor*1000)/100)*100>>
<<set _menialPrice = Math.clamp(_menialPrice, 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 ¤_menialPrice.
<<set _optionsBreak = 0>>
<<if $PopCap > $helots+$fuckdolls+$menialBioreactors>>
	[[Buy|Buy Slaves][$helots+=1,$menialDemandFactor+=1,$cash-=_menialPrice]]
	<<if $cash > _menialPrice*10>>
		[[(x10)|Buy Slaves][$helots+=10,$menialDemandFactor+=10,$cash-=_menialPrice*10]]
	<</if>>
	<<if $cash > _menialPrice*100>>
		[[(x100)|Buy Slaves][$helots+=100,$menialDemandFactor+=100,$cash-=_menialPrice*100]]
	<</if>>
	<<if $cash > _menialPrice*2>>
		[[(max)|Buy Slaves][$helots+=Math.trunc($cash/(_menialPrice)),$menialDemandFactor+=Math.trunc($cash/(_menialPrice)),$cash-=Math.trunc($cash/(_menialPrice))*(_menialPrice)]]
	<</if>>
	<<set _optionsBreak = 1>>
<</if>>
<<if $helots >= 1>>
	<<if _optionsBreak>>|<</if>>
	[[Sell|Buy Slaves][$helots-=1,$menialDemandFactor-=1,$cash+=_menialPrice]]
<<if $helots >= 10>>
	[[(x10)|Buy Slaves][$helots-=10,$menialDemandFactor-=10,$cash+=_menialPrice*10]]
<<if $helots >= 100>>
	[[(x100)|Buy Slaves][$helots-=100,$menialDemandFactor-=100,$cash+=_menialPrice*100]]
<</if>>
<</if>>
[[(all)|Buy Slaves][$cash+=$helots*(_menialPrice),$menialDemandFactor-=$helots*(_menialPrice),$helots = 0]]
	<<if $arcologies[0].FSPaternalist == "unset">>
	<<if $arcadeUpgradeFuckdolls == 1>>
	<<set _fconvertCost = 1000>>
		<<if _menialPrice >= 1100>>
		<<set _fconvertCost = (_menialPrice+100)>>
		<</if>>

    [[Convert to Fuckdoll|Buy Slaves][$helots-=1,$fuckdolls+=1,$cash-=(_fconvertCost)]]
		<<if $helots >= 10>>
			[[(x10)|Buy Slaves][$helots-=10,$fuckdolls+=10,$cash-=10*(_fconvertCost)]]
		<<if $helots >= 100>>
			[[(x100)|Buy Slaves][$helots-=100,$fuckdolls+=100,$cash-=100*(_fconvertCost)]]
		<</if>>
		<</if>>
		[[(all)|Buy Slaves][$fuckdolls+=$helots,$cash-=(_fconvertCost)*($helots),$helots=0]]
		//Costs ¤_fconvertCost//
	<</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 == "unset">>

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

<<if $menialBioreactors > 1>>

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

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

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


code:
:: Cellblock [nobr]

<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Cellblock", $showEncyclopedia = 1, $encyclopedia = "Cellblock", $cellblockSlaves = $CellBiIDs.length>>

<<if $cellblockName != "the Cellblock">>
	<<set $cellblockNameCaps = $cellblockName.replace("the ", "The ")>>
<</if>>
<<cellblockAssignmentFilter>>
$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 "Aztec Revivalist">>
	is designed to frighten the prisoners to submission. All the cells look to the center of the facility, where a sacrificial altar stands, adorned with ceremonial <<if $arcologies[0].FSPaternalist != "unset">>ropes and penetrators<<else>>knives, ropes and blunt instruments<</if>>.
<<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.
<<case "Hedonistic">>
	is torture for thin slaves. The first thing they notice is the heavily reinforced cot they will reside upon. The second is the feeding tube that will be anchored in their stomach for the duration of their stay. Slaves imprisoned here will have their body stuffed to capacity with concentrated slave food, unsuring a plump, docile slave by the end of their sentence.
<<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 = 0, $cellblockDecoration = "standard", $cellblockUpgrade = 0]]
<</if>>

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

$cellblockNameCaps has room for $cellblock slaves to be kept in close confinement.
[[Expand the cellblock|Cellblock][$cash -= _Tmult0, $cellblock += 5]] //Costs ¤_Tmult0//

<<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>>
	<<set _Tmult1 = Math.trunc(20000*$upgradeMultiplierArcology)>>
	Its compliance systems are standard. [[Upgrade them to soften slave flaws|Cellblock][$cash -= _Tmult1, $cellblockUpgrade = 1]] //Costs ¤_Tmult1//
<</if>>

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

<<if ($cellblock <= $cellblockSlaves)>>
	''$cellblockNameCaps is full and cannot hold any more slaves''
<<elseif ($slaves.length > $cellblockSlaves)>>
	<<link "''Send a resistant slave to be broken in the cellblock''">>
		<<replace #ComingGoing>>
			<<resetAssignmentFilter>>
			<<set $Flag to 0>>
			<<include "Slave Summary">>
		<</replace>>
	<</link>>
<</if>>

<<if $cellblockSlaves > 0>>
	| <<link "''Let a slave out of the cellblock''">>
		<<replace #ComingGoing>>
			<<cellblockAssignmentFilter>>
			<<set $Flag = 1>>
			<<include "Slave Summary">>
			<<resetAssignmentFilter>>
		<</replace>>
	<</link>>
<<else>>

//The cellblock is empty for the moment.
//
<</if>>

<<assignmentFilter>>

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

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


code:
:: Cellblock Report [nobr]

<<SlaveSort $CellBiIDs>>
<<set _DL = $CellBiIDs.length, $cellblockSlaves = _DL, _SL = $slaves.length, _brokenSlaves = 0, _idleBonus = 0, _softenedQuirks = 0, _trustMalus = 0, _FLsFetish = 0>>

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

<<if ($Wardeness != 0)>>
	<<set _FLs = $slaves.findIndex(function(s) { return s.ID == $Wardeness.ID; })>>

	<<if ($slaves[_FLs].health < -80)>>
		<<set $slaves[_FLs].health += 20>>
	<<elseif ($slaves[_FLs].health < -40)>>
		<<set $slaves[_FLs].health += 15>>
	<<elseif ($slaves[_FLs].health < 0)>>
		<<set $slaves[_FLs].health += 10>>
	<<elseif ($slaves[_FLs].health < 90)>>
		<<set $slaves[_FLs].health += 7>>
	<</if>>
	<<if ($slaves[_FLs].devotion <= 60)>>
		<<set $slaves[_FLs].devotion += 2>>
	<</if>>
	<<set $slaves[_FLs].devotion += _devBonus>>
	<<if $slaves[_FLs].trust < 60>>
		<<set $slaves[_FLs].trust += 3>>
	<</if>>
	<<if $slaves[_FLs].fetishStrength <= 95>>
		<<if $slaves[_FLs].fetish != "sadist">>
			<<fetishChangeChance $slaves[_FLs]>>
			<<if $fetishChangeChance > random(0,100)>>
				<<set _FLsFetish = 1, $slaves[_FLs].fetishKnown = 1, $slaves[_FLs].fetish = "sadist">>
			<</if>>
		<<elseif $slaves[_FLs].fetishKnown == 0>>
			<<set _FLsFetish = 1, $slaves[_FLs].fetishKnown = 1>>
		<<else>>
			<<set _FLsFetish = 2, $slaves[_FLs].fetishStrength += 4>>
		<</if>>
	<</if>>
	<<set $Wardeness = $slaves[_FLs]>>
	<<if ($Wardeness.energy > 95) || ($Wardeness.fetish == "sadist")>>
		<<set _devBonus++, _trustMalus++, _idleBonus++>>
	<</if>>
	    <<SlaveFullName $Wardeness>> is serving as the Wardeness.
	<<if $Wardeness.relationship == -3 && $Wardeness.devotion > 50>>
		<<set _devBonus++, _trustMalus++, _idleBonus++>>
		As your wife, she tries her best to break the disobedient slaves to your will.
	<</if>>
	<<if (_FLsFetish == 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 @@.pink;become more of a sadist.@@
	<<elseif (_FLsFetish == 2)>>
		Being not only allowed but encouraged to get off while punishing prisoners @@.lightsalmon;deepens her sadism.@@
	<</if>>
	<<if setup.wardenessCareers.includes($Wardeness.career)>>
		<<set _devBonus++, _trustMalus++, _idleBonus++>>
		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">>
		<<set _devBonus++, _trustMalus += 2, _idleBonus += 2>>
		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))>>
		<<set _devBonus++, _trustMalus++, _idleBonus++>>
		Her molestation of the prisoners is more varied and effective because she has a dick to fuck them with.
	<</if>>
	<<if ($Wardeness.muscles > 35)>>
		<<set _devBonus++, _trustMalus++, _idleBonus++>>
		She is strong enough to restrain anyone that tries anything with her own hands.
	<</if>>
	<<if ($Wardeness.devotion > 95)>>
		<<set _devBonus++, _trustMalus++, _idleBonus++>>
		Her devotion to you is so absolute that she sees breaking bitches for your service as a noble calling.
	<</if>>
	<<for _dI = 0; _dI < _DL; _dI++>>
		<<set $i = $slaveIndices[$CellBiIDs[_dI]]>>
		<<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[_FLs].rivalry++, $slaves[$i].rivalry++>>
			<</if>>
		<<elseif $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[_FLs].relationship = 0, $slaves[_FLs].relationshipTarget = 0, $slaves[$i].relationship = 0, $slaves[$i].relationshipTarget = 0>>
			<</if>>
		<<elseif $familyTesting == 1 && totalRelatives($slaves[$i]) > 0>>
			<<if $slaves[$i].mother == $Wardeness.ID || $slaves[$i].father == $Wardeness.ID>>
				She shows her daughter $slaves[$i].slaveName no mercy, making sure she understands her place.
				<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
			<<elseif $slaves[$i].ID == $Wardeness.mother>>
				She shows her mother $slaves[$i].slaveName no mercy, making sure she understands her place.
				<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
			<<elseif $slaves[$i].ID == $Wardeness.father>>
				She shows her father $slaves[$i].slaveName no mercy, making sure she understands her place.
				<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
			<<elseif areSisters($slaves[$i], $Wardeness) == 1>>
				She shows her twin sister $slaves[$i].slaveName no mercy, making sure she understands her place.
				<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
			<<elseif areSisters($slaves[$i], $Wardeness) == 2>>
				She shows her sister $slaves[$i].slaveName no mercy, making sure she understands her place.
				<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
			<<elseif areSisters($slaves[$i], $Wardeness) == 3>>
				She shows her half-sister $slaves[$i].slaveName no mercy, making sure she understands her place.
				<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
			<</if>>
		<<elseif $Wardeness.relationTarget == $slaves[$i].ID && $familyTesting == 0>>
			She shows her $slaves[$i].relation $slaves[$i].slaveName no mercy, making sure she understands her place.
			<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
		<</if>>
	<</for>>
	<<if (_DL < $cellblock)>>
		<<set _seed = random(1,10)+(($cellblock-_DL)*(random(150,170)+(_idleBonus*10))), $cash += _seed>>

    Since she doesn't have enough prisoners to manage to keep her busy, she works on citizens' slaves, earning @@.yellowgreen;¤_seed.@@
	<</if>>
	<<if (_DL > 0)>>

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

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

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

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

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

		<</if>>
		/* 000-250-006 */
		''__@@.pink;<<SlaveFullName $slaves[$i]>>@@__'' is serving as the Wardeness in $cellblockName.

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

<<include "SA devotion">>
	<<else>>
		<<silently>>
		<<include "SA chooses own clothes">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<include "SA drugs">>
		<<include "SA relationships">>
		<<include "SA rivalries">>
		<<include "SA devotion">>
		<</silently>>
	<</if>>
	<<set $Wardeness = $slaves[_FLs]>>
<</if>>

<<for _dI = 0; _dI < _DL; _dI++>>
	<<set $i = $slaveIndices[$CellBiIDs[_dI]]>>
	<<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 $cellblockDecoration == "Hedonistic">>
		<<if $slaves[$i].weight < 200>>
			<<set $slaves[$i].weight += 3>>
		<</if>>
		<<if $slaves[$i].muscles > -100>>
			<<set $slaves[$i].muscles -= 2>>
		<</if>>
	<</if>>
	<<if $cellblockUpgrade == 1>>
		<<if ($slaves[$i].behavioralFlaw != "none") && ($slaves[$i].behavioralQuirk == "none")>>
			<<SoftenBehavioralFlaw $slaves[$i]>>
			<<set $slaves[$i].devotion -= 10, _softenedQuirks++>>
		<<elseif ($slaves[$i].sexualFlaw != "none") && ($slaves[$i].sexualQuirk == "none")>>
			<<SoftenSexualFlaw $slaves[$i]>>
			<<set $slaves[$i].devotion -= 10, _softenedQuirks++>>
		<</if>>
	<</if>>
	<<set $slaves[$i].devotion += _devBonus, $slaves[$i].trust -= _trustMalus>>
	<<if ($Wardeness != 0) && ($Wardeness.sexualFlaw == "malicious") && ($slaves[$i].energy >= 2)>>
		<<set $slaves[$i].energy -= 2>>
	<</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 $showEWD != 0>>

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

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

		<</if>>
		/* 000-250-006 */
		''__@@.pink;<<SlaveFullName $slaves[$i]>>@@__''
		<<if $slaves[$i].choosesOwnAssignment == 2>>
			<<include "SA chooses own job">>
		<<else>>
			is confined in $cellblockName.
		<</if>>

    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">>
	<<else>>
		<<silently>>
		<<include "SA chooses own job">>
		<<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>>
	<</if>>
<</for>>
<<if (_softenedQuirks) || (_brokenSlaves)>>

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

<</if>>


code:
:: Change Language

<<nobr>>

<<set $nextButton = "Confirm changes", $nextLink = "Manage Arcology">>

<<set $revivalistLanguage = 0>>
<<if $arcologies[0].FSRomanRevivalist != "unset">>
	<<if $language != "Latin">>
	<<set $revivalistLanguage = "Latin">>
	<</if>>
<<elseif $arcologies[0].FSAztecRevivalist != "unset">>
	<<if $language != "Nahuatl">>
	<<set $revivalistLanguage = "Nahuatl">>
	<</if>>
<<elseif $arcologies[0].FSEgyptianRevivalist != "unset">>
	<<if $language != "Ancient Egyptian">>
	<<set $revivalistLanguage = "Ancient Egyptian">>
	<</if>>
<<elseif $arcologies[0].FSEdoRevivalist != "unset">>
	<<if $language != "Japanese">>
	<<set $revivalistLanguage = "Japanese">>
	<</if>>
<<elseif $arcologies[0].FSArabianRevivalist != "unset">>
	<<if $language != "Arabic">>
	<<set $revivalistLanguage = "Arabic">>
	<</if>>
<<elseif $arcologies[0].FSChineseRevivalist != "unset">>
	<<if $language != "Chinese">>
	<<set $revivalistLanguage = "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 = "English">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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 = "Spanish">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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 = "Portuguese">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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 = "Arabic">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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 = "Chinese">>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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 = $seed>>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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 = $revivalistLanguage>>
	<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
	<<for $i = 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:
:: 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 < 40>>
	<<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 < -10>>
	<<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 [silently]

<<assignJob $slaves[$i] "take classes">>

<<goto "Main">>