From 08dbf9a17da19f6f9214da09747c4744f263c9c2 Mon Sep 17 00:00:00 2001
From: Jones <Jones>
Date: Mon, 27 Jan 2020 13:05:52 +0100
Subject: [PATCH] spa clinic entry conditions

---
 src/facilities/clinic/clinicFramework.js | 2 +-
 src/facilities/spa/spaFramework.js       | 2 +-
 src/uncategorized/clinicReport.tw        | 7 +++++--
 src/uncategorized/spaReport.tw           | 4 ++--
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/facilities/clinic/clinicFramework.js b/src/facilities/clinic/clinicFramework.js
index 483705b3e8b..67700532b72 100644
--- a/src/facilities/clinic/clinicFramework.js
+++ b/src/facilities/clinic/clinicFramework.js
@@ -41,7 +41,7 @@ App.Entity.Facilities.ClinicPatientJob = class extends App.Entity.Facilities.Fac
 	checkRequirements(slave) {
 		let r = super.checkRequirements(slave);
 
-		if ((slave.health.illness < 2 && slave.health.shortDamage < 20) &&
+		if ((slave.health.illness < 2 && slave.health.shortDamage < 20 && slave.health.condition >= 20) &&
 			(V.Nurse === 0 || ((slave.chem <= 15 || this.facility.upgrade("Filters") !== 1) &&
 				(V.bellyImplants !== 1 || slave.bellyImplant <= -1) &&
 				(slave.pregKnown !== 1 || (this.facility.option("SpeedGestation") <= 0 && slave.pregControl !== "speed up")) && (slave.pregAdaptation * 1000 >= slave.bellyPreg && slave.preg <= slave.pregData.normalBirth / 1.33)))) {
diff --git a/src/facilities/spa/spaFramework.js b/src/facilities/spa/spaFramework.js
index c1e5f8eccc1..6ae00525ec4 100644
--- a/src/facilities/spa/spaFramework.js
+++ b/src/facilities/spa/spaFramework.js
@@ -46,7 +46,7 @@ App.Entity.Facilities.SpaAssigneeJob = class extends App.Entity.Facilities.Facil
 			(
 				slave.devotion < -20 ||
 				(
-					slave.health.condition >= 50 &&
+					slave.health.condition >= 60 &&
 					slave.health.tired < 20 &&
 					slave.trust > 60 &&
 					slave.devotion > 60 &&
diff --git a/src/uncategorized/clinicReport.tw b/src/uncategorized/clinicReport.tw
index b036c869409..3b8df01cb86 100644
--- a/src/uncategorized/clinicReport.tw
+++ b/src/uncategorized/clinicReport.tw
@@ -293,6 +293,7 @@
 	<</if>>
 	<<if ($slaves[$i].health.illness > 1)>> /* keeping a slave in the clinic for a level 1 illness is hardly worth it */
 	<<elseif ($slaves[$i].health.shortDamage >= 20)>> /* shortDamage does no real harm, until it gets to 20 */
+	<<elseif ($slaves[$i].health.condition >= 40)>>
 	<<elseif ($Nurse != 0) && ($slaves[$i].chem > 15) && ($clinicUpgradeFilters == 1)>>
 	<<elseif ($Nurse != 0) && ($slaves[$i].pregKnown == 1) && ($clinicSpeedGestation > 0 || $slaves[$i].pregControl == "speed up")>>
 	<<elseif ($Nurse != 0) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
@@ -340,10 +341,12 @@
 			is receiving treatment in $clinicName.
 		<</if>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= saRest($slaves[$i])>>
-		<<if ($slaves[$i].health.illness > 0)>>
+		<<if ($slaves[$i].health.illness > 1)>>
 			$He stays in the clinic since $he is still sick.
-		<<elseif ($slaves[$i].health.condition <= 40)>>
+		<<elseif ($slaves[$i].health.condition < 20)>>
 			$He stays in the clinic since $his health is still poor.
+		<<elseif ($slaves[$i].health.shortDamage >= 20)>>
+			$He stays in the clinic to recover from $his injuries.
 		<<elseif ($Nurse != 0) && ($slaves[$i].chem > 15) && ($clinicUpgradeFilters == 1)>>
 			$He stays in the clinic as unhealthy chemicals are still being flushed from $his system.
 		<<elseif ($Nurse != 0) && ($slaves[$i].pregKnown == 1) && ($clinicSpeedGestation > 0 || $slaves[$i].pregControl == "speed up")>>
diff --git a/src/uncategorized/spaReport.tw b/src/uncategorized/spaReport.tw
index 40326adbf1d..45ce162199e 100644
--- a/src/uncategorized/spaReport.tw
+++ b/src/uncategorized/spaReport.tw
@@ -287,7 +287,7 @@
 	<<default>>
 		<<set $slaves[$i].rules.living = "luxurious">>
 	<</switch>>
-	<<if ($slaves[$i].health.condition >= 50) && ($slaves[$i].health.tired < 20) && ($slaves[$i].trust > 60) && ($slaves[$i].devotion > 60) && ($slaves[$i].fetish != "mindbroken") && ($slaves[$i].sexualFlaw == "none") && ($slaves[$i].behavioralFlaw == "none")>>
+	<<if ($slaves[$i].health.condition >= 60) && ($slaves[$i].health.tired < 20) && ($slaves[$i].trust > 60) && ($slaves[$i].devotion > 60) && ($slaves[$i].fetish != "mindbroken") && ($slaves[$i].sexualFlaw == "none") && ($slaves[$i].behavioralFlaw == "none")>>
 		<p>
 			<span class="slave-name">$slaves[$i].slaveName</span> is feeling well enough to leave $spaName,
 			<span class="noteworthy">
@@ -336,7 +336,7 @@
 			$He remains in the Spa, stubborn in $his flaw.
 		<<elseif ($slaves[$i].trust < 60) || ($slaves[$i].devotion < 60)>>
 			$He remains in the Spa, as $he is still learning to accept life as a slave.
-		<<elseif ($slaves[$i].health.condition < 20)>>
+		<<elseif ($slaves[$i].health.condition < 60)>>
 			$He remains in the Spa, as $his health is still low.
 		<</if>>
 		<br>&nbsp;&nbsp;&nbsp;
-- 
GitLab