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>>$activeSlave.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.dick == 1>>

	[[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 unadvisable//<</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 = "Main">>
<<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', 'origEye', 'origHColor', 'nationality', 'origRace', 'face', '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) { return !(p in _s);})>>
		<<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">>
		<<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>>
		<<goto "Main">>
	<</link>> //This will not fix missing properties.//
<</if>>

repo_name: CheatDude/fc


code:
:: The Hippolyta Academy [nobr]

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

//
The Hippolyta Academy is one of the most famous slave bodyguarding schools in all 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.

<<GenerateMarketSlave "HA">>
<<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:
:: Wetware CPUs [nobr]

<<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $showEncyclopedia = 1, $encyclopedia = "Slave Schools">>
/* Multi-Purchase Support */
<<if ndef $newSlaves>><<set $newSlaves = []>><</if>>
<<if $newSlaves.length > 0>>
	<<set $nextButton = "Continue", $nextLink = "Bulk Slave Intro", $slaveMarket = "wetware", $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.//

<<GenerateMarketSlave "wetware">>
<<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>>


code:
:: assignment-filter widget [widget nobr]

/*
 * filters the list according to the selected Facility
 * function(y) is a loop through $slaves to set assignmentVisible to 1 and returns a new array
 * function(x) filters the slaves with the given condition ( here its the assignment )
 * so basically function(x) finds the slaves that are selected and function(y) sets them to be visible
*/

/*
 * These widgets set the visibilities for the different Facilities
*/

<<widget "resetAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 1})>><<set $slaves.filter(function(x){return x.assignment.includes("in the") || x.assignment.includes("be the") || x.assignment.includes("live with") || (x.assignment.includes("be your") && x.assignment != "be your Head Girl") || x.assignment.includes("work as a ")}).map(function(y){y.assignmentVisible = 0})>>
<</widget>>

<<widget "showallAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 1})>><<set $slaves.filter(function(x){return x.assignment.includes("agent")}).map(function(y){y.assignmentVisible = 0})>>
<</widget>>

<<widget "arcadeAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "be confined in the arcade"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "brothelAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "work in the brothel" || x.assignment == "be the Madam"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "cellblockAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "be confined in the cellblock" || x.assignment == "be the Wardeness"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "clinicAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "get treatment in the clinic" || x.assignment == "be the Nurse"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "clubAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "serve in the club" || x.assignment == "be the DJ"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "dairyAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "work in the dairy" || x.assignment == "be the Milkmaid"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "farmyardAssignmentFilter">>
		<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "work as a farmhand" || x.assignment == "be the Farmer"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "headgirlSuiteAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "live with your Head Girl"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "penthouseAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "rest" || x.assignment == "be a subordinate slave" || x.assignment == "whore" || x.assignment == "serve the public" || x.assignment == "work a glory hole" || x.assignment == "get milked" || x.assignment == "be a servant" || x.assignment == "please you"|| x.assignment == "stay confined" || x.assignment == "take classes" || x.assignment == "choose her own job" || x.assignment == "live with your Head Girl"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "schoolAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "learn in the schoolroom" || x.assignment == "be the Schoolteacher"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "spaAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "rest in the spa" || x.assignment == "be the Attendant"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "nurseryAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "work as a nanny" || x.assignment == "be the Matron"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "suiteAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "serve in the master suite" || x.assignment == "be your Concubine"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

<<widget "quartersAssignmentFilter">>
	<<set $slaves.map(function(y){y.assignmentVisible = 0})>><<set $slaves.filter(function(x){return x.assignment == "work as a servant" || x.assignment == "be the Stewardess"}).map(function(y){y.assignmentVisible = 1})>>
<</widget>>

/*
 * Checks from which Facility its get called and removes it from the list
 * this is the Main Filter widget used on all Passages atm
 * sets Flag = zero so slave summary provides send-to-facility links
*/
<<widget "assignmentFilter">>
	<<link All>><<showallAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>>
	<<if passage() != "Arcade">><<print " | ">><<link Arcade>><<arcadeAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Brothel">><<print " | ">><<link Brothel>><<brothelAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Cellblock">><<print " | ">><<link Cellblock>><<cellblockAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Clinic">><<print " | ">><<link Clinic>><<clinicAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Club">><<print " | ">><<link Club>><<clubAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Dairy">><<print " | ">><<link Dairy>><<dairyAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Farmyard">><<print " | ">><<link Farmyard>><<farmyardAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<print " | ">><<link Penthouse>><<penthouseAssignmentFilter>><<replace #ComingGoing>><<include 'Slave Summary'>><<set $Flag = 0>><<resetAssignmentFilter>><</replace>><</link>>
	<<if passage() != "Schoolroom">><<print " | ">><<link Schoolroom>><<schoolAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Spa">><<print " | ">><<link Spa>><<spaAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Nursery">><<print " | ">><<link Nursery>><<nurseryAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Master Suite">><<print " | ">><<link Suite>><<suiteAssignmentFilter>><<replace #ComingGoing>><<set $Flag = 0>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
	<<if passage() != "Servants' Quarters">><<print " | ">><<link Quarters>><<quartersAssignmentFilter>><<set $Flag = 0>><<replace #ComingGoing>><<include 'Slave Summary'>><<resetAssignmentFilter>><</replace>><</link>><</if>>
<</widget>>

/*
 * undefinedAssignmentFilter serves no purpose atm
 * might use it for RA Slave filter and Matchmaking
*/
<<widget "undefinedAssignmentFilter">>
	<<link All>><<showallAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Arcade>><<arcadeAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Brothel>><<brothelAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Cellblock>><<cellblockAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Clinic>><<clinicAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Club>><<clubAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Dairy>><<dairyAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Farmyard>><<farmyardAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Penthouse>><<penthouseAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Schoolroom>><<schoolAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Spa>><<spaAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Nursery>><<nurseryAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Suite>><<suiteAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>><<print " | ">>
	<<link Quarters>><<quartersAssignmentFilter>><<replace $args.full>><<include 'Slave Summary'>><</replace>><</link>>
	<<resetAssignmentFilter>>
<</widget>>