code:
:: misc widgets [nobr widget]

/* TODO: Modularize. */

/%
 Call as <<UpdateNextButton>>
 Allows for dynamic updating of the next button in the storyCaption (left side-bar) for events that disable the button until user makes a selection
%/
<<widget "UpdateNextButton">>
	<<replace "#nextButton">>
		<<link "$nextButton">> /* must use link so spacebar shortcut will work */
			<<if $nextButton != " ">> /* but no effect if nextButton is set to a blank space */
				<<set $ui = "main">>
				<<goto $nextLink>>
			<</if>>
		<</link>>
		<<if $nextButton != " ">>@@.cyan;[Space]@@<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<AssayedSlaveAvailable>>
 Checks $assayedSlave for availability, e.g. not strapped to a machine or distant.
%/
<<widget "AssayedSlaveAvailable">>
<<if $assayedSlave.assignment == "be your agent">>
	<<set $assayedSlaveAvailable = 0>>
<<elseif $assayedSlave.assignment == "live with your agent">>
	<<set $assayedSlaveAvailable = 0>>
<<elseif ($assayedSlave.assignment == "work in the dairy") && ($dairyRestraintsSetting >= 2)>>
	<<set $assayedSlaveAvailable = 0>>
<<else>>
	<<set $assayedSlaveAvailable = 1>>
<</if>>
<</widget>>

/%
 Call as <<SimpleSexAct slave 5>> or <<SimpleSexAct slave>>
 $arg[1] is how many times to increment either the Vaginal, Anal, or Oral counts, depending on availability on $arg[0].
 If left undefined it will assume it to be 1.
 Intended to be a simple "I want to fuck x and not have to code a bunch of logic for it".
%/
<<widget "SimpleSexAct">>
<<if $args[1]>>
	<<for _miscW = 0; _miscW < $args[1]; _miscW++>>
		<<set _fuckTarget = random(1,100)>>
		<<if $args[0].nipples == "fuckable" && $PC.dick == 1 && _fuckTarget > 80>>
			<<set $mammaryTotal++, $args[0].mammaryCount++>>
		<<elseif canDoVaginal($args[0]) && $args[0].vagina > 0 && _fuckTarget > 33>>
			<<set $vaginalTotal++, $args[0].vaginalCount++>>
			<<if $PC.dick == 1 && canGetPregnant($args[0]) && ($args[0].eggType == "human")>>
				<<= knockMeUp($args[0], 10, 0, -1, 1)>>
			<</if>>
		<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && _fuckTarget > 10>>
			<<set $analTotal++, $args[0].analCount++>>
			<<if $PC.dick == 1 && canGetPregnant($args[0]) && ($args[0].eggType == "human")>>
				<<= knockMeUp($args[0], 10, 1, -1, 1)>>
			<</if>>
		<<else>>
			<<set $oralTotal++, $args[0].oralCount++>>
		<</if>>
	<</for>>
<<else>>
	<<set _fuckTarget = random(1,100)>>
	<<if $args[0].nipples == "fuckable" && $PC.dick == 1 && _fuckTarget > 80>>
		<<set $mammaryTotal++, $args[0].mammaryCount++>>
	<<elseif canDoVaginal($args[0]) && $args[0].vagina > 0 && _fuckTarget > 33>>
		<<set $vaginalTotal++, $args[0].vaginalCount++>>
		<<if $PC.dick == 1 && canGetPregnant($args[0]) && ($args[0].eggType == "human")>>
			<<= knockMeUp($args[0], 10, 0, -1, 1)>>
		<</if>>
	<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && _fuckTarget > 10>>
		<<set $analTotal++, $args[0].analCount++>>
		<<if $PC.dick == 1 && canGetPregnant($args[0]) && ($args[0].eggType == "human")>>
			<<= knockMeUp($args[0], 10, 1, -1, 1)>>
		<</if>>
	<<else>>
		<<set $oralTotal++, $args[0].oralCount++>>
	<</if>>
<</if>>
<</widget>>

/%
 Call as <<SimpleSlaveFucking slave 5>> or <<SimpleSlaveFucking slave>>
 $arg[1] is how many times to increment either the Vaginal, Anal, or Oral counts, depending on availability on $arg[0].
 If left undefined it will assume it to be 1.
 Intended to be a simple "x got fucked y times and I don't want to keep coding it".
 Pregnancy chance is handled in saLongTermEffects.tw.
%/
<<widget "SimpleSlaveFucking">>
<<if $args[1]>>
	<<for _miscW = 0; _miscW < $args[1]; _miscW++>>
		<<set _fuckTarget = random(1,100)>>
		<<if $args[0].nipples == "fuckable" && _fuckTarget > 80>>
			<<set $mammaryTotal++, $args[0].mammaryCount++>>
		<<elseif canDoVaginal($args[0]) && $args[0].vagina > 0 && _fuckTarget > 33>>
			<<set $vaginalTotal++, $args[0].vaginalCount++>>
		<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && _fuckTarget > 10>>
			<<set $analTotal++, $args[0].analCount++>>
		<<else>>
			<<set $oralTotal++, $args[0].oralCount++>>
		<</if>>
	<</for>>
<<else>>
	<<set _fuckTarget = random(1,100)>>
	<<if $args[0].nipples == "fuckable" && _fuckTarget > 80>>
		<<set $mammaryTotal++, $args[0].mammaryCount++>>
	<<elseif canDoVaginal($args[0]) && $args[0].vagina > 0 && _fuckTarget > 33>>
		<<set $vaginalTotal++, $args[0].vaginalCount++>>
	<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && _fuckTarget > 10>>
		<<set $analTotal++, $args[0].analCount++>>
	<<else>>
		<<set $oralTotal++, $args[0].oralCount++>>
	<</if>>
<</if>>
<</widget>>

/%
 Call as <<SimpleSlaveSlaveFucking subslave domslave 5>> or <<SimpleSlaveSlaveFucking subslave domslave>>
 $arg[2] is how many times to increment either the Vaginal, Anal, or Oral counts, depending on availability on $arg[0].
 If left undefined it will assume it to be 1.
 Intended to be a simple "x got fucked y times by z and I don't want to keep coding it".
%/
<<widget "SimpleSlaveSlaveFucking">>
<<if $args[2]>>
	<<for _miscW = 0; _miscW < $args[2]; _miscW++>>
		<<set _fuckTarget = random(1,100)>>
		<<if $args[0].nipples == "fuckable" && canPenetrate($args[1]) && _fuckTarget > 80>>
			<<if passage() == "SA serve your other slaves">>
				<<if $args[0].ID == $slaves[$i].ID>>
					<<set _mammaryUse++>>
					<<set $penetrativeTotal++, $args[1].penetrativeTotal++>>
				<<else>>
					<<set _penetrativeUse++>>
					<<set $mammaryTotal++, $args[0].mammaryCount++>>
				<</if>>
			<<else>>
				<<set $mammaryTotal++, $args[0].mammaryCount++>>
				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
			<</if>>
		<<elseif canDoVaginal($args[0]) && $args[0].vagina > 0 && canPenetrate($args[1]) && _fuckTarget > 33>>
			<<if passage() == "SA serve your other slaves">>
				<<if $args[0].ID == $slaves[$i].ID>>
					<<set _vaginalUse++>>
					<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
				<<else>>
					<<set _penetrativeUse++>>
					<<set $vaginalTotal++, $args[0].vaginalCount++>>
				<</if>>
			<<else>>
				<<set $vaginalTotal++, $args[0].vaginalCount++>>
				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
			<</if>>
			<<if canImpreg($args[0], $args[1])>>
				<<= knockMeUp($args[0], 3, 0, $args[1].ID, 1)>>
			<</if>>
		<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && canPenetrate($args[1]) && _fuckTarget > 10>>
			<<if canImpreg($args[0], $args[1])>>
				<<= knockMeUp($args[0], 3, 1, $args[1].ID, 1)>>
			<</if>>
			<<if passage() == "SA serve your other slaves">>
				<<if $args[0].ID == $slaves[$i].ID>>
					<<set _analUse++>>
					<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
				<<else>>
					<<set _penetrativeUse++>>
					<<set $analTotal++, $args[0].analCount++>>
				<</if>>
			<<else>>
				<<set $analTotal++, $args[0].analCount++>>
				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
			<</if>>
		<<else>>
			<<set $oralTotal++, $args[0].oralCount++>>
		<</if>>
	<</for>>
<<else>>
	<<set _fuckTarget = random(1,100)>>
	<<if $args[0].nipples == "fuckable" && canPenetrate($args[1]) && _fuckTarget > 80>>
		<<if passage() == "SA serve your other slaves">>
			<<if $args[0].ID == $slaves[$i].ID>>
				<<set _mammaryUse++>>
				<<set $penetrativeTotal++, $args[1].penetrativeTotal++>>
			<<else>>
				<<set _penetrativeUse++>>
				<<set $mammaryTotal++, $args[0].mammaryCount++>>
			<</if>>
		<<else>>
			<<set $mammaryTotal++, $args[0].mammaryCount++>>
			<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
		<</if>>
	<<elseif canDoVaginal($args[0]) && $args[0].vagina > 0 && canPenetrate($args[1]) && _fuckTarget > 33>>
		<<if passage() == "SA serve your other slaves">>
			<<if $args[0].ID == $slaves[$i].ID>>
				<<set _vaginalUse++>>
				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
			<<else>>
				<<set _penetrativeUse++>>
				<<set $vaginalTotal++, $args[0].vaginalCount++>>
			<</if>>
		<<else>>
			<<set $vaginalTotal++, $args[0].vaginalCount++>>
			<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
		<</if>>
		<<if canImpreg($args[0], $args[1])>>
			<<= knockMeUp($args[0], 3, 0, $args[1].ID, 1)>>
		<</if>>
	<<elseif canDoAnal($args[0]) && $args[0].anus > 0 && canPenetrate($args[1]) && _fuckTarget > 10>>
		<<if passage() == "SA serve your other slaves">>
			<<if $args[0].ID == $slaves[$i].ID>>
				<<set _analUse++>>
				<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
			<<else>>
				<<set _penetrativeUse++>>
				<<set $analTotal++, $args[0].analCount++>>
			<</if>>
		<<else>>
			<<set $analTotal++, $args[0].analCount++>>
			<<set $penetrativeTotal++, $args[1].penetrativeCount++>>
		<</if>>
		<<if canImpreg($args[0], $args[1])>>
			<<= knockMeUp($args[0], 3, 1, $args[1].ID, 1)>>
		<</if>>
	<<else>>
		<<set $oralTotal++, $args[0].oralCount++>>
	<</if>>
<</if>>
<</widget>>

/%
 Call as <<SimpleVaginaFuck slave 5>> or <<SimpleVaginaFuck slave>>
 $arg[1] is how many times to increment either the Vaginal count.
 If left undefined it will assume it to be 1.
 Intended to be a simple "x got fucked vaginally y times and I don't want to keep coding it".
%/
<<widget "SimpleVaginaFuck">>
<<if $args[1]>>
	<<set $vaginalTotal += $args[1], $args[0].vaginalCount += $args[1]>>
<<else>>
	<<set $vaginalTotal++, $args[0].vaginalCount++>>
<</if>>
<</widget>>

/%
 Call as <<SimpleAssFuck slave 5>> or <<SimpleAssFuck slave>>
 $arg[1] is how many times to increment either the Vaginal count.
 If left undefined it will assume it to be 1.
 Intended to be a simple "x got fucked vaginally y times and I don't want to keep coding it".
%/
<<widget "SimpleAssFuck">>
<<if $args[1]>>
	<<set $analTotal += $args[1], $args[0].analCount += $args[1]>>
<<else>>
	<<set $analTotal++, $args[0].analCount++>>
<</if>>
<</widget>>

/%
 Call as <<SlaveInteractImpreg>>
%/
<<widget "SlaveInteractImpreg">>
<<replace #impreg>>
	<<if (canGetPregnant($activeSlave)) && ($activeSlave.fuckdoll == 0) && $seePreg != 0>>
		<<if ($PC.dick != 0 && $activeSlave.eggType == "human")>>
		| <<link "Impregnate her yourself">><<replace "#miniscene">><<include "FPCImpreg">>
    <</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<</if>>
		<<if canImpreg($activeSlave, $activeSlave)>>
		| <<link "Use her own seed to impregnate her">><<replace "#miniscene">><<include "FSlaveSelfImpreg">>
    <</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<</if>>
		| [[Use another slave to impregnate her|FSlaveImpreg]]
	<</if>>
	<<if $activeSlave.assignment != "work in the dairy" && $activeSlave.assignment != "be confined in the arcade" && $activeSlave.assignment != "be confined in the cellblock">>
		<<if $enema == 1>>
			<<if ($activeSlave.inflation < 3 && $activeSlave.pregKnown == 0 && $activeSlave.bellyImplant < 1500) || ($activeSlave.inflation < 1)>>
				<<if $activeSlave.inflationType == "water" || $activeSlave.inflationType == "none">>
					| <<link "Fill her ass with water">><<set $activeSlave.inflationType = "water">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
				<</if>>
				<<if $medicalEnema == 1>>
					<<if $activeSlave.inflationType == "aphrodisiac" || $activeSlave.inflationType == "none">>
						| <<link "Fill her ass with aphrodisiacs">><<set $activeSlave.inflationType = "aphrodisiac">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
					<</if>>
					<<if $activeSlave.inflationType == "curative" || $activeSlave.inflationType == "none">>
						| <<link "Fill her ass with curatives">><<set $activeSlave.inflationType = "curative">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
					<</if>>
					<<if $activeSlave.inflationType == "tightener" || $activeSlave.inflationType == "none">>
						| <<link "Fill her ass with rectal tighteners">><<set $activeSlave.inflationType = "tightener">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
					<</if>>
				<</if>>
			<</if>> /* inflation < 3 */
		<</if>> /* enema == 1 */
		<<if $dairyPiping == 1>>
			<<if ($milkPipeline > 88 && $milkPipeline != 0) || $arcologies[0].FSPastoralistLaw == 1>>
				<<if ($activeSlave.inflation < 3 && $activeSlave.pregKnown == 0 && $activeSlave.bellyImplant < 1500) || ($activeSlave.inflation < 1)>>
					<<if $activeSlave.inflationType == "milk" || $activeSlave.inflationType == "none">>
						| <<link "Fill her ass with milk">><<set $activeSlave.inflationType = "milk">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
						| <<link "Force feed her milk">><<set $activeSlave.inflationType = "milk">><<set $activeSlave.inflationMethod = 1>><<replace "#miniscene">><<include "FillUpFace">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
					<</if>>
				<</if>>
			<<else>>
				| //$dairyNameCaps is not producing enough milk to pump through the pipes//
			<</if>>
			<<if ($cumPipeline > 88 && $cumPipeline != 0) || $arcologies[0].FSPastoralistLaw == 1>>
				<<if ($activeSlave.inflation < 3 && $activeSlave.pregKnown == 0 && $activeSlave.bellyImplant < 1500) || ($activeSlave.inflation < 1)>>
					<<if $activeSlave.inflationType == "cum" || $activeSlave.inflationType == "none">>
						| <<link "Fill her ass with cum">><<set $activeSlave.inflationType = "cum">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
						| <<link "Force feed her cum">><<set $activeSlave.inflationType = "cum">><<set $activeSlave.inflationMethod = 1>><<replace "#miniscene">><<include "FillUpFace">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
					<</if>>
				<</if>>
			<<else>>
				| //$dairyNameCaps is not producing enough cum to pump through the pipes//
			<</if>>
		<</if>> /* dairyPiping == 1 */
	<</if>> /* assigned to dairy or arcade */
	<<if $activeSlave.inflation == 0 && $activeSlave.bellyImplant < 1500>>
		<<if $activeSlave.assignment != "work in the dairy" && $activeSlave.assignment != "be confined in the arcade" && $activeSlave.assignment != "be confined in the cellblock">>
			| [[Use another slave to forcefeed her|SlaveOnSlaveFeedingWorkAround]]
			<<if $buckets == 1>>
				| <<link "Make her consume two liters of slave food">><<set $activeSlave.inflationType = "food">><<set $activeSlave.inflationMethod = 1>><<set $activeSlave.inflation = 1>><<replace "#miniscene">><<include "forceFeeding">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
				<<if $activeSlave.pregKnown == 0>>
					| <<link "Force her to consume a gallon of slave food">><<set $activeSlave.inflationType = "food">><<set $activeSlave.inflationMethod = 1>><<set $activeSlave.inflation = 2>><<replace "#miniscene">><<include "forceFeeding">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
					| <<link "Force two gallons of slave food into her">><<set $activeSlave.inflationType = "food">><<set $activeSlave.inflationMethod = 1>><<set $activeSlave.inflation = 3>><<replace "#miniscene">><<include "forceFeeding">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
				<</if>>
			<</if>>
		<</if>>
	<</if>>
	<</replace>>
<<replace #bloating>>
	<<if $activeSlave.inflation > 0>>

		__Required Bloating__: <<if $activeSlave.inflation == 3>><<print "She is required to keep 2 gallons of $activeSlave.inflationType in her at all times">><<elseif $activeSlave.inflation == 2>><<print "She is required to keep 4 liters of $activeSlave.inflationType in her at all times">><<elseif $activeSlave.inflation == 1>><<print "She is required to keep 2 liters of $activeSlave.inflationType in her at all times">><</if>>.
		<<if $activeSlave.inflationMethod == 3>>
			<<link "Let her deflate">><<set $activeSlave.inflation = 0,$activeSlave.inflationType = "none",$activeSlave.inflationMethod = 0,$activeSlave.cumSource = 0,$activeSlave.milkSource = 0, SetBellySize($activeSlave)>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<elseif $activeSlave.inflationType == "milk">>
			<<link "Let her deflate">><<set $activeSlave.inflation = 0,$activeSlave.inflationType = "none",$activeSlave.inflationMethod = 0, SetBellySize($activeSlave)>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<elseif $activeSlave.inflationType == "cum">>
			<<link "Let her deflate">><<set $activeSlave.inflation = 0,$activeSlave.inflationType = "none",$activeSlave.inflationMethod = 0, SetBellySize($activeSlave)>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<else>>
			<<link "Let her deflate">><<set $activeSlave.inflation = 0,$activeSlave.inflationType = "none",$activeSlave.inflationMethod = 0, SetBellySize($activeSlave)>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<</if>>
	<</if>>
<</replace>>
<</widget>>

/%
 Call as <<SlaveInteractDrugs>>
%/
<<widget "SlaveInteractDrugs">>
	<<replace #drugs>>

Drugs: $activeSlave.drugs.
	<<link "None">><<set $activeSlave.drugs = "no drugs">><<SlaveInteractDrugs>><</link>>
	<<if $activeSlave.indentureRestrictions < 2>>
		<<if $activeSlave.drugs == "intensive breast injections" || $activeSlave.drugs == "intensive butt injections" || $activeSlave.drugs == "intensive penis enhancement" || $activeSlave.drugs == "intensive testicle enhancement">>
			| <<link "Moderate">>
				<<switch $activeSlave.drugs>>
				<<case "intensive breast injections">>
					<<set $activeSlave.drugs = "breast injections">>
				<<case "intensive butt injections">>
					<<set $activeSlave.drugs = "butt injections">>
				<<case "intensive penis enhancement">>
					<<set $activeSlave.drugs = "penis enhancement">>
				<<case "intensive testicle enhancement">>
					<<set $activeSlave.drugs = "testicle enhancement">>
				<</switch>>
				<<SlaveInteractDrugs>>
			<</link>>
		<<elseif $activeSlave.drugs == "breast injections" || $activeSlave.drugs == "butt injections" || $activeSlave.drugs == "penis enhancement" || $activeSlave.drugs == "testicle enhancement">>
			| <<link "Intensify">>
				<<set $activeSlave.drugs = "intensive " + $activeSlave.drugs>>
				<<SlaveInteractDrugs>>
			<</link>>
		<</if>>
		<<if ($activeSlave.intelligence > -2) && $activeSlave.indentureRestrictions < 1>>
			| <<link "Psychosuppressants">><<set $activeSlave.drugs = "psychosuppressants">><<SlaveInteractDrugs>><</link>>
		<<else>>
			| Psychosuppressants
		<</if>>
		<<if ($activeSlave.boobs < 48000)>>
			| <<link "Breasts">><<set $activeSlave.drugs = "breast injections">><<SlaveInteractDrugs>><</link>>
		<<else>>
			| Breasts
		<</if>>
		<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
			<<if ($activeSlave.boobs < 25000)>>
				| <<link "Hyper-Breasts">><<set $activeSlave.drugs = "hyper breast injections">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Hyper Breasts
			<</if>>
		<</if>>
		<<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>>
			<<if ($activeSlave.boobs-$activeSlave.boobsImplant > 100)>>
				| <<link "Breast reducers">><<set $activeSlave.drugs = "breast redistributors">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Breast reducers
			<</if>>
			<<if ($activeSlave.nipples == "huge" || $activeSlave.nipples == "puffy" || $activeSlave.nipples == "cute")>>
				| <<link "Nipple reducers">><<set $activeSlave.drugs = "nipple atrophiers">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Nipple reducers
			<</if>>
		<</if>>
		<<if ($activeSlave.butt < 9)>>
			| <<link "Buttocks">><<set $activeSlave.drugs = "butt injections">><<SlaveInteractDrugs>><</link>>
		<<else>>
			| Buttocks
		<</if>>
		<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
			<<if ($activeSlave.butt < 20)>>
				| <<link "Hyper-Buttocks">><<set $activeSlave.drugs = "hyper butt injections">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Hyper Buttocks
			<</if>>
		<</if>>
		<<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>>
			<<if ($activeSlave.butt-$activeSlave.buttImplant > 0)>>
				| <<link "Butt reducers">><<set $activeSlave.drugs = "butt redistributors">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Butt reducers
			<</if>>
		<</if>>
		<<if ($activeSlave.lips <= 95) || (($activeSlave.lips <= 85) && ($seeExtreme != 1))>>
			| <<link "Lips">><<set $activeSlave.drugs = "lip injections">><<SlaveInteractDrugs>><</link>>
		<<else>>
			| Lips
		<</if>>
		<<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>>
			<<if ($activeSlave.lips-$activeSlave.lipsImplant > 0)>>
				| <<link "Lip reducers">><<set $activeSlave.drugs = "lip atrophiers">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Lip reducers
			<</if>>
		<</if>>
		<<if $growthStim == 1>>
			<<if $activeSlave.height < 274 && $activeSlave.height < Math.clamp((Height.mean($activeSlave) * 1.25),0,274)>>
				| <<link "Growth Stimulants">><<set $activeSlave.drugs = "growth stimulants">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Growth Stimulants
			<</if>>
		<</if>>
		| <<link "Fertility">><<set $activeSlave.drugs = "fertility drugs">><<SlaveInteractDrugs>><</link>>
		<<if ($seeHyperPreg == 1) && ($activeSlave.indentureRestrictions < 1) && ($superFertilityDrugs == 1) && $activeSlave.breedingMark != 1>>
			| <<link "Fertility+">><<set $activeSlave.drugs = "super fertility drugs">><<SlaveInteractDrugs>><</link>>
		<</if>>
		<<if ($activeSlave.dick > 0)>>
			<<if ($activeSlave.dick < 10)>>
				| <<link "Penis enhancement">><<set $activeSlave.drugs = "penis enhancement">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Penis enhancement
			<</if>>
		<<else>>
			<<if ($activeSlave.clit < 5)>>
				| <<link "Clitoris enhancement">><<set $activeSlave.drugs = "penis enhancement">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Clitoris enhancement
			<</if>>
		<</if>>
		<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
			<<if ($activeSlave.dick > 0)>>
				<<if ($activeSlave.dick < 31)>>
					| <<link "Hyper penis enhancement">><<set $activeSlave.drugs = "hyper penis enhancement">><<SlaveInteractDrugs>><</link>>
				<<else>>
					| Hyper penis enhancement
				<</if>>
			<<else>>
				<<if ($activeSlave.clit < 5)>>
					| <<link "Hyper clitoris enhancement">><<set $activeSlave.drugs = "penis enhancement">><<SlaveInteractDrugs>><</link>>
				<<else>>
					| Hyper clitoris enhancement
				<</if>>
			<</if>>
		<</if>>
		<<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>>
			<<if ($activeSlave.dick > 1)>>
				| <<link "Penis reducers">><<set $activeSlave.drugs = "penis atrophiers">><<SlaveInteractDrugs>><</link>>
			<<elseif $activeSlave.dick == 1>>
				| Penis reducers
			<</if>>
		<</if>>
		<<if ($activeSlave.balls > 0)>>
			| <<link "Testicle enhancement">><<set $activeSlave.drugs = "testicle enhancement">><<SlaveInteractDrugs>><</link>>
			<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
				| <<link "Hyper testicle enhancement">><<set $activeSlave.drugs = "hyper testicle enhancement">><<SlaveInteractDrugs>><</link>>
			<</if>>
		<</if>>
		<<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>>
			<<if ($activeSlave.balls > 1)>>
				| <<link "Testicle reducers">><<set $activeSlave.drugs = "testicle atrophiers">><<SlaveInteractDrugs>><</link>>
			<<elseif $activeSlave.balls == 1>>
				| Testicle reducers
			<</if>>
			<<if ($activeSlave.clit > 0)>>
				| <<link "Clitoris reducers">><<set $activeSlave.drugs = "clitoris atrophiers">><<SlaveInteractDrugs>><</link>>
			<</if>>
			<<if ($activeSlave.labia > 0)>>
				| <<link "Labia reducers">><<set $activeSlave.drugs = "labia atrophiers">><<SlaveInteractDrugs>><</link>>
			<</if>>
		<</if>>
		<<if $arcologies[0].FSYouthPreferentialistResearch == 1>>
			<<if ($activeSlave.visualAge > 18)>>
				| <<link "Anti-aging cream">><<set $activeSlave.drugs = "anti-aging cream">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Anti-aging cream
			<</if>>
		<</if>>
		| <<link "Steroids">><<set $activeSlave.drugs = "steroids">><<SlaveInteractDrugs>><</link>>
		<<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>>
			<<if ($activeSlave.weight > -95)>>
				| <<link "Weight loss pills">><<set $activeSlave.drugs = "appetite suppressors">><<SlaveInteractDrugs>><</link>>
			<<else>>
				| Weight loss pills
			<</if>>
		<</if>>
		<<if $precociousPuberty == 1 && $pubertyHormones == 1 && $activeSlave.breedingMark != 1>>
			<<if ($activeSlave.ovaries == 1 || $activeSlave.mpreg == 1) && $activeSlave.pubertyXX == 0>>
				| <<link "Female hormone injections">><<set $activeSlave.drugs = "female hormone injections">><<SlaveInteractDrugs>><</link>>
			<</if>>
			<<if $activeSlave.balls > 0 && $activeSlave.pubertyXY == 0>>
				| <<link "Male hormone injections">><<set $activeSlave.drugs = "male hormone injections">><<SlaveInteractDrugs>><</link>>
			<</if>>
		<</if>>
		| <<link "Hormone enhancers">><<set $activeSlave.drugs = "hormone enhancers">><<SlaveInteractDrugs>><</link>>
		| <<link "Hormone blockers">><<set $activeSlave.drugs = "hormone blockers">><<SlaveInteractDrugs>><</link>>
		<<if $activeSlave.boobs > 250 && $activeSlave.boobShape != "saggy" && $purchasedSagBGone == 1>>
			| <<link "Sag-B-Gone breast lifting cream">><<set $activeSlave.drugs = "sag-B-gone">><<SlaveInteractDrugs>><</link>>
		<</if>>
	<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<SlaveInteractFertility>>
%/
<<widget "SlaveInteractFertility">>
<<replace #fertilityblock>>
<<if $activeSlave.fuckdoll == 0 && ($activeSlave.ovaries == 1 || $activeSlave.mpreg == 1 || $activeSlave.preg > 0)>>
	<<if ($activeSlave.preg < -1)>>
		//She is sterile//
	<<elseif ($activeSlave.pubertyXX == 0) && $activeSlave.preg < 1>>
		//She is not yet fertile//
	<<elseif $activeSlave.ovaryAge >= 47 && $activeSlave.preg < 1>>
		//She is too old to become pregnant//
		<<if $activeSlave.preg == -1>>
			<<set $activeSlave.preg = 0>>
			<<run SetBellySize($activeSlave)>>
		<</if>>
	<<elseif $activeSlave.broodmotherOnHold == 1>>
	//Her pregnancy implant is turned off<<if $activeSlave.broodmotherCountDown > 0>>; she is expected to be completely emptied of her remaining brood in $activeSlave.broodmotherCountDown week<<if $activeSlave.broodmotherCountDown > 1>>s<</if>><<else>>.<</if>>//
	[[Turn on implant|Slave Interact][$activeSlave.broodmotherOnHold = 0, $activeSlave.broodmotherCountDown = 0]]
	<<elseif ($activeSlave.preg >= -1)>>
		__Contraception__: <<if $activeSlave.preg == -1>><<print "using contraceptives">><<elseif $activeSlave.pregWeek < 0>><<print "postpartum">><<elseif $activeSlave.preg == 0>><<print "fertile">><<elseif $activeSlave.preg < 4>><<print "may be pregnant">><<else>><<print $activeSlave.preg>><<print " weeks pregnant">><</if>>.
		<<if ($activeSlave.preg == 0)>>
			<<link "Use contraceptives">><<set $activeSlave.preg = -1>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<elseif ($activeSlave.preg == -1)>>
			<<link "Let her get pregnant">><<set $activeSlave.preg = 0>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<elseif $activeSlave.induce == 1>>
			//Hormones are being slipped into her food, she will give birth suddenly and rapidly this week//
		<<elseif ($activeSlave.preg > 38) && ($activeSlave.broodmother == 0) && ($activeSlave.labor == 0)>>
			[[Induce labor|Slave Interact][$activeSlave.labor = 1,$activeSlave.induce = 1,$birthee = 1]]
			| [[Give her a cesarean section|csec]]
		<<elseif ($activeSlave.broodmother > 0)>>
			<<if $activeSlave.broodmotherOnHold != 1>>
				[[Turn off implant|Slave Interact][$activeSlave.broodmotherOnHold = 1, $activeSlave.broodmotherCountDown = 38-WombMinPreg($activeSlave)]]
			<</if>>
			<<if ($activeSlave.preg > 37)>>
				| [[Induce mass childbirth|BirthStorm]]
			<</if>>
		<<elseif ($activeSlave.preg > 35)>>
			[[Give her a cesarean section|csec]]
		<<elseif ($activeSlave.preg > 0) && $activeSlave.breedingMark == 1 && $activeSlave.pregSource == -1>>
			//You are forbidden from aborting an elite child//
		<<elseif ($activeSlave.preg > 0)>>
			[[Abort her pregnancy|Abort]]
		<</if>>
	<</if>>
<<elseif ($activeSlave.ovaries == 1 || $activeSlave.mpreg == 1 || $activeSlave.preg > 0)>>
	<<if ($activeSlave.preg < -1)>>
		//It is sterile//
	<<elseif ($activeSlave.pubertyXX == 0)>>
		//It is not yet fertile//
	<<elseif $activeSlave.ovaryAge >= 47 && $activeSlave.preg < 1>>
		//It is too old to become pregnant//
		<<if $activeSlave.preg == -1>>
			<<set $activeSlave.preg = 0>>
			<<run SetBellySize($activeSlave)>>
		<</if>>
	<<elseif $activeSlave.broodmotherOnHold == 1>>
	//Its pregnancy implant is turned off; it expected to be completely emptied of its remaining brood in $activeSlave.broodmotherCountDown week $activeSlave.broodmotherCountDown week<<if $activeSlave.broodmotherCountDown > 1>>s<</if>>//
	[[Turn on implant|Slave Interact][$activeSlave.broodmotherOnHold = 0, $activeSlave.broodmotherCountDown = 0]]
	<<elseif ($activeSlave.preg >= -1)>>
		__Contraception__: <<if $activeSlave.preg == -1>><<print "using contraceptives">><<elseif $activeSlave.pregWeek < 0>><<print "postpartum">><<elseif $activeSlave.preg == 0>><<print "fertile">><<elseif $activeSlave.preg < 4>><<print "may be pregnant">><<else>><<print $activeSlave.preg>><<print " weeks pregnant">><</if>>.
		<<if ($activeSlave.preg == 0)>>
			<<link "Use contraceptives">><<set $activeSlave.preg = -1>>
			<<SlaveInteractFertility>>
			<</link>>
		<<elseif ($activeSlave.preg == -1)>>
			<<link "Let it get pregnant">><<set $activeSlave.preg = 0>>
			<<SlaveInteractFertility>>
			<</link>>
		<<elseif $activeSlave.induce == 1>>
			//Hormones are being slipped into its food, it will give birth suddenly and rapidly this week//
		<<elseif ($activeSlave.preg > 38) && ($activeSlave.broodmother == 0) && ($activeSlave.labor == 0)>>
			[[Induce labor|Slave Interact][$activeSlave.labor = 1,$activeSlave.induce = 1,$birthee = 1]]
			| [[Give it a cesarean section|csec]]
		<<elseif ($activeSlave.broodmother > 0)>>
			<<if $activeSlave.broodmotherOnHold != 1>>
				[[Turn off implant|Slave Interact][$activeSlave.broodmotherOnHold = 1, $activeSlave.broodmotherCountDown = 38-WombMinPreg($activeSlave)]]
			<</if>>
			<<if ($activeSlave.preg > 37)>>
				| [[Induce mass childbirth|BirthStorm]]
			<</if>>
		<<elseif ($activeSlave.preg > 35)>>
			[[Give it a cesarean section|csec]]
		<<elseif ($activeSlave.preg > 0) && $activeSlave.breedingMark == 1 && $activeSlave.pregSource == -1>>
			//You are forbidden from aborting an elite child//
		<<elseif ($activeSlave.preg > 0)>>
			[[Abort its pregnancy|Abort]]
		<</if>>
	<</if>>
<</if>>
<<if ($activeSlave.pregKnown == 1) && ($pregSpeedControl == 1) && ($activeSlave.breedingMark != 1) && ($activeSlave.indentureRestrictions < 1) && ($activeSlave.broodmother == 0)>>

	__Pregnancy control__: <<if $activeSlave.pregControl == "labor supressors">>Labor is suppressed<<elseif $activeSlave.pregControl == "slow gestation">>Slowed gestation<<elseif $activeSlave.pregControl == "speed up">>Faster gestation<<else>>Normal gestation<</if>>
	<<if ($activeSlave.preg >= 38)>>

		<<if $activeSlave.pregControl == "labor supressors">>
			<<link "Normal Birth">><<set $activeSlave.pregControl = "none">><<replace "#pregControl">>natural birth<</replace>><</link>>
		<<else>>
			<<link "Supress Labor">><<set $activeSlave.pregControl = "labor supressors">><<replace "#pregControl">>labor will be suppressed<</replace>><</link>>
		<</if>>
	<<elseif ($activeSlave.preg < 40)>>

		<<if $activeSlave.pregControl != "none">>
			<<link "Normal Gestation">><<set $activeSlave.pregControl = "none">><<replace "#pregControl">>normal gestation speed<</replace>><</link>> |
		<</if>>
		<<if $activeSlave.pregControl != "slow Gestation">>
			<<link "Slow Gestation">><<set $activeSlave.pregControl = "slow gestation">><<replace "#pregControl">>slowed gestation speed<</replace>><</link>> |
		<</if>>
		<<if $activeSlave.pregControl != "speed up">>
			<<link "Fast Gestation">><<set $activeSlave.pregControl = "speed up">><<replace "#pregControl">>fast gestation speed, staffed clinic recommended<</replace>><</link>>
		<</if>>
	<</if>>
<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractSexOption>>
%/
<<widget "SlaveInteractSexOption">>
<<replace #sexoption>>
	<<if ($activeSlave.vagina > -1)>>
		<<if canDoVaginal($activeSlave)>>
			<<link "Fuck her">><<replace "#miniscene">><<include "FVagina">>
<</replace>><<SlaveInteractFertility>><</link>>
			<<if canDoAnal($activeSlave)>>
				| <<link "Use her holes">><<replace "#miniscene">><<include "FButt">>
    <</replace>><<SlaveInteractFertility>><</link>>
			<</if>>
		<<else>>
			//Remove her chastity belt if you wish to fuck her//
		<</if>>
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractAnalSexOption>>
%/
<<widget "SlaveInteractAnalSexOption">>
<<replace #analsexoption>>
	<<if canDoAnal($activeSlave)>>
		| <<link "Fuck her ass">><<replace "#miniscene">><<include "FAnus">>
    <</replace>><</link>>
	<<else>>
		| //Remove her chastity belt if you wish to fuck her ass//
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractAnalGropeOption>>
%/
<<widget "SlaveInteractAnalGropeOption">>
<<replace #analgropeoption>>
	<<if canDoAnal($activeSlave)>>
		| <<link "Grope her butt">><<replace "#miniscene">><<include "FondleButt">>
    <</replace>><</link>>
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractGropeOption>>
%/
<<widget "SlaveInteractGropeOption">>
<<replace #gropeoption>>
	<<if ($activeSlave.vagina > -1)>>
		<<if canDoVaginal($activeSlave)>>
		| <<link "Grope her pussy">><<replace "#miniscene">><<include "FondleVagina">>
    <</replace>><</link>>
		<</if>>
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractDickGropeOption>>
%/
<<widget "SlaveInteractDickGropeOption">>
<<replace #dickgropeoption>>
	<<if ($activeSlave.dick >0)>>
		<<if ($activeSlave.dickAccessory != "chastity") && ($activeSlave.dickAccessory != "combined chastity")>>
		| <<link "Grope her dick">><<replace "#miniscene">><<include "FondleDick">>
    <</replace>><</link>>
			<<if canPenetrate($activeSlave) && $sexualOpeness == 1>>
				| <<link "Ride her dick">><<replace "#miniscene">><<include "FDick">>
    <</replace>><</link>>
			<</if>>
		<<else>>
		| //Remove her dick chastity belt if you wish to play with her cock//
		<</if>>
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<agentLeadership>>
 Must be within $arcologies[$i] for loop
%/
<<widget "agentLeadership">>
<<set $agentBonus = 0>>
<<for _j = 0; _j < $leaders.length; _j++>>
	<<if $arcologies[$i].leaderID == $leaders[_j].ID>>
		<<set $agentBonus = $leaders[_j].intelligence>>
		<<set $agentBonus += $leaders[_j].intelligenceImplant>>
		<<if $leaders[_j].actualAge > 35>>
			<<set $agentBonus += 1>>
		<</if>>
		<<if $leaders[_j].career == "an arcology owner">>
			<<set $agentBonus += 1>>
		<<elseif setup.HGCareers.includes($leaders[_j].career)>>
			<<set $agentBonus += 1>>
		<</if>>
		<<if $leaders[_j].fetishStrength > 95>>
		<<if ($leaders[_j].fetish == "dom") || ($leaders[_j].fetish == "sadist")>>
			<<set $agentBonus += 1>>
		<<elseif ($leaders[_j].fetish == "submissive") || ($leaders[_j].fetish == "masochist")>>
			<<set $agentBonus -= 1>>
		<</if>>
		<</if>>
		<<if $leaders[_j].energy > 95>>
			<<set $agentBonus += 1>>
		<</if>>
	<<break>>
	<</if>>
<</for>>
<<if $agentBonus > random(0,5)>>
	<<set $agentBonus = 1>>
<<else>>
	<<set $agentBonus = 0>>
<</if>>
<</widget>>

/%
 Call as <<PCTitle>>
%/
<<widget "PCTitle">>

<<if $surnameOrder != 1>>
	<<switch $PC.nationality>>
	<<case "Cambodian" "Chinese" "Hungarian" "Japanese" "Korean" "Mongolian" "Taiwanese" "Vietnamese">>
		<<if $PC.surname>><<set $PCTitle = $PC.surname>><<set $PCTitle += " " + $PC.name>><<else>><<set $PCTitle = $PC.name>><</if>>
	<<default>>
		<<set $PCTitle = $PC.name>>
		<<if $PC.surname>><<set $PCTitle += " " + $PC.surname>><</if>>
	<</switch>>
<<else>>
	<<set $PCTitle = $PC.name>>
	<<if $PC.surname>><<set $PCTitle += " " + $PC.surname>><</if>>
<</if>>
<<set $titles = []>>

<<if $cheater == 1>>
	<<set $PCTitle = ($PCTitle + " the Cheater")>>
<<elseif $arcologies[0].FSRestart > 10>>
	<<set $PCTitle = ($PCTitle + " of the Societal Elite")>>
<<elseif $rep > 18000>>
	<<set $PCTitle = ($PCTitle + " the Great")>>
<<elseif $rep > 17000>>
	<<set $PCTitle = ("the exalted " + $PCTitle)>>
<<elseif $rep > 16000>>
	<<set $PCTitle = ("the illustrious " + $PCTitle)>>
<<elseif $rep > 15000>>
	<<set $PCTitle = ("the prestigious " + $PCTitle)>>
<<elseif $rep > 14000>>
	<<set $PCTitle = ("the renowned " + $PCTitle)>>
<<elseif $rep > 13000>>
	<<set $PCTitle = ("the famed " + $PCTitle)>>
<<elseif $rep > 12000>>
	<<set $PCTitle = ("the celebrated " + $PCTitle)>>
<<elseif $rep > 11000>>
	<<set $PCTitle = ("the honored " + $PCTitle)>>
<<elseif $rep > 10000>>
	<<set $PCTitle = ("the acclaimed " + $PCTitle)>>
<<elseif $rep > 9000>>
	<<set $PCTitle = ("the eminent " + $PCTitle)>>
<<elseif $rep > 8250>>
	<<set $PCTitle = ("the prominent " + $PCTitle)>>
<<elseif $rep > 7500>>
	<<set $PCTitle = ("the distinguished " + $PCTitle)>>
<<elseif $rep > 6750>>
	<<set $PCTitle = ("the admired " + $PCTitle)>>
<<elseif $rep > 6000>>
	<<set $PCTitle = ("the esteemed " + $PCTitle)>>
<<elseif $rep > 5250>>
	<<set $PCTitle = ("the respected " + $PCTitle)>>
<<elseif $rep > 4500>>
	<<set $PCTitle = ("the known " + $PCTitle)>>
<<elseif $rep > 3750>>
	<<set $PCTitle = ("the recognized " + $PCTitle)>>
<<elseif $rep > 3000>>
	<<set $PCTitle = ("the rumored " + $PCTitle)>>
<</if>>

<<set $PCTitle = ($PCTitle + ", ")>>

<<if $PC.name == "FC Dev">>
	<<set $titles.push("the Creator")>>
<</if>>

<<if $plot == 1>>
	<<if $invasionVictory == 3>>
	<<if $PC.title == 1>>
		<<set $titles.push("Hero of the City")>>
	<<else>>
		<<set $titles.push("Heroine of the City")>>
	<</if>>
	<<elseif $invasionVictory == 2>>
	<<set $titles.push("Defender of the City")>>
	<</if>>
	<<if $daughtersVictory == 3>>
	<<set $titles.push("Destroyer of the Daughters")>>
	<<elseif $daughtersVictory == 2>>
	<<if $PC.title == 1>>
		<<set $titles.push("Victor over the Daughters")>>
	<<else>>
		<<set $titles.push("Victrix over the Daughters")>>
	<</if>>
	<</if>>
<</if>>

<<if $mercenaries >= 5>>
	<<if $mercenariesTitle == "Evocati">>
	<<set $seed = $mercenariesTitle>>
	<<set $seed = ("Princeps of the " + $seed)>>
	<<set $titles.push($seed)>>
	<<elseif $mercenariesTitle == "Knights">>
	<<set $seed = $mercenariesTitle>>
	<<if $PC.title == 1>>
		<<set $seed = ("Lord Commander of the " + $seed)>>
	<<else>>
		<<set $seed = ("Lady Commander of the " + $seed)>>
	<</if>>
	<<set $titles.push($seed)>>
	<<elseif $mercenariesTitle == "Immortals">>
	<<set $seed = $mercenariesTitle>>
	<<set $seed = ("Tyrant of the " + $seed)>>
	<<set $titles.push($seed)>>
	<<else>>
	<<set $seed = $mercenariesTitle>>
	<<set $seed = ("Commander of the " + $seed)>>
	<<set $titles.push($seed)>>
	<</if>>
<<elseif $mercenaries >= 1>>
	<<set $titles.push("Commander of the Mercenaries")>>
<</if>>

<<if $dispensary == 1>>
	<<if $PC.title == 1>>
		<<set $titles.push("Pharmacologos")>>
	<<else>>
		<<set $titles.push("Pharmacologes")>>
	<</if>>
<</if>>

<<if $arcologies[0].FSSupremacist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Grand Champion of the Blood")>>
<<elseif $arcologies[0].FSSupremacist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Champion of the Blood")>>
<<elseif $arcologies[0].FSSupremacist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Defender of the Blood")>>
<</if>>

<<if $arcologies[0].FSSubjugationist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Grand Overseer of the Inferior Race")>>
<<elseif $arcologies[0].FSSubjugationist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Overseer of the Inferior Race")>>
<<elseif $arcologies[0].FSSubjugationist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Subduer of the Inferior Race")>>
<</if>>

<<if $arcologies[0].FSGenderRadicalist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Buttfucker of All Slaves")>>
<<elseif $arcologies[0].FSGenderRadicalist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Sodomizer of the Traps")>>
<<elseif $arcologies[0].FSGenderRadicalist >= $FSLockinLevel*0.3>>
	<<if $PC.title == 1>>
	<<set $titles.push("Penetrator of the Sissies")>>
	<<else>>
	<<set $titles.push("Penetratrix of the Sissies")>>
	<</if>>
<</if>>

<<if $arcologies[0].FSGenderFundamentalist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("Father to the City")>>
	<<else>>
	<<set $titles.push("Mother to the City")>>
	<</if>>
<<elseif $arcologies[0].FSGenderFundamentalist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Defender of Women")>>
<<elseif $arcologies[0].FSGenderFundamentalist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Restorer of Morals")>>
<</if>>

<<if $arcologies[0].FSPaternalist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("Protector to All Slaves")>>
	<<else>>
	<<set $titles.push("Protectrix to All Slaves")>>
	<</if>>
<<elseif $arcologies[0].FSPaternalist >= $FSLockinLevel*0.6>>
	<<if $PC.title == 1>>
	<<set $titles.push("Benefactor of Slaves")>>
	<<else>>
	<<set $titles.push("Benefactrix of Slaves")>>
	<</if>>
<<elseif $arcologies[0].FSPaternalist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Pursuer of Justice")>>
<</if>>

<<if $arcologies[0].FSRepopulationFocus >= $FSLockinLevel*0.9>>
		<<set $titles.push("the Savior of the Future")>>
<<elseif $arcologies[0].FSRepopulationFocus >= $FSLockinLevel*0.6>>
	<<set $titles.push("the Holder of the Future")>>
<<elseif $arcologies[0].FSRepopulationFocus >= $FSLockinLevel*0.3>>
	<<set $titles.push("the Repopulist")>>
<</if>>

<<if $arcologies[0].FSDegradationist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Holder of the Rod and the Lash")>>
<<elseif $arcologies[0].FSDegradationist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Subduer of Slaves")>>
<<elseif $arcologies[0].FSDegradationist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Pursuer of Justice")>>
<</if>>

<<if $arcologies[0].FSBodyPurist >= $FSLockinLevel*0.9>>
	<<set $titles.push("the Purifier of the Breasts")>>
<<elseif $arcologies[0].FSBodyPurist >= $FSLockinLevel*0.6>>
	<<set $titles.push("the Discerning")>>
<<elseif $arcologies[0].FSBodyPurist >= $FSLockinLevel*0.3>>
	<<set $titles.push("the Tasteful")>>
<</if>>

<<if $arcologies[0].FSAssetExpansionist >= $FSLockinLevel*0.9>>
	<<set $titles.push("the Expander of the Breasts")>>
<<elseif $arcologies[0].FSAssetExpansionist >= $FSLockinLevel*0.6>>
	<<set $titles.push("the Expander")>>
<<elseif $arcologies[0].FSAssetExpansionist >= $FSLockinLevel*0.3>>
	<<if $PC.title == 1>>
	<<set $titles.push("the Implantor")>>
	<<else>>
	<<set $titles.push("the Implantrix")>>
	<</if>>
<</if>>

<<if $arcologies[0].FSPastoralist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("the Master of Stock")>>
	<<else>>
	<<set $titles.push("the Mistress of Stock")>>
	<</if>>
<<elseif $arcologies[0].FSPastoralist >= $FSLockinLevel*0.6>>
	<<set $titles.push("the Rancher")>>
<<elseif $arcologies[0].FSPastoralist >= $FSLockinLevel*0.3>>
	<<set $titles.push("the Farmer")>>
<</if>>

<<if $arcologies[0].FSPhysicalIdealist >= $FSLockinLevel*0.9>>
	<<set $titles.push("beloved of Brodin")>>
<<elseif $arcologies[0].FSPhysicalIdealist >= $FSLockinLevel*0.6>>
	<<if $PC.title == 1>>
	<<set $titles.push("he of the godlike Body")>>
	<<else>>
	<<set $titles.push("she of the godlike Body")>>
	<</if>>
<<elseif $arcologies[0].FSPhysicalIdealist >= $FSLockinLevel*0.3>>
	<<set $titles.push("advancer of Gains")>>
<</if>>

<<if $arcologies[0].FSHedonisticDecadence >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("Master of Softness")>>
	<<else>>
	<<set $titles.push("Lady of Softness")>>
	<</if>>
<<elseif $arcologies[0].FSHedonisticDecadence >= $FSLockinLevel*0.6>>
	<<set $titles.push("Thickness Eunthusiast")>>
<<elseif $arcologies[0].FSHedonisticDecadence >= $FSLockinLevel*0.3>>
	<<set $titles.push("the Feeder")>>
<</if>>

<<if $arcologies[0].FSMaturityPreferentialist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Grand Preserver of MILFS")>>
<<elseif $arcologies[0].FSMaturityPreferentialist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Fucker of MILFS")>>
<<elseif $arcologies[0].FSMaturityPreferentialist >= $FSLockinLevel*0.3>>
	<<if $PC.title == 1>>
	<<set $titles.push("he of the notorious MILF preference")>>
	<<else>>
	<<set $titles.push("she of the notorious MILF preference")>>
	<</if>>
<</if>>

<<if $arcologies[0].FSYouthPreferentialist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Keeper of the Magnificent Young Harem")>>
<<elseif $arcologies[0].FSYouthPreferentialist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Keeper of Virgins")>>
<<elseif $arcologies[0].FSYouthPreferentialist >= $FSLockinLevel*0.3>>
	<<set $titles.push("the Virginbreaker")>>
<</if>>

<<if $arcologies[0].FSChattelReligionistLaw == 1>>
	<<set $titles.push("the Prophet")>>
<<elseif $arcologies[0].FSChattelReligionist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Keeper of the Blade and Chalice")>>
<<elseif $arcologies[0].FSChattelReligionist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Champion of the Faith")>>
<<elseif $arcologies[0].FSChattelReligionist >= $FSLockinLevel*0.3>>
	<<set $titles.push("the Holy")>>
<</if>>

<<if $arcologies[0].FSRomanRevivalist >= $FSLockinLevel*0.9>>
	<<set $titles.push("First Consul")>>
<<elseif $arcologies[0].FSRomanRevivalist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Aedile")>>
<<elseif $arcologies[0].FSRomanRevivalist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Quaestor")>>
<</if>>

<<if $arcologies[0].FSAztecRevivalist >= $FSLockinLevel*0.9>>
	<<set $titles.push("Tlatcani")>>
<<elseif $arcologies[0].FSAztecRevivalist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Cihuacoatl")>>
<<elseif $arcologies[0].FSAztecRevivalist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Tlatoani")>>
<</if>>

<<if $arcologies[0].FSEgyptianRevivalist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("the Living God")>>
	<<else>>
	<<set $titles.push("the Living Goddess")>>
	<</if>>
<<elseif $arcologies[0].FSEgyptianRevivalist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Pharaoh")>>
<<elseif $arcologies[0].FSEgyptianRevivalist >= $FSLockinLevel*0.3>>
	<<if $PC.title == 1>>
	<<set $titles.push("Prince of the Nile")>>
	<<else>>
	<<set $titles.push("Princess of the Nile")>>
	<</if>>
<</if>>

<<if $arcologies[0].FSEdoRevivalist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("Emperor and Descendant of Amaterasu")>>
	<<else>>
	<<set $titles.push("Amaterasu Reborn")>>
	<</if>>
<<elseif $arcologies[0].FSEdoRevivalist >= $FSLockinLevel*0.6>>
	<<set $titles.push("Shogun")>>
<<elseif $arcologies[0].FSEdoRevivalist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Daimyo")>>
<</if>>

<<if $arcologies[0].FSArabianRevivalist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("Caliph")>>
	<<else>>
	<<set $titles.push("Handmaiden of Allah")>>
	<</if>>
<<elseif $arcologies[0].FSArabianRevivalist >= $FSLockinLevel*0.6>>
	<<if $PC.title == 1>>
	<<set $titles.push("Sultan")>>
	<<else>>
	<<set $titles.push("Sultana")>>
	<</if>>
<<elseif $arcologies[0].FSArabianRevivalist >= $FSLockinLevel*0.3>>
	<<set $titles.push("Beloved of Allah")>>
<</if>>

<<if $arcologies[0].FSChineseRevivalist >= $FSLockinLevel*0.9>>
	<<if $PC.title == 1>>
	<<set $titles.push("Emperor and Holder of the Mandate of Heaven")>>
	<<else>>
	<<set $titles.push("Empress and Holder of the Mandate of Heaven")>>
	<</if>>
<<elseif $arcologies[0].FSChineseRevivalist >= $FSLockinLevel*0.6>>
	<<if $PC.title == 1>>
	<<set $titles.push("Emperor")>>
	<<else>>
	<<set $titles.push("Empress")>>
	<</if>>
<<elseif $arcologies[0].FSChineseRevivalist >= $FSLockinLevel*0.3>>
	<<if $PC.title == 1>>
	<<set $titles.push("Governor of the Province")>>
	<<else>>
	<<set $titles.push("Governess of the Province")>>
	<</if>>
<</if>>

<<if $brothelSlaves >= 15>>
	<<if $PC.title == 1>>
	<<set $titles.push("Procurator of the Brothel")>>
	<<else>>
	<<set $titles.push("Procuratrix of the Brothel")>>
	<</if>>
<</if>>
<<if $clubSlaves >= 15>>
	<<set $titles.push("First on the Club")>>
<</if>>
<<if $dairySlaves >= 15>>
	<<set $titles.push("Keeper of the Cattle")>>
<</if>>
<<if $cumSlaves >= 15>>
	<<if $PC.title == 1>>
	<<set $titles.push("Extractor of the Ejaculate")>>
	<<else>>
	<<set $titles.push("Extractrix of the Ejaculate")>>
	<</if>>
<</if>>
<<if $servantsQuartersSlaves >= 15>>
	<<if $PC.title == 1>>
	<<set $titles.push("Director of the Servants")>>
	<<else>>
	<<set $titles.push("Directrix of the Servants")>>
	<</if>>
<</if>>
<<if $schoolroomSlaves >= 10>>
	<<if $PC.title == 1>>
	<<set $titles.push("Educator of the Slaves")>>
	<<else>>
	<<set $titles.push("Educatrix of the Slaves")>>
	<</if>>
<</if>>
<<if $spaSlaves >= 10>>
	<<set $titles.push("Order of the Bath")>>
<</if>>
<<if $arcadeSlaves >= 15>>
	<<set $titles.push("Comptroller of the Arcade")>>
<</if>>

<<set $schoolsPresent = []>>
<<set $schoolsPerfected = []>>
<<if $TSS.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("The Slave School")>>
<<elseif $TSS.schoolPresent == 1>>
	<<set $schoolsPresent.push("The Slave School")>>
<</if>>
<<if $GRI.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("The Growth Research Institute")>>
<<elseif $GRI.schoolPresent == 1>>
	<<set $schoolsPresent.push("The Growth Research Institute")>>
<</if>>
<<if $SCP.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("St. Claver Preparatory")>>
<<elseif $SCP.schoolPresent == 1>>
	<<set $schoolsPresent.push("St. Claver Preparatory")>>
<</if>>
<<if $LDE.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("L'École des Enculées")>>
<<elseif $LDE.schoolPresent == 1>>
	<<set $schoolsPresent.push("L'École des Enculées")>>
<</if>>
<<if $TGA.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("The Gymnasium-Academy")>>
<<elseif $TGA.schoolPresent == 1>>
	<<set $schoolsPresent.push("The Gymnasium-Academy")>>
<</if>>
<<if $HA.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("The Hippolyta Academy")>>
<<elseif $HA.schoolPresent == 1>>
	<<set $schoolsPresent.push("The Hippolyta Academy")>>
<</if>>
<<if $TCR.schoolProsperity >= 10>>
	<<set $schoolsPerfected.push("The Cattle Ranch")>>
<<elseif $TCR.schoolPresent == 1>>
	<<set $schoolsPresent.push("The Cattle Ranch")>>
<</if>>
<<if $schoolsPerfected.length > 0>>
	<<if $PC.title == 1>>
	<<set $schoolTitle = "Benefactor of ">>
	<<else>>
	<<set $schoolTitle = "Benefactrix of ">>
	<</if>>
	<<for _mwi = 0; _mwi < $schoolsPerfected.length; _mwi++>>
		<<set $seed = $schoolsPerfected[_mwi]>>
		<<set $schoolTitle = ($schoolTitle + $seed)>>
		<<if _mwi < $schoolsPerfected.length-2>>
			<<set $schoolTitle = ($schoolTitle + ", ")>>
		<<elseif _mwi == $schoolsPerfected.length-2>>
			<<if $schoolsPerfected.length > 2>>
			<<set $schoolTitle = ($schoolTitle + ", and ")>>
			<<else>>
			<<set $schoolTitle = ($schoolTitle + " and ")>>
			<</if>>
		<</if>>
	<</for>>
	<<set $titles.push($schoolTitle)>>
<</if>>
<<if $schoolsPresent.length > 0>>
	<<set $schoolTitle = "Supporter of ">>
	<<for _mwi = 0; _mwi < $schoolsPresent.length; _mwi++>>
	<<set $seed = $schoolsPresent[_mwi]>>
	<<set $schoolTitle = ($schoolTitle + $seed)>>
	<<if _mwi < $schoolsPresent.length-2>>
		<<set $schoolTitle = ($schoolTitle + ", ")>>
	<<elseif _mwi == $schoolsPresent.length-2>>
		<<if $schoolsPresent.length > 2>>
		<<set $schoolTitle = ($schoolTitle + ", and ")>>
		<<else>>
		<<set $schoolTitle = ($schoolTitle + " and ")>>
		<</if>>
	<</if>>
	<</for>>
	<<set $titles.push($schoolTitle)>>
<</if>>
<<if $TFS.schoolProsperity >= 10>>
	<<set $titles.push("Honorary Sibling of the Futanari Sisters")>>
<<elseif $TFS.schoolPresent == 1>>
	<<if $PC.title == 1>>
	<<set $titles.push("Protector of the Futanari Sisters")>>
	<<else>>
	<<set $titles.push("Protectrix of the Futanari Sisters")>>
	<</if>>
<</if>>

<<if $slaves.length > 50>>
	<<if $PC.title == 1>>
	<<set $titles.push("Master of Slaves")>>
	<<else>>
	<<set $titles.push("Mistress of Slaves")>>
	<</if>>
<<elseif $slaves.length > 40>>
	<<set $titles.push("Holder of Slaves")>>
<<elseif $slaves.length > 30>>
	<<set $titles.push("Keeper of Slaves")>>
<<elseif $slaves.length > 20>>
	<<set $titles.push("Manager of Slaves")>>
<<elseif $slaves.length > 10>>
	<<set $titles.push("owner of slaves")>>
<</if>>

<<if $corpValue > 500000>>
	<<set $titles.push("Corporate Titan")>>
<<elseif $corpValue > 250000>>
	<<set $titles.push("corporate innovator")>>
<<elseif $corpValue > 100000>>
	<<set $titles.push("corporate founder")>>
<<elseif $corpValue > 0>>
	<<if $PC.title == 1>>
	<<set $titles.push("noted corporate businessman")>>
	<<else>>
	<<set $titles.push("noted corporate businesswoman")>>
	<</if>>
<</if>>

<<if $titles.length > 0>>
	<<set $titles.push("and ")>>
<</if>>

<<if $rep > 18000>>
	<<if $PC.title == 1>>
	<<set $titles.push("unquestioned Master of the Arcology")>>
	<<else>>
	<<set $titles.push("unquestioned Mistress of the Arcology")>>
	<</if>>
<<elseif $rep > 15000>>
	<<if $PC.title == 1>>
	<<set $titles.push("Lord of the Arcology")>>
	<<else>>
	<<set $titles.push("Lady of the Arcology")>>
	<</if>>
<<elseif $rep > 12000>>
	<<set $titles.push("Ruler of the Arcology")>>
<<elseif $rep > 9000>>
	<<set $titles.push("chief officer of the arcology")>>
<<else>>
	<<set $titles.push("owner of the arcology")>>
<</if>>

<<for _mwi = 0; _mwi < $titles.length; _mwi++>>
	<<set $seed = $titles[_mwi]>>
	<<set $PCTitle = ($PCTitle + $seed)>>
	<<if _mwi < $titles.length-2>>
	<<set $PCTitle = ($PCTitle + ", ")>>
	<</if>>
<</for>>

<</widget>>

/%
 Call as <<MenialPopCap>>
 Applies the menial popcap without asking.
%/
<<widget "MenialPopCap">>

<<set $PopCap = 500>>
<<for _mwi = 20; _mwi < $sectors.length; _mwi++>>
	<<if $sectors[_mwi].type == "Pens">>
		<<set $PopCap += 500>>
	<</if>>
<</for>>
<<set _OverMenialCap = ($helots+$fuckdolls+$menialBioreactors)-$PopCap>>
<<if _OverMenialCap > 0>>
	<<set _Price = menialSlaveCost()>>
	<<if $helots > 0>>
		<<if $helots > _OverMenialCap>>
			<<set $cash += _OverMenialCap*_Price, $menialDemandFactor -= _OverMenialCap,
			$helots -= _OverMenialCap, _OverMenialCap = 0>>
			You don't have enough room for all your menials and are obliged to sell some.
		<<else>>
			<<set $cash += $helots*_Price, $menialDemandFactor -= $helots,
			_OverMenialCap -= $helots, $helots = 0>>
			You don't have enough room for your menials and are obliged to sell them.
		<</if>>
	<</if>>
	<<if (_OverMenialCap > 0) && ($fuckdolls > 0)>>
		<<if $fuckdolls > _OverMenialCap>>
			<<set $cash += _OverMenialCap*(_Price*2), $menialDemandFactor -= _OverMenialCap,
			$fuckdolls -= _OverMenialCap, _OverMenialCap = 0>>
			You don't have enough room for all your fuckdolls and are obliged to sell some.
		<<else>>
			<<set $cash += $fuckdolls*(_Price*2), $menialDemandFactor -= $fuckdolls,
			_OverMenialCap -= $fuckdolls, $fuckdolls = 0>>
			You don't have enough room for your fuckdolls and are obliged to sell them.
		<</if>>
	<</if>>
	<<if (_OverMenialCap > 0) && ($menialBioreactors > 0)>>
		<<set $cash += _OverMenialCap*(_Price-100), $menialDemandFactor -= _OverMenialCap,
		$menialBioreactors -= _OverMenialCap>>
		You don't have enough room for all your menial bioreactors and are obliged to sell some.
	<</if>>
<</if>>

<</widget>>

/%
 Call as <<OralSkillIncrease>>
 $args[0]: Slave.
 $skillIncrease: Amount of increase.
%/
<<widget "OralSkillIncrease">>

<<SlavePronouns $args[0]>>
<<if $args[0].oralSkill <= 10>>
	<<if $args[0].oralSkill+$skillIncrease > 10>>
		@@.green;$pronounCap now has basic knowledge about oral sex,@@ and can at least suck a dick without constant gagging.
	<</if>>
<<elseif $args[0].oralSkill <= 30>>
	<<if $args[0].oralSkill+$skillIncrease > 30>>
		@@.green;$pronounCap now has some oral skills,@@ and can reliably bring dicks and pussies to climax with her mouth.
	<</if>>
<<elseif $args[0].oralSkill <= 60>>
	<<if $args[0].oralSkill+$skillIncrease > 60>>
		@@.green;$pronounCap is now an oral expert,@@ and has a delightfully experienced tongue.
	<</if>>
<<elseif $args[0].oralSkill < 100>>
	<<if $args[0].oralSkill+$skillIncrease >= 100>>
		@@.green;$pronounCap has mastered oral sex,@@ and can learn nothing more about sucking dick or eating pussy.
	<</if>>
<</if>>
<<set $args[0].oralSkill += $skillIncrease>>

<</widget>>

/%
 Call as <<VaginalSkillIncrease>>
 $args[0]: Slave.
 $skillIncrease: Amount of increase.
%/
<<widget "VaginalSkillIncrease">>

<<SlavePronouns $args[0]>>
<<if $args[0].vaginalSkill <= 10>>
	<<if $args[0].vaginalSkill+$skillIncrease > 10>>
		@@.green;$pronounCap now has basic knowledge about vaginal sex,@@ and can avoid some of the common pitfalls and turnoffs.
	<</if>>
<<elseif $args[0].vaginalSkill <= 30>>
	<<if $args[0].vaginalSkill+$skillIncrease > 30>>
		@@.green;$pronounCap now has some vaginal sex skills,@@ and can do more than just lie there and take it.
	<</if>>
<<elseif $args[0].vaginalSkill <= 60>>
	<<if $args[0].vaginalSkill+$skillIncrease > 60>>
		@@.green;$pronounCap is now a vaginal sex expert,@@ and has the muscular control to massage anything that's inside her.
	<</if>>
<<elseif $args[0].vaginalSkill < 100>>
	<<if $args[0].vaginalSkill+$skillIncrease >= 100>>
		@@.green;$pronounCap has mastered vaginal sex,@@ and can learn nothing more about tribbing or taking dick.
	<</if>>
<</if>>
<<set $args[0].vaginalSkill += $skillIncrease>>

<</widget>>

/%
 Call as <<AnalSkillIncrease>>
 $args[0]: Slave.
 $skillIncrease: Amount of increase.
%/
<<widget "AnalSkillIncrease">>

<<SlavePronouns $args[0]>>
<<if $args[0].analSkill <= 10>>
	<<if $args[0].analSkill+$skillIncrease > 10>>
		@@.green;$pronounCap now has basic knowledge about anal sex,@@ and can accept penetration of her anus without danger.
	<</if>>
<<elseif $args[0].analSkill <= 30>>
	<<if $args[0].analSkill+$skillIncrease > 30>>
		@@.green;$pronounCap now has some anal sex skills,@@ and needs less preparation before taking rough penetration.
	<</if>>
<<elseif $args[0].analSkill <= 60>>
	<<if $args[0].analSkill+$skillIncrease > 60>>
		@@.green;$pronounCap is now an anal sex expert,@@ and knows how to use her sphincter to please.
	<</if>>
<<elseif $args[0].analSkill < 100>>
	<<if $args[0].analSkill+$skillIncrease >= 100>>
		@@.green;$pronounCap has mastered anal sex,@@ and can learn nothing more about taking it up the ass.
	<</if>>
<</if>>
<<set $args[0].analSkill += $skillIncrease>>

<</widget>>

/%
 Call as <<WhoreSkillIncrease>>
 $args[0]: Slave.
 $skillIncrease: Amount of increase.
%/
<<widget "WhoreSkillIncrease">>

<<SlavePronouns $args[0]>>
<<if $args[0].whoreSkill <= 10>>
	<<if $args[0].whoreSkill+$skillIncrease > 10>>
		@@.green;$pronounCap now has basic knowledge about how to whore,@@ and can avoid some potentially dangerous situations.
	<</if>>
<<elseif $args[0].whoreSkill <= 30>>
	<<if $args[0].whoreSkill+$skillIncrease > 30>>
		@@.green;$pronounCap now has some skill as a whore,@@ and knows how to sell her body at a good price.
	<</if>>
<<elseif $args[0].whoreSkill <= 60>>
	<<if $args[0].whoreSkill+$skillIncrease > 60>>
		@@.green;$pronounCap is now an expert whore,@@ and can often make clients forget that $pronoun's a prostitute they're paying for.
	<</if>>
<<elseif $args[0].whoreSkill < 100>>
	<<if $args[0].whoreSkill+$skillIncrease >= 100>>
		@@.green;$pronounCap is now a masterful whore,@@ and can learn nothing more about prostitution.
	<</if>>
<</if>>
<<set $args[0].whoreSkill += $skillIncrease>>

<</widget>>

/%
 Call as <<EntertainSkillIncrease>>
 $args[0]: Slave.
 $skillIncrease: Amount of increase.
%/
<<widget "EntertainSkillIncrease">>

<<SlavePronouns $args[0]>>
<<if $args[0].entertainSkill <= 10>>
	<<if $args[0].entertainSkill+$skillIncrease > 10>>
		@@.green;$pronounCap now has basic knowledge about how to be entertaining,@@ and can usually avoid serious faux pas.
	<</if>>
<<elseif $args[0].entertainSkill <= 30>>
	<<if $args[0].entertainSkill+$skillIncrease > 30>>
		@@.green;$pronounCap now has some skill as an entertainer,@@ and can flirt, dance, and strip acceptably.
	<</if>>
<<elseif $args[0].entertainSkill <= 60>>
	<<if $args[0].entertainSkill+$skillIncrease > 60>>
		@@.green;$pronounCap is now an expert entertainer,@@ and can flirt engagingly, dance alluringly, and strip arousingly.
	<</if>>
<<elseif $args[0].entertainSkill < 100>>
	<<if $args[0].entertainSkill+$skillIncrease >= 100>>
		@@.green;$pronounCap is now a masterful entertainer,@@ and can learn nothing more about flirting, dancing, or stripping.
	<</if>>
<</if>>
<<set $args[0].entertainSkill += $skillIncrease>>

<</widget>>

/%
 Call as <<FaceIncrease>>
 $args[0]: Slave.
 $args[1]: Amount of increase.
%/
<<widget "FaceIncrease">>

<<SlavePronouns $args[0]>>
<<if $args[0].face <= -95>>
	@@.green;$possessiveCap face is no longer horrifying,@@ and is now merely ugly.
<<elseif $args[0].face <= -40>>
	<<if $args[0].face+$args[1] > -40>>
		@@.green;$possessiveCap face is no longer ugly,@@ and is now merely unattractive.
	<</if>>
<<elseif $args[0].face <= -10>>
	<<if $args[0].face+$args[1] > -10>>
		@@.green;$possessiveCap face is no longer unattractive,@@ and is now somewhat tolerable.
	<</if>>
<<elseif $args[0].face <= 10>>
	<<if $args[0].face+$args[1] > 10>>
		@@.green;$possessiveCap face is now decently attractive,@@ rather than merely tolerable.
	<</if>>
<<elseif $args[0].face <= 40>>
	<<if $args[0].face+$args[1] > 40>>
		@@.green;$possessiveCap face is now quite beautiful,@@ rather than merely pretty.
	<</if>>
<<elseif $args[0].face <= 95>>
	<<if $args[0].face+$args[1] > 95>>
		@@.green;$possessiveCap face is now perfect.@@ It's difficult to imagine how it could be any more beautiful.
	<</if>>
<</if>>
<<set $args[0].face = Math.clamp($args[0].face+$args[1],-100,100)>>
<<if $args[0].face > 95>><<set $args[0].face = 100>><</if>>

<</widget>>

/%
 Call as <<AddSlave>>
 $args[0]: Slave.
%/
<<widget "AddSlave">>

<<switch $args[0].eyeColor>>
<<case "blind blue">><<set $args[0].origEye = "deep blue">>
<<case "milky white" "implant">><<set $args[0].origEye = either("blue", "green", "brown", "hazel", "light blue", "light green", "dark green", "dark blue")>>
<<default>><<set $args[0].origEye = $args[0].eyeColor>>
<</switch>>
<<set $args[0].origHColor = $args[0].hColor>>
<<set $args[0].underArmHColor = $args[0].hColor>>
<<set $args[0].pubicHColor = $args[0].hColor>>
<<set $args[0].origSkin = $args[0].skin>>

<<if $surnamesForbidden == 1>>
	<<set $args[0].slaveSurname = 0>>
<</if>>

<<if $args[0].preg > 0>>
	<<set $args[0].pregWeek = $args[0].preg>>
<<else>>
	<<set $args[0].pregWeek = 0>>
<</if>>

<<if $familyTesting == 1>>
	<<set $args[0].sisters = 0>>
	<<set $args[0].daughters = 0>>
	<<if $args[0].mother == -1 || $args[0].father == -1>>
		<<set $PC.daughters += 1>>
	<</if>>
	<<if areSisters($PC, $args[0]) > 0>>
		<<set $PC.sisters += 1>>
	<</if>>
	<<for _k = 0; _k < $slaves.length; _k++>>
		<<if $slaves[_k].mother == $args[0].ID || $slaves[_k].father == $args[0].ID>>
			<<set $args[0].daughters += 1>>
		<</if>>
		<<if $args[0].mother == $slaves[_k].ID || $args[0].father == $slaves[_k].ID>>
			<<set $slaves[_k].daughters += 1>>
		<</if>>
		<<if areSisters($slaves[_k], $args[0]) > 0>>
			<<set $args[0].sisters += 1>>
			<<set $slaves[_k].sisters += 1>>
		<</if>>
	<</for>>
<</if>>

<<if $args[0].dick > 0>>
	<<if $args[0].balls > 0>>
	<<if $args[0].devotion <= 50>>
	<<if ($args[0].fetish != "buttslut") || ($args[0].fetishKnown != 1)>>
	<<if $args[0].sexualFlaw != "hates women">>
	<<set $REFeminizationCheckinIDs.push($args[0].ID)>>
	<</if>>
	<</if>>
	<</if>>
	<</if>>
<</if>>
<<if $args[0].actualAge > 35>>
	<<if $args[0].face < 40>>
	<<if $args[0].analSkill <= 30>>
	<<set $REMILFCheckinIDs.push($args[0].ID)>>
	<</if>>
	<</if>>
<</if>>
<<if $args[0].attrXY <= 60>>
	<<if $args[0].attrXX > 60>>
		<<set $REOrientationCheckinIDs.push($args[0].ID)>>
	<</if>>
<</if>>
<<if $args[0].face < -10>>
	<<set $REUglyCheckinIDs.push($args[0].ID)>>
<</if>>
<<if $args[0].anus < 2>>
	<<set $REButtholeCheckinIDs.push($args[0].ID)>>
<</if>>
<<if $args[0].boobs < 800>>
	<<set $REReductionCheckinIDs.push($args[0].ID)>>
<</if>>

<<if $args[0].fuckdoll > 0>>
	<<set $args[0].pronoun = "it", $args[0].possessivePronoun = "its", $args[0].possessive = "its", $args[0].object = "it", $args[0].objectReflexive = "itself", $args[0].noun = "toy">>
<<elseif $args[0].dick > 0 && $args[0].vagina == -1 && $diversePronouns == 1>>
	<<set $args[0].pronoun = "he", $args[0].possessivePronoun = "his", $args[0].possessive = "his", $args[0].object = "him", $args[0].objectReflexive = "himself", $args[0].noun = "boy">>
<<else>>
	<<set $args[0].pronoun = "she", $args[0].possessivePronoun = "hers", $args[0].possessive = "her", $args[0].object = "her", $args[0].objectReflexive = "herself", $args[0].noun = "girl">>
<</if>>

<<run SetBellySize($args[0])>>

<<run addSlave($args[0])>>
<<if $args[0].origin != "She was your slave, but you freed her, which she repaid by participating in a coup attempt against you. It failed, and she is again your chattel." && $args[0].ID != $boomerangSlave.ID>>
	<<set $genePool.push($args[0])>>
<<else>>
	<<set _t = $genePool.findIndex(function(s) { return s.ID == $args[0].ID; })>>
	<<if _t == -1>> /* traitor or boomerang somehow not found */
		<<set $genePool.push($args[0])>>
	<</if>>
<</if>>

/* add to facilities array if needed */
<<if $args[0].assignment != "rest">>
	<<= assignJob($args[0], $args[0].assignment)>>
<</if>>

/** do not run the Rules Assistant before adding the new slave to the slaves list! **/
<<if $ui != "start">>
<<if $universalRulesNewSlavesRA == 1>>
<<if $rulesAssistantAuto != 0>>
	<<silently>>
	<<run DefaultRules($args[0])>>
	<</silently>>
<</if>>
<</if>>
<</if>>

<</widget>>

/%
 Call as <<Enunciate>>
 $args[0]: Slave.
%/
<<widget "Enunciate">>
	<<run Enunciate($args[0]) >>
<</widget>>

<<widget "Master">><<if def $args[0]>><<Enunciate $args[0]>><<elseif ndef $titleEnunciate>><<Enunciate $activeSlave>><</if>>$titleEnunciate<</widget>>
<<widget "WrittenMaster">><<= WrittenMaster($args[0]) >><</widget>>
<<widget "say">><<if def $args[0] && $sayEnunciate != "lisp">>$args[0]<<else>>$sayEnunciate<</if>><</widget>>
<<widget "s">>$sEnunciate<</widget>>
<<widget "S">>$SEnunciate<</widget>>
<<widget "ss">>$ssEnunciate<</widget>>
<<widget "c">>$cEnunciate<</widget>>
<<widget "cc">>$ccEnunciate<</widget>>
<<widget "z">>$zEnunciate<</widget>>
<<widget "sh">>$shEnunciate<</widget>>
<<widget "Sh">>$ShEnunciate<</widget>>
<<widget "x">>$xEnunciate<</widget>>

/%
 Call as <<SoftenBehavioralFlaw>>
 $args[0]: Slave.
%/
<<widget "SoftenBehavioralFlaw">>
	<<switch $args[0].behavioralFlaw>>
	<<case "arrogant">>
		<<set $args[0].behavioralQuirk = "confident">>
	<<case "bitchy">>
		<<set $args[0].behavioralQuirk = "cutting">>
	<<case "odd">>
		<<set $args[0].behavioralQuirk = "funny">>
	<<case "hates men">>
		<<set $args[0].behavioralQuirk = "adores women">>
	<<case "hates women">>
		<<set $args[0].behavioralQuirk = "adores men">>
	<<case "gluttonous">>
		<<set $args[0].behavioralQuirk = "fitness">>
	<<case "anorexic">>
		<<set $args[0].behavioralQuirk = "insecure">>
	<<case "devout">>
		<<set $args[0].behavioralQuirk = "sinful">>
	<<case "liberated">>
		<<set $args[0].behavioralQuirk = "advocate">>
	<</switch>>
	<<set $args[0].behavioralFlaw = "none">>
<</widget>>

/%
 Call as <<SoftenSexualFlaw>>
 $args[0]: Slave.
%/
<<widget "SoftenSexualFlaw">>
	<<switch $args[0].sexualFlaw>>
	<<case "hates oral">>
		<<set $args[0].sexualQuirk = "gagfuck queen">>
	<<case "hates anal">>
		<<set $args[0].sexualQuirk = "painal queen">>
	<<case "hates penetration">>
		<<set $args[0].sexualQuirk = "strugglefuck queen">>
	<<case "shamefast">>
		<<set $args[0].sexualQuirk = "tease">>
	<<case "idealistic">>
		<<set $args[0].sexualQuirk = "romantic">>
	<<case "repressed">>
		<<set $args[0].sexualQuirk = "perverted">>
	<<case "apathetic">>
		<<set $args[0].sexualQuirk = "caring">>
	<<case "crude">>
		<<set $args[0].sexualQuirk = "unflinching">>
	<<case "judgemental">>
		<<set $args[0].sexualQuirk = "size queen">>
	<</switch>>
	<<set $args[0].sexualFlaw = "none">>
<</widget>>

/%
 Call as <<EventFetish>>
 $args[0]: Slave.
 $args[1]: Fetish.
%/
<<widget "EventFetish">>

<<if $args[0].fetish == $args[1]>>
This experience
<<if $args[0].fetishKnown == 1>>
	<<if $args[0].fetishStrength > 95>>
		@@.lightsalmon;<<switch $args[0].fetish>>
		<<case "submissive">>deepens her sexual need to submit.
		<<case "cumslut">>increases her appetite for oral sex.
		<<case "humiliation">>makes her even more eager to be humiliated.
		<<case "buttslut">>encourages her to focus on anal sex.
		<<case "boobs">>focuses her sexuality on her breasts and nipples.
		<<case "sadist">>titillates the sadistic part of her.
		<<case "masochist">>helps conflate pain and sexual pleasure for her.
		<<case "dom">>strengthens her desire to top other slaves.
		<<case "pregnancy">>further confuses lust and pregnancy in her mind.
		<<default>>ERROR: bad fetish
		<</switch>>@@
		<<set $args[0].fetishStrength += 10>>
	<<else>>
		is @@.hotpink;especially enjoyable for her,@@ since
		<<switch $args[0].fetish>>
		<<case "submissive">>she's an utterly submissive little slut.
		<<case "cumslut">>her <<if $args[0].vagina > -1>>clit<<else>>frenulum<</if>> might as well be located in her throat.
		<<case "humiliation">>she has a hopeless need to be humiliated and degraded.
		<<case "buttslut">>she's completely in love with having her ass fucked.
		<<case "boobs">>she loves breast play more than any other kind of sex.
		<<case "sadist">>nothing is as titillating to her as another slave's pain can be.
		<<case "masochist">>she loves pain more than she likes pleasure.
		<<case "dom">>she lives for the times she's allowed to fuck someone.
		<<case "pregnancy">>all her deepest sexual desires involve <<if $args[0].vagina > -1 || $args[0].mpreg == 1>>pregnancy<<else>>impregnation<</if>>.
		<<default>>ERROR: bad fetish
		<</switch>>
		<<set $args[0].devotion += 3>>
	<</if>>
<<else>>
	was surprisingly appealing for her, revealing that she's a
	@@.lightsalmon;<<switch $args[0].fetish>>
	<<case "submissive">>sexual submissive!
	<<case "humiliation">>humiliation slut!
	<<case "boobs">>slut for breast play!
	<<case "pregnancy">>pregslut!
	<<default>>$args[0]!
	<</switch>>@@
	<<set $args[0].fetishKnown = 1>>
<</if>>
<</if>>

<</widget>>

/%
 Call as <<SlaveSort [$slaves]>>
 $args[0]: array to sort
%/
<<widget "SlaveSort">>
<<if passage() == "Main">>
	<<switch $sortSlavesBy>>
	<<case "name">>
		<<if ($sortSlavesOrder == "ascending")>>
			<<set $args[0] = $args[0].sort(function(a, b){if(a.slaveName  b.slaveName) return 1; return 0;})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){if(a.slaveName > b.slaveName) return -1; if(a.slaveName >
		<</if>>
	<<case "assignment">>
		<<if ($sortSlavesOrder == "ascending")>>
			<<set $args[0] = $args[0].sort(function(a, b){if(a.assignment  b.assignment) return 1; return 0;})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){if(a.assignment > b.assignment) return -1; if(a.assignment >
		<</if>>
	<<case "seniority">>
		<<if ($sortSlavesOrder == "ascending")>>
			<<set $args[0] = $args[0].sort(function(a, b){return b.weekAcquired-a.weekAcquired})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){return a.weekAcquired-b.weekAcquired})>>
		<</if>>
	<<case "actualAge">>
		<<if ($sortSlavesOrder == "ascending")>>
			<<set $args[0] = $args[0].sort(function(a, b){return a.actualAge-b.actualAge})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){return b.actualAge-a.actualAge})>>
		<</if>>
	<<case "visualAge">>
		<<if ($sortSlavesOrder == "ascending")>>
			<<set $args[0] = $args[0].sort(function(a, b){return a.visualAge-b.visualAge})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){return b.visualAge-a.visualAge})>>
		<</if>>
	<<case "physicalAge">>
		<<if ($sortSlavesOrder == "physicalAge")>>
			<<set $args[0] = $args[0].sort(function(a, b){return a.physicalAge-b.physicalAge})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){return b.physicalAge-a.physicalAge})>>
		<</if>>
	<<default>>
		<<if ($sortSlavesOrder == "ascending")>>
			<<set $args[0] = $args[0].sort(function(a, b){return a.devotion-b.devotion})>>
		<<else>>
			<<set $args[0] = $args[0].sort(function(a, b){return b.devotion-a.devotion})>>
		<</if>>
	<</switch>>
	<<set $slaveIndices = slaves2indices()>>
<<else>>
	<<set $slaveIndices = slaves2indices()>>
	<<set filterInPlace($args[0], function(s) { return $slaveIndices[s] !== undefined; })>>
	<<set $args[0].sort(function(a, b) { return $slaveIndices[a] - $slaveIndices[b]; })>>
<</if>>
<</widget>>

/%
 Call as <<FSChange>>
 $args[0]: FS.
 $args[1]: Magnitude.
 $args[2]: Bonus multiplier. (Optional)
 %/
<<widget "FSChange">>
<<switch $args[0]>>
<<case "Supremacist">>
	<<if Number.isFinite($arcologies[0].FSSupremacist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSSupremacist/$FSLockinLevel)>>
		<<set $arcologies[0].FSSupremacist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Subjugationist">>
	<<if Number.isFinite($arcologies[0].FSSubjugationist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSSubjugationist/$FSLockinLevel)>>
		<<set $arcologies[0].FSSubjugationist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "GenderRadicalist">>
	<<if Number.isFinite($arcologies[0].FSGenderRadicalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSGenderRadicalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSGenderRadicalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "GenderFundamentalist">>
	<<if Number.isFinite($arcologies[0].FSGenderFundamentalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSGenderFundamentalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSGenderFundamentalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Paternalist">>
	<<if Number.isFinite($arcologies[0].FSPaternalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSPaternalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSPaternalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Degradationist">>
	<<if Number.isFinite($arcologies[0].FSDegradationist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSDegradationist/$FSLockinLevel)>>
		<<set $arcologies[0].FSDegradationist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "AssetExpansionist">>
	<<if Number.isFinite($arcologies[0].FSAssetExpansionist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSAssetExpansionist/$FSLockinLevel)>>
		<<set $arcologies[0].FSAssetExpansionist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "SlimnessEnthusiast">>
	<<if Number.isFinite($arcologies[0].FSSlimnessEnthusiast)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSSlimnessEnthusiast/$FSLockinLevel)>>
		<<set $arcologies[0].FSSlimnessEnthusiast += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "TransformationFetishist">>
	<<if Number.isFinite($arcologies[0].FSTransformationFetishist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSTransformationFetishist/$FSLockinLevel)>>
		<<set $arcologies[0].FSTransformationFetishist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "BodyPurist">>
	<<if Number.isFinite($arcologies[0].FSBodyPurist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSBodyPurist/$FSLockinLevel)>>
		<<set $arcologies[0].FSBodyPurist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "MaturityPreferentialist">>
	<<if Number.isFinite($arcologies[0].FSMaturityPreferentialist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSMaturityPreferentialist/$FSLockinLevel)>>
		<<set $arcologies[0].FSMaturityPreferentialist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "YouthPreferentialist">>
	<<if Number.isFinite($arcologies[0].FSYouthPreferentialist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSYouthPreferentialist/$FSLockinLevel)>>
		<<set $arcologies[0].FSYouthPreferentialist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Pastoralist">>
	<<if Number.isFinite($arcologies[0].FSPastoralist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSPastoralist/$FSLockinLevel)>>
		<<set $arcologies[0].FSPastoralist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "PhysicalIdealist">>
	<<if Number.isFinite($arcologies[0].FSPhysicalIdealist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSPhysicalIdealist/$FSLockinLevel)>>
		<<set $arcologies[0].FSPhysicalIdealist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "ChattelReligionist">>
	<<if Number.isFinite($arcologies[0].FSChattelReligionist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSChattelReligionist/$FSLockinLevel)>>
		<<set $arcologies[0].FSChattelReligionist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "RomanRevivalist">>
	<<if Number.isFinite($arcologies[0].FSRomanRevivalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSRomanRevivalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSRomanRevivalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "AztecRevivalist">>
	<<if Number.isFinite($activeArcology.FSAztecRevivalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSAztecRevivalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSAztecRevivalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "EgyptianRevivalist">>
	<<if Number.isFinite($arcologies[0].FSEgyptianRevivalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSEgyptianRevivalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSEgyptianRevivalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "EdoRevivalist">>
	<<if Number.isFinite($arcologies[0].FSEdoRevivalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSEdoRevivalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSEdoRevivalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "ArabianRevivalist">>
	<<if Number.isFinite($arcologies[0].FSArabianRevivalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSArabianRevivalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSArabianRevivalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "ChineseRevivalist">>
	<<if Number.isFinite($arcologies[0].FSChineseRevivalist)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSChineseRevivalist/$FSLockinLevel)>>
		<<set $arcologies[0].FSChineseRevivalist += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Repopulationist">>
	<<if Number.isFinite($arcologies[0].FSRepopulationFocus)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSRepopulationFocus/$FSLockinLevel)>>
		<<set $arcologies[0].FSRepopulationFocus += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Eugenics">>
	<<if Number.isFinite($arcologies[0].FSRestart)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSRestart/$FSLockinLevel)>>
		<<set $arcologies[0].FSRestart += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<case "Hedonism">>
	<<if Number.isFinite($arcologies[0].FSHedonisticDecadence)>>
		<<set $rep += $args[1]*$FSSingleSlaveRep*($arcologies[0].FSHedonisticDecadence/$FSLockinLevel)>>
		<<set $arcologies[0].FSHedonisticDecadence += 0.05*$args[1]*$FSSingleSlaveRep*($args[2] || 1)>>
	<</if>>
<<default>>
	@@.red;ERROR: bad FS reference $args[0]@@
<</switch>>

<</widget>>

/%
 Call as <<FSChangePorn>>
 $args[0]: FS.
 $args[1]: Magnitude.
%/
<<widget "FSChangePorn">>

<<FSChange $args[0] $args[1] $pornFameBonus>>

<</widget>>

/* Called as <<FSChangeDecoration "FSName" "clothesBoughtFSClothes">>, will generate description of current decoration level and a link to increase it if applicable, quotes are needed to pass FSName as reference - DO NOT INCLUDE IT AS PROPERTY OF $arcologies[0]! */
<<widget "FSChangeDecoration">>
<<set _FS = $args[0]>>
<<set _FSDecoration = _FS + "Decoration">>
<<capture _FS, _FSDecoration>>
<<switch $arcologies[0][_FSDecoration]>>
<<case 20>>
	$arcologies[0].name is not customized to support this goal.
	<<if $arcologies[0][_FS] >= 10>>
		[[Modify your arcology's internal media to support this goal|Future Society][$arcologies[0][_FSDecoration] = 40, $cash -= 2500]] //Costs <<print cashFormat(2500)>>//
	<<else>>
		You must advance this goal before customization to support it becomes available.
	<</if>>
<<case 40>>
	$arcologies[0].name's media is supporting this goal.
	<<if $arcologies[0][_FS] >= 30>>
		[[Redecorate your arcology's public spaces to support this goal|Future Society][$arcologies[0][_FSDecoration] = 60, $cash -= 10000]] //Costs <<print cashFormat(10000)>>//
	<<else>>
		You must advance this goal before further customization to support it becomes available.
	<</if>>
<<case 60>>
	$arcologies[0].name's media is supporting this goal, and $arcologies[0].name's public spaces are decorated to support it too.
	<<if $arcologies[0][_FS] >= 50>>
		[[Station slaves in your arcology's public spaces to promote this goal|Future Society][$arcologies[0][_FSDecoration] = 80, $cash -= 10000]] //Costs <<print cashFormat(10000)>>//
	<<else>>
		You must advance this goal before further customization to support it becomes available.
	<</if>>
<<case 80>>
	$arcologies[0].name's media is supporting this goal; $arcologies[0].name's public spaces are decorated to support it, and have slaves stationed in them to support it too.
	<<if $arcologies[0][_FS] >= 70>>
		<<if def $args[3]>> /* Only for FSRepopulation */
			[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, State.variables[$args[1]] = 1, State.variables[$args[2]] = 1, State.variables[$args[3]] = 1, $cash -= 20000]] //Costs <<print cashFormat(20000)>>//
		<<elseif def $args[1]>>
			[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, State.variables[$args[1]] = 1, $cash -= 20000]] //Costs <<print cashFormat(20000)>>//
		<<else>>
			[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, $cash -= 20000]] //Costs <<print cashFormat(20000)>>//
		<</if>>
	<<else>>
		You must advance this goal before further customization to support it becomes available.
	<</if>>
<<case 100>>
	$arcologies[0].name's media is supporting this goal; $arcologies[0].name's public spaces are decorated to support it, and have slaves stationed in them to support it. The exterior of the arcology has been remodeled to support it too; the arcology is fully customized for this goal.
<</switch>>
<</capture>>
<</widget>>

<<widget "ValidateFacilityDecoration">>
/* Used by following widget, called with <<ValidateFacilityDecoration "var">> where var is for example "spaDecoration" -- quotes are needed to pass var as reference - DO NOT INCLUDE $ PREFIX! */
<<switch State.variables[$args[0]]>> /* get value of var name that was provided */
<<case "standard">>
	/* nothing to do */
<<case "Supremacist">>
	<<if !Number.isFinite($arcologies[0].FSSupremacist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Subjugationist">>
	<<if !Number.isFinite($arcologies[0].FSSubjugationist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Gender Radicalist">>
	<<if !Number.isFinite($arcologies[0].FSGenderRadicalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Gender Fundamentalist">>
	<<if !Number.isFinite($arcologies[0].FSGenderFundamentalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Paternalist">>
	<<if !Number.isFinite($arcologies[0].FSPaternalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Body Purist">>
	<<if !Number.isFinite($arcologies[0].FSBodyPurist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Transformation Fetishist">>
	<<if !Number.isFinite($arcologies[0].FSTransformationFetishist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Youth Preferentialist">>
	<<if !Number.isFinite($arcologies[0].FSYouthPreferentialist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Maturity Preferentialist">>
	<<if !Number.isFinite($arcologies[0].FSMaturityPreferentialist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Slimness Enthusiast">>
	<<if !Number.isFinite($arcologies[0].FSSlimnessEnthusiast)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Asset Expansionist">>
	<<if !Number.isFinite($arcologies[0].FSAssetExpansionist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Pastoralist">>
	<<if !Number.isFinite($arcologies[0].FSPastoralist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Physical Idealist">>
	<<if !Number.isFinite($arcologies[0].FSPhysicalIdealist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Chattel Religionist">>
	<<if !Number.isFinite($arcologies[0].FSChattelReligionist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Degradationist">>
	<<if !Number.isFinite($arcologies[0].FSDegradationist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Roman Revivalist">>
	<<if !Number.isFinite($arcologies[0].FSRomanRevivalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Egyptian Revivalist">>
	<<if !Number.isFinite($arcologies[0].FSEgyptianRevivalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Edo Revivalist">>
	<<if !Number.isFinite($arcologies[0].FSEdoRevivalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Arabian Revivalist">>
	<<if !Number.isFinite($arcologies[0].FSArabianRevivalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Chinese Revivalist">>
	<<if !Number.isFinite($arcologies[0].FSChineseRevivalist)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Repopulation Focus">>
	<<if !Number.isFinite($arcologies[0].FSRepopulationFocus)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Eugenics">>
	<<if !Number.isFinite($arcologies[0].FSRestart)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<<case "Hedonistic">>
	<<if !Number.isFinite($arcologies[0].FSHedonisticDecadence)>>
		<<set State.variables[$args[0]] = "standard">>
	<</if>>
<</switch>>
<</widget>>

<<widget "ClearFacilityDecorations">>
/* Called when a FS is abandoned or failed out of. */

<<if $brothel > 0>><<ValidateFacilityDecoration "brothelDecoration">><</if>>
<<if $club > 0>><<ValidateFacilityDecoration "clubDecoration">><</if>>
<<if $dairy > 0>><<ValidateFacilityDecoration "dairyDecoration">><</if>>
<<if $spa > 0>><<ValidateFacilityDecoration "spaDecoration">><</if>>
<<if $clinic > 0>><<ValidateFacilityDecoration "clinicDecoration">><</if>>
<<if $schoolroom > 0>><<ValidateFacilityDecoration "schoolroomDecoration">><</if>>
<<if $cellblock > 0>><<ValidateFacilityDecoration "cellblockDecoration">><</if>>
<<if $servantsQuarters > 0>><<ValidateFacilityDecoration "servantsQuartersDecoration">><</if>>
<<if $arcade > 0>><<ValidateFacilityDecoration "arcadeDecoration">><</if>>
<<if $masterSuite > 0>><<ValidateFacilityDecoration "masterSuiteDecoration">><</if>>

<</widget>>

/* Called as <<SetFacilityDecoration "facilityDecoration">>, will generate a clickable list of potential decorations, quotes are needed to pass facilityDecoration as reference - DO NOT INCLUDE $ PREFIX! */
<<widget "SetFacilityDecoration">>
<<if ($arcologies[0].FSSupremacist >= 20) && (State.variables[$args[0]] != "Supremacist")>>

    [[Supremacist redecoration|Future Society][State.variables[$args[0]] = "Supremacist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSSubjugationist >= 20) && (State.variables[$args[0]] != "Subjugationist")>>

    [[Subjugationist redecoration|Future Society][State.variables[$args[0]] = "Subjugationist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSRepopulationFocus >= 20) && (State.variables[$args[0]] != "Repopulation Focus")>>

    [[Repopulation Focus redecoration|Future Society][State.variables[$args[0]] = "Repopulation Focus", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSRestart >= 20) && (State.variables[$args[0]] != "Eugenics")>>

    [[Eugenics redecoration|Future Society][State.variables[$args[0]] = "Eugenics", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSGenderRadicalist >= 20) && (State.variables[$args[0]] != "Gender Radicalist")>>

    [[Gender Radicalist redecoration|Future Society][State.variables[$args[0]] = "Gender Radicalist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSGenderFundamentalist >= 20) && (State.variables[$args[0]] != "Gender Fundamentalist")>>

    [[Gender Fundamentalist redecoration|Future Society][State.variables[$args[0]] = "Gender Fundamentalist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSPaternalist >= 20) && (State.variables[$args[0]] != "Paternalist")>>

    [[Paternalist redecoration|Future Society][State.variables[$args[0]] = "Paternalist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSBodyPurist >= 20) && (State.variables[$args[0]] != "Body Purist")>>

    [[Body Purist redecoration|Future Society][State.variables[$args[0]] = "Body Purist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSTransformationFetishist >= 20) && (State.variables[$args[0]] != "Transformation Fetishist")>>

    [[Transformation Fetishist redecoration|Future Society][State.variables[$args[0]] = "Transformation Fetishist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSYouthPreferentialist >= 20) && (State.variables[$args[0]] != "Youth Preferentialist")>>

    [[Youth Preferentialist redecoration|Future Society][State.variables[$args[0]] = "Youth Preferentialist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSMaturityPreferentialist >= 20) && (State.variables[$args[0]] != "Maturity Preferentialist")>>

    [[Maturity Preferentialist redecoration|Future Society][State.variables[$args[0]] = "Maturity Preferentialist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSSlimnessEnthusiast >= 20) && (State.variables[$args[0]] != "Slimness Enthusiast")>>

    [[Slimness Enthusiast redecoration|Future Society][State.variables[$args[0]] = "Slimness Enthusiast", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSAssetExpansionist >= 20) && (State.variables[$args[0]] != "Asset Expansionist")>>

    [[Asset Expansionist redecoration|Future Society][State.variables[$args[0]] = "Asset Expansionist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSPastoralist >= 20) && (State.variables[$args[0]] != "Pastoralist")>>

    [[Pastoralist redecoration|Future Society][State.variables[$args[0]] = "Pastoralist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSPhysicalIdealist >= 20) && (State.variables[$args[0]] != "Physical Idealist")>>

    [[Physical Idealist redecoration|Future Society][State.variables[$args[0]] = "Physical Idealist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSHedonisticDecadence >= 20) && (State.variables[$args[0]] != "Hedonistic")>>

    [[Hedonistic redecoration|Future Society][State.variables[$args[0]] = "Hedonistic", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSChattelReligionist >= 20) && (State.variables[$args[0]] != "Chattel Religionist")>>

    [[Chattel Religionist redecoration|Future Society][State.variables[$args[0]] = "Chattel Religionist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSDegradationist >= 20) && (State.variables[$args[0]] != "Degradationist")>>

    [[Degradationist redecoration|Future Society][State.variables[$args[0]] = "Degradationist", $cash -= 5000]]
<</if>>
<<if ($arcologies[0].FSRomanRevivalist >= 20) && (State.variables[$args[0]] != "Roman Revivalist")>>

    [[Roman Revivalist redecoration|Future Society][State.variables[$args[0]] = "Roman Revivalist", $cash -= 5000]]
<<elseif ($arcologies[0].FSAztecRevivalist >= 20) && (State.variables[$args[0]] != "Aztec Revivalist")>>

    [[Aztec Revivalist redecoration|Future Society][State.variables[$args[0]] = "Aztec Revivalist", $cash -= 5000]]
<<elseif ($arcologies[0].FSEgyptianRevivalist >= 20) && (State.variables[$args[0]] != "Egyptian Revivalist")>>

    [[Egyptian Revivalist redecoration|Future Society][State.variables[$args[0]] = "Egyptian Revivalist", $cash -= 5000]]
<<elseif ($arcologies[0].FSEdoRevivalist >= 20) && (State.variables[$args[0]] != "Edo Revivalist")>>

    [[Edo Revivalist redecoration|Future Society][State.variables[$args[0]] = "Edo Revivalist", $cash -= 5000]]
<<elseif ($arcologies[0].FSArabianRevivalist >= 20) && (State.variables[$args[0]] != "Arabian Revivalist")>>

    [[Arabian Revivalist redecoration|Future Society][State.variables[$args[0]] = "Arabian Revivalist", $cash -= 5000]]
<<elseif ($arcologies[0].FSChineseRevivalist >= 20) && (State.variables[$args[0]] != "Chinese Revivalist")>>

    [[Chinese Revivalist redecoration|Future Society][State.variables[$args[0]] = "Chinese Revivalist", $cash -= 5000]]
<</if>>
<</widget>>

/%
 Call as <<SlaveInteractFucktoy>>
%/
<<widget "SlaveInteractFucktoy">>

<<replace #fucktoypref>>
	<<if ($activeSlave.assignment == "please you") || ($activeSlave.assignment == "serve in the master suite") || ($activeSlave.assignment == "be your Concubine")>>
		__Fucktoy use preference__: $activeSlave.toyHole.
		  <<link "Mouth">><<set $activeSlave.toyHole = "mouth">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>
		| <<link "Tits">><<set $activeSlave.toyHole = "boobs">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>
		<<if ($activeSlave.vagina > 0) && canDoVaginal($activeSlave)>>
		| <<link "Pussy">><<set $activeSlave.toyHole = "pussy">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>
		<<elseif ($activeSlave.vagina == 0)>>
		| //Take her virginity before giving her pussy special attention//
		<</if>>
		<<if ($activeSlave.anus > 0) && canDoAnal($activeSlave)>>
		| <<link "Ass">><<set $activeSlave.toyHole = "ass">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>
		<<else>>
		| //Take her anal virginity before giving her ass special attention//
		<</if>>
		/*check*/
		<<if ($activeSlave.dick > 0) && canPenetrate($activeSlave)>>
		| <<link "Dick">><<set $activeSlave.toyHole = "dick">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>
		<</if>>
		| <<link "No Preference">><<set $activeSlave.toyHole = "all her holes">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>

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

<</widget>>

/*
 OBSOLETE: Use setPregType()instead!
 Call as <<SetPregType>>
 $args[0]: Slave.
*/
<<widget "SetPregType">> /* IMHO rework is posssible. Can be more interesting to play, if this code will take in account more body conditions - age, fat, food, hormone levels, etc. */
	<<if $args[0].broodmother < 1>> /* Broodmothers should be not processed here. Necessary now.*/
		<<if (def $args[0].readyOva) && $args[0].readyOva > 0 >>
			<<set $args[0].pregType = $args[0].readyOva, $args[0].readyOva = 0>> /* just single override; for delayed impregnation cases */
		<</if>>
		<<if $args[0].ID == -1>>
			<<if $PC.birthMaster > 0>> /* Predisposed to twins */
				<<if $PC.fertDrugs == 1>>
					<<set $args[0].pregType = either(2, 2, 3, 3, 3, 3, 4, 4)>>
				<<else>>
					<<set $args[0].pregType = either(1, 1, 1, 2, 2, 2, 2, 2, 2, 3)>>
				<</if>>
				<<if $PC.forcedFertDrugs > 0>>
					<<set $args[0].pregType += either(1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4)>>
				<</if>>
			<<else>>
				<<if $PC.fertDrugs == 1>>
					<<set $args[0].pregType = either(1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4)>>
				<<else>>
					<<set $args[0].pregType = either(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2)>>
				<</if>>
				<<if $PC.forcedFertDrugs > 0>>
					<<set $args[0].pregType += either(0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4)>>
				<</if>>
			<</if>>
		<<else>>
			<<if $args[0].pregType == 0>>
				<<if ($args[0].drugs == "super fertility drugs")>>
<<if (($masterSuitePregnancyFertilitySupplements == 1) && (($args[0].assignment == "serve in the master suite") || ($args[0].assignment == "be your Concubine")))>>
						<<if ($args[0].hormones == 2)>>
							<<set $args[0].pregType = random(20,29)>>
						<<else>>
							<<set $args[0].pregType = random(10,29)>>
						<</if>>
					<<else>>
						<<if ($args[0].hormones == 2)>>
							<<set $args[0].pregType = random(10,29)>>
						<<else>>
							<<set $args[0].pregType = either(3, 4, 4, 4, 5, 5, 6, 10, 11, 20)>>
						<</if>>
					<</if>>
				<<elseif ($args[0].drugs == "fertility drugs")>>
					<<if (($masterSuitePregnancyFertilitySupplements == 1) && (($args[0].assignment == "serve in the master suite") || ($args[0].assignment == "be your Concubine")))>>
						<<if ($args[0].hormones == 2)>>
							<<set $args[0].pregType = random(4,5)>>
						<<else>>
							<<set $args[0].pregType = either(2, 2, 3, 3, 3, 3, 4, 4, 5, 5)>>
						<</if>>
					<<else>>
						<<if ($args[0].hormones == 2)>>
							<<set $args[0].pregType = random(2,5)>>
						<<else>>
							<<set $args[0].pregType = either(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)>>
						<</if>>
					<</if>>
				<<else>>
					<<set $args[0].pregType = either(1, 1, 1, 1, 1, 1, 1, 1, 1, 2)>>
				<</if>>
			<</if>>
		<</if>>
	<</if>>
<</widget>>

/* see how they are on a single line? This permits "."s and other things to be appended directly onto the widget result */
<<widget "PlayerName">><<if $surnameOrder != 1>><<switch $PC.nationality>><<case "Cambodian" "Chinese" "Hungarian" "Japanese" "Korean" "Mongolian" "Taiwanese" "Vietnamese">><<if $PC.surname>>$PC.surname <</if>>$PC.name<<default>>$PC.name<<if $PC.surname>> $PC.surname<</if>><</switch>><<else>>$PC.name<<if $PC.surname>> $PC.surname<</if>><</if>><</widget>>

<<widget "SlaveFullName">><<if $surnameOrder != 1>><<switch $args[0].nationality>><<case "Cambodian" "Chinese" "Hungarian" "Japanese" "Korean" "Mongolian" "Taiwanese" "Vietnamese">><<if $args[0].slaveSurname>>$args[0].slaveSurname <</if>>$args[0].slaveName<<default>>$args[0].slaveName<<if $args[0].slaveSurname>> $args[0].slaveSurname<</if>><</switch>><<else>>$args[0].slaveName<<if $args[0].slaveSurname>> $args[0].slaveSurname<</if>><</if>><</widget>>

<<widget "PoliteRudeTitle">><<switch $args[0].nationality>><<case "Japanese">><<if $args[0].trust > 0>>$PC.name<<if $PC.title > 0>>kun<<else>>chan<</if>><<else>><<if $PC.surname>><<print $PC.surname>><<else>><<print $PC.name>><<s>>an<</if>><</if>><<default>><<if $args[0].intelligence < -2>><<Master>><<elseif $args[0].intelligence > 1>><<if $PC.title > 0>>Ma<<s>>ther<<else>>Mi<<s>>tre<<ss>><</if>><<elseif $args[0].trust > 0>>$PC.name<<else>><<if $PC.surname>>$PC.surname<<else>>$PC.name<</if>><</if>><</switch>><</widget>>

/*
 Call as <<EventNameLink>>
 $args[0]: Slave.
*/
<<widget "EventNameLink">><<if $surnameOrder != 1>><<switch $args[0].nationality>><<case "Cambodian" "Chinese" "Hungarian" "Japanese" "Korean" "Mongolian" "Taiwanese" "Vietnamese">><<if $args[0].slaveSurname>><<set _name = $args[0].slaveSurname>><<set _name += " " + $args[0].slaveName>><<else>><<set _name = $args[0].slaveName>><</if>><<default>><<set _name = $args[0].slaveName>><<if $args[0].slaveSurname>><<set _name += " " + $args[0].slaveSurname>><</if>><</switch>><<else>><<set _name = $args[0].slaveName>><<if $args[0].slaveSurname>><<set _name += " " + $args[0].slaveSurname>><</if>><</if>><<print "[[_name|Long Slave Description][$nextLink = passage(), $eventDescription = 1]]">><</widget>>

/*
 Call as <<EventNameDelink>>
 $args[0]: Slave.
*/
<<widget "EventNameDelink">><<replace "#name">><<SlaveFullName $args[0]>><</replace>><</widget>>

/*
 Call as <<DegradingName $slave>> where $slave is any slave object
  $args[0]: Slave
 */
<<widget "DegradingName">>
<<if $args[0].fuckdoll > 0>>
	<<set $args[0].slaveName = "Fuckdoll No. " + random(1000,9999), $args[0].slaveSurname = 0>>
<<elseif ($args[0].assignment == "work in the dairy") && ($dairyRestraintsSetting >= 2)>>
	<<set $args[0].slaveName = "Bioreactor No. " + random(1000,9999), $args[0].slaveSurname = 0>>
<<else>>

<<set _names = []>>

<<if ($seeRace == 1)>>
<<switch $args[0].race>>
<<case "white">>
	<<set _names.push("Pale", "White")>>
<<case "asian">>
	<<set _names.push("Asian", "Yellow")>>
<<case "latina">>
	<<set _names.push("Brown", "Latina")>>
<<case "black">>
	<<set _names.push("Black", "Dark")>>
<<case "pacific islander">>
	<<set _names.push("Islander", "Sea")>>
<<case "malay">>
	<<set _names.push("Cinnamon", "Pinoy", "Spice")>>
<<case "southern european">>
	<<set _names.push("Mediterranean", "Olive")>>
<<case "amerindian">>
	<<set _names.push("Indian", "Reservation")>>
<<case "semitic">>
	<<set _names.push("Semitic")>>
<<case "middle eastern">>
	<<set _names.push("Arab", "Sand")>>
<<case "indo-aryan">>
	<<set _names.push("Brown", "Indian")>>
<<case "mixed race">>
	<<set _names.push("Mulatto", "Mutt")>>
<</switch>>
<</if>>

<<set _names.push($args[0].hColor)>>

<<if ($args[0].eyes == -2)>>
	<<set _names.push("Blind", "Eyeless", "Sightless")>>
<</if>>

<<if ($args[0].boobs < 500) && ($args[0].butt < 3)>>
	<<set _names.push("Girly", "Slim", "Thin")>>
<</if>>
<<if ($args[0].boobs < 300)>>
	<<set _names.push("Flat")>>
<</if>>
<<if ($args[0].anus > 2) || ($args[0].vagina > 2)>>
	<<set _names.push("Gaping", "Hallway", "Slit", "Wideopen")>>
<</if>>
<<if ($args[0].weight > 160)>>
	<<set _names.push("Cow", "Fat", "Whale")>>
<<elseif ($args[0].weight > 30)>>
	<<set _names.push("Chubby", "Fat", "Whale")>>
<<elseif ($args[0].weight <= -30)>>
	<<set _names.push("Bony", "Rail", "Skinny")>>
<</if>>
<<if ($args[0].muscles > 30)>>
	<<set _names.push("Huge", "Muscles", "Ripped", "Strong")>>
<</if>>
<<if ($args[0].fetish == "buttslut") && ($args[0].fetishKnown == 1)>>
	<<set _names.push("Anal", "Sodomy")>>
<</if>>
<<if ($args[0].fetish == "cumslut") && ($args[0].fetishKnown == 1)>>
	<<set _names.push("Cum", "Dicksuck", "Sucker")>>
<</if>>
<<if ($args[0].fetish == "humiliation") && ($args[0].fetishKnown == 1)>>
	<<set _names.push("Rape")>>
<</if>>
<<if ($args[0].fetish == "masochist") && ($args[0].fetishKnown == 1)>>
	<<set _names.push("Pain", "Rape", "Struggle")>>
<</if>>
<<if ($args[0].fetish == "pregnancy") && ($args[0].fetishKnown == 1)>>
	<<set _names.push("Fertile")>>
<</if>>
<<if (($args[0].boobs*$args[0].lactation) > 1000)>>
	<<set _names.push("Creamy", "Milky")>>
<</if>>
<<if ($args[0].oralSkill <= 30) && ($args[0].analSkill <= 30)>>
	<<set _names.push("Cheap", "Fail", "Gutter")>>
<</if>>
<<if $args[0].nipples == "fuckable">>
	<<set _names.push("Nipplefuck", "Nipplecunt")>>
<<elseif ($args[0].nipples != "tiny") && ($args[0].nipples != "cute")>>
	<<set _names.push("Pointy", "Titclit")>>
<</if>>
<<if ($args[0].visualAge > 35)>>
	<<set _names.push("Mature")>>
<</if>>
<<if ($args[0].visualAge < 25)>>
	<<set _names.push("Girly", "Thin", "Young")>>
<</if>>
<<if ($args[0].amp == 1)>>
	<<set _names.push("Stumpy")>>
<</if>>
<<if ($args[0].boobsImplant > 1000) || ($args[0].buttImplant > 3)>>
	<<set _names.push("Fake", "Plastic", "Silicone")>>
<</if>>
<<if ($args[0].dick > 5) && ($args[0].balls > 5)>>
	<<set $prefixes.push("Potent")>>
<</if>>
<<if ($args[0].broodmother == 2) && ($args[0].preg > 30)>>
	<<set $prefixes.push("Bursting", "Seeded")>>
<</if>>
<<if ($args[0].broodmother == 1) && ($args[0].preg > 30)>>
	<<set $prefixes.push("Bloated", "Stuffed")>>
<</if>>
<<if $args[0].bellyPreg >= 450000>>
	<<set $prefixes.push("Bulging", "Squirming")>>
<</if>>
<<if ($args[0].bellyPreg >= 5000)>>
	<<set _names.push("Preg")>>
<</if>>
<<if ($args[0].dick > 4)>>
	<<set _names.push("Dangle", "Hung")>>
<</if>>
<<if ($args[0].dick > 0) && ($args[0].balls == 0)>>
	<<set _names.push("Cut", "Gelded", "Soft")>>
<</if>>
<<if ($args[0].dick > 0) && ($args[0].balls > 0)>>
	<<set _names.push("Erect", "Hard", "Stiff")>>
<</if>>
<<if ($args[0].dick == 1)>>
	<<set _names.push("Micro", "Tiny")>>
<</if>>
<<if ($args[0].height >= 185)>>
	<<set _names.push("Tall", "Top")>>
<</if>>
<<if ($args[0].height < 150)>>
	<<set _names.push("Stumpy", "Tiny")>>
<</if>>
<<if ($args[0].whoreSkill > 95)>>
	<<set _names.push("Money", "Street")>>
<</if>>
<<if ($args[0].entertainSkill > 95)>>
	<<set _names.push("Easy", "Club")>>
<</if>>
<<if ($args[0].oralSkill > 95)>>
	<<set _names.push("Suck")>>
<</if>>
<<if ($args[0].intelligence > 1)>>
	<<set _names.push("Bright", "Clever", "Smart")>>
	<<if ($args[0].intelligenceImplant == 1)>>
		<<set _names.push("College", "Graduate", "Nerdy")>>
	<</if>>
<<elseif ($args[0].intelligence < -1)>>
	<<set _names.push("Cretin", "Dumb", "Retarded", "Stupid")>>
<</if>>
<<if ($args[0].vagina == 1) && ($args[0].vaginalSkill <= 10)>>
	<<set _names.push("Fresh", "New", "Tight")>>
<</if>>
<<if ($args[0].devotion < -75)>>
	<<set _names.push("Angry", "Biter", "Caged")>>
<<elseif ($args[0].devotion < -50)>>
	<<set _names.push("Cell", "Cuffs")>>
<<elseif ($args[0].devotion < -20)>>
	<<set _names.push("Bag", "Box")>>
<<elseif ($args[0].devotion <= 20)>>
	<<set _names.push("Sad", "Whiner")>>
<</if>>
<<if ($args[0].trust < -50)>>
	<<set _names.push("Screaming")>>
<<elseif ($args[0].trust < -20)>>
	<<set _names.push("Crying")>>
<<elseif ($args[0].trust < 20)>>
	<<set _names.push("Begging")>>
<</if>>

<<set _suffixes = []>>

<<if $args[0].dick == 0>>
	<<if $args[0].vagina == -1>> /* NULLS */
		<<set _suffixes.push("Null")>>
	<<else>> /* FEMALES */
		<<if $args[0].visualAge < 25>>
			<<set _suffixes.push("Girl")>>
		<</if>>
	<</if>>
<<else>>
	<<if $args[0].vagina != -1>>
		<<set _suffixes.push("Futa")>>
	<<else>>
		<<if $args[0].balls > 0>>
			<<if ($args[0].boobs > 300) && ($args[0].butt > 2)>> /* SHEMALES: cock & balls, T&A above minimum */
				<<set _suffixes.push("Shemale")>>
			<<else>>
				<<if ($args[0].shoulders < 1) && ($args[0].muscles <= 30)>>
					<<if ($args[0].faceShape == "masculine") || ($args[0].faceShape == "androgynous")>> /* SISSIES: feminine shoulders or muscles, masculine faces */
						<<set _suffixes.push("Sissy")>>
					<<else>> /* TRAPS: feminine shoulders or muscles, feminine faces */
						<<set _suffixes.push("Trap")>>
					<</if>>
				<<else>> /* BITCHES: masculine shoulders or muscles */
					<<set _suffixes.push("Bitch")>>
				<</if>>
			<</if>>
		<<else>>
			<<if $args[0].visualAge > 35>>
				<<set _suffixes.push("DickMILF")>>
			<<elseif $args[0].visualAge >= 25>>
				<<set _suffixes.push("Dickslave")>>
			<<else>>
				<<set _suffixes.push("Dickgirl")>>
			<</if>>
		<</if>>
	<</if>>
<</if>>

<<if ($args[0].anus > 0)>>
	<<set _suffixes.push("Anus", "Asshole", "Backdoor", "Butt", "Butthole")>>
<</if>>
<<if ($args[0].vagina > 0)>>
	<<set _suffixes.push("Cunt", "Pussy", "Vagina")>>
<</if>>
<<if ($args[0].boobs < 500) && ($args[0].butt < 3) && ($args[0].dick > 0)>>
	<<set _suffixes.push("Bitch", "Bottom", "Sissy", "Trap")>>
<</if>>
<<if ($args[0].energy > 95)>>
	<<set _suffixes.push("Fuck", "Fuckaddict", "Nympho", "Sexaddict")>>
<</if>>
<<if ($args[0].weight > 160)>>
	<<set _names.push("Blimp", "Fatass")>>
<</if>>
<<if ($args[0].fetish == "humiliation") && ($args[0].fetishKnown == 1)>>
	<<set _suffixes.push("Rapebait", "Showgirl")>>
<</if>>
<<if ($args[0].fetish == "submissive") && ($args[0].fetishKnown == 1)>>
	<<set _suffixes.push("Bottom", "Fuckee", "Rapebait")>>
<</if>>
<<if ($args[0].fetish == "dom") && ($args[0].fetishKnown == 1)>>
	<<set _suffixes.push("Dom", "Fucker", "Top")>>
<</if>>
<<if ($args[0].fetish == "pregnancy") && ($args[0].fetishKnown == 1)>>
	<<set _suffixes.push("Breeder", "Mommy")>>
<</if>>
<<if ($args[0].fetish == "boobs") && ($args[0].fetishKnown == 1)>>
	<<set _suffixes.push("Boob", "Boobie", "Tit", "Titty")>>
<</if>>
<<if (($args[0].boobs*$args[0].lactation) > 1000)>>
	<<set _suffixes.push("Cow")>>
<</if>>
<<if $args[0].births >= 5>>
	<<set _suffixes.push("Broodmother")>>
<</if>>
<<if $args[0].births >= 2>>
	<<set _suffixes.push("Breeder")>>
<</if>>
<<if ($args[0].nipples != "tiny") && ($args[0].nipples != "cute")>>
	<<set _suffixes.push("Nipples")>>
<</if>>
<<if ($args[0].areolae > 2)>>
	<<set _suffixes.push("Areolas", "Headlights")>>
<</if>>
<<if ($args[0].lips > 40)>>
	<<set _suffixes.push("Lips", "Pillows")>>
<</if>>
<<if ($args[0].labia > 1)>>
	<<set _suffixes.push("Curtains", "Flower", "Lips")>>
<</if>>
<<if ($args[0].visualAge > 35)>>
	<<set _suffixes.push("Cougar", "MILF")>>
<</if>>
<<if ($args[0].amp == 1)>>
	<<set _suffixes.push("Stumpy")>>
<</if>>
<<if ($args[0].bellyPreg > 5000)>>
	<<set _suffixes.push("Belly", "Mommy")>>
<</if>>
<<if $args[0].belly >= 1500>>
	<<set _suffixes.push("Belly")>>
<</if>>
<<if ($args[0].dick > 5) && ($args[0].balls > 5)>>
	<<set _suffixes.push("Cannon", "Daddy")>>
<</if>>
<<if $args[0].breedingMark == 1>>
	<<set _suffixes.push("Breeder", "Oven", "Womb")>>
<</if>>
<<if ($args[0].broodmother == 2) && ($args[0].preg > 30)>>
	<<set _suffixes.push("Factory", "Nursery")>>
<</if>>
<<if ($args[0].broodmother == 1) && ($args[0].preg > 30)>>
	<<set _suffixes.push("Breeder", "Factory")>>
<</if>>
<<if $args[0].belly > 150000>>
	<<set _suffixes.push("Balloon")>>
<</if>>
<<if ($args[0].dick > 4)>>
	<<set _suffixes.push("Cock", "Dick")>>
<</if>>
<<if ($args[0].dick == 1)>>
	<<set _suffixes.push("Bitch")>>
<</if>>
<<if ($args[0].boobs >= 800)>>
	<<set _suffixes.push("Boob", "Boobs", "Titty")>>
<</if>>
<<if ($args[0].butt > 5)>>
	<<set _suffixes.push("Ass", "Bottom", "Butt")>>
<</if>>
<<if ($args[0].vagina == 0)>>
	<<set _suffixes.push("Virgin")>>
<</if>>
<<if ($args[0].height >= 185)>>
	<<set _suffixes.push("Tower")>>
<</if>>
<<if ($args[0].height < 150)>>
	<<set _suffixes.push("Shortstack", "Stumpy")>>
<</if>>
<<if ($args[0].whoreSkill > 95)>>
	<<set _suffixes.push("Whore")>>
<</if>>
<<if ($args[0].entertainSkill > 95)>>
	<<set _suffixes.push("Slut")>>
<</if>>
<<if ($args[0].oralSkill > 95)>>
	<<set _suffixes.push("Throat")>>
<</if>>
<<if ($args[0].vaginalSkill > 95)>>
	<<set _suffixes.push("Channel", "Kegel", "Pussy")>>
<</if>>
<<if ($args[0].analSkill > 95)>>
	<<set _suffixes.push("Asspussy", "Sphincter")>>
<</if>>
<<if ($args[0].anus == 1)>>
	<<set _suffixes.push("Tightass", "Tightbutt")>>
<</if>>
<<if $args[0].devotion > 50>>
	<<set _names.push("Prize")>>
	<<if ($args[0].visualAge > 35)>>
		<<set _suffixes.push("Queen")>>
	<<elseif ($args[0].visualAge < 25)>>
		<<set _names.push("Princess")>>
	<</if>>
<</if>>
<<if ($args[0].trust < -50)>>
	<<set _suffixes.push("Sobber")>>
<<elseif ($args[0].trust < -20)>>
	<<set _suffixes.push("Meat", "Tears", "Thing", "Weeper")>>
<</if>>

<<set $args[0].slaveName = _names.random()>>
<<switch $args[0].assignment>>
<<case "guard you">>
	<<set $args[0].slaveName = either("Battle", "Guard")>>
<<case "recruit girls">>
	<<set $args[0].slaveName = either("Cam", "Recruiter")>>
<<case "be the Madam">>
	<<set $args[0].slaveName = either("Madam", "Pimp")>>
<<case "be the DJ">>
	<<set $args[0].slaveName = either("Bass", "Booth")>>
<<case "be the Milkmaid">>
	<<if $cumSlaves > 3>>
		<<set $args[0].slaveName = either("Fucker", "Milker")>>
	<</if>>
<<case "be the Milkmaid">>
	<<set $args[0].slaveName = either("Dairy", "Farm")>>
<<case "be your Head Girl">>
	<<set $args[0].slaveName = either("Chief", "Head")>>
<<case "be the Schoolteacher">>
	<<set $args[0].slaveName = either("Classroom", "Teacher")>>
<<case "be the Attendant">>
	<<set $args[0].slaveName = either("Bath", "Spa")>>
<<case "be the Wardeness">>
	<<set $args[0].slaveName = either("Jail", "Prison")>>
<<case "be your concubine">>
	<<set $args[0].slaveName = either("Bed", "Master")>>
<</switch>>

<<set _surname = _suffixes.random()>>
<<if _surname == $args[0].slaveName.toLowerCase()>>
	<<DegradingName $args[0]>>
<</if>>
<<set $args[0].slaveSurname = _surname>>

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

<<widget "CreateSimpleTabs">>

<</widget>>