From fc89efd7256cf80b597bfe3e97a02c09a3f93395 Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Sat, 17 Mar 2018 03:32:07 -0400
Subject: [PATCH] cleanup

---
 devNotes/VersionChangeLog-Premod+LoliMod.txt | 10 +++++++
 devNotes/twine JS                            | 29 ++++++++++++++++----
 src/uncategorized/remoteSurgery.tw           |  6 ++--
 src/uncategorized/slaveInteract.tw           |  2 +-
 src/utility/miscWidgets.tw                   |  2 +-
 src/utility/raWidgets.tw                     | 12 ++++----
 6 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/devNotes/VersionChangeLog-Premod+LoliMod.txt b/devNotes/VersionChangeLog-Premod+LoliMod.txt
index ba41ee437a5..da4b4707c53 100644
--- a/devNotes/VersionChangeLog-Premod+LoliMod.txt
+++ b/devNotes/VersionChangeLog-Premod+LoliMod.txt
@@ -2,6 +2,16 @@
 
 0.10.7.0/1
 
+3/17/2018
+
+	399
+	-added incest focus policy (pre-EgyptianRevivalist bonus)
+	-SFanon's fixes and tweaks
+	-pregmodfan's fixes to the autosurgery
+	-pregmodfan's belly implant implantation and filling to the RA
+	-pregmodfan's broodmother implant tweaks (implant stays in after shutdown; must be removed surgically, but can be restarted)
+	-various little text fixes
+
 3/16/2018
 
 	398
diff --git a/devNotes/twine JS b/devNotes/twine JS
index f1c4d366e2c..0096138c994 100644
--- a/devNotes/twine JS	
+++ b/devNotes/twine JS	
@@ -293,7 +293,7 @@ window.canImpreg = function(slave1, slave2) {
 window.isFertile = function(slave) {
 	if (!slave) {
 		return null;
-	} else if (slave.preg > 0) { /* currently pregnant */
+	} else if (slave.womb.length > 0 || slave.broodmother > 0) { /* currently pregnant or broodmother */
 		return false;
 	} else if (slave.preg < -1) { /* sterile */
 		return false;
@@ -6891,7 +6891,7 @@ window.WombInit = function(actor) //Init womb system.
     {
         WombImpregnate(actor, actor.pregType, actor.pregSource, actor.preg);
     }
-    else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother > 0) //sorry but for already present broodmothers it's impossible to calculate fully, aproximation used.
+    else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother > 0 && actor.broodmotherOnHold < 1) //sorry but for already present broodmothers it's impossible to calculate fully, aproximation used.
     {
         var i, pw = actor.preg, bCount, bLeft;
         if (pw > 40)
@@ -7093,6 +7093,23 @@ window.WombNormalizePreg = function(actor)
 {
 //    console.log("New actor: " + actor.slaveName + " ===============" + actor.name);
     WombInit(actor);
+
+    if (actor.womb.length == 0 && actor.broodmother >= 1) // this is broodmother on hold.
+    {
+        actor.pregType = 0; 
+        actor.pregKnown = 0;
+        
+        if (actor.preg > 0)
+            actor.preg = 0.1; //to avoid legacy code conflicts - broodmother on hold can't be impregnated, but she not on normal contraceptives. So we set this for special case.
+        
+        if (actor.pregSource > 0)
+            actor.pregSource = 0;
+
+        if (actor.pregWeek > 0) 
+            actor.pregWeek = 0;
+            
+        actor.broodmotherCountDown = 0;
+    }
     
     if (actor.womb.length > 0)
     {
@@ -7116,7 +7133,7 @@ window.WombNormalizePreg = function(actor)
         actor.pregType = actor.womb.length;
         actor.pregSource = actor.womb[0].fatherID;
     } 
-    else if (actor.womb.length == 0 && actor.broodmother < 1)
+    else if (actor.womb.length == 0 && actor.broodmother < 1) //not broodmother
     {
 //        console.log("preg fixing");
         actor.pregType = 0;
@@ -8679,9 +8696,9 @@ window.extractHairColor = function(hColor) {
 /*SFJS [script]*/
 
 window.simpleWorldEconomyCheck = function() {
-	var n1 = 7;
-	var n2 = 5;
-	var n3 = 3;
+	var n1 = 4;
+	var n2 = 3;
+	var n3 = 2;
 	if(State.variables.economy === .5) {
 		return n1;
 	} else if(State.variables.economy === 1.5) {
diff --git a/src/uncategorized/remoteSurgery.tw b/src/uncategorized/remoteSurgery.tw
index 838db590d7c..51f638e0af1 100644
--- a/src/uncategorized/remoteSurgery.tw
+++ b/src/uncategorized/remoteSurgery.tw
@@ -507,7 +507,7 @@ $pronounCap's
 <<if $activeSlave.pregKnown > 0>>
 	pregnant.
 <<elseif $activeSlave.womb.length == 0 && $activeSlave.broodmother > 0>>
-	broodmother on hold.
+	got a dormant broodmother implant in $possessive womb.
 <<elseif $activeSlave.preg > 0>>
 	showing unusual discomfort as $possessive stomach is inspected. A quick test reveals that @@.lime;$pronoun is pregnant.@@
 	<<set $activeSlave.pregKnown = 1>>
@@ -764,9 +764,9 @@ Work on her sex:
 <<if $permaPregImplant == 1>>
 	<<if $activeSlave.broodmother >= 1 >>
 		<<if $activeSlave.womb.length == 0 >>
-			[[Remove a pregnancy generator|Surgery Degradation][$activeSlave.preg = 0,$activeSlave.pregWeek = 0,$activeSlave.pregKnown = 0,$activeSlave.pregType = 0,$activeSlave.broodmother = 0,$activeSlave.broodmotherFetuses = 0,$activeSlave.broodmotherOnHold = 0,$cash -= $surgeryCost,$activeSlave.pregControl = "none",$activeSlave.health -= 10,$surgeryType = "pregRemove"]] 
+			[[Remove a pregnancy generator|Surgery Degradation][$activeSlave.preg = 0,$activeSlave.pregWeek = -2,$activeSlave.pregSource = 0,$activeSlave.pregWeek = 0,$activeSlave.pregKnown = 0,$activeSlave.pregType = 0,$activeSlave.broodmother = 0,$activeSlave.broodmotherFetuses = 0,$activeSlave.broodmotherOnHold = 0,$cash -= $surgeryCost,$activeSlave.pregControl = "none",$activeSlave.health -= 10,$surgeryType = "pregRemove"]] 
 		<<else>>
-			She is pregnant right now, and her broodmother implant can't be safely extracted.
+			$possessiveCap is pregnant right now, so her broodmother implant can't be safely extracted.
 		<</if>>
 	<</if>>
 <</if>>
diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw
index 53c585cb332..4e7d804d3b0 100644
--- a/src/uncategorized/slaveInteract.tw
+++ b/src/uncategorized/slaveInteract.tw
@@ -1039,7 +1039,7 @@ Aphrodisiacs: <span id="aphrodisiacs"><strong><<if $activeSlave.aphrodisiacs > 1
 			<<SetBellySize $activeSlave>>
 		<</if>>
 	<<elseif $activeSlave.broodmotherOnHold == 1>>
-		//Her pregnancy implant is turned off<<if $activeSlave.broodmotherCountDown > 0>>; she expected to be completely emptied of her remaining brood in $activeSlave.broodmotherCountDown week<<if $activeSlave.broodmotherCountDown > 1>>s<</if>><<else>>.<</if>>// 
+		//Her pregnancy implant is turned off<<if $activeSlave.broodmotherCountDown > 0>>; she is expected to be completely emptied of her remaining brood in $activeSlave.broodmotherCountDown week<<if $activeSlave.broodmotherCountDown > 1>>s<</if>><<else>>.<</if>>// 
 		[[Turn on implant|Slave Interact][$activeSlave.broodmotherOnHold = 0, $activeSlave.broodmotherCountDown = 0]] 
 	<<elseif $activeSlave.preg >= -1>>
 	Contraception: <span id="fertility"><strong><<if $activeSlave.preg == -1>><<print "using contraceptives">><<elseif $activeSlave.pregWeek < 0>><<print "postpartum">><<elseif $activeSlave.preg == 0>><<print "fertile">><<elseif $activeSlave.preg < 4>><<print "may be pregnant">><<else>><<print $activeSlave.preg>><<print " weeks pregnant">><</if>></strong></span>.
diff --git a/src/utility/miscWidgets.tw b/src/utility/miscWidgets.tw
index c905ed175bd..647748af6f8 100644
--- a/src/utility/miscWidgets.tw
+++ b/src/utility/miscWidgets.tw
@@ -674,7 +674,7 @@
 			<<SetBellySize $activeSlave>>
 		<</if>>
 	<<elseif $activeSlave.broodmotherOnHold == 1>>
-	//Her pregnancy implant is turned off<<if $activeSlave.broodmotherCountDown > 0>>; she expected to be completely emptied of her remaining brood in $activeSlave.broodmotherCountDown week<<if $activeSlave.broodmotherCountDown > 1>>s<</if>><<else>>.<</if>>//  
+	//Her pregnancy implant is turned off<<if $activeSlave.broodmotherCountDown > 0>>; she is expected to be completely emptied of her remaining brood in $activeSlave.broodmotherCountDown week<<if $activeSlave.broodmotherCountDown > 1>>s<</if>><<else>>.<</if>>//  
 	[[Turn on implant|Slave Interact][$activeSlave.broodmotherOnHold = 0, $activeSlave.broodmotherCountDown = 0]]
 	<<elseif ($activeSlave.preg >= -1)>>
 		__Contraception__: <span id="fertility"><strong><<if $activeSlave.preg == -1>><<print "using contraceptives">><<elseif $activeSlave.pregWeek < 0>><<print "postpartum">><<elseif $activeSlave.preg == 0>><<print "fertile">><<elseif $activeSlave.preg < 4>><<print "may be pregnant">><<else>><<print $activeSlave.preg>><<print " weeks pregnant">><</if>></strong></span>.
diff --git a/src/utility/raWidgets.tw b/src/utility/raWidgets.tw
index d6a182780cb..6df784d53cc 100644
--- a/src/utility/raWidgets.tw
+++ b/src/utility/raWidgets.tw
@@ -3542,39 +3542,39 @@ Your brand design is ''$brandDesign.''
 
 <</if>> /* CLOSES FUCKDOLL CHECK */
 
-/* Here belly implants size control, it's used Surgery Degradation passage to setup devotion and thrust changes. */
+/* Here is belly implant size control, it's used in Surgery Degradation passage to setup devotion and trust changes. */
 <<if (def _combinedRule.bellyImplantVol) && $args[0].bellyImplant >= 0 && _combinedRule.bellyImplantVol >= 0>>
 	<<set _tmpNextL = $nextLink, _tmpNextB = $nextButton, _as = $activeSlave, $activeSlave = $args[0]>> /* this is hack to use Surgery Degradation without breaking normal End Week routine */
 	<br>
 	<<if $args[0].health > -10 >>
 		<<set _bdiff = _combinedRule.bellyImplantVol - $args[0].bellyImplant>>
 		<<if _bdiff >= 5000 && $activeSlave.bellyPain == 0 && $args[0].health > 50>>
-			$args[0].slaveName's belly is way too smaller then desired size, so she has been directed to have intensive belly implant filling procedures throught this week.
+			$args[0].slaveName's belly is way too small, so she has been directed to have intensive belly implant filling procedures throughout this week.
 			<<set $surgeryType = "bellyUp", $activeSlave.bellyImplant += 1000, $activeSlave.bellyPain += 2>>
 			<<silently>>
 				<<include "Surgery Degradation">>
 			<</silently>>
 		<<elseif _bdiff >= 500 && $activeSlave.bellyPain < 2 >>
-			$args[0].slaveName's belly not reached desired size, so she has been directed to have belly implant filling procedures throught this week.
+			$args[0].slaveName's belly has not reached the desired size, so she has been directed to have belly implant filling procedures throughout this week.
 			<<set $surgeryType = "bellyUp", $activeSlave.bellyImplant += 500, $activeSlave.bellyPain += 1>>
 			<<silently>>
 				<<include "Surgery Degradation">>
 			<</silently>>
 		<<elseif _bdiff <= -5000 >>
-			$args[0].slaveName's belly is way too big, so she has been directed to have intensive belly implant drainig procedures throught this week.
+			$args[0].slaveName's belly is way too big, so she has been directed to have intensive belly implant draining procedures throughout this week.
 			<<set $surgeryType = "bellyDown", $activeSlave.bellyImplant -= 1000>>
 			<<silently>>
 				<<include "Surgery Degradation">>
 			<</silently>>
 		<<elseif _bdiff <= -500 >>
-			$args[0].slaveName's belly is too big, so she has been directed to have belly implant drainig procedures throught this week.
+			$args[0].slaveName's belly is too big, so she has been directed to have belly implant draining procedures throughout this week.
 			<<set $surgeryType = "bellyDown", $activeSlave.bellyImplant -= 500>>
 			<<silently>>
 				<<include "Surgery Degradation">>
 			<</silently>>
 		<</if>>
 	<<else>>
-		$args[0].slaveName not heahty enough to safely manipulate her belly implant.
+		$args[0].slaveName is not healthy enough to safely adjust her belly implant.
 	<</if>>
 	<<set $nextLink = _tmpNextL, $nextButton = _tmpNextB, $activeSlave = _as>>
 <</if>>
-- 
GitLab