From 29d449748e8f5a1e9d1cef6dfb87a1f9baae5bea Mon Sep 17 00:00:00 2001 From: DCoded <dcoded@live.com> Date: Thu, 23 Jul 2020 23:10:06 -0400 Subject: [PATCH] Refactored nursery weight rules effects --- .../nursery/reports/childrenReport.js | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/src/facilities/nursery/reports/childrenReport.js b/src/facilities/nursery/reports/childrenReport.js index dc73de38694..a79b86d1ba5 100644 --- a/src/facilities/nursery/reports/childrenReport.js +++ b/src/facilities/nursery/reports/childrenReport.js @@ -41,36 +41,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { // TODO: rework these entirely if (Matron || NL) { - if (V.nurseryWeight) { - const firstNanny = NL > 0 ? App.Entity.facilities.nursery.employees()[0] : null; - r += `<br>`; - if (V.nurseryWeightSetting === 1) { - if (child.weight < 200) { - child.weight += 5; - } - r += `${He} is being fed an excessive amount of food, causing <span class="red">rapid weight gain.</span> `; - } else if (V.nurseryWeightSetting === 2) { - if (child.weight > 10) { - child.weight--; - r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overweight and <span class="green">decreases the amount of food ${he} eats.</span> `; - } else if (child.weight <= -10) { - child.weight++; - r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is underweight and <span class="green">increases the amount of food ${he} eats.</span> `; - } else { - r += `${He} is <span class="lime">currently a healthy weight;</span> efforts will be made to maintain it. `; - } - } else if (V.nurseryWeightSetting === 0) { - if (child.weight > -20) { - r += `${His} developing body <span class="red">quickly sheds its gained weight.</span> `; - child.weight -= 40; - } - } - } else { - if (child.weight > -20) { - child.weight -= 40; - r += `${His} developing body <span class="red">quickly sheds its gained weight.</span>`; - } - } + // TODO: rewrite these if (V.nurseryMuscles) { @@ -330,5 +301,46 @@ App.Facilities.Nursery.childrenReport = function childrenReport() { return; } + + + // MARK: Nursery Rules Effects + + function weightRulesEffects() { + let r = []; + + if (V.nurseryWeight) { + const firstNanny = NL > 0 ? nannies[0] : null; + r.push(`<br>`); + if (V.nurseryWeightSetting === 1) { + if (child.weight < 200) { + child.weight += 5; + } + r.push(`${He} is being fed an excessive amount of food, causing <span class="red">rapid weight gain.</span> `); + } else if (V.nurseryWeightSetting === 2) { + if (child.weight > 10) { + child.weight--; + r.push(`${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overweight and <span class="green">decreases the amount of food ${he} eats.</span> `); + } else if (child.weight <= -10) { + child.weight++; + r.push(`${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is underweight and <span class="green">increases the amount of food ${he} eats.</span> `); + } else { + r.push(`${He} is <span class="lime">currently a healthy weight;</span> efforts will be made to maintain it. `); + } + } else if (V.nurseryWeightSetting === 0) { + if (child.weight > -20) { + r.push(`${His} developing body <span class="red">quickly sheds its gained weight.</span> `); + child.weight -= 40; + } + } + } else { + if (child.weight > -20) { + child.weight -= 40; + r.push(`${His} developing body <span class="red">quickly sheds its gained weight.</span>`); + } + } + + return r.join(' '); + } + return r.join(' '); }; -- GitLab