From 7ea0d96671ad48dc026a3d0ce7f9baf13cf61023 Mon Sep 17 00:00:00 2001
From: Empress Sela <empresssela@cock.li>
Date: Fri, 17 Jul 2020 22:26:58 -0400
Subject: [PATCH] Add inbreeding to face calculation

---
 src/npc/generate/generateGenetics.js | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/npc/generate/generateGenetics.js b/src/npc/generate/generateGenetics.js
index 8d0e579b0f8..f306ad9d026 100644
--- a/src/npc/generate/generateGenetics.js
+++ b/src/npc/generate/generateGenetics.js
@@ -103,7 +103,7 @@ globalThis.generateGenetics = (function() {
 		genes.skin = setSkin(father, mother, actor2);
 		genes.race = setRace(father, mother, actor2);
 		genes.intelligence = setIntelligence(father, mother, activeMother, actor2, genes.inbreedingCoeff);
-		genes.face = setFace(father, mother, activeMother, actor2, genes.geneticQuirks);
+		genes.face = setFace(father, mother, activeMother, actor2, genes.geneticQuirks, genes.inbreedingCoeff);
 		genes.faceShape = setFaceShape(father, mother, genes.geneticQuirks);
 		genes.eyeColor = setEyeColor(father, mother, actor2);
 		if (genes.geneticQuirks.heterochromia === 2) {
@@ -614,7 +614,7 @@ globalThis.generateGenetics = (function() {
 	}
 
 	// face
-	function setFace(father, mother, activeMother, actor2, genes) {
+	function setFace(father, mother, activeMother, actor2, genes, inbreedingCoeff) {
 		let face;
 		if (genes.pFace > 0 && genes.uFace > 0) {
 			face = 0;
@@ -644,19 +644,8 @@ globalThis.generateGenetics = (function() {
 			face = mother.face;
 		}
 		if (V.inbreeding === 1 && genes.pFace === 0 && genes.uFace === 0) {
-			if (mother.ID !== -1) {
-				if (father !== 0 && father.ID === -1 && activeMother.breedingMark !== 1) {
-					if (face > -100 && jsRandom(1, 100) > 60) {
-						face -= jsRandom(2, 20);
-					}
-				} else {
-					if (face > -100 && jsRandom(1, 100) < 50) {
-						face -= jsRandom(1, 15);
-						if (face >= -95 && jsRandom(1, 100) < 30) {
-							face -= jsRandom(5, 20);
-						}
-					}
-				}
+			if (jsRandom(1, 100) < inbreedingCoeff*200) {
+				face -= Math.abs(normalRandInt(5*inbreedingCoeff, 35*inbreedingCoeff, -100*coeff, 100*coeff));
 			}
 		}
 		return Math.clamp(face, -100, 100);
-- 
GitLab