diff --git a/src/js/generateGenetics.tw b/src/js/generateGenetics.tw index 30ae86e70339099eb9ec7554b5cf6231cddee093..8af37cb282fb30a5a0a3c5eb277997db2ab54cf9 100644 --- a/src/js/generateGenetics.tw +++ b/src/js/generateGenetics.tw @@ -460,9 +460,139 @@ window.generateChild = function(mother, ova, destination) { let pregUpgrage = V.pregnancyMonitoringUpgrade; if (!destination) { //does extra work for the incubator if defined, otherwise builds a simple object - child.physicalAge = child.actualAge; - child.visualAge = child.actualAge; - child.actualAge = child.actualAge; + if (genes.gender = "XX") { + child.genes == "XX"; + child.slaveSurname = genes.surname; + if (!pregUpgrage) { + 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.surname; + } else { + if (genes.father == -1) { + child.slaveName = `${genes.motherName} and your daughter`; + child.slaveSurname = V.PC.surname; + } 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 son`; + let currentMother = getSlave(genes.mother); + if (currentMother !== undefined) { + if (currentMother.slaveSurname !== 0 && currentMother.slaveSurname !== "") { + child.slaveSurname = currentMother.slaveSurname; + } + } + } + } + } else { + child.slaveName = genes.name; + } + } else { + child.genes == "XY"; + child.slaveSurname = genes.surname; + if (!pregUpgrage) { + 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.surname; + } else { + if (genes.father == -1) { + child.slaveName = `${genes.motherName} and your son`; + child.slaveSurname = V.PC.surname; + } 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 { + child.slaveName = genes.name; + } + } + + child.mother = genes.mother; + child.father = genes.father; + child.nationality = genes.nationality; + child.skin = genes.skin; + 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.eyeColor = genes.eyeColor; + child.hColor = genes.hColor; + 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.pubicHColor = child.hColor; + child.underArmHColor = child.hColor; + child.eyebrowHColor = child.hColor; + child.birthWeek = child.birthWeek; + if (mother.addict > 0) { + child.addict = Math.trunc(mother.addict/2); + } + child.weekAcquired = V.week; + if (child.nationality == "Stateless") { + if (V.arcologies[0].FSRomanRevivalist > 90) { + child.nationality = "Roman Revivalist"; + } else if (V.arcologies[0].FSAztecRevivalist > 90) { + child.nationality = "Aztec Revivalist"; + } else if (V.arcologies[0].FSEgyptianRevivalist > 90) { + child.nationality = "Ancient Egyptian Revivalist"; + } else if (V.arcologies[0].FSEdoRevivalist > 90) { + child.nationality = "Edo Revivalist"; + } else if (V.arcologies[0].FSArabianRevivalist > 90) { + child.nationality = "Arabian Revivalist"; + } else if (V.arcologies[0].FSChineseRevivalist > 90) { + child.nationality = "Ancient Chinese Revivalist"; + } + } + } else { V.activeSlaveOneTimeMinAge = V.targetAge; @@ -586,7 +716,6 @@ window.generateChild = function(mother, ova, destination) { child.pubicHColor = child.hColor; child.underArmHColor = child.hColor; child.eyebrowHColor = child.hColor; - child.actualAge = child.actualAge; child.birthWeek = child.birthWeek; child.energy = 0; child.anus = 0; diff --git a/src/js/removeActiveSlave.tw b/src/js/removeActiveSlave.tw index e8ea98fbe9a2aef89d9552ef01caeef819016866..5cfff83f8aab6d9a0b9601594d41e579854e9578 100644 --- a/src/js/removeActiveSlave.tw +++ b/src/js/removeActiveSlave.tw @@ -63,6 +63,7 @@ window.removeActiveSlave = function removeActiveSlave() { } V.slaves.forEach(slave => { WombChangeID(slave, AS_ID, V.missingParentID); /* This check is complex, should be done in JS now, all needed will be done here. */ + WombChangeGeneID(slave, AS_ID, V.missingParentID); if (slave.pregSource === V.missingParentID) { missing = true; } @@ -148,32 +149,30 @@ window.removeActiveSlave = function removeActiveSlave() { removeJob(V.activeSlave, V.activeSlave.assignment); if (V.traitor !== 0) { + missing = true; /* no exceptions, fetus system relies on this */ if (AS_ID === V.traitor.pregSource) { V.traitor.pregSource = 0; } if (V.traitor.mother === AS_ID) { V.traitor.mother = V.missingParentID; - missing = true; } if (V.traitor.father === AS_ID) { V.traitor.father = V.missingParentID; - missing = true; } if (V.traitor.origBodyOwnerID === AS_ID) { V.traitor.origBodyOwnerID = 0; } } if (V.boomerangSlave !== 0) { + missing = true; if (AS_ID === V.boomerangSlave.pregSource) { V.boomerangSlave.pregSource = 0; } if (V.boomerangSlave.mother === AS_ID) { V.boomerangSlave.mother = V.missingParentID; - missing = true; } if (V.boomerangSlave.father === AS_ID) { V.boomerangSlave.father = V.missingParentID; - missing = true; } if (V.boomerangSlave.origBodyOwnerID === AS_ID) { V.traitor.origBodyOwnerID = 0; @@ -227,7 +226,6 @@ window.removeActiveSlave = function removeActiveSlave() { V.genePool.deleteAt(_geneIndex); } } - if (missing) { V.missingTable[V.missingParentID] = { slaveName: V.activeSlave.slaveName, @@ -237,6 +235,11 @@ window.removeActiveSlave = function removeActiveSlave() { vagina : V.activeSlave.vagina, ID : V.missingParentID }; + if (V.traitor.ID == V.activeSlave.ID) { /* To link developing fetuses to their parent */ + V.traitor.missingParentTag = V.missingParentID; + } else if (V.boomerangSlave.ID == V.activeSlave.ID) { + V.boomerangSlave.missingParentTag = V.missingParentID; + } V.missingParentID--; } diff --git a/src/js/wombJS.tw b/src/js/wombJS.tw index 36b0ab64856adb0a8d50400f95ef0738d9852606..9a3d53f94a05fa34a446b8bfb12f7b2af7720319 100644 --- a/src/js/wombJS.tw +++ b/src/js/wombJS.tw @@ -293,6 +293,15 @@ window.WombChangeID = function(actor, fromID, toID) { WombNormalizePreg(actor); }; +window.WombChangeGeneID = function(actor, fromID, toID) { + WombInit(actor); + actor.womb.genetics + .filter(ft => ft.father === fromID) + .forEach(ft => ft.father = toID); + .filter(ft => ft.mother === fromID) + .forEach(ft => ft.mother = toID); + WombNormalizePreg(actor); +}; /* Sorts the womb object by age with oldest and thus soonest to be born, first. This will be needed in the future once individual fertilization is a possibility.*/ window.WombSort = function(actor) {