From 333f597cd94bd98daa888c0b65fa66385aebd2bd Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Sun, 8 Dec 2019 23:45:55 -0800
Subject: [PATCH] Significantly reduce the processing burden of
 showDistantRelatives (and fix a few bugs along the way)

---
 src/js/extendedFamilyModeJS.js       |   2 +-
 src/utility/extendedFamilyWidgets.tw | 461 +++++++++------------------
 2 files changed, 149 insertions(+), 314 deletions(-)

diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js
index 4d47e1ffee4..44f1bb4c4c1 100644
--- a/src/js/extendedFamilyModeJS.js
+++ b/src/js/extendedFamilyModeJS.js
@@ -31,7 +31,7 @@ window.isGrandfatherP = function isGrandfatherP(granddaughter, grandfather) {
 };
 
 window.isGrandparentP = function isGrandparentP(granddaughter, grandparent) {
-	return isGrandmotherP(daughter, parent) || isGrandfatherP(daughter, parent);
+	return isGrandmotherP(granddaughter, grandparent) || isGrandfatherP(granddaughter, grandparent);
 };
 
 window.sameDad = function(slave1, slave2) {
diff --git a/src/utility/extendedFamilyWidgets.tw b/src/utility/extendedFamilyWidgets.tw
index b66d4b481b1..fd8649bb1fd 100644
--- a/src/utility/extendedFamilyWidgets.tw
+++ b/src/utility/extendedFamilyWidgets.tw
@@ -178,19 +178,7 @@
 	<</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>>
+	<<set $children = $slaves.filter((s) => { return isGrandparentP(s, $activeSlave); });>>
 	<<if $children.length > 0>>
 		$He
 		<<if $children.length > 2>>
@@ -204,362 +192,209 @@
 			<</for>>
 		<<elseif $children.length > 1>>
 			has @@.lightgreen;two grandchildren, $children[0].slaveName, and $children[1].slaveName as your slaves.@@
-		<<elseif $children.length > 0>>
+		<<else>>
 			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>>
+	/*testtest PC aunt and uncle passage - determines how many aunts and uncles you have*/
+	<<set _aunts = [], _uncles = []>>
+	<<if isAunt($PC, $activeSlave)>>
+		<<set _momsiblings = $slaves.filter((s) => { const sis = areSisters(s, $PC.mother); return sis == 1 || sis == 2; }),
+			  _dadsiblings = $slaves.filter((s) => { const sis = areSisters(s, $PC.father); return sis == 1 || sis == 2; })>>
+		<<for $i = 0; $i < _momsiblings.length; $i++>>
+			<<if _momsiblings[$i].ID != $activeSlave.ID>>
+				<<if _momsiblings[$i].genes == "XX">>
+					<<set _aunts.push(_momsiblings[$i])>>
+				<<else>>
+					<<set _uncles.push(_momsiblings[$i])>>
 				<</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,
+		<</for>>
+		<<for $i = 0; $i < _dadsiblings.length; $i++>>
+			<<if _dadsiblings[$i].ID != $activeSlave.ID>>
+				<<if _dadsiblings[$i].genes == "XX">>
+					<<set _aunts.push(_dadsiblings[$i])>>
 				<<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>>
+					<<set _uncles.push(_dadsiblings[$i])>>
 				<</if>>
-			<</for>>
-		<</if>>
-	<</if>>
-	<<set $children = []>>
+			<</if>>
+		<</for>>
 
-	/*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 $activeSlave.genes == "XX">>
+			$He
+			<<if _aunts.length > 1>>
+				is @@.lightgreen;your aunt along with
+				<<for $j = 0; $j < _aunts.length; $j++>>
+					<<if $j < _aunts.length-1>>
+						_aunts[$j].slaveName,
+					<<else>>
+						and _aunts[$j].slaveName.@@
+					<</if>>
+				<</for>>
+			<<elseif _aunts.length > 0>>
+				is @@.lightgreen;your aunt along with _aunts[0].slaveName.@@
+			<<else>>
+				is @@.lightgreen;your aunt.@@
 			<</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>>
+		<<else>>
+			$He
+			<<if _uncles.length > 1>>
+				is @@.lightgreen;your uncle along with
+				<<for $j = 0; $j < _uncles.length; $j++>>
+					<<if $j < _uncles.length-1>>
+						_uncles[$j].slaveName,
+					<<else>>
+						and _uncles[$j].slaveName.@@
 					<</if>>
-				<</if>>
-			<</for>>
+				<</for>>
+			<<elseif _uncles.length > 0>>
+				is @@.lightgreen;your uncle along with _uncles[0].slaveName.@@
+			<<else>>
+				is @@.lightgreen;your uncle.@@
+			<</if>>
 		<</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>>
+	/*testtest aunt and uncle passage - determines how many aunts and uncles a slave has*/
+	<<set _aunts = [], _uncles = []>>
+	<<set _momsiblings = $slaves.filter((s) => { const sis = areSisters(s, $activeSlave.mother); return sis == 1 || sis == 2; }),
+		  _dadsiblings = $slaves.filter((s) => { const sis = areSisters(s, $activeSlave.father); return sis == 1 || sis == 2; })>>
+	<<for $i = 0; $i < _momsiblings.length; $i++>>
+		<<if _momsiblings[$i].genes == "XX">>
+			<<set _aunts.push(_momsiblings[$i])>>
+		<<else>>
+			<<set _uncles.push(_momsiblings[$i])>>
 		<</if>>
 	<</for>>
-	<<if $children.length > 0>>
+	<<for $i = 0; $i < _dadsiblings.length; $i++>>
+		<<if _dadsiblings[$i].genes == "XX">>
+			<<set _aunts.push(_dadsiblings[$i])>>
+		<<else>>
+			<<set _uncles.push(_dadsiblings[$i])>>
+		<</if>>
+	<</for>>
+	
+	<<if _aunts.length > 0>>
 		$He
-		<<if $children.length > 2>>
+		<<if _aunts.length > 2>>
 			has @@.lightgreen;many aunts,
-			<<for $j = 0; $j < $children.length; $j++>>
-				<<if $j < $children.length-1>>
-					$children[$j].slaveName,
+			<<for $j = 0; $j < _aunts.length; $j++>>
+				<<if $j < _aunts.length-1>>
+					_aunts[$j].slaveName,
 				<<else>>
-					and $children[$j].slaveName.@@
+					and _aunts[$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.@@
+		<<elseif _aunts.length > 1>>
+			has @@.lightgreen;two aunts, _aunts[0].slaveName, and _aunts[1].slaveName.@@
+		<<else>>
+			has @@.lightgreen;an aunt, _aunts[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>>
+	<<if _uncles.length > 0>>
 		$He
-		<<if $children.length > 2>>
+		<<if _uncles.length > 2>>
 			has @@.lightgreen;many uncles,
-			<<for $j = 0; $j < $children.length; $j++>>
-				<<if $j < $children.length-1>>
-					$children[$j].slaveName,
+			<<for $j = 0; $j < _uncles.length; $j++>>
+				<<if $j < _uncles.length-1>>
+					_uncles[$j].slaveName,
 				<<else>>
-					and $children[$j].slaveName.@@
+					and _uncles[$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.@@
+		<<elseif _uncles.length > 1>>
+			has @@.lightgreen;two uncles, _uncles[0].slaveName, and _uncles[1].slaveName.@@
+		<<else>>
+			has @@.lightgreen;an uncle, _uncles[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>>
+	/*testtest PC niece and nephew passage - determines how many nieces and nephews you have*/
+	<<set _nieces = [], _nephews = []>>
+	<<if isAunt($activeSlave, $PC)>>
+		<<set _nieces = $slaves.filter((s) => { return( (s.ID != $activeSlave.ID) && (isAunt(s, $PC)) && (s.genes == "XX")); })>>
+		<<set _nephews = $slaves.filter((s) => { return( (s.ID != $activeSlave.ID) && (isAunt(s, $PC)) && (s.genes == "XY")); })>>
+
+		<<if $activeSlave.genes == "XX">>
+			$He
+			<<if _nieces.length > 1>>
+				is @@.lightgreen;your niece along with
+				<<for $j = 0; $j < _nieces.length; $j++>>
+					<<if $j < _nieces.length-1>>
+						_nieces[$j].slaveName,
+					<<else>>
+						and _nieces[$j].slaveName.@@
 					<</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>>
+				<</for>>
+			<<elseif _nieces.length > 0>>
+				is @@.lightgreen;your niece along with _nieces[0].slaveName.@@
+			<<else>>
+				is @@.lightgreen;your niece.@@
+			<</if>>
+		<<else>>
+			$He
+			<<if _nephews.length > 1>>
+				is @@.lightgreen;your nephew along with
+				<<for $j = 0; $j < _nephews.length; $j++>>
+					<<if $j < _nephews.length-1>>
+						_nephews[$j].slaveName,
+					<<else>>
+						and _nephews[$j].slaveName.@@
 					<</if>>
 				<</for>>
+			<<elseif _nephews.length > 0>>
+				is @@.lightgreen;your nephew along with _nephews[0].slaveName.@@
+			<<else>>
+				is @@.lightgreen;your nephew.@@
 			<</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>>
+	/* testtest niece and nephew passage - determines how many nieces and nephews a slave has*/
+	<<set _nieces = $slaves.filter((s) => { return( (s.ID != $activeSlave.ID) && (isAunt(s, $activeSlave)) && (s.genes == "XX")); })>>
+	<<set _nephews = $slaves.filter((s) => { return( (s.ID != $activeSlave.ID) && (isAunt(s, $activeSlave)) && (s.genes == "XY")); })>>
+
+	<<if _nieces.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,
+		<<if _nieces.length > 2>>
+			has @@.lightgreen;many nieces,
+			<<for $j = 0; $j < _nieces.length; $j++>>
+				<<if $j < _nieces.length-1>>
+					_nieces[$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>>
+					and _nieces[$j].slaveName, who are your slaves.@@
 				<</if>>
 			<</for>>
+		<<elseif _nieces.length > 1>>
+			has @@.lightgreen;two nieces, _nieces[0].slaveName, and _nieces[1].slaveName, who are your slaves.@@
+		<<else>>
+			has @@.lightgreen;a niece, _nieces[0].slaveName, who is your slave.@@
 		<</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>>
+	<<if _nephews.length > 0>>
 		$He
-		<<if $children.length > 2>>
+		<<if _nephews.length > 2>>
 			has @@.lightgreen;many nephews,
-			<<for $j = 0; $j < $children.length; $j++>>
-				<<if $j < $children.length-1>>
-					$children[$j].slaveName,
+			<<for $j = 0; $j < _nephews.length; $j++>>
+				<<if $j < _nephews.length-1>>
+					_nephews[$j].slaveName,
 				<<else>>
-					and $children[$j].slaveName, who are your slaves.@@
+					and _nephews[$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.@@
+		<<elseif _nephews.length > 1>>
+			has @@.lightgreen;two nephews, _nephews[0].slaveName, and _nephews[1].slaveName, who are your slaves.@@
+		<<else>>
+			has @@.lightgreen;a nephew, _nephews[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 = []>>
-*/
-
+/*testtest PC sibling passages - determines how many siblings you have*/
 <<set _twins = [], _sisters = [], _brothers = [], _halfsisters = [], _halfbrothers = [], _cousins = []>>
 <<for _efw = 0; _efw < $slaves.length; _efw++>>
 	<<set _sisterCheck = areSisters($slaves[_efw], $activeSlave)>>
-- 
GitLab