From 96734e69a64e190dcd981638b2a6bb72347b32db Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Thu, 23 Jul 2020 23:13:55 -0400
Subject: [PATCH] Refactored nursery muscles rules effects

---
 .../nursery/reports/childrenReport.js         | 64 +++++++++++--------
 1 file changed, 36 insertions(+), 28 deletions(-)

diff --git a/src/facilities/nursery/reports/childrenReport.js b/src/facilities/nursery/reports/childrenReport.js
index a79b86d1ba5..41741f55aaf 100644
--- a/src/facilities/nursery/reports/childrenReport.js
+++ b/src/facilities/nursery/reports/childrenReport.js
@@ -40,34 +40,9 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 			}
 
 			// TODO: rework these entirely
-			if (Matron || NL) {
-
-
-				// TODO: rewrite these
-				if (V.nurseryMuscles) {
-					r += `${He} is being given anabolic steroids causing <span class="green">rapid muscle development.</span> `;	// TODO: not happy with this
-					if (V.nurseryMusclesSetting === 2) {
-						if (child.muscles < 100) {
-							child.muscles += 5;
-						}
-						r += `${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overly muscular and <span class="green">decreases ${his} steroid dosage.</span> `;
-					} else if (V.nurseryMusclesSetting === 1) {
-						if (child.muscles > 10) {
-							child.muscles--;
-							r += `${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) {
-							child.muscles++;
-							r += `${He} has <span class="lime">a healthy musculature;</span> efforts will be made to maintain it. `;
-						} else {
-							r += `${His} developing body <span class="red">quickly loses its gained muscle.</span> `;
-						}
-					} else if (V.nurseryMusclesSetting === 0) {
-						if (child.muscles > -100) {
-							child.muscles -= 40;
-							r += `${His} developing body <span class="red">quickly loses its gained muscle.</span> `;
-						}
-					}
-				}
+			if (Matron || nannies) {
+				r.push(weightRulesEffects());
+				r.push(musclesRulesEffects());
 			}
 		} else {
 			// TODO:
@@ -342,5 +317,38 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 		return r.join(' ');
 	}
 
+	function musclesRulesEffects() {
+		let r = [];
+
+		// TODO: rewrite these
+		if (V.nurseryMuscles) {
+			r.push(`${He} is being given anabolic steroids causing <span class="green">rapid muscle development.</span> `);	// TODO: not happy with this
+
+			if (V.nurseryMusclesSetting === 2) {
+				if (child.muscles < 100) {
+					child.muscles += 5;
+				}
+				r.push(`${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overly muscular and <span class="green">decreases ${his} steroid dosage.</span> `);
+			} else if (V.nurseryMusclesSetting === 1) {
+				if (child.muscles > 10) {
+					child.muscles--;
+					r.push(`${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) {
+					child.muscles++;
+					r.push(`${He} has <span class="lime">a healthy musculature;</span> efforts will be made to maintain it. `);
+				} else {
+					r.push(`${His} developing body <span class="red">quickly loses its gained muscle.</span> `);
+				}
+			} else if (V.nurseryMusclesSetting === 0) {
+				if (child.muscles > -100) {
+					child.muscles -= 40;
+					r.push(`${His} developing body <span class="red">quickly loses its gained muscle.</span> `);
+				}
+			}
+		}
+
+		return r.join(' ');
+	}
+
 	return r.join(' ');
 };
-- 
GitLab