code:
:: extended family widgets [nobr widget]

<<widget "Family">>

/*testtest PC parent passage - determines if the current slave is your mother or father*/
<<if $activeSlave.ID == $PC.mother && $activeSlave.ID == $PC.father>>
	$He @@.lightgreen;is both your mother and father;@@ $he impregnated $himself with you.
<<elseif $activeSlave.ID == $PC.mother>>
	$He @@.lightgreen;is your mother.@@
<<elseif $activeSlave.ID == $PC.father>>
	$He @@.lightgreen;is your father.@@
<</if>>

<<if $activeSlave.father == -1 && $activeSlave.mother == -1>>
	$He's @@.lightgreen;your child;@@ you knocked yourself up and gave birth to $him.
<<elseif $activeSlave.father == $activeSlave.mother && ($activeSlave.father > 0 || ($activeSlave.father in $missingTable && $showMissingSlaves))>>
	<<if $activeSlave.father > 0>>
		<<set _pName = $slaves[$slaveIndices[$activeSlave.father]].slaveName>>
	<<else>>
		<<set _pName = "your former slave "+$missingTable[$activeSlave.father].slaveName>>
	<</if>>
	$He was @@.lightgreen;both fathered and mothered by _pName.@@
<</if>>

<<if $activeSlave.father == -1 && $activeSlave.mother != -1>>
	$He's @@.lightgreen;your child;@@ you knocked $his mother up.
<<elseif ($activeSlave.father > 0 || ($activeSlave.father in $missingTable && $showMissingSlaves)) && $activeSlave.father != $activeSlave.mother>>
	<<if $activeSlave.father > 0>>
		<<set _pName = $slaves[$slaveIndices[$activeSlave.father]].slaveName>>
	<<else>>
		<<set _pName = "your former slave "+$missingTable[$activeSlave.father].slaveName>>
	<</if>>
	$He was @@.lightgreen;fathered by _pName's@@ virile dick.
<</if>>

<<if $activeSlave.father != -1 && $activeSlave.mother == -1>>
	$He's @@.lightgreen;your child;@@ you gave birth to $him.
<<elseif ($activeSlave.mother > 0 || ($activeSlave.mother in $missingTable && $showMissingSlaves)) && $activeSlave.father != $activeSlave.mother>>
	<<if $activeSlave.mother > 0>>
		<<set _pName = $slaves[$slaveIndices[$activeSlave.mother]].slaveName>>
	<<else>>
		<<set _pName = "your former slave "+$missingTable[$activeSlave.mother].slaveName>>
	<</if>>
	$He was @@.lightgreen;born from _pName's@@ fertile womb.
<</if>>

<<set _children = $slaves.filter(function(s) { return $activeSlave.ID == s.father; })>>
<<if _children.length > 2>>
	$He @@.lightgreen;fathered
	<<for _efw = 0; _efw < _children.length; _efw++>>
		<<if _efw < _children.length-1>>
			_children[_efw].slaveName,
		<<else>>
			and _children[_efw].slaveName.@@
		<</if>>
	<</for>>
<<elseif _children.length > 1>>
	$He @@.lightgreen;fathered a pair of your slaves: _children[0].slaveName, and _children[1].slaveName.@@
<<elseif _children.length > 0>>
	$He @@.lightgreen;fathered a single slave of yours: _children[0].slaveName.@@
<</if>>

<<set _children = $slaves.filter(function(s) { return $activeSlave.ID == s.mother; })>>
<<if _children.length > 2>>
	$He @@.lightgreen;gave birth to
	<<for _efw = 0; _efw < _children.length; _efw++>>
		<<if _efw < _children.length-1>>
			_children[_efw].slaveName,
		<<else>>
			and _children[_efw].slaveName.@@
		<</if>>
	<</for>>
<<elseif _children.length > 1>>
	$He @@.lightgreen;gave birth to a pair of your slaves: _children[0].slaveName, and _children[1].slaveName.@@
<<elseif _children.length > 0>>
	$He @@.lightgreen;gave birth to a single one of your slaves: _children[0].slaveName.@@
<</if>>

<<if (def $showDistantRelatives) && $showDistantRelatives == 1>>
	/*testtest maternal grandma passage - determines if the current slave has a maternal grandmother*/
	<<set _mi = $slaveIndices[$activeSlave.mother]>>
	<<set _fi = $slaveIndices[$activeSlave.father]>>
	<<if def _mi>>
		<<set _mmi = $slaveIndices[$slaves[_mi].mother]>>
		<<set _fmi = $slaveIndices[$slaves[_mi].father]>>
	<<elseif $PC.ID == $activeSlave.mother>>
		<<set _mmi = $slaveIndices[$PC.mother]>>
		<<set _fmi = $slaveIndices[$PC.father]>>
	<</if>>
	<<if def _fi>>
		<<set _mfi = $slaveIndices[$slaves[_fi].mother]>>
		<<set _ffi = $slaveIndices[$slaves[_fi].father]>>
	<<elseif $PC.ID == $activeSlave.father>>
		<<set _mfi = $slaveIndices[$PC.mother]>>
		<<set _ffi = $slaveIndices[$PC.father]>>
	<</if>>
	<<if (def _mi || def _fi) && ndef _mmi && ndef _fmi && ndef _mfi && ndef _ffi>>
		<<if def _mi>>
			<<if (def _fi) && _mi == _fi>>
				<<if $PC.ID == $slaves[_mi].mother && $PC.ID == $slaves[_fi].father>>
					$He is @@.lightgreen;your grandchild.@@ You impregnated yourself with $his sole biological parent.
				<<elseif $PC.ID == $slaves[_mi].mother>>
					$He is @@.lightgreen;your grandchild.@@ You gave birth to $his sole biological parent.
				<<elseif $PC.ID == $slaves[_fi].father>>
					$He is @@.lightgreen;your grandchild.@@ You fathered $his sole biological parent.
				<</if>>
			<<elseif (def _fi) && $PC.ID == $slaves[_mi].mother && $PC.ID == $slaves[_fi].mother>>
				$He is @@.lightgreen;your grandchild.@@ You gave birth to both of $his parents.
			<<elseif (def _fi) && $PC.ID == $slaves[_mi].father && $PC.ID == $slaves[_fi].father>>
				$He is @@.lightgreen;your grandchild.@@ You fathered both of $his parents.
			<<elseif $PC.ID == $slaves[_mi].mother>>
				$He is @@.lightgreen;your grandchild.@@ You gave birth to $his mother.
			<<elseif $PC.ID == $slaves[_mi].father>>
				$He is @@.lightgreen;your grandchild.@@ You fathered $his mother.
			<</if>>
		<<elseif def _fi>>
			<<if $PC.ID == $slaves[_fi].mother>>
				$He is @@.lightgreen;your grandchild.@@ You gave birth to $his father.
			<<elseif $PC.ID == $slaves[_fi].father>>
				$He is @@.lightgreen;your grandchild.@@ You fathered $his father.
			<</if>>
		<</if>>
	<<else>>
		<<if (def _mmi) && (def _ffi) && _mmi == _ffi>>
			$His sole @@.lightgreen;grandparent is $slaves[_mmi].slaveName.@@
		<<else>>
			<<if (def _mmi) && (def _mfi) && _mmi == _mfi>>
				$His sole @@.lightgreen;grandmother is $slaves[_mmi].slaveName.@@
			<<else>>
				<<if def _mmi>>
					$His maternal @@.lightgreen;grandmother is $slaves[_mmi].slaveName.@@
				<</if>>
				<<if def _mfi>>
					$His paternal @@.lightgreen;grandmother is $slaves[_mfi].slaveName.@@
				<</if>>
			<</if>>
			<<if (def _fmi) && (def _ffi) && _fmi == _ffi>>
				$His sole @@.lightgreen;grandfather is $slaves[_ffi].slaveName.@@
			<<else>>
				<<if def _fmi>>
					$His maternal @@.lightgreen;grandfather is $slaves[_fmi].slaveName.@@
				<</if>>
				<<if _ffi>>
					$His paternal @@.lightgreen;grandfather is $slaves[_ffi].slaveName.@@
				<</if>>
			<</if>>
		<</if>>
	<</if>>

	/*testtest PC grandparents passage - determines if the current slave is your grandparent*/
	<<set _pcMother = $slaveIndices[$PC.mother]>>
	<<set _pcFather = $slaveIndices[$PC.father]>>
	<<if def _pcMother>>
		<<if (def _pcFather) && _pcMother == _pcFather>>
			<<if $activeSlave.ID == $slaves[_pcMother].mother && $activeSlave.ID == $slaves[_pcFather].father>>
				$He is @@.lightgreen;your sole grandparent.@@ $He impregnated $himself with your mother/father who in turn impregnated themselves with you.
			<<elseif $activeSlave.ID == $slaves[_pcMother].mother>>
				$He is @@.lightgreen;your sole grandmother.@@ $He gave birth to $slaves[_pcMother].slaveName who in turn impregnated themselves with you.
			<<elseif $activeSlave.ID == $slaves[_pcFather].father>>
				$He is @@.lightgreen;your sole grandfather.@@ $He fathered $slaves[_pcFather].slaveName who in turn impregnated themselves with you.
			<</if>>
		<<elseif (def _pcFather) && $activeSlave.ID == $slaves[_pcMother].mother && $activeSlave.ID == $slaves[_pcFather].mother>>
			$He is @@.lightgreen;your sole grandmother.@@ $He gave birth to both of your parents, $slaves[_pcMother].slaveName and $slaves[_pcFather].slaveName.
		<<elseif (def _pcFather) && $activeSlave.ID == $slaves[_pcMother].father && $activeSlave.ID == $slaves[_pcFather].father>>
			$He is @@.lightgreen;your sole grandfather.@@ $He fathered both of your parents, $slaves[_pcFather].slaveName and $slaves[_pcMother].slaveName.
		<<elseif $activeSlave.ID == $slaves[_pcMother].mother>>
			$He is @@.lightgreen;your maternal grandmother.@@
		<<elseif $activeSlave.ID == $slaves[_pcMother].father>>
			$He is @@.lightgreen;your maternal grandfather.@@
		<</if>>
	<<elseif def _pcFather>>
		<<if $activeSlave.ID == $slaves[_pcFather].mother>>
			$He is @@.lightgreen;your paternal grandmother.@@
		<<elseif $activeSlave.ID == $slaves[_pcFather].father>>
			$He is @@.lightgreen;your paternal grandfather.@@
		<</if>>
	<</if>>

	/*testtest grandchild passage - determines how many grandchildren the current slave has*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
		<<if $activeSlave.ID == $slaves[$i].mother || $activeSlave.ID == $slaves[$i].father>>
			<<for $j = 0; $j < $slaves.length; $j++>>
				<<if $slaves[$i].ID != $slaves[$j].ID>>
				<<if $slaves[$i].ID == $slaves[$j].mother || $slaves[$i].ID == $slaves[$j].father>>
					<<set $children.push($slaves[$j])>>
				<</if>>
				<</if>>
			<</for>>
		<</if>>
		<</if>>
	<</for>>
	<<if $children.length > 0>>
		$He
	<<if $children.length > 2>>
		has @@.lightgreen;many grandchildren,
		<<for $j = 0; $j < $children.length; $j++>>
			<<if $j < $children.length-1>>
				$children[$j].slaveName,
			<<else>>
				and $children[$j].slaveName amongst your slaves.@@
			<</if>>
		<</for>>
	<<elseif $children.length > 1>>
		has @@.lightgreen;two grandchildren, $children[0].slaveName, and $children[1].slaveName as your slaves.@@
	<<elseif $children.length > 0>>
		has a @@.lightgreen;grandchild, $children[0].slaveName as your slave.@@
	<</if>>
	<</if>>
	<<set $children = []>>

	/*testtest PC aunt passage - determines how many aunts you have*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
		<<if areSisters($slaves[$i], $activeSlave) == 1 || areSisters($slaves[$i], $activeSlave) == 2>>
		<<if $slaves[$i].ID == $PC.mother || $slaves[$i].ID == $PC.father>>
			<<for $j = 0; $j < $slaves.length; $j++>>
				<<if $slaves[$i].ID != $slaves[$j].ID>>
				<<if $slaves[$j].genes == "XX">>
				<<if areSisters($slaves[$j], $activeSlave) == 1 || areSisters($slaves[$j], $activeSlave) == 2>>
					<<set $children.push($slaves[$j])>>
				<</if>>
				<</if>>
				<</if>>
			<</for>>
		<</if>>
		<</if>>
		<</if>>
	<</for>>
	<<if $activeSlave.genes == "XX" && $children.length > 0>>
		$He
		<<if $children.length > 2>>
			is @@.lightgreen;your aunt along with
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			is @@.lightgreen;your aunt along with $children[0].slaveName.@@
		<<elseif $children.length > 0>>
			<<for $i = 0; $i < $slaves.length; $i++>>
				<<if $slaves[$i].ID != $activeSlave.ID && $activeSlave.genes == "XX">>
				<<if areSisters($slaves[$i], $activeSlave) == 1 || areSisters($slaves[$i], $activeSlave) == 2>>
				<<if $slaves[$i].ID == $PC.mother || $slaves[$i].ID == $PC.father>>
					$He is @@.lightgreen;your aunt.@@
				<</if>>
				<</if>>
				<</if>>
			<</for>>
		<</if>>
	<</if>>
	<<set $children = []>>

	/*testtest PC uncle passage - determines how many uncles you have*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if areSisters($slaves[$i], $activeSlave) == 1 || areSisters($slaves[$i], $activeSlave) == 2>>
				<<if $slaves[$i].ID == $PC.mother || $slaves[$i].ID == $PC.father>>
					<<for $j = 0; $j < $slaves.length; $j++>>
						<<if $slaves[$i].ID != $slaves[$j].ID && $slaves[$j].dick > 0 && $slaves[$j].genes == "XY">>
							<<if areSisters($slaves[$j], $activeSlave) == 1 || areSisters($slaves[$j], $activeSlave) == 2>>
								<<set $children.push($slaves[$j])>>
							<</if>>
						<</if>>
					<</for>>
				<</if>>
			<</if>>
		<</if>>
	<</for>>
	<<if $activeSlave.genes == "XY" && $children.length > 0>>
		$He
		<<if $children.length > 2>>
			is @@.lightgreen;your uncle along with
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			is @@.lightgreen;your uncle along with $children[0].slaveName.@@
		<<elseif $children.length > 0>>
			<<for $i = 0; $i < $slaves.length; $i++>>
				<<if $slaves[$i].ID != $activeSlave.ID && $activeSlave.genes == "XY">>
					<<if areSisters($slaves[$i], $activeSlave) == 1 || areSisters($slaves[$i], $activeSlave) == 2>>
						<<if $slaves[$i].ID == $PC.mother || $slaves[$i].ID == $PC.father>>
							$He is @@.lightgreen;your uncle.@@
						<</if>>
					<</if>>
				<</if>>
			<</for>>
		<</if>>
	<</if>>
	<<set $children = []>>

	/*testtest aunt passage - determines how many aunts a slave has*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if $slaves[$i].ID == $activeSlave.mother || $slaves[$i].ID == $activeSlave.father>>
				<<for $j = 0; $j < $slaves.length; $j++>>
					<<if $slaves[$j].genes == "XX">>
						<<if areSisters($slaves[$j], $slaves[$i]) == 1 || areSisters($slaves[$j], $slaves[$i]) == 2>>
							<<set $children.push($slaves[$j])>>
						<</if>>
					<</if>>
				<</for>>
			<</if>>
		<</if>>
	<</for>>
	<<if $children.length > 0>>
		$He
		<<if $children.length > 2>>
			has @@.lightgreen;many aunts,
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			has @@.lightgreen;two aunts, $children[0].slaveName, and $children[1].slaveName.@@
		<<elseif $children.length > 0>>
			has @@.lightgreen;an aunt, $children[0].slaveName.@@
		<</if>>
	<</if>>
	<<set $children = []>>

	/*testtest uncle passage - determines how many uncles a slave has*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if $slaves[$i].ID == $activeSlave.mother || $slaves[$i].ID == $activeSlave.father>>
				<<for $j = 0; $j < $slaves.length; $j++>>
					<<if $slaves[$j].genes == "XY">>
						<<if areSisters($slaves[$j], $slaves[$i]) == 1 || areSisters($slaves[$j], $slaves[$i]) == 2>>
							<<set $children.push($slaves[$j])>>
						<</if>>
					<</if>>
				<</for>>
			<</if>>
		<</if>>
	<</for>>
	<<if $children.length > 0>>
		$He
		<<if $children.length > 2>>
			has @@.lightgreen;many uncles,
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			has @@.lightgreen;two uncles, $children[0].slaveName, and $children[1].slaveName.@@
		<<elseif $children.length > 0>>
			has @@.lightgreen;an uncle, $children[0].slaveName.@@
		<</if>>
	<</if>>
	<<set $children = []>>

	/*testtest PC niece passage - determines how many nieces you have*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if areSisters($slaves[$i], $PC) == 1 || areSisters($slaves[$i], $PC) == 2>>
				<<if $slaves[$i].ID == $activeSlave.mother || $slaves[$i].ID == $activeSlave.father>>
					<<for $j = 0; $j < $slaves.length; $j++>>
						<<if $slaves[$i].ID != $slaves[$j].ID && $slaves[$j].ID != $activeSlave.ID && $slaves[$j].genes == "XX">>
							<<if $slaves[$i].ID == $slaves[$j].mother || $slaves[$i].ID == $slaves[$j].father>>
								<<set $children.push($slaves[$j])>>
							<</if>>
						<</if>>
					<</for>>
				<</if>>
			<</if>>
		<</if>>
	<</for>>
	<<if $activeSlave.genes == "XX" && $children.length > 0>>
		$He
		<<if $children.length > 2>>
			is @@.lightgreen;your niece along with
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			is @@.lightgreen;your niece along with $children[0].slaveName.@@
		<<elseif $children.length > 0>>
			<<for $i = 0; $i < $slaves.length; $i++>>
				<<if $slaves[$i].ID != $activeSlave.ID && $activeSlave.genes == "XX">>
					<<if areSisters($slaves[$i], $PC) == 1 || areSisters($slaves[$i], $PC) == 2>>
						<<if $slaves[$i].ID == $activeSlave.mother || $slaves[$i].ID == $activeSlave.father>>
							is @@.lightgreen;your niece.@@
						<</if>>
					<</if>>
				<</if>>
			<</for>>
		<</if>>
	<</if>>
	<<set $children = []>>

	/* testtest niece passage - determines how many nieces a slave has*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if areSisters($slaves[$i], $activeSlave) == 1 || areSisters($slaves[$i], $activeSlave) == 2>>
				<<for $j = 0; $j < $slaves.length; $j++>>
					<<if $slaves[$i].ID != $slaves[$j].ID && $slaves[$j].ID != $activeSlave.ID && $slaves[$j].genes == "XX">>
						<<if $slaves[$i].ID == $slaves[$j].mother || $slaves[$i].ID == $slaves[$j].father>>
							<<set $children.push($slaves[$j])>>
						<</if>>
					<</if>>
				<</for>>
			<</if>>
		<</if>>
	<</for>>
	<<if $children.length > 0>>
		$He
		<<if $children.length > 2>>
			has @@.lightgreen;many nieces,
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName, who are your slaves.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			has @@.lightgreen;two nieces, $children[0].slaveName, and $children[1].slaveName, who are your slaves.@@
		<<elseif $children.length > 0>>
			has @@.lightgreen;a niece, $children[0].slaveName, who is your slave.@@
		<</if>>
	<</if>>
	<<set $children = []>>

	/*testtest PC nephew passage - determines how many nephews you have*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if areSisters($slaves[$i], $PC) == 1 || areSisters($slaves[$i], $PC) == 2>>
				<<if $slaves[$i].ID == $activeSlave.mother || $slaves[$i].ID == $activeSlave.father>>
					<<for $j = 0; $j < $slaves.length; $j++>>
						<<if $slaves[$i].ID != $slaves[$j].ID && $slaves[$j].ID != $activeSlave.ID && $slaves[$i].genes == "XY">>
							<<if $slaves[$i].ID == $slaves[$j].mother || $slaves[$i].ID == $slaves[$j].father>>
								<<set $children.push($slaves[$j])>>
							<</if>>
						<</if>>
					<</for>>
				<</if>>
			<</if>>
		<</if>>
	<</for>>
	<<if $activeSlave.genes == "XY" && $children.length > 0>>
		$He
		<<if $children.length > 2>>
			is @@.lightgreen;your nephew along with
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			is @@.lightgreen;your nephew along with $children[0].slaveName.@@
		<<elseif $children.length > 0>>
			<<for $i = 0; $i < $slaves.length; $i++>>
				<<if $slaves[$i].ID != $activeSlave.ID && $activeSlave.genes == "XY">>
					<<if areSisters($slaves[$i], $PC) == 1 || areSisters($slaves[$i], $PC) == 2>>
						<<if $slaves[$i].ID == $activeSlave.mother || $slaves[$i].ID == $activeSlave.father>>
							is @@.lightgreen;your nephew.@@
						<</if>>
					<</if>>
				<</if>>
			<</for>>
		<</if>>
	<</if>>
	<<set $children = []>>

	/* testtest nephew passage - determines how many nephews a slave has*/
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if areSisters($slaves[$i], $activeSlave) == 1 || areSisters($slaves[$i], $activeSlave) == 2>>
				<<for $j = 0; $j < $slaves.length; $j++>>
					<<if $slaves[$i].ID != $slaves[$j].ID && $slaves[$j].ID != $activeSlave.ID && $slaves[$j].genes == "XY">>
						<<if $slaves[$i].ID == $slaves[$j].mother || $slaves[$i].ID == $slaves[$j].father>>
							<<set $children.push($slaves[$j])>>
						<</if>>
					<</if>>
				<</for>>
			<</if>>
		<</if>>
	<</for>>
	<<if $children.length > 0>>
		$He
		<<if $children.length > 2>>
			has @@.lightgreen;many nephews,
			<<for $j = 0; $j < $children.length; $j++>>
				<<if $j < $children.length-1>>
					$children[$j].slaveName,
				<<else>>
					and $children[$j].slaveName, who are your slaves.@@
				<</if>>
			<</for>>
		<<elseif $children.length > 1>>
			has @@.lightgreen;two nephews, $children[0].slaveName, and $children[1].slaveName, who are your slaves.@@
		<<elseif $children.length > 0>>
			has @@.lightgreen;a nephew, $children[0].slaveName, who is your slave.@@
		<</if>>
	<</if>>
	<<set $children = []>>
<</if>> /* end distant relatives toggle check */

/*testtest PC sibling passages - determines how many siblings you have
<<set $children = []>>
<<set _rel_num = areSisters($activeSlave, $PC)>>
<<if(_rel_num > 0)>>
	<<if ($activeSlave.genes == "XX")>>
		<<set _rel_type = "sister">>
	<<else>>
		<<set _rel_type = "brother">>
	<</if>>
	<<if (_rel_num == 1)>>
		<<set _rel_desc = "your twin">>
	<<elseif _rel_num == 2>>
		<<set _rel_desc = "your ">>
	<<elseif _rel_num == 3>>
		<<set _rel_desc = "your half-">>
	<</if>>
	<<for $i = 0; $i < $slaves.length; $i++>>
		<<if $slaves[$i].ID != $activeSlave.ID>>
			<<if _rel_num == areSisters($activeSlave, $slaves[$i]) && ($activeSlave.vagina > -1) == ($slaves[$i].vagina > -1)>>
				<<set console.log('sisters', $slaves[$i].birthName)>>
				<<set $children.push($slaves[$i])>>
			<</if>>
		<</if>>
	<</for>>
	$He
	<<if $children.length > 1>>
		@@.lightgreen;is _rel_desc _rel_type along with
		<<for $j = 0; $j < $children.length; $j++>>
			<<if $j < $children.length-1>>
				$children[$j].slaveName,
			<<else>>
				and $children[$j].slaveName.@@
			<</if>>
		<</for>>
	<<elseif $children.length > 0>>
		is @@.lightgreen;_rel_desc _rel_type with $children[0].slaveName.@@
	<<else>>
		is @@.lightgreen;_rel_desc _rel_type.@@
	<</if>>
<</if>>
<<set $children = []>>
*/

<<set _twins = [], _sisters = [], _brothers = [], _halfsisters = [], _halfbrothers = [], _cousins = []>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<set _sisterCheck = areSisters($slaves[_efw], $activeSlave)>>
	<<if _sisterCheck == 1>>
		<<run _twins.push($slaves[_efw])>>
	<</if>>
	<<if _sisterCheck == 2>>
		<<run ($slaves[_efw].genes == 'XX' ? _sisters : _brothers).push($slaves[_efw])>>
	<</if>>
	<<if _sisterCheck == 3>>
		<<run ($slaves[_efw].genes == 'XX' ? _halfsisters : _halfbrothers).push($slaves[_efw])>>
	<</if>>
	<<if (def $showDistantRelatives) && $showDistantRelatives == 1>>
		<<set _cousinCheck = areCousins($slaves[_efw], $activeSlave)>>
		<<if _cousinCheck == true>>
			<<run _cousins.push($slaves[_efw])>>
		<</if>>
	<</if>>
<</for>>

/*testtest PC twin passages - determines how many twins you have but not implemented yet*/
<<if areSisters($activeSlave, $PC) == 1>>
	$He
	<<if _twins.length > 1>>
		@@.lightgreen;shared a cramped womb with you, <<print _twins.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
	<<elseif _twins.length > 0>>
		is @@.lightgreen;your twin along with _twins[0].slaveName.@@
	<<else>>
		is @@.lightgreen;your twin <<if $activeSlave.genes == "XX">>sister<<else>>brother<</if>>.@@
	<</if>>
<</if>>

/*testtest PC sister passages - determines how many sisters you have*/
<<if areSisters($activeSlave, $PC) < 3 && areSisters($activeSlave, $PC) > 0 && $activeSlave.genes == "XX">>
	$He
	<<if _sisters.length > 1>>
		@@.lightgreen;is your sister along with <<print _sisters.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
	<<elseif _sisters.length > 0>>
		is @@.lightgreen;your sister along with _sisters[0].slaveName.@@
	<<else>>
		is @@.lightgreen;your sister.@@
	<</if>>
<</if>>

/*testtest PC brother passages - determines how many brothers you have*/
<<if areSisters($activeSlave, $PC) < 3 && areSisters($activeSlave, $PC) > 0 && $activeSlave.genes == "XY">>
	$He
	<<if _brothers.length > 1>>
		@@.lightgreen;is your brother along with <<print _brothers.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
	<<elseif _brothers.length > 0>>
		is @@.lightgreen;your brother along with _brothers[0].slaveName.@@
	<<else>>
		is @@.lightgreen;your brother.@@
	<</if>>
<</if>>

/*testtest PC half-sister passages - determines how many half-sisters you have*/
<<if areSisters($activeSlave, $PC) == 3 && $activeSlave.genes == "XX">>
	$He
	<<if _halfsisters.length > 1>>
		@@.lightgreen;is your half-sister along with <<print _halfsisters.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
	<<elseif _halfsisters.length > 0>>
		is @@.lightgreen;your half-sister along with _halfsisters[0].slaveName.@@
	<<else>>
		is @@.lightgreen;your half-sister.@@
	<</if>>
<</if>>

/*testtest PC half-brother passages - determines how many half-brothers you have*/
<<if areSisters($activeSlave, $PC) == 3 && $activeSlave.genes == "XY">>
	$He
	<<if _halfbrothers.length > 1>>
		@@.lightgreen;is your half-brother along with <<print _halfbrothers.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
	<<elseif _halfbrothers.length > 0>>
		is @@.lightgreen;your half-brother along with _halfbrothers[0].slaveName.@@
	<<else>>
		is @@.lightgreen;your half-brother.@@
	<</if>>
<</if>>

/*testtest twins? - determines how many twins a slave has*/
<<if _twins.length > 0>>
	$He
	<<if _twins.length > 2>>
		@@.lightgreen;shared a cramped womb with <<print _twins.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
	<<elseif _twins.length > 1>>
		is @@.lightgreen;one of a set of triplets; _twins[0].slaveName and _twins[1].slaveName@@ complete the trio.
	<<else>>
		is @@.lightgreen;twins with _twins[0].slaveName.@@
	<</if>>
<</if>>

/*testtest sister - determines how many sisters a slave has*/
<<if _sisters.length > 0>>
	<<if _sisters.length > 1>>
		@@.lightgreen;<<print _sisters.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>> are $his sisters.@@
	<<else>>
		@@.lightgreen; _sisters[0].slaveName is $his sister.@@
	<</if>>
<</if>>

/*testtest brother - determines how many brothers a slave has*/
<<if _brothers.length > 0>>
	<<if _brothers.length > 1>>
		@@.lightgreen;<<print _brothers.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>> are $his brothers.@@
	<<else>>
		@@.lightgreen;_brothers[0].slaveName is $his brother.@@
	<</if>>
<</if>>

/*testtest half-sister - determines how many half-sisters a slave has*/
<<set _children = $slaves.filter(function(s) { return s.ID != $activeSlave.ID && areSisters($activeSlave, s) == 3 && s.genes == "XX"; })>>
<<if _children.length > 2>>
	@@.lightgreen;
	<<for _efw = 0; _efw < _children.length; _efw++>>
		<<if _efw < _children.length-1>>
			_children[_efw].slaveName,
		<<else>>
			and _children[_efw].slaveName
		<</if>>
	<</for>>
	are half-sisters to $him.@@
<<elseif _children.length > 1>>
	@@.lightgreen;_children[0].slaveName and _children[1].slaveName are half-sisters to $him.@@
<<elseif _children.length > 0>>
	@@.lightgreen;_children[0].slaveName is a half-sister to $him.@@
<</if>>

/*testtest half-brother - determines how many half-brothers a slave has*/
<<set _children = $slaves.filter(function(s) { return s.ID != $activeSlave.ID && areSisters($activeSlave, s) == 3 && s.genes == "XY"; })>>
<<if _children.length > 2>>
	@@.lightgreen;
	<<for _efw = 0; _efw < _children.length; _efw++>>
		<<if _efw < _children.length-1>>
			_children[_efw].slaveName,
		<<else>>
			and _children[_efw].slaveName
		<</if>>
	<</for>>
	are half-brothers to $him.@@
<<elseif _children.length > 1>>
	@@.lightgreen;_children[0].slaveName and _children[1].slaveName are half-brothers to $him.@@
<<elseif _children.length > 0>>
	@@.lightgreen;_children[0].slaveName is a half-brother to $him.@@
<</if>>

<<if (def $showDistantRelatives) && $showDistantRelatives == 1>>
	/*testtest PC cousin passage - determines how many cousins you have*/
	<<if areCousins($activeSlave, $PC)>>
		$He
		<<if _cousins.length > 1>>
			@@.lightgreen;is your cousin along with <<print _cousins.reduce(function(res, ch, i, arr) { return (res.slaveName || res) + (i == arr.length - 1 ? ' and ' : ', ') + ch.slaveName; })>>.@@
		<<elseif _cousins.length > 0>>
			is @@.lightgreen;your cousin along with _sisters[0].slaveName.@@
		<<else>>
			is @@.lightgreen;your cousin.@@
		<</if>>
	<</if>>

	/*testtest cousin - determines how many cousins a slave has*/
	<<set _children = $slaves.filter(function(s) { return s.ID != $activeSlave.ID && areCousins($activeSlave, s)})>>
	<<if _children.length > 2>>
		@@.lightgreen;
		<<for _efw = 0; _efw < _children.length; _efw++>>
			<<if _efw < _children.length-1>>
				_children[_efw].slaveName,
			<<else>>
				and _children[_efw].slaveName
			<</if>>
		<</for>>
		are cousins to $him.@@
	<<elseif _children.length > 1>>
		@@.lightgreen;_children[0].slaveName and _children[1].slaveName are cousins to $him.@@
	<<elseif _children.length > 0>>
		@@.lightgreen;_children[0].slaveName is a cousin to $him.@@
	<</if>>
<</if>> /* end distant relatives toggle check */

<<if $activeSlave.clone != 0>>
	$He is
	<<if $activeSlave.cloneID == -1>>
		your clone.
	<<else>>
		a clone of $activeSlave.clone.
	<</if>>
<</if>>

<<if $cheatMode == 1>>
	$He has $activeSlave.sisters sisters, and $activeSlave.daughters daughters.
<</if>>

<</widget>>

<<widget PlayerFamily>>

<br><br>Your present family includes:

/*Player parents, lists both your parents, or just one.*/
<<if $showMissingSlaves>>
	<<if $PC.mother in $missingTable>>
		<<set $children.push($missingTable[$PC.mother])>>
	<</if>>
	<<if $PC.father in $missingTable && !($PC.father == $PC.mother)>>
		<<set $children.push($missingTable[$PC.father])>>
	<</if>>
<</if>>
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].ID == $PC.father || $slaves[$i].ID == $PC.mother>>
		<<set $children.push($slaves[$i])>>
	<</if>>
<</for>>
<<if $children.length > 1>>
	<br>Your parents are @@.lightgreen;<<if $children[0].ID < 0>>your former slave<<if $children[1].ID < 0>>s<</if>><</if>> $children[0].slaveName and <<if $children[1].ID < 0 && $children[0].ID > 0>>your former slave<</if>> $children[1].slaveName.@@
<<elseif $children.length > 0>>
	<<if $PC.father == $PC.mother>>
		<br>Your parent is @@.lightgreen;<<if $children[0].ID < 0>>your former slave<</if>> $children[0].slaveName,@@ who impregnated $himself with you.
	<<else>>
		<br>You know one of your parents, @@.lightgreen;<<if $children[0].ID < 0>>your former slave<</if>> $children[0].slaveName.@@
	<</if>>
<</if>>
<<set $children = []>>

/*Twins Test with aresisters*/
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].ID != $PC.ID>>
		<<if areSisters($slaves[$i], $PC) == 1 && areSisters($slaves[$i], $slaves[$i]) == 1>>
			<<set $children.push($slaves[$i])>>
		<</if>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>You are @@.lightgreen;twins with
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName.@@
		<</if>>
	<</for>>
<<elseif $children.length > 1>>
	<br>You are twins with @@.lightgreen;$children[0].slaveName and $children[1].slaveName.@@
<<elseif $children.length > 0>>
	<br>Your twin is @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

/*Sister Test with aresisters*/
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].ID != $PC.ID>>
		<<if areSisters($PC, $slaves[$i]) === 2 && areSisters($slaves[$i], $PC) === 2>>
			<<if $slaves[$i].genes == "XX">>
				<<set $children.push($slaves[$i])>>
			<</if>>
		<</if>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>@@.lightgreen;
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName
		<</if>>
	<</for>>@@
	are your sisters.
<<elseif $children.length > 1>>
	<br>@@.lightgreen;$children[0].slaveName and $children[1].slaveName@@ are your sisters.
<<elseif $children.length > 0>>
	<br>Your sister is @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

/*Brother Test with aresisters*/
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].ID != $PC.ID>>
		<<if areSisters($PC, $slaves[$i]) === 2 && areSisters($slaves[$i], $PC) === 2>>
			<<if $slaves[$i].genes == "XY">>
				<<set $children.push($slaves[$i])>>
			<</if>>
		<</if>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>@@.lightgreen;
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName
		<</if>>
	<</for>>@@
	are your brothers.
<<elseif $children.length > 1>>
	<br>@@.lightgreen;$children[0].slaveName and $children[1].slaveName@@ are your brothers.
<<elseif $children.length > 0>>
	<br>Your brother is @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

/*Half-Sister Test with aresisters */
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].ID != $PC.ID>>
		<<if areSisters($slaves[$i], $PC) == 3 && areSisters($PC, $slaves[$i]) == 3>>
			<<if $slaves[$i].genes == "XX">>
				<<set $children.push($slaves[$i])>>
			<</if>>
		<</if>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>@@.lightgreen;
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName.
		<</if>>
	<</for>>@@
	are your half-sisters.
<<elseif $children.length > 1>>
	<br>@@.lightgreen;$children[0].slaveName and $children[1].slaveName@@ are your half-sisters.
<<elseif $children.length > 0>>
	<br>You have one half-sister, @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

/*Half-Brother Test with aresisters */
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $slaves[$i].ID != $PC.ID>>
		<<if areSisters($slaves[$i], $PC) == 3 && areSisters($PC, $slaves[$i]) == 3>>
			<<if $slaves[$i].genes == "XY">>
				<<set $children.push($slaves[$i])>>
			<</if>>
		<</if>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>@@.lightgreen;
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName.
		<</if>>
	<</for>>@@
	are your half-brothers.
<<elseif $children.length > 1>>
	<br>@@.lightgreen;$children[0].slaveName and $children[1].slaveName@@ are your half-brothers.
<<elseif $children.length > 0>>
	<br>You have one half-brother, @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

/*
<<if $PC.clone != 0>>
	<br>You are a clone of
	<<if $activeSlave.cloneID == -1>>
		yourself.
	<<else>>
		$PC.clone.
	<</if>>
<</if>>
*/

/*Player is Father, lists children you fathered*/
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $PC.ID == $slaves[$i].father>>
		<<set $children.push($slaves[$i])>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>You are the father of @@.lightgreen;
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName.@@
		<</if>>
	<</for>>
<<elseif $children.length > 1>>
	<br>You are the father of two of your slaves, @@.lightgreen;$children[0].slaveName, and $children[1].slaveName.@@
<<elseif $children.length > 0>>
	<br>You are the father of one of your slaves, @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

/*Player is Mother, lists birthed children*/
<<for $i = 0; $i < $slaves.length; $i++>>
	<<if $PC.ID == $slaves[$i].mother>>
		<<set $children.push($slaves[$i])>>
	<</if>>
<</for>>
<<if $children.length > 2>>
	<br>You are the mother of@@.lightgreen;
	<<for $j = 0; $j < $children.length; $j++>>
		<<if $j < $children.length-1>>
			$children[$j].slaveName,
		<<else>>
			and $children[$j].slaveName.@@
		<</if>>
	<</for>>
<<elseif $children.length > 1>>
	<br>You are the mother of two of your slaves, @@.lightgreen;$children[0].slaveName, and $children[1].slaveName.@@
<<elseif $children.length > 0>>
	<br>You are the mother of one of your slaves, @@.lightgreen;$children[0].slaveName.@@
<</if>>
<<set $children = []>>

<<if $cheatMode == 1>>
	$PC.sisters sisters, $PC.daughters daughters.
<</if>>

<</widget>>

<<widget "parentName">>
<<if $activeSlave[$args[0]] == $PC.ID>>
	You
<<else>>
	<<set _j = $slaveIndices[$activeSlave[$args[0]]]>>
	<<if def _j>>
		<<print $slaves[_j].slaveName>>
	<<else>>
		Unknown
	<</if>>
<</if>>
<</widget>>

<<widget "listOfSlavesWithSameParent">>
<<if $activeSlave[$args[0]] != 0>>
	<<set _printSeperator = false>>
	<<if $activeSlave[$args[0]] == $PC[$args[0]]>>
		You
		<<set _printSeperator = true>>
	<</if>>
	<<for _j = 0; _j < $slaves.length; _j++>>
		<<if $slaves[_j][$args[0]] == $activeSlave[$args[0]]>>
			<<if _printSeperator>> | <</if>>
			<<set _printSeperator = true>>
			<<print $slaves[_j].slaveName>>
		<</if>>
	<</for>>
<</if>>
<</widget>>

<<widget "redisplayFamily">>
<<replace '#fatheredNames'>><<listOfSlavesWithParent "father" $activeSlave.ID>><</replace>>
<<replace '#motheredNames'>><<listOfSlavesWithParent "mother" $activeSlave.ID>><</replace>>
<<replace '#familySummary'>><<Family>><</replace>>
<<replace '#motherName'>><<parentName "mother">><</replace>>
<<replace '#fatherName'>><<parentName "father">><</replace>>
<<replace '#sameMotherNames'>><<listOfSlavesWithSameParent 'mother'>><</replace>>
<<replace '#sameFatherNames'>><<listOfSlavesWithSameParent 'father'>><</replace>>
/* <<run updateFamilyTree($activeSlave, $slaves, $PC)>> */
<<set _tSlaveList = [$activeSlave]>>
<<set _tSlaveList.push.apply(_tSlaveList, $slaves)>>
<<run renderFamilyTree(_tSlaveList, $activeSlave.ID)>>
<</widget>>

/* First parameter is e.g. "father" or "mother" and second parameter is the ID to match */
<<widget "listOfSlavesWithParent">>
<<if $args[1] != 0>>
	<<set _printSeperator = false>>
	<<if $args[1] == $PC[$args[0]]>>
		You
		<<set _printSeperator = true>>
	<</if>>
	<<for _j = 0; _j < $slaves.length; _j++>>
		<<if $slaves[_j][$args[0]] == $args[1]>>
			<<if _printSeperator>> | <</if>>
			<<set _printSeperator = true>>
			<<print $slaves[_j].slaveName>>
		<</if>>
	<</for>>
<</if>>
<</widget>>

<<widget "editFamily">>
<div id="editFamily"><div id="familyTable">

<br>''Mother:'' <span id="motherName"><<parentName "mother">></span>
<<link "Reset">>
	<<set $activeSlave.mother = 0>>
	<<redisplayFamily>>
<</link>>
<<if $PC.vagina == 1 && (($PC.actualAge - $activeSlave.actualAge) >= $fertilityAge) && (($PC.mother != $activeSlave.mother) || ($activeSlave.mother == 0)) && $saveImported == 0>>
| <<link "You">><<set $activeSlave.mother = $PC.ID>><<redisplayFamily>><</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if $slaves[_efw].vagina > 0 && (($slaves[_efw].actualAge - $activeSlave.actualAge) >= $fertilityAge) && (($slaves[_efw].mother != $activeSlave.mother) || ($activeSlave.mother == 0)) && $slaves[_efw].newGamePlus == 0>>
	|
	<<set _id = $slaves[_efw].ID>>
	<<set _slaveName = $slaves[_efw].slaveName>>
	<<print "
		<<link _slaveName>>
			<<set $activeSlave.mother = " + _id + ">>
			<<redisplayFamily>>
		<</link>>
	">>
	<</if>>
<</for>>

<br>''Father:'' <span id="fatherName"><<parentName "father">></span>
<<link "Reset">>
	<<set $activeSlave.father = 0>>
	<<redisplayFamily>>
<</link>>
<<if ($PC.dick == 1) && (($PC.actualAge - $activeSlave.actualAge) >= $potencyAge) && (($PC.father != $activeSlave.father) || ($activeSlave.father == 0)) && $saveImported == 0>>
| <<link "You">><<set $activeSlave.father = $PC.ID>><<redisplayFamily>><</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if ($slaves[_efw].dick > 0) && ((($slaves[_efw].actualAge - $activeSlave.actualAge) >= $potencyAge)) && (($slaves[_efw].father != $activeSlave.father) || ($activeSlave.father == 0)) && $slaves[_efw].newGamePlus == 0>>
		|
		<<set _id = $slaves[_efw].ID>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<print "
			<<link _slaveName>>
				<<set $activeSlave.father = " + _id + ">>
				<<redisplayFamily>>
			<</link>>
		">>
	<</if>>
<</for>>

<br>''Same mother as:'' <span id="sameMotherNames"><<listOfSlavesWithSameParent 'mother'>></span>
<<link "Reset">>
	<<set $activeSlave.mother = 0>>
	<<redisplayFamily>>
<</link>>
<<if ($activeSlave.mother != $PC.ID) && ($PC.mother != $activeSlave.ID) && ($saveImported == 0)>>
	|
	<<link "You">>
		<<if $PC.mother != 0>>
			<<set $activeSlave.mother = $PC.mother>>
		<<elseif $activeSlave.mother != 0>>
			<<set $PC.mother = $activeSlave.mother>>
		<<else>>
			<<set $activeSlave.mother = -5 - 2*$activeSlave.ID>>
			<<set $PC.mother = $activeSlave.mother>>
		<</if>>
		<<redisplayFamily>>
	<</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if $slaves[_efw].newGamePlus == 0>>
		<<if $saveImported == 1>>|<</if>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<set _slave = $slaves[_efw]>>
		<<if ($activeSlave.mother != _slave.ID) && (_slave.mother != $activeSlave.ID)>>
		|
		<<print "
			<<link _slaveName>>
				<<set _slave = $slaves[" + _efw + "]>>
				<<if _slave.mother != 0>>
					<<set $activeSlave.mother = _slave.mother>>
				<<elseif $activeSlave.mother != 0>>
					<<set _slave.mother = $activeSlave.mother>>
				<<else>>
					<<set $activeSlave.mother = -5 - 2*$activeSlave.ID>>
					<<set _slave.mother = $activeSlave.mother>>
				<</if>>
				<<redisplayFamily>>
			<</link>>
		">>
		<</if>>
	<</if>>
<</for>>

<br>''Same father as:'' <span id="sameFatherNames"><<listOfSlavesWithSameParent 'father'>></span>
<<link "Reset">>
	<<set $activeSlave.father = 0>>
	<<replace '#fatherName'>><</replace>>
	<<replace '#sameFatherNames'>><</replace>>
	<<redisplayFamily>>
<</link>>
<<if ($activeSlave.father != $PC.ID) && ($PC.father != $activeSlave.ID) && ($saveImported == 0)>>
	|
	<<link "You">>
		<<if $PC.father != 0>>
			<<set $activeSlave.father = $PC.father>>
		<<elseif $activeSlave.father != 0>>
			<<set $PC.father = $activeSlave.father>>
		<<else>>
			<<set $activeSlave.father = -5 - 2*$activeSlave.ID -1>>
			<<set $PC.father = $activeSlave.father>>
		<</if>>
		<<redisplayFamily>>
	<</link>>
<</if>>
<<for _efw = 0; _efw < $slaves.length; _efw++>>
	<<if $slaves[_efw].newGamePlus == 0>>
		<<if $saveImported == 1>>|<</if>>
		<<set _slaveName = $slaves[_efw].slaveName>>
		<<set _slave = $slaves[_efw]>>
		<<if ($activeSlave.father != _slave.ID) && (_slave.father != $activeSlave.ID)>>
		|
		<<print "
			<<link _slaveName>>
				<<set _slave = $slaves[" + _efw + "]>>
				<<if _slave.father != 0>>
					<<set $activeSlave.father = _slave.father>>
				<<elseif $activeSlave.father != 0>>
					<<set _slave.father = $activeSlave.father>>
				<<else>>
					<<set $activeSlave.father = -5 - 2*$activeSlave.ID -1>>
					<<set _slave.father = $activeSlave.father>>
				<</if>>
				<<redisplayFamily>>
			<</link>>
		">>
		<</if>>
	<</if>>
<</for>>

<br>''Mother of the children:'' <span id="motheredNames"><<listOfSlavesWithParent "mother" $activeSlave.ID>></span>
<<link "Reset">>
	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].mother == $activeSlave.ID && $slaves[_efw].newGamePlus == 0>>
			<<set $slaves[_efw].mother = 0>>
		<</if>>
	<</for>>
	<<if $PC.mother == $activeSlave.ID && $saveImported == 0>>
		<<set $PC.mother = 0>>
	<</if>>
	<<redisplayFamily>>
<</link>>
<<if $activeSlave.vagina >= 0>>
	<<if (($activeSlave.actualAge - $PC.actualAge) >= $fertilityAge) && (($PC.mother != $activeSlave.mother) || ($activeSlave.mother == 0)) && ($saveImported == 0)>>
		|
		<<link "You">>
			<<set $PC.mother = $activeSlave.ID>>
			<<if $activeSlave.vagina == 0>>
				<<set $activeSlave.vagina = 1>>
			<</if>>
			<<redisplayFamily>>
		<</link>>
	<</if>>

	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].newGamePlus == 0>>
			<<set _slaveName = $slaves[_efw].slaveName>>
			<<set _slave = $slaves[_efw]>>
			<<if (($activeSlave.actualAge - _slave.actualAge) >= $fertilityAge) && ((_slave.mother != $activeSlave.mother) || ($activeSlave.mother == 0))>>
				|
				<<print "
					<<link _slaveName>>
						<<set _slave = $slaves[" + _efw + "]>>
						<<set _slave.mother = $activeSlave.ID>>
						<<if $activeSlave.vagina == 0>>
							<<set $activeSlave.vagina = 1>>
						<</if>>
						<<redisplayFamily>>
					<</link>>
				">>
			<</if>>
		<</if>>
	<</for>>
<</if>>

<br>''Father of the children:'' <span id="fatheredNames"><<listOfSlavesWithParent "father" $activeSlave.ID>></span>
<<link "Reset">>
	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].father == $activeSlave.ID && $slaves[_efw].newGamePlus == 0>>
			<<set $slaves[_efw].father = 0>>
		<</if>>
	<</for>>
	<<if $PC.father == $activeSlave.ID && $saveImported == 0>>
		<<set $PC.father = 0>>
	<</if>>
	<<redisplayFamily>>
<</link>>
<<if $activeSlave.dick > 0>>
	<<if (($activeSlave.actualAge - $PC.actualAge) >= $potencyAge) && (($PC.father != $activeSlave.father) || ($activeSlave.father == 0)) && ($saveImported == 0)>>
		|
		<<link "You">>
			<<set $PC.father = $activeSlave.ID>>
			<<redisplayFamily>>
		<</link>>
	<</if>>

	<<for _efw = 0; _efw < $slaves.length; _efw++>>
		<<if $slaves[_efw].newGamePlus == 0>>
			<<set _slaveName = $slaves[_efw].slaveName>>
			<<set _slave = $slaves[_efw]>>
			<<if (($activeSlave.actualAge - _slave.actualAge) >= $potencyAge) && ((_slave.father != $activeSlave.father) || ($activeSlave.father == 0))>>
				|
				<<print "
					<<link _slaveName>>
						<<set _slave = $slaves[" + _efw + "]>>
						<<set _slave.father = $activeSlave.ID>>
						<<redisplayFamily>>
					<</link>>
				">>
			<</if>>
		<</if>>
	<</for>>
<</if>>

<br>
<<if $saveImported == 0>>
	<<link "Reset ALL PC Relatives">>
		<<set _sameMother = 0, _sameFather = 0>>
		<<for _efw = 0; _efw < $slaves.length; _efw++>>
			<<if $slaves[_efw].newGamePlus == 0>>
				<<if $slaves[_efw].mother == $PC.ID>>
					<<set $slaves[_efw].mother = 0>>
				<</if>>
				<<if $slaves[_efw].father == $PC.ID>>
					<<set $slaves[_efw].father = 0>>
				<</if>>
				<<if $slaves[_efw].mother == $PC.mother>>
					<<set _sameMother++>>
				<</if>>
				<<if $slaves[_efw].father == $PC.father>>
					<<set _sameFather++>>
				<</if>>
			<</if>>
		<</for>>
		<<if _sameMother == 0 && $activeSlave.mother == $PC.mother>>
			<<set $activeSlave.mother = 0>>
		<</if>>
		<<if _sameFather == 0 && $activeSlave.father == $PC.father>>
			<<set $activeSlave.father = 0>>
		<</if>>
		<<for _efw = 0; (_efw < $slaves.length && (_sameMother == 1 || _sameFather == 1)); _efw++>>
			<<if $slaves[_efw].newGamePlus == 0>>
				<<if $slaves[_efw].mother == $PC.mother && _sameMother == 1>>
					<<set $slaves[_efw].mother = 0, _sameMother = 0>>
				<</if>>
				<<if $slaves[_efw].father == $PC.father && _sameFather == 1>>
					<<set $slaves[_efw].father = 0, _sameFather = 0>>
				<</if>>
			<</if>>
		<</for>>
		<<if $activeSlave.mother == $PC.ID>>
			<<set $activeSlave.mother = 0>>
		<</if>>
		<<if $activeSlave.father == $PC.ID>>
			<<set $activeSlave.father = 0>>
		<</if>>
		<<set $PC.father = 0>>
		<<set $PC.mother = 0>>
		<<redisplayFamily>>
	<</link>>
<</if>>

<br>
    <span id="familySummary"><<Family>></span>
<br>
</div>
<div id="familyTree"></div>
<<set _tSlaveList = [$activeSlave]>>
<<set _tSlaveList.push.apply(_tSlaveList, $slaves)>>
<<run renderFamilyTree(_tSlaveList, $activeSlave.ID)>>
</div>

<</widget>>


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 <<SlaveInteractImpreg>>
%/
<<widget "SlaveInteractImpreg">>
<<replace #impreg>>
	<<if canGetPregnant($activeSlave) && ($activeSlave.geneticQuirks.superfetation != 2 || $geneticMappingUpgrade != 0) && ($activeSlave.fuckdoll == 0) && $seePreg != 0>>
		<<if canImpreg($activeSlave, $PC)>>
			| <<link "Impregnate $him yourself">><<replace "#miniscene">><<include "FPCImpreg">>
    <</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<</if>>
		<<if canImpreg($activeSlave, $activeSlave)>>
			| <<link "Use $his own seed to impregnate $him">><<replace "#miniscene">><<include "FSlaveSelfImpreg">>
    <</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<</if>>
		| [["Use another slave to impregnate " + $him|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 $his 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 $his 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 $his 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 $his 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 $his ass with milk">><<set $activeSlave.inflationType = "milk">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
						| <<link "Force-feed $him 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 $his ass with cum">><<set $activeSlave.inflationType = "cum">><<set $activeSlave.inflationMethod = 2>><<replace "#miniscene">><<include "FillUpButt">>
<</replace>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
						| <<link "Force-feed $him 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 force-feed " + $him|SlaveOnSlaveFeedingWorkAround]]
			<<if $buckets == 1>>
				| <<link "Make $him 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 $him 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 $him">><<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 "$He is required to keep 2 gallons of $activeSlave.inflationType in $him at all times">><<elseif $activeSlave.inflation == 2>><<print "$He is required to keep 4 liters of $activeSlave.inflationType in $him at all times">><<elseif $activeSlave.inflation == 1>><<print "$He is required to keep 2 liters of $activeSlave.inflationType in $him at all times">><</if>>.
		<<if $activeSlave.inflationMethod == 3>>
			<<link "Let $him 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 $him deflate">><<set $activeSlave.inflation = 0,$activeSlave.inflationType = "none",$activeSlave.inflationMethod = 0, SetBellySize($activeSlave)>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<elseif $activeSlave.inflationType == "cum">>
			<<link "Let $him deflate">><<set $activeSlave.inflation = 0,$activeSlave.inflationType = "none",$activeSlave.inflationMethod = 0, SetBellySize($activeSlave)>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<else>>
			<<link "Let $him 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+$activeSlave.intelligenceImplant > -100) && $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-$activeSlave.boobsMilk > 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 || $propOutcome == 0)>>
			| <<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 || $propOutcome == 0)>>
			<<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.ovaries == 1 || $activeSlave.mpreg == 1 || $activeSlave.preg > 0>>
	<<if ($activeSlave.preg < -1)>>
		//$He is sterile//
	<<elseif ($activeSlave.pubertyXX == 0) && $activeSlave.preg < 1>>
		//$He is not yet fertile//
	<<elseif $activeSlave.ovaryAge >= 47 && $activeSlave.preg < 1>>
		//$He is too old to become pregnant//
		<<if $activeSlave.preg == -1>>
			<<set $activeSlave.preg = 0>>
			<<run SetBellySize($activeSlave)>>
		<</if>>
	<<elseif $activeSlave.broodmotherOnHold == 1>>
	//$His pregnancy implant is turned off<<if $activeSlave.broodmotherCountDown > 0>>; $he is expected to be completely emptied of $his 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 $him get pregnant">><<set $activeSlave.preg = 0>><<SlaveInteractImpreg>><<SlaveInteractFertility>><</link>>
		<<elseif $activeSlave.induce == 1>>
			//Hormones are being slipped into $his food; $he will give birth suddenly and rapidly this week//
		<<elseif ($activeSlave.preg > $activeSlave.pregData.normalBirth-2 && $activeSlave.preg > $activeSlave.pregData.minLiveBirth) && ($activeSlave.broodmother == 0) && ($activeSlave.labor == 0)>>
			[[Induce labor|Slave Interact][$activeSlave.labor = 1,$activeSlave.induce = 1,$birthee = 1]]
			| [["Give " + $him + " 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 > $activeSlave.pregData.minLiveBirth)>>
			[["Give " + $him + " a cesarean section"|csec]]
		<<elseif ($activeSlave.preg > 0) && $activeSlave.breedingMark == 1 && $propOutcome == 1 && $activeSlave.pregSource == -1>>
			//You are forbidden from aborting an elite child//
		<<elseif ($activeSlave.preg > 0)>>
			[["Abort " + $his + " pregnancy"|Abort]]
		<</if>>
	<</if>>
<</if>>
<<if ($activeSlave.pregKnown == 1) && ($pregSpeedControl == 1) && ($activeSlave.breedingMark != 1 || $propOutcome == 0) && ($activeSlave.indentureRestrictions < 1) && ($activeSlave.broodmother == 0) && $seePreg != 0>>

	__Pregnancy control__: <<if $activeSlave.pregControl == "labor suppressors">>Labor is suppressed<<elseif $activeSlave.pregControl == "slow gestation">>Slowed gestation speed<<elseif $activeSlave.pregControl == "speed up">>Faster gestation speed, staffed clinic recommended<<else>>Normal gestation and birth<</if>>.
	<<if ($activeSlave.preg >= $activeSlave.pregData.minLiveBirth)>>

		<<if $activeSlave.pregControl == "labor suppressors">>
			<<link "Normal Birth">><<set $activeSlave.pregControl = "none">><<SlaveInteractFertility>><</link>>
		<<else>>
			<<link "Suppress Labor">><<set $activeSlave.pregControl = "labor suppressors">><<SlaveInteractFertility>><</link>>
		<</if>>
	<<elseif ($activeSlave.preg < $activeSlave.pregData.normalBirth)>>

		<<if $activeSlave.pregControl != "none">>
			<<link "Normal Gestation">><<set $activeSlave.pregControl = "none">><<SlaveInteractFertility>><</link>> |
		<</if>>
		<<if $activeSlave.pregControl != "slow Gestation">>
			<<link "Slow Gestation">><<set $activeSlave.pregControl = "slow gestation">><<SlaveInteractFertility>><</link>> |
		<</if>>
		<<if $activeSlave.pregControl != "speed up">>
			<<link "Fast Gestation">><<set $activeSlave.pregControl = "speed up">><<SlaveInteractFertility>><</link>>
		<</if>>
	<</if>>
<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractSexOption>>
%/
<<widget "SlaveInteractSexOption">>
<<replace #sexoption>>
	<<if ($activeSlave.vagina > -1)>>
		<<if canDoVaginal($activeSlave)>>
			<<link "Fuck $him">><<replace "#miniscene">><<include "FVagina">>
<</replace>><<SlaveInteractFertility>><</link>>
			<<if canDoAnal($activeSlave)>>
				| <<link "Use $his holes">><<replace "#miniscene">><<include "FButt">>
    <</replace>><<SlaveInteractFertility>><</link>>
			<</if>>
			<<if ($activeSlave.bellyPreg >= 300000)>>
				| <<link "Fuck $him on $his belly">><<replace "#miniscene">><<include "FBellyFuck">>
    <</replace>><<SlaveInteractFertility>><</link>>
			<</if>>
			<<if $activeSlave.bellyPreg >= 300000 && $pregInventions >= 1>>
				| <<link "Fuck $him in $his maternity swing">><<replace "#miniscene">><<include "FMaternitySwing">>
    <</replace>><<SlaveInteractFertility>><</link>>
			<</if>>
			<<if $activeSlave.bellyPreg >= 300000 && $pregInventions >= 1>>
				| <<link "Fuck $him with the help of $his assistants">><<replace "#miniscene">><<include "FAssistedSex">>
    <</replace>><<SlaveInteractFertility>><</link>>
			<</if>>
			<<if $activeSlave.bellyPreg >= 300000 && $pregInventions >= 1>>
				| <<link "Fuck $him in your goo pool">><<replace "#miniscene">><<include "FPoolSex">>
    <</replace>><<SlaveInteractFertility>><</link>>
			<</if>>
		<<else>>
			//Remove $his chastity belt if you wish to fuck $him//
		<</if>>
	<</if>>
	<<if $activeSlave.bellyPreg >= 300000>>
		<<if canDoVaginal($activeSlave) || canDoAnal($activeSlave)>>
			| <<link "Fuck $him on $his belly">><<replace "#miniscene">><<include "FBellyFuck">>
    <</replace>><</link>>
			<<if $pregInventions >= 1>>
				| <<link "Fuck $him in $his maternity swing">><<replace "#miniscene">><<include "FMaternitySwing">>
    <</replace>><</link>>
				| <<link "Fuck $him with the help of $his assistants">><<replace "#miniscene">><<include "FAssistedSex">>
    <</replace>><</link>>
				| <<link "Fuck $him in your goo pool">><<replace "#miniscene">><<include "FPoolSex">>
    <</replace>><</link>>
			<</if>>
		<</if>>
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractAnalSexOption>>
%/
<<widget "SlaveInteractAnalSexOption">>
<<replace #analsexoption>>
	<<if canDoAnal($activeSlave)>>
		| <<link "Fuck $his ass">><<replace "#miniscene">><<include "FAnus">>
    <</replace>><</link>>
	<<else>>
		| //Remove $his chastity belt if you wish to fuck $his ass//
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractAnalGropeOption>>
%/
<<widget "SlaveInteractAnalGropeOption">>
<<replace #analgropeoption>>
	<<if canDoAnal($activeSlave)>>
		| <<link "Grope $his 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 $his pussy">><<replace "#miniscene">><<include "FondleVagina">>
    <</replace>><</link>>
		<</if>>
	<</if>>
<</replace>>
<</widget>>
/%
 Call as <<SlaveInteractDickGropeOption>>
%/
<<widget "SlaveInteractDickGropeOption">>
<<replace #dickgropeoption>>
	<<if ($activeSlave.dick > 0)>>
		<<if !($activeSlave.chastityPenis)>>
		| <<link "Grope $his dick">><<replace "#miniscene">><<include "FondleDick">>
    <</replace>><</link>>
			<<if canPenetrate($activeSlave) && $sexualOpeness == 1>>
				| <<link "Ride $his dick">><<replace "#miniscene">><<include "FDick">>
    <</replace>><</link>>
			<</if>>
		<<else>>
			| //Remove $his dick chastity belt if you wish to play with $his 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 = Math.floor(($leaders[_j].intelligence+$leaders[_j].intelligenceImplant)/32)>>
		<<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 <<OralSkillIncrease>>
 $args[0]: Slave.
 $skillIncrease: Amount of increase.
%/
<<widget "OralSkillIncrease">>

<<= SkillIncrease.Oral($args[0], $skillIncrease)>>

<</widget>>

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

<<= SkillIncrease.Vaginal($args[0], $skillIncrease)>>

<</widget>>

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

<<= SkillIncrease.Anal($args[0], $skillIncrease)>>

<</widget>>

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

<<= SkillIncrease.Whore($args[0], $skillIncrease)>>

<</widget>>

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

<<= SkillIncrease.Entertain($args[0], $skillIncrease)>>

<</widget>>

<<widget "Master">><<if def $args[0]>><<run Enunciate($args[0])>><<elseif ndef $titleEnunciate>><<run Enunciate($activeSlave)>><</if>>$titleEnunciate<</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 "C">>$CEnunciate<</widget>>
<<widget "cc">>$ccEnunciate<</widget>>
<<widget "z">>$zEnunciate<</widget>>
<<widget "Z">>$zEnunciate<</widget>>
<<widget "ch">>$chEnunciate<</widget>>
<<widget "Ch">>$ChEnunciate<</widget>>
<<widget "ps">>$psEnunciate<</widget>>
<<widget "Ps">>$PsEnunciate<</widget>>
<<widget "sh">>$shEnunciate<</widget>>
<<widget "Sh">>$ShEnunciate<</widget>>
<<widget "sc">>$scEnunciate<</widget>>
<<widget "Sc">>$ScEnunciate<</widget>>
<<widget "sch">>$schEnunciate<</widget>>
<<widget "Sch">>$SchEnunciate<</widget>>
<<widget "x">>$xEnunciate<</widget>>
<<widget "X">>$XEnunciate<</widget>>

/*
	If $args[0] is defined, it is assumed the primary slave is speaking about secondary slave. Else, the secondary slave is speaking about primary slave.
	This means that <<he>> will print _heLisp or $he, and <<he 2>> will print _he2Lisp or _he2.
	Pronouns must be set for both slaves, and <<setSpokenLocalPronouns primarySlave secondarySlave>> must be previously called.
*/
<<widget "he">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_heLisp<<else>>$he<</if>><<else>><<if _primarySlaveLisp>>_he2Lisp<<else>>_he2<</if>><</if>><</widget>>
<<widget "his">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_hisLisp<<else>>$his<</if>><<else>><<if _primarySlaveLisp>>_his2Lisp<<else>>_his2<</if>><</if>><</widget>>
<<widget "hers">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_hersLisp<<else>>$hers<</if>><<else>><<if _primarySlaveLisp>>_hers2Lisp<<else>>_hers2<</if>><</if>><</widget>>
<<widget "himself">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_himselfLisp<<else>>$himself<</if>><<else>><<if _primarySlaveLisp>>_himself2Lisp<<else>>_himself2<</if>><</if>><</widget>>
<<widget "He">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_HeLisp<<else>>$He<</if>><<else>><<if _primarySlaveLisp>>_He2Lisp<<else>>_He2<</if>><</if>><</widget>>
<<widget "His">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_HisLisp<<else>>$His<</if>><<else>><<if _primarySlaveLisp>>_His2Lisp<<else>>_His2<</if>><</if>><</widget>>
<<widget "Hers">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_HersLisp<<else>>$Hers<</if>><<else>><<if _primarySlaveLisp>>_Hers2Lisp<<else>>_Hers2<</if>><</if>><</widget>>
<<widget "Himself">><<if ndef $args[0]>><<if _secondarySlaveLisp>>_HimselfLisp<<else>>$Himself<</if>><<else>><<if _primarySlaveLisp>>_Himself2Lisp<<else>>_Himself2<</if>><</if>><</widget>>

<<widget "heP">><<if _playerSlaveLisp>>_hePLisp<<else>>_heP<</if>><</widget>>
<<widget "hisP">><<if _playerSlaveLisp>>_hisPLisp<<else>>_hisP<</if>><</widget>>
<<widget "HeP">><<if _playerSlaveLisp>>_HePLisp<<else>>_HeP<</if>><</widget>>
<<widget "HisP">><<if _playerSlaveLisp>>_HisPLisp<<else>>_HisP<</if>><</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 $his sexual need to submit.
		<<case "cumslut">>increases $his appetite for oral sex.
		<<case "humiliation">>makes $him even more eager to be humiliated.
		<<case "buttslut">>encourages $him to focus on anal sex.
		<<case "boobs">>focuses $his sexuality on $his breasts and nipples.
		<<case "sadist">>titillates the sadistic part of $him.
		<<case "masochist">>helps conflate pain and sexual pleasure for $him.
		<<case "dom">>strengthens $his desire to top other slaves.
		<<case "pregnancy">>further confuses lust and pregnancy in $his mind.
		<<default>>ERROR: bad fetish
		<</switch>>@@
		<<set $args[0].fetishStrength += 10>>
	<<else>>
		is @@.hotpink;especially enjoyable for $him,@@ since
		<<switch $args[0].fetish>>
		<<case "submissive">>$he's an utterly submissive little slut.
		<<case "cumslut">>$his <<if $args[0].vagina > -1>>clit<<else>>frenulum<</if>> might as well be located in $his throat.
		<<case "humiliation">>$he has a hopeless need to be humiliated and degraded.
		<<case "buttslut">>$he's completely in love with having $his ass fucked.
		<<case "boobs">>$he loves breast play more than any other kind of sex.
		<<case "sadist">>nothing is as titillating to $him as another slave's pain can be.
		<<case "masochist">>$he loves pain more than $he likes pleasure.
		<<case "dom">>$he lives for the times $he's allowed to fuck someone.
		<<case "pregnancy">>all $his 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 $him, revealing that $he'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">>
		<<run SlaveSort($args[0], true)>>
	<<else>>
		<<run SlaveSort($args[0])>>
	<</if>>
<</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, cashX(-2500, "capEx")]] //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, cashX(-10000, "capEx")]] //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, cashX(-10000, "capEx")]] //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, cashX(-20000, "capEx")]] //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, cashX(-20000, "capEx")]] //Costs <<print cashFormat(20000)>>//
		<<elseif $args[0] == "FSRestart">>
			[[Customize the exterior of the arcology to support this goal and fully establish the Societal Elite|Future Society][$arcologies[0].FSRestartDecoration = 100, $upgradeMultiplierArcology = upgradeMultiplierArcology(), $upgradeMultiplierMedicine = upgradeMultiplierMedicine(), cashX(-75000, "capEx")]] //Costs <<print cashFormat(75000)>> and may dilute your control over the arcology//
		<<else>>
			[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, cashX(-20000, "capEx")]] //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>>

/* 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", cashX(-5000, "capEx")]]
<</if>>
<<if ($arcologies[0].FSSubjugationist >= 20) && (State.variables[$args[0]] != "Subjugationist")>>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/*
 OBSOLETE: Use setPregType()instead!
 Call as <<SetPregType>>
 $args[0]: Slave.
*/
<<widget "SetPregType">> /* IMHO rework is possible. 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 */

/*
 Call as <<EventNameLink>>
*/
<<widget "EventNameLink">><<print "[[SlaveFullName($activeSlave)|Long Slave Description][$nextLink = passage(), $eventDescription = 1]]">><</widget>>

-/*
- Call as <<EventNameDelink>>
-*/
-<<widget "EventNameDelink">><<replace "#name">><<= SlaveFullName($activeSlave)>><</replace>><</widget>>

repo_name: CheatDude/fc