diff --git a/src/js/generateGenetics.js b/src/js/generateGenetics.js index 4f31a143868d853b25eaf0c50b6fdebf29432d61..6151aeca4ff49eda5a563b94a1779d3522b1fb96 100644 --- a/src/js/generateGenetics.js +++ b/src/js/generateGenetics.js @@ -9,6 +9,13 @@ window.generateGenetics = (function() { let activeFather; let V; + // intelligence and face parameters are the same so we can use the intelligence distribution for face values + const fuzzy = (a, b, spread=20, min=-100, max=100) => Intelligence.random({ + mean: (a+b)/2, + spread: spread, + limitIntelligence: [min, max] + }); + function generateGenetics(actor1, actor2, x) { V = State.variables; genes = { @@ -563,26 +570,14 @@ window.generateGenetics = (function() { if (actor2 === -6) { smarts = jsRandom(90, 100); } else if (father !== 0) { - if (father.intelligence < mother.intelligence) { - smarts = jsRandom(father.intelligence, mother.intelligence); - } else { - smarts = jsRandom(mother.intelligence, father.intelligence); - } - if (smarts <= 50) { - smarts += 30; - } + // player is considered "good stock" + smarts = fuzzy(father.intelligence, mother.intelligence, 20, 50, 100); } else { smarts = jsRandom(50, 100); } } else if (father !== 0) { - if (father.intelligence < mother.intelligence) { - smarts = jsRandom(father.intelligence, mother.intelligence); - } else { - smarts = jsRandom(mother.intelligence, father.intelligence); - } - if (activeMother.breedingMark === 1 && smarts <= 50) { - smarts = jsRandom(60, 100); - } + // elite slaves are also considered "good stock" + smarts = fuzzy(father.intelligence, mother.intelligence, 20, activeMother.breedingMark ? 50 : -100, 100); } else { smarts = mother.intelligence; } @@ -621,26 +616,14 @@ window.generateGenetics = (function() { if (actor2 === -6) { face = jsRandom(90, 100); } else if (father !== 0) { - if (father.face < mother.face) { - face = jsRandom(father.face, mother.face); - } else { - face = jsRandom(mother.face, father.face); - } - if (face <= 40) { - face += jsRandom(5, 20); - } + // player is considered "good stock" + face = fuzzy(father.face, mother.face, 20, 50, 100); } else { face = jsRandom(20, 100); } } else if (father !== 0) { - if (father.face < mother.face) { - face = jsRandom(father.face, mother.face); - } else { - face = jsRandom(mother.face, father.face); - } - if (activeMother.breedingMark === 1 && face < 60) { - face = jsRandom(60, 100); - } + // elite slaves are also considered "good stock" + face = fuzzy(father.face, mother.face, 20, activeMother.breedingMark ? 50 : -100, 100); } else { face = mother.face; }