From cb157549f0ea63d968bfc8f80c4abac6a9cced44 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 26 Sep 2020 01:21:52 -0400
Subject: [PATCH] get rid of that damn gate

---
 src/js/birth/birth.js | 283 ++++++++++++++++++++----------------------
 1 file changed, 134 insertions(+), 149 deletions(-)

diff --git a/src/js/birth/birth.js b/src/js/birth/birth.js
index 2053d3e1bed..d1b1bb51eb8 100644
--- a/src/js/birth/birth.js
+++ b/src/js/birth/birth.js
@@ -22,7 +22,7 @@ globalThis.allBirths = function() {
  * Describes birth for a single slave, and can present options for the player to send the babies to a particular place
  * @param {App.Entity.SlaveState} slave
  */
-globalThis.birth = function(slave, {birthStorm = false} = {}) {
+globalThis.birth = function(slave, { birthStorm = false } = {}) {
 	const el = document.createElement("p");
 	el.style.overflow = "hidden"; // Keep image from floating into the next slave.
 	let p;
@@ -1025,139 +1025,124 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 				birthDamage += 2;
 			}
 			el.append(p);
-			if (
-				(
-					(slave.vagina >= 2 || slave.vaginaLube > 0) && slave.mpreg === 1) ||
-				!newMother ||
-				slave.hips > 0 ||
-				(App.Data.misc.nurseCareers.includes(slave.career) && slave.fetish !== "mindbroken" && slave.muscles >= -95) ||
-				slave.intelligenceImplant >= 15 ||
-				slave.pregAdaptation >= 100
-			) {
-				p = document.createElement("p");
-				App.UI.DOM.appendNewElement("div", p, `However:`);
-
-				if (slave.mpreg === 1) {
-					if (slave.anus >= 2) {
-						App.Events.addNode(
-							p,
-							[
-								`${His}`,
-								App.UI.DOM.makeElement("span", `loose ass`, "green"),
-								`made birthing ${his} ${children} easier.`
-							],
-							"div"
-						);
-					}
-					birthDamage -= slave.anus;
-				} else {
-					if (slave.vagina >= 2) {
-						App.Events.addNode(
-							p,
-							[
-								`${His}`,
-								App.UI.DOM.makeElement("span", `loose vagina`, "green"),
-								`made birthing ${his} ${children} easier.`
-							],
-							"div"
-						);
-						birthDamage -= slave.vagina;
-					}
-					if (slave.vaginaLube > 0) {
-						App.Events.addNode(
-							p,
-							[
-								`${His}`,
-								App.UI.DOM.makeElement("span", `moist vagina`, "green"),
-								`hastened ${his} ${children}'s birth.`
-							],
-							"div"
-						);
-						birthDamage -= slave.vaginaLube;
-					}
-				}
 
-				if (!newMother) {
-					App.Events.addNode(
-						p,
-						[
-							`${He} has`,
-							App.UI.DOM.makeElement("span", `given birth before,`, "green"),
-							`so ${he} knows just what to do.`
-						],
-						"div"
-					);
-					birthDamage -= 3;
-				}
-				if (slave.hips > 0) {
-					App.Events.addNode(
-						p,
-						[
-							`${His} `,
-							App.UI.DOM.makeElement("span", `wide hips`, "green"),
-							`greatly aided childbirth.`
-						],
-						"div"
-					);
-					birthDamage -= slave.hips;
+			r = [];
+			if (slave.mpreg === 1) {
+				if (slave.anus >= 2) {
+					r.push([
+						`${His}`,
+						App.UI.DOM.makeElement("span", `loose ass`, "green"),
+						`made birthing ${his} ${children} easier.`
+					]);
 				}
-				r = [];
-				if (slave.pregAdaptation >= 1000) {
-					r.push(`${His} body has`);
-					r.push(App.UI.DOM.makeElement("span", `completely adapted to pregnancy;`, "green"));
-					r.push(`when it is time to give birth, that baby is coming out fast.`);
-					birthDamage -= 10;
-				} else if (slave.pregAdaptation >= 500) {
-					r.push(`${His} body is`);
-					r.push(App.UI.DOM.makeElement("span", `highly adapted to bearing life`, "green"));
-					r.push(`and birth is no small part of that.`);
-					birthDamage -= 3;
-				} else if (slave.pregAdaptation >= 100) {
-					r.push(`${His} body has`);
-					r.push(App.UI.DOM.makeElement("span", `become quite adept at bearing children,`, "green"));
-					r.push(`birth included.`);
-					birthDamage -= 1;
+				birthDamage -= slave.anus;
+			} else {
+				if (slave.vagina >= 2) {
+					r.push([
+						`${His}`,
+						App.UI.DOM.makeElement("span", `loose vagina`, "green"),
+						`made birthing ${his} ${children} easier.`
+					]);
+					birthDamage -= slave.vagina;
 				}
-				App.Events.addNode(p, r, "div");
-
-				if (slave.curatives > 0) {
-					App.Events.addNode(
-						p,
-						[
-							`${His} `,
-							App.UI.DOM.makeElement("span", `curatives`, "green"),
-							`helped protect ${him}.`
-						],
-						"div"
-					);
-					birthDamage -= 3;
+				if (slave.vaginaLube > 0) {
+					r.push([
+						`${His}`,
+						App.UI.DOM.makeElement("span", `moist vagina`, "green"),
+						`hastened ${his} ${children}'s birth.`
+					]);
+					birthDamage -= slave.vaginaLube;
 				}
+			}
 
-				r = [];
-				if (App.Data.misc.nurseCareers.includes(slave.career) && slave.fetish !== "mindbroken" && slave.muscles >= -95) {
-					r.push(`Thanks to ${his}`);
-					r.push(App.UI.DOM.makeElement("span", `previous career,`, "green"));
-					r.push(`childbirth went smoothly.`);
-					birthDamage = 0;
-				} else if (slave.intelligenceImplant >= 15) {
-					r.push(`${He} was`);
-					r.push(App.UI.DOM.makeElement("span", `taught how to handle birth`, "green"));
-					r.push(`in class.`);
-					birthDamage -= 2;
+			if (!newMother) {
+				r.push([
+					`${He} has`,
+					App.UI.DOM.makeElement("span", `given birth before,`, "green"),
+					`so ${he} knows just what to do.`
+				]);
+				birthDamage -= 3;
+			}
+
+			if (slave.hips > 0) {
+				r.push([
+					`${His} `,
+					App.UI.DOM.makeElement("span", `wide hips`, "green"),
+					`greatly aided childbirth.`
+				]);
+				birthDamage -= slave.hips;
+			}
+
+			if (slave.pregAdaptation >= 1000) {
+				r.push([
+					`${His} body has`,
+					App.UI.DOM.makeElement("span", `completely adapted to pregnancy;`, "green"),
+					`when it is time to give birth, that baby is coming out fast.`
+				]);
+				birthDamage -= 10;
+			} else if (slave.pregAdaptation >= 500) {
+				r.push([
+					`${His} body is`,
+					App.UI.DOM.makeElement("span", `highly adapted to bearing life`, "green"),
+					`and birth is no small part of that.`
+				]);
+				birthDamage -= 3;
+			} else if (slave.pregAdaptation >= 100) {
+				r.push([
+					`${His} body has`,
+					App.UI.DOM.makeElement("span", `become quite adept at bearing children,`, "green"),
+					`birth included.`
+				]);
+				birthDamage -= 1;
+			}
+
+			if (slave.curatives > 0) {
+				r.push([
+					`${His} `,
+					App.UI.DOM.makeElement("span", `curatives`, "green"),
+					`helped protect ${him}.`
+				]);
+				birthDamage -= 3;
+			}
+
+			if (App.Data.misc.nurseCareers.includes(slave.career) && slave.fetish !== "mindbroken" && slave.muscles >= -95) {
+				r.push([
+					`Thanks to ${his}`,
+					App.UI.DOM.makeElement("span", `previous career,`, "green"),
+					`childbirth went smoothly.`
+				]);
+				birthDamage = 0;
+			} else if (slave.intelligenceImplant >= 15) {
+				r.push([
+					`${He} was`,
+					App.UI.DOM.makeElement("span", `taught how to handle birth`, "green"),
+					`in class.`
+				]);
+				birthDamage -= 2;
+			}
+
+			if (slave.geneticQuirks.uterineHypersensitivity === 2) {
+				if (V.geneticMappingUpgrade >= 1) {
+					r.push([
+						`${His} hypersensitive uterus made birth`,
+						App.UI.DOM.makeElement("span", `a very pleasant experience,`, "green"),
+						`distracting from the pain.`
+					]);
+				} else {
+					r.push([
+						`${He} oddly climaxed multiple times during birth,`,
+						App.UI.DOM.makeElement("span", `keeping ${his} mind off the pain.`, "green")
+					]);
 				}
-				App.Events.addNode(p, r, "div");
-				if (slave.geneticQuirks.uterineHypersensitivity === 2) {
-					r = [];
-					if (V.geneticMappingUpgrade >= 1) {
-						r.push(`${His} hypersensitive uterus made birth`);
-						r.push(App.UI.DOM.makeElement("span", `a very pleasant experience,`, "green"));
-						r.push(`distracting from the pain.`);
-					} else {
-						r.push(`${He} oddly climaxed multiple times during birth,`);
-						r.push(App.UI.DOM.makeElement("span", `keeping ${his} mind off the pain.`, "green"));
-					}
-					birthDamage -= 5;
-					App.Events.addNode(p, r, "div");
+				birthDamage -= 5;
+			}
+
+			// If we added material to r (likely) give it a title and assemble it for display
+			if (r.length > 0) {
+				p = document.createElement("p");
+				App.UI.DOM.appendNewElement("div", p, `However:`);
+				for (const boost of r) {
+					App.Events.addNode(p, boost, "div");
 				}
 				el.append(p);
 			}
@@ -2003,7 +1988,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 		let _tempSub;
 		let _HGL;
 		let his2, he2, him2;
-		const {HeU, hisU, heU, himU, himselfU, girlU} = getNonlocalPronouns(V.seeDicks).appendSuffix('U');
+		const { HeU, hisU, heU, himU, himselfU, girlU } = getNonlocalPronouns(V.seeDicks).appendSuffix('U');
 		const children = slave.pregType > 1 ? `children` : `child`;
 		const childrenAre = slave.pregType > 1 ? `children are` : `child is`;
 		const UH = (slave.geneticQuirks.uterineHypersensitivity === 2) ? `, convulsing with orgasms in the process` : ``;
@@ -2079,7 +2064,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 				case "be a subordinate slave":
 					_tempSub = getSlave(slave.subTarget);
 					if (_tempSub) {
-						({his2} = getPronouns(_tempSub).appendSuffix("2"));
+						({ his2 } = getPronouns(_tempSub).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (slave.subTarget === 0) {
@@ -2860,7 +2845,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 					break;
 				case "rest in the spa":
 					if (S.Attendant) {
-						({he2, him2} = getPronouns(S.Attendant).appendSuffix("2"));
+						({ he2, him2 } = getPronouns(S.Attendant).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (random(1, 20) > suddenBirth) {
@@ -2913,7 +2898,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 				case "work as a nanny":		// TODO: this needs a rewrite
 					if (V.MatronID !== 0) {
-						({he2} = getPronouns(S.Matron).appendSuffix("2"));
+						({ he2 } = getPronouns(S.Matron).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (random(1, 20) > suddenBirth) {
@@ -2966,7 +2951,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 				case "learn in the schoolroom":
 					if (S.Schoolteacher) {
-						({he2} = getPronouns(S.Schoolteacher).appendSuffix("2"));
+						({ he2 } = getPronouns(S.Schoolteacher).appendSuffix("2"));
 					}
 					if (!canWalk(slave)) {
 						if (random(1, 20) > suddenBirth) {
@@ -3283,7 +3268,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 					break;
 
 				case "live with your Head Girl":
-					({he2} = getPronouns(S.HeadGirl).appendSuffix("2"));
+					({ he2 } = getPronouns(S.HeadGirl).appendSuffix("2"));
 					if (slave.pregSource === V.HeadGirlID) {
 						if (random(1, 20) > suddenBirth) {
 							r.push(`${S.HeadGirl.slaveName} makes sure that the mother of ${his2} child is happy and comfortable for the upcoming birth, even if they won't be spending much time with their offspring. ${he2} carefully undresses ${slave.slaveName}, all the while whispering sweet nothings in ${his} ear. ${He} begins to push out ${firstText} baby${UH}, and ${his} child is carefully collected by their father. Once they are out of the way, ${S.HeadGirl.slaveName} moves in to fondle ${slave.slaveName}'s tired, still very gravid body.`);
@@ -3340,9 +3325,9 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 				case "get treatment in the clinic":
 					if (S.Nurse) {
-						({he2, his2} = getPronouns(S.Nurse).appendSuffix("2"));
+						({ he2, his2 } = getPronouns(S.Nurse).appendSuffix("2"));
 					} else {
-						({he2, his2} = getNonlocalPronouns(V.seeDicks).appendSuffix('2'));
+						({ he2, his2 } = getNonlocalPronouns(V.seeDicks).appendSuffix('2'));
 					}
 					if (!canWalk(slave)) {
 						if (random(1, 20) > suddenBirth) {
@@ -3907,7 +3892,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 				case "be a subordinate slave":
 					_tempSub = getSlave(slave.subTarget);
 					if (_tempSub) {
-						({he2} = getPronouns(_tempSub).appendSuffix("2"));
+						({ he2 } = getPronouns(_tempSub).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (slave.subTarget === 0) {
@@ -4557,7 +4542,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 					break;
 
 				case "live with your Head Girl":
-					({he2, his2} = getPronouns(S.HeadGirl).appendSuffix("2"));
+					({ he2, his2 } = getPronouns(S.HeadGirl).appendSuffix("2"));
 					if (!canWalk(slave)) {
 						if (slave.fetish === "mindbroken") {
 							r.push(`${slave.slaveName} is awoken from ${his} rest by a strong contraction. ${He} attempts to roll over, and failing that, begins to fall back to sleep as another contraction wracks ${his} body. ${His} body begins to birth another of ${his} brood.`);
@@ -4587,7 +4572,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 				case "get treatment in the clinic":
 					if (S.Nurse) {
-						({he2, his2} = getPronouns(S.Nurse).appendSuffix("2"));
+						({ he2, his2 } = getPronouns(S.Nurse).appendSuffix("2"));
 					}
 					r.push(`${slave.slaveName} is in the perfect place to give birth when ${his} body begins to push out another of ${his} brood.`);
 					if (S.Nurse) {
@@ -4801,7 +4786,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 				case "be a subordinate slave": {
 					const domSlave = getSlave(slave.subTarget);
 					if (domSlave) {
-						({he2} = getPronouns(domSlave).appendSuffix("2"));
+						({ he2 } = getPronouns(domSlave).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (slave.subTarget === 0) {
@@ -5257,7 +5242,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 					break;
 
 				case "live with your Head Girl":
-					({He2, he2, his2} = getPronouns(S.HeadGirl).appendSuffix("2"));
+					({ He2, he2, his2 } = getPronouns(S.HeadGirl).appendSuffix("2"));
 					if (slave.pregSource === V.HeadGirlID) {
 						r.push(`${S.HeadGirl.slaveName} makes sure that the mother of ${his2} ${children} is happy and comfortable for the upcoming birth, even if they won't be spending much time with their offspring. ${He2} carefully undresses ${slave.slaveName}, all the while whispering sweet nothings in ${his} ear. ${He} begins to push out ${his} ${babies},`);
 						if (slave.geneticQuirks.uterineHypersensitivity === 2) {
@@ -5467,7 +5452,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 				case "be a subordinate slave": {
 					const domSlave = getSlave(slave.subTarget);
 					if (bw) {
-						({he2} = getPronouns(domSlave).appendSuffix("2"));
+						({ he2 } = getPronouns(domSlave).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (slave.subTarget === 0) {
@@ -5758,7 +5743,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 					break;
 
 				case "live with your Head Girl":
-					({he2} = getPronouns(S.HeadGirl).appendSuffix("2"));
+					({ he2 } = getPronouns(S.HeadGirl).appendSuffix("2"));
 					if (slave.pregSource === V.HeadGirlID) {
 						r.push(`${S.HeadGirl.slaveName} makes sure that the mother of ${his2} ${children} is happy and comfortable for the upcoming birth, even if they won't be spending much time with their offspring. ${He2} carefully undresses ${slave.slaveName}, all the while whispering sweet nothings in ${his} ear. ${He} begins to push out ${his} ${babies},`);
 						if (slave.geneticQuirks.uterineHypersensitivity === 2) {
@@ -5828,7 +5813,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 			const rival = slave.rivalry > 0 ? getSlave(slave.rivalryTarget) : null;
 			if (rival) {
-				({he2} = getPronouns(rival).appendSuffix("2"));
+				({ he2 } = getPronouns(rival).appendSuffix("2"));
 			}
 
 			if (slave.fetish === "mindbroken") {
@@ -5899,7 +5884,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 				case "be a subordinate slave": {
 					const domSlave = getSlave(slave.subTarget);
 					if (domSlave) {
-						({he2} = getPronouns(domSlave).appendSuffix("2"));
+						({ he2 } = getPronouns(domSlave).appendSuffix("2"));
 					}
 					if (slave.fetish === "mindbroken") {
 						if (slave.subTarget === 0) {
@@ -6394,7 +6379,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 				case "learn in the schoolroom":
 					if (S.Schoolteacher) {
-						({he2, his2} = getPronouns(S.Schoolteacher).appendSuffix("2"));
+						({ he2, his2 } = getPronouns(S.Schoolteacher).appendSuffix("2"));
 					}
 					if (!canWalk(slave)) {
 						r.push(`During a lesson in ${V.schoolroomName}, ${slave.slaveName}'s water breaks. Since ${he} can't leave the lesson, ${he} tries ${his} best to hold back the upcoming birth. ${He} fails to do so and a particularly strong contraction elicits a moan noticeable enough to draw all the students' attention.`);
@@ -6574,7 +6559,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 					break;
 
 				case "live with your Head Girl":
-					({he2} = getPronouns(S.HeadGirl).appendSuffix("2"));
+					({ he2 } = getPronouns(S.HeadGirl).appendSuffix("2"));
 					if (!canWalk(slave)) {
 						if (slave.fetish === "mindbroken") {
 							r.push(`${slave.slaveName} is awoken from ${his} rest by a strong contraction. ${He} rolls over and begins to fall back to sleep as another wracks ${his} body.`);
@@ -6604,7 +6589,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 				case "get treatment in the clinic":
 					if (S.Nurse) {
-						({he2, his2} = getPronouns(S.Nurse).appendSuffix("2"));
+						({ he2, his2 } = getPronouns(S.Nurse).appendSuffix("2"));
 					}
 					r.push(`${slave.slaveName} is in the perfect place to give birth when ${his} water breaks.`);
 					if (S.Nurse) {
@@ -6665,7 +6650,7 @@ globalThis.birth = function(slave, {birthStorm = false} = {}) {
 
 	function deadlyBirthScene() {
 		const el = document.createElement("p");
-		const {HeU, heU} = getNonlocalPronouns(V.seeDicks).appendSuffix('U');
+		const { HeU, heU } = getNonlocalPronouns(V.seeDicks).appendSuffix('U');
 		let r = [];
 		slaveDead = 1;
 		const babies = slave.pregType > 1 ? `babies` : `baby`;
-- 
GitLab