From 0f1034dad81a858f9d78cad3c7b273c019c22eef Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Tue, 3 Apr 2018 21:32:37 -0400
Subject: [PATCH] fixes and tbm progress.

---
 devNotes/VersionChangeLog-Premod+LoliMod.txt | 10 +++
 src/events/intro/introSummary.tw             |  2 +-
 src/init/storyInit.tw                        |  3 +
 src/pregmod/theBlackMarket.tw                | 86 +++++++++++++++++++-
 src/uncategorized/BackwardsCompatibility.tw  |  6 ++
 src/uncategorized/dispensary.tw              |  2 +-
 src/uncategorized/generateXXSlave.tw         |  9 +-
 src/uncategorized/generateXYSlave.tw         |  8 +-
 src/utility/assignWidgets.tw                 |  4 +-
 9 files changed, 116 insertions(+), 14 deletions(-)

diff --git a/devNotes/VersionChangeLog-Premod+LoliMod.txt b/devNotes/VersionChangeLog-Premod+LoliMod.txt
index 86b2e42b162..b9afaf879b8 100644
--- a/devNotes/VersionChangeLog-Premod+LoliMod.txt
+++ b/devNotes/VersionChangeLog-Premod+LoliMod.txt
@@ -2,6 +2,16 @@
 
 0.10.7.1-0.1.x
 
+4/03/2018
+
+	24
+	-various fixes including issues pertaining to incubator reservations not clearing after birth
+	-also fixed horrid age weighting effects involving the age FSs
+
+	23
+	-lots more new nicknames
+	-various text and bug fixes
+
 4/02/2018
 
 	22
diff --git a/src/events/intro/introSummary.tw b/src/events/intro/introSummary.tw
index 3b522a6d77a..ae0f0d818fb 100644
--- a/src/events/intro/introSummary.tw
+++ b/src/events/intro/introSummary.tw
@@ -675,7 +675,7 @@ __''Player Character''__
 			influence you to be ''caring and motherly''. Sex scene alterations; slaves will trust you more, but may try to take advantage of your mercy.
 			[[Change to no change|Intro Summary][$PC.pregMood = 0]] | [[Change to aggressive|Intro Summary][$PC.pregMood = 2]]
 		<<elseif $PC.pregMood == 0>>
-			do not effect you. Vanilla setting.
+			do not affect you. Vanilla setting.
 			[[Change to motherly|Intro Summary][$PC.pregMood = 1]] | [[Change to aggressive|Intro Summary][$PC.pregMood = 2]]
 		<<else>>
 			influence you to be ''aggressive and domineering''. Sex scene alterations; slaves will fear you more, but will become more submissive to you.
diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index d09c3248a3d..31c4f57f7ea 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -1299,6 +1299,9 @@ ocularImplant: 0,
 erectileImplant: 0
 } >>
 
+<<set $merchantFSWares = ["GenderRadicalistResearch", "TransformationFetishistResearch", "AssetExpansionistResearch", "SlimnessEnthusiastResearch", "YouthPreferentialistResearch", "HedonisticDecadenceResearch"]>>
+<<set $merchantIllegalWares = []>>
+
 <<if ndef $PC.hacking>>
 	<<set $PC.hacking = 0>>
 <</if>>
diff --git a/src/pregmod/theBlackMarket.tw b/src/pregmod/theBlackMarket.tw
index 0dbf295ffd2..241b8156ed8 100644
--- a/src/pregmod/theBlackMarket.tw
+++ b/src/pregmod/theBlackMarket.tw
@@ -2,8 +2,90 @@
 
 <<set $nextButton = "Back", $nextLink = "Buy Slaves", $returnTo = "Buy Slaves", $showEncyclopedia = 1, $encyclopedia = "The Black Market">>
 
-You board your VTOL bird for the trip the the current location of the particularly exclusive, and quite lucrative, Black Market knowing full well that the trip may take far longer than anticipated; the market frequently relocates to shake the unwanted attention it inevitably gains. It's far easier than paying off authorities, especially with how outrageous their demands have become with the decline of the Old World. You're greeting by a gruff bouncer, already fully aware of just who you are and your permission to be there. "Check your weapons - No firearms allowed inside.<<if $Bodyguard != 0>> She may keep her blade," he gestures to $Bodyguard.slaveName, "but keep in mind. If you cause us trouble, you will not be going home in one piece.<<if $Bodyguard.amp <= -4>>" He taps his clearly bionic arm. "Disable her weapons systems. I know what she is capable of.<</if>><</if>>"
+You board your VTOL bird for the trip to the current location of the particularly exclusive, and quite lucrative, Black Market knowing full well that the trip may take far longer than anticipated; the market frequently relocates to shake the unwanted attention it inevitably gains. It's far easier than paying off authorities, especially with how outrageous their demands have become with the decline of the Old World. You're greeting by a gruff bouncer, already fully aware of just who you are and your permission to be there. "Check your weapons - No firearms allowed inside.<<if $Bodyguard != 0>> She may keep her blade," he gestures to $Bodyguard.slaveName, "but keep in mind. If you cause us trouble, you will not be going home in one piece.<<if $Bodyguard.amp <= -4>>" He taps his clearly bionic arm. "Disable her weapons systems. I know what she is capable of.<</if>><</if>>"
 
 <br><br>
 
-Once inside, you are able to fully absorb in the sights and sounds of the market proper. All sorts of items are available for purchase, from exotic beasts that may very well be the last of their kind, to the most lethal of weaponry both old and new, and even luxuries long gone. Despite the overbearing security, one's wallet can easiliy be emptied in this place.
+Once inside, you are able to fully absorb in the sights and sounds of the market proper. All sorts of items are available for purchase, from exotic beasts that may very well be the last of their kind, to the most lethal of weaponry both old and new, and even luxuries long gone. Despite the overbearing security, one's wallet can easily be emptied in this place.
+
+<br><br>
+
+The main draw, however, is the prominent stage to the rear of the building where the most desirable and less than legal slaves are auctioned off. Enslaved celebrities, kidnapped royalty, the daughters of warlords and all manner of slaves outlawed for sale in most arcologies frequently make appearances before the hungry crowd. It's usually not worth the added risk or the price to buy these girls yourself, however.
+/* This could use a variety of scenes for who is currently at auction, possibly even with slave purchase */
+
+<br><br>
+Of all the wonders present, the thing that catches your eye the most is a shady looking stall with a somehow even shadier looking merchant; a merchant who is beckoning you to come over. "A prominent arcology owner like yourself wandering around in here can only be looking for one thing: New and exciting ways to spice up <<if $PC.title == 1>>his<<else>>her<</if>> slaves! I've got the hottest research and tech straight from the labs waiting for you to peruse and some of the 'hottest' tech straight out of the research labs if you catch my drift." He shuffles around behind the counter, pulling out a stack of papers.
+
+<<if dispensary == 0>>
+	Even if you wanted to buy something, you lack the pharmaceutical fabricator to make use of it.
+<<else>>
+	<<if ndef $thisWeeksFSWares>>
+		<<set thisWeeksFSWares = $merchantFSWares.randomMany(2)>>
+	<<set $merchantFSWares = ["GenderRadicalistResearch", "TransformationFetishistResearch", "AssetExpansionistResearch", "SlimnessEnthusiastResearch", "YouthPreferentialistResearch", "HedonisticDecadenceResearch"]>>
+	<</if>>
+
+	<br>
+	"Now when it comes to the legal, relatively boring stuff, I've got the following available:"
+	<br>
+	<<if $thisWeeksFSWares.length > 0>>
+		<<for _bm = 0; _bm < $thisWeeksFSWares.length; _bm++>>
+			<<if $thisWeeksFSWares[_bm] == "GenderRadicalistResearch">>
+				<<if $seePreg != 0 && $arcologies[0].FSGenderRadicalistResearch == 0>>
+					<<if $organFarmUpgrade > 0>>
+						<<if $cash < 100000>>
+							[[Purchase schematics for anal pregnancy|The Black Market][$cash -= 100000, $arcologies[0].FSGenderRadicalistResearch = 1, _dump = $merchantFSWares.delete("GenderRadicalistResearch")]] //<<print cashFormat(100000)>>.//
+						<<else>>
+							You can not afford the asking price of <<print cashFormat(100000)>> for anal pregnancy schematics. "No discounts. No haggling. No price naming. Take it or leave it."
+						<</if>>
+					<<else>>
+						You lack the facilities needed to grow organs, so anal pregnancy schematics are currently out of your reach.
+					<</if>>
+				<<elseif $seePreg == 1>>
+					You have no interest in this pregnancy based research.
+				<<else>>
+					You already possess designs for anal pregnancy.
+					<<set _dump = $merchantFSWares.delete("GenderRadicalistResearch")>>
+				<</if>>
+			<</if>>
+			<<if $thisWeeksFSWares[_bm] == "TransformationFetishistResearch">>
+				<<if $arcologies[0].FSTransformationFetishistResearch == 0>>
+					<<if $ImplantProductionUpgrade == 1>>
+						<<if $cash < 50000>>
+							[[Purchase designs for immense implants|The Black Market][$cash -= 50000, $arcologies[0].FSTransformationFetishistResearch = 1, _dump = $merchantFSWares.delete("TransformationFetishistResearch")]] //<<print cashFormat(50000)>>.//
+						<<else>>
+							You can not afford the asking price of <<print cashFormat(50000)>> for absurdly huge implant designs. "No big fake boobs for you. How sad it must be to be flat and enslaved by such a poor <<if $PC.title == 1>>Master<<else>>Mistress<</if>>"
+						<</if>>
+					<<else>>
+						You lack the facilities needed to produce implants of this caliber, so absurdly huge implant designs are currently unobtainable.
+					<</if>>
+				<<else>>
+					You already possess designs for oversized implants.
+					<<set _dump = $merchantFSWares.delete("TransformationFetishistResearch")>>
+				<</if>>
+			<</if>>
+			<<if $thisWeeksFSWares[_bm] == "AssetExpansionistResearch">>
+				<<if $arcologies[0].FSAssetExpansionistResearch == 0>>
+						<<if $cash < 50000>>
+							[[Purchase formulas for extremely powerful growth drugs|The Black Market][$cash -= 50000, $arcologies[0].FSAssetExpansionistResearch = 1, _dump = $merchantFSWares.delete("AssetExpansionistResearch")]] //<<print cashFormat(50000)>>.//
+						<<else>>
+							You can not afford the asking price of <<print cashFormat(50000)>> for extremely powerful growth drug formulas. "Why'd you even come here if you didn't have the credits to buy anything?"
+						<</if>>
+					<</if>>
+				<<else>>
+					You already possess formulas for extremely powerful growth drugs.
+					<<set _dump = $merchantFSWares.delete("AssetExpansionistResearch")>>
+				<</if>>
+			<</if>>
+		<</for>>
+	<<else>>
+		You appear to already possess all the societal based schematics he has to offer.
+	<</if>>
+
+	<br>
+	He gestures to a door in the back of the stall. "The good shit's back there, here's a list:"
+	<<if $merchantIllegalWares.length > 1>>
+	<<elseif $merchantIllegalWares.length == 1>>
+	<<else>>
+		You appear to already possess all the black market schematics he has to offer.
+	<</if>>
+<</if>>
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 93bf3e13a90..7d8c84c7704 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -690,6 +690,12 @@
 <<if ndef $eugenicsFullControl>>
 	<<set $eugenicsFullControl = 0>>
 <</if>>
+<<if ndef $merchantFSWares>>
+	<<set $merchantFSWares = ["GenderRadicalistResearch", "TransformationFetishistResearch", "AssetExpansionistResearch", "SlimnessEnthusiastResearch", "YouthPreferentialistResearch", "HedonisticDecadenceResearch"]>>
+<</if>>
+<<if ndef $merchantIllegalWares>>
+	<<set $merchantIllegalWares = []>>
+<</if>>
 
 <<if $SFMODToggle == 1 && $securityForceCreate == 1>> 
 	/* SF anon additional Special Force Variables [SFVAR] */
diff --git a/src/uncategorized/dispensary.tw b/src/uncategorized/dispensary.tw
index 8f35a778876..5f4d33c5f3e 100644
--- a/src/uncategorized/dispensary.tw
+++ b/src/uncategorized/dispensary.tw
@@ -552,7 +552,7 @@ Future Societies Research
 <</if>>
 <</if>>
 
-<<if ($ImplantProductionUpgrade == 1) and ($arcologies[0].FSTransformationFetishistDecoration >= 100)>>
+<<if ($ImplantProductionUpgrade == 1) && ($arcologies[0].FSTransformationFetishistDecoration >= 100)>>
 	<<if ($arcologies[0].FSTransformationFetishistResearch == 0) and ($rep <= 5000*_PCSkillCheck)>>
 		//You lack the reputation to access experimental gigantic implants and elasticizing filler.//
 		<br>
diff --git a/src/uncategorized/generateXXSlave.tw b/src/uncategorized/generateXXSlave.tw
index dd6275a8d24..136531db6bb 100644
--- a/src/uncategorized/generateXXSlave.tw
+++ b/src/uncategorized/generateXXSlave.tw
@@ -30,10 +30,11 @@
 <</if>>
 <<set $activeSlave.actualAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
 <<set $activeSlaveOneTimeMinAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
-<<if ($arcologies[0].FSYouthPreferentialist != "unset") && ($arcologies[0].FSYouthPreferentialist >= random(1,100))>>
-	<<set $activeSlave.actualAge = Math.min($activeSlave.actualAge, $activeSlaveOneTimeMinAge)>>
-<<elseif ($arcologies[0].FSMaturityPreferentialist != "unset") && ($arcologies[0].FSMaturityPreferentialist >= random(1,100))>>
-	<<set $activeSlave.actualAge = Math.max($activeSlave.actualAge, $activeSlaveOneTimeMaxAge)>>
+<<set $activeSlaveOneTimeMinAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
+<<if ($arcologies[0].FSYouthPreferentialist != "unset") && ($arcologies[0].FSYouthPreferentialist >= random(1,200)) && $activeSlave.actualAge > 24>>
+  <<set $activeSlave.actualAge = random($activeSlaveOneTimeMinAge, $activeSlave.actualAge)>>
+<<elseif ($arcologies[0].FSMaturityPreferentialist != "unset") && ($arcologies[0].FSMaturityPreferentialist >= random(1,150)) && $activeSlaveOneTimeMaxAge > 24 && $activeSlave.actualAge <= 24>>
+  <<set $activeSlave.actualAge = random($activeSlave.actualAge, $activeSlaveOneTimeMaxAge)>>
 <</if>>
 <<if $activeSlave.actualAge >= $retirementAge>>
 	<<set $activeSlave.actualAge = ($retirementAge-2)>>
diff --git a/src/uncategorized/generateXYSlave.tw b/src/uncategorized/generateXYSlave.tw
index f4869a0d665..074d239172c 100644
--- a/src/uncategorized/generateXYSlave.tw
+++ b/src/uncategorized/generateXYSlave.tw
@@ -31,10 +31,10 @@
 <</if>>
 <<set $activeSlave.actualAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
 <<set $activeSlaveOneTimeMinAge = random($activeSlaveOneTimeMinAge,$activeSlaveOneTimeMaxAge)>>
-<<if ($arcologies[0].FSYouthPreferentialist != "unset") && ($arcologies[0].FSYouthPreferentialist >= random(1,100))>>
-  <<set $activeSlave.actualAge = Math.min($activeSlave.actualAge, $activeSlaveOneTimeMinAge)>>
-<<elseif ($arcologies[0].FSMaturityPreferentialist != "unset") && ($arcologies[0].FSMaturityPreferentialist >= random(1,100))>>
-  <<set $activeSlave.actualAge = Math.max($activeSlave.actualAge, $activeSlaveOneTimeMaxAge)>>
+<<if ($arcologies[0].FSYouthPreferentialist != "unset") && ($arcologies[0].FSYouthPreferentialist >= random(1,200)) && $activeSlave.actualAge > 24>>
+  <<set $activeSlave.actualAge = random($activeSlaveOneTimeMinAge, $activeSlave.actualAge)>>
+<<elseif ($arcologies[0].FSMaturityPreferentialist != "unset") && ($arcologies[0].FSMaturityPreferentialist >= random(1,150)) && $activeSlaveOneTimeMaxAge > 24 && $activeSlave.actualAge <= 24>>
+  <<set $activeSlave.actualAge = random($activeSlave.actualAge, $activeSlaveOneTimeMaxAge)>>
 <</if>>
 <<if $activeSlave.actualAge >= $retirementAge>>
 	<<set $activeSlave.actualAge = ($retirementAge-2)>>
diff --git a/src/utility/assignWidgets.tw b/src/utility/assignWidgets.tw
index 909d7578c39..eabe9a13ae8 100644
--- a/src/utility/assignWidgets.tw
+++ b/src/utility/assignWidgets.tw
@@ -174,9 +174,9 @@
 			<<set $BrothiIDs.delete(_wID), $brothelSlaves-->>
 		<<case "be confined in the cellblock" "cellblock">>
 			<<set $args[0].assignment = "rest">>
-			<<if ($slaves[_wi].inflation > 0)>>
+			<<if ($args[0].inflation > 0)>>
 				<<set $args[0].inflation = 0, $args[0].inflationType = "none", $args[0].inflationMethod = 0>>
-				<<SetBellySize $slaves[$i]>>
+				<<SetBellySize $args[0]>>
 			<</if>>
 			<<set $CellBiIDs.delete(_wID), $cellblockSlaves-->>
 		<<case "get treatment in the clinic" "clinic">>
-- 
GitLab