diff --git a/src/facilities/incubator/incubatorInteract.js b/src/facilities/incubator/incubatorInteract.js index b7658772059f9a5ded915178bed7c65340ae2b4f..867e0fc6290aaa56c4d9ad698f85eb16481e263d 100644 --- a/src/facilities/incubator/incubatorInteract.js +++ b/src/facilities/incubator/incubatorInteract.js @@ -23,19 +23,24 @@ App.UI.incubator = function() { const tabCaptions = { mothers: 'Mothers', tanks: 'Tanks', - settings: 'Settings' + settings: 'Settings', + pc: 'You' }; el.append(intro()); const tabBar = App.UI.DOM.appendNewElement("div", el, '', "tab-bar"); + tabBar.append(App.UI.tabBar.tabButtonDOM('mothers', tabCaptions.mothers)); + if (V.PC.pregKnown === 1 && (V.arcologies[0].FSRestart === "unset" || V.eugenicsFullControl === 1 || (V.PC.pregSource !== -1 && V.PC.pregSource !== -6))) { + tabBar.append(App.UI.tabBar.tabButtonDOM('pc', tabCaptions.pc)); + } tabBar.append( - App.UI.tabBar.tabButtonDOM('mothers', tabCaptions.mothers), App.UI.tabBar.tabButtonDOM('tanks', tabCaptions.tanks), App.UI.tabBar.tabButtonDOM('settings', tabCaptions.settings), ); el.append(App.UI.tabBar.makeTabDOM('mothers', makeSpanIded("content-mothers", mothers()))); + el.append(App.UI.tabBar.makeTabDOM('pc', makeSpanIded("content-pc", PC()))); el.append(App.UI.tabBar.makeTabDOM('tanks', makeSpanIded("content-tankBabies", tankBabies()))); el.append(App.UI.tabBar.makeTabDOM('settings', makeSpanIded("content-tank-settings", tankSettings()))); @@ -448,181 +453,6 @@ App.UI.incubator = function() { if (_eligibility === 0) { App.UI.DOM.appendNewElement("div", el, `You have no pregnant slaves bearing eligible children.`, "note"); } - if (V.PC.pregKnown === 1 && (V.arcologies[0].FSRestart === "unset" || V.eugenicsFullControl === 1 || (V.PC.pregSource !== -1 && V.PC.pregSource !== -6))) { - const _WL = V.PC.womb.length; - const _reservedIncubator = WombReserveCount(V.PC, "incubator"); - const _reservedNursery = WombReserveCount(V.PC, "nursery"); - r.push(App.UI.DOM.makeElement("span", `You're ${V.PC.pregWeek} ${(V.PC.pregWeek === 1) ? `week`:`weeks`}pregnant`, ["pink", "bold"])) - if (_WL === 1) { - r.push(`a baby.`); - } else { - r.push(`${pregNumberName(_WL, 2)}.`); - } - linkArray = []; - const choices = document.createElement("div"); - choices.classList.add("choices"); - if (_reservedIncubator > 0) { - _childrenReserved = 1; - if (_WL === 1) { - r.push(`Your child will be placed in ${V.incubatorName}.`); - } else if (_reservedIncubator < _WL) { - r.push(`${_reservedIncubator} of your children will be placed in ${V.incubatorName}.`); - } else if (_WL === 2) { - r.push(`Both of your children will be placed in ${V.incubatorName}.`); - } else { - r.push(`All ${_reservedIncubator} of your children will be placed in ${V.incubatorName}.`); - } - - if ((_reservedIncubator < _WL) && (V.reservedChildren < _freeTanks) && (_reservedIncubator - _reservedNursery > 0)) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { }, - [], - `Analyze PC Pregnancy` - ) - ); - } - linkArray.push( - App.UI.DOM.link( - `Keep another child`, - () => { - WombAddToGenericReserve(V.PC, 'incubator', 1); - refresh(); - } - ) - ); - if (_reservedIncubator > 0) { - linkArray.push( - App.UI.DOM.link( - `Keep one less child`, - () => { - WombCleanGenericReserve(V.PC, 'incubator', 1); - refresh(); - } - ) - ); - } - if (_reservedIncubator > 1) { - linkArray.push( - App.UI.DOM.link( - `Keep none of your children`, - () => { - WombCleanGenericReserve(V.PC, 'incubator', 9999); - refresh(); - } - ) - ); - } - if ((V.reservedChildren + _WL - _reservedIncubator) <= _freeTanks) { - linkArray.push( - App.UI.DOM.link( - `Keep the rest of your children`, - () => { - WombAddToGenericReserve(V.PC, 'incubator', 9999); - refresh(); - } - ) - ); - } - } else if ((_reservedIncubator === _WL) || (V.reservedChildren === _freeTanks) || (_reservedIncubator - _reservedNursery >= 0)) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { }, - [], - `Analyze PC Pregnancy` - ) - ); - } - linkArray.push( - App.UI.DOM.link( - `Keep one less child`, - () => { - V.reservedChildren -= 1; - refresh(); - } - ) - ); - if (_reservedIncubator > 1) { - App.UI.DOM.link( - `Keep none of your children`, - () => { - WombCleanGenericReserve(V.PC, 'incubator', 9999); - refresh(); - } - ); - } - } - } else if (V.reservedChildren < _freeTanks) { - if (_WL - _reservedNursery === 0) { - r.push( - App.UI.DOM.makeElement( - "span", - `Your ${(_WL === 1) ? `child is` : `children are`} already reserved for ${V.nurseryName}`, - "note" - ) - ); - App.UI.DOM.link( - `Keep your ${(_WL === 1) ? `child` : `children`} here instead`, - () => { - WombChangeReserveType(V.PC, 'nursery', 'incubator'); - refresh(); - } - ); - } else { - r.push(``); - if (_freeTanks === 1) { - r.push(`You have an <span class="lime"> available aging tank.</span>`); - } else { - r.push(`You have <span class="lime"> available aging tanks.</span>`); - } - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { }, - [], - `Analyze PC Pregnancy` - ) - ); - } - App.UI.DOM.link( - `Keep ${(_WL > 1) ? `a` : `your`} child`, - () => { - WombAddToGenericReserve(V.PC, 'incubator', 1); - refresh(); - } - ); - if ((_WL > 1) && (V.reservedChildren + _WL - _reservedIncubator) <= _freeTanks) { - App.UI.DOM.link( - `Keep all of your children|Incubator`, - () => { - WombAddToGenericReserve(V.PC, 'incubator', 9999); - refresh(); - } - ); - } - } - } else if (V.reservedChildren === _freeTanks) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { }, - [], - `Analyze PC Pregnancy` - ) - ); - } - linkArray.push(App.UI.DOM.makeElement("span", `You have <span class= "red"> no room for your offspring.</span>`)); - } - App.Events.addNode(el, r, "div"); - choices.append(App.UI.DOM.generateLinksStrip(linkArray)); - el.append(choices); - } if (V.reservedChildren !== 0 || _childrenReserved === 1) { /* the oops I made it go negative somehow button */ @@ -689,6 +519,190 @@ App.UI.incubator = function() { } } + function PC() { + const el = new DocumentFragment(); + let r = []; + const _WL = V.PC.womb.length; + const _reservedIncubator = WombReserveCount(V.PC, "incubator"); + const _reservedNursery = WombReserveCount(V.PC, "nursery"); + r.push(App.UI.DOM.makeElement("span", `You're ${V.PC.pregWeek} ${(V.PC.pregWeek === 1) ? `week`:`weeks`}pregnant`, ["pink", "bold"])) + if (_WL === 1) { + r.push(`a baby.`); + } else { + r.push(`${pregNumberName(_WL, 2)}.`); + } + linkArray = []; + const choices = document.createElement("div"); + choices.classList.add("choices"); + if (_reservedIncubator > 0) { + _childrenReserved = 1; + if (_WL === 1) { + r.push(`Your child will be placed in ${V.incubatorName}.`); + } else if (_reservedIncubator < _WL) { + r.push(`${_reservedIncubator} of your children will be placed in ${V.incubatorName}.`); + } else if (_WL === 2) { + r.push(`Both of your children will be placed in ${V.incubatorName}.`); + } else { + r.push(`All ${_reservedIncubator} of your children will be placed in ${V.incubatorName}.`); + } + + if ((_reservedIncubator < _WL) && (V.reservedChildren < _freeTanks) && (_reservedIncubator - _reservedNursery > 0)) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { }, + [], + `Analyze PC Pregnancy` + ) + ); + } + linkArray.push( + App.UI.DOM.link( + `Keep another child`, + () => { + WombAddToGenericReserve(V.PC, 'incubator', 1); + refresh(); + } + ) + ); + if (_reservedIncubator > 0) { + linkArray.push( + App.UI.DOM.link( + `Keep one less child`, + () => { + WombCleanGenericReserve(V.PC, 'incubator', 1); + refresh(); + } + ) + ); + } + if (_reservedIncubator > 1) { + linkArray.push( + App.UI.DOM.link( + `Keep none of your children`, + () => { + WombCleanGenericReserve(V.PC, 'incubator', 9999); + refresh(); + } + ) + ); + } + if ((V.reservedChildren + _WL - _reservedIncubator) <= _freeTanks) { + linkArray.push( + App.UI.DOM.link( + `Keep the rest of your children`, + () => { + WombAddToGenericReserve(V.PC, 'incubator', 9999); + refresh(); + } + ) + ); + } + } else if ((_reservedIncubator === _WL) || (V.reservedChildren === _freeTanks) || (_reservedIncubator - _reservedNursery >= 0)) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { }, + [], + `Analyze PC Pregnancy` + ) + ); + } + linkArray.push( + App.UI.DOM.link( + `Keep one less child`, + () => { + V.reservedChildren -= 1; + refresh(); + } + ) + ); + if (_reservedIncubator > 1) { + App.UI.DOM.link( + `Keep none of your children`, + () => { + WombCleanGenericReserve(V.PC, 'incubator', 9999); + refresh(); + } + ); + } + } + } else if (V.reservedChildren < _freeTanks) { + if (_WL - _reservedNursery === 0) { + r.push( + App.UI.DOM.makeElement( + "span", + `Your ${(_WL === 1) ? `child is` : `children are`} already reserved for ${V.nurseryName}`, + "note" + ) + ); + App.UI.DOM.link( + `Keep your ${(_WL === 1) ? `child` : `children`} here instead`, + () => { + WombChangeReserveType(V.PC, 'nursery', 'incubator'); + refresh(); + } + ); + } else { + r.push(``); + if (_freeTanks === 1) { + r.push(`You have an <span class="lime"> available aging tank.</span>`); + } else { + r.push(`You have <span class="lime"> available aging tanks.</span>`); + } + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { }, + [], + `Analyze PC Pregnancy` + ) + ); + } + App.UI.DOM.link( + `Keep ${(_WL > 1) ? `a` : `your`} child`, + () => { + WombAddToGenericReserve(V.PC, 'incubator', 1); + refresh(); + } + ); + if ((_WL > 1) && (V.reservedChildren + _WL - _reservedIncubator) <= _freeTanks) { + App.UI.DOM.link( + `Keep all of your children|Incubator`, + () => { + WombAddToGenericReserve(V.PC, 'incubator', 9999); + refresh(); + } + ); + } + } + } else if (V.reservedChildren === _freeTanks) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { }, + [], + `Analyze PC Pregnancy` + ) + ); + } + linkArray.push(App.UI.DOM.makeElement("span", `You have <span class= "red"> no room for your offspring.</span>`)); + } + App.Events.addNode(el, r, "div"); + choices.append(App.UI.DOM.generateLinksStrip(linkArray)); + el.append(choices); + + return el; + + function refresh() { + return jQuery("#content-pc").empty().append(PC()); + } + } + function tankBabies() { const el = new DocumentFragment(); let row;