From 694513d3942f4a042f71702ab9108845bf99dffe Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Sat, 28 Mar 2020 18:27:01 -0400
Subject: [PATCH] Tiredness money effects

---
 src/endWeek/healthFunctions.js | 29 +++++++++++++++++++++++------
 src/js/economyJS.js            |  3 +--
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/src/endWeek/healthFunctions.js b/src/endWeek/healthFunctions.js
index ce11266bc87..130edf9dd42 100644
--- a/src/endWeek/healthFunctions.js
+++ b/src/endWeek/healthFunctions.js
@@ -636,14 +636,32 @@ window.tired = function tired(slave) {
 	}
 };
 
+/**
+ * @param {App.Entity.SlaveState} slave
+ * @returns {number}
+ */
+window.restEffects = function restEffects(slave) {
+	if (!slave.fuckdoll) {
+		if (slave.assignment === "work a glory hole") {
+			if (slave.rules.rest === "mandatory") {
+				return .86;
+			} else if (slaveResting(slave)) {
+				return .25;
+			} else if (slave.tired + 20 >= 90 && !willWorkToDeath(slave)) {
+				return .10;
+			}
+		}
+	}
+	return 1;
+};
+
 /**
  * @param {App.Entity.SlaveState} slave
  * @returns {void}
  */
 window.tiredFucks = function tiredFucks(slave) {
-	/* temp disable
-	if (!slave.fuckdoll && slave.fetish !== "mindbroken") {
-		if (slave.assignment === "work a glory hole" || slave.assignment === "be confined in the arcade") {
+	if (!slave.fuckdoll) {
+		if (slave.assignment === "work a glory hole") {
 			let acceptance = 0;
 			acceptance += Math.trunc(slave.energy / 10);
 			acceptance -= Math.trunc((slave.intelligence + slave.intelligenceImplant) / 10);
@@ -655,9 +673,8 @@ window.tiredFucks = function tiredFucks(slave) {
 			} else {
 				slave.health.tired += Math.trunc(slave.sexAmount * (1 + normalRandInt(0, 5) / 100) / 50);
 			}
-		} else {
+		} /*else {
 			slave.health.tired += Math.trunc(slave.sexAmount * (1 + normalRandInt(0, 5) / 100) / 25);
-		}
+		}*/
 	}
-	*/
 };
diff --git a/src/js/economyJS.js b/src/js/economyJS.js
index d46d72ced25..f80375f3e8c 100644
--- a/src/js/economyJS.js
+++ b/src/js/economyJS.js
@@ -1655,7 +1655,7 @@ window.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDemandRef
 	// Glory hole slaves adding to 'arcade'
 	V.JobIDArray["work a glory hole"].forEach(ID => {
 		const s = V.slaves[V.slaveIndices[ID]];
-		s.sexAmount = Math.trunc((normalRandInt(600, 20) + (4 - s.anus) * 10 + (4 - s.vagina) * 10 + Math.trunc(s.health.condition / 2)) * 0.75);
+		s.sexAmount = Math.trunc(restEffects(s) * ((normalRandInt(600, 20) + (4 - s.anus) * 10 + (4 - s.vagina) * 10 + Math.trunc(s.health.condition / 2)) * 0.75));
 		tiredFucks(s);
 		slaveJobValues.arcade += s.sexAmount;
 	});
@@ -1664,7 +1664,6 @@ window.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDemandRef
 	V.ArcadeiIDs.forEach(ID => {
 		const s = V.slaves[V.slaveIndices[ID]];
 		s.sexAmount = (normalRandInt(600, 20) + (4 - (s.anus - 2 * V.arcadeUpgradeInjectors)) * 10 + (4 - (s.vagina - 2 * V.arcadeUpgradeInjectors)) * 10 + Math.trunc(s.health.condition / 2));
-		tiredFucks(s);
 		slaveJobValues.arcade += s.sexAmount;
 	});
 
-- 
GitLab