From a9ba9b815f56d6d085855df78450a4e5294c12e4 Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Thu, 23 Jul 2020 22:52:00 -0400
Subject: [PATCH] Refactored matron and nanny fetish effects

---
 .../nursery/reports/childrenReport.js         | 106 +++++++++---------
 1 file changed, 54 insertions(+), 52 deletions(-)

diff --git a/src/facilities/nursery/reports/childrenReport.js b/src/facilities/nursery/reports/childrenReport.js
index fd4a968a3cc..4a749e45c5c 100644
--- a/src/facilities/nursery/reports/childrenReport.js
+++ b/src/facilities/nursery/reports/childrenReport.js
@@ -17,64 +17,23 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 			{ he, his, He, His } = getPronouns(child);
 
 		if (child.growTime > 0) {
-			r += `<br><span class="pink">${child.slaveName}</span> is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}. `;
+			r.push(`<span class="pink">${child.slaveName}</span> is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}.`);
 		} else {
-			r += `<span class="pink">${child.slaveName}</span> is <span class="lime">ready for release.</span> ${He} will be removed from ${V.nurseryName} upon your approach.`;
+			r.push(`<span class="pink">${child.slaveName}</span> is <span class="lime">ready for release.</span> ${He} will be removed from ${V.nurseryName} upon your approach.`);
 		}
 
 		// TODO: add Matron and nanny effects
 		if (child.actualAge >= 3) {
-			if (Matron || NL) {
-				let chance = jsRandom(1, 100);
-
-				if (jsDef(Matron)) {
-					if (Matron.fetish !== "none") {
-						if (chance > 90) {
-							if (child.fetish === "none") {
-								r.push(`${child.slaveName} has taken a few cues from ${Matron.slaveName}, and ${newChildFetish(child.fetish)}.`);
-
-								child.fetish = Matron.fetish;
-							} else {
-								if (chance > 95) {
-									r.push(`${Matron.slaveName} has rubbed off on ${child.slaveName}, in more ways than one. ${He} ${newChildFetish(child.fetish)}.`);
-
-									child.fetish = Matron.fetish;
-								}
-							}
-						}
-					}
-				}
-
-				if (nannies) {
-					for (const slave of nannies) {
-						if (slave.fetish !== "none") {
-							if (chance > 85) {
-								if (child.fetish === "none") {
-									r.push(`${slave.slaveName} has left quite an impression on ${child.slaveName}, and ${he} ${newChildFetish(child.fetish)}.`);
-
-									child.fetish = slave.fetish;
-								} else {
-									if (chance > 90) {
-										r.push(`${child.slaveName} seems to have taken to ${slave.slaveName}'s example, and ${newChildFetish(child.fetish)}.`);
-
-										child.fetish = slave.fetish;
-									}
-								}
-							}
-						}
-					}
-				}
-
-				// TODO: expand education system
-				if (Matron) {
-					matronEducationEffects();
-					matronFitnessEffects();
-				}
+			if (Matron) {
+				matronFetishEffects();
+				matronEducationEffects();
+				matronFitnessEffects();
+			}
 
-				if (nannies) {
-					nannyEducationEffects();
-					nannyFitnessEffects();
-				}
+			if (nannies) {
+				nannyEducationEffects();
+				nannyFitnessEffects();
+				nannyFetishEffects();
 			}
 
 			// TODO: add friend / rivalry system
@@ -241,7 +200,28 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 
 	// MARK: Matron Effects
 
+	function matronFetishEffects() {
+		const chance = jsRandom(1, 100);
+
+		if (Matron.fetish !== "none") {
+			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;
+
+						return `${Matron.slaveName} has rubbed off on ${child.slaveName}, in more ways than one. ${He} ${newChildFetish(child.fetish)}.`;
+					}
+				}
+			}
+		}
+	}
+
 	function matronEducationEffects() {
+		// TODO: expand this
 		const
 			{ he2, him2, his2 } = getPronouns(Matron).appendSuffix('2'),
 
@@ -275,7 +255,29 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 
 	// MARK: Nanny Effects
 
+	function nannyFetishEffects() {
+		for (const slave of nannies) {
+			if (slave.fetish !== "none") {
+				if (chance > 85) {
+					if (child.fetish === "none") {
+						child.fetish = slave.fetish;
+
+						return `${slave.slaveName} has left quite an impression on ${child.slaveName}, and ${he} ${newChildFetish(child.fetish)}.`;
+					} else {
+						if (chance > 90) {
+							child.fetish = slave.fetish;
+
+							return `${child.slaveName} seems to have taken to ${slave.slaveName}'s example, and ${newChildFetish(child.fetish)}.`;
+						}
+					}
+				}
+			}
+		}
+	}
+
 	function nannyEducationEffects() {
+		// TODO: expand this
+
 		let
 			averageIntelligence = 0,
 			averageIntelligenceImplant = 0;
-- 
GitLab