From 5e1f86d716d93a7e873e1d715235d8a0b25fcff3 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Wed, 3 Mar 2021 18:23:56 -0800 Subject: [PATCH] Allow creation of any starting girls' relative from the starting girls screen, not just the last one. --- src/npc/startingGirls/startingGirlsPassage.js | 109 ++++++++++++++++-- 1 file changed, 102 insertions(+), 7 deletions(-) diff --git a/src/npc/startingGirls/startingGirlsPassage.js b/src/npc/startingGirls/startingGirlsPassage.js index fdf4148c8cf..4a28d3c0c8e 100644 --- a/src/npc/startingGirls/startingGirlsPassage.js +++ b/src/npc/startingGirls/startingGirlsPassage.js @@ -1,6 +1,6 @@ App.StartingGirls.passage = function() { if (!V.activeSlave) { - V.activeSlave = App.StartingGirls.generate(); + V.activeSlave = V.activeSlave ||App.StartingGirls.generate(); } const el = new DocumentFragment(); let r = []; @@ -21,13 +21,11 @@ App.StartingGirls.passage = function() { } r.push(`these slaves, <span class="springgreen">they cost half of what they normally would have here.</span>`); } + } else { + const pronoun = V.slaves.length > 0 ? "they" : getPronouns(V.slaves[0]).he; + r.push(`${toSentence(V.slaves.map(s => SlaveFullName(s)))}'s records have been finalized; ${pronoun} will arrive with you when you take over your new arcology.`); } - App.UI.DOM.makeElement("div", "Current cash reserves can be found on the far left sidebar."); - if (V.slaves.length === 1) { - App.UI.DOM.makeElement("div", "One slave is already committed."); - } else if (V.slaves.length > 1) { - App.UI.DOM.makeElement("div", `${V.slaves.length} slaves already committed.`); - } + r.push(App.UI.DOM.makeElement("div", "Current cash reserves can be found on the far left sidebar.")); App.Events.addNode(el, r, "p"); const headerLinks = App.UI.DOM.appendNewElement("div", el); @@ -231,6 +229,103 @@ App.StartingGirls.passage = function() { ) ); + if (V.slaves.length > 0) { + linkArray.push( + App.UI.DOM.link( + `Start over with a finalized slave's relative`, + () => { + const el = new DocumentFragment(); + const select = App.UI.DOM.appendNewElement("select", el); + for (const slave of V.slaves) { + const option = App.UI.DOM.appendNewElement("option", select, `${SlaveFullName(slave)} (${slave.genes}, ${slave.actualAge})`); + option.value = slave.ID.toString(); + } + select.selectedIndex = -1; + select.onchange = () => { + const ID = Number.parseInt(select.options[select.selectedIndex].value); + const srcSlave = getSlave(ID); + const relatives = []; + const makeSiblingLink = (sibling) => { + return App.UI.DOM.link(capFirstChar(sibling), () => { + setMissingParents(srcSlave); + V.activeSlave = generateRelatedSlave(srcSlave, sibling); + App.StartingGirls.randomizeUnknowns(V.activeSlave); + }, [], "Starting Girls"); + }; + if (srcSlave) { + relatives.push(makeSiblingLink("twin")); + if (V.seeDicks !== 100 && srcSlave.mother === 0) { + const ageRange = getParentAgeRange(srcSlave, false); + if (ageRange.min <= ageRange.max) { + relatives.push( + App.UI.DOM.link("Mother", () => { + V.activeSlave = generateRelatedSlave(srcSlave, "mother"); + App.StartingGirls.randomizeUnknowns(V.activeSlave); + srcSlave.mother = V.activeSlave.ID; + }, [], "Starting Girls") + ); + } + } + if (V.seeDicks !== 0 && srcSlave.father === 0) { + const ageRange = getParentAgeRange(srcSlave, true); + if (ageRange.min <= ageRange.max) { + relatives.push( + App.UI.DOM.link("Father", () => { + V.activeSlave = generateRelatedSlave(srcSlave, "father"); + App.StartingGirls.randomizeUnknowns(V.activeSlave); + srcSlave.father = V.activeSlave.ID; + }, [], "Starting Girls") + ); + } + } + if (srcSlave.actualAge < V.retirementAge - 2) { + if (V.seeDicks !== 100) { + relatives.push(makeSiblingLink("older sister")); + } + if (V.seeDicks !== 0) { + relatives.push(makeSiblingLink("older brother")); + } + } + if (srcSlave.actualAge > V.minimumSlaveAge + 2) { + if (V.seeDicks !== 100) { + relatives.push(makeSiblingLink("younger sister")); + } + if (V.seeDicks !== 0) { + relatives.push(makeSiblingLink("younger brother")); + } + } + if (srcSlave.actualAge > V.minimumSlaveAge + 11) { + if (V.seeDicks !== 100) { + relatives.push( + App.UI.DOM.link("Daughter", () => { + V.activeSlave = generateRelatedSlave(srcSlave, "daughter"); + App.StartingGirls.randomizeUnknowns(V.activeSlave); + }, [], "Starting Girls") + ); + } + if (V.seeDicks !== 0) { + relatives.push( + App.UI.DOM.link("Son", () => { + V.activeSlave = generateRelatedSlave(srcSlave, "son"); + App.StartingGirls.randomizeUnknowns(V.activeSlave); + }, [], "Starting Girls") + ); + } + } + } + jQuery(linkDiv).empty().append(App.UI.DOM.generateLinksStrip(relatives)); + }; + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.combineNodes(`Relative of slave: `, select)); + const linkDiv = App.UI.DOM.appendNewElement("div", el, ``); + App.UI.DOM.appendNewElement("div", el, "Note: finalized slaves have already had your career bonuses applied, and these will transfer to the generated relative; remove them if you don't want to be charged for them.", "note"); + App.UI.DOM.appendNewElement("div", el, "Warning: related slaves will influence each others' opinion of you, and may become difficult to control if not properly broken.", "note"); + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.passageLink("Back", "Starting Girls")); + jQuery(headerLinks).empty().append(el); + } + ) + ); + } + linkArray.push(App.UI.DOM.passageLink("Take control of your arcology", "Acquisition")); headerLinks.append(App.UI.DOM.generateLinksStrip(linkArray)); el.append(headerLinks); -- GitLab