From 3eb739e4fb3cf2eb4c582fb7819052cf17b1512f Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Wed, 5 Aug 2020 00:56:45 -0400
Subject: [PATCH] Bugfix, DOMified musclesRulesEffects()

---
 src/endWeek/reports/childrenReport.js | 54 ++++++++++++++++++---------
 1 file changed, 37 insertions(+), 17 deletions(-)

diff --git a/src/endWeek/reports/childrenReport.js b/src/endWeek/reports/childrenReport.js
index f7d09b4fa89..e4f6aec1511 100644
--- a/src/endWeek/reports/childrenReport.js
+++ b/src/endWeek/reports/childrenReport.js
@@ -176,7 +176,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 				firstNanny = NL > 0 ? nannies[0] : null;
 
 			if (V.nurseryWeightSetting === 1) {
-				const weightSpan = App.UI.DOM.makeElement("div", 'rapid weight gain.', ["health", "dec"]);
+				const weightSpan = App.UI.DOM.makeElement("span", 'rapid weight gain.', ["health", "dec"]);
 
 				if (child.weight < 200) {
 					child.weight += 5;
@@ -184,26 +184,26 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 
 				div.append(`${He} is being fed an excessive amount of food, causing`, weightSpan);
 			} else if (V.nurseryWeightSetting === 2) {
-				const weightSpan = App.UI.DOM.makeElement("div", `decreases the amount of food ${he} eats.`, "improvement");
+				const weightSpan = App.UI.DOM.makeElement("span", `decreases the amount of food ${he} eats.`, "improvement");
 
 				if (child.weight > 10) {
 					child.weight--;
 
 					div.append(`${caretaker} notices ${he} is overweight and `, weightSpan);
 				} else if (child.weight <= -10) {
-					const weightSpan = App.UI.DOM.makeElement("div", `increases the amount of food ${he} eats.`, "improvement");
+					const weightSpan = App.UI.DOM.makeElement("span", `increases the amount of food ${he} eats.`, "improvement");
 
 					child.weight++;
 
 					div.append(`${caretaker} notices ${he} is underweight and `, weightSpan);
 				} else {
-					const weightSpan = App.UI.DOM.makeElement("div", 'currently a healthy weight;', ["change", "positive"]);
+					const weightSpan = App.UI.DOM.makeElement("span", 'currently a healthy weight;', ["change", "positive"]);
 
 					div.append(`${He} is `, weightSpan, ` efforts will be made to maintain it. `);
 				}
 			} else if (V.nurseryWeightSetting === 0) {
 				if (child.weight > -20) {
-					const weightSpan = App.UI.DOM.makeElement("div", 'quickly sheds its gained weight.', ["health", "dec"]);
+					const weightSpan = App.UI.DOM.makeElement("span", 'quickly sheds its gained weight.', ["health", "dec"]);
 
 					child.weight -= 40;
 
@@ -212,7 +212,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 			}
 		} else {
 			if (child.weight > -20) {
-				const weightSpan = App.UI.DOM.makeElement("div", 'quickly sheds its gained weight.', ["health", "dec"]);
+				const weightSpan = App.UI.DOM.makeElement("span", 'quickly sheds its gained weight.', ["health", "dec"]);
 
 				child.weight -= 40;
 
@@ -227,28 +227,48 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 		const div = document.createElement("div");
 
 		// TODO: rewrite these
+		// FIXME: this entire section needs a rewrite - numbers and text don't line up at all
 		if (V.nurseryMuscles) {
-			div.append(`${He} is being given anabolic steroids causing <span class="green">rapid muscle development.</span> `);	// TODO: not happy with this
+			const
+				caretaker = Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName,
+				firstNanny = NL > 0 ? nannies[0] : null;
+
+			const muscleSpan = App.UI.DOM.makeElement("div", 'rapid muscle development.', "improvement");
+
+			div.append(`${He} is being worked out as often as possible, resulting in `, muscleSpan);
 
 			if (V.nurseryMusclesSetting === 2) {
-				if (child.muscles < 100) {
-					child.muscles += 5;
+				const muscleSpan = App.UI.DOM.makeElement("span", `decreases the amount of exercise ${he} receives.`, "improvement");
+
+				if (child.muscles > 100) {
+					child.muscles -= 5;
 				}
-				div.append(`${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overly muscular and <span class="green">decreases ${his} steroid dosage.</span> `);
+
+				div.append(`${caretaker} notices ${he} is overly muscular and `, muscleSpan);
 			} else if (V.nurseryMusclesSetting === 1) {
-				if (child.muscles > 10) {
+				if (child.muscles < -10) {
+					const muscleSpan = App.UI.DOM.makeElement("span", `increases the amount of exercise ${he} receives.`, "improvement");
+
 					child.muscles--;
-					div.append(`${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is weak and <span class="green">increases ${his} steroid dosage.</span> `);
-				} else if (child.muscles < -10) {
+
+					div.append(`${caretaker} notices ${he} is weak and `, muscleSpan);
+				} else if (child.muscles > 10) {
+					const muscleSpan = App.UI.DOM.makeElement("span", 'a healthy musculature;', ["change", "positive"]);
+
 					child.muscles++;
-					div.append(`${He} has <span class="lime">a healthy musculature;</span> efforts will be made to maintain it. `);
+
+					div.append(`${He} has `, muscleSpan, ` efforts will be made to maintain it.`);
 				} else {
-					div.append(`${His} developing body <span class="red">quickly loses its gained muscle.</span> `);
+					const muscleSpan = App.UI.DOM.makeElement("span", 'quickly loses its gained muscle.', ["health", "dec"]);
+
+					div.append(`${His} developing body `, muscleSpan);
 				}
 			} else if (V.nurseryMusclesSetting === 0) {
-				if (child.muscles > -100) {
+				const muscleSpan = App.UI.DOM.makeElement("span", 'quickly loses its gained muscle.', ["health", "dec"]);
+
+				if (child.muscles > 100) {
 					child.muscles -= 40;
-					div.append(`${His} developing body <span class="red">quickly loses its gained muscle.</span> `);
+					div.append(`${His} developing body `, muscleSpan);
 				}
 			}
 		}
-- 
GitLab