From 204965b08b8a453a6c4a8937d76ceb0211fcb9d9 Mon Sep 17 00:00:00 2001 From: Empress Sela <empresssela@cock.li> Date: Wed, 8 Jul 2020 22:14:39 -0400 Subject: [PATCH] First iteration of COI effect on intelligence --- src/npc/generate/generateGenetics.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/npc/generate/generateGenetics.js b/src/npc/generate/generateGenetics.js index 8e7ad2bc128..8d0e579b0f8 100644 --- a/src/npc/generate/generateGenetics.js +++ b/src/npc/generate/generateGenetics.js @@ -102,7 +102,7 @@ globalThis.generateGenetics = (function() { genes.geneticQuirks = setGeneticQuirks(activeFather, activeMother, genes.gender); genes.skin = setSkin(father, mother, actor2); genes.race = setRace(father, mother, actor2); - genes.intelligence = setIntelligence(father, mother, activeMother, actor2); + genes.intelligence = setIntelligence(father, mother, activeMother, actor2, genes.inbreedingCoeff); genes.face = setFace(father, mother, activeMother, actor2, genes.geneticQuirks); genes.faceShape = setFaceShape(father, mother, genes.geneticQuirks); genes.eyeColor = setEyeColor(father, mother, actor2); @@ -582,7 +582,7 @@ globalThis.generateGenetics = (function() { } // intelligence - function setIntelligence(father, mother, activeMother, actor2) { + function setIntelligence(father, mother, activeMother, actor2, inbreedingCoeff) { let smarts; if (mother.ID === -1) { if (actor2 === -6) { @@ -606,22 +606,8 @@ globalThis.generateGenetics = (function() { smarts = mother.intelligence; } if (V.inbreeding === 1) { - if (mother.ID !== -1) { - if (father !== 0 && father.ID === -1 && activeMother.breedingMark !== 1) { - if (smarts >= -95 && jsRandom(1, 100) < 40) { - smarts -= jsRandom(1, 10); - if (smarts >= -95 && jsRandom(1, 100) < 20) { - smarts -= jsRandom(1, 5); - } - } - } else { - if (smarts >= -95 && jsRandom(1, 100) < 50) { - smarts -= jsRandom(1, 15); - if (smarts >= -95 && jsRandom(1, 100) < 30) { - smarts -= jsRandom(1, 15); - } - } - } + if (jsRandom(1, 100) < inbreedingCoeff*200) { + smarts -= Math.abs(normalRandInt(5*inbreedingCoeff, 30*inbreedingCoeff, -100*coeff, 100*coeff)); } } return Math.clamp(smarts, -100, 100); -- GitLab