From 7eaf4bb107100345410732fb3faf8e98d0a7b31f Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sun, 29 Nov 2020 03:01:58 -0500
Subject: [PATCH] age fixes

---
 src/events/intro/pcBodyIntro.js | 118 ++++++++++++++------------------
 1 file changed, 52 insertions(+), 66 deletions(-)

diff --git a/src/events/intro/pcBodyIntro.js b/src/events/intro/pcBodyIntro.js
index d445f3d85e6..ae69d404948 100644
--- a/src/events/intro/pcBodyIntro.js
+++ b/src/events/intro/pcBodyIntro.js
@@ -1,5 +1,7 @@
 App.Intro.PCBodyIntro = function() {
 	V.PC.actualAge = Math.clamp(V.PC.actualAge, 14, 80);
+	V.PC.physicalAge = V.PC.actualAge;
+	V.PC.visualAge = V.PC.actualAge;
 
 	const el = new DocumentFragment();
 	let r = [];
@@ -8,11 +10,12 @@ App.Intro.PCBodyIntro = function() {
 	r.push(App.UI.DOM.makeElement("span", `what's under your business attire?`, ["intro", "question"]));
 	App.Events.addNode(el, r, "p");
 
-	el.append(PCbody());
+	el.append(PCBody());
+	el.append(PCAge());
 
 	return el;
 
-	function PCbody() {
+	function PCBody() {
 		const el = document.createElement("p");
 		const options = new App.UI.OptionsGroup();
 		let r = [];
@@ -54,48 +57,21 @@ App.Intro.PCBodyIntro = function() {
 			if (V.PC.vagina !== -1) {
 				r.push(`slacks, <strong>both a penis and a vagina.</strong>`);
 				options.addOption(r.join(" "))
-					.customButton(
-						"Remove the penis",
-						() => {
-							V.PC.dick = 0;
-							V.PC.balls = 0;
-							V.PC.scrotum = 0;
-							V.PC.prostate = 0;
-						},
-						"PC Body Intro"
-					)
-					.customButton(
-						"Remove the vagina",
-						() => {
-							V.PC.vagina = -1;
-							V.PC.ovaries = 0;
-						},
-						"PC Body Intro"
-					);
+					.customButton("Remove the penis", penisRemove, "PC Body Intro")
+					.customButton("Remove the vagina", vaginaRemove, "PC Body Intro");
 			} else {
 				r.push(`slacks, a <strong>penis.</strong>`);
 				options.addOption(r.join(" "))
 					.customButton(
 						"Switch to vagina",
 						() => {
-							V.PC.dick = 0;
-							V.PC.balls = 0;
-							V.PC.scrotum = 0;
-							V.PC.prostate = 0;
+							penisRemove();
 							V.PC.genes = "XX";
-							V.PC.vagina = 1;
-							V.PC.ovaries = 1;
+							vaginaAdd();
 						},
 						"PC Body Intro"
 					)
-					.customButton(
-						"Add a vagina",
-						() => {
-							V.PC.vagina = 1;
-							V.PC.ovaries = 1;
-						},
-						"PC Body Intro"
-					);
+					.customButton("Add a vagina", vaginaAdd, "PC Body Intro");
 			}
 		} else {
 			r.push(`skirt, a <strong>vagina.</strong>`);
@@ -103,40 +79,50 @@ App.Intro.PCBodyIntro = function() {
 				.customButton(
 					"Switch to penis",
 					() => {
-						V.PC.dick = 4;
-						V.PC.balls = 3;
-						V.PC.scrotum = 3;
-						V.PC.prostate = 1;
+						penisAdd();
 						V.PC.genes = "XY";
-						V.PC.vagina = -1;
-						V.PC.ovaries = 0;
+						vaginaRemove();
 					},
 					"PC Body Intro"
 				)
-				.customButton(
-					"Add a penis",
-					() => {
-						V.PC.dick = 4;
-						V.PC.balls = 3;
-						V.PC.scrotum = 3;
-						V.PC.prostate = 1;
-					},
-					"PC Body Intro"
-				);
+				.customButton("Add a penis", penisAdd, "PC Body Intro");
 		}
 
 		el.append(options.render());
 
 		return el;
+
+		function penisAdd() {
+			V.PC.dick = 4;
+			V.PC.balls = 3;
+			V.PC.scrotum = 3;
+			V.PC.prostate = 1;
+		}
+
+		function penisRemove() {
+			V.PC.dick = 0;
+			V.PC.balls = 0;
+			V.PC.scrotum = 0;
+			V.PC.prostate = 0;
+		}
+
+		function vaginaAdd() {
+			V.PC.vagina = 1;
+			V.PC.ovaries = 1;
+		}
+
+		function vaginaRemove() {
+			V.PC.vagina = -1;
+			V.PC.ovaries = 0;
+		}
 	}
-};
 
-/*
-<p>
-	<div class="intro question">
-		r.push(`How old are you?`);
-	</div>
-	<div>
+	function PCAge() {
+		const el = document.createElement("p");
+		const options = new App.UI.OptionsGroup();
+
+		App.UI.DOM.appendNewElement("div", el, `How old are you?`, ["intro", "question"]);
+		const r = [];
 		r.push(`I'm`);
 		if (V.PC.actualAge >= 65) {
 			r.push(`getting up in years. I've made a legacy for myself, and I'm not done yet.`);
@@ -148,16 +134,16 @@ App.Intro.PCBodyIntro = function() {
 			r.push(`surprisingly young. I'll need to prove myself, but I've got energy to burn.`);
 		}
 		r.push(`My age:`);
-		<span style="font-weight:Bold">
-			<<textbox "V.PC.actualAge" V.PC.actualAge "PC Body Intro">>
-		</span>
-		V.PC.physicalAge = V.PC.actualAge, V.PC.visualAge = V.PC.actualAge;
-	</div>
-	<div class="indent note">
-		r.push(`Older player characters start with more reputation and maintain reputation somewhat more easily, but have slightly less sexual energy.`);
-	</div>
-</p>
+		options.addOption(r.join(" "), "actualAge", V.PC).showTextBox()
+			.addComment(`Older player characters start with more reputation and maintain reputation somewhat more easily, but have slightly less sexual energy.`);
+
+		el.append(options.render());
 
+		return el;
+	}
+};
+
+/*
 <p>
 	<div class="intro question">
 		r.push(`What is your name and alternate indulgence?`);
-- 
GitLab