From b6458e059fe4e4e2a2320bdb54facb16a217e67b Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Thu, 22 Oct 2020 20:23:33 -0400
Subject: [PATCH] retire

---
 src/endWeek/economics/arcmgmt.js | 62 +++++++++++++++++---------------
 1 file changed, 33 insertions(+), 29 deletions(-)

diff --git a/src/endWeek/economics/arcmgmt.js b/src/endWeek/economics/arcmgmt.js
index 56ca9e03ce7..7e04d58cc66 100644
--- a/src/endWeek/economics/arcmgmt.js
+++ b/src/endWeek/economics/arcmgmt.js
@@ -123,35 +123,7 @@ globalThis.arcmgmt = function() {
 	_middleClass += (schoolSubsidy) * 40;
 	_middleClass *= 1 + (schoolSubsidy) * 0.005;
 
-	/* Slave retirement trigger pulled (one time only)*/
-	if (V.citizenRetirementTrigger === 1) {
-		r= [];
-		if (V.customMenialRetirementAge >= 65) {
-			_citizenRetirementImpact = 0.475 - Math.clamp(V.customMenialRetirementAge / 200, 0.325, 0.475);
-		} else {
-			_citizenRetirementImpact = 0.9 - Math.clamp(V.customMenialRetirementAge / 100, 0.2, 0.65);
-		}
-		if (V.arcologies[0].FSSupremacistLawME + V.arcologies[0].FSSubjugationistLawME > 0) {
-			_citizenRetirementImpact *= 2 / 3;
-		}
-		V.lowerClass += Math.trunc((V.NPCSlaves + V.menials) * (0.05 + _citizenRetirementImpact));
-		_menialsRetirement = Math.trunc(V.menials * (0.05 + _citizenRetirementImpact));
-		V.menials = Math.trunc(V.menials * (0.95 - _citizenRetirementImpact));
-		_ASlavesRetirement = Math.trunc(V.NPCSlaves * (0.05 + _citizenRetirementImpact));
-		V.NPCSlaves = Math.trunc(V.NPCSlaves * (0.95 - _citizenRetirementImpact));
-		V.citizenRetirementTrigger = 2;
-		r.push(`You have enacted citizen retirement, the slaves of eligible age are granted freedom.`);
-		if (_menialsRetirement > 1) {
-			r.push(`<span class="red">${_menialsRetirement} of your menial slaves</span> were retired.`);
-		} else if (_menialsRetirement > 0) {
-			r.push(`<span class="red">One of your menial slaves</span> was retired.`);
-		}
-		if (_ASlavesRetirement > 1) {
-			r.push(`<span class="red">${_ASlavesRetirement} slaves</span> in your arcology were given a citizen retirement.`);
-		}
-		/* I could bother with a single slave retirement message, but that's never going to get used*/
-		App.Events.addParagraph(el, r);
-	}
+	slaveRetirement();
 
 	expiration();
 
@@ -2214,6 +2186,38 @@ globalThis.arcmgmt = function() {
 		}
 	}
 
+	function slaveRetirement() {
+		const r =[];
+		/* Slave retirement trigger pulled (one time only)*/
+		if (V.citizenRetirementTrigger === 1) {
+			if (V.customMenialRetirementAge >= 65) {
+				_citizenRetirementImpact = 0.475 - Math.clamp(V.customMenialRetirementAge / 200, 0.325, 0.475);
+			} else {
+				_citizenRetirementImpact = 0.9 - Math.clamp(V.customMenialRetirementAge / 100, 0.2, 0.65);
+			}
+			if (V.arcologies[0].FSSupremacistLawME + V.arcologies[0].FSSubjugationistLawME > 0) {
+				_citizenRetirementImpact *= 2 / 3;
+			}
+			V.lowerClass += Math.trunc((V.NPCSlaves + V.menials) * (0.05 + _citizenRetirementImpact));
+			_menialsRetirement = Math.trunc(V.menials * (0.05 + _citizenRetirementImpact));
+			V.menials = Math.trunc(V.menials * (0.95 - _citizenRetirementImpact));
+			_ASlavesRetirement = Math.trunc(V.NPCSlaves * (0.05 + _citizenRetirementImpact));
+			V.NPCSlaves = Math.trunc(V.NPCSlaves * (0.95 - _citizenRetirementImpact));
+			V.citizenRetirementTrigger = 2;
+			r.push(`You have enacted citizen retirement, the slaves of eligible age are granted freedom.`);
+			if (_menialsRetirement > 1) {
+				r.push(`<span class="red">${_menialsRetirement} of your menial slaves</span> were retired.`);
+			} else if (_menialsRetirement > 0) {
+				r.push(`<span class="red">One of your menial slaves</span> was retired.`);
+			}
+			if (_ASlavesRetirement > 1) {
+				r.push(`<span class="red">${_ASlavesRetirement} slaves</span> in your arcology were given a citizen retirement.`);
+			}
+			/* I could bother with a single slave retirement message, but that's never going to get used*/
+		}
+		App.Events.addParagraph(el, r);
+	}
+
 	function expiration() {
 		const r = [];
 		/* Slave expiration*/
-- 
GitLab