diff --git a/src/npc/startingGirls/editFamily.js b/src/npc/startingGirls/editFamily.js index ed948e91a9420aa9232cf45660f79f1d07ce061f..62fc3f44b4948e4442e8902fdbc89b9ca5d31160 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; }