diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index cf60c7d28f630ea29d37399da36c612e4f45461b..229b88a72fcce5f367c2b2376240ba29474deb9b 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -671,10 +671,12 @@ App.Data.resetOnNGPlus = { masterSuiteName: "the Master Suite", // Nursery - /** Counts the number of children the nursery can support */ - nursery: 0, /** Counts the number of nannies the nursery can support */ + nursery: 0, + /** No longer used */ nurseryNannies: 0, + /** Counts the number of children the nursery can support */ + nurseryCribs: 0, /** Counts the number of children currently in the nursery */ nurseryChildren: 0, /** Check for whether the children are influenced by the nannies */ diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 0dccde0280cfdd2c7c6f024b4802a956e3d7bb1c..26cddca9d78927bcce9a311f400a9c5d7ad8084a 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -2446,6 +2446,14 @@ App.Update.oldVersions = function(node) { } } + if (V.releaseID < 1184) { + if (V.nurseryNannies > 0) { + V.nurseryCribs = V.nursery; + V.nursery = V.nurseryNannies; + V.nurseryNannies = 0; + } + } + if ((typeof V.familyTesting === "undefined") && V.releaseID < 1065) { // possibly vanilla FC; compel V.familyTesting to 0 so that the family upgrade will run on slaves V.familyTesting = 0; diff --git a/src/endWeek/reports/nurseryReport.js b/src/endWeek/reports/nurseryReport.js index b448ccfe3a4d284c82d15cb7887518f79c7fd317..0c1b6d9e33dc621699a9d2865ef95c8a8b9e1808 100644 --- a/src/endWeek/reports/nurseryReport.js +++ b/src/endWeek/reports/nurseryReport.js @@ -8,6 +8,7 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() { const slaves = App.Utils.sortedEmployees(App.Entity.facilities.nursery); const devBonus = (V.nurseryDecoration !== "standard") ? 1 : 0; const arcology = V.arcologies[0]; + const NL = App.Entity.facilities.nursery.employeesIDs().size; let matronBonus = 0; @@ -60,13 +61,13 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() { if (S.Matron.health.condition < 10) { r.push(`${He} does ${his} best to take good care of ${V.nurseryChildren ? `the children` : `${V.nurseryName}`}, but ${his} poor health limits ${his} ability to do so.`); } else if (S.Matron.health.condition < 80) { - r.push(`${His} good health allows ${him} to keep up with the demands of ${V.nurseryName}${V.nurseryNannies ? `and <span class="yellowgreen">work</span> the nannies hard` : ``}.`); + r.push(`${His} good health allows ${him} to keep up with the demands of ${V.nurseryName}${NL ? `and <span class="yellowgreen">work</span> the nannies hard` : ``}.`); - matronBonus += V.nurseryNannies ? 50 : 0; + matronBonus += NL ? 50 : 0; } else { - r.push(`${His} perfect health allows ${him} to really stay on top of things in ${V.nurseryName}${V.nurseryNannies ? ` and <span class="yellowgreen">really drive</span> the nannies hard.` : ``}`); + r.push(`${His} perfect health allows ${him} to really stay on top of things in ${V.nurseryName}${NL > 0 ? ` and <span class="yellowgreen">really drive</span> the nannies hard.` : ``}`); - matronBonus += V.nurseryNannies ? 75 : 0; + matronBonus += NL ? 75 : 0; } if (App.Data.Careers.Leader.matron.includes(S.Matron.career)) { @@ -98,8 +99,8 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() { matronBonus += S.Matron.intelligence + S.Matron.intelligenceImplant; } - if (V.nurseryChildren < V.nursery) { - let seed = jsRandom(1, 10) + ((V.nursery - V.nurseryChildren) * (jsRandom(150, 170) + (matronBonus * 10))); + if (V.nurseryChildren < V.nurseryCribs) { + let seed = jsRandom(1, 10) + ((V.nurseryCribs - V.nurseryChildren) * (jsRandom(150, 170) + (matronBonus * 10))); cashX(seed, "nursery", S.Matron); r.push(`<p class="indent">Since ${he} doesn't have enough children to occupy all ${his} time, ${V.nurseryName} takes in citizens' children on a contract basis and ${he} cares for them too, earning <span class='yellowgreen'>${cashFormat(seed)}.</span></p>`); diff --git a/src/endWeek/saChoosesOwnJob.js b/src/endWeek/saChoosesOwnJob.js index 7df731ba4980d4796aa1750114e52e1bf1373d4f..5c08029c433a542726925fa79861848b096a455f 100644 --- a/src/endWeek/saChoosesOwnJob.js +++ b/src/endWeek/saChoosesOwnJob.js @@ -156,7 +156,7 @@ App.SlaveAssignment.choosesOwnJob = function saChoosesOwnJob(slave) { choice.push(`is obedient but not devoted, so ${he} <span class="job change">decides to work as a servant</span> since it's the least sexually demanding job available.`); choice.push(assignJob(slave, "be a servant")); } - } else if (V.universalRulesAssignsSelfFacility === 1 && slave.devotion > 50 && canWalk(slave) && canSee(slave) && V.nurseryNannies > nurseryL && (V.cribs.findIndex((c) => (c.mother === slave.ID || c.father === slave.ID)))) { + } else if (V.universalRulesAssignsSelfFacility === 1 && slave.devotion > 50 && canWalk(slave) && canSee(slave) && V.nursery > nurseryL && (V.cribs.findIndex((c) => (c.mother === slave.ID || c.father === slave.ID)))) { if (V.cribs.findIndex((c) => (c.mother === slave.ID || c.father === slave.ID))) { choice.push(`wants to look after ${his} child, so ${he} <span class="job change">decides to work in ${V.nurseryName}.</span>`); choice.push(assignJob(slave, "work as a nanny")); diff --git a/src/endWeek/slaveAssignmentReport.js b/src/endWeek/slaveAssignmentReport.js index c11b035d9949aa46571333857518ae662d928248..67e489f2530cf11591cd384badff6b59b46132bf 100644 --- a/src/endWeek/slaveAssignmentReport.js +++ b/src/endWeek/slaveAssignmentReport.js @@ -265,7 +265,7 @@ App.EndWeek.slaveAssignmentReport = function() { [App.EndWeek.spaReport, App.Entity.facilities.spa], [App.EndWeek.servantsQuartersReport, App.Entity.facilities.servantsQuarters], [App.Facilities.Nursery.nurseryReport, App.Entity.facilities.nursery], - [App.Facilities.Nursery.childrenReport, "Nursery Children", V.nursery, V.nurseryChildren], + [App.Facilities.Nursery.childrenReport, "Nursery Children", V.nurseryCribs, V.nurseryChildren], [App.EndWeek.incubatorReport, App.Entity.facilities.incubator], [App.EndWeek.masterSuiteReport, App.Entity.facilities.masterSuite], [App.EndWeek.penthouseReport, "The Penthouse"], diff --git a/src/events/scheduled/sePlayerBirth.js b/src/events/scheduled/sePlayerBirth.js index 27ef156774919844764ce3475fe913bad0c8b5f6..e266a21a49f91130189e269b1e5755cda3828632 100644 --- a/src/events/scheduled/sePlayerBirth.js +++ b/src/events/scheduled/sePlayerBirth.js @@ -808,7 +808,7 @@ App.Events.SEPlayerBirth = class SEPlayerBirth extends App.Events.BaseEvent { r.push(`him`); } r.push(`aside for incubation.</span>`); - if (V.cribs.length < V.nursery) { + if (V.cribs.length < V.nurseryCribs) { App.Facilities.Nursery.newChild(generateChild(V.PC, birthed[0])); } } @@ -918,7 +918,7 @@ App.Events.SEPlayerBirth = class SEPlayerBirth extends App.Events.BaseEvent { r.push(`him`); } r.push(`aside to be raised in the penthouse.</span>`); - if (V.cribs.length < V.nursery) { + if (V.cribs.length < V.nurseryCribs) { App.Facilities.Nursery.newChild(generateChild(V.PC, birthed[p])); } birthed.splice(birthed[p], 1); @@ -927,7 +927,7 @@ App.Events.SEPlayerBirth = class SEPlayerBirth extends App.Events.BaseEvent { } } - r.push(`All in all, you've bought a healthy group of`); + r.push(`All in all, you've brought a healthy group of`); if (babiesReduced.length > 2) { for (let spb = 0; spb < babiesReduced.length; spb++) { if (spb < babiesReduced.length - 1) { diff --git a/src/facilities/nursery/nursery.js b/src/facilities/nursery/nursery.js index 3476dba689cea02c9a95ac20a83757f13e51d4b4..f3cc6b278450a4658aa4c1976b1733bf762a36dd 100644 --- a/src/facilities/nursery/nursery.js +++ b/src/facilities/nursery/nursery.js @@ -3,8 +3,8 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { const nursery = App.Entity.facilities.nursery; const decommissionHandler = () => { V.nursery = 0; + V.nurseryCribs = 0; V.nurseryDecoration = "standard"; - V.nurseryNannies = 0; V.nannyInfluence = 0; V.cribs = []; }; @@ -87,11 +87,11 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { /** @returns {FC.Facilities.Expand} */ get expand() { const slaves = this.facility.hostedSlaves(); - const nannies = numberWithPluralOne(V.nurseryNannies, 'nanny', 'nannies'); + const nannies = numberWithPluralOne(V.nursery, 'nanny', 'nannies'); return { amount: 1, - desc: `${this.facility.nameCaps} has room to support ${nannies}. There ${slaves === 1 ? `is` : `are`} currently ${nannies} taking care of ${numberWithPlural(V.nurseryChildren, 'child', 'children')}.`, + desc: `${this.facility.nameCaps} has room to support ${nannies}. There ${slaves === 1 ? `is currently ${num(slaves)} nanny` : `are currently ${num(slaves)} nannies`} taking care of ${numberWithPlural(V.nurseryChildren, 'child', 'children')}.`, maximum: 5, }; } @@ -261,8 +261,6 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { let childrenReserved = 0; - text.push(`Reserve an eligible mother-to-be's child to be placed in a room upon birth. Of ${V.nursery} rooms, ${numberWithPlural(V.nursery - V.nurseryChildren, 'is', 'are')} unoccupied. Of those, ${numberWithPlural(FetusGlobalReserveCount("nursery"), 'room is', 'rooms are')} reserved.`); - App.Events.addNode(div, text); const refreshDiv = document.createElement("div"); @@ -275,14 +273,14 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { const div = document.createElement("div"); div.append( - sort(), + //sort(), mothers(), ); return div; } - function sort() { + /* function sort() { const div = document.createElement("div"); const sorts = []; @@ -311,33 +309,29 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { ); return div; - } + }*/ //Was not working function mothers() { const el = new DocumentFragment(); let r = []; let eligibility = 0; let linkArray; - const reservedChildren = FetusGlobalReserveCount("incubator"); - const freeRooms = V.nursery - V.nurseryChildren; - r.push(`Reserve an eligible mother-to-be's child to be placed in a room upon birth. Of ${V.nursery} rooms, ${freeRooms}`); - if (freeRooms === 1) { - r.push(`is`); - } else { - r.push(`are`); - } - r.push(`unoccupied. Of those, ${reservedChildren}`); - if (reservedChildren === 1) { - r.push(`room is`); - } else { - r.push(`rooms are`); + const reservedChildrenN = FetusGlobalReserveCount('nursery'); + const freeRooms = V.nurseryCribs - V.nurseryChildren; + const reservedChildrenI = FetusGlobalReserveCount('incubator'); + const incubatorSlaves = V.incubator.tanks.length; + const freeTanks = V.incubator.capacity - incubatorSlaves; + r.push(`Reserve an eligible mother-to-be's child to be placed in a room upon birth. Of ${V.nurseryCribs} rooms, ${numberWithPlural(freeRooms, 'is', 'are')} unoccupied. Of those, ${numberWithPlural(FetusGlobalReserveCount("nursery"), 'room is', 'rooms are')} reserved.`); + if (V.incubator.capacity > 0) { + r.push(`Of ${V.incubator.capacity} incubation tanks, ${numberWithPlural(freeTanks, 'is', 'are')} unoccupied. Of those, ${numberWithPlural(FetusGlobalReserveCount("incubator"), 'tank is', 'tanks are')} reserved.`); } - r.push(`reserved.`); + App.Events.addNode(el, r, "div"); const sortingOptions = new Map([ ["Name", "data-name"], - ["Reserved Incubator Spots", "data-reserved-spots"], + ["Reserved Nursery Spots", "data-reserved-spots-nursery"], + ["Reserved Incubator Spots", "data-reserved-spots-incubator"], ["Pregnancy Week", "data-preg-week"], ["Number of Children", "data-preg-count"], ]); @@ -378,7 +372,7 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { el.append(sortingBar); } - const qlIncubator = document.createElement("div"); + const qlNursery = document.createElement("div"); for (const slave of V.slaves) { if (slave.preg > 0 && slave.pregKnown === 1 && slave.eggType === "human") { const r = []; @@ -387,7 +381,7 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { const { His, his } = getPronouns(slave); - const freeRooms = V.nursery - V.nurseryChildren; + const freeRooms = V.nurseryCribs - V.nurseryChildren; const WL = slave.womb.length; const reservedIncubator = WombReserveCount(slave, "incubator"); const reservedNursery = WombReserveCount(slave, "nursery"); @@ -396,7 +390,8 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { momEl.classList.add("possible"); momEl.setAttribute("data-preg-count", slave.womb.length.toString()); - momEl.setAttribute("data-reserved-spots", reservedIncubator.toString()); + momEl.setAttribute("data-reserved-spots-nursery", reservedNursery.toString()); + momEl.setAttribute("data-reserved-spots-incubator", reservedIncubator.toString()); momEl.setAttribute("data-preg-week", slave.pregWeek.toString()); momEl.setAttribute("data-name", SlaveFullName(slave)); @@ -436,207 +431,310 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { } else { r.push(`baby.`); } - if (reservedIncubator > 0) { + if (reservedNursery > 0) { childrenReserved = 1; if (WL === 1) { r.push(`${His} child`); - } else if (reservedIncubator < WL) { - r.push(`${reservedIncubator} of ${his} children`); + } else if (reservedNursery < WL) { + r.push(`${reservedNursery} of ${his} children`); } else if (WL === 2) { r.push(`Both of ${his} children`); } else { - r.push(`All ${reservedIncubator} of ${his} children`); + r.push(`All ${reservedNursery} of ${his} children`); } r.push(`will be placed in ${V.nurseryName}.`); - if ((reservedIncubator + reservedNursery < WL) && (reservedChildren < freeRooms)) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { - V.AS = slave.ID; - }, - [], - `Analyze Pregnancy` - ) - ); - } - linkArray.push( - App.UI.DOM.link( - `Keep another child`, - () => { - WombAddToGenericReserve(slave, 'incubator', 1); - refresh(); - } - ) - ); - if (reservedIncubator > 0) { - linkArray.push( - App.UI.DOM.link( - `Keep one less child`, - () => { - WombCleanGenericReserve(slave, 'incubator', 1); - refresh(); - } - ) - ); - } - if (reservedIncubator > 1) { - linkArray.push( - App.UI.DOM.link( - `Keep none of ${his} children`, - () => { - WombCleanGenericReserve(slave, 'incubator', 9999); - refresh(); - } - ) - ); - } - if ((reservedChildren + WL - reservedIncubator) <= freeRooms) { - linkArray.push( - App.UI.DOM.link( - `Keep the rest of ${his} children`, - () => { - WombAddToGenericReserve(slave, 'incubator', 9999); - refresh(); - } - ) - ); - } - } else if ((reservedIncubator === WL) || (reservedChildren === freeRooms) || (reservedIncubator + reservedNursery === WL)) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { - V.AS = slave.ID; - }, - [], - `Analyze Pregnancy` - ) - ); - } - linkArray.push( - App.UI.DOM.link( - `Keep one less child`, - () => { - WombCleanGenericReserve(slave, 'incubator', 1); - refresh(); - } - ) - ); - if (reservedIncubator > 1) { - linkArray.push( - App.UI.DOM.link( - `Keep none of ${his} children`, - () => { - WombCleanGenericReserve(slave, 'incubator', 9999); - refresh(); - } - ) - ); - } - } - } else if (reservedChildren < freeRooms) { - if (WL - reservedNursery === 0) { - r.push(App.UI.DOM.makeElement("span", `${His} children are already reserved for ${V.nurseryName}`, "note")); - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { - V.AS = slave.ID; - }, - [], - `Analyze Pregnancy` - ) - ); - } - linkArray.push( - App.UI.DOM.link( - `Keep ${his} ${((WL > 1) ? "children" : "child")} here instead`, - () => { - WombChangeReserveType(slave, 'nursery', 'incubator'); - refresh(); - } - ) - ); - } else { - r.push(`You have `); - if (freeRooms === 1) { - r.push(`an <span class="lime">available aging room.</span>`); - } else { - r.push(`<span class="lime">available aging rooms.</span>`); - } - if (V.pregnancyMonitoringUpgrade === 1) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { - V.AS = slave.ID; - }, - [], - `Analyze Pregnancy` - ) - ); - } - } - linkArray.push( - App.UI.DOM.link( - `Keep ${(WL > 1) ? "a" : "the"} child`, - () => { - WombAddToGenericReserve(slave, 'incubator', 1); - refresh(); - } - ) - ); - if ((WL > 1) && (reservedChildren + WL - reservedIncubator) <= freeRooms) { - linkArray.push( - App.UI.DOM.link( - `Keep all of ${his} children`, - () => { - WombAddToGenericReserve(slave, 'incubator', 9999); - refresh(); - } - ) - ); - } - } - } else if (reservedChildren === freeRooms) { - if (V.pregnancyMonitoringUpgrade === 1) { - linkArray.push( - App.UI.DOM.link( - `Inspect pregnancy`, - () => { - V.AS = slave.ID; - }, - [], - `Analyze Pregnancy` - ) - ); - } - const noRoom = new DocumentFragment(); - noRoom.append(`You have `); - App.UI.DOM.appendNewElement("span", noRoom, `no room for ${his} offspring.`, "red"); - linkArray.push(noRoom); - } + if ((reservedIncubator + reservedNursery < WL) && (reservedChildrenN < freeRooms)) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { + V.AS = slave.ID; + }, + [], + `Analyze Pregnancy` + ) + ); + } + linkArray.push( + App.UI.DOM.link( + `Keep another child here`, + () => { + WombAddToGenericReserve(slave, 'nursery', 1); + refresh(); + } + ) + ); + if (reservedNursery > 0) { + linkArray.push( + App.UI.DOM.link( + `Keep one less child here`, + () => { + WombCleanGenericReserve(slave, 'nursery', 1); + refresh(); + } + ) + ); + } + if (reservedNursery > 1) { + linkArray.push( + App.UI.DOM.link( + `Keep none of ${his} children here`, + () => { + WombCleanGenericReserve(slave, 'nursery', 9999); + refresh(); + } + ) + ); + } + if ((reservedChildrenN + WL - reservedNursery) <= freeRooms) { //GammaNote Maths Order + linkArray.push( + App.UI.DOM.link( + `Keep the rest of ${his} children here`, + () => { + WombAddToGenericReserve(slave, 'nursery', 9999); + refresh(); + } + ) + ); + } + } else if ((reservedNursery === WL) || (reservedChildrenN === freeRooms) || (reservedIncubator + reservedNursery === WL)) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { + V.AS = slave.ID; + }, + [], + `Analyze Pregnancy` + ) + ); + } + if (reservedNursery > 0) { + linkArray.push( + App.UI.DOM.link( + `Keep one less child here`, + () => { + WombCleanGenericReserve(slave, 'nursery', 1); + refresh(); + } + ) + ); + } + if (reservedNursery > 1) { + linkArray.push( + App.UI.DOM.link( + `Keep none of ${his} children here`, + () => { + WombCleanGenericReserve(slave, 'nursery', 9999); + refresh(); + } + ) + ); + } + } + } else if (reservedIncubator + reservedNursery < WL ) { + r.push(`You have `); + if (freeRooms === 1) { + r.push(`an <span class="lime">available aging room.</span>`); + } else { + r.push(`<span class="lime">available aging rooms.</span>`); + } + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { + V.AS = slave.ID; + }, + [], + `Analyze Pregnancy` + ) + ); + } + linkArray.push( + App.UI.DOM.link( + `Keep ${(WL > 1) ? "a" : "the"} child here`, + () => { + WombAddToGenericReserve(slave, 'nursery', 1); + refresh(); + } + ) + ); + if ((WL > 1) && (reservedChildrenN + WL - reservedNursery) <= freeRooms) { + linkArray.push( + App.UI.DOM.link( + `Keep all of ${his} children here`, + () => { + WombAddToGenericReserve(slave, 'nursery', 9999); + refresh(); + } + ) + ); + } + } + if(V.incubator.capacity > 0) { + if (reservedIncubator > 0) { //GammaNote + childrenReserved = 1; + if (WL === 1) { + r.push(`${His} child`); + } else if (reservedIncubator < WL) { + r.push(`${reservedIncubator} of ${his} children`); + } else if (WL === 2) { + r.push(`Both of ${his} children`); + } else { + r.push(`All ${reservedIncubator} of ${his} children`); + } + r.push(`will be placed in ${V.incubator.name}.`); + if ((reservedIncubator + reservedNursery < WL) && (reservedChildrenI < freeTanks)) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { + V.AS = slave.ID; + }, + [], + `Analyze Pregnancy` + ) + ); + } + linkArray.push( + App.UI.DOM.link( + `Keep another child in ${V.incubator.name}`, + () => { + WombAddToGenericReserve(slave, 'incubator', 1); + refresh(); + } + ) + ); + if (reservedIncubator > 0) { + linkArray.push( + App.UI.DOM.link( + `Keep one less child in ${V.incubator.name}`, + () => { + WombCleanGenericReserve(slave, 'incubator', 1); + refresh(); + } + ) + ); + } + if (reservedIncubator > 1) { + linkArray.push( + App.UI.DOM.link( + `Keep none of ${his} children in ${V.incubator.name}`, + () => { + WombCleanGenericReserve(slave, 'incubator', 9999); + refresh(); + } + ) + ); + } + if ((reservedChildrenI + WL - reservedIncubator) <= freeTanks) { //GammaNote maths order? + linkArray.push( + App.UI.DOM.link( + `Keep the rest of ${his} children in ${V.incubator.name}`, + () => { + WombAddToGenericReserve(slave, 'incubator', 9999); + refresh(); + } + ) + ); + } + } + } else if ((reservedIncubator === WL) || (reservedChildrenI === freeTanks) || (reservedIncubator + reservedNursery === WL)) { + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { + V.AS = slave.ID; + }, + [], + `Analyze Pregnancy` + ) + ); + } + if (reservedIncubator > 0) { + linkArray.push( + App.UI.DOM.link( + `Keep one less child in ${V.incubator.name}`, + () => { + WombCleanGenericReserve(slave, 'incubator', 1); + refresh(); + } + ) + ); + } + if (reservedIncubator > 1) { + linkArray.push( + App.UI.DOM.link( + `Keep none of ${his} children in ${V.incubator.name}`, + () => { + WombCleanGenericReserve(slave, 'incubator', 9999); + refresh(); + } + ) + ); + } + } else if (reservedIncubator + reservedNursery < WL ) { + r.push(`You have `); + if (freeTanks === 1) { + r.push(`an <span class="lime">available aging tank.</span>`); + } else { + r.push(`<span class="lime">available aging tanks.</span>`); + } + if (V.pregnancyMonitoringUpgrade === 1) { + linkArray.push( + App.UI.DOM.link( + `Inspect pregnancy`, + () => { + V.AS = slave.ID; + }, + [], + `Analyze Pregnancy` + ) + ); + } + linkArray.push( + App.UI.DOM.link( + `Keep ${(WL > 1) ? "a" : "the"} child in ${V.incubator.name}`, + () => { + WombAddToGenericReserve(slave, 'incubator', 1); + refresh(); + } + ) + ); + if ((WL > 1) && (reservedChildrenN + WL - reservedNursery) <= freeRooms) { + linkArray.push( + App.UI.DOM.link( + `Keep all of ${his} children in ${V.incubator.name}`, + () => { + WombAddToGenericReserve(slave, 'incubator', 9999); + refresh(); + } + ) + ); + } + } + } eligibility = 1; App.Events.addNode(momEl, r, "div"); choices.append(App.UI.DOM.generateLinksStrip(linkArray)); momEl.append(choices); - qlIncubator.append(momEl); + qlNursery.append(momEl); } } } sortByPreviousSort(); - el.append(qlIncubator); + el.append(qlNursery); if (eligibility === 0) { App.UI.DOM.appendNewElement("div", el, `You have no pregnant slaves bearing eligible children.`, "note"); } - if (reservedChildren !== 0 || childrenReserved === 1) { // the oops I made it go negative somehow button + if (reservedChildrenN !== 0 || reservedChildrenI !== 0 || childrenReserved === 1) { // the oops I made it go negative somehow button App.UI.DOM.appendNewElement( "div", el, @@ -647,8 +745,12 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { if (WombReserveCount(slave, "incubator") !== 0) { WombCleanGenericReserve(slave, 'incubator', 9999); } + if (WombReserveCount(slave, "nursery") !== 0) { + WombCleanGenericReserve(slave, 'nursery', 9999); + } } WombCleanGenericReserve(V.PC, 'incubator', 9999); + WombCleanGenericReserve(V.PC, 'nursery', 9999); refresh(); } ) @@ -661,9 +763,9 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { } function sortBy(attrName) { - let sortedIncubatorPossibles = $(qlIncubator).children('p.possible').detach(); - sortedIncubatorPossibles = sortDomObjects(sortedIncubatorPossibles, attrName); - $(sortedIncubatorPossibles).appendTo(qlIncubator); + let sortedNurseryPossibles = $(qlNursery).children('p.possible').detach(); + sortedNurseryPossibles = sortDomObjects(sortedNurseryPossibles, attrName); + $(sortedNurseryPossibles).appendTo(qlNursery); } function sortByPreviousSort() { @@ -732,19 +834,19 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { const cost = Math.trunc(5000 * V.upgradeMultiplierArcology); const links = []; - div.append(`It can support ${numberWithPlural(V.nursery, 'child', 'children')}. There ${numberWithPlural(V.nurseryChildren, 'is', 'are')} currently ${numberWithPlural(V.nurseryChildren, 'room')} in use in ${this.facility.name}.`); + div.append(`It can support ${numberWithPlural(V.nurseryCribs, 'child', 'children')}. There ${V.nurseryChildren === 1 ? `is currently` : `are currently`} ${numberWithPlural(V.nurseryChildren, 'room')} in use in ${this.facility.name}.`); links.push(App.UI.DOM.link(`Add room for another 5 children`, () => { cashX(forceNeg(cost), "nursery"); - V.nursery += 5; + V.nurseryCribs += 5; App.UI.reload(); }, [], '', `Costs ${cashFormat(cost)} and will increase upkeep costs.`)); - if (V.nursery > 1 && FetusGlobalReserveCount("nursery") < V.nursery - V.nurseryChildren) { + if (V.nurseryCribs > 1 && FetusGlobalReserveCount("nursery") < V.nurseryCribs - V.nurseryChildren) { links.push(App.UI.DOM.link(`Remove a room`, () => { cashX(forceNeg(cost / 5), "nursery"); - V.nursery -= 5; + V.nurseryCribs -= 1; App.UI.reload(); }, [], '', `Costs ${cashFormat(cost / 5)} and will decrease upkeep costs.`)); @@ -758,10 +860,10 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { /** @returns {HTMLDivElement[]} */ get customNodes() { return [ + this.rooms, this.mothers, this.children, this.targetAge, - this.rooms, ]; } }; diff --git a/src/facilities/nursery/nurseryFramework.js b/src/facilities/nursery/nurseryFramework.js index 35431bbc9347b5c0deb01d672bcb93e8fa8762be..e909489ade73e5bb7de78274dd53483960d294c6 100644 --- a/src/facilities/nursery/nurseryFramework.js +++ b/src/facilities/nursery/nurseryFramework.js @@ -68,8 +68,8 @@ App.Entity.Facilities.Nursery = class extends App.Entity.Facilities.SingleJobFac /** @override */ occupancyReport(long) { return long - ? `${V.nurseryChildren}/${V.nursery} babies, ${this.hostedSlaves()}/${V.nurseryNannies} nannies${this.manager.currentEmployee ? `, ${this.manager.desc.position}` : ""}` - : `${V.nurseryChildren}/${V.nursery}, ${this.hostedSlaves()}/${V.nurseryNannies}${this.manager.currentEmployee ? ", L" : ""}`; + ? `${V.nurseryChildren}/${V.nurseryCribs} babies, ${this.hostedSlaves()}/${V.nursery} nannies${this.manager.currentEmployee ? `, ${this.manager.desc.position}` : ""}` + : `${V.nurseryChildren}/${V.nurseryCribs}, ${this.hostedSlaves()}/${V.nursery}${this.manager.currentEmployee ? ", L" : ""}`; } }; diff --git a/src/facilities/nursery/utils/nurseryUtils.js b/src/facilities/nursery/utils/nurseryUtils.js index a20c9642ca8fba1452efe133def4dbc2a84a9722..914c006e347d7d037271d8193429749f809e9660 100644 --- a/src/facilities/nursery/utils/nurseryUtils.js +++ b/src/facilities/nursery/utils/nurseryUtils.js @@ -690,7 +690,7 @@ App.Facilities.Nursery.nurserySort = function nurserySort() { const PC = V.PC; const SL = V.slaves.length; const arcology = V.arcologies[0]; - const freeCribs = (V.nursery - V.cribs.length); + const freeCribs = (V.nurseryCribs - V.cribs.length); let r = ``; let eligibility = 0; diff --git a/src/facilities/penthouse/managePenthouse.js b/src/facilities/penthouse/managePenthouse.js index 90561620fd7536a212559395ec461f64b237a7e3..897c7122bd711819b30fe8bdd7b07628b08b6df4 100644 --- a/src/facilities/penthouse/managePenthouse.js +++ b/src/facilities/penthouse/managePenthouse.js @@ -111,8 +111,8 @@ App.UI.managePenthouse = function() { if (V.experimental.nursery === 1) { if (V.nursery === 0) { App.UI.DOM.appendNewElement("div", el, makeLink("Build a nursery to raise children from birth", () => { - V.nursery = 5; - V.nurseryNannies = 1; + V.nursery = 1; + V.nurseryCribs = 5; })); } else { App.UI.DOM.appendNewElement("div", el, `The penthouse has a nursery built where infants can be brought up.`); diff --git a/src/facilities/surgery/analyzePlayerPregnancy.js b/src/facilities/surgery/analyzePlayerPregnancy.js index e312f923c4dc450f9df9c33a8927deec93746810..d48fe20695eac640d29cafab38cce1624df6341e 100644 --- a/src/facilities/surgery/analyzePlayerPregnancy.js +++ b/src/facilities/surgery/analyzePlayerPregnancy.js @@ -13,7 +13,7 @@ App.UI.analyzePCPregnancy = function() { const incubatorReservations = WombReserveCount(V.PC, "incubator"); const nurseryReservations = WombReserveCount(V.PC, "nursery"); const freeTanks = V.incubator.capacity - V.incubator.tanks.length; - const freeCribs = V.nursery - V.cribs.length; + const freeCribs = V.nurseryCribs - V.cribs.length; const reservedChildren = FetusGlobalReserveCount("incubator"); const reservedChildrenNursery = FetusGlobalReserveCount("nursery"); let linkArray = []; @@ -29,7 +29,7 @@ App.UI.analyzePCPregnancy = function() { App.UI.DOM.appendNewElement("p", node, `Fetal development week: ${V.PC.preg}`); let p = App.UI.DOM.appendNewElement("p", node); - if (V.incubator.capacity > 0 || V.nursery > 0) { + if (V.incubator.capacity > 0 || V.nurseryCribs > 0) { let div = App.UI.DOM.appendNewElement("div", p); if (V.incubator.capacity > 0) { if (incubatorReservations > 0) { diff --git a/src/facilities/surgery/analyzePregnancy.js b/src/facilities/surgery/analyzePregnancy.js index 2beb1a23541d70a6120c16e879fe2a39fafa827d..54854485b4a85dbd2e5f32ad2a400bfa5fba0504 100644 --- a/src/facilities/surgery/analyzePregnancy.js +++ b/src/facilities/surgery/analyzePregnancy.js @@ -126,7 +126,7 @@ globalThis.analyzePregnancies = function(mother, cheat) { App.UI.DOM.appendNewElement("div", el, `Mother Name: ${genes.motherName}`); } } - if (V.incubator.capacity > 0 || V.nursery > 0) { + if (V.incubator.capacity > 0 || V.nurseryCribs > 0) { App.UI.DOM.appendNewElement("div", el, `Reserved: ${fetus.reserve}`); } @@ -177,7 +177,7 @@ globalThis.analyzePregnancies = function(mother, cheat) { [], passage() )); - } else if ((V.nursery - V.cribs.length) - FetusGlobalReserveCount("nursery") > 0) { + } else if ((V.nurseryCribs - V.cribs.length) - FetusGlobalReserveCount("nursery") > 0) { App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link( `Keep this child in ${V.nurseryName}`, () => { @@ -261,7 +261,7 @@ App.UI.analyzePregnancy = function() { const incubatorReservations = WombReserveCount(slave, "incubator"); const nurseryReservations = WombReserveCount(slave, "nursery"); const freeTanks = V.incubator.capacity - V.incubator.tanks.length; - const freeCribs = V.nursery - V.cribs.length; + const freeCribs = V.nurseryCribs - V.cribs.length; const reservedChildren = FetusGlobalReserveCount("incubator"); let linkArray = []; @@ -293,7 +293,7 @@ App.UI.analyzePregnancy = function() { App.UI.DOM.appendNewElement("p", node, `Fetal development week: ${Math.trunc(slave.preg * 1000) / 1000}`); p = App.UI.DOM.appendNewElement("p", node); - if (V.incubator.capacity > 0 || V.nursery > 0) { + if (V.incubator.capacity > 0 || V.nurseryCribs > 0) { let div = App.UI.DOM.appendNewElement("div", p); if (V.incubator.capacity > 0) { if (incubatorReservations > 0) { diff --git a/src/interaction/siPhysicalRegimen.js b/src/interaction/siPhysicalRegimen.js index 0ac6b2ebeb159cfd4bbf1fe3187f40520fefc636..fa79ec52510b0b1d054bb0325792782897233127 100644 --- a/src/interaction/siPhysicalRegimen.js +++ b/src/interaction/siPhysicalRegimen.js @@ -665,7 +665,7 @@ App.UI.SlaveInteract.physicalRegimen = function(slave, refresh) { title.textContent = `${His} children are already reserved for ${V.incubator.name}`; title.style.fontStyle = "italic"; } else { - const freeCribs = (V.nursery - V.cribs.length); + const freeCribs = (V.nurseryCribs - V.cribs.length); if (reservedNursery > 0) { if (WL === 1) { title.textContent = `${His} child will be placed in ${V.nurseryName}. `; diff --git a/src/js/birth/birth.js b/src/js/birth/birth.js index 24cc9d30cb6ded022c28254cf4d53b360efc008f..50f9361544dcb2d86c5de2415576bcb46c3515ed 100644 --- a/src/js/birth/birth.js +++ b/src/js/birth/birth.js @@ -9164,7 +9164,7 @@ globalThis.sendNewbornsToFacility = function(mom, babiesBeingBorn, sendAll) { for (const ovum of babiesBeingBorn) { if ((ovum.reserve === "incubator" || sendAll) && V.incubator.tanks.length < V.incubator.capacity) { App.Facilities.Incubator.newChild(generateChild(mom, ovum, true)); - } else if ((ovum.reserve === "nursery" || sendAll) && V.cribs.length < V.nursery) { + } else if ((ovum.reserve === "nursery" || sendAll) && V.cribs.length < V.nurseryCribs) { App.Facilities.Nursery.newChild(generateChild(mom, ovum)); } else { remainingBabies.push(ovum); diff --git a/src/npc/descriptions/career.js b/src/npc/descriptions/career.js index 6b6cd1b5f56c99c0dbc19c4a3448aa916a99b3c9..f5c6e9c21d46a59c59ee0c1cab4c4ba8c8058734 100644 --- a/src/npc/descriptions/career.js +++ b/src/npc/descriptions/career.js @@ -44,7 +44,7 @@ App.Desc.career = function(slave) { } } else if (App.Data.Careers.Leader.matron.includes(slave.career)) { r.push(`${career}, giving ${him} potential as a Matron for`); - if (V.nursery === 0 && V.nurseryNannies === 0) { + if (V.nursery === 0 && V.nurseryCribs === 0) { r.push(`a Nursery.`); } else { r.push(`${V.nurseryName}.`);