From e17ba57788b836eb8bf5bec75f7d6667779088d0 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Mon, 1 Mar 2021 20:01:19 +0100
Subject: [PATCH] fix heterochromia generation

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

diff --git a/src/npc/generate/generateGenetics.js b/src/npc/generate/generateGenetics.js
index 292a41b52e2..4cb2f91ea5b 100644
--- a/src/npc/generate/generateGenetics.js
+++ b/src/npc/generate/generateGenetics.js
@@ -970,19 +970,12 @@ globalThis.generateGenetics = (function() {
 		quirks.albinism = genes(father !== 0 ? father.geneticQuirks.albinism : 0, mother.geneticQuirks.albinism);
 
 		// heterochromia
-		// FIXME heterochromia is a string when active, this is not respected here.
-		if (father !== 0) {
-			fatherGenes = father.geneticQuirks.heterochromia;
-		}
-		geneTarget = Math.pow(2, mother.geneticQuirks.heterochromia + fatherGenes);
-		if (geneTarget >= 2) {
-			chance = jsRandom(1, 16);
-			if (chance <= geneTarget) {
-				quirks.heterochromia = 2;
-			} else if (chance <= 3 * geneTarget) {
-				quirks.heterochromia = 1;
-			}
-		}
+		quirks.heterochromia = genes(
+			father === 0 ? 0 :
+				typeof father.geneticQuirks.heterochromia === "string" ? 2 :
+					father.geneticQuirks.heterochromia,
+			typeof mother.geneticQuirks.heterochromia === "string" ? 2 :
+				mother.geneticQuirks.heterochromia);
 
 		// rear lipedema
 		quirks.rearLipedema = genes(father !== 0 ? father.geneticQuirks.rearLipedema : 0, mother.geneticQuirks.rearLipedema);
-- 
GitLab