From abc4b00a49daf7fe754de0f1cbb310da685ed68e Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Mon, 19 Nov 2018 21:25:45 -0500
Subject: [PATCH] fixes

---
 devNotes/twine JS.txt           |  2 +-
 src/js/generateGenetics.tw      | 93 ++++++++++++++++++++-------------
 src/pregmod/analyzePregnancy.tw | 62 ++++++++++++++--------
 3 files changed, 99 insertions(+), 58 deletions(-)

diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index 3601a9c8b5f..2f2ee6dcdbb 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -10021,7 +10021,7 @@ window.generateGenetics = (function() {
 	function setGender(father) {
 		let gender;
 		if (V.seeDicksAffectsPregnancy == 1) {
-			gender = Math.floor(Math.random()*100) < V.seeDicks ? 2 : 1;
+			gender = Math.floor(Math.random()*100) < V.seeDicks ? "XY" : "XX";
 		} else if (V.adamPrinciple == 1) {
 			if (father) {
 				if (father.genes == "XX") {
diff --git a/src/js/generateGenetics.tw b/src/js/generateGenetics.tw
index cab7b424686..0e930df609c 100644
--- a/src/js/generateGenetics.tw
+++ b/src/js/generateGenetics.tw
@@ -14,7 +14,7 @@ window.generateGenetics = (function() {
 		V = State.variables;
 		genes = {gender: "XX", name: "blank", surname: 0, mother: 0, motherName: "none", father: 0, fatherName: "none", nationality: "Stateless", race: "white", intelligence: 0, face: 0, eyeColor: "brown", hColor: "black", skin: "white", markings: "none", behavioralFlaw: "none", sexualFlaw: "none", pubicHSyle: "bushy", underArmHStyle: "bushy", geneticQuirks: 0};
 		if (actor1.ID > 0) {
-			mother = V.genePool.findIndex(function(s) { return s.ID == actor1.ID; });
+			mother = V.genePool.find(function(s) { return s.ID == actor1.ID; });
 			if (mother === undefined) {
 				mother = actor1;
 			}
@@ -26,7 +26,7 @@ window.generateGenetics = (function() {
 			activeMother = V.PC;
 			mother = V.PC;
 		}
-		father = (actor2 > 0) ? V.genePool.findIndex(function(s) { return s.ID == actor2; })
+		father = (actor2 > 0) ? V.genePool.find(function(s) { return s.ID == actor2; })
 			: (actor2 == -1) ? V.PC
 			: 0;
 		activeFather = (father !== 0 && father.ID > 0) ? V.slaves[V.slaveIndices[actor2]]
@@ -38,7 +38,7 @@ window.generateGenetics = (function() {
 		genes.mother = setMotherID(actor1.ID);
 		genes.motherName = setMotherName(activeMother);
 		genes.father = setFatherID(actor2);
-		genes.fatherName = setFatherName(father, activeFather);
+		genes.fatherName = setFatherName(father, activeFather, actor2);
 		genes.nationality = setNationality(father, mother);
 		genes.skin = setSkin(father, mother);
 		genes.race = setRace(father, mother, actor2);
@@ -60,9 +60,9 @@ window.generateGenetics = (function() {
 	function setGender(father) {
 		let gender;
 		if (V.seeDicksAffectsPregnancy == 1) {
-			gender = Math.floor(Math.random()*100) < V.seeDicks ? 2 : 1;
+			gender = Math.floor(Math.random()*100) < V.seeDicks ? "XY" : "XX";
 		} else if (V.adamPrinciple == 1) {
-			if (father) {
+			if (father !== 0) {
 				if (father.genes == "XX") {
 					gender = "XX";
 				} else {
@@ -106,9 +106,9 @@ window.generateGenetics = (function() {
 	}
 
 	// fatherName
-	function setFatherName(father, activeFather) {
+	function setFatherName(father, activeFather, actor2) {
 		let fatherName;
-		if (father) {
+		if (father !== 0) {
 			if (father.ID == -1) {
 				fatherName = activeFather.name;
 				if (activeFather.surname !== 0 && activeFather.surname !== "") { fatherName + " " + activeFather.surname; }
@@ -116,13 +116,34 @@ window.generateGenetics = (function() {
 				fatherName = activeFather.slaveName;
 				if (activeFather.slaveSurname !== 0 && activeFather.slaveSurname !== "") { fatherName + " " + activeFather.slaveSurname; }
 			}
-			return fatherName;
+		} else {
+			switch(actor2) {
+				case -2:
+				case -5:
+					fatherName = "citizen";
+					break;
+				case -3:
+					fatherName = "Your Master";
+					break;
+				case -4:
+					fatherName = "Another arcology owner";
+					break;
+				case -6:
+					fatherName = "The Societal Elite";
+					break;
+				case -7:
+					fatherName = "Lab designed";
+					break;
+				default:
+					fatherName = "Unknown";
+			}
 		}
+		return fatherName;
 	}
 
 	// nationality
 	function setNationality(father, mother) {
-		return (!father) ? "Stateless"
+		return (father === 0) ? "Stateless"
 			: (father.nationality == mother.nationality) ? mother.nationality
 			: "Stateless";
 	}
@@ -130,7 +151,7 @@ window.generateGenetics = (function() {
 	// race
 	function setRace(father, mother, actor2) {
 		let race;
-		if (father) {
+		if (father !== 0) {
 			race = (mother.origRace == father.origRace) ? mother.origRace
 			: (jsRandom(1,4)) == 4 ? jsEither([father.origRace, mother.origRace])
 			: "mixed race";
@@ -162,12 +183,12 @@ window.generateGenetics = (function() {
 			'light brown': 16,
 			dark: 15,
 			'dark olive': 14,
-			bronzed: 13,
-			tanned: 12,
+			bronze: 13,
+			tan: 12,
 			natural: 11,
 			olive: 10,
 			'light olive': 9,
-			lightened: 8,
+			light: 8,
 			light: 7,
 			white: 6,
 			fair: 5,
@@ -178,7 +199,7 @@ window.generateGenetics = (function() {
 			'pure white': 0
 		};
 		let momSkinIndex = mother ? (skinToMelanin[mother.origSkin] || 11) : 7;
-		let dadSkinIndex = father ? (skinToMelanin[father.origSkin] || 11) : 7;
+		let dadSkinIndex = father !== 0 ? (skinToMelanin[father.origSkin] || 11) : 7;
 		let skinIndex = Math.round(Math.random() * (dadSkinIndex - momSkinIndex) + momSkinIndex);
 		return [
 			'pure white',
@@ -189,12 +210,12 @@ window.generateGenetics = (function() {
 			'fair',
 			'white',
 			'light',
-			'lightened',
+			'light',
 			'light olive',
 			'olive',
 			'natural',
-			'tanned',
-			'bronzed',
+			'tan',
+			'bronzw',
 			'dark olive',
 			'dark',
 			'light brown',
@@ -209,7 +230,7 @@ window.generateGenetics = (function() {
 	// eyeColor
 	function setEyeColor(father, mother, actor2) {
 		let eyeColor;
-		if (father) {
+		if (father !== 0) {
 			if (mother.origEye == father.origEye) {
 				eyeColor = mother.origEye;
 			} else if (mother.origEye == "red" || mother.origEye == "pale red" || mother.origEye == "light red" || mother.origEye == "pale gray" || mother.origEye == "milky white") {
@@ -242,7 +263,7 @@ window.generateGenetics = (function() {
 	// hColor
 	function setHColor(father, mother, actor2) {
 		let hairColor;
-		if (father) {
+		if (father !== 0) {
 			if (mother.origHColor == father.origHColor) {
 				hairColor = mother.origHColor;
 			} else if (mother.origHColor == "white") {
@@ -271,7 +292,7 @@ window.generateGenetics = (function() {
 	// underArmHairStyle
 	function setUnderArmHStyle(father, mother) {
 		let hair;
-		if (father) {
+		if (father !== 0) {
 			if (mother.underArmHStyle == "hairless" && father.underArmHStyle == "hairless") {
 				hair = "hairless";
 			} else if (mother.underArmHStyle == "hairless" || father.underArmHStyle == "hairless") {
@@ -290,7 +311,7 @@ window.generateGenetics = (function() {
 	// pubicHairStyle
 	function setPubicHStyle(father, mother) {
 		let hair;
-		if (father) {
+		if (father !== 0) {
 			if (mother.pubicHStyle == "hairless" && father.pubicHStyle == "hairless") {
 				hair = "hairless";
 			} else if (mother.pubicHStyle == "hairless" || father.pubicHStyle == "hairless") {
@@ -315,7 +336,7 @@ window.generateGenetics = (function() {
 			markings = "none";
 		}
 		if (markings == "none") {
-			if (father) {
+			if (father !== 0) {
 				markings = jsEither([mother.markings, father.markings, "none", "none"]);
 			} else {
 				markings = jsEither([mother.markings, mother.markings, "none", "none"]);
@@ -327,7 +348,7 @@ window.generateGenetics = (function() {
 	// sexualFlaw
 	function setSexualFlaw(father, mother) {
 		let flaw;
-		if (father) {
+		if (father !== 0) {
 			flaw = jsEither([mother.sexualFlaw, father.sexualFlaw, "none", "none"]);
 		} else {
 			flaw = jsEither([mother.sexualFlaw, mother.sexualFlaw, "none", "none"]);
@@ -338,7 +359,7 @@ window.generateGenetics = (function() {
 	// behavioralFlaw
 	function setBehavioralFlaw(father, mother) {
 		let flaw;
-		if (father) {
+		if (father !== 0) {
 			flaw = jsEither([mother.behavioralFlaw, father.behavioralFlaw, "none", "none"]);
 		} else {
 			flaw = jsEither([mother.behavioralFlaw, mother.behavioralFlaw, "none", "none"]);
@@ -349,7 +370,7 @@ window.generateGenetics = (function() {
 	// fetish
 	function setFetish(father, mother) {
 		let fetish;
-		if (father) {
+		if (father !== 0) {
 			fetish = jsEither(["none", "none", "none", "none", "none", father.fetish, mother.fetish]);
 		} else {
 			fetish = jsEither(["none", "none", "none", "none", "none", mother.fetish, mother.fetish]);
@@ -364,7 +385,7 @@ window.generateGenetics = (function() {
 		if (mother.ID == -1) {
 			if (actor2 == -6) {
 				smarts = jsRandom(90,100);
-			} else if (father) {
+			} else if (father !== 0) {
 				if (father.intelligence < mother.intelligence) {
 					smarts = jsRandom(father.intelligence, mother.intelligence);
 				} else {
@@ -376,7 +397,7 @@ window.generateGenetics = (function() {
 			} else {
 				smarts = jsRandom(50,100);
 			}
-		} else if (father) {
+		} else if (father !== 0) {
 			if (father.intelligence < mother.intelligence) {
 				smarts = jsRandom(father.intelligence, mother.intelligence);
 			} else {
@@ -386,11 +407,11 @@ window.generateGenetics = (function() {
 				smarts = jsRandom(60,100);
 			}
 		} else {
-			smarts = mother.inelligence;
+			smarts = mother.intelligence;
 		}
 		if (V.inbreeding == 1) {
 			if (mother.ID != -1) {
-				if (father && father.ID == -1 && activeMother.breedingMark != 1) {
+				if (father !== 0 && father.ID == -1 && activeMother.breedingMark != 1) {
 					if (smarts >= -95 && jsRandom(1,100) < 40) {
 						smarts -= jsRandom(1,10);
 						if (smarts >= -95 && jsRandom(1,100) < 20) {
@@ -416,7 +437,7 @@ window.generateGenetics = (function() {
 		if (mother.ID == -1) {
 			if (actor2 == -6) {
 				face = jsRandom(90,100);
-			} else if (father) {
+			} else if (father !== 0) {
 				if (father.face < mother.face) {
 					face = jsRandom(father.face, mother.face);
 				} else {
@@ -428,21 +449,21 @@ window.generateGenetics = (function() {
 			} else {
 				face = jsRandom(20,100);
 			}
-		} else if (father) {
-			if (father.intelligence < mother.intelligence) {
-				face = jsRandom(father.intelligence, mother.intelligence);
+		} else if (father !== 0) {
+			if (father.face < mother.face) {
+				face = jsRandom(father.face, mother.face);
 			} else {
-				face = jsRandom(mother.intelligence, father.intelligence);
+				face = jsRandom(mother.face, father.face);
 			}
 			if (activeMother.breedingMark == 1 && face < 60) {
 				face = jsRandom(60,100);
 			}
 		} else {
-			face = mother.inelligence;
+			face = mother.face;
 		}
 		if (V.inbreeding == 1) {
 			if (mother.ID != -1) {
-				if (father && father.ID == -1 && activeMother.breedingMark != 1) {
+				if (father !== 0 && father.ID == -1 && activeMother.breedingMark != 1) {
 					if (face > -100 && jsRandom(1,100) > 60) {
 						face -= jsRandom(2,20);
 					}
diff --git a/src/pregmod/analyzePregnancy.tw b/src/pregmod/analyzePregnancy.tw
index 21351fb8bdc..9ccaf1b9e14 100644
--- a/src/pregmod/analyzePregnancy.tw
+++ b/src/pregmod/analyzePregnancy.tw
@@ -8,12 +8,12 @@
 
 <br><br>
 
-<<set $saleDescription = 1>><<PregnancyDescription>><<set $saleDescription = 0>>
+<<set $saleDescription = 1>><<pregnancyDescription>><<set $saleDescription = 0>>
 
 <br><br>
 Overall statistics:
 <br>&nbsp;&nbsp;&nbsp;&nbsp;Fetal count: $activeSlave.womb.length
-<br>&nbsp;&nbsp;&nbsp;&nbsp;Estimated womb volume: $activeSlave.bellyPreg cc
+<br>&nbsp;&nbsp;&nbsp;&nbsp;Estimated womb volume: <<print commaNum(Math.round($activeSlave.bellyPreg))>> cc
 
 <br><br>
 Furthest developed pregnancy:
@@ -66,42 +66,62 @@ Deep scan:
 <br>
 <<for _ap = 0; _ap < _WL; _ap++>>
 <<capture _ap>>
-	<br>&nbsp;&nbsp;
-	Ova $activeSlave.womb[_ap].genetics.name
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Gender $activeSlave.womb[_ap].genetics.gender
+	Ova: $activeSlave.womb[_ap].genetics.name
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Father ID $activeSlave.womb[_ap].genetics.father
+	Gender: $activeSlave.womb[_ap].genetics.gender
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Father Name $activeSlave.womb[_ap].genetics.fatherName
+	Father ID: $activeSlave.womb[_ap].genetics.father
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Nationality $activeSlave.womb[_ap].genetics.nationality
+	Father Name: $activeSlave.womb[_ap].genetics.fatherName
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Skin $activeSlave.womb[_ap].genetics.skin
+	Mother ID: $activeSlave.womb[_ap].genetics.mother
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Race $activeSlave.womb[_ap].genetics.race
+	Mother Name: $activeSlave.womb[_ap].genetics.motherName
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Intelligence $activeSlave.womb[_ap].genetics.intelligence
+	Nationality: $activeSlave.womb[_ap].genetics.nationality
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Face $activeSlave.womb[_ap].genetics.face
+	Race: $activeSlave.womb[_ap].genetics.race
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Eye Color $activeSlave.womb[_ap].genetics.eyeColor
+	Skin tone: $activeSlave.womb[_ap].genetics.skin
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Hair Color $activeSlave.womb[_ap].genetics.hColor
+	Intelligence index: $activeSlave.womb[_ap].genetics.intelligence out of 100
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Underarm Hair Style $activeSlave.womb[_ap].genetics.underArmHStyle
+	Face index: $activeSlave.womb[_ap].genetics.face out of 100
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Pubic Hair Style $activeSlave.womb[_ap].genetics.pubicHStyle
+	Eye Color: $activeSlave.womb[_ap].genetics.eyeColor
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Markings $activeSlave.womb[_ap].genetics.markings
+	Hair Color: $activeSlave.womb[_ap].genetics.hColor
+	<<if $activeSlave.womb[_ap].genetics.underArmHStyle == "hairless" && $activeSlave.womb[_ap].genetics.pubicHStyle == "hairless">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;
+		Body hair: none
+	<<elseif $activeSlave.womb[_ap].genetics.underArmHStyle == "hairless">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;
+		Body hair: lacks underarm hair
+	<<elseif $activeSlave.womb[_ap].genetics.pubicHStyle == "hairless">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;
+		Body hair: lacks pubic hair
+	<</if>>
+	<<if $activeSlave.womb[_ap].genetics.markings == "freckles" || $activeSlave.womb[_ap].genetics.markings == "heavily freckled">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;
+		Markings: $activeSlave.womb[_ap].genetics.markings
+	<</if>>
+	<br><br>&nbsp;&nbsp;&nbsp;&nbsp;
+	
+	Underarm Hair Style: $activeSlave.womb[_ap].genetics.underArmHStyle
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Sexual Flaw $activeSlave.womb[_ap].genetics.sexualFlaw
+	Pubic Hair Style: $activeSlave.womb[_ap].genetics.pubicHStyle
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Behavioral Flaw $activeSlave.womb[_ap].genetics.behavioralFlaw
+	Markings: $activeSlave.womb[_ap].genetics.markings
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Fetish $activeSlave.womb[_ap].genetics.fetish
+	Sexual Flaw: $activeSlave.womb[_ap].genetics.sexualFlaw
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
-	Reserved $activeSlave.womb[_ap].reserve
+	Behavioral Flaw: $activeSlave.womb[_ap].genetics.behavioralFlaw
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;
+	Fetish: $activeSlave.womb[_ap].genetics.fetish
+	<br><br>&nbsp;&nbsp;&nbsp;&nbsp;
+	
+	Reserved: $activeSlave.womb[_ap].reserve
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;
 
 	<<if $geneticMappingUpgrade == 0>>
-- 
GitLab