From 69ee849d60f5bb43e797bf380e8d251dde147a5b Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sun, 18 Apr 2021 19:33:40 -0400
Subject: [PATCH] face to data

---
 js/003-data/slaveMods.js                      | 21 +++++
 .../surgery/surgeryPassageFaceAndHair.js      | 89 +++++--------------
 src/npc/startingGirls/startingGirls.js        | 12 +--
 3 files changed, 48 insertions(+), 74 deletions(-)

diff --git a/js/003-data/slaveMods.js b/js/003-data/slaveMods.js
index 29eeddb9d31..879a9c8d4ff 100644
--- a/js/003-data/slaveMods.js
+++ b/js/003-data/slaveMods.js
@@ -436,3 +436,24 @@ App.Medicine.Modification.eyebrowFullness = new Set(["pencil-thin", "thin", "thr
 App.Medicine.Modification.pubicStyles = new Set(["waxed", "in a strip", "neat", "bushy", "bushy in the front and neat in the rear", "very bushy"]);
 App.Medicine.Modification.armpitStyles = new Set(["waxed", "shaved", "neat", "bushy"]);
 App.Medicine.Modification.hornColor = new Set(["golden", "copper", "red", "deep red", "green", "pink", "dark brown", "brown", "burgundy", "jet black", "black", "grey", "silver", "white", "blue-violet", "purple", "dark orchid", "sea green", "green-yellow", "dark blue", "blazing red", "neon green", "neon blue", "neon pink"]);
+App.Medicine.Modification.faceShape = new Map([
+	["normal", {
+		desc: `faces have no impact on beauty; the slave's face affects beauty based on its attractiveness alone.`
+	}],
+	["exotic", {
+		desc: `faces exaggerate the impact of facial attractiveness on beauty: being exotic will make an ugly face worse and a beautiful face better.`
+	}],
+	["sensual", {
+		desc: `faces exaggerate the impact of facial attractiveness on beauty, but less than exotic faces do, and also add a small fixed bonus to attractiveness.`
+	}],
+	["cute", {
+		desc: `faces add a larger fixed bonus to attractiveness.`
+	}],
+	["androgynous", {
+		desc: `faces are moderately bad for attractiveness`
+	}],
+	["masculine", {
+		desc: ``,
+		get requirements() { return V.seeDicks !== 0; }
+	}]
+]);
diff --git a/src/facilities/surgery/surgeryPassageFaceAndHair.js b/src/facilities/surgery/surgeryPassageFaceAndHair.js
index c3d7e360f6d..356ee4ed253 100644
--- a/src/facilities/surgery/surgeryPassageFaceAndHair.js
+++ b/src/facilities/surgery/surgeryPassageFaceAndHair.js
@@ -143,82 +143,33 @@ App.UI.surgeryPassageHairAndFace = function(slave, cheat = false) {
 				App.UI.DOM.appendNewElement("div", el, `${His} face cannot sustain further cosmetic surgery`, ["choices", "note"]);
 			} else {
 				const linkArray = [];
-				if (slave.faceShape !== "normal") {
-					linkArray.push(makeLink(
-						`Make conventionally feminine`,
-						"face",
-						() => {
-							slave.faceShape = "normal";
-							slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
-							surgeryDamage(slave, 10);
-						}
-					));
-				}
-				if (slave.faceShape === "masculine") {
+				const faceMap = (slave.faceShape === "masculine") ? new Map([["normal", {}], ["androgynous", {}]]) : App.Medicine.Modification.faceShape;
+
+				for (const [key, shape] of faceMap) {
+					if (
+						(shape.hasOwnProperty("requirements") && !shape.requirements) ||
+						slave.faceShape === key || // Can't change to what you are
+						slave.faceShape !== "androgynous" && key === "masculine" // Can't go directly to or from masculine, have to go through androgynous
+					) {
+						continue;
+					}
+					let title;
+					if (key === "androgynous" && slave.faceShape === "masculine") {
+						title = `Soften to androgynous`;
+					} else if (key === "normal") {
+						title = `Make conventionally feminine`;
+					} else {
+						title = capFirstChar(key);
+					}
 					linkArray.push(makeLink(
-						`Soften to androgynous`,
+						title,
 						"face",
 						() => {
-							slave.faceShape = "androgynous";
+							slave.faceShape = key;
 							slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
 							surgeryDamage(slave, 10);
 						}
 					));
-				} else {
-					if (slave.faceShape !== "cute") {
-						linkArray.push(makeLink(
-							`Cute`,
-							"face",
-							() => {
-								slave.faceShape = "cute";
-								slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
-								surgeryDamage(slave, 10);
-							}
-						));
-					}
-					if (slave.faceShape !== "exotic") {
-						linkArray.push(makeLink(
-							`Exotic`,
-							"face",
-							() => {
-								slave.faceShape = "exotic";
-								slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
-								surgeryDamage(slave, 10);
-							}
-						));
-					}
-					if (slave.faceShape !== "sensual") {
-						linkArray.push(makeLink(
-							`Sensual`,
-							"face",
-							() => {
-								slave.faceShape = "sensual";
-								slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
-								surgeryDamage(slave, 10);
-							}
-						));
-					}
-					if (slave.faceShape !== "androgynous") {
-						linkArray.push(makeLink(
-							`Androgynous`,
-							"face",
-							() => {
-								slave.faceShape = "androgynous";
-								slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
-								surgeryDamage(slave, 10);
-							}
-						));
-					} else {
-						linkArray.push(makeLink(
-							`Masculine`,
-							"face",
-							() => {
-								slave.faceShape = "masculine";
-								slave.faceImplant = Math.clamp(slave.faceImplant + _artificiality, 0, 100);
-								surgeryDamage(slave, 10);
-							}
-						));
-					}
 				}
 				linkArray.push(makeLink(
 					`Just improve attractiveness`,
diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js
index bb8a00eec71..39a15c4515a 100644
--- a/src/npc/startingGirls/startingGirls.js
+++ b/src/npc/startingGirls/startingGirls.js
@@ -882,12 +882,14 @@ App.StartingGirls.upper = function(slave, cheat = false) {
 	const el = new DocumentFragment();
 	const options = new App.UI.OptionsGroup();
 	let option;
-	option = options.addOption("Facial appearance", "faceShape", slave)
-		.addValue("Normal", "normal");
-	if (V.seeDicks !== 0) {
-		option.addValue("Masculine", "masculine");
+
+	option = options.addOption("Facial appearance", "faceShape", slave);
+	for (const [key, shape] of App.Medicine.Modification.faceShape) {
+		if (shape.hasOwnProperty("requirements") && !shape.requirements) {
+			continue;
+		}
+		option.addValue(capFirstChar(key), key);
 	}
-	option.addValueList([["Androgynous", "androgynous"], ["Cute", "cute"], ["Sensual", "sensual"], ["Exotic", "exotic"]]);
 
 	App.StartingGirls.addSet(
 		option = options.addOption("Facial attractiveness", "face", slave),
-- 
GitLab