code:
:: Criminal Market [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $encyclopedia = "Slave Schools", $slaveMarket = $weeklyMarket>>

<<if ndef $newSlaves>><<set $newSlaves = []>><</if>>
<<if $newSlaves.length > 0>>
	<<set $nextButton = "Continue", $nextLink = "Bulk Slave Intro", $returnTo = "Main", $newSlaveIndex = 0>>
<</if>>

You board the transport to
<<switch $weeklyMarket>>
<<case "low tier criminals">> /* mixed prisoners */

	a small prison on the edge of the city spanning from the foot of your arcology with the appearance of an old world police station. You arrive inside and are met by a cute receptionist, asking why one such as yourself would visit such a place. With formalities out of the way, the head of the station is called and arrives shortly. "Well now, didn't expect to see you here. Came to pick up a criminal and give them a chance at not being a menial?" You are then led further into the station and into the prisoners' quarters; most of them appear downcast and dismal, but some look up to see what the commotion is about. "You! Come here! This fine <<if $PC.title == 1>>gentleman<<else>>lady<</if>> wants to take a look, so be on your best behavior!" the head calls out, bringing one of the criminals close enough to be inspected.

<<case "gangs and smugglers">> /* males only, or females only if $seeDicks == 0 */

	a large gray prison at the edge of the Free City as word of your approach is sent ahead. The visage of the prison itself is a grim one, enclosed by a large gray concrete fence with electrified barbed wire coiled at the top. As the vehicle rolls to a stop before a large gate, the guard in control of the gate operates a board of buttons and levers, promptly opening it so it may continue. "Stay on the road," he respectfully advises, a final remark before letting your driver carry on. Beyond the fence is an array of guard towers manned with drones for 24/7 surveillance, giving you a clear idea of what was to happen if you were not to heed the guard's words and decided to wander off from the group.

	Your destination at the end of the road is a garage, where upon your disembarking, no less than 4 heavily armored guards with electric batons at their sides come to greet you. You could almost mistake them for unmanned drones had they not start speaking. "We've been expecting you; please follow us. We house some dangerous individuals in our establishment and we need to keep you safe." You accept their advice and enter the premises.

	You are met with a dimly lit concrete hallway as you enter, only for it to open up to a multi-floor prison that had placed its prisoners underground for the most part<<if ($PC.title == 0 || $PC.boobs >= 1000 || $PC.butt >= 3) && $seeDicks > 0>>, where you are met with a hailstorm of whistles, cheers and other catcalls<</if>>. You come to a bridge and look down to see its inhabitants, hard criminals that are coming together for a meal. You watch a fight break out at one point and an armored guard quickly step in and apply his baton to the offenders, coupled with a loud zap that silences the entire area. Around your level, you see the better stock: the attractive prisoners one would show to an interested customer.

	You finally reach the warden's office, "Welcome <<if $PC.title == 1>>Mister<<else>>Miss<</if>> $PC.slaveSurname, I never thought my prison could have turned to a trade such as this, but times are hard." He beckons you to the seat opposite him, "but I'm not one to complain when an opportunity such as this comes my way." He motions to his guards to bring in a select stock for your perusal. "We house some tough nuts in this establishment, but if you believe you can capitalize on these criminals, we'll be happy to have you take them off our hands." The guard returns with a convict ready to be sold.

<<case "white collar">> /* mixed prisoners */

	what looks more like an oversized vacation home rather than something one goes to for committing crimes. You enter the premises into a small chamber with a booth to the side and are immediately met with a cheerful "Ah! We've been waiting for you. Please go in. We'll call someone to guide you immediately."

	You nod at the prompt and enter further into the luxurious building to find a formally dressed guide and what appears to be the holding area of the prison. The cells, if you can call them that, are large and cozy, each with their own computer and television. The air is also conditioned for their comfort and old world classical music is playing to provide further ambiance. Walking through, you see the prisoners themselves, lazing about in their beds, sitting at their computers, or just talking to each other. If there was ever a prison you'd rather end up in, this would be it.

	You enter the warden's office and are greeted with all due formalities. "Glad to see you at our establishment. When I heard that someone as renowned as yourself was coming over, I made the appropriate preparations." You are served a cup of tea as she brings in the chosen stock for you to observe at your leisure.

<<case "military prison">>

	a holding facility for prisoners of war located on the outskirts of the Free City, which is reasonable due to the dangers inherent to the criminals imprisoned in such an establishment. The driver radios ahead that you and several other interested parties will be arriving shortly. Once you disembark at the edge of the grounds, you are recognized by the stationed guard and ushered into a heavily armored vehicle. <<if $PC.career == "mercenary">>The interior brings back memories and you completely<<else>>Although the interior makes you feel like a prisoner, you<</if>> understand the reasoning behind such a design choice.

	Once you arrive at the prison, the door opens to a garage and another door, brightly lit to welcome you to the premises. Through the door, you find the prisoner's quarters, each of them enclosed by electrified fences to ensure your safety as you see the stock. A guard enters, asking you to follow him as he leads you across the chamber to meet with the warden.

	Entering the warden's quarters, you take a seat across from him as he takes the initiative. "Ah, fancy meeting one such as yourself here. Though we house some of the hardiest criminals you can find, I'm sure one such as yourself could find great use for them." He smirks. "... or perhaps great entertainment through the pits," he says as he beckons to his staff as they bring in the selected stock.

<</switch>>

<<set _marketResult = generateMarketSlave($weeklyMarket)>>
<<set $activeSlave = _marketResult.slave>>
<<print _marketResult.text>>

<<set _slaveCost = slaveCost($activeSlave)>>
<<setLocalPronouns $activeSlave>>
<<if $slavesSeen > $slaveMarketLimit>><<set _slaveCost += Math.trunc(_slaveCost*(($slavesSeen-$slaveMarketLimit)*0.1))>><</if>>

It will cost <<print cashFormat(_slaveCost)>> to enslave $him.

[[Inspect a different prisoner|Criminal Market][$slavesSeen += 1]]
<<if $cash >= _slaveCost>>

[["Enslave " + $him + " and check out other available prisoners"|Criminal Market][cashX(forceNeg(_slaveCost), "slaveTransfer", $activeSlave), $newSlaves.push($activeSlave), $introType = "multi", $slavesSeen+=1]]
	<<if $newSlaves.length == 0>>

[["Enslave " + $him|New Slave Intro][cashX(forceNeg(_slaveCost), "slaveTransfer", $activeSlave),$nextButton = "Continue",$nextLink = "AS Dump",$returnTo = "Main"]]
	<<else>>

[["Enslave " + $him + " and finish your inspection"|Bulk Slave Intro][cashX(forceNeg(_slaveCost), "slaveTransfer", $activeSlave), $newSlaves.push($activeSlave)]]
	<</if>>
<<else>>
	//You lack the necessary funds to enslave this criminal.//
<</if>>
<<if $newSlaves.length > 0>>

[[Finish your enslavement of prisoners|Bulk Slave Intro]]
<</if>>

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

<<set _slaveCost = slaveCost($activeSlave)>>


code:
:: Customize Slave Trade [nobr]

<<if ndef $nationalities>>
	<<set $nationalities = {}>>
<</if>>
<<if ndef $baseControlsFilter>>
	<<set $baseControlsFilter = "all">>
<</if>>
<<if ndef $customWA>>
	<<set $customWA = 0>>
<</if>>

	When civilization turned upon itself, some countries readily took to enslaving their own. Others were raided by their neighbors for their desirable, and profitable, citizens. Which nationalities were most affected by the booming slave trade, and thus, likely to appear in your local slave markets?

	+ to increase pop. – to reduce pop. 0 to remove entirely

	<<include "Basenationalities Controls">>

	[[Reset filters|passage()][$baseControlsFilter = "all"]] | [[Clear all nationalities|passage()][$nationalities = {}]]

	Vanilla presets:
	<<= App.CustomSlaveTrade.generatePresetLinks("Vanilla")>>

	Mod presets:
	<<= App.CustomSlaveTrade.generatePresetLinks("Mod")>>

	<<link "Export Settings">><><</link>> | <<link "Import Settings">><><</link>>

repo_name: KnightBoulegard/fc

license: mit


code:
:: Edit Genetics [nobr]

<>


code:
:: Elite Slave [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves">>
<<set $encyclopedia = "Slave Schools">>

You check to see if any potential breeding slaves are on auction. <<if $eliteAuctioned == 1>>There are none available right now, but there probably will be next week.<<else>>

<<set $eliteAuctioned = 1>>

<<if $arcologies[0].FSMaturityPreferentialist > 20>>
	<<set $activeSlaveOneTimeMinAge = 25>>
<<else>>
	<<set $activeSlaveOneTimeMinAge = $fertilityAge>>
<</if>>
<<if $arcologies[0].FSYouthPreferentialist > 20>>
	<<set $activeSlaveOneTimeMaxAge = 23>>
<<else>>
	<<set $activeSlaveOneTimeMaxAge = 40>>
<</if>>
<<set $one_time_age_overrides_pedo_mode = 1>>
<<set $oneTimeDisableDisability = 1>>
<<if $arcologies[0].FSSupremacist != "unset">>
	<<set $fixedRace = $arcologies[0].FSSupremacistRace>>
<<elseif $arcologies[0].FSSubjugationist != "unset">>
	<<set _races = ["amerindian", "asian", "asian", "asian", "asian", "asian", "asian", "black", "black", "indo-aryan", "indo-aryan", "latina", "latina", "latina", "malay", "malay", "middle eastern", "middle eastern", "mixed race", "pacific islander", "semitic", "semitic", "southern european", "southern european", "white", "white", "white", "white", "white", "white", "white", "white", "white"]>>
	<<set _races = _races.delete($arcologies[0].FSSubjugationistRace)>>
	<<set $fixedRace = _races.random()>>
<</if>>
<<set $activeSlave = GenerateNewSlave("XX")>>
<<set $activeSlave.origin = "$He was purchased from a member of the Elite.">>
<<set $activeSlave.career = "a slave">>
<<set $activeSlave.prestige = 1>>
<<set $activeSlave.trust = random(60,100)>>
<<set $activeSlave.devotion = random(60,100)>>
<<if $arcologies[0].FSPetiteAdmiration > 20>>
	<<if !heightPass($activeSlave)>>
		<<set $activeSlave.height = Math.trunc(Height.random($activeSlave, {limitMult: [-4, -2]}))>>
	<</if>>
<<elseif $arcologies[0].FSStatuesqueGlorification > 20>>
	<<if !heightPass($activeSlave)>>
		<<set $activeSlave.height = Math.trunc(Height.random($activeSlave, {limitMult: [3, 5]}))>>
	<</if>>
<</if>>
<<if $arcologies[0].FSPaternalist > 20>>
	<<run setHealth($activeSlave, 100, 0, 0, 0, 0)>>
	<<set $activeSlave.intelligenceImplant = 30>>
<<else>>
	<<run setHealth($activeSlave, jsRandom(10, 60), undefined, undefined, 0)>>
	<<set $activeSlave.intelligenceImplant = either(0,15,30)>>
<</if>>
<<if $arcologies[0].FSSlimnessEnthusiast > 20>>
	<<if $arcologies[0].FSHedonisticDecadence > 20 || $arcologies[0].FSPhysicalIdealistLaw == 1>>
		<<set _weightMax = 30>>
	<<else>>
		<<set _weightMax = 0>>
	<</if>>
<<elseif $arcologies[0].FSPhysicalIdealistLaw == 1>>
	<<set _weightMax = 30>>
<<else>>
	<<set _weightMax = 100>>
<</if>>
<<if $arcologies[0].FSHedonisticDecadence > 20>>
	<<if $arcologies[0].FSSlimnessEnthusiast > 20>>
		<<set _weightMin = 10>>
	<<else>>
		<<set _weightMin = 95>>
	<</if>>
<<else>>
	<<set _weightMin = -70>>
<</if>>
<<set $activeSlave.weight = random(_weightMin, _weightMax)>>
<<if $arcologies[0].FSPhysicalIdealist > 20>>
	<<if $arcologies[0].FSPhysicalIdealistLaw == 1>>
		<<set _musclesMin = 20>>
		<<set _musclesMax = 50>>
	<<else>>
		<<set _musclesMin = 95>>
		<<set _musclesMax = 100>>
	<</if>>
<<elseif $arcologies[0].FSHedonisticDecadence > 20>>
	<<if $arcologies[0].FSHedonisticDecadenceStrongFat == 1>>
		<<set _musclesMin = 50>>
		<<set _musclesMax = 100>>
	<<else>>
		<<set _musclesMin = -100>>
		<<set _musclesMax = 50>>
	<</if>>
<<else>>
	<<set _musclesMin = -50>>
	<<set _musclesMax = 50>>
<</if>>
<<set $activeSlave.muscles = random(_musclesMin, _musclesMax)>>
<<if $arcologies[0].FSPhysicalIdealist > 20>>
	<<set $activeSlave.height += 5>>
<</if>>
<<run eyeSurgery($activeSlave, "both", "normal")>>
<<set $activeSlave.hears = 0>>
<<if ($activeSlave.weight < -30)>>
	<<set $activeSlave.waist = random(-55,0)>>
<<elseif $activeSlave.physicalAge < 13>>
	<<set $activeSlave.waist = random(-25,25)>>
<<elseif ($activeSlave.weight <= 30)>>
	<<set $activeSlave.waist = random(-45,5)>>
<<elseif ($activeSlave.weight <= 160)>>
	<<set $activeSlave.waist = random(-20,10)>>
<</if>>
<<if $activeSlave.voice < 2>>
	<<set $activeSlave.voice++>>
<</if>>
<<if $activeSlave.accent > 1>>
	<<set $activeSlave.accent = 1>>
<</if>>
<<if $activeSlave.shoulders > 0>>
	<<set $activeSlave.shoulders -= 2>>
<</if>>
<<if $arcologies[0].FSAssetExpansionist > 20>>
	<<set $activeSlave.boobs = (random(50,500) * 100)>>
	<<set $activeSlave.butt = random(6,20)>>
	<<if $arcologies[0].FSTransformationFetishist > 20>>
		<<set $activeSlave.boobsImplant = $activeSlave.boobs-200>>
		<<if $activeSlave.boobsImplant > 10000>>
			<<set $activeSlave.boobsImplantType = "hyper fillable">>
		<<else>>
			<<set $activeSlave.boobsImplantType = "advanced fillable">>
		<</if>>
		<<set $activeSlave.buttImplant = $activeSlave.butt-1>>
		<<if $activeSlave.buttImplant > 9>>
			<<set $activeSlave.buttImplantType = "hyper fillable">>
		<<else>>
			<<set $activeSlave.buttImplantType = "advanced fillable">>
		<</if>>
	<</if>>
<<elseif $arcologies[0].FSSlimnessEnthusiast > 20>>
	<<set $activeSlave.boobs = (random(3,5) * 100)>>
	<<set $activeSlave.butt = random(0,2)>>
	<<if $arcologies[0].FSTransformationFetishist > 20>>
		<<set $activeSlave.boobsImplant = $activeSlave.boobs-50>>
		<<set $activeSlave.boobsImplantType = "normal">>
		<<if $activeSlave.butt > 1>>
			<<set $activeSlave.buttImplant = 1>>
			<<set $activeSlave.buttImplantType = "normal">>
		<</if>>
	<</if>>
<<else>>
	<<set $activeSlave.boobs = (random(5,10) * 100)>>
	<<set $activeSlave.butt = random(3,7)>>
	<<if $arcologies[0].FSTransformationFetishist > 20>>
		<<set $activeSlave.boobsImplant = $activeSlave.boobs-200>>
		<<set $activeSlave.boobsImplantType = "normal">>
		<<set $activeSlave.buttImplant = $activeSlave.butt-1>>
		<<set $activeSlave.buttImplantType = "normal">>
	<</if>>
<</if>>
<<if $arcologies[0].FSTransformationFetishist > 20>>
	<<set $activeSlave.boobShape = "normal">>
<<else>>
	<<set $activeSlave.boobShape = either("perky", "perky", "torpedo-shaped", "wide-set")>>
<</if>>
<<if $activeSlave.nipples == "tiny">>
	<<set $activeSlave.nipples = "puffy">>
<</if>>
<<set $activeSlave.face = 100>>
<<set $activeSlave.faceShape = either("cute", "cute", "exotic", "exotic", "normal", "normal", "sensual", "sensual", "sensual")>>
<<set $activeSlave.lips = random(45,75)>>
<<if $arcologies[0].FSTransformationFetishist > 20>>
	<<set $activeSlave.lips += 25>>
	<<set $activeSlave.lipsImplant = 25>>
<</if>>
<<if $activeSlave.teeth != "normal" && $activeSlave.physicalAge >= 12>>
	<<set $activeSlave.teeth = "normal">>
<</if>>
<<if $activeSlave.vaginaLube == 0>>
	<<set $activeSlave.vaginaLube++>>
<</if>>
<<set $activeSlave.preg = 0>>
<<set $activeSlave.counter.birthsTotal = either(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 4)>>
<<if $arcologies[0].FSPastoralist > 20 || $activeSlave.counter.birthsTotal > 0>>
	<<set $activeSlave.lactation = 1>>
	<<if $arcologies[0].FSPastoralist > 20>>
		<<set $activeSlave.lactationAdaptation = $arcologies[0].FSPastoralist>>
	<<else>>
		<<set $activeSlave.lactationAdaptation = Math.min($activeSlave.counter.birthsTotal*10, 100)>>
	<</if>>
<<else>>
	<<set $activeSlave.lactation = either(0, 0, 0, 0, 1)>>
<</if>>
<<if $activeSlave.lactation > 0>>
	<<set $activeSlave.lactationDuration = 2>>
<</if>>
<<if $activeSlave.counter.birthsTotal > 0>>
	<<set $activeSlave.vagina = random(2,3)>>
	<<set $activeSlave.pregWeek = either(-4, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)>>
<<else>>
	<<set $activeSlave.vagina = random(0,3)>>
	<<set $activeSlave.pregWeek = 0>>
<</if>>
<<if $activeSlave.hips <= 0>>
	<<set $activeSlave.hips = 1>>
<</if>>
<<if $arcologies[0].FSGenderRadicalist > 20>>
	<<set $activeSlave.dick = random(2,5)>>
	<<set $activeSlave.balls = random(2,10)>>
	<<set $activeSlave.scrotum = $activeSlave.balls>>
	<<set $activeSlave.prostate = random(1,3)>>
<</if>>
<<set $activeSlave.makeup = 2>>
<<set $activeSlave.nails = 1>>
<<if $activeSlave.vagina == 0>>
	<<set $activeSlave.skill.vaginal = 30>>
<<else>>
	<<set $activeSlave.skill.vaginal = 60>>
<</if>>
<<if $activeSlave.anus == 0>>
	<<set $activeSlave.skill.anal = 10>>
<<else>>
	<<set $activeSlave.skill.anal = 60>>
<</if>>
<<set $activeSlave.skill.oral = 60>>
<<set $activeSlave.chastityVagina = 1>>
<<set $activeSlave.intelligence = random(51,100)>>
<<if $arcologies[0].FSIntellectualDependency > 20>>
	<<set $activeSlave.energy = 100>>
	<<set $activeSlave.attrXY = 100>>
<<elseif $arcologies[0].FSSlaveProfessionalism > 20>>
	<<set $activeSlave.intelligence = Intelligence.random({limitIntelligence: [80, 100]})>>
	<<if $activeSlave.vagina >= 0>>
		<<set $activeSlave.skill.vaginal = 100>>
	<</if>>
	<<set $activeSlave.skill.anal = 100>>
	<<set $activeSlave.skill.oral = 100>>
	<<set $activeSlave.skill.entertainment = 100>>
	<<set $activeSlave.skill.whoring = 100>>
	<<set $activeSlave.intelligenceImplant = 30>>
<</if>>
<<set $activeSlave.attrKnown = 1>>
<<set $activeSlave.fetishKnown = 1>>
<<set $activeSlave.behavioralQuirk = "confident">>
<<set $activeSlave.sexualQuirk = either("caring", "caring", "gagfuck queen", "perverted", "romantic", "romantic", "strugglefuck queen", "tease", "unflinching")>>
<<set $activeSlave.pubertyXX = 1>>
<<set $activeSlave.breedingMark = 1>>

<<set _slaveCost = slaveCost($activeSlave)>>

It will take <<print cashFormat(_slaveCost)>> to win the auction.

<<if $cash >= _slaveCost>>
	[[Place that bid|New Slave Intro][cashX(forceNeg(_slaveCost), "slaveTransfer", $activeSlave),$nextButton = "Continue",$nextLink = "AS Dump",$returnTo = "Main"]]
<<else>>
	//You lack the necessary funds to place a winning bid.//
<</if>>

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

<</if>>


code:
:: eliteTakeOver [nobr]

<<set $nextButton = " ">>

<<set _pregSurrender = 0>>
/* preg/lobotomization check */
You knew this day would come. Surrounding yourself with powerful people has its boons, but also poses a distinct threat. You've heard them murmuring when you enter the room, you've seen them excuse themselves from your presence, and lately they've been overtly hostile. The Societal Elite have turned on you.

You look up from your desk as the locked door to your office unseals, and a dozen individuals brazenly walk into your view.<<if $Bodyguard != 0>><<setLocalPronouns $Bodyguard>> $Bodyguard.slaveName stands between you and them. A single glare from the leader of the bunch and $he backs off, eyes to the ground.<</if>>

<<if $PC.pregSource == -1 || $PC.pregSource == -6>>
	<<if $PC.refreshmentType == 0>>
		Taking a drag from a fresh $PC.refreshment,
	<<elseif $PC.refreshmentType == 1>>
		Taking a drink of a fresh glass of $PC.refreshment,
	<<elseif $PC.refreshmentType == 2>>
		Taking a bite of a fresh $PC.refreshment,
	<<elseif $PC.refreshmentType == 3>>
		Doing a line of $PC.refreshment,
	<<elseif $PC.refreshmentType == 4>>
		Injecting a hit of $PC.refreshment into your arm,
	<<elseif $PC.refreshmentType == 5>>
		Swallowing a $PC.refreshment,
	<<elseif $PC.refreshmentType == 6>>
		Placing a tab of $PC.refreshment under your tongue,
	<</if>>
	you greet your rather unwelcome guests.

	"You are no longer worthy of being a part of our society. But you carry within you one of our heirs. A conundrum for some, but we have already solved that problem."

	What was that last thing he said? It's getting hard to think right. The $PC.refreshment... Drugged... You collapse onto your desk, unconscious.

	<<if $Bodyguard != 0>>
		A sharp pain and a rush of adrenaline drags you back to your senses. Sneaking a peak, you witness $Bodyguard.slaveName valiantly trying to protect you, despite <<if hasAnyProstheticLimbs($Bodyguard)>>$his cybernetics being locked down<<else>>the overwhelming odds<</if>>. As $he and their leader struggle closer to your desk, his revolver and a syringe are dislodged onto your desk. It seems drugging you wasn't their first thought. With $Bodyguard.slaveName's risky gamble, your fate has fallen back into your hands.
	<<else>>
		You'll spend the rest of your life a breeder to the Societal Elite; blinded and muted. More than a slave, but still less than your master. Life isn't so bad, your two most devoted slaves were taken along to keep you happy, and you are treated quite well, possibilities considered. Though once your eggs dry up, odds are your little remaining usefulness will be at an end. Best not to think too much into it.
		<<set _pregSurrender = 1>>
		<<set $ui = "start">>

		''GAME OVER''
	<</if>>
<<else>>
	The leader reaches into his jacket and extracts a syringe, you recognize it as a powerful drug used in lobotomies, and places it to your left. From his hip he pulls a revolver, six-chambered, and loads five bullets, spins the chamber, and places it to your right.

	"You are no longer worthy of being a part of our society. You know you can't be allowed to spread any information. But we are not merciless; one of our members has taken an interest in having you as her pet. You may choose to lose your mind, and service her until she tires of you, or gamble for your life and serve her anyway. Now decide."
<</if>>

<<if _pregSurrender == 0>>
	<<set $finalChoice = "final stand">>
	The choice is simple — you will not be a slave.

	You decide to make a final stand.

	<<if $Bodyguard != 0>>

		<<if $PC.pregSource == -1 || $PC.pregSource == -6>>
			$Bodyguard.slaveName is already doing everything in $his power to save you.
		<<else>>
			<<link "Attempt to signal $Bodyguard.slaveName, your bodyguard">>
				<<set $finalChoice = "bodyguard">>
				<<replace "#fate">>
					attempt to signal $Bodyguard.slaveName, your bodyguard.
				<</replace>>
			<</link>>
		<</if>>
	<</if>>
	<<if $mercenaries >= 1>>

		<<link "Send a message to the leader of the $mercenariesTitle">>
			<<set $finalChoice = "mercenaries">>
			<<replace "#fate">>
				send a message to the leader of the $mercenariesTitle.
			<</replace>>
		<</link>>
	<</if>>
	<<if $SF.Toggle && $SF.Active >= 1>>

 <<set _N = App.SF.SFC()>>
		<<link "Send a message to _N">>
			<<set $finalChoice = "SF">>
			<<replace "#fate">>
				send a message to <<print App.SF.SFC()>>.
			<</replace>>
		<</link>>
	<</if>>
	<<if $PC.pregSource != -1 && $PC.pregSource != -6>>

		<<link "Try and enrage them.">>
			<<set $finalChoice = "enrage">>
			<<replace "#fate">>
				try and enrage them, baiting them into a vulnerable position.
			<</replace>>
		<</link>>
	<</if>>

	<<link "Make a final stand">>
		<<set $finalChoice = "final stand">>
		<<replace "#fate">>
			make a final stand.
		<</replace>>
	<</link>>

	<<link "Give in">>
		<<set $finalChoice = "give in">>
		<<replace "#fate">>
			give in.
		<</replace>>
	<</link>>

	<<link "Confirm">>
		<<goto "eliteTakeOverFight">>
	<</link>>
<</if>>


code:
:: eliteTakeOverFight [nobr]

<<set _shoot = 0>>
<<switch $finalChoice>>
<<case "bodyguard">>
	<<set _roll = random(0,100)>>
	<<if $career == "mercenary">>
		As a result of your prior experience as a mercenary you were able to successfully signal $Bodyguard.slaveName without the Elites noticing.
		<<set $BodyguardHasSucessfullyRecivedSignal = 1>>
	<<elseif $PC.skill.warfare >= 100 && _roll > 20>>
		As a result of your mastery of warfare you were able to successfully signal $Bodyguard.slaveName without the Elites noticing.
		<<set $BodyguardHasSucessfullyRecivedSignal = 1>>
	<<elseif $PC.skill.warfare >= 60 && _roll > 30>>
		As a result of your expertness of warfare you were able to successfully signal $Bodyguard.slaveName without the Elites noticing.
		<<set $BodyguardHasSucessfullyRecivedSignal = 1>>
	<<elseif $PC.skill.warfare >= 30 && _roll > 40>>
		As a result of having some skill in warfare you were able to successfully signal $Bodyguard.slaveName without the elites noticing.
		<<set $BodyguardHasSucessfullyRecivedSignal = 1>>
	<<elseif $PC.skill.warfare >= 10 && _roll > 50>>
		As a result of having a small amount of skill in warfare you were able to successfully signal $Bodyguard.slaveName without the Elites noticing.
		<<set $BodyguardHasSucessfullyRecivedSignal = 1>>
	<<elseif $PC.skill.warfare < 10 && _roll > 60>>
		By blind luck and what little you remember of your lessons in warfare are were able to successfully signal $Bodyguard.slaveName without the Elites noticing.
		<<set $BodyguardHasSucessfullyRecivedSignal = 1>>
	<<else>>
		One of the Elites shouts "What the fuck are you trying to do?" Well, there goes that option.
		<<set $BodyguardHasSucessfullyRecivedSignal = 0>>
	<</if>>

You then pick up the revolver and quickly take aim.
<<case "mercenaries">>

You send a quick message to the leader of your $mercenariesTitle, about your situation, then you pick up the revolver and quickly take aim.
	<<set $MercenariesMessageSent = 1>>
<<case "SF">>

You send a quick message to <<print App.SF.SFC()>> about your situation, then you pick up the revolver and quickly take aim.
	<<set $SpecialForcesMessageSent = 1>>
<<case "enrage">>
	<<if $PC.career != "wealth" && $PC.career != "engineer" && $PC.career != "medicine">>
		You know exactly what to say in order to enrage them.
		<<set _EliteEnraged = 1>>
	<<elseif random(0,100) > 50>>
		You manage to select the right words to enrage them.
		<<set _EliteEnraged = 1>>
	<<else>>
		You try to enrage them, but your words have had no effect.
		<<set _EliteEnraged = 0>>
	<</if>>

You then pick up the revolver and quickly take aim.
<<case "final stand">>
	You pick up the revolver and quickly take aim.
<<case "give in">>
	You pick up the revolver and hold the barrel to your temple.
<</switch>>

<<if $finalChoice == "give in">>
	<<if $PC.pregSource == -1 || $PC.pregSource == -6>>Screw their plans, you're out of here. <</if>>With a "Bang!" you drop dead.
	<<set $ui = "start">>

	''GAME OVER''
<<else>>
	/* PC shooting */
	/* higher skill means a higher chance to hit due to lower requirements and if the elites are enraged they very slightly become easier targets. */
	/* 5/6 = 83% rounded down is the chance that it was loaded chamber (simplified version based off the Wikipedia article) */

	/* variables: */
	/* Revolver */
	<<set _revolverChambers = 6>>
	<<set _revolverBullets = 5>>
	/*Elites */
	<<set $eliteTotal = 12>>
	<<set $eliteDead = 0>>
	<<set $eliteVegetable = 0>>

	/* To Hit chance */
	<<if $PC.pregSource == -1 || $PC.pregSource == -6>> /* still woozy */
		<<set _toHit = 56>>
	<<elseif $PC.skill.career == "mercenary" || $PC.skill.warfare >= 100>>
		<<set _toHit = 83>>
	<<elseif $PC.skill.warfare >= 60>>
		<<set _toHit = 76>>
	<<elseif $PC.skill.warfare >= 30>>
		<<set _toHit = 67>>
	<<elseif $PC.skill.warfare >= 10>>
		<<set _toHit = 60>>
	<<else>>
		<<set _toHit = 56>>
	<</if>>
	<<if _EliteEnraged == 1>>
		<<set _toHit += 5>>
	<</if>>

	/* shooting */
	/* in the end I removed the messages from the cycle. I don't think having 6 lines of "you shot" is pretty looking. Feel free to re add them in however */
	<<for _i = _revolverChambers; _i > 0; _i-->>
		<<if random(0,100) <= _toHit && _revolverBullets > 0>>
			<<set $eliteDead += 1, _revolverBullets -= 1>>
		<<elseif _revolverBullets > 0>>
			<<set _revolverBullets -= 1>>
		<</if>>
	<</for>>

	<<if $eliteDead >= 1>>

You managed to kill several Elites in rapid succession, leaving the rest in shock and fear.
	<<elseif $eliteDead == 1>>

You managed to kill one Elite, leaving the rest in shock and fear.
	<<else>>

Unfortunately you fail to kill a single Elite.
	<</if>>

	/* syringe shot */
	<<set $eliteVegetable = 0>>
	<<set _druggedThrow = 0>>

	<<if $eliteDead > 0>>
		With $eliteDead Elites dead, you pick up the syringe from the desk and aim for the forehead of another.
	<<else>>
		Having failed to kill them with the revolver, in a desperate move you pick up the syringe from the desk and aim for the forehead of one of the elite.
	<</if>>
	<<if $PC.pregSource == -1 || $PC.pregSource == -6>>But there's two of them... Shaking your head, you realize it's the drugs messing with you. You just need to focus.<</if>>
	<<set _hitRoll = (random(0,100) - _druggedThrow)>>
	<<if $career == "mercenary" && _hitRoll > 0>>
		With your prior history as a mercenary, making the throw is child's play.
		<<set _SyringeHeadShot = 1>>
	<<elseif $PC.skill.warfare >= 100>>
		<<if _hitRoll > 50>>
			As a result of your mastery of warfare you successfully made the throw.
			<<set _SyringeHeadShot = 1>>
		<<else>>
			Unfortunately you miss the shot.
			<<set _SyringeHeadShot = 0>>
		<</if>>
	<<elseif $PC.skill.warfare >= 60>>
		<<if _hitRoll > 60>>
			As a result of your combat expertise you successfully made the throw.
			<<set _SyringeHeadShot = 1>>
		<<else>>
			Unfortunately you miss the shot.
			<<set _SyringeHeadShot = 0>>
		<</if>>
	<<elseif $PC.skill.warfare >= 30>>
		<<if _hitRoll > 70>>
			As you have some skill, you successfully made the throw.
			<<set _SyringeHeadShot = 1>>
		<<else>>
			Unfortunately you miss the shot.
			<<set _SyringeHeadShot = 0>>
		<</if>>
	<<elseif $PC.skill.warfare >= 10>>
		<<if _hitRoll > 80>>
			Your small amount of skill assisted you in making the throw.
			<<set _SyringeHeadShot = 1>>
		<<else>>
			Unfortunately you miss the shot.
			<<set _SyringeHeadShot = 0>>
		<</if>>
	<<elseif $PC.skill.warfare < 10>>
		<<if _hitRoll > 90>>
			By blind luck you successfully made the throw.
			<<set _SyringeHeadShot = 1>>
		<<else>>
			Unfortunately you miss the shot.
			<<set _SyringeHeadShot = 0>>
		<</if>>
	<</if>>
	<<if _SyringeHeadShot == 1>>

		Picking up the spent revolver, you aim for the syringe's plunger.
		<<if $career == "mercenary">>
			With your prior history as a mercenary, making the throw is child's play.
			<<set _SpentRevolverHitSyringePlunger = 1>>
		<<elseif $PC.skill.warfare >= 100 && random(0,100) > 50>>
			As a result of your mastery of warfare you successfully made the throw.
			<<set _SpentRevolverHitSyringePlunger = 1>>
		<<elseif $PC.skill.warfare >= 60 && random(0,100) > 60>>
			As a result of your expertness of warfare you successfully made the throw.
			<<set _SpentRevolverHitSyringePlunger = 1>>
		<<elseif $PC.skill.warfare >= 30 && random(0,100) > 70>>
			As you have some skill you successfully made the throw.
		<<set _SpentRevolverHitSyringePlunger = 1>>
		<<elseif $PC.skill.warfare >= 10 && random(0,100) > 80>>
			Your small amount of skill assisted you in making the throw.
			<<set _SpentRevolverHitSyringePlunger = 1>>
		<<elseif $PC.skill.warfare < 10 && random(0,100) > 90>>
			By blind luck you successfully made the throw.
			<<set _SpentRevolverHitSyringePlunger = 1>>
		<<else>>
			Unfortunately you miss the shot.
			<<set _SpentRevolverHitSyringePlunger = 0>>
		<</if>>
	<</if>>
	<<if _SpentRevolverHitSyringePlunger == 1>>

		<<if random(0,100) > 50>>
			The target dies of nervous system overload brought about by the drug.
			<<set $eliteDead +=1>>
		<<else>>
			The target is still alive but is nothing more than a vegetable.
			<<set $eliteVegetable = 1>>
		<</if>>
	<</if>>
<</if>>

<<set $eliteLeft = $eliteTotal - $eliteDead - $eliteVegetable>>

/* if the player has managed to make enough damage to the Elite and the rep is high enough the citizens will come to save the PC */
/* this is to give reason to exist for the "enrage" and "last stand" option */
/* result							*/
/* $eliteFate:						*/
/*		killed = 0					*/
/*		enslaved = 1				*/
/*		had fun (and enslaved) = 2	*/
<<if $BodyguardHasSucessfullyRecivedSignal == 1>>
	<<setLocalPronouns $Bodyguard>>
	<<run Enunciate($Bodyguard)>>
	$Bodyguard.slaveName asks, "<<Master>>, what <<sh>>ould I do with the <<if $eliteLeft < $eliteTotal>>remaining<</if>> 'Elite' left?"

	<<link "Open fire">>
		<<set $eliteFate = 0>>
		<<goto "eliteTakeOverResult">>
	<</link>>

	<<link "Enslave them">>
		<<set $eliteFate = 1>>
		<<goto "eliteTakeOverResult">>
	<</link>>

<<link "Have fun with them them">>
		<<set $eliteFate = 2>>
		<<goto "eliteTakeOverResult">>
	<</link>>
<<elseif $MercenariesMessageSent == 1>>
	It is now that a squad of $mercenariesTitle makes their entrance, pointing their guns at the <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite.
	The officer asks, "Your orders, <<= properTitle()>>?"

	<<link "Open fire">>
		<<set $eliteFate = 0>>
		<<goto "eliteTakeOverResult">>
	<</link>>

	<<link "Enslave them">>
		<<set $eliteFate = 1>>
		<<goto "eliteTakeOverResult">>
	<</link>>

<<link "Have fun with them them">>
		<<set $eliteFate = 2>>
		<<goto "eliteTakeOverResult">>
	<</link>>
<<elseif $SpecialForcesMessageSent>>
	It is now that a squad of $SF.Lower makes their entrance, pointing their guns at the <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite.
	The officer asks, "Your orders, <<= properTitle()>>?"

	<<link "Open fire">>
		<<set $eliteFate = 0>>
		<<goto "eliteTakeOverResult">>
	<</link>>

	<<link "Enslave them">>
		<<set $eliteFate = 1>>
		<<goto "eliteTakeOverResult">>
	<</link>>

<<link "Have fun with them them">>
		<<set $eliteFate = 2>>
		<<goto "eliteTakeOverResult">>
	<</link>>
<<elseif $Bodyguard != 0>>
	<<setLocalPronouns $Bodyguard>>
	<<run Enunciate($Bodyguard)>>
	It is now that $Bodyguard.slaveName makes $his entrance, pointing $his guns at the <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite.
	$He then asks "<<Master>>, what <<sh>>ould I do with the <<if $eliteLeft < $eliteTotal>>remaining<</if>> 'Elite' left?"

	<<link "Open fire">>
		<<set $eliteFate = 0>>
		<<goto "eliteTakeOverResult">>
	<</link>>

	<<link "Enslave them">>
		<<set $eliteFate = 1>>
		<<goto "eliteTakeOverResult">>
	<</link>>

<<link "Have fun with them them">>
		<<set $eliteFate = 2>>
		<<goto "eliteTakeOverResult">>
	<</link>>
<<elseif $eliteLeft <= 9 && $rep >= 10000>>
	Some of the citizens waiting outside your penthouse to see you hear the ruckus and rush inside, worried. Time seems to freeze for a few seconds, while the remaining Elite recover from their terror and the citizens digest the gory scene in front of them.
	The newcomers are quick to take your side. In little time the Elites, outgunned and outnumbered, are neutralized.

One of the more courageous citizens approaches you and asks "<<= properTitle()>>, what should we do with them?"

	<<link "Open fire">>
		<<set $eliteFate = 0>>
		<<goto "eliteTakeOverResult">>
	<</link>>

	<<link "Enslave them">>
		<<set $eliteFate = 1>>
		<<goto "eliteTakeOverResult">>
	<</link>>

<<link "Have fun with them them">>
		<<set $eliteFate = 2>>
		<<goto "eliteTakeOverResult">>
	<</link>>
<<elseif $finalChoice != "give in">>
	With nothing else left, you remain powerless to stop the <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite, who quickly capture and enslave you. Your personal story may continue, but the part of it worthy of retelling has now ended.
	<<set $ui = "start">>

	''GAME OVER''
<</if>>


code:
:: eliteTakeOverResult [nobr]

<<set $nextButton = "Continue">><<UpdateNextButton>> /* unlock Continue button */

<<if $Bodyguard != 0>>
	<<setLocalPronouns $Bodyguard>>
<</if>>
<<setNonlocalPronouns $seeDicks>>

<<switch $eliteFate>>
<<case 0>>
	<<if $MercenariesMessageSent == 1>>
		The mercenaries open fire as ordered. Shortly after, the conspiring Elite are dead.
	<<elseif $SpecialForcesMessageSent == 1>>
		The soldiers open fire as ordered. Shortly after, the conspiring Elite are dead.
	<<elseif $eliteLeft <= 9 && $rep >= 10000>>
		Your citizens freeze for a second, then obey your orders. Shortly after, the conspiring Elite are dead.
	<<else>>
		Your bodyguard opens fire as ordered. Shortly after, the conspiring Elite are dead.
	<</if>>
<<case 1>>
	<<if random(0,100) > 50>>
		An Elite bites down on a cyanide pill hidden in a false tooth and
		<<if random(0,100) > 75>>
			takes the coward's way out (how predictable), frothing at the mouth.
			<<set $eliteDead += 1>>
		<<else>>
			experiences great pain but unfortunately (for them at least) survives.
		<</if>>
	<</if>>
	<<if $MercenariesMessageSent == 1>>

The <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly captured and enslaved by your mercenaries.
	<<elseif $SpecialForcesMessageSent == 1>>

The <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly captured and enslaved by your soldiers.
	<<elseif $eliteLeft <= 9 && $rep >= 10000>>

The <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly captured and enslaved by your loyal citizens.
	<<else>>

The <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly captured and enslaved by your bodyguard.
	<</if>>
<<case 2>>
	<<if random(0,100) > 50>>
			An Elite bites down on a cyanide pill hidden in a false tooth and
		<<if random(0,100) > 75>>
			takes the coward's way out (how predictable), frothing at the mouth.
			<<set $eliteDead += 1>>
		<<else>>
			experiences great pain but unfortunately (for them at least) survives.
		<</if>>
	<</if>>
	<<if $MercenariesMessageSent == 1>>

The <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly captured, abused and enslaved.
		The officer is thankful for giving the troops a chance to let off some stream. Two soldiers decide to double team an Elite; one ass fucks while the other facefucks.
		Another soldier takes a particular interest in an Elite and politely asks you
		"<<= properTitle()>>, can I keep _himU?"

			<<link "No">>
				<<replace "#choice1">>
					Your rejection upsets some of them, but their professionalism ensures it isn't visible.
				<</replace>>
			<</link>>
			|
			<<link "Yes">>
				<<set $eliteLeft -= 1>>
				<<run repX(2500, "event")>>
				<<replace "#choice1">>
					For a second your acceptance shocks them. Once they recover they are very grateful. "Thank you <<= properTitle()>>, I'll make sure to look after _himU." Soon the story spreads of the kind arcology owner, enhancing your reputation.
				<</replace>>
			<</link>>

	<<elseif $SpecialForcesMessageSent>>

The <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly captured, abused and enslaved.
		<<if $SF.Depravity <= 0.3>>
			Two soldiers decide to double team an Elite; one gropes _hisU ass while the other gropes _hisU tits.
		<<elseif $SF.Depravity <= 1.2>>
			Two soldiers decide to double team an Elite; one assfucks while the other facefucks.
		<<else>>
			Two soldiers decide to double team an Elite; one breaks out their knife and begins to make little breaks in the Elite's skin while the other soldier facefucks them.
		<</if>>
		Another soldier takes a particular interest in an Elite and politely asks you "<<= properTitle()>>, can I keep _himU?"

			<<link "No">>
				<<set _SFHappyEverAfter = 0>>
				<<replace "#choice1">>
					Your rejection upsets some of them, but their professionalism ensures it isn't visible.
				<</replace>>
			<</link>>
			|
			<<link "Yes">>
				<<set $eliteLeft -= 1, _SFHappyEverAfter = 1>>
				<<run repX(2500, "event")>>
				<<replace "#choice1">>
					For a second your acceptance shocks them. Once they recover they are very grateful. "Thank you <<= properTitle()>>, I'll make sure to look after _himU." Soon the story spreads of the kind arcology owner, enhancing your reputation.
				<</replace>>
			<</link>>

		<<if $SF.MercCon.CanAttend === -1>>
			<<switch $SF.Colonel.Core>>
			<<case "kind">>
				The Colonel is shocked that you would allow her troops to do this but understands that it comes with the territory.<<if _SFHappyEverAfter == 1>> "Thanks for being kind to one of my soldiers."<</if>>
			<<case "brazen" "cruel" "jaded">>
				The Colonel is grateful that you let her troops let off some steam.<<if _SFHappyEverAfter == 1>> "Thanks for being kind to one of my soldiers."<</if>>
			<</switch>>
		<</if>>
		<<set $SF.Depravity += 0.05>>
	<<elseif $eliteLeft <= 9 && $rep >= 10000>>
		<<if $arcologies[0].FSDegradationist != "unset">>
			An evil smile appears on the faces of your loyal citizens, while the surviving Elite freeze in terror. The impromptu festivity will go on for hours, getting more and more depraved.
		<<else>>
			While some citizens respectfully step out, some join you in the fun. The impromptu festivities will go on for hours, getting more and more depraved.
		<</if>>
	<<else>>
		<<if $Bodyguard.fetish == "sadist">>$Bodyguard.slaveName gets out $his melee weapon and starts to give them many small cuts, the look of pleasure on $his face is evident.<<else>>$Bodyguard.slaveName ties them and then gets out $his melee weapon and starts to abuse them; $his face is blank.<</if>>

Shortly after, the terrified <<if $eliteLeft < $eliteTotal>>remaining<</if>> Elite are quickly brought away to be officially enslaved.
	<</if>>
<</switch>>

<<if $eliteFate >= 1>>
	<<if $eliteVegetable == 1>>
		<<set $eliteLeft-->>
		<<set $activeSlaveOneTimeMinAge = 25>>
		<<set $activeSlaveOneTimeMaxAge = ($retirementAge-2)>>
		<<set $oneTimeDisableDisability = 1>>
		<<if $arcologies[0].FSSupremacistLawME == 1>>
			<<set $fixedRace = $arcologies[0].FSSupremacistRace>>
		<<elseif $arcologies[0].FSSubjugationistLawME == 1>>
			<<set _races = setup.filterRacesLowercase.filter(race => race !== $arcologies[0].FSSubjugationistRace)>>
			<<set $fixedRace = _races.random()>>
		<</if>>
		<<if $seeDicks == 0>>
			<<set $activeSlave = GenerateNewSlave("XX")>>
		<<elseif $seeDicks == 100>>
			<<set $activeSlave = GenerateNewSlave("XY")>>
		<<elseif random(1,100) > 50>> /* 50% chance of getting girl or boy */
			<<set $activeSlave = GenerateNewSlave("XX")>>
		<<else>>
			<<set $activeSlave = GenerateNewSlave("XY")>>
		<</if>>
		<<set _origin = "$He was a member of the Societal Elite, captured in their failed attempt at expressing their displeasure.">>
		<<set $activeSlave.origin = _origin>>
		<<set $activeSlave.career = "a well connected individual">>
		<<set $activeSlave.prestige = either(2,2,3)>> /* 33% chance of getting level 3 prestige */
		<<set $activeSlave.prestigeDesc = "$He was once considered influential in society, but now $he's the one getting fucked.">>
		<<set $activeSlave.face = random(70,100)>>
		<<set $activeSlave.devotion = random(-10,-20)>>
		<<set $activeSlave.trust = random(-20,-30)>>
		<<if $activeSlave.boobShape == "saggy" || $activeSlave.boobShape == "downward-facing">>
			<<set $activeSlave.boobShape = either("perky", "torpedo-shaped", "wide-set")>>
		<</if>>
		<<set $activeSlave.fetish = "mindbroken">>
		<<set $activeSlave.pubicHStyle = "waxed">>
		<<set $activeSlave.underArmHStyle = "waxed">>
		<<set $activeSlave.anus = 0>>
		<<set $activeSlave.weight = random(10,75)>>
		<<set $activeSlave.intelligence = random(70,100)>>
		<<set $activeSlave.intelligenceImplant = 30>>
		<<set $activeSlave.skill.entertainment = 0>>
		<<set $activeSlave.skill.whoring = 0>>
		<<run setHealth($activeSlave, jsRandom(60, 75), 0, 0, 0, jsRandom(0, 20))>>
		<<set $activeSlave.canRecruit = 0>>
		<<run newSlave($activeSlave)>> /* skip New Slave Intro */
	<</if>>
	<<for _i = $eliteLeft; _i > 0; _i-->>
		<<set $activeSlaveOneTimeMinAge = 25>>
		<<set $activeSlaveOneTimeMaxAge = ($retirementAge-2)>>
		<<set $oneTimeDisableDisability = 1>>
		<<if $arcologies[0].FSSupremacistLawME == 1>>
			<<set $fixedRace = $arcologies[0].FSSupremacistRace>>
		<<elseif $arcologies[0].FSSubjugationistLawME == 1>>
			<<set _races = setup.filterRacesLowercase.filter(race => race !== $arcologies[0].FSSubjugationistRace)>>
			<<set $fixedRace = _races.random()>>
		<</if>>
		<<if $seeDicks == 0>>
			<<set $activeSlave = GenerateNewSlave("XX")>>
		<<elseif $seeDicks == 100>>
			<<set $activeSlave = GenerateNewSlave("XY")>>
		<<elseif random(1,100) > 50>> /* 50% chance of getting girl or boy */
			<<set $activeSlave = GenerateNewSlave("XX")>>
		<<else>>
			<<set $activeSlave = GenerateNewSlave("XY")>>
		<</if>>
		<<set _origin = "$He was a member of the Societal Elite, captured in their failed attempt at expressing their displeasure.">>
		<<set $activeSlave.origin = _origin>>
		<<set $activeSlave.career = "a well connected individual">>
		<<set $activeSlave.prestige = either(2,2,3)>>
		<<set $activeSlave.prestigeDesc = "$He was once considered influential in society, but now $he's the one getting fucked.">>
		<<set $activeSlave.face = random(70,100)>>
		<<set $activeSlave.devotion = random(-10,-20)>>
		<<set $activeSlave.trust = random(-20,-30)>>
		<<if $eliteFate == 2 && random(1,100) >= 75>> /* 25% chance of getting mindbroken elites if they were abused */
			<<set $activeSlave.fetish = "mindbroken">>
		<</if>>
		<<if $activeSlave.boobShape == "saggy" || $activeSlave.boobShape == "downward-facing">>
			<<set $activeSlave.boobShape = either("perky", "torpedo-shaped", "wide-set")>>
		<</if>>
		<<set $activeSlave.pubicHStyle = "waxed">>
		<<set $activeSlave.underArmHStyle = "waxed">>
		<<set $activeSlave.anus = 0>>
		<<set $activeSlave.weight = random(-30,75)>>
		<<set $activeSlave.intelligence = random(0,60)>>
		<<set $activeSlave.intelligenceImplant = 30>>
		<<set $activeSlave.skill.entertainment = 0>>
		<<set $activeSlave.skill.whoring = 0>>
		<<run setHealth($activeSlave, jsRandom(60, 75), 0, 0, 0, jsRandom(0, 20))>>
		<<set $activeSlave.canRecruit = 0>>
		<<set $activeSlave.behavioralFlaw = either("arrogant", "bitchy")>>
		<<run newSlave($activeSlave)>> /* skip New Slave Intro */
	<</for>>
<</if>>

/* clean up */
<<set $failedElite = 0, $eugenicsFullControl = 1>>


code:
:: fat grafting workaround [nobr]

<<set $nextButton = "Finalize fat transfer", $nextLink = "Surgery Degradation">>

Enough graftable body fat was harvested for an additional <<print $availabeFat*100>>ccs per breast or an additional <<if getSlave($AS).butt <= 10>><<print $availabeFat/2>><<else>><<print $availabeFat/5>><</if>> sizes to $his rear. <<if $availabeFat == 0>>All fat marked for use<<else>>A total of $availabeFat unit<<if $availabeFat > 1>>s<</if>> remain<</if>>.

$boobFat units of fat will be added to $his breasts for a size gain of <<print $boobFat*100>>ccs.

<<if $availabeFat > 0>>
	[[Increase|fat grafting workaround][$boobFat++, $availabeFat--]] |
<<else>>
	No more fat available. |
<</if>>
<<if $boobFat > 0>>
	[[Decrease|fat grafting workaround][$boobFat--, $availabeFat++]]
<<else>>
	No fat marked for breast use.
<</if>>

<<if getSlave($AS).butt <= 10>><<print $buttFat*2>><<else>><<print $buttFat*5>><</if>> units of fat will be added to $his ass for a size gain of $buttFat.
<<if getSlave($AS).butt > 10>>

	<<if $availabeFat > 0>>
		[[Increase|fat grafting workaround][$buttFat += .2, $availabeFat -= 1]] |
	<<else>>
		No more fat available. |
	<</if>>
	<<if $buttFat > 0>>
		[[Decrease|fat grafting workaround][$buttFat -= .2, $availabeFat += 1]]
	<<else>>
		No fat marked for ass use.
	<</if>>
<<else>>

	<<if $availabeFat > 0>>
		[[Increase|fat grafting workaround][$buttFat += .5, $availabeFat -= 1]] |
	<<else>>
		No more fat available. |
	<</if>>
	<<if $buttFat > 0>>
		[[Decrease|fat grafting workaround][$buttFat -= .5, $availabeFat += 1]]
	<<else>>
		No fat marked for ass use.
	<</if>>
<</if>>


code:
:: Gene Lab [nobr jump-to-safe jump-from-safe]

<<set $nextButton = "Back", $nextLink = "Manage Penthouse", $encyclopedia = "The Pharmaceutical Fab.", _PCSkillCheck = Math.min($upgradeMultiplierMedicine, $HackingSkillMultiplier)>>

The Gene Lab

<<if $geneticMappingUpgrade == 1>>
	//The gene lab is fully operational. It is capable of mapping a slave's genes, identifying genetic traits and abnormalities. It can be used to modify a slave's genome should you obtain the data necessary to adjust it.//

	[[Upgrade the genome mapper|Gene Lab][cashX(forceNeg(Math.trunc(500000*$upgradeMultiplierArcology)), "capEx"), $geneticMappingUpgrade = 2]]
	//Costs <<print cashFormat(Math.trunc(500000*$upgradeMultiplierArcology))>>//
<<elseif $geneticMappingUpgrade == 2>>
	//The gene lab is fully operational. It is capable of fully mapping a slave's genes, identifying genetic traits and abnormalities. It can be used to correct (or flaw) a slave's genome, as well as modify it should you obtain the data necessary to adjust it.//
<</if>>

Genetic Modification

<<if $dispensaryUpgrade == 0>>
	//The fabricator must be upgraded before it can produce treatments to alter genes//

<<else>>
	The fabricator is capable of producing treatments to alter a slave's genetic code.

	<<if $arcologies[0].childhoodFertilityInducedNCSResearch == 1>>
		The fabricator is capable of producing treatments to induce NCS.

	<</if>>
	<<if $RapidCellGrowthFormula == 1>>
		The fabricator is capable of producing treatments to accelerate cellular reproduction.

	<</if>>
	<<if $geneticMappingUpgrade >= 2>>
		<<if $geneticFlawLibrary != 1>>
			[[Purchase designs for inducing genetic anomalies|Gene Lab][cashX(forceNeg(100000*_PCSkillCheck), "capEx"), $geneticFlawLibrary = 1]]
			//Costs <<print cashFormat(100000*_PCSkillCheck)>>//

    //Will allow genetic flaws and quirks to be injected into a slave's genome//

		<<else>>
			The fabricator is capable of producing treatments to induce various genetic anomalies.

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

Genetic Harvesting

<<if ($cloningSystem != 1) && ($rep <= 18000*_PCSkillCheck)>>
	//You lack the reputation needed to access methods for human cloning//

<<elseif ($cloningSystem != 1) && ($rep > 18000*_PCSkillCheck)>>
	<<if $organFarmUpgrade == 0>>
		//An organ farm is needed to grow the blank embryo to serve as a clone base//

	<<else>>
		[[Purchase methods for human cloning|Gene Lab][cashX(forceNeg(100000*_PCSkillCheck), "capEx"), $cloningSystem = 1]]
		//Costs <<print cashFormat(100000*_PCSkillCheck)>>//

    //Will allow children to be created with identical base genetics as the source DNA//

	<</if>>
<<elseif ($cloningSystem > 0)>>
	The gene lab is capable of implanting a slave's genetic sequence into a blank embryo to produce a basic clone. [[Make a clone|Cloning Workaround][$donatrix = "Undecided", $receptrix = "Undecided"]]

<</if>>


code:
:: Husk Slave [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $encyclopedia = "Kidnapped Slaves">>
<<if ($huskSlave.dick == 0) && ($huskSlave.vagina == -1)>><<set $huskSlave.vagina = 0>><</if>>

<<if $huskSlaveOrdered == 0>>You lay out a new order for a braindead slave to be put aside for your use.<<else>>You review your posted husk order.<</if>> Your order requests a body with the following characteristics:

<<set $huskSlave.age = Math.clamp($huskSlave.age, $minimumSlaveAge, $retirementAge-1)>>

Age:

<<textbox "$huskSlave.age" $huskSlave.age "Husk Slave">>

Sex:
<<if $huskSlave.sex == 1>>Female.
<<elseif $huskSlave.sex == 2>>Male.
<<elseif $huskSlave.sex == 3>>Futanari.
<</if>>

[[Female|Husk Slave][$huskSlave.sex = 1]]
| [[Male|Husk Slave][$huskSlave.sex = 2]]
| [[Both|Husk Slave][$huskSlave.sex = 3]]

Nationality:

<<textbox "$huskSlave.nationality" $huskSlave.nationality "Husk Slave">>

<<textbox "$huskSlave.race" $huskSlave.race "Husk Slave">>

[[White|Husk Slave][$huskSlave.race = "white"]]
| [[Asian|Husk Slave][$huskSlave.race = "asian"]]
| [[Latina|Husk Slave][$huskSlave.race = "latina"]]
| [[Middle Eastern|Husk Slave][$huskSlave.race = "middle eastern"]]
| [[Black|Husk Slave][$huskSlave.race = "black"]]
| [[Semitic|Husk Slave][$huskSlave.race = "semitic"]]
| [[Southern European|Husk Slave][$huskSlave.race = "southern european"]]
| [[Indo-Aryan|Husk Slave][$huskSlave.race = "indo-aryan"]]
| [[Amerindian|Husk Slave][$huskSlave.race = "amerindian"]]
| [[Pacific Islander|Husk Slave][$huskSlave.race = "pacific islander"]]
| [[Malay|Husk Slave][$huskSlave.race = "malay"]]
| [[Mixed Race|Husk Slave][$huskSlave.race = "mixed race"]]
| [[Not Important|Husk Slave][$huskSlave.race = "not important"]]

Virginity:
<<if $huskSlave.virgin == 0>>Virgin.
<<else>>Not important.
<</if>>

[[Important|Husk Slave][$huskSlave.virgin = 0]]
| [[Not Important|Husk Slave][$huskSlave.virgin = 1]]

Reserving a body will cost <<print cashFormat(10000)>> up front. Canceling an order will refund your money; however, if a delivered body is rejected, your money will not be refunded.
<<if $huskSlaveOrdered == 1>>
	[[Withdraw body order|Main][$huskSlaveOrdered = 0, cashX(10000, "slaveTransfer")]]
<<elseif $cash < 10000>>
	//You lack the credits to place a body reservation.//
<<else>>
	[[Post body order|Main][$huskSlaveOrdered = 1, cashX(-10000, "slaveTransfer")]]
<</if>>


code:
:: Husk Slave Swap [nobr]

<<set $nextButton = "Continue">>
<<set _oldSlave = clone($swappingSlave)>>
<<set _m = $slaveIndices[$swappingSlave.ID]>>

You strap $slaves[_m].slaveName, and the body to which $he will be transferred, into the remote surgery and stand back as it goes to work.
<<BodySwap $slaves[_m] $activeSlave>>
<<set _gps = $genePool.findIndex(function(s) { return s.ID == $slaves[_m].ID; })>>
<<set $genePool[_gps].race = $slaves[_m].race, $genePool[_gps].origRace = $slaves[_m].origRace, $genePool[_gps].skin = $slaves[_m].skin, $genePool[_gps].markings = $slaves[_m].markings, $genePool[_gps].eye.origColor = $slaves[_m].eye.origColor, $genePool[_gps].origHColor = $slaves[_m].origHColor, $genePool[_gps].origSkin = $slaves[_m].origSkin, $genePool[_gps].face = $slaves[_m].face, $genePool[_gps].pubicHStyle = $slaves[_m].pubicHStyle, $genePool[_gps].underArmHStyle = $slaves[_m].underArmHStyle, $genePool[_gps].eyebrowHStyle = $slaves[_m].eyebrowHStyle>> /* special exception to swap genePool since the temporary body lacks an entry. Otherwise we could just call the widget using the genePool entries */

After an honestly impressive procedure, $slaves[_m].slaveName is recovering nicely.

<<BodySwapReaction $slaves[_m] _oldSlave>>

<<set _slaveCost = slaveCost(_oldSlave)>>
<<set _payout = Math.trunc(_slaveCost/3)>>
$slaves[_m].slaveName's old body was bought by the Flesh Heap for <<print cashFormat(_payout)>>.
<<if $slaves[_m].bodySwap > 0>>
	<<set _myBody = $slaves.findIndex(function(s) { return s.origBodyOwnerID == $slaves[_m].ID; })>>
	<<if _myBody != -1>>
		<<set $slaves[_myBody].origBodyOwnerID = 0>>
		<<setLocalPronouns $slaves[_myBody] 2>>
		<<if $slaves[_myBody].fetish != "mindbroken" && $slaves[_myBody].fuckdoll == 0>>
			<<if $slaves[_myBody].devotion > 20>>
				$slaves[_myBody].slaveName is somewhat saddened to see _his2 body leave forever.
			<<elseif $slaves[_myBody].devotion >= -50>>
				$slaves[_myBody].slaveName is @@.mediumorchid;disturbed@@ to find _his2 body is gone for good, damaging _his2 @@.gold;ability to trust you.@@
				<<set $slaves[_myBody].devotion -= 30, $slaves[_myBody].trust -= 30>>
			<<else>>
				$slaves[_myBody].slaveName is @@.mediumorchid;deeply upset@@ that _he2'll never see _his2 body again. With so little left, _he2 finds it easy to take vengeance by @@.orangered;completely rejecting your ownership of _him2.@@
				<<set $slaves[_myBody].devotion -= 50, $slaves[_myBody].trust = 100>>
			<</if>>
		<</if>>
	<</if>>
<</if>>
<<set $slaves[_m].bodySwap++>>
<<run cashX(_payout, "slaveTransfer")>>
<<set $activeSlave = 0, $swappingSlave = 0>>


code:
:: husk Slave Swap Workaround [nobr]

<<if $activeSlave.tankBaby != 3>>
	<<set $nextButton = "Abort Operation", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event">>
<<else>>
	<<set $nextButton = "Abort Operation", $nextLink = "Main", $returnTo = "Incubator">>
<</if>>

"This operation is neither simple nor is it perfected. There are extreme health risks involved and no guarantee of success. Strap a slave into your remote surgery to consent to the operation. Indentured servants<<if ($incubator > 0) || ($nurseryBabies)>> and slaves with reserved children<</if>> are not eligible."

//Select the slave whose mind will be transferred into the waiting husk. Amputated slaves must not be wearing prosthetics. This operation will cost <<print cashFormat(10000)>>.//

__Select an eligible slave:__
<<for _i = 0; _i < $slaves.length; _i++>>
	<<capture _i>>
		<<if isSlaveAvailable($slaves[_i])>>
			<<if $slaves[_i].fuckdoll == 0>>
				<<if !hasAnyProstheticLimbs($slaves[_i])>>
					<<if $slaves[_i].indenture == -1>>
						<<if $slaves[_i].breedingMark == 0 || $propOutcome == 0 || $eugenicsFullControl == 1 || $arcologies[0].FSRestart == "unset">>
							<<if WombReserveCount($slaves[_i]) == 0>>
								<<if $slaves[_i].ID != $AS>>
									<<set _name = SlaveFullName($slaves[_i])>>

[[_name|Husk Slave Swap][$swappingSlave = $slaves[_i], cashX(-10000, "slaveSurgery", $slaves[_i])]]
								<</if>>
							<</if>>
						<</if>>
					<</if>>
				<</if>>
			<</if>>
		<</if>>
	<</capture>>
<</for>>


code:
:: Implant Manufactory [nobr jump-to-safe jump-from-safe]

<<set $nextButton = "Back", $nextLink = "Manage Penthouse", $encyclopedia = "The Pharmaceutical Fab.", _PCSkillCheck = Math.min($upgradeMultiplierMedicine, $HackingSkillMultiplier)>>

The Implant Manufactory

	The implant manufactory is running smoothly. It can cheaply produce advanced implants and has freed you from relying on outside sources for specialty implants. It can easily produce more complex implants should you obtain the schematics necessary to build them.

Implant Production

The manufactory is capable of producing customized fillable implants.

<<if ($meshImplants != 1) && ($rep <= 10000*_PCSkillCheck)>>

		You lack the reputation to access plans for supportive breast implants.

<<elseif ($meshImplants != 1) && ($rep > 10000*_PCSkillCheck)>>

		[[Purchase plans for supportive mesh breast implants|Implant Manufactory][cashX(forceNeg(40000*_PCSkillCheck), "capEx"), $meshImplants = 1]]

			Costs <<print cashFormat(40000*_PCSkillCheck)>>

				Will allow the construction of organic and supportive mesh breast implants.

<<elseif ($meshImplants > 0)>>

The manufactory is capable of producing supportive mesh breast implants.

<</if>>

<<if $UterineRestraintMesh == 1>>

The manufactory is capable of producing supportive mesh uterine implants.

<</if>>

<<if ($bellyImplants == 0) && ($rep <= 2000*_PCSkillCheck)>>

You lack the reputation to access experimental fillable abdominal implants.

<<elseif ($bellyImplants == 0) && ($rep > 2000*_PCSkillCheck)>>

		[[Purchase schematics for fillable abdominal implants|Implant Manufactory][cashX(forceNeg(30000*_PCSkillCheck), "capEx"), $bellyImplants = 1]]

			Costs <<print cashFormat(30000*_PCSkillCheck)>>

				Will allow the construction of fillable abdominal implants for the autosurgery.

<<elseif ($bellyImplants > 0)>>

The manufactory is capable of crafting fillable abdominal implants.

	<<if ($bellyImplants == 1) && ($cervixImplants == 0) && ($rep <= 6000*_PCSkillCheck)>> /* show only after belly implants already researched */

You lack the reputation to access experimental cervix filter micropumps schematics for abdominal implants.

	<<elseif ($bellyImplants == 1) && ($cervixImplants == 0) && ($rep > 6000 * _PCSkillCheck)>> /* nanotech like technology much more impressive and costly than simple implant */

			[[Purchase schematics for cervix filter micropumps|Implant Manufactory][cashX(forceNeg(70000*_PCSkillCheck), "capEx"), $cervixImplants = 1]]

				Costs <<print cashFormat(70000*_PCSkillCheck)>>

					Will allow the construction of cervix filter micropumps for fillable abdominal implants using the autosurgery.

	<<elseif ($cervixImplants == 1) && ($rep <= 8000*_PCSkillCheck)>>

The manufactory is capable of crafting cervix filter micropumps for fillable abdominal implants.

			You lack the reputation to obtain conversion kits for rectal filter micropumps.

	<<elseif ($cervixImplants == 1) && ($rep > 8000*_PCSkillCheck)>>

The manufactory is capable of crafting cervix filter micropumps for fillable abdominal implants.

			[[Purchase conversion kits for rectal filter micropumps|Implant Manufactory][cashX(forceNeg(60000*_PCSkillCheck), "capEx"), $cervixImplants = 2]]

				Costs <<print cashFormat(60000*_PCSkillCheck)>>

					Will allow the construction of the anal equivalent of the cervix micropumps using the autosurgery.

	<<elseif ($cervixImplants > 1)>>

The manufactory is capable of crafting cervix and rectal filter micropumps for fillable abdominal implants.

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

<<if $seePreg != 0>>

Fertility Implants

	<<if $fertilityImplant == 1>>

The manufactory is capable of crafting fertility enhancing implants for ovaries.

	<<elseif $fertilityImplant == 0 && ($rep <= 3000*_PCSkillCheck)>>

			You lack the reputation to access fertility boosting ovarian implants.

	<<else>>

			[[Purchase schematics for fertility enhancing ovarian implants|Implant Manufactory][cashX(forceNeg(10000*_PCSkillCheck), "capEx"), $fertilityImplant = 1]]

				Costs <<print cashFormat(10000*_PCSkillCheck)>>

					Will allow the construction of implants that encourage multiple eggs being released during ovulation.

	<</if>>

	<<if $sympatheticOvaries == 1>>

The manufactory is capable of crafting implants that synchronize ovum release.

	<</if>>

	<<if $seeHyperPreg == 1 && $seeExtreme == 1>>
		<<if ($permaPregImplant == 0) && ($rep <= 4000*_PCSkillCheck)>>

You lack the reputation to access experimental pregnancy generator schematics.

		<<elseif ($permaPregImplant == 0) && ($rep > 4000*_PCSkillCheck)>>

				[[Purchase schematics for an experimental implantable pregnancy generator|Implant Manufactory][cashX(forceNeg(40000*_PCSkillCheck), "capEx"), $permaPregImplant = 1]]

					Costs <<print cashFormat(40000*_PCSkillCheck)>>

						Will allow the construction of implants that force perpetual pregnancy.

		<<elseif ($permaPregImplant > 0)>>

The manufactory is capable of crafting pregnancy generators.

		<</if>>
		<<if $PGHack == 1>>

			The tools required to hack the firmware of basic pregnancy generator implants have been produced by the manufactory for use in the remote surgery.

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

<</if>>

Fluid Production Implants

<<if ($prostateImplants != 1) && ($rep <= 3000*_PCSkillCheck)>>

You lack the reputation to access plans for prostate implants.

<<elseif ($prostateImplants != 1) && ($rep > 3000*_PCSkillCheck)>>

		[[Purchase plans for ejaculation enhancing prostate implants|Implant Manufactory][cashX(forceNeg(30000*_PCSkillCheck), "capEx"), $prostateImplants = 1]]

			Costs <<print cashFormat(30000*_PCSkillCheck)>>

				Will allow the construction of a prostate implant designed to stimulate fluid production for massive ejaculations. Beware of leaking and dehydration.

<<elseif ($prostateImplants > 0)>>

The manufactory is capable of producing ejaculation enhancing prostate implants.

<</if>>