code:
:: SE Burst [nobr]

<<set $nextButton = "Continue", $nextLink = "Scheduled Event">>

<<for _b = 0; _b < $slaves.length; _b++>>
<<if $slaves[_b].burst == 1>>

	<<if (($slaves[_b].belly > ($slaves[_b].pregAdaptation*3200)) || $slaves[_b].bellyPreg > 600000)>>

		<<set $slaves[_b].curBabies = WombBirth($slaves[_b], $slaves[_b].pregData.minLiveBirth)>>
		<<set $slaves[_b].curStillBirth = 0 >>
		<<set _curBabies = $slaves[_b].curBabies.length>> /*just to improve speed and usability here.*/
		<<set $birthsTotal += _curBabies>>

		<<set _others = 0, _PC = 0, _citizens = 0, _oldMaster = 0, _arcOwner = 0, _clients = 0, _elite = 0, _lab = 0, _futaS = 0, _fathers = [], _babyFatherLink = []>>
		<<for _cb = 0; _cb < $slaves[_b].curBabies.length; _cb++>>
			<<if $slaves[_b].curBabies[_cb].fatherID == 0>>
				<<set _others++>>
				<<set _fathers.push("some man's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -1>>
				<<set $PC.counter.slavesFathered++>>
				<<set _PC++>>
				<<set _fathers.push("your")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -2>>
				<<set _citizens++>>
				<<set _fathers.push("a citizen's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -3>>
				<<set _oldMaster++>>
				<<set _fathers.push("your former Master's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -4>>
				<<set _arcOwner++>>
				<<set _fathers.push("another arcology owner's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -5>>
				<<set _clients++>>
				<<set _fathers.push("your client's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -6>>
				<<set _elite++>>
				<<set _fathers.push("the Societal Elite's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -7>>
				<<set _lab++>>
				<<set _fathers.push("the gene lab's")>>
			<<elseif $slaves[_b].curBabies[_cb].fatherID == -9>>
				<<set _futaS++>>
				<<set _fathers.push("a Futanari Sister's")>>
			<<else>>
				<<set _babyDaddy = findFather($slaves[_b].curBabies[_cb].fatherID)>>
				<<if def _babyDaddy>>
					<<if _babyDaddy.ID == $slaves[_b].ID>>
						<<set _fathers.push(String($his + " own"))>>
						<<for _cb2 = 0; _cb2 < _babyFatherLink.length; _cb2++>>
							<<if _babyFatherLink[_cb2].string == String($his + " own")>>
								<<set _babyFatherLink[_cb2].count++>>
							<<else>>
								<<set _babyFatherLink[_cb2] = {string: String($his + " own"), count: 1}>>
							<</if>>
						<</for>>
					<<else>>
						<<set _fathers.push(String(_babyDaddy.slaveName+ "'s"))>>
						<<for _cb2 = 0; _cb2 < _babyFatherLink.length; _cb2++>>
							<<if _babyFatherLink[_cb2].string == String(_babyDaddy.slaveName+ "'s")>>
								<<set _babyFatherLink[_cb2].count++>>
							<<else>>
								<<set _babyFatherLink[_cb2] = {string: String(_babyDaddy.slaveName+ "'s"), count: 1}>>
							<</if>>
						<</for>>
					<</if>>
					<<set _adjust = _babyDaddy.counter.slavesFathered++>>
					<<set adjustFatherProperty(_babyDaddy, "slavesFathered", _adjust)>>
				<<else>>
					<<set _others++>>
					<<set _fathers.push("some man's")>>
				<</if>>
			<</if>>
		<</for>>
		<<set _fathersReduced = removeDuplicates(_fathers)>>
		<<for _cb = 0; _cb < _fathersReduced.length; _cb++>>
			<<set _num = 0>>
			<<if _fathersReduced[_cb] == "some man's">>
				<<set _num = _others>>
			<<elseif _fathersReduced[_cb] == "your">>
				<<set _num = _PC>>
			<<elseif _fathersReduced[_cb] == "a citizen's">>
				<<set _num = _citizens>>
			<<elseif _fathersReduced[_cb] == "your former Master's">>
				<<set _num = _oldMaster>>
			<<elseif _fathersReduced[_cb] == "another arcology owner's">>
				<<set _num = _arcOwner>>
			<<elseif _fathersReduced[_cb] == "your client's">>
				<<set _num = _clients>>
			<<elseif _fathersReduced[_cb] == "the Societal Elite's">>
				<<set _num = _elite>>
			<<elseif _fathersReduced[_cb] == "the gene lab's">>
				<<set _num = _lab>>
			<<elseif _fathersReduced[_cb] == "a Futanari Sister's">>
				<<set _num = _futaS>>
			<<else>>
				<<set _cb2 = _babyFatherLink.findIndex(function(s) {_fathersReduced[_cb] == _babyFatherLink[s].string; })>>
				<<if _cb2 != -1>>
					<<set _num = _babyFatherLink[_cb2].count>>
				<</if>>
			<</if>>
			<<if _num == 1>>
				<<set _fathersReduced[_cb] += " baby">>
			<<elseif _num >= 40>>
				<<set _fathersReduced[_cb] += String(" massive brood of " + _num + " babies")>>
			<<elseif _num >= 20>>
				<<set _fathersReduced[_cb] += String(" brood of " + _num + " babies")>>
			<<elseif _num >= 10>>
				<<set _fathersReduced[_cb] += String(" impressive group of " + _num + " babies")>>
			<<else>>
				<<set _fathersReduced[_cb] += String(" " + pregNumberName(_num, 2))>>
			<</if>>
		<</for>>

		<<if $slaves[_b].broodmother < 1>>
			<<set $slaves[_b].curStillBirth = $slaves[_b].womb.length>>
			<<set WombFlush($slaves[_b])>>
		<</if>>

		<<set _incubated = 0>>
		<<set _cToIncub = 0, _cToNursery = 0>>
		<<for _csec = 0; _csec < _curBabies; _csec++>>
			<<if $slaves[_b].curBabies[_csec].reserve === "incubator">>
				<<set _cToIncub++>>
			<<elseif $slaves[_b].curBabies[_csec].reserve === "nursery">>
				<<set _cToNursery++>>
			<</if>>
		<</for>>

		/* ------------------------------------------------ */

		$slaves[_b].slaveName's straining womb finally gave out and burst, taking $his

		<<if _curBabies > 0>>
			life, but not <<if _curBabies <= 1>>that of $his child<<else>>those of all $his children<</if>>;
			<<if _fathersReduced.length > 2>>
				<<for _cb = 0; _cb < _fathersReduced.length; _cb++>>
					<<if _cb < _fathersReduced.length-1>>
						_fathersReduced[_cb],
					<<else>>
						and _fathersReduced[_cb]
					<</if>>
				<</for>>
			<<elseif _fathersReduced.length > 1>>
				_fathersReduced[0] and _fathersReduced[1]
			<<else>>
				_fathersReduced[0]
			<</if>>

			<<if _curBabies <= 1>>has<<else>>have<</if>>
			promptly been

			<<set _incubated = 0>>
			<<if _cToIncub == _curBabies>>
				taken to $incubatorName.
			<<elseif _cToIncub < _curBabies && _cToIncub > 0>>
				split between $incubatorName and
				<<if _cToNursery > 0>>
					<<if _cToNursery == _curBabies-_cToIncub && _incubated > 0>>
						$nurseryName.
					<<elseif _cToNursery < _curBabies-_cToIncub && _cToNursery > 0>>
						$nurseryName, and the medical suite.
					<</if>>
				<<else>>
					the medical suite.
				<</if>>
			<<elseif _cToNursery == _curBabies>>
				taken to $nurseryName.
			<<elseif _cToNursery < _curBabies && _cToNursery > 0>>
				split between $nurseryName and the medical suite.
			<<else>>
				taken to the medical suite.
			<</if>>

			<<if _cToIncub > 0 || _cToNursery > 0>>
				<<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */
					<<if $slaves[_b].curBabies[_cb].reserve == "incubator">>
						<<set $activeChild = generateChild($slaves[_b], $slaves[_b].curBabies[_cb], 1)>>
						<<include "Incubator Workaround">>
						<<run $slaves[_b].curBabies.splice($slaves[_b].curBabies[_cb], 1)>>
						<<set _cb--, _curBabies-->>
					<<elseif $slaves[_b].curBabies[_cb].reserve == "nursery">>
						<<set $activeChild = generateChild($slaves[_b], $slaves[_b].curBabies[_cb])>>
						<<include "Nursery Workaround">>
						<<run $slaves[_b].curBabies.splice($slaves[_b].curBabies[_cb], 1)>>
						<<set _cb--, _curBabies-->>
					<</if>>
				<</for>>
			<</if>>
		<<else>>
			life and <<if _curBabies <= 1>>that of $his child<<else>>those of $his children<</if>>.
		<</if>>

		<<set _curBabies = $slaves[_b].curBabies.length>>

		<<if _curBabies > 0>>

			<>
			<<if $arcologies[0].FSRestart != "unset" && $slaves[_b].breedingMark == 1 && $propOutcome == 1 && ($slaves[_b].pregSource == -1 || $slaves[_b].pregSource == -6)>>
				From there, $his child<<if _curBabies > 1>>ren are<<else>> is<</if>> collected by the Societal Elite to be raised into upstanding members of the new society.
			<<elseif $slaves[_b].breedingMark == 1 && $propOutcome == 1 && ($slaves[_b].pregSource == -1 || $slaves[_b].pregSource == -6) && $DefaultBirthDestination == "the market">>
				<<set _babyCost = random(2000,4500)>>
				$His <<if _curBabies > 1>>babies were<<else>>baby was<</if>> purchased by the Societal Elite for @@.yellowgreen;<<print cashFormat(_curBabies*(_babyCost))>>.@@
				<<run cashX((_curBabies*(_babyCost)), "babyTransfer")>>
			<<elseif $slaves[_b].pregSource == -9 && $DefaultBirthDestination == "the market">>
				<<set _babyCost = random(1000,2500)>>
				$His <<if _curBabies > 1>>babies were<<else>>baby was<</if>> purchased by the Futanari Sisters for @@.yellowgreen;<<print cashFormat(_curBabies*(_babyCost))>>.@@
				<<run cashX((_curBabies*(_babyCost)), "babyTransfer")>>
			<<elseif $DefaultBirthDestination == "individually decided fates">>
				Unless you provide otherwise, the child<<if _curBabies > 1>>ren<</if>> will be remanded to one of $arcologies[0].name's slave orphanages.
				<<set $slaveOrphanageTotal += _curBabies>>
				<<capture $i, $dispositionId, _curBabies>>

				<<if $arcologies[0].FSRepopulationFocus > 40>>

<<link "Send them to a breeder school">>
						<<replace `"#" + $dispositionId`>>
							The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to one of $arcologies[0].name's future minded schools, to be administered fertility and virility treatments as well as be brought up to take pride in reproduction. Hopefully there they will be trained to not suffer the same fate.
							<<set $breederOrphanageTotal += _curBabies, $slaveOrphanageTotal -= _curBabies>>
						<</replace>>
					<</link>>
					//Will cost a one-time <<print cashFormat(50)>>// |
				<</if>>

<<link "Send them to a citizen school">>
					<<replace `"#" + $dispositionId`>>
						The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to one of $arcologies[0].name's citizen schools, to be brought up coequal with the arcology's other young people.
						<<set $citizenOrphanageTotal += _curBabies, $slaveOrphanageTotal -= _curBabies>>
					<</replace>>
				<</link>>
				//Will cost <<print cashFormat(100)>> weekly//
				<<if $activeSlave.breedingMark == 1 && ($activeSlave.pregSource == -1 || $activeSlave.pregSource == -6) && $propOutcome == 1>>

<<link "Give them to the Societal Elite.">>
						<<replace `"#" + $dispositionId`>>
							The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to be raised by the Societal Elite, to be brought up as <<if _curBabies > 1>>future members<<else>>a future member<</if>> of their vision of the world.
							<<set $slaveOrphanageTotal -= _curBabies>>
						<</replace>>
						<<set $nextButton = "Back">><<UpdateNextButton>> /* unlock Continue button */
					<</link>>
				<</if>>
				<<if $slaves[_b].pregSource == -9>>

<<link "Give them to the Futanari Sisters">>
						<<replace #dispositionId>>
							The child<<if _curBabies > 1>>ren are<<else>> is<</if>> handed off to be raised by their father, the Futanari Sisters. You recommend they take it easy for a while before any more burst into kids.
							<<set $slaveOrphanageTotal -= _curBabies>>
						<</replace>>
					<</link>>
				<</if>>

<<link "Have them raised privately">>
					<<replace `"#" + $dispositionId`>>
						The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to be privately raised, to be brought up as <<if _curBabies > 1>>future high class citizens<<else>>a future high class citizen<</if>>.
						<<set $privateOrphanageTotal += _curBabies, $slaveOrphanageTotal -= _curBabies>>
					<</replace>>
				<</link>>
				//Will cost <<print cashFormat(500)>> weekly//
				<<if $policies.cash4Babies == 1>>

<<link "Send them to auction">>
						<<replace `"#" + $dispositionId`>>
							<<if $activeSlave.prestige > 1 || $activeSlave.porn.prestige > 2>>
								<<set _babyCost = random(-12,100)>>
								<<if $activeSlave.prematureBirth > 0>><<set _babyCost = random(-32,40)>><</if>>
							<<else>>
								<<set _babyCost = random(-12,12)>>
								<<if $activeSlave.prematureBirth > 0>><<set _babyCost = -45>><</if>>
							<</if>>
							$His <<if _curBabies > 1>>babies were<<else>>baby was<</if>> sold for <<if _curBabies > 1>>a total of <</if>><<if $slaves[_b].prematureBirth == 1>>@@.yellowgreen;<<print cashFormat(_curBabies*(50+_babyCost))>>,@@ a low price, due to the added costs of caring for them.<<else>>@@.yellowgreen;<<print cashFormat(_curBabies*(50+_babyCost))>>.@@<</if>>
							<<run cashX((_curBabies*(50+_babyCost)), "babyTransfer")>>
							<<set $slaveOrphanageTotal -= _curBabies>>
						<</replace>>
					<</link>>
				<</if>>
				<</capture>>
			<<else>>
				<<switch $DefaultBirthDestination>>
				<<case "an orphanage">>
					The child<<if _curBabies > 1>>ren<</if>> will be remanded to one of $arcologies[0].name's slave orphanages.
					<<set $slaveOrphanageTotal += _curBabies>>
				<<case "a citizen school">>
					The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to one of $arcologies[0].name's citizen schools, to be brought up coequal with the arcology's other young people.
					<<set $citizenOrphanageTotal += _curBabies, $slaveOrphanageTotal -= _curBabies>>
				<<case "a private school">>
					The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to be privately raised, to be brought up as <<if _curBabies > 1>>future high class citizens<<else>>a future high class citizen<</if>>.
					<<set $privateOrphanageTotal += _curBabies, $slaveOrphanageTotal -= _curBabies>>
				<<case "breeder schools">>
					The child<<if _curBabies > 1>>ren are<<else>> is<</if>> sent to one of $arcologies[0].name's future minded schools, to be administered fertility and virility treatments as well as be brought up to take pride in reproduction. Hopefully there they will be trained to not suffer the same fate.
					<<set $breederOrphanageTotal += _curBabies, $slaveOrphanageTotal -= _curBabies>>
				<<case "the market">>
					<<if $slaves[$_b].prestige > 1 || $slaves[$_b].porn.prestige > 2>>
						<<set _babyCost = random(-12,100)>>
						<<if $slaves[$_b].prematureBirth > 0>><<set _babyCost = random(-32,40)>><</if>>
					<<else>>
						<<set _babyCost = random(-12,12)>>
						<<if $slaves[$_b].prematureBirth > 0>><<set _babyCost = -45>><</if>>
					<</if>>
					$His <<if _curBabies > 1>>babies were<<else>>baby was<</if>> sold for <<if _curBabies > 1>>a total of <</if>><<if $slaves[$_b].prematureBirth == 1>>@@.yellowgreen;<<print cashFormat(_curBabies*(50+_babyCost))>>,@@ a low price, due to the added costs of caring for them.<<else>>@@.yellowgreen;<<print cashFormat(_curBabies*(50+_babyCost))>>.@@<</if>>
					<<run cashX(_curBabies*(50+_babyCost), "babyTransfer")>>
				<</switch>>
			<</if>>
			<>
		<</if>>

		<<if $arcologies[0].FSRestart != "unset" && _curBabies > 0>>

			<<if $slaves[_b].breedingMark == 1 && ($slaves[_b].pregSource == -1 || $slaves[_b].pregSource == -6) && $propOutcome == 1>>
				The Societal Elite @@.green;are pleased@@ at the new additions to their class, despite it claiming a promising breeder.
				<<set $failedElite -= _curBabies>>
			<<elseif $eugenicsFullControl != 1>>
				The Societal Elite @@.red;are disappointed@@ that you would allow subhuman filth to dirty society under your watch. Society @@.red;frowns@@ on the unwelcome addition of more subhumans into the world. At least the "birth" claimed the wretched $girl's life.
				<<set $failedElite += (5 * _curBabies)>>
				<<run repX(forceNeg(10 * _curBabies), "babyTransfer")>>
			<</if>>
		<</if>>

		<<set $reservedChildren = FetusGlobalReserveCount("incubator")>>
		<<set $reservedChildrenNursery = FetusGlobalReserveCount("nursery")>>

	<<elseif $slaves[_b].inflation != 0>>
		<<pop $slaves[_b]>>
	<</if>>

	<<set $activeSlave = $slaves[_b]>>
	<<= removeActiveSlave() >>

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

<<set $burstee = 0>>
<<set $burst = 0>>


code:
:: SE Death [nobr]

<<set $nextButton = "Continue", $nextLink = "Scheduled Event">>

<<set _killedSlaves = []>>
<<for _slave range $slaves>>
	<<switch _slave.death.toLowerCase()>>
		<<case "old">>
			<<DeathOldAge _slave>>

			<<set _killedSlaves.push(_slave)>>
		<<case "od">>
			<<DeathOverdose _slave>>

			<<set _killedSlaves.push(_slave)>>
		<<case "health">>
			<<DeathUnhealthy _slave>>

			<<set _killedSlaves.push(_slave)>>
		<<case "burst">>
			<<DeathPregnancyBurst _slave>>

			<<set _killedSlaves.push(_slave)>>
	<</switch>>
<</for>>
<<if _killedSlaves.length == 0>>
	/* if something beats this to the slaves, this should kick the player along instead of leaving them at a blank screen */
	<<set $slaveDeath = 0>>
	<<goto "Scheduled Event">>
<</if>>
<<for _slave range _killedSlaves>>
	<<set $activeSlave = _slave>>
	<<= removeActiveSlave() >>
<</for>>
<<unset _killedSlaves>>

<<set $slaveDeath = 0>>

repo_name: NovX/fc

license: mit


code:
:: SE FCNN Station [nobr]

<<set $nextButton = "Continue", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event", $encyclopedia = "FCTV", $FCNNstation = -1>>

<<setPlayerPronouns>>

One of the first groups to take advantage of the Free Cities' nearly nonexistent regulations for media and communications was the Free Cities News Network. As one of the few stations covering news within the Free Cities, and the only one doing so without any form of censorship, FCNN quickly became one the most popular news networks in the world. Presently, however, the network's future looks grim. Its reluctance on portraying explicitly pornographic content has lead to plummeting audience figures, especially in comparison to the upstart 8HGG Inc. media empire. In addition, governments within and outside the Free Cities have become increasingly restrictive towards the press, to the point that many FCNN branches have been effectively silenced.

This is the situation when you receive a personal video call from the network's beleaguered president. The former FCNN headquarters has been outright destroyed for reporting on its host nation's human rights abuses, and they're hoping to relocate to $arcologies[0].name. "We are, of course, in dire financial straits," the president nervously explains, "So we'll need a small subsidy to establish our new headquarters. Probably, oh, let's say... @@.yellowgreen;<<print cashFormat(100000)>>@@ or so?" He flinches while forcing a grin.

You ponder their proposal to yourself.
<<if $seeFCNN == 1>>
	While you're not exactly a FCNN fan<<= _girlP>>,
<<else>>
	Though you may not listen to FCNN regularly,
<</if>>
and the price certainly seems outrageous, accepting the offer would likely be a boost to your public reputation, as well as the local economy. The network is clearly at the end of their rope; the fact they would even ask for money beforehand is proof enough of that. If you don't accept their offer now, they'll probably go bankrupt or worse before you can get another chance to.

	<<link "Accept">>
		<<replace "#result">>
			You accept the FCNN president's offer. He looks like he's about to burst into tears after hearing this, especially since you offer no caveats as well, but struggles to maintain a professional composure regardless. Before the week is over, FCNN has established their new headquarters in $arcologies[0].name.
			<<set cashX(forceNeg(100000), "capEx"), $arcologies[0].prosperity += 2, $FCNNstation = 1>>
			<<set $fcnn.push("...is FCNN, broadcasting live from its international headquarters within...")>>
		<</replace>>
	<</link>>

<<link "Decline">>
		<<replace "#result">>
			You decline the FCNN president's offer. There's very little change in his expression; he was probably expecting this response. He accepts your decision, thanks you for your time, and unenthusiastically claims the network will soldier on regardless.
			<<set $FCNNstation = -1>>
		<</replace>>
	<</link>>


code:
:: SE husk slave delivery [nobr]

<<set $huskSlaveOrdered = 0, $nextButton = "Continue", $nextLink = "Scheduled Event", $returnTo = "Scheduled Event", $encyclopedia = "Enslaving People">>

<<set $activeSlaveOneTimeMinAge = parseInt($huskSlave.age)>>
<<set $activeSlaveOneTimeMaxAge = parseInt($huskSlave.age)>>
<<set $one_time_age_overrides_pedo_mode = 1>>
<<set $fixedNationality = $huskSlave.nationality>>
<<if $huskSlave.race != "not important">>
	<<set $fixedRace = $huskSlave.race>>
<</if>>
<<if $huskSlave.sex == 2>>
	<<set $activeSlave = GenerateNewSlave("XY", {mature: 0})>>
	<<set $activeSlave.boobs = 50>>
	<<set $activeSlave.boobsImplant = 0>>
	<<set $activeSlave.boobsImplantType = "none">>
<<else>>
	<<set $activeSlave = GenerateNewSlave("XX", {mature: 0})>>
<</if>>

<<set $activeSlave.slaveName = "Doll">>
<<set $activeSlave.birthName = "">>
<<set $activeSlave.slaveSurname = "">>
<<set $activeSlave.surname = "">>
<<set $activeSlave.origin = "You reserved a mindless slave like $him from the Flesh Heap.">>
<<set $activeSlave.devotion = 0>>
<<set $activeSlave.trust = 0>>
<<set $activeSlave.fetish = "mindbroken">>
<<set $activeSlave.fetishStrength = 10>>
<<set $activeSlave.fetishKnown = 1>>
<<set $activeSlave.career = "a Fuckdoll">>
<<set $activeSlave.behavioralFlaw = "none">>
<<set $activeSlave.behavioralQuirk = "none">>
<<set $activeSlave.sexualFlaw = "none">>
<<set $activeSlave.sexualQuirk = "none">>
<<set $activeSlave.intelligence = -100>>
<<set $activeSlave.intelligenceImplant = 0>>
<<set $activeSlave.skill.vaginal = 0>>
<<set $activeSlave.skill.oral = 0>>
<<set $activeSlave.skill.anal = 0>>
<<set $activeSlave.skill.whoring = 0>>
<<set $activeSlave.skill.entertainment = 0>>
<<set $activeSlave.skill.combat = 0>>

<<if $huskSlave.sex == 3>>
	<<set $activeSlave.dick = 1>>
	<<set $activeSlave.foreskin = 2>>
	<<set $activeSlave.prostate = 1>>
	<<set $activeSlave.balls = 1>>
	<<if $activeSlave.physicalAge >= $potencyAge>>
		<<set $activeSlave.pubertyXY = 1>>
	<</if>>
<</if>>
<<if $activeSlave.balls > 0>>
	<<set $activeSlave.scrotum = $activeSlave.balls>>
<</if>>
<<if $activeSlave.vagina == -1>>
	<<set $activeSlave.clit = 0>>
<</if>>
<<if $huskSlave.virgin == 0>>
	<<set $activeSlave.anus = 0>>
	<<if $activeSlave.vagina > -1>>
		<<set $activeSlave.vagina = 0>>
	<</if>>
<</if>>

<<setLocalPronouns $activeSlave>>

A slave came in fitting the description you provided.

//As expected, $he is a complete vegetable, but that is what you ordered after all. You lack the facilities to care for $him in this state, so you should do what you are planning quickly. Or you could return $him to the Flesh Heap, though you won't get your credits back.//

<<includeDOM App.Desc.longSlave(V.activeSlave, {market: "generic"})>>

<<if $cash >= $surgeryCost>>
	[[Accept the offered slave and contact the bodyswap surgeon.|husk Slave Swap Workaround]] //Will significantly increase the selected slave's upkeep.//
<<else>>
	//You can't sustain $him and thus must return $him.//
<</if>>


code:
:: SlaveOnSlaveFeedingWorkAround [nobr]

<<set $nextButton = "Back", $nextLink = "Slave Interact">>

<<set $milkTap = 0, _descM = "milk", _descC = "cum", _eligibilityMilk2 = 0, _eligibilityMilk4 = 0, _eligibilityMilk8 = 0, _eligibilityCum2 = 0, _eligibilityCum4 = 0, _eligibilityCum8 = 0>>

<<for _i = 0; _i < $slaves.length; _i++>> /* milk output */
	<<if $slaves[_i].lactation > 0>>
		<<set $slaves[_i].milkOutput = 0>>
		<<set _milk = milkAmount($slaves[_i])>>
		<<set _milk = (_milk/14)>>
		<<set _milk = Math.trunc(_milk)>>
		<<set $slaves[_i].milkOutput = _milk>>
	<<else>>
		<<set _milk = 0>>
		<<set $slaves[_i].milkOutput = 0>>
	<</if>>
<</for>>
<<for _i = 0; _i < $slaves.length; _i++>> /* cum output */
	<<if $slaves[_i].balls > 0 && $slaves[_i].dick > 0 && $slaves[_i].chastityPenis != 1>>
		<<set $slaves[_i].cumOutput = 0>>
		<<set _cum = cumAmount($slaves[_i])>>
		<<set _cum = (_cum/7)>>
		<<set _cum = (_cum/10)>>
		<<set _cum = Math.trunc(_cum)>>
		<<set $slaves[_i].cumOutput = _cum>>
	<<else>>
		<<set _cum = 0>>
		<<set $slaves[_i].cumOutput = 0>>
	<</if>>
<</for>>

	<<= getSlave($AS).slaveName>> is prepped to drink $his fill; now you must select a slave capable of producing the required amount of milk or ejaculate.

Select an eligible slave to serve as the tap

Milk Slaves

		2 Liters

		4 Liters

		8 Liters

	/* 2 Liters */

		<<for _i = 0; _i < $slaves.length; _i++>>

				<<if $slaves[_i].milkOutput >= 2>>
					<<if ($slaves[_i].ID != getSlave($AS).ID) && $slaves[_i].nipples != "fuckable">>
						<<set _name = SlaveFullName($slaves[_i])>>
						<<print "[[_name|FSlaveFeed][$milkTap = $slaves[" + _i + "], getSlave($AS).inflation = 1, getSlave($AS).inflationType = _descM, getSlave($AS).inflationMethod = 3]]">>
						<<if relativeTerm(getSlave($AS), $slaves[_i]) != null>>
							<<print relativeTerm(getSlave($AS), $slaves[_i])>>
						<</if>>
						<<if $slaves[_i].relationshipTarget == getSlave($AS).ID>>
							<<switch $slaves[_i].relationship>>
							<<case 1>>
								friends
							<<case 2>>
								best friends
							<<case 3>>
								friends with benefits
							<<case 4>>
								lover
							<<case 5>>
								slave $wife
							<</switch>>
						<</if>>
						<<if $slaves[_i].rivalryTarget == getSlave($AS).ID>>
							<<switch $slaves[_i].relationship>>
							<<case 1>>
								dislikes
							<<case 2>>
								rival
							<<case 3>>
								bitterly hates
							<</switch>>
						<</if>>
						<<set _eligibilityMilk2 = 1>>
					<</if>>
				<</if>>

		<</for>>
		<<if (_eligibilityMilk2 == 0)>>

				You have no slaves capable of producing two liters of milk.

		<</if>>

	<<if getSlave($AS).pregKnown == 0>>
		/* 4 Liters */

			<<for _i = 0; _i < $slaves.length; _i++>>

					<<if $slaves[_i].milkOutput >= 4>>
						<<if ($slaves[_i].ID != getSlave($AS).ID) && $slaves[_i].nipples != "fuckable">>
							<<set _name = SlaveFullName($slaves[_i])>>
							<<print "[[_name|FSlaveFeed][$milkTap = $slaves[" + _i + "], getSlave($AS).inflation = 2, getSlave($AS).inflationType = _descM, getSlave($AS).inflationMethod = 3]]">>
							<<if relativeTerm(getSlave($AS), $slaves[_i]) != null>>
								<<print relativeTerm(getSlave($AS), $slaves[_i])>>
							<</if>>
							<<if $slaves[_i].relationshipTarget == getSlave($AS).ID>>
								<<switch $slaves[_i].relationship>>
								<<case 1>>
									friends
								<<case 2>>
									best friends
								<<case 3>>
									friends with benefits
								<<case 4>>
									lover
								<<case 5>>
									slave $wife
								<</switch>>
							<</if>>
							<<if $slaves[_i].rivalryTarget == getSlave($AS).ID>>
								<<switch $slaves[_i].relationship>>
								<<case 1>>
									dislikes
								<<case 2>>
									rival
								<<case 3>>
									bitterly hates
								<</switch>>
							<</if>>
							<<set _eligibilityMilk4 = 1>>
						<</if>>
					<</if>>

			<</for>>
			<<if (_eligibilityMilk4 == 0)>>

					You have no slaves capable of producing four liters of milk.

			<</if>>

		/* 8 Liters */

			<<for _i = 0; _i < $slaves.length; _i++>>

					<<if $slaves[_i].milkOutput >= 8>>
						<<if ($slaves[_i].ID != getSlave($AS).ID) && $slaves[_i].nipples != "fuckable">>
							<<set _name = SlaveFullName($slaves[_i])>>
							<<print "[[_name|FSlaveFeed][$milkTap = $slaves[" + _i + "], getSlave($AS).inflation = 3, getSlave($AS).inflationType = _descM, getSlave($AS).inflationMethod = 3]]">>
							<<if relativeTerm(getSlave($AS), $slaves[_i]) != null>>
								<<print relativeTerm(getSlave($AS), $slaves[_i])>>
							<</if>>
							<<if $slaves[_i].relationshipTarget == getSlave($AS).ID>>
								<<switch $slaves[_i].relationship>>
								<<case 1>>
									friends
								<<case 2>>
									best friends
								<<case 3>>
									friends with benefits
								<<case 4>>
									lover
								<<case 5>>
									slave $wife
								<</switch>>
							<</if>>
							<<if $slaves[_i].rivalryTarget == getSlave($AS).ID>>
								<<switch $slaves[_i].relationship>>
									<<case 1>>
										dislikes
									<<case 2>>
										rival
									<<case 3>>
										bitterly hates
								<</switch>>
							<</if>>
							<<set _eligibilityMilk8 = 1>>
						<</if>>
					<</if>>

			<</for>>
			<<if (_eligibilityMilk8 == 0)>>

					You have no slaves capable of producing eight liters of milk.

			<</if>>

	<<else>>

			Due to $his pregnancy, $he is incapable of keeping down more than two liters of milk.

	<</if>>

Cum Slaves

			2 Liters

			4 Liters

			8 Liters

		/* 2 Liters */

			<<for _i = 0; _i < $slaves.length; _i++>>

					<<if $slaves[_i].cumOutput >= 2>>
						<<if ($slaves[_i].ID != getSlave($AS).ID)>>
							<<set _name = SlaveFullName($slaves[_i])>>
							<<print "[[_name|FSlaveFeed][$milkTap = $slaves[" + _i + "], getSlave($AS).inflation = 1, getSlave($AS).inflationType = _descC, getSlave($AS).inflationMethod = 3]]">>
							<<set _eligibilityCum2 = 1>>
						<</if>>
					<</if>>

			<</for>>
			<<if (_eligibilityCum2 == 0)>>

					You have no slaves capable of producing two liters of cum.

			<</if>>

		<<if getSlave($AS).pregKnown == 0>>
			/* 4 Liters */

				<<for _i = 0; _i < $slaves.length; _i++>>

						<<if $slaves[_i].cumOutput >= 4>>
							<<if ($slaves[_i].ID != getSlave($AS).ID)>>
								<<set _name = SlaveFullName($slaves[_i])>>
								<<print "[[_name|FSlaveFeed][$milkTap = $slaves[" + _i + "], getSlave($AS).inflation = 2, getSlave($AS).inflationType = _descC, getSlave($AS).inflationMethod = 3]]">>
								<<set _eligibilityCum4 = 1>>
							<</if>>
						<</if>>

				<</for>>

				<<if (_eligibilityCum4 == 0)>>

						You have no slaves capable of producing four liters of cum.

				<</if>>

			/* 8 Liters */

				<<for _i = 0; _i < $slaves.length; _i++>>

						<<if $slaves[_i].cumOutput >= 8>>
							<<if ($slaves[_i].ID != getSlave($AS).ID)>>
								<<set _name = SlaveFullName($slaves[_i])>>
								<<print "[[_name|FSlaveFeed][$milkTap = $slaves[" + _i + "], getSlave($AS).inflation = 3, getSlave($AS).inflationType = _descC, getSlave($AS).inflationMethod = 3]]">>
								<<set _eligibilityCum8 = 1>>
							<</if>>
						<</if>>

				<</for>>
				<<if (_eligibilityCum8 == 0)>>

						You have no slaves capable of producing eight liters of cum.

				<</if>>

		<<else>>

				Due to $his pregnancy, $he is incapable of keeping down more than two liters of cum.

		<</if>>


code:
:: Slave Slave Swap [nobr]

<<set $nextButton = "Continue">>
<<set _ss1 = $slaveIndices[$activeSlave.ID]>>
<<set _ss1Clone = clone($activeSlave)>>
<<set _ss2 = $slaveIndices[$swappingSlave.ID]>>
<<set _ss2Clone = clone($swappingSlave)>>
<<set _gps1 = $genePool.findIndex(function(s) { return s.ID == $slaves[_ss1].ID; })>>
<<set _gps1Clone = clone($genePool[_gps1])>>
<<set _gps2 = $genePool.findIndex(function(s) { return s.ID == $slaves[_ss2].ID; })>>
<<set _gps2Clone = clone($genePool[_gps2])>>

You strap $activeSlave.slaveName and $swappingSlave.slaveName into the remote surgery and stand back as it goes to work.
<<BodySwap $slaves[_ss1] _ss2Clone>>
<<BodySwap $genePool[_gps1] _gps2Clone 1>> /* passing a third argument just to detect if it's a slave from the genepool */
<<BodySwap $slaves[_ss2] _ss1Clone>>
<<BodySwap $genePool[_gps2] _gps1Clone 1>> /* passing a third argument just to detect if it's a slave from the genepool */

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

<<BodySwapReaction $slaves[_ss1] _ss1Clone>>

In the neighboring bed, $slaves[_ss2].slaveName rests peacefully.

<<BodySwapReaction $slaves[_ss2] _ss2Clone>>

/* figuring out whom has whose body now*/

<<if $slaves[_ss1].bodySwap == 0>>
	<<set $slaves[_ss1].origBodyOwnerID = _ss2Clone.ID>>
<<elseif $slaves[_ss2].origBodyOwner !== "">> /* now who's going to be looking for you? */
	<<set _myBody = $slaves.findIndex(function(s) { return s.origBodyOwnerID == $slaves[_ss2].ID; })>>
	<<if _myBody != -1>>
		<<set $slaves[_myBody].origBodyOwnerID = $slaves[_ss1].ID>>
	<</if>>
<</if>>

<<if $slaves[_ss2].bodySwap == 0>>
	<<set $slaves[_ss2].origBodyOwnerID = _ss1Clone.ID>>
<<elseif $slaves[_ss1].origBodyOwner !== "">> /* now who's going to be looking for you? */
	<<set _myBody = $slaves.findIndex(function(s) { return s.origBodyOwnerID == $slaves[_ss1].ID; })>>
	<<if _myBody != -1>>
		<<set $slaves[_myBody].origBodyOwnerID = $slaves[_ss2].ID>>
	<</if>>
<</if>>

/* now to handle whose body it is, name-wise */

<<BodySwapName $slaves[_ss1] $slaves[_ss2]>>
<<BodySwapName $slaves[_ss2] $slaves[_ss1]>>

<<if _ss1Clone.bodySwap > 0>>
	<<if $slaves[_ss1].origBodyOwnerID == $slaves[_ss1].ID>>
		<<set $slaves[_ss1].bodySwap = 0>>
		<<set $slaves[_ss1].origBodyOwnerID = 0>>
		<<set $slaves[_ss1].origBodyOwner = "">>
	<<else>>
		<<set $slaves[_ss1].bodySwap++>>
	<</if>>
<<else>>
	<<set $slaves[_ss1].bodySwap++>>
<</if>>

<<if $slaves[_ss2].bodySwap > 0>>
	<<if $slaves[_ss2].origBodyOwnerID == $slaves[_ss2].ID>>
		<<set $slaves[_ss2].bodySwap = 0>>
		<<set $slaves[_ss2].origBodyOwnerID = 0>>
		<<set $slaves[_ss2].origBodyOwner = "">>
	<<else>>
		<<set $slaves[_ss2].bodySwap++>>
	<</if>>
<<else>>
	<<set $slaves[_ss2].bodySwap++>>
<</if>>

<<set $activeSlave = 0, $swappingSlave = 0>>


code:
:: Slave Slave Swap Workaround [nobr]

<<set $nextButton = "Abort Operation", $nextLink = "Main">>
<<set $slaves[$slaveIndices[$activeSlave.ID]] = $activeSlave>>

The surgeon awaits the pair of slaves to be strapped into the surgery. So far only $activeSlave.slaveName is prepped:

//Select the slave who will be trading bodies with $him. 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 ($slaves[_i].ID != $activeSlave.ID)>>
					<<set _name = SlaveFullName($slaves[_i])>>

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


code:
:: Surrogacy [nobr]

<<set $nextButton = "Continue">>

<<switch $surgeryType>>

<<case "surrogacy">>

	<<if $receptrix.ID == -1>>
		Since the surgery required only a local anesthetic, you remain fully aware of the procedure as the autosurgery carries it out. You slowly rise to your feet, a hand to your lower belly, appreciating the new life growing within you.
		<<set $PC.pregKnown = 1>>
		<<run WombSurrogate($PC, 1, $donatrix, $impregnatrix.ID, 1)>>
		<<run WombNormalizePreg($PC)>>
	<<else>>
		<<set $receptrix.pregKnown = 1>>
		<<run WombSurrogate($receptrix, 1, $donatrix, $impregnatrix.ID, 1)>>
		<<run WombNormalizePreg($receptrix)>>
		<<setLocalPronouns $receptrix>>
		<<if $receptrix.fetish == "mindbroken">>
			$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
		<<elseif ($receptrix.fetish == "pregnancy") && ($receptrix.fetishStrength > 60) && ($receptrix.fetishKnown == 1)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. $He was overjoyed at the sight of the syringe containing $his future child emptying into $his womb.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He is @@.hotpink; filled with joy@@ over the life settling into $his womb and can't wait to see the result. $He's so pleased that $he now @@.mediumaquamarine;trusts@@ your plans for $his body.
			<<set $receptrix.trust += 4, $receptrix.devotion += 10>>
		<<elseif ($receptrix.devotion > 50)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. $He watched the syringe containing $his new pregnancy empty into $his womb with rapt attention.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He's @@.hotpink;grateful@@ that you think $him worthy of carrying this child, and a little nervous about how $he'll perform as a surrogate.
			<<set $receptrix.devotion += 4>>
		<<elseif ($receptrix.devotion >= -20)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. From the syringe making contact with $his skin, to the egg's delivery into $his womb and $his subsequent impregnation, $he couldn't look away.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He understands the realities of $his life as a slave, so it isn't much of a shock. $He is @@.gold;sensibly fearful@@ of your total power over $his body.
			<<set $receptrix.trust -= 10>>
		<<else>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. The moment $he realized what was happening, $he shut $his eyes tight, only opening them again as $he feels the slight tingle of the injector exiting $his lower abdomen.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He does not understand the realities of $his life as a slave at a core level, so $he's @@.mediumorchid;terrified and angry@@ that you have forced $him to bear this child, even more so as $he realizes $he doesn't know who the father is. $He is @@.gold;sensibly fearful@@ of your total power over $his body and the future of the life $he now harbors within $him.
			<<set $receptrix.trust -= 15, $receptrix.devotion -= 15>>
		<</if>>
		<<set _surr = $slaves.findIndex(function(s) { return s.ID == $receptrix.ID; })>>
		<<set $slaves[_surr] = $receptrix>>
	<</if>>
	<<set $receptrix = 0, $impregnatrix = 0, $donatrix = 0>>

<<case "transplant">>

	<<if $receptrix.ID == -1>>
		Since the surgery required only a local anesthetic, you are very aware that you are now carrying <<= getSlave($AS).slaveName>>'s child. You slowly rise to your feet, a hand to your lower belly, appreciating the new life growing within you.
		<<set _fetus = WombRemoveFetus(getSlave($AS), $wombIndex)>>
		<<run WombAddFetus($PC, _fetus)>>
		<<set $PC.pregKnown = 1, $PC.preg = WombMaxPreg($PC), getSlave($AS).preg = WombMaxPreg(getSlave($AS))>>
		<<run WombNormalizePreg($PC)>>
		<<run WombNormalizePreg(getSlave($AS))>>
	<<else>>
		<<set _fetus = WombRemoveFetus($donatrix, $wombIndex)>>
		<<run WombAddFetus($receptrix, _fetus)>>
		<<set $receptrix.pregKnown = 1, $receptrix.preg = WombMaxPreg($receptrix), $donatrix.preg = WombMaxPreg($donatrix)>>
		<<run WombNormalizePreg($receptrix)>>
		<<run WombNormalizePreg($donatrix)>>
		<<if $donatrix.ID == -1>>
			<<set $PC = $donatrix>>
		<<else>>
			<<set _surr = $slaves.findIndex(function(s) { return s.ID == $donatrix.ID; })>>
			<<set $slaves[$slaveIndices[$AS]] = $donatrix>>
		<</if>>
		<<setLocalPronouns $receptrix>>
		<<if $receptrix.fetish == "mindbroken">>
			$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
		<<elseif ($receptrix.fetish == "pregnancy") && ($receptrix.fetishStrength > 60) && ($receptrix.fetishKnown == 1)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. $He was overjoyed at the sight of the syringe containing $his future child emptying into $his womb.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He is @@.hotpink; filled with joy@@ over the life resettling into $his womb and can't wait to see the result. $He's so pleased that $he now @@.mediumaquamarine;trusts@@ your plans for $his body.
			<<set $receptrix.trust += 4, $receptrix.devotion += 10>>
		<<elseif ($receptrix.devotion > 50)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. $He watched the syringe containing $his new pregnancy empty into $his womb with rapt attention.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He's @@.hotpink;grateful@@ that you think $him worthy of carrying this child in <<if $donatrix.ID == -1>>your stead<<else>>lieu of $donatrix.slaveName<</if>>, and a little nervous about how $he'll perform as a surrogate.
			<<set $receptrix.devotion += 4>>
		<<elseif ($receptrix.devotion >= -20)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. From the syringe making contact with $his skin, to the egg's delivery into $his womb and $his subsequent impregnation, $he couldn't look away.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He understands the realities of $his life as a slave, so it isn't much of a shock. $He is @@.gold;sensibly fearful@@ of your total power over $his body and how you are forcing <<if $donatrix.ID == -1>>your pregnancy upon $him<<else>>$him to carry what should have been $donatrix.slaveName's burden<</if>>.
			<<set $receptrix.trust -= 10>>
		<<else>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. The moment $he realized what was happening, $he shut $his eyes tight, only opening them again as $he feels the slight tingle of the injector exiting $his lower abdomen.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He does not understand the realities of $his life as a slave at a core level, so $he's @@.mediumorchid;terrified and angry@@ that you have forced $him to <<if $donatrix.ID == -1>>carry your child instead of doing so yourself<<else>>bear this child in lieu of $donatrix.slaveName<</if>>. $He is @@.gold;sensibly fearful@@ of your total power over $his body and who else's troubles may be levied upon $him.
			<<set $receptrix.trust -= 15, $receptrix.devotion -= 15>>
		<</if>>
		<<set _surr = $slaves.findIndex(function(s) { return s.ID == $receptrix.ID; })>>
		<<set $slaves[_surr] = $receptrix>>
	<</if>>
	<<set $receptrix = 0, $donatrix = 0, $wombIndex = 0>>

<<case "clone">>

	<<if $receptrix.ID == -1>>
		Since the surgery required only a local anesthetic, you remain fully aware of the procedure as the autosurgery carries it out. You slowly rise to your feet, a hand to your lower belly, appreciating the clone growing within you.
		<<set $PC.pregKnown = 1>>
		<<if $donatrix.ID != -1>>
			<<set _babyDaddy = $genePool.find(function(s) { return s.ID == $donatrix.ID; })>>
			<<if ndef _babyDaddy>>
				<<set _babyDaddy = $slaveIndices[$donatrix.ID]>>
			<</if>>
			<<run WombImpregnateClone($PC, 1, $donatrix, _babyDaddy, 1)>>
		<<else>>
			<<set _babyDaddy = $PC>>
			<<run WombImpregnateClone($PC, 1, $PC, _babyDaddy, 1)>>
		<</if>>
		<<run WombNormalizePreg($PC)>>
	<<else>>
		<<set $receptrix.pregKnown = 1>>
		<<if $donatrix.ID != -1>>
			<<set _babyDaddy = $genePool.find(function(s) { return s.ID == $donatrix.ID; })>>
			<<if ndef _babyDaddy>>
				<<set _babyDaddy = $slaveIndices[$donatrix.ID]>>
			<</if>>
			<<run WombImpregnateClone($receptrix, 1, $donatrix, _babyDaddy, 1)>>
		<<else>>
			<<set _babyDaddy = $PC>>
			<<run WombImpregnateClone($receptrix, 1, $PC, _babyDaddy, 1)>>
		<</if>>
		<<run WombNormalizePreg($receptrix)>>
		<<setLocalPronouns $receptrix>>
		<<if $receptrix.fetish == "mindbroken">>
			$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen,
			<<if $receptrix.ID == $donatrix.ID>>
				but has no idea $he carries $his own clone.
			<<else>>
				$he knows that $he has been impregnated.
			<</if>>
		<<elseif ($receptrix.fetish == "pregnancy") && ($receptrix.fetishStrength > 60) && ($receptrix.fetishKnown == 1)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. $He was overjoyed at the sight of the syringe containing $his <<if $receptrix.ID == $donatrix.ID>>clone<<else>>future child<</if>> emptying into $his womb.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated<<if $receptrix.ID == $donatrix.ID>>, but not that $he now bears $his own clone<</if>>.
			<</if>>
			$He is @@.hotpink; filled with joy@@ over the life settling into $his womb and can't wait to see the result. $He's so pleased that $he now @@.mediumaquamarine;trusts@@ your plans for $his body.
			<<set $receptrix.trust += 4, $receptrix.devotion += 10>>
		<<elseif ($receptrix.devotion > 50)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. $He watched the syringe containing $his new pregnancy empty into $his womb with rapt attention.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated<<if $receptrix.ID == $donatrix.ID>>, but not that $he now bears $his own clone<</if>>.
			<</if>>
			$He's @@.hotpink;grateful@@ that you think $him worthy of carrying this child, and a little nervous about how $he'll perform as a surrogate.
			<<set $receptrix.devotion += 4>>
		<<elseif ($receptrix.devotion >= -20)>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. From the syringe making contact with $his skin, to the egg's delivery into $his womb and $his subsequent impregnation, $he couldn't look away.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated<<if $receptrix.ID == $donatrix.ID>>, but not that $he now bears $his own clone<</if>>.
			<</if>>
			$He understands the realities of $his life as a slave, so it isn't much of a shock. $He is @@.gold;sensibly fearful@@ of your total power over $his body.
			<<set $receptrix.trust -= 10>>
		<<else>>
			<<if canSee($receptrix)>>
				Since the surgery required only a local anesthetic, $receptrix.slaveName remained fully aware throughout the procedure. The moment $he realized what was happening, $he shut $his eyes tight, only opening them again as $he feels the slight tingle of the injector exiting $his lower abdomen.
			<<else>>
				$receptrix.slaveName leaves the surgery with a certain warmth in $his lower abdomen, $he knows that $he has been impregnated.
			<</if>>
			$He does not understand the realities of $his life as a slave at a core level, so $he's @@.mediumorchid;terrified and angry@@ that you have forced $him to bear <<if $receptrix.ID == $donatrix.ID>>$his own clone and potential replacement<<else>>this child, even more so as $he realizes $he doesn't know who the father is<</if>>. $He is @@.gold;sensibly fearful@@ of your total power over $his body and the future of the life $he now harbors within $him.
			<<set $receptrix.trust -= 15, $receptrix.devotion -= 15>>
		<</if>>
		<<set _surr = $slaves.findIndex(function(s) { return s.ID == $receptrix.ID; })>>
		<<set $slaves[_surr] = $receptrix>>
	<</if>>
	<<if $donatrix.ID != -1 && $donatrix.ID != $receptrix.ID>>
		<<set _surr = $slaves.findIndex(function(s) { return s.ID == $donatrix.ID; })>>
		<<set $slaves[_surr] = $donatrix>>
	<</if>>
	<<set $receptrix = 0, $donatrix = 0>>

<</switch>>


code:
:: Surrogacy Workaround [nobr]

<<set $nextButton = "Cancel", _eligibility = 0, _eligibilityI = 0, _eligibility2 = 0>>
<<if $donatrix.ID == $PC.ID>>
	<<set _donatrixID = -1>>
<<else>>
	<<set _donatrixID = 0>>
<</if>>
<<if $impregnatrix != "Undecided" && $impregnatrix.ID == -1>><<set _impreg = PlayerName()>><<elseif $impregnatrix != "Undecided">><<set _impreg = SlaveFullName($impregnatrix)>><<else>><<set _impreg = $impregnatrix>><</if>>
<<if $receptrix != "Undecided" && $receptrix.ID == -1>><<set _receive = PlayerName()>><<elseif $receptrix != "Undecided">><<set _receive = SlaveFullName($receptrix)>><<else>><<set _receive = $receptrix>><</if>>

	<<if _donatrixID == -1>>
		You've prepared yourself to have an egg taken from your ovaries;
	<<else>>
		<<= getSlave($AS).slaveName>> is prepped to have an egg harvested from $his ovaries;
	<</if>>
	now you must select a target to fertilize it and who will carry it to term.

_impreg will provide the seed and _receive shall carry it.
<<if _impreg != "Undecided" && _receive != "Undecided">>
	[[Implant fertilized ovum|Surrogacy][cashX(forceNeg($surgeryCost*2), "slaveSurgery"), $surgeryType = "surrogacy"]]
<</if>>

__Semen donatrix: _impreg __

<<for _sw = 0; _sw < $slaves.length; _sw++>>
	<<capture _sw>>
		<<if $slaves[_sw].balls > 0 && $slaves[_sw].pubertyXY == 1 && isSlaveAvailable($slaves[_sw]) && canBreed($donatrix, $slaves[_sw])>>
			<<set _name = SlaveFullName($slaves[_sw])>>

[[_name|Surrogacy Workaround][$impregnatrix = $slaves[_sw]]]
			<<set _eligibility = 1>>
		<</if>>
	<</capture>>
<</for>>
<<if (_eligibility == 0)>>

//You have no slaves with potent sperm.//
<</if>>

<<if $incubatorSlaves > 0 && $incubatorReproductionSetting == 2>>

	__Incubator settings are resulting in large-scale fluid secretion. Select an eligible incubatee to milk for semen:__

	<<for _sw3 = 0; _sw3 < $tanks.length; _sw3++>>
		<<capture _sw3>>
			<<if $tanks[_sw3].balls > 0 && $tanks[_sw3].dick > 0 && canBreed($donatrix, $tanks[_sw3])>>
				<<set _name3 = $tanks[_sw3].slaveName>>
				[[_name3|Surrogacy Workaround][$impregnatrix = $tanks[_sw3]]]
				<<set _eligibilityI = 1>>
			<</if>>
		<</capture>>
	<</for>>
	<<if (_eligibilityI == 0)>>

//You have no growing slaves producing sperm.//
	<</if>>
<</if>>

<<if $PC.balls != 0>>

	[[Use your own|Surrogacy Workaround][$impregnatrix = $PC]]
<</if>>

__Chosen surrogate: _receive __

<<for _sw1 = 0; _sw1 < $slaves.length; _sw1++>>
	<<capture _sw1>>
		<<if ($slaves[_sw1].ovaries > 0 || $slaves[_sw1].mpreg > 0) && isSlaveAvailable($slaves[_sw1]) && $slaves[_sw1].preg >= 0 && $slaves[_sw1].preg < 4 && $slaves[_sw1].pregWeek >= 0 && $slaves[_sw1].pubertyXX == 1 && $slaves[_sw1].pregType < 12 && $slaves[_sw1].bellyImplant == -1 && $slaves[_sw1].broodmother == 0 && $slaves[_sw1].inflation <= 2 && $slaves[_sw1].physicalAge < 70>>
			<<set _name2 = SlaveFullName($slaves[_sw1])>>

[[_name2|Surrogacy Workaround][$receptrix = $slaves[_sw1]]] <<if $slaves[_sw1].pregType >= 4>>//Using a slave carrying multiples is inadvisable//<</if>>
			<<set _eligibility2 = 1>>
		<</if>>
	<</capture>>
<</for>>
<<if (_eligibility2 == 0)>>

//You have no slaves capable of acting as a surrogate.//
<</if>>

<<if $PC.vagina != -1 && $PC.preg >= 0 && $PC.preg < 4 && $PC.pregType < 8 && $PC.physicalAge < 70>>

	[[Use your own womb|Surrogacy Workaround][$receptrix = $PC]]
<</if>>


code:
:: test genetics [nobr]

<<set $nextButton = "Back", $nextLink = "Options">>
<<set _seed = 0>>

All slave array slaves MUST be present in genePool or else there is a malfunction.

genePool

index	name	ID	origin

<<for _i = 0; _i < $genePool.length; _i++>>

		_i
		$genePool[_i].slaveName
		$genePool[_i].ID
		$genePool[_i].origin

<</for>>

<<set _neededProperties = ['genes', 'origSkin', 'eye.origColor', 'origHColor', 'nationality', 'origRace', 'face', 'faceShape', 'markings', 'intelligence', 'underArmHStyle', 'pubicHStyle']>>

slaves

index	name	ID	origin	assignment

<<for _i = 0; _i < $slaves.length; _i++>>
	<<set _s = $slaves[_i]>>
	<<set _error = $genePool.every(function(g) { return $slaves[_i].ID !== g.ID; })>>
	<<if _error>><<set _errorCause = "Doesn't exist in the gene pool">><</if>>
	<<if !_error>>
		<<set _missingProperties = _neededProperties.filter(function(p) {
			p = p.split(".");
			let c = _s;
			for (const r of p) {
				if (!(r in c)) {
					return true;
				}
				c = c[r];
			}
			return false;
		})>>
		<<if _missingProperties.length > 0>>
			<<set _error = true, _errorCause = "Missing properties: " + _missingProperties.join(", ")>>
		<</if>>
	<</if>>
	<<if _error>>

			_i
			_s.slaveName
			_s.ID
			_s.origin
			_s.assignment
			_errorCause

	<<else>>

			_i
			_s.slaveName
			_s.ID
			_s.origin
			_s.assignment

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

<<if _errorCause>>
	@@.red;Errors in the gene pool detected! Please report this.@@
	<<link "Add missing slaves to the gene pool" "Main">>
		<<for _i = 0; _i < $slaves.length; _i++>>
			<<if $genePool.every(function(g) { return $slaves[_i].ID !== g.ID; })>>
				<<set $genePool.push($slaves[_i])>>
			<</if>>
		<</for>>
	<</link>> //This will not fix missing properties.//
<</if>>


code:
:: The Hippolyta Academy [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $encyclopedia = "Slave Schools", $slaveMarket = "HA">>
/* Multi-Purchase Support */
<<if ndef $newSlaves>><<set $newSlaves = []>><</if>>
<<if $newSlaves.length > 0>>
	<<set $nextButton = "Continue", $nextLink = "Bulk Slave Intro", $returnTo = "Main", $newSlaveIndex = 0>>
<</if>>

//
The Hippolyta Academy is one of the most famous slave bodyguarding schools in all the Free Cities. Its business model is to offer very high quality, highly trained girls. Their renowned amazonian maids are some of the best combatants in the world and can be often found at the side of the wealthiest citizens.
<<if $HA.schoolUpgrade == 1>>
	Recently the school was able to enhance its educational programs thanks to your generous donation. Their slaves are now some of the most well trained and educated on the market.
<<elseif $HA.schoolUpgrade == 2>>
	Recently the school was able to improve its drug enhancement program thanks to your generous donation. Their slaves are now some of the most physically impressive specimen on the market.
<<elseif $HA.schoolUpgrade == 3>>
	Recently the school redirected its focus to better align with the strongfat ideal, as of your suggestion. Their slaves are physically impressive yet maintain a soft and feminine aspect.
<</if>>
//

The Hippolyta Academy offers a fresh graduate for inspection. The interview takes place in one of the many training areas of the school, where the physical prowess of the candidate can be easily showcased.

<<set _marketResult = generateMarketSlave("HA")>>
<<set $activeSlave = _marketResult.slave>>
<<print _marketResult.text>>
<<set _slaveCost = slaveCost($activeSlave)>>
<<if $HA.schoolSale != 0>>
	<<set _slaveCost = Math.trunc(_slaveCost*0.6)>>
<<elseif $HA.schoolUpgrade != 0>>
	<<set _slaveCost = Math.trunc(_slaveCost*1.2)>>
<</if>>
<<if $slavesSeen > $slaveMarketLimit>><<set _slaveCost += Math.trunc(_slaveCost*(($slavesSeen-$slaveMarketLimit)*0.1))>><</if>>

The price is <<print cashFormat(_slaveCost)>>.<<if $slavesSeen > $slaveMarketLimit>> You have cast such a wide net for slaves this week that it is becoming more expensive to find more for sale. Your reputation helps determine your reach within the slave market.<</if>>

<<setLocalPronouns $activeSlave>>
<<buyingFromSchoolControls $HA "slave" "slaves">>


code:
:: The Utopian Orphanage [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $encyclopedia = "Slave Schools", $slaveMarket = "TUO">>
/* Multi-Purchase Support */
<<if ndef $newSlaves>><<set $newSlaves = []>><</if>>
<<if $newSlaves.length > 0>>
	<<set $nextButton = "Continue", $nextLink = "Bulk Slave Intro", $returnTo = "Main", $newSlaveIndex = 0>>
<</if>>

//
The Utopian Orphanage is where all slaves dream of being raised. Its business model is to offer intelligent, well educated girls just past their majority. The girls are treated exceptionally well and have no sexual education or experience.
//

The Utopian Orphanage offers a fresh graduate for inspection. The interview takes place in the girl's private room, where she showcases her education and wits.

<<set _marketResult = generateMarketSlave("TUO")>>
<<set $activeSlave = _marketResult.slave>>
<<print _marketResult.text>>
<<set _slaveCost = slaveCost($activeSlave)>>
<<if $TUO.schoolSale != 0>>
	<<set _slaveCost = Math.trunc(_slaveCost*0.6)>>
<<elseif $TUO.schoolUpgrade != 0>>
	<<set _slaveCost = Math.trunc(_slaveCost*1.2)>>
<</if>>
<<if $slavesSeen > $slaveMarketLimit>><<set _slaveCost += Math.trunc(_slaveCost*(($slavesSeen-$slaveMarketLimit)*0.1))>><</if>>

The price is <<print cashFormat(_slaveCost)>>.<<if $slavesSeen > $slaveMarketLimit>> You have cast such a wide net for slaves this week that it is becoming more expensive to find more for sale. Your reputation helps determine your reach within the slave market.<</if>>

<<setLocalPronouns $activeSlave>>
<<buyingFromSchoolControls $TUO "slave" "slaves">>


code:
:: Wetware CPUs [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $encyclopedia = "Slave Schools", $slaveMarket = "wetware">>
/* Multi-Purchase Support */
<<if ndef $newSlaves>><<set $newSlaves = []>><</if>>
<<if $newSlaves.length > 0>>
	<<set $nextButton = "Continue", $nextLink = "Bulk Slave Intro", $returnTo = "Main", $newSlaveIndex = 0>>
<</if>>

//Wetware CPUs offer highly trained slaves with useful career experience at a discount; That is, at the cost of the physical health of the merchandise.//

<<set _marketResult = generateMarketSlave("wetware")>>
<<set $activeSlave = _marketResult.slave>>
<<print _marketResult.text>>
<<set _slaveCost = slaveCost($activeSlave)>>
<<if $slavesSeen > $slaveMarketLimit>><<set _slaveCost += Math.trunc(_slaveCost*(($slavesSeen-$slaveMarketLimit)*0.1))>><</if>>

The price is <<print cashFormat(_slaveCost)>>.<<if $slavesSeen > $slaveMarketLimit>> You have cast such a wide net for slaves this week that it is becoming more expensive to find more for sale. Your reputation helps determine your reach within the slave market.<</if>>

<<setLocalPronouns $activeSlave>>
<<buyingFromMarketControls>>