From 783568ecdd86e8a07f424351c5ffbf0e2cff3355 Mon Sep 17 00:00:00 2001
From: LollipopScythe <lollipopscythe@protonmail.com>
Date: Fri, 6 Dec 2024 21:02:09 +0000
Subject: [PATCH 1/3] Fixed issue with the `prayerRoomEnd` widget allowing for
 the manipulation of tf traits

---
 .../04-Variables/variables-versionUpdate.twee |   8 +-
 game/base-system/transformations.twee         | 130 +++++++++++-------
 .../special-sydney/widgets.twee               |   6 +
 3 files changed, 95 insertions(+), 49 deletions(-)

diff --git a/game/04-Variables/variables-versionUpdate.twee b/game/04-Variables/variables-versionUpdate.twee
index a0dc1e32b3..daa478c4da 100644
--- a/game/04-Variables/variables-versionUpdate.twee
+++ b/game/04-Variables/variables-versionUpdate.twee
@@ -5717,5 +5717,11 @@
 	<<if $options.textAnimations is undefined>>
 		<<set $options.textAnimations to true>>
 	<</if>>
-	
+
+	/* Clear invalid transformation parts */
+	<<if $objectVersion.transformations lt 1 or !$objectVersion.transformations>>
+		<<clearAnimalTransformations>>
+		<<clearDivineTransformations>>
+		<<set $objectVersion.transformations to 1>>
+	<</if>>
 <</widget>>
diff --git a/game/base-system/transformations.twee b/game/base-system/transformations.twee
index 8485ae7053..ea0bac4e70 100644
--- a/game/base-system/transformations.twee
+++ b/game/base-system/transformations.twee
@@ -331,9 +331,11 @@
 						<<set $transformationParts.fallenAngel.wings to "hidden">>
 					<</if>>
 				<</if>>
-			<<case 99>>
-				<<set $specialTransform to 0>>
-				<<set $fallenangel to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $specialTransform to 0>>
+					<<set $fallenangel to 0>>
+				<</if>>
 				<<set $transformationParts.fallenAngel.halo to "disabled">>
 				<<set $transformationParts.fallenAngel.wings to "disabled">>
 		<</switch>>
@@ -433,15 +435,17 @@
 					<<set $transformationParts.angel.wings to "disabled">>
 					<br><br>
 				<</if>>
-			<<case 99>>
-				<<set $specialTransform to 0>>
-				<<set $angel to 0>>
-				<<set $angelbuild to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $specialTransform to 0>>
+					<<set $angel to 0>>
+					<<set $angelbuild to 0>>
+				<</if>>
 				<<set $transformationParts.angel.halo to "disabled">>
 				<<set $transformationParts.angel.wings to "disabled">>
 		<</switch>>
 	<<else>>
-		<<clearDivineTransformations>>
+		<<clearDivineTransformations true>>
 		<<set $specialTransform to 1>>
 		<<set $angel to 6>>
 		<<set $angelbuild to 50>>
@@ -540,17 +544,19 @@
 				<<else>>
 					<<set $demonFeat to true>>
 				<</if>>
-			<<case 99>>
-				<<set $specialTransform to 0>>
-				<<set $demon to 0>>
-				<<set $demonbuild to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $specialTransform to 0>>
+					<<set $demon to 0>>
+					<<set $demonbuild to 0>>
+				<</if>>
 				<<set $transformationParts.demon.horns to "disabled">>
 				<<set $transformationParts.demon.tail to "disabled">>
 				<<set $transformationParts.demon.wings to "disabled">>
 				<<set $transformationParts.traits.flaunting to "disabled">>
 		<</switch>>
 	<<else>>
-		<<clearDivineTransformations>>
+		<<clearDivineTransformations true>>
 		<<set $specialTransform to 1>>
 		<<set $demon to 6>>
 		<<set $demonbuild to 30>>
@@ -646,10 +652,12 @@
 					<<set $transformationParts.wolf.tail to "disabled">>
 					<br><br>
 				<</if>>
-			<<case 99>>
-				<<set $physicalTransform to 0>>
-				<<set $wolfgirl to 0>>
-				<<set $wolfbuild to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $physicalTransform to 0>>
+					<<set $wolfgirl to 0>>
+					<<set $wolfbuild to 0>>
+				<</if>>
 				<<set $transformationParts.traits.fangs to "disabled">>
 				<<set $transformationParts.wolf.cheeks to "disabled">>
 				<<set $transformationParts.wolf.ears to "disabled">>
@@ -658,7 +666,7 @@
 				<<set $transformationParts.wolf.tail to "disabled">>
 		<</switch>>
 	<<else>>
-		<<clearAnimalTransformations>>
+		<<clearAnimalTransformations true>>
 		<<set $physicalTransform to 1>>
 		<<set $wolfgirl to 6>>
 		<<set $wolfbuild to 100>>
@@ -796,17 +804,19 @@
 					<span class="gold">Your surroundings appear darker than before. </span>
 					<<set $cat to 9>>
 				<</if>>
-			<<case 99>>
-				<<set $physicalTransform to 0>>
-				<<set $cat to 0>>
-				<<set $catbuild to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $physicalTransform to 0>>
+					<<set $cat to 0>>
+					<<set $catbuild to 0>>
+				<</if>>
 				<<set $transformationParts.traits.fangs to "disabled">>
 				<<set $transformationParts.traits.sharpEyes to "disabled">>
 				<<set $transformationParts.cat.ears to "disabled">>
 				<<set $transformationParts.cat.tail to "disabled">>
 		<</switch>>
 	<<else>>
-		<<clearAnimalTransformations>>
+		<<clearAnimalTransformations true>>
 		<<set $physicalTransform to 1>>
 		<<set $cat to 6>>
 		<<set $catbuild to 100>>
@@ -914,18 +924,20 @@
 					<<set $transformationParts.cow.tail to "disabled">>
 					<br><br>
 				<</if>>
-			<<case 99>>
-				<<set $physicalTransform to 0>>
-				<<set $cow to 0>>
-				<<set $cowbuild to 0>>
-				<<set $semen_max to 3000>>
-				<<set $milk_max to 3000>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $physicalTransform to 0>>
+					<<set $cow to 0>>
+					<<set $cowbuild to 0>>
+					<<set $semen_max to 3000>>
+					<<set $milk_max to 3000>>
+				<</if>>
 				<<set $transformationParts.cow.tail to "disabled">>
 				<<set $transformationParts.cow.ears to "disabled">>
 				<<set $transformationParts.cow.horns to "disabled">>
 		<</switch>>
 	<<else>>
-		<<clearAnimalTransformations>>
+		<<clearAnimalTransformations true>>
 		<<set $physicalTransform to 1>>
 		<<set $cow to 6>>
 		<<set $cowbuild to 100>>
@@ -1055,10 +1067,12 @@
 					<</if>>
 					<br><br>
 				<</if>>
-			<<case 99>>
-				<<set $physicalTransform to 0>>
-				<<set $harpy to 0>>
-				<<set $birdbuild to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $physicalTransform to 0>>
+					<<set $harpy to 0>>
+					<<set $birdbuild to 0>>
+				<</if>>
 				<<set $transformationParts.bird.eyes to "disabled">>
 				<<set $transformationParts.bird.malar to "disabled">>
 				<<set $transformationParts.bird.tail to "disabled">>
@@ -1080,7 +1094,7 @@
 				<</if>>
 		<</switch>>
 	<<else>>
-		<<clearAnimalTransformations>>
+		<<clearAnimalTransformations true>>
 		<<set $physicalTransform to 1>>
 		<<set $harpy to 6>>
 		<<set $birdbuild to 100>>
@@ -1199,10 +1213,12 @@
 					<<set $transformationParts.fox.tail to "disabled">>
 					<br><br>
 				<</if>>
-			<<case 99>>
-				<<set $physicalTransform to 0>>
-				<<set $fox to 0>>
-				<<set $foxbuild to 0>>
+			<<case 99 100>>
+				<<if _args[0] is 100>>
+					<<set $physicalTransform to 0>>
+					<<set $fox to 0>>
+					<<set $foxbuild to 0>>
+				<</if>>
 				<<set $transformationParts.traits.fangs to "disabled">>
 				<<set $transformationParts.traits.sharpEyes to "disabled">>
 				<<set $transformationParts.traits.mateForLife to "disabled">>
@@ -1211,7 +1227,7 @@
 				<<set $transformationParts.fox.tail to "disabled">>
 		<</switch>>
 	<<else>>
-		<<clearAnimalTransformations>>
+		<<clearAnimalTransformations true>>
 		<<set $physicalTransform to 1>>
 		<<set $fox to 6>>
 		<<set $foxbuild to 100>>
@@ -1225,15 +1241,33 @@
 <</widget>>
 
 <<widget "clearAnimalTransformations">>
-	<<harpyTransform 99>>
-	<<cowTransform 99>>
-	<<catTransform 99>>
-	<<wolfTransform 99>>
-	<<foxTransform 99>>
+	/* Provide arg to clear all tf data */
+	<<if _args[0]>>
+		<<harpyTransform 100>>
+		<<cowTransform 100>>
+		<<catTransform 100>>
+		<<wolfTransform 100>>
+		<<foxTransform 100>>
+	<<else>>
+		/* Clears invalid $transformationParts variables */
+		<<if !$harpy>><<harpyTransform 99>><</if>>
+		<<if !$cow>><<cowTransform 99>><</if>>
+		<<if !$cat>><<catTransform 99>><</if>>
+		<<if !$wolfgirl>><<wolfTransform 99>><</if>>
+		<<if !$fox>><<foxTransform 99>><</if>>
+	<</if>>
 <</widget>>
 
 <<widget "clearDivineTransformations">>
-	<<demonTransform 99>>
-	<<angelTransform 99>>
-	<<fallenButNotOut 99>>
+	/* Provide arg to clear all tf data */
+	<<if _args[0]>>
+		<<demonTransform 100>>
+		<<angelTransform 100>>
+		<<fallenButNotOut 100>>
+	<<else>>
+		/* Clears invalid $transformationParts variables */
+		<<if !$demon>><<demonTransform 99>><</if>>
+		<<if !$angel>><<angelTransform 99>><</if>>
+		<<if !$fallenangel>><<fallenButNotOut 99>><</if>>
+	<</if>>
 <</widget>>
diff --git a/game/overworld-town/special-sydney/widgets.twee b/game/overworld-town/special-sydney/widgets.twee
index 972f8f1e4e..1b999cf8bf 100644
--- a/game/overworld-town/special-sydney/widgets.twee
+++ b/game/overworld-town/special-sydney/widgets.twee
@@ -1411,6 +1411,7 @@
 		angel: $angel,
 		angelbuild: $angelbuild,
 		fallenangel: $fallenangel,
+		demon: $demon,
 		transformationParts: $transformationParts,
 		purity: $purity,
 		trauma: $trauma,
@@ -1423,10 +1424,15 @@
     <<set $angel to $defileSacredGroundStore.angel>>
     <<set $angelbuild to $defileSacredGroundStore.angelbuild>>
     <<set $fallenangel to $defileSacredGroundStore.fallenangel>>
+    <<if $defileSacredGroundStore.demon isnot undefined>><<set $demon to $defileSacredGroundStore.demon>><</if>>
     <<set $transformationParts to clone($defileSacredGroundStore.transformationParts)>>
     <<set $purity to $defileSacredGroundStore.purity>>
     <<set $trauma to $defileSacredGroundStore.trauma>>
 
+	/* Clear invalid beast transformation parts due to the manipulation of $transformationParts */
+	<<clearAnimalTransformations>>
+	<<clearDivineTransformations>>
+
 	<<unset $defileSacredGroundStore>>
 
 	<<endcombat>> /* legacy support for saves updated mid combat */
-- 
GitLab


From 4ac1867393f0c2e0a5b6f46743203327f4f9a163 Mon Sep 17 00:00:00 2001
From: LollipopScythe <lollipopscythe@protonmail.com>
Date: Sun, 8 Dec 2024 16:08:45 +0000
Subject: [PATCH 2/3] Removed unintended stat changes when drinking your own
 milk

---
 game/base-system/widgets.twee | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/game/base-system/widgets.twee b/game/base-system/widgets.twee
index a02018ec0c..4272121086 100644
--- a/game/base-system/widgets.twee
+++ b/game/base-system/widgets.twee
@@ -3864,18 +3864,22 @@
 
 <<widget "breastfed">>
 	<<set $milk_drank_stat += _args[0] or random(1, 5)>>
-	<<if random(1, 100) gte 70>>
-		<<if $NPCList[0].type and $NPCList[0].type is "wolfgirl">>
-			<<transform wolf 1>>
-		<<elseif $NPCList[0].type and $NPCList[0].type is "foxgirl">>
-			<<transform fox 1>>
-		<<else>>
-			<<transform cat 1>>
+	<<if _args[0]>>
+		<<set $hunger -= _args[0]>><<set $thirst -= _args[0]>>
+	<<else>>
+		<<if random(1, 100) gte 70>>
+			<<if $NPCList[0].type and $NPCList[0].type is "wolfgirl">>
+				<<transform wolf 1>>
+			<<elseif $NPCList[0].type and $NPCList[0].type is "foxgirl">>
+				<<transform fox 1>>
+			<<else>>
+				<<transform cat 1>>
+			<</if>>
 		<</if>>
+		<<if $milkdranktrait is 1>><<physique 1>><</if>>
+		<<purity -1>>
+		<<set $hunger -= 200>><<set $thirst -= 200>>
 	<</if>>
-	<<if $milkdranktrait is 1>><<physique 1>><</if>>
-	<<purity -1>>
-	<<set $hunger -= 200>><<set $thirst -= 200>>
 <</widget>>
 
 <<widget "nectarfed">>
-- 
GitLab


From 5a435eed8ca80442dfcb51ad7d465d0462fa76b5 Mon Sep 17 00:00:00 2001
From: LollipopScythe <lollipopscythe@protonmail.com>
Date: Sun, 8 Dec 2024 17:57:25 +0000
Subject: [PATCH 3/3] Changed the versiondate code to use `$tfFix` instead

---
 game/04-Variables/variables-versionUpdate.twee | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/game/04-Variables/variables-versionUpdate.twee b/game/04-Variables/variables-versionUpdate.twee
index a6084fd1d4..f9484ac1cc 100644
--- a/game/04-Variables/variables-versionUpdate.twee
+++ b/game/04-Variables/variables-versionUpdate.twee
@@ -4339,7 +4339,7 @@
 	<</if>>
 
 	<!-- Fixing broken transformation stuff -->
-	<<if $tfFIX is undefined or $tfFIX lte 1>>
+	<<if $tfFIX is undefined or $tfFIX lte 2>>
 		<<if $tfFIX is undefined>>
 			<!-- V0.4.0.5 repair transformationParts object after damage from mid-prayer room or nightmare saves -->
 			<<if $transformationParts.fox is undefined>>
@@ -4407,8 +4407,13 @@
 				<<fallenTransform>>
 			<</if>>
 		<</if>>
-
-		<<set $tfFIX to 2>>
+		
+		/* <!-- 0.5.3.0 Clear invalid transformation parts */
+		<<if $tfFIX is undefined or $tfFIX lte 2>>
+			<<clearAnimalTransformations>>
+			<<clearDivineTransformations>>
+		<</if>>
+		<<set $tfFIX to 3>>
 	<</if>>
 
 	<!-- V0.4.0.5 Old saves with untyped named NPCs -->
@@ -5715,10 +5720,4 @@
 		<<set $options.combatAnimations to true>>
 	<</if>>
 
-	/* Clear invalid transformation parts */
-	<<if $objectVersion.transformations lt 1 or !$objectVersion.transformations>>
-		<<clearAnimalTransformations>>
-		<<clearDivineTransformations>>
-		<<set $objectVersion.transformations to 1>>
-	<</if>>
 <</widget>>
-- 
GitLab