From 56dc6beef1e744d9fce1df565132595032307ebe Mon Sep 17 00:00:00 2001 From: DCoded <dcoded@live.com> Date: Sun, 9 Aug 2020 13:40:33 -0400 Subject: [PATCH] Changes, formatting, and cleanup --- js/003-data/gameVariableData.js | 18 +++++++++----- src/endWeek/reports/childrenReport.js | 36 +++++++-------------------- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 89d8e69ef5a..c7ee0825544 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -741,11 +741,16 @@ App.Data.resetOnNGPlus = { masterSuiteNameCaps: "The Master Suite", // Nursery Subsection - nursery: 0, // counts the number of children the nursery can support - nurseryNannies: 0, // counts the number of nannies the nursery can support - nurseryChildren: 0, // counts the number of children currently in the nursery - MatronInfluence: 0, // check for whether the children are influenced by the Matron - nannyInfluence: 0, // check for whether the children are influenced by the nannies + /** Counts the number of children the nursery can support */ + nursery: 0, + /** Counts the number of nannies the nursery can support */ + nurseryNannies: 0, + /** Counts the number of children currently in the nursery */ + nurseryChildren: 0, + /** Check for whether the children are influenced by the Matron */ + MatronInfluence: 0, + /** Check for whether the children are influenced by the nannies */ + nannyInfluence: 0, nurseryDecoration: "standard", nurseryWeight: 0, nurseryMuscles: 0, @@ -758,7 +763,8 @@ App.Data.resetOnNGPlus = { nurseryName: "the Nursery", nurseryNameCaps: "The Nursery", reservedChildrenNursery: 0, - cribs: [], // array of children in the nursery + /** Array of children in the Nursery */ + cribs: [], cribsIndices: {}, sortNurseryList: "Unsorted", targetAgeNursery: 18, diff --git a/src/endWeek/reports/childrenReport.js b/src/endWeek/reports/childrenReport.js index de7d1879681..f25cf43352b 100644 --- a/src/endWeek/reports/childrenReport.js +++ b/src/endWeek/reports/childrenReport.js @@ -12,9 +12,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { CL = V.cribs.length, medianNannyIntelligence = NL ? findMedianNannyIntelligence() : null, - medianNannyIntelligenceImplant = NL ? findMedianNannyIntelligenceImplant() : null, - - randomNanny = NL > 1 ? jsRandom(0, nannies.length - 1) : 0; + medianNannyIntelligenceImplant = NL ? findMedianNannyIntelligenceImplant() : null; for (const child of V.cribs) { const childDiv = App.UI.DOM.appendNewElement("div", frag, '', "child-section"); @@ -32,7 +30,9 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { } if (NL > 0) { - let nanny = nannies[randomNanny]; + const + randomNanny = NL > 1 ? jsRandom(0, nannies.length - 1) : 0, + nanny = nannies[randomNanny]; if (nanny.fetish !== "none") { childDiv.append(nannyFetishEffects(child, nanny)); @@ -65,16 +65,10 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { { He } = getPronouns(child), chance = jsRandom(1, 100); - if (chance > 90) { - if (child.fetish === "none") { - child.fetish = Matron.fetish; - - return `${child.slaveName} has taken a few cues from ${Matron.slaveName}, and ${newChildFetish(child.fetish)}. `; - } else if (chance > 95) { - child.fetish = Matron.fetish; + if ((chance > 90 && child.fetish === "none") || chance > 95) { + child.fetish = Matron.fetish; - return `${Matron.slaveName} has rubbed off on ${child.slaveName}, in more ways than one. ${He} ${newChildFetish(child.fetish)}. `; - } + return `${child.slaveName} has taken a few cues from ${Matron.slaveName}, and ${newChildFetish(child.fetish)}. `; } } @@ -524,23 +518,11 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { } function findMedianNannyIntelligence() { - const intelligenceValues = []; - - for (const nanny of nannies) { - intelligenceValues.push(nanny.intelligence); - } - - return median(intelligenceValues); + return median(nannies.map(n => n.intelligence)); } function findMedianNannyIntelligenceImplant() { - const intelligenceImplantValues = []; - - for (const nanny of nannies) { - intelligenceImplantValues.push(nanny.intelligenceImplant); - } - - return median(intelligenceImplantValues); + return median(nannies.map(n => n.intelligenceImplant)); } /** -- GitLab