From 6c53c5556b003f7b4fc05245596dcb87255a891b Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Tue, 5 Jan 2021 04:24:03 -0500
Subject: [PATCH] Fetish changing function changes

---
 src/endWeek/endWeekUtils.js      | 12 ++++++++++++
 src/endWeek/saSharedVariables.js |  2 ++
 src/js/utilsSlave.js             |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 src/endWeek/endWeekUtils.js

diff --git a/src/endWeek/endWeekUtils.js b/src/endWeek/endWeekUtils.js
new file mode 100644
index 00000000000..58bfb027c08
--- /dev/null
+++ b/src/endWeek/endWeekUtils.js
@@ -0,0 +1,12 @@
+/**
+ * Sets slave's fetish
+ * @param {App.Entity.SlaveState} slave
+ * @param {string} fetish
+ * @param {int} strength
+ */
+globalThis.fetishChange = function(slave, fetish, strength = 65) {
+	slave.fetish = fetish;
+	slave.fetishStrength = strength;
+	slave.fetishKnown = 1;
+	App.EndWeek.saVars.fetishChanged = 1;
+};
\ No newline at end of file
diff --git a/src/endWeek/saSharedVariables.js b/src/endWeek/saSharedVariables.js
index 67d1dbc0bd7..8186fe68787 100644
--- a/src/endWeek/saSharedVariables.js
+++ b/src/endWeek/saSharedVariables.js
@@ -45,6 +45,8 @@ App.EndWeek.SASharedVariables = class {
 		this.pornFameBonus = 1;
 		/** Used to condense all the possible galactorrhea lactation start points to a single line of text in saLongTermPhysicalEffects. */
 		this.inappropriateLactation = 0;
+		/** Used limit a slave to a single fetish change per week. */
+		this.fetishChanged = 0;
 		/** TODO: move V.slaveUsedRest here after saRules is converted, and find others */
 	}
 
diff --git a/src/js/utilsSlave.js b/src/js/utilsSlave.js
index 08c031f8578..ab9b7c85dcf 100644
--- a/src/js/utilsSlave.js
+++ b/src/js/utilsSlave.js
@@ -2070,7 +2070,7 @@ globalThis.fetishChangeChance = function(slave) {
 		fetish = (slave.fetishStrength / 4),
 		sex = 0;
 
-	if (slave.clitSetting !== slave.fetish) {
+	if (slave.clitSetting !== slave.fetish && App.EndWeek.saVars.fetishChanged !== 1) {
 		// fetish should be more uncertain leading towards puberty and then steadily become more set in stone afterwards
 		if (slave.balls) {
 			if (V.potencyAge >= slave.actualAge) {
-- 
GitLab