From 368be4985b772f62ccf185c6c36e2355e4fbb43e Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Wed, 10 Feb 2021 02:01:22 -0800
Subject: [PATCH] Starting Girls fixes - be clearer about what birth week
 means, tolerate large birth weeks, fix JSDoc, and fix slaves getting invalid
 hearing settings with extreme mods turned off.

---
 src/npc/startingGirls/startingGirls.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js
index da1f71da9d1..6a7127f0e5a 100644
--- a/src/npc/startingGirls/startingGirls.js
+++ b/src/npc/startingGirls/startingGirls.js
@@ -58,6 +58,9 @@ App.StartingGirls.cleanup = function(slave) {
 	slave.physicalAge = slave.actualAge;
 	slave.visualAge = slave.actualAge;
 	slave.ovaryAge = slave.actualAge;
+	if (slave.birthWeek > 51) {
+		slave.birthWeek = slave.birthWeek % 52;
+	}
 	slave.birthWeek = Math.clamp(slave.birthWeek, 0, 51) || 0;
 
 	slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0;
@@ -676,7 +679,7 @@ App.StartingGirls.addSet = function(option, set) {
 /**
  * @param {App.Entity.SlaveState} slave
  * @param {boolean} cheat
- * @returns {HTMLDivElement}
+ * @returns {DocumentFragment}
  */
 App.StartingGirls.physical = function(slave, cheat = false) {
 	const el = new DocumentFragment();
@@ -761,8 +764,8 @@ App.StartingGirls.physical = function(slave, cheat = false) {
 	option.addValueList([["Normal", 0], ["Hard of hearing", -1]]);
 	if (V.seeExtreme === 1) {
 		option.addValue("Deaf", -2);
-	} else if (slave.hears === 0) {
-		slave.hears = 2;
+	} else if (slave.hears === -2) {
+		slave.hears = -1;
 	}
 
 	App.StartingGirls.addSet(
@@ -1097,7 +1100,7 @@ App.StartingGirls.physical = function(slave, cheat = false) {
 /**
  * @param {App.Entity.SlaveState} slave
  * @param {boolean} cheat
- * @returns {HTMLDivElement}
+ * @returns {DocumentFragment}
  */
 App.StartingGirls.profile = function(slave, cheat = false) {
 	const el = new DocumentFragment();
@@ -1179,7 +1182,7 @@ App.StartingGirls.profile = function(slave, cheat = false) {
 		.customButton("Resync only height to age", () => slave.height = Height.random(slave), "")
 		.addComment("It is recommended to resync if you change age significantly");
 
-	options.addOption("Birth week", "birthWeek", slave).showTextBox();
+	options.addOption("Weeks since birthday", "birthWeek", slave).showTextBox();
 
 	if (cheat) {
 		options.addOption("Owned since week", "weekAcquired", slave).showTextBox();
@@ -1280,7 +1283,7 @@ App.StartingGirls.profile = function(slave, cheat = false) {
 /**
  * @param {App.Entity.SlaveState} slave
  * @param {boolean} cheat
- * @returns {HTMLDivElement}
+ * @returns {DocumentFragment}
  */
 App.StartingGirls.mental = function(slave, cheat = false) {
 	const el = new DocumentFragment();
-- 
GitLab