From 56adac367cfaa94ec3bc9919c960c2c94ed8d289 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Tue, 15 Dec 2020 09:15:32 -0500
Subject: [PATCH] finish mother

---
 src/npc/startingGirls/editFamily.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/npc/startingGirls/editFamily.js b/src/npc/startingGirls/editFamily.js
index ed948e91a94..62fc3f44b49 100644
--- a/src/npc/startingGirls/editFamily.js
+++ b/src/npc/startingGirls/editFamily.js
@@ -23,6 +23,7 @@ App.Intro.editFamily = function(slave) {
 		function mother() {
 			const div = new DocumentFragment();
 			const linkArray = [];
+			const requirements = (s) => (s.vagina > 0  && ((s.mother !== slave.mother) || (slave.mother === 0)));
 
 			const nameEl = makeElWithID("motherName")
 			nameEl.append(parentName("mother"));
@@ -40,7 +41,7 @@ App.Intro.editFamily = function(slave) {
 				)
 			)
 
-			if (V.PC.vagina > 0 && ((V.PC.actualAge - slave.actualAge) >= V.fertilityAge) && ((V.PC.mother !== slave.mother) || (slave.mother === 0)) && _allowPCFamily) {
+			if (requirements(V.PC) && ((V.PC.actualAge - slave.actualAge) >= V.fertilityAge) && _allowPCFamily) {
 				linkArray.push(
 					App.UI.DOM.link(
 						"You",
@@ -52,15 +53,13 @@ App.Intro.editFamily = function(slave) {
 				)
 			}
 
-			for (_efw = 0; _efw < V.slaves.length; _efw++) {
-				if (V.slaves[_efw].vagina > 0 && ((V.slaves[_efw].actualAge - slave.actualAge) >= V.slaves[_efw].pubertyAgeXX) && ((V.slaves[_efw].mother !== slave.mother) || (slave.mother === 0)) && V.slaves[_efw].newGamePlus === 0) {
-					_id = V.slaves[_efw].ID;
-					_slaveName = V.slaves[_efw].slaveName;
+			for (const potentialRel of V.slaves) {
+				if (requirements(potentialRel) && ((potentialRel.actualAge - slave.actualAge) >= potentialRel.pubertyAgeXX) && potentialRel.newGamePlus === 0) {
 					linkArray.push(
 						App.UI.DOM.link(
-							_slaveName,
+							potentialRel.slaveName,
 							() => {
-								slave.mother = _id
+								slave.mother = potentialRel.ID
 								refresh();
 							}
 						)
@@ -68,6 +67,8 @@ App.Intro.editFamily = function(slave) {
 				}
 			}
 
+			div.append(App.UI.DOM.generateLinksStrip(linkArray));
+
 			return div;
 		}
 	
-- 
GitLab