From a8a2603a8a8d3569c2cc566355d86b55b9c4e30c Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Tue, 13 Nov 2018 18:08:08 -0500
Subject: [PATCH] progress and reserved init

---
 devNotes/VersionChangeLog-Premod+LoliMod.txt |  2 ++
 devNotes/twine JS.txt                        |  2 ++
 player variables documentation - Pregmod.txt |  9 ++++----
 slave variables documentation - Pregmod.txt  |  1 +
 src/init/storyInit.tw                        |  4 ++--
 src/js/wombJS.tw                             |  2 ++
 src/npc/acquisition.tw                       |  2 +-
 src/pregmod/analyzePregnancy.tw              | 24 ++++++++++++++++++++
 src/pregmod/breederProposal.tw               |  2 +-
 src/pregmod/eliteTakeOver.tw                 |  8 +++----
 src/pregmod/managePersonalAffairs.tw         |  6 ++---
 src/uncategorized/BackwardsCompatibility.tw  | 15 ++++++++++--
 12 files changed, 60 insertions(+), 17 deletions(-)

diff --git a/devNotes/VersionChangeLog-Premod+LoliMod.txt b/devNotes/VersionChangeLog-Premod+LoliMod.txt
index bf78a9ccf19..67830587990 100644
--- a/devNotes/VersionChangeLog-Premod+LoliMod.txt
+++ b/devNotes/VersionChangeLog-Premod+LoliMod.txt
@@ -4,6 +4,8 @@
 	-WIP content added to nursery/farmyard
 	-genetic sequencing moved out of dispensary
 	-added advanced pregnancy tracking
+	-genetics now determined at conception, rather than birth
+	-pregSource normalization
 
 0.10.7.1-0.10.x
 
diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index fb2dd846322..32219708c89 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -10493,6 +10493,7 @@ window.WombImpregnate = function(actor, fCount, fatherID, age) {
 		tf.age = age; //initial age
 		tf.fatherID = fatherID; //We can store who is father too.
 		tf.volume = 1; //Initial, to create property. Updated with actual data after WombGetVolume call.
+		tf.reserved = 0; //Initial, to create property. Used later to mark if this child is to be kept.
 		tf.identical = 0; //Initial, to create property. Updated with actual data during fetalSplit call.
 		tf.genetics = generateGenetics(actor.ID, fatherID, i+1); //Stored genetic information.
 
@@ -10715,6 +10716,7 @@ window.fetalSplit = function(actor) {
 	nft.volume = 1;
 	nft.identical = 0;
 	nft.genetics = 0;
+	nft.reserved = 0;
 
 	actor.womb.forEach(function(s){
 		if ((jsRandom(1,1000) >= 1000) && s.identical !== 1)
diff --git a/player variables documentation - Pregmod.txt b/player variables documentation - Pregmod.txt
index f5ae18e6c5a..04135371c0e 100644
--- a/player variables documentation - Pregmod.txt	
+++ b/player variables documentation - Pregmod.txt	
@@ -88,12 +88,13 @@ pregSource:
 
 who knocked you up
  0 - unknown
--1 - Societal Elite
--2 - client
+-1 - self-impreg
+-2 - citizen
 -3 - former master
 -4 - male arc owner
--5 - citizen
--6 - self-impreg
+-5 - client
+-6 - Societal Elite
+-7 - designer baby
 
 pregMood:
 
diff --git a/slave variables documentation - Pregmod.txt b/slave variables documentation - Pregmod.txt
index 4dcda7b73cb..3602da40820 100644
--- a/slave variables documentation - Pregmod.txt	
+++ b/slave variables documentation - Pregmod.txt	
@@ -1732,6 +1732,7 @@ pregSource:
 
 accepts ID See Pregnancy Control section for more.
 Who sired her pregnancy
+-7 - designer baby
 -2 - Citizen of your arcology
 -1 - You
  0 - Unidentifiable
diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 46ef5479ced..166238c2d74 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with thi
 <<set $returnTo = "init", $nextButton = "Continue", $nextLink = "Alpha disclaimer">>
 
 <<unset $releaseID>>
-<<set $ver = "0.10.7", $releaseID = 1031>>
-<<if ndef $releaseID>><<set $releaseID = 1031>><</if>>
+<<set $ver = "0.10.7", $releaseID = 1032>>
+<<if ndef $releaseID>><<set $releaseID = 1032>><</if>>
 
 /* This needs to be broken down into individual files that can be added to StoryInit instead. */
 
diff --git a/src/js/wombJS.tw b/src/js/wombJS.tw
index 346d0b09199..71947a497a2 100644
--- a/src/js/wombJS.tw
+++ b/src/js/wombJS.tw
@@ -80,6 +80,7 @@ window.WombImpregnate = function(actor, fCount, fatherID, age) {
 		tf.age = age; //initial age
 		tf.fatherID = fatherID; //We can store who is father too.
 		tf.volume = 1; //Initial, to create property. Updated with actual data after WombGetVolume call.
+		tf.reserved = 0; //Initial, to create property. Used later to mark if this child is to be kept.
 		tf.identical = 0; //Initial, to create property. Updated with actual data during fetalSplit call.
 		tf.genetics = generateGenetics(actor.ID, fatherID, i+1); //Stored genetic information.
 
@@ -303,6 +304,7 @@ window.fetalSplit = function(actor) {
 	nft.volume = 1;
 	nft.identical = 0;
 	nft.genetics = 0;
+	nft.reserved = 0;
 
 	actor.womb.forEach(function(s){
 		if ((jsRandom(1,1000) >= 1000) && s.identical !== 1)
diff --git a/src/npc/acquisition.tw b/src/npc/acquisition.tw
index fe746474b10..29db50b3a6f 100644
--- a/src/npc/acquisition.tw
+++ b/src/npc/acquisition.tw
@@ -51,7 +51,7 @@
 				<<set $PC.pregSource = -3>>
 				<<set $PC.pregType += random(0,0,1)>>
 			<<elseif $PC.career == "escort">>
-				<<set $PC.pregSource = -2>>
+				<<set $PC.pregSource = -5>>
 			<</if>>
 			<<set $PC.pregKnown = 1>>
 			<<set $PC.belly = getPregBellySize($PC)>>
diff --git a/src/pregmod/analyzePregnancy.tw b/src/pregmod/analyzePregnancy.tw
index 47254bed817..60255428e33 100644
--- a/src/pregmod/analyzePregnancy.tw
+++ b/src/pregmod/analyzePregnancy.tw
@@ -18,3 +18,27 @@ Furthest developed pregnancy:
 <br>&nbsp;&nbsp;&nbsp;&nbsp;Fetal development week: $activeSlave.preg
 
 <br><br>
+Deep scan:
+
+<br>
+<<for _ap = 0; _ap < $activeSlave.womb.length; _ap++>>
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;
+	Ova $activeSlave.womb[_ap].genetics.name
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;
+	<<if $geneticMappingUpgrade == 0>>
+	<<else>>
+		<<if $activeSlave.womb[_ap].age > 5>>
+		<</if>>
+		<<if $activeSlave.womb[_ap].age > 13>>
+		<</if>>
+	<</if>>
+	
+	//name this ova
+	<<if $activeSlave.womb[_ap].age < 4>>
+		//abort this ova
+	<</if>>
+	<<if $nursery > 0 || $incubator > 0>>
+		//reserve this ova
+	<</if>>
+	<br><br><hr style="margin:0"><br>
+<</for>>
\ No newline at end of file
diff --git a/src/pregmod/breederProposal.tw b/src/pregmod/breederProposal.tw
index 9c9a7c10557..d16a53f0106 100644
--- a/src/pregmod/breederProposal.tw
+++ b/src/pregmod/breederProposal.tw
@@ -11,7 +11,7 @@ Within the hour, you are called before <<if $eugenicsFullControl == 1>>what's le
 	<<set $propOutcome = 1>>
 	<<InitStandards>>
 	<<set $nextButton = "Continue">><<UpdateNextButton>> /* unlock Continue button */
-<<elseif $PC.pregSource == -1>>
+<<elseif $PC.pregSource == -1 || $PC.pregSource == -6>>
 	"Since you are doing your part and carrying an elite child, we will gladly reward you by granting your proposal. We shall decide upon the standards for breeding stock and notify you shortly."
 	<<set $propOutcome = 1>>
 	<<InitStandards>>
diff --git a/src/pregmod/eliteTakeOver.tw b/src/pregmod/eliteTakeOver.tw
index e812c960220..aecc71cd684 100644
--- a/src/pregmod/eliteTakeOver.tw
+++ b/src/pregmod/eliteTakeOver.tw
@@ -8,7 +8,7 @@ You knew this day would come. Surrounding yourself with powerful people has its
 <br>
 You look up from your desk as the locked door to your office unseals, and a dozen individuals brazenly walk into your view.<<if $Bodyguard != 0>> $Bodyguard.slaveName stands between you and them. A single glare from the leader of the bunch and she backs off, eyes to the ground.<</if>>
 <br>
-<<if $PC.pregSource == -1>>
+<<if $PC.pregSource == -1 || $PC.pregSource == -6>>
 	<<if $PC.refreshmentType == 0>>
 		Taking a drag from a fresh $PC.refreshment,
 	<<elseif $PC.refreshmentType == 1>>
@@ -39,7 +39,7 @@ You look up from your desk as the locked door to your office unseals, and a doze
 		<br><br>
 		''GAME OVER''
 	<</if>>
-<<elseif $PC.pregSource != -1>>
+<<elseif $PC.pregSource != -6>>
 	The leader reaches into his jacket and extracts a syringe, you recognize it as a powerful drug used in lobotomies, and places it to your left. From his hip he pulls a revolver, six-chambered, and loads five bullets, spins the chamber, and places it to your right. 
 	<br>
 	"You are no longer worthy of being a part of our society. You know you can't be allowed to spread any information. But we are not merciless; one of our members has taken an interest in having you as her pet. You may choose to lose your mind, and service her until she tires of you, or gamble for your life and serve her anyway. Now decide."
@@ -54,7 +54,7 @@ You look up from your desk as the locked door to your office unseals, and a doze
 	<br>
 	<<if $Bodyguard != 0>>
 		<br>
-		<<if $PC.pregSource == -1>>
+		<<if $PC.pregSource == -1 || $PC.pregSource == -6>>
 			$Bodyguard.slaveName is already doing everything in her power to save you.
 		<<else>>
 			<<link "Attempt to signal $Bodyguard.slaveName, your bodyguard">>
@@ -83,7 +83,7 @@ You look up from your desk as the locked door to your office unseals, and a doze
 			<</replace>>
 		<</link>>
 	<</if>>
-	<<if $PC.pregSource != -1>>
+	<<if $PC.pregSource != -6 && $PC.pregSource != -1>>
 		<br>
 		<<link "Try and enrage them.">>
 			<<set $finalChoice = "enrage">>
diff --git a/src/pregmod/managePersonalAffairs.tw b/src/pregmod/managePersonalAffairs.tw
index 1b3137ce468..ccc5dd80b55 100644
--- a/src/pregmod/managePersonalAffairs.tw
+++ b/src/pregmod/managePersonalAffairs.tw
@@ -369,13 +369,13 @@ __Contraceptives and Fertility__
 <br>
 
 <span id="miniscene">
-<<if $PC.preg < 6 && $PC.pregKnown == 1 && $PC.pregSource != -1>>
+<<if $PC.preg < 6 && $PC.pregKnown == 1 && $PC.pregSource != -6>>
 	Your period is late, so the first thing you do is test yourself for a potential pregnancy: @@.lime;you are pregnant.@@	<<link "Abort your child">><<replace "#miniscene">><<set $PC.preg = 0, $PC.pregType = 0, $PC.pregSource = 0, $PC.pregKnown = 0, $PC.pregWeek = 0>><<set WombFlush($PC)>><<print "You take a syringe filled with abortifacients and make yourself comfortable. Injecting the vial through your belly into your womb, your close your eyes and wait for what is coming. Once you feel it is over, you clean yourself up and go on your way, child free.">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
 <<elseif $PC.labor == 1>>
 	You are beginning to feel contractions; you'll be giving birth soon.
 <<elseif $PC.preg >= 39>>
 	Your due date is looming, but your child doesn't seem to be interested in coming out just yet. [[Induce childbirth|Manage Personal Affairs][$PC.labor = 1]]
-<<elseif $PC.pregKnown == 1 && $PC.pregSource != -1>>
+<<elseif $PC.pregKnown == 1 && $PC.pregSource != -6>>
 	You're pregnant, something rather unbecoming for an arcology owner. <<link "Abort your child">><<replace "#miniscene">><<set $PC.preg = 0, $PC.pregWeek = -2, $PC.pregType = 0, $PC.pregSource = 0, $PC.belly = 0, $PC.pregKnown = 0>><<set WombFlush($PC)>><<print "You take a syringe filled with abortifacients and make yourself comfortable. Injecting the vial through your belly into your womb, your close your eyes and wait for what is coming. Once you feel it is over, you clean yourself up and go on your way, child free.">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
 <</if>>
 </span>
@@ -437,7 +437,7 @@ In total, you have given birth to:
 	You're having morning sickness. 
 <<elseif $PC.preg > 1>>
 	You've missed your period. This could be bad.
-<<elseif $PC.preg > 0 && $PC.pregSource != -1>>
+<<elseif $PC.preg > 0 && $PC.pregSource != -6>>
 	Your fertile pussy has been thoroughly seeded, there is a chance you are pregnant. <<link "Pop some morning after pills">><<set $PC.preg = 0, $PC.pregWeek = 0, $PC.pregType = 0, $PC.pregSource = 0, $PC.pregKnown = 0>><<set WombFlush($PC)>><<goto "Manage Personal Affairs">><</link>>
 <<elseif $PC.pregWeek < 0>>
 	You're still recovering from your recent pregnancy.
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index b2519f53c56..a2341cfa3c4 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -354,6 +354,17 @@
 <<if ndef $PC.underArmHStyle>>
 	<<set $PC.underArmHStyle = "hairless">>
 <</if>>
+<<if $releaseID < 1032>>
+	<<if $PC.pregSource == -1>>
+		<<set $PC.pregSource = -6>>
+	<<elseif $PC.pregSource == -2>>
+		<<set $PC.pregSource = -5>>
+	<<elseif $PC.pregSource == -6>>
+		<<set $PC.pregSource = -1>>
+	<<elseif $PC.pregSource == -5>>
+		<<set $PC.pregSource = -2>>
+	<</if>>
+<</if>>
 <<run PCDatatypeCleanup()>>
 
 <<if ndef $universalRulesImmobileSlavesMaintainMuscles>>
@@ -3540,6 +3551,6 @@ Done!
 	<</if>>
 <</for>>
 
-<<if $releaseID < 1031>>
-	<<set $releaseID = 1031>>
+<<if $releaseID < 1032>>
+	<<set $releaseID = 1032>>
 <</if>>
-- 
GitLab