diff --git a/src/js/generateGenetics.js b/src/js/generateGenetics.js index 6d4c1a755da8af9955001a727e814e40908f29fc..3cd4fa3595c93a9f97c88621a7de6be8886c404b 100644 --- a/src/js/generateGenetics.js +++ b/src/js/generateGenetics.js @@ -1063,265 +1063,108 @@ globalThis.generateGenetics = (function() { */ globalThis.generateChild = function(mother, ova, destination) { let genes = ova.genetics; // maybe just argument this? We'll see. - let pregUpgrade = V.pregnancyMonitoringUpgrade; let child = {}; - if (!destination) { // does extra work for the incubator if defined, otherwise builds a simple object - if (genes.gender === "XX") { - child.genes = "XX"; - child.slaveSurname = genes.surname; - if (!pregUpgrade) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed !== undefined) { - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = `Your daughter`; - } else { - child.slaveName = `Your and ${genes.fatherName}'s daughter`; - } - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveName = `${genes.motherName}'s and your daughter`; - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s daughter`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - child.slaveName = `${genes.motherName}'s bastard daughter`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } - } + function setSurname() { + child.slaveSurname = genes.surname; + if (genes.clone) { + if (genes.cloneID === -1) { + child.slaveSurname = V.PC.slaveSurname; } else { - let childName = genes.name; - if (childName.indexOf("ovum") === 0) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed !== undefined) { - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = "Your son"; - } else { - child.slaveName = `Your and ${genes.fatherName}'s son`; - } - } else { - if (genes.father === -1) { - child.slaveName = `${genes.motherName}'s and your son`; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s son`; - } else { - child.slaveName = `${genes.motherName}'s bastard son`; - } + let cloneSeed = getSlave(genes.cloneID); + if (cloneSeed !== undefined) { + if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { + child.slaveSurname = cloneSeed.slaveSurname; } - } else { - child.slaveName = genes.name; } - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed !== undefined) { - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } - } else if (genes.mother === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } + } + } else if (genes.mother === -1 || genes.father === -1) { + child.slaveSurname = V.PC.slaveSurname; + } else if (genes.father > 0) { + let currentMother = getSlave(genes.mother); + if (currentMother !== undefined) { + if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { + child.slaveSurname = currentMother.slaveSurname; + } + } else { + let currentFather = getSlave(genes.father); + if (currentFather !== undefined) { + if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { + child.slaveSurname = currentFather.slaveSurname; } } } } else { - child.genes = "XY"; - child.slaveSurname = genes.surname; - if (!pregUpgrade) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed !== undefined) { - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = "Your son"; - } else { - child.slaveName = `Your and ${genes.fatherName}'s son`; - } - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveName = `${genes.motherName}'s and your son`; - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s son`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - child.slaveName = `${genes.motherName}'s bastard son`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } + let currentMother = getSlave(genes.mother); + if (currentMother !== undefined) { + if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { + child.slaveSurname = currentMother.slaveSurname; } - } else { - let childName = genes.name; - if (childName.indexOf("ovum") === 0) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed !== undefined) { - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = "Your son"; - } else { - child.slaveName = `Your and ${genes.fatherName}'s son`; - } - } else { - if (genes.father === -1) { - child.slaveName = `${genes.motherName}'s and your son`; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s son`; - } else { - child.slaveName = `${genes.motherName}'s bastard son`; - } - } + } + } + } + + function setSlaveName() { + const relString = child.genes === "XX" ? "daughter" : "son"; + if (!(V.pregnancyMonitoringUpgrade) || genes.name.indexOf("ovum") === 0) { + if (genes.clone) { + if (genes.cloneID === -1) { + child.slaveName = `Your clone`; } else { - child.slaveName = genes.name; + child.slaveName = `${genes.clone}'s clone`; } - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed !== undefined) { - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } - } else if (genes.mother === -1) { - child.slaveSurname = V.PC.slaveSurname; + } else if (genes.mother === -1) { + if (genes.father <= 0) { + child.slaveName = `Your ${relString}`; } else { - if (genes.father === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } + child.slaveName = `Your and ${genes.fatherName}'s ${relString}`; } + } else if (genes.father === -1) { + child.slaveName = `${genes.motherName}'s and your ${relString}`; + } else if (genes.father > 0) { + child.slaveName = `${genes.motherName} and ${genes.fatherName}'s ${relString}`; + } else { + child.slaveName = `${genes.motherName}'s bastard ${relString}`; } + } else { + child.slaveName = genes.name; } + } + + function makeAlbinismOverride(race) { + let albinismOverride = { + skin: 0, + eyeColor: "red", + hColor: "white" + }; + switch (race) { + case "black": + case "indo-aryan": + case "malay": + case "pacific islander": + case "amerindian": + albinismOverride.skin = "very fair"; + break; + case "latina": + albinismOverride.skin = "extremely fair"; + break; + case "asian": + case "middle eastern": + case "semitic": + case "southern european": + case "white": + albinismOverride.skin = "pure white"; + break; + default: + albinismOverride.skin = "pure white"; + } + return albinismOverride; + } + + if (!destination) { // does extra work for the incubator if defined, otherwise builds a simple object + child.genes = genes.gender; + setSlaveName(); + setSurname(); child.mother = genes.mother; child.father = genes.father; @@ -1343,32 +1186,7 @@ globalThis.generateChild = function(mother, ova, destination) { child.fetish = genes.fetish; child.geneticQuirks = clone(genes.geneticQuirks); if (child.geneticQuirks.albinism === 2) { - child.albinismOverride = { - skin: 0, - eyeColor: "red", - hColor: "white" - }; - switch (child.race) { - case "black": - case "indo-aryan": - case "malay": - case "pacific islander": - case "amerindian": - child.albinismOverride.skin = "very fair"; - break; - case "latina": - child.albinismOverride.skin = "extremely fair"; - break; - case "asian": - case "middle eastern": - case "semitic": - case "southern european": - case "white": - child.albinismOverride.skin = "pure white"; - break; - default: - child.albinismOverride.skin = "pure white"; - } + child.albinismOverride = makeAlbinismOverride(child.race); } child.origSkin = genes.skin; child.eye.origColor = genes.eyeColor; @@ -1395,254 +1213,20 @@ globalThis.generateChild = function(mother, ova, destination) { } } } else { - V.activeSlaveOneTimeMinAge = V.targetAge; - V.activeSlaveOneTimeMaxAge = V.targetAge; - // eslint-disable-next-line camelcase - V.one_time_age_overrides_pedo_mode = 1; + const fixedAge = { + minAge: V.targetAge, + maxAge: V.targetAge, + ageOverridesPedoMode: 1, + mature: 0 + }; if (genes.gender === "XX") { - child = GenerateNewSlave("XX", {mature: 0}); - child.slaveSurname = genes.surname; - if (!pregUpgrade) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = `Your daughter`; - } else { - child.slaveName = `Yours and ${genes.fatherName}'s daughter`; - } - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveName = `Yours and ${genes.motherName}'s daughter`; - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s daughter`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - child.slaveName = `${genes.motherName}'s bastard daughter`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } - } - } else { - let childName = genes.name; - if (childName.indexOf("ovum") === 0) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = `Your daughter`; - } else { - child.slaveName = `Yours and ${genes.fatherName}'s daughter`; - } - } else { - if (genes.father === -1) { - child.slaveName = `Yours and ${genes.motherName}'s daughter`; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s daughter`; - } else { - child.slaveName = `${genes.motherName}'s bastard daughter`; - } - } - } else { - child.slaveName = genes.name; - } - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } else if (genes.mother === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } - } - } + child = GenerateNewSlave("XX", fixedAge); } else { - child = GenerateNewSlave("XY", {mature: 0}); - child.slaveSurname = genes.surname; - if (!pregUpgrade) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = "Your son"; - } else { - child.slaveName = `Your and ${genes.fatherName}'s son`; - } - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveName = `${genes.motherName} and your son`; - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s son`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - child.slaveName = `${genes.motherName}'s bastard son`; - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } - } - } else { - let childName = genes.name; - if (childName.indexOf("ovum") === 0) { - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveName = `Your clone`; - child.slaveSurname = V.PC.slaveSurname; - } else { - child.slaveName = `${genes.clone}'s clone`; - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = "Your son"; - } else { - child.slaveName = `Your and ${genes.fatherName}'s son`; - } - } else { - if (genes.father === -1) { - child.slaveName = `${genes.motherName} and your son`; - } else if (genes.father > 0) { - child.slaveName = `${genes.motherName} and ${genes.fatherName}'s son`; - } else { - child.slaveName = `${genes.motherName}'s bastard son`; - } - } - } else { - child.slaveName = genes.name; - } - if (genes.clone) { - if (genes.cloneID === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - let cloneSeed = getSlave(genes.cloneID); - if (cloneSeed.slaveSurname !== 0 && cloneSeed.slaveSurname !== "") { - child.slaveSurname = cloneSeed.slaveSurname; - } - } - } else if (genes.mother === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else { - if (genes.father === -1) { - child.slaveSurname = V.PC.slaveSurname; - } else if (genes.father > 0) { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } else { - let currentFather = getSlave(genes.father); - if (currentFather !== undefined) { - if (currentFather.slaveSurname !== 0 && currentFather.slaveSurname !== "") { - child.slaveSurname = currentFather.slaveSurname; - } - } - } - } else { - let currentMother = getSlave(genes.mother); - if (currentMother !== undefined) { - if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { - child.slaveSurname = currentMother.slaveSurname; - } - } - } - } - } + child = GenerateNewSlave("XY", fixedAge); } + setSlaveName(); + setSurname(); child.actualAge = 0; if (genes.clone !== undefined) { @@ -1656,32 +1240,7 @@ globalThis.generateChild = function(mother, ova, destination) { child.origRace = child.race; child.geneticQuirks = clone(genes.geneticQuirks); if (child.geneticQuirks.albinism === 2) { - child.albinismOverride = { - skin: 0, - eyeColor: "red", - hColor: "white" - }; - switch (child.race) { - case "black": - case "indo-aryan": - case "malay": - case "pacific islander": - case "amerindian": - child.albinismOverride.skin = "very fair"; - break; - case "latina": - child.albinismOverride.skin = "extremely fair"; - break; - case "asian": - case "middle eastern": - case "semitic": - case "southern european": - case "white": - child.albinismOverride.skin = "pure white"; - break; - default: - child.albinismOverride.skin = "pure white"; - } + child.albinismOverride = makeAlbinismOverride(child.race); } child.origSkin = genes.skin; child.eye.origColor = genes.eyeColor; @@ -1792,7 +1351,7 @@ globalThis.generateChild = function(mother, ova, destination) { child.tankBaby = 1; } else { child.origin = "$His brain is blank outside of the most basic of functions."; - child.fetish = "mindbroken" + child.fetish = "mindbroken"; child.tankBaby = 3; } child.intelligenceImplant = 0; diff --git a/src/js/generateNewSlaveJS.js b/src/js/generateNewSlaveJS.js index c4c89f6feeee79fe46bf7309bf635b09e2a3a301..f1ef6fe8879d454da53e6a18ba54c5a0d992597c 100644 --- a/src/js/generateNewSlaveJS.js +++ b/src/js/generateNewSlaveJS.js @@ -53,13 +53,8 @@ globalThis.GenerateNewSlave = (function() { slave = BaseSlave(); preGenCombinedStats(); - if (!sex) { - if (GenerateChromosome() == "XY") { - GenerateXYSlave(); - } else { - GenerateXXSlave(); - } - } else if (sex === "XY") { + sex = sex || GenerateChromosome(); + if (sex === "XY") { GenerateXYSlave(); } else { GenerateXXSlave();