:: Remove activeSlave

<<silently>>

<<if $activeSlave.ID == $PC.pregSource>>
	<<set $PC.pregSource to 0>>
<</if>>
<<for $x to 0; $x < $slaves.length; $x++>>
<<if $activeSlave.ID == $slaves[$x].ID>>
	<<if $activeSlave.reservedChildren > 0>>
		<<set $reservedChildren -= $activeSlave.reservedChildren>>
	<</if>>
	<<if $incubator > 0>>
		<<for $y to 0; $y < $tanks.length; $y++>>
			<<if $activeSlave.ID is $tanks[$y].mother>>
				<<set $slaves[$y].mother to $missingParentID>>
			<</if>>
			<<if $activeSlave.ID is $tanks[$y].father>>
				<<set $slaves[$y].father to $missingParentID>>
			<</if>>
		<</for>>
	<</if>>
	<<for $y to 0; $y < $slaves.length; $y++>>
		<<if $activeSlave.ID is $slaves[$y].pregSource>>
			<<set $slaves[$y].pregSource to 0>>
		<</if>>
	<</for>>
	<<if $PC.mother == $activeSlave.ID>>
		<<set $PC.mother to $missingParentID>>
		<<if $PC.father == $activeSlave.ID>>
			<<set $PC.father to $missingParentID>>
		<</if>>
		<<set $missingParentID-->>
	<</if>>
	<<if $PC.father == $activeSlave.ID>>
		<<set $PC.father to $missingParentID>>
		<<set $missingParentID-->>
	<</if>>
	<<if $PC.sisters > 0>>
		/*put sister decrement code here*/
	<</if>>
	<<if $PC.daughters > 0>>
		<<if $activeSlave.father == -1 || $activeSlave.mother == -1>>
			<<set $PC.daughters-->>
		<</if>>
	<</if>>
	<<if $activeSlave.daughters > 0>>
		<<for $y to 0; $y < $slaves.length; $y++>>
			<<if $slaves[$y].mother is $activeSlave.ID>>
				<<set $slaves[$y].mother to $missingParentID>>
			<</if>>
			<<if $slaves[$y].father is $activeSlave.ID>>
				<<set $slaves[$y].father to $missingParentID>>
			<</if>>
		<</for>>
		<<if $incubator > 0>>
			<<for $y to 0; $y < $tanks.length; $y++>>
				<<if $activeSlave.ID is $tanks[$y].mother>>
					<<set $slaves[$y].mother to $missingParentID>>
				<</if>>
				<<if $activeSlave.ID is $tanks[$y].father>>
					<<set $slaves[$y].father to $missingParentID>>
				<</if>>
			<</for>>
		<</if>>
		<<set $missingParentID-->>
	<</if>>
	<<if $activeSlave.mother > 0 || $activeSlave.father > 0>>
		<<for $y to 0; $y < $slaves.length; $y++>>
			<<if $activeSlave.mother is $slaves[$y].ID || $activeSlave.father is $slaves[$y].ID>>
				<<set $slaves[$y].daughters-->>
			<</if>>
		<</for>>
		<<set $missingParentID-->>
	<</if>>
	<<if $activeSlave.sisters > 0>>
		<<for $y to 0; $y < $slaves.length; $y++>>
			<<if sameMom($activeSlave, $slaves[$y]) || sameDad($activeSlave, $slaves[$y])>>
				<<set $activeSlave.sisters-->>
				<<set $slaves[$y].sisters-->>
			<</if>>
		<</for>>
	<</if>>
	<<if $activeSlave.relation != 0>>
		<<for $y to 0; $y < $slaves.length; $y++>>
			<<if $slaves[$y].ID is $activeSlave.relationTarget>>
				<<set $slaves[$y].relation to 0>>
				<<set $slaves[$y].relationTarget to 0>>
				<<break>>
			<</if>>
		<</for>>
	<</if>>
	<<for $y to 0; $y < $slaves.length; $y++>>
		<<if $slaves[$y].milkSource != 0>>
			<<if $slaves[$y].milkSource is $activeSlave.ID>>
				<<set $slaves[$y].milkSource to 0>>
				<<set $slaves[$y].inflation to 0>>
				<<set $slaves[$y].inflationType to "none">>
				<<set $slaves[$y].inflationMethod to 0>>
				<<break>>
			<</if>>
		<</if>>
		<<if $slaves[$y].cumSource != 0>>
			<<if $slaves[$y].cumSource is $activeSlave.ID>>
				<<set $slaves[$y].cumSource to 0>>
				<<set $slaves[$y].inflation to 0>>
				<<set $slaves[$y].inflationType to "none">>
				<<set $slaves[$y].inflationMethod to 0>>
				<<break>>
			<</if>>
		<</if>>
	<</for>>
	<<if $activeSlave.relationship > 0>>
		<<for $y to 0; $y < $slaves.length; $y++>>
			<<if $slaves[$y].ID is $activeSlave.relationshipTarget>>
				<<set $slaves[$y].relationship to 0>>
				<<set $slaves[$y].relationshipTarget to 0>>
				<<break>>
			<</if>>
		<</for>>
	<</if>>
	<<if $activeSlave.rivalry != 0>>
		<<for $y to 0; $y < $slaves.length; $y++>>
			<<if $slaves[$y].ID is $activeSlave.rivalryTarget>>
				<<set $slaves[$y].rivalry to 0>>
				<<set $slaves[$y].rivalryTarget to 0>>
				<<break>>
			<</if>>
		<</for>>
	<</if>>
	<<if $activeSlave.ID is $Recruiter.ID>>
		<<set $Recruiter to 0>>
	<</if>>
	<<if $activeSlave.ID is $HeadGirl.ID>>
		<<set $HeadGirl to 0>>
	<</if>>
	<<if $activeSlave.ID is $Bodyguard.ID>>
		<<set $Bodyguard to 0>>
	<</if>>
	<<if $activeSlave.ID is $Lurcher.ID>>
		<<set $Lurcher to 0>>
	<</if>>
	<<if $activeSlave.ID is $retiree.ID>>
		<<set $retiree to 0>>
	<</if>>
	<<if $fighterIDs.contains($activeSlave.ID)>>
	<<for $z to 0; $z < $fighterIDs.length; $z++>>
	<<if $activeSlave.ID == $fighterIDs[$z]>>
		<<set $dump to $fighterIDs.pluck([$z], [$z])>>
		<<set $z -= 1>>
	<</if>>
	<</for>>
	<</if>>
	<<if $activeSlave.ID is $fighterTwo.ID>>
		<<set $fighterTwo to 0>>
	<</if>>
	<<if $activeSlave.ID is $Madam.ID>>
		<<set $Madam to 0>>
	<</if>>
	<<if $activeSlave.ID is $DJ.ID>>
		<<set $DJ to 0>>
	<</if>>
	<<if $activeSlave.ID is $Milkmaid.ID>>
		<<set $Milkmaid to 0>>
	<</if>>
	<<if $activeSlave.ID is $Schoolteacher.ID>>
		<<set $Schoolteacher to 0>>
	<</if>>
	<<if $activeSlave.ID is $Attendant.ID>>
		<<set $Attendant to 0>>
	<</if>>
	<<if $activeSlave.ID is $Nurse.ID>>
		<<set $Nurse to 0>>
	<</if>>
	<<if $activeSlave.ID is $Collectrix.ID>>
		<<set $Collectrix to 0>>
	<</if>>
	<<if $activeSlave.ID is $Stewardess.ID>>
		<<set $Stewardess to 0>>
	<</if>>
	<<if $activeSlave.ID is $Wardeness.ID>>
		<<set $Wardeness to 0>>
	<</if>>
	<<if $activeSlave.ID is $Concubine.ID>>
		<<set $Concubine to 0>>
	<</if>>
	<<if $activeSlave.ID is $personalAttention>>
	<<if $PC.career == "escort">>
		<<set $personalAttention to "whoring">>
	<<elseif $PC.career == "servant">>
		<<set $personalAttention to "upkeep">>
	<<else>>
		<<set $personalAttention to "business">>
	<</if>>
	<</if>>
	<<for _d to 0; _d < $slavesOriginal.length; _d++>>
		<<if $slavesOriginal[_d].ID is $activeSlave.ID>>
			<<set $dump to $slavesOriginal.pluck([_d], [_d])>>
			<<break>>
		<</if>>
	<</for>>
	<<set $dump to $slaves.pluck([$x], [$x])>>
	<<break>>
<</if>>
<</for>>

<</silently>>
