diff --git a/src/facilities/nursery/generateChild.js b/src/facilities/nursery/generateChild.js new file mode 100644 index 0000000000000000000000000000000000000000..f9aedd0845aab900eda461350e81815048432553 --- /dev/null +++ b/src/facilities/nursery/generateChild.js @@ -0,0 +1,320 @@ +/** + * Creates a new child object based on its mother and father and whether or not it is destined for the Incubator + * @param {App.Entity.SlaveState} mother The slave object carrying the child source + * @param {object} ovum The source for the child, comes from the mother's womb array + * @param {number} destination Optional + * @returns {App.Entity.SlaveState|App.Entity.InfantState} + */ +globalThis.generateChild = function (mother, ovum, incubator=false) { + let genes = ovum.genetics; // TODO: maybe just argument this? We'll see. + let child = {}; + + if (!incubator) { // 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; + child.nationality = genes.nationality; + child.race = genes.race; + child.intelligence = genes.intelligence; + if (mother.prematureBirth > 0) { + if (child.intelligence >= -90) { + child.intelligence -= jsRandom(0, 10); + } + child.premature = 1; + } + child.face = genes.face; + child.underArmHStyle = genes.underArmHStyle; + child.pubicHStyle = genes.pubicHStyle; + child.markings = genes.markings; + child.sexualFlaw = genes.sexualFlaw; + child.behavioralFlaw = genes.behavioralFlaw; + child.fetish = genes.fetish; + child.geneticQuirks = clone(genes.geneticQuirks); + if (child.geneticQuirks.albinism === 2) { + child.albinismOverride = makeAlbinismOverride(child.race); + } + child.origSkin = genes.skin; + child.eyeColor = genes.eyeColor; + child.origHColor = genes.hColor; + child.skin = getGeneticSkinColor(child); + child.hColor = getGeneticHairColor(child); + child.pubicHColor = child.hColor; + child.underArmHColor = child.hColor; + child.eyebrowHColor = child.hColor; + child.birthWeek = 0; + child.actualAge = 0; + if (genes.faceShape !== undefined) { + child.faceShape = genes.faceShape; + } + if (mother.addict > 0) { + child.addict = Math.trunc(mother.addict / 2); + } + child.weekAcquired = V.week; + if (child.nationality === "Stateless") { + const revivalistNationality = getRevivalistNationality(); + if (typeof revivalistNationality === 'string') { + child.nationality = revivalistNationality; + } + } + } else { + const fixedAge = { + minAge: V.targetAge, + maxAge: V.targetAge, + ageOverridesPedoMode: 1, + mature: 0 + }; + + child = GenerateNewSlave(genes.gender, fixedAge); + setSlaveName(); + setSurname(); + + child.actualAge = 0; + if (genes.clone !== undefined) { + child.clone = genes.clone; + child.cloneID = genes.cloneID; + } + child.mother = genes.mother; + child.father = genes.father; + child.nationality = genes.nationality; + child.race = genes.race; + child.origRace = child.race; + child.geneticQuirks = clone(genes.geneticQuirks); + if (child.geneticQuirks.albinism === 2) { + child.albinismOverride = makeAlbinismOverride(child.race); + } + child.origSkin = genes.skin; + child.eye.origColor = genes.eyeColor; + child.origHColor = genes.hColor; + child.skin = getGeneticSkinColor(child); + child.hColor = getGeneticHairColor(child); + resetEyeColor(child, "both"); + child.pubicHColor = child.hColor; + child.underArmHColor = child.hColor; + child.eyebrowHColor = child.hColor; + child.intelligence = genes.intelligence; + if (mother.prematureBirth > 0) { + if (child.intelligence >= -90) { + child.intelligence -= jsRandom(0, 10); + } + child.premature = 1; + } + if (child.geneticQuirks.dwarfism === 2 && child.geneticQuirks.gigantism !== 2) { + child.height = Height.random(child, { limitMult: [-4, -1], spread: 0.15 }); + } else if (child.geneticQuirks.gigantism === 2 && child.geneticQuirks.dwarfism !== 2) { + child.height = Height.random(child, { limitMult: [3, 10], spread: 0.15 }); + } + child.face = genes.face; + child.underArmHStyle = genes.underArmHStyle; + child.pubicHStyle = genes.pubicHStyle; + child.markings = genes.markings; + child.sexualFlaw = genes.sexualFlaw; + child.behavioralFlaw = genes.behavioralFlaw; + child.fetish = genes.fetish; + child.birthWeek = 0; + child.energy = 0; + child.anus = 0; + if (child.vagina > 0) { child.vagina = 0; } + if (child.fetish !== "none") { child.fetishStrength = 20; } + if (child.dick > 0) { child.foreskin = 1; child.balls = 1; child.scrotum = 1; } + if (genes.faceShape !== undefined) { child.faceShape = genes.faceShape; } + if (mother.addict > 0) { child.addict = Math.trunc(mother.addict / 2); } + child.career = "a slave since birth"; + child.birthName = child.slaveName; + child.birthSurname = child.slaveSurname; + child.devotion = 0; + child.trust = 0; + child.weekAcquired = V.week; + if (child.nationality === "Stateless") { + const revivalistNationality = getRevivalistNationality(); + if (typeof revivalistNationality === 'string') { + child.nationality = revivalistNationality; + } + } + + child.weight = -100; + child.muscles = -100; + child.boobs = 0; + child.butt = 0; + child.chem = 990; + child.areolaePiercing = 0; + child.corsetPiercing = 0; + child.boobsImplant = 0; + child.boobsImplantType = "none"; + child.nipplesPiercing = 0; + child.areolaePiercing = 0; + child.lactation = 0; + child.hipsImplant = 0; + child.buttImplant = 0; + child.buttImplantType = "none"; + child.lipsImplant = 0; + child.lipsPiercing = 0; + child.tonguePiercing = 0; + child.vaginaPiercing = 0; + child.preg = 0; + child.pregType = 0; + child.pregKnown = 0; + child.belly = 0; + child.bellyPreg = 0; + child.bellyFluid = 0; + child.bellyImplant = -1; + child.cervixImplant = 0; + child.clitPiercing = 0; + child.dickPiercing = 0; + child.makeup = 0; + child.nails = 0; + child.earPiercing = 0; + child.nosePiercing = 0; + child.eyebrowPiercing = 0; + child.stampTat = 0; + child.bellyTat = 0; + child.anusPiercing = 0; + child.anusTat = 0; + child.shouldersTat = 0; + child.armsTat = 0; + child.legsTat = 0; + child.backTat = 0; + child.skill.combat = 0; + child.skill.whoring = 0; + child.skill.entertainment = 0; + child.skill.oral = 0; + child.skill.anal = 0; + child.skill.vaginal = 0; + child.accent = 4; + child.canRecruit = 0; + child.hStyle = "long"; + child.hLength = 300; + if (V.incubatorImprintSetting === "terror") { + child.origin = "$He was conditioned from birth into mindless terror in an aging tank."; + child.tankBaby = 2; + } else if (V.incubatorImprintSetting === "trust") { + child.origin = "$He was conditioned from birth into trusting obedience in an aging tank."; + child.tankBaby = 1; + } else { + child.origin = "$His brain is blank outside of the most basic of functions."; + child.fetish = "mindbroken"; + child.tankBaby = 3; + } + child.intelligenceImplant = 0; + child.navelPiercing = 0; + } + + this.setSurname(child, genes); + this.setSlaveName(child, genes); + + generatePronouns(child); + + return child; +}; + +/** + * Sets the child's surname based on information on its mother and father + * @param {object} child + * @param {object} genes An object containing child's genetic information + */ +function setSurname(child, genes) { + child.slaveSurname = genes.surname; + 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 || 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; + } + } + } +} + +/** + * Sets the child's name or title based on information on its mother and father + * @param {object} child + * @param {object} genes An object containing child's genetic information + */ +function setSlaveName(child, genes) { + 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.clone}'s clone`; + } + } else if (genes.mother === -1) { + if (genes.father <= 0) { + child.slaveName = `Your ${relString}`; + } else { + 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; + } +} + +/** + * Changes the child's skin depending on if it has albinism + * @param {string} race The child's race + */ +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; +} diff --git a/src/js/generateGenetics.js b/src/js/generateGenetics.js index 520fc57fc63f12de31ff3431a1c172fb1c30433b..88adc9cdcd921b95dea393f4f3109a0c63227190 100644 --- a/src/js/generateGenetics.js +++ b/src/js/generateGenetics.js @@ -1057,304 +1057,3 @@ globalThis.generateGenetics = (function() { return generateGenetics; })(); - -/** - * @param {App.Entity.SlaveState} mother - * @returns {App.Entity.SlaveState|App.Entity.InfantState} - */ -globalThis.generateChild = function(mother, ova, destination) { - let genes = ova.genetics; // maybe just argument this? We'll see. - let child = {}; - - function setSurname() { - child.slaveSurname = genes.surname; - 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 || 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; - } - } - } - } - - 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.clone}'s clone`; - } - } else if (genes.mother === -1) { - if (genes.father <= 0) { - child.slaveName = `Your ${relString}`; - } else { - 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; - child.nationality = genes.nationality; - child.race = genes.race; - child.intelligence = genes.intelligence; - if (mother.prematureBirth > 0) { - if (child.intelligence >= -90) { - child.intelligence -= jsRandom(0, 10); - } - child.premature = 1; - } - child.face = genes.face; - child.underArmHStyle = genes.underArmHStyle; - child.pubicHStyle = genes.pubicHStyle; - child.markings = genes.markings; - child.sexualFlaw = genes.sexualFlaw; - child.behavioralFlaw = genes.behavioralFlaw; - child.fetish = genes.fetish; - child.geneticQuirks = clone(genes.geneticQuirks); - if (child.geneticQuirks.albinism === 2) { - child.albinismOverride = makeAlbinismOverride(child.race); - } - child.origSkin = genes.skin; - child.eyeColor = genes.eyeColor; - child.origHColor = genes.hColor; - child.skin = getGeneticSkinColor(child); - child.hColor = getGeneticHairColor(child); - child.pubicHColor = child.hColor; - child.underArmHColor = child.hColor; - child.eyebrowHColor = child.hColor; - child.birthWeek = 0; - child.actualAge = 0; - if (genes.faceShape !== undefined) { - child.faceShape = genes.faceShape; - } - if (mother.addict > 0) { - child.addict = Math.trunc(mother.addict / 2); - } - child.weekAcquired = V.week; - if (child.nationality === "Stateless") { - const revivalistNationality = getRevivalistNationality(); - if (typeof revivalistNationality === 'string') { - child.nationality = revivalistNationality; - } - } - } else { - const fixedAge = { - minAge: V.targetAge, - maxAge: V.targetAge, - ageOverridesPedoMode: 1, - mature: 0 - }; - - child = GenerateNewSlave(genes.gender, fixedAge); - setSlaveName(); - setSurname(); - - child.actualAge = 0; - if (genes.clone !== undefined) { - child.clone = genes.clone; - child.cloneID = genes.cloneID; - } - child.mother = genes.mother; - child.father = genes.father; - child.nationality = genes.nationality; - child.race = genes.race; - child.origRace = child.race; - child.geneticQuirks = clone(genes.geneticQuirks); - if (child.geneticQuirks.albinism === 2) { - child.albinismOverride = makeAlbinismOverride(child.race); - } - child.origSkin = genes.skin; - child.eye.origColor = genes.eyeColor; - child.origHColor = genes.hColor; - child.skin = getGeneticSkinColor(child); - child.hColor = getGeneticHairColor(child); - resetEyeColor(child, "both"); - child.pubicHColor = child.hColor; - child.underArmHColor = child.hColor; - child.eyebrowHColor = child.hColor; - child.intelligence = genes.intelligence; - if (mother.prematureBirth > 0) { - if (child.intelligence >= -90) { - child.intelligence -= jsRandom(0, 10); - } - child.premature = 1; - } - if (child.geneticQuirks.dwarfism === 2 && child.geneticQuirks.gigantism !== 2) { - child.height = Height.random(child, {limitMult: [-4, -1], spread: 0.15}); - } else if (child.geneticQuirks.gigantism === 2 && child.geneticQuirks.dwarfism !== 2) { - child.height = Height.random(child, {limitMult: [3, 10], spread: 0.15}); - } - child.face = genes.face; - child.underArmHStyle = genes.underArmHStyle; - child.pubicHStyle = genes.pubicHStyle; - child.markings = genes.markings; - child.sexualFlaw = genes.sexualFlaw; - child.behavioralFlaw = genes.behavioralFlaw; - child.fetish = genes.fetish; - child.birthWeek = 0; - child.energy = 0; - child.anus = 0; - if (child.vagina > 0) { child.vagina = 0; } - if (child.fetish !== "none") { child.fetishStrength = 20; } - if (child.dick > 0) { child.foreskin = 1; child.balls = 1; child.scrotum = 1; } - if (genes.faceShape !== undefined) { child.faceShape = genes.faceShape; } - if (mother.addict > 0) { child.addict = Math.trunc(mother.addict / 2); } - child.career = "a slave since birth"; - child.birthName = child.slaveName; - child.birthSurname = child.slaveSurname; - child.devotion = 0; - child.trust = 0; - child.weekAcquired = V.week; - if (child.nationality === "Stateless") { - const revivalistNationality = getRevivalistNationality(); - if (typeof revivalistNationality === 'string') { - child.nationality = revivalistNationality; - } - } - - child.weight = -100; - child.muscles = -100; - child.boobs = 0; - child.butt = 0; - child.chem = 990; - child.areolaePiercing = 0; - child.corsetPiercing = 0; - child.boobsImplant = 0; - child.boobsImplantType = "none"; - child.nipplesPiercing = 0; - child.areolaePiercing = 0; - child.lactation = 0; - child.hipsImplant = 0; - child.buttImplant = 0; - child.buttImplantType = "none"; - child.lipsImplant = 0; - child.lipsPiercing = 0; - child.tonguePiercing = 0; - child.vaginaPiercing = 0; - child.preg = 0; - child.pregType = 0; - child.pregKnown = 0; - child.belly = 0; - child.bellyPreg = 0; - child.bellyFluid = 0; - child.bellyImplant = -1; - child.cervixImplant = 0; - child.clitPiercing = 0; - child.dickPiercing = 0; - child.makeup = 0; - child.nails = 0; - child.earPiercing = 0; - child.nosePiercing = 0; - child.eyebrowPiercing = 0; - child.stampTat = 0; - child.bellyTat = 0; - child.anusPiercing = 0; - child.anusTat = 0; - child.shouldersTat = 0; - child.armsTat = 0; - child.legsTat = 0; - child.backTat = 0; - child.skill.combat = 0; - child.skill.whoring = 0; - child.skill.entertainment = 0; - child.skill.oral = 0; - child.skill.anal = 0; - child.skill.vaginal = 0; - child.accent = 4; - child.canRecruit = 0; - child.hStyle = "long"; - child.hLength = 300; - if (V.incubatorImprintSetting === "terror") { - child.origin = "$He was conditioned from birth into mindless terror in an aging tank."; - child.tankBaby = 2; - } else if (V.incubatorImprintSetting === "trust") { - child.origin = "$He was conditioned from birth into trusting obedience in an aging tank."; - child.tankBaby = 1; - } else { - child.origin = "$His brain is blank outside of the most basic of functions."; - child.fetish = "mindbroken"; - child.tankBaby = 3; - } - child.intelligenceImplant = 0; - child.navelPiercing = 0; - } - - generatePronouns(child); - - return child; -}; diff --git a/src/npc/interaction/passage/birthStorm.tw b/src/npc/interaction/passage/birthStorm.tw index 875295dd9a775b44fd8363a7b677ddf9f015d56d..760e9c7794d940b257d737bb37b108fb0946bc1c 100644 --- a/src/npc/interaction/passage/birthStorm.tw +++ b/src/npc/interaction/passage/birthStorm.tw @@ -226,7 +226,7 @@ The remote surgery allows the removal of the pregnancy generator through convent <</if>> <<else>> - /*No live babies. Placeholder */ + /* TODO: No live babies. Placeholder */ <</if>> <<set _curBabies = getSlave($AS).curBabies.length>>