From d42b5fbb84b26079b3c96afe42315b004c23bb64 Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Thu, 23 Jul 2020 23:24:41 -0400
Subject: [PATCH] Refactored child grow time

---
 .../nursery/reports/childrenReport.js         | 23 +++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/facilities/nursery/reports/childrenReport.js b/src/facilities/nursery/reports/childrenReport.js
index bfcc5dc3dfa..d034fd0aa3a 100644
--- a/src/facilities/nursery/reports/childrenReport.js
+++ b/src/facilities/nursery/reports/childrenReport.js
@@ -13,14 +13,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 		r = [];
 
 	for (const child of V.cribs) {
-		const
-			{ he, his, He, His } = getPronouns(child);
-
-		if (child.growTime > 0) {
-			r.push(`<span class="pink">${child.slaveName}</span> is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}.`);
-		} else {
-			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.`);
-		}
+		r.push(childGrowTime(child));
 
 		if (child.actualAge >= 3) {
 			if (Matron) {
@@ -78,6 +71,16 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 		}
 	}
 
+	function childGrowTime(child) {
+		const { He } = getPronouns(child);
+
+		if (child.growTime > 0) {
+			return `<span class="pink">${child.slaveName}</span> is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}.`;
+		} else {
+			return `<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 relation checks
 	function childFriendshipRivalries() {
 		for (const target of V.cribs) {	// alias for second child
@@ -157,7 +160,9 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 	// MARK: Matron Effects
 
 	function matronFetishEffects() {
-		const chance = jsRandom(1, 100);
+		const
+			{ He } = getPronouns(child),
+			chance = jsRandom(1, 100);
 
 		if (Matron.fetish !== "none") {
 			if (chance > 90) {
-- 
GitLab