From f3bac2a7d47c80e7962c4081d9df81768bd5489b Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Thu, 26 Mar 2020 23:32:49 -0700 Subject: [PATCH] 1. Move NGP slave javascript out of backwardsCompatibility.js into newGamePlus.js 2. Move NGP PC prep out of storyInit.tw into the newGamePlus closure 3. Move ngUpdateGenePool and ngUpdateMissingTable out from global scope into the newGamePlus closure 4. Set the NGP offset constant exactly once, in the newGamePlus closure 5. Fix some NGP bugs 6. Refactor family controller reset into resetFamilyCounters() in extendedFamilyModeJS.js, remove familyPanic.tw, and replace all other instances of family controller reset with a call to resetFamilyCounters(). 7. Refactor revivalist nationality determination into a new getRevivalistNationality() function and call it everywhere we try to determine the revivalist nationality. --- js/003-data/gameVariableData.js | 3 +- .../backwardsCompatibility.js | 179 --------------- src/data/newGamePlus.js | 206 ++++++++++++++++++ src/init/storyInit.tw | 72 +----- src/js/extendedFamilyModeJS.js | 29 +++ src/js/generateGenetics.js | 30 +-- src/js/storyJS.js | 27 --- src/js/utilsFC.js | 17 ++ src/npc/acquisition.tw | 34 +-- src/npc/familyPanic.tw | 25 --- src/uncategorized/newGamePlus.tw | 1 + src/uncategorized/options.tw | 6 +- 12 files changed, 270 insertions(+), 359 deletions(-) create mode 100644 src/data/newGamePlus.js delete mode 100644 src/npc/familyPanic.tw diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index dc3df48b781..cf9839acb3d 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -12,7 +12,7 @@ App.Data.defaultGameStateVariables = { releaseID: 0, // Slaves - slaveIndices: 0, + slaveIndices: [], genePool: [], geneMods: {NCS: 0, rapidCellGrowth: 0}, missingTable: {}, @@ -89,6 +89,7 @@ App.Data.defaultGameStateVariables = { profiler: 0, realRoyalties: 0, retainCareer: 1, + ngpNationality: 0, rulesAssistantAuto: 0, rulesAssistantMain: 1, seeAge: 1, diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 77f4fcf5b46..560504d9d50 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -2076,182 +2076,3 @@ App.Update.sectorsToBuilding = function() { return m; } }; - -App.Update.slaveLoopInit = function() { - let SL = V.slaves.length; - const NGPOffset = 1200000; - for (let i = 0; i < SL; i++) { - if (V.slaves[i].assignment !== "be imported") { - removeNonNGPSlave(V.slaves[i]); - i--, SL--; - } - } - for (let i = 0; i < SL; i++) { - if (V.slaves[i].assignment === "be imported") { - V.slaves[i].ID += NGPOffset; - V.slaves[i].assignment = "rest"; - V.slaves[i].weekAcquired = 0; - V.slaves[i].newGamePlus = 1; - if (V.slaves[i].mother > 0) { - V.slaves[i].mother += NGPOffset; - } else if (V.freshPC === 1 && V.slaves[i].mother === -1) { - V.slaves[i].mother = -NGPOffset; - } else if (V.slaves[i].mother < -1) { - V.slaves[i].mother -= NGPOffset; - } - if (V.slaves[i].father > 0) { - V.slaves[i].father += NGPOffset; - } else if (V.freshPC === 1 && V.slaves[i].father === -1) { - V.slaves[i].father = -NGPOffset; - } else if (V.slaves[i].father < -1) { - V.slaves[i].father -= NGPOffset; - } - V.slaves[i].daughters = 0; - V.slaves[i].sisters = 0; - V.slaves[i].canRecruit = 0; - V.slaves[i].breedingMark = 0; - if (V.arcologies[0].FSRomanRevivalist > 90) { - V.slaves[i].nationality = "Roman Revivalist"; - } else if (V.arcologies[0].FSAztecRevivalist > 90) { - V.slaves[i].nationality = "Aztec Revivalist"; - } else if (V.arcologies[0].FSEgyptianRevivalist > 90) { - V.slaves[i].nationality = "Ancient Egyptian Revivalist"; - } else if (V.arcologies[0].FSEdoRevivalist > 90) { - V.slaves[i].nationality = "Edo Revivalist"; - } else if (V.arcologies[0].FSArabianRevivalist > 90) { - V.slaves[i].nationality = "Arabian Revivalist"; - } else if (V.arcologies[0].FSChineseRevivalist > 90) { - V.slaves[i].nationality = "Ancient Chinese Revivalist"; - } - if (V.slaves[i].relationTarget !== 0) { - V.slaves[i].relationTarget += NGPOffset; - } - if (V.slaves[i].relationshipTarget !== 0) { - V.slaves[i].relationshipTarget += NGPOffset; - } - if (V.slaves[i].cloneID !== 0) { - V.slaves[i].cloneID += NGPOffset; - } - V.slaves[i].rivalry = 0, V.slaves[i].rivalryTarget = 0, V.slaves[i].subTarget = 0; - V.slaves[i].drugs = "no drugs"; - V.slaves[i].porn.spending = 0; - V.slaves[i].rules.living = "spare"; - V.slaves[i].diet = "healthy"; - V.slaves[i].pregControl = "none"; - } - } - V.slaveIndices = slaves2indices(); - for (let k = 0; k < SL; k++) { - for (let i = 0; i < SL; i++) { - if (V.slaves[k].mother === V.slaves[i].ID || V.slaves[k].father === V.slaves[i].ID) { - V.slaves[i].daughters += 1; - } - if (areSisters(V.slaves[k], V.slaves[i]) > 0) { - V.slaves[i].sisters += 1; - } - } - if (V.slaves[k].pregSource > 0) { - V.slaves[k].pregSource += NGPOffset; - let getFather = V.slaveIndices[V.slaves[k].pregSource]; - if (getFather) { - V.slaves[k].pregSource = 0; - } - } - for (let sInit = 0; sInit < V.slaves[k].womb.length; sInit++) { - if (V.slaves[k].womb[sInit].fatherID > 0) { - V.slaves[k].womb[sInit].fatherID += NGPOffset; - } else if (V.freshPC === 1 && V.slaves[k].womb[sInit].fatherID === -1) { - V.slaves[k].womb[sInit].fatherID = -NGPOffset; - } else if (V.slaves[k].womb[sInit].fatherID < -20) { - V.slaves[k].womb[sInit].fatherID -= NGPOffset; - } - if (V.slaves[k].womb[sInit].genetics.father > 0) { - V.slaves[k].womb[sInit].genetics.father += NGPOffset; - } else if (V.freshPC === 1 && V.slaves[k].womb[sInit].genetics.father === -1) { - V.slaves[k].womb[sInit].genetics.father = -NGPOffset; - } else if (V.slaves[k].womb[sInit].genetics.father < -20) { - V.slaves[k].womb[sInit].genetics.father -= NGPOffset; - } - if (V.slaves[k].womb[sInit].genetics.mother > 0) { - V.slaves[k].womb[sInit].genetics.mother += NGPOffset; - } else if (V.freshPC === 1 && V.slaves[k].womb[sInit].genetics.mother === -1) { - V.slaves[k].womb[sInit].genetics.mother = -NGPOffset; - } else if (V.slaves[k].womb[sInit].genetics.mother < -20) { - V.slaves[k].womb[sInit].genetics.mother -= NGPOffset; - } - } - if (V.slaves[k].cloneID !== 0) { - let getClone = V.slaveIndices[V.slaves[k].cloneID]; - if (getClone) { - V.slaves[k].cloneID = 0; - } - } - } - V.genePool = ngUpdateGenePool(V.genePool); - if (typeof V.missingTable === undefined || V.showMissingSlaves === false) { - V.missingTable = {}; - } else { - V.missingTable = ngUpdateMissingTable(V.missingTable); - } - for (let i = 0; i < SL; i++) { - if (V.slaves[i].relation !== 0) { - let seed = 0, rt = V.slaves[i].relationTarget, ID = V.slaves[i].ID; - let j = V.slaveIndices[rt]; - if ((j) && V.slaves[j].relationTarget === ID) { - seed = 1; - } - if (seed === 0) { - V.slaves[i].relation = 0, V.slaves[i].relationTarget = 0; - } - } - if (V.slaves[i].relationship > 0) { - let seed = 0, rt = V.slaves[i].relationshipTarget, ID = V.slaves[i].ID; - let j = V.slaveIndices[rt]; - if ((j) && V.slaves[j].relationshipTarget === ID) { - seed = 1; - } - if (seed === 0) { - V.slaves[i].relationship = 0, V.slaves[i].relationshipTarget = 0; - } - } - } - for (let i = 0; i < SL; i++) { - if (V.familyTesting === 1) { - if (V.slaves[i].canRecruit === 1) { - /* V.recruiters.push(V.slaves[i]);*/ - } - } else { - if (V.slaves[i].relation === 0) { - if (random(1, 100) <= 5) { - V.slaves[i].recruiter = "twin"; - } else if ((V.slaves[i].actualAge > 32) && (random(1, 100) <= 41)) { - V.slaves[i].recruiter = "mother"; - } else if ((V.slaves[i].actualAge < 24) && (random(1, 100) <= 40)) { - V.slaves[i].recruiter = "daughter"; - } else if ((V.slaves[i].actualAge < 43) && (random(1, 100) <= 20)) { - V.slaves[i].recruiter = "older sister"; - } else if ((V.slaves[i].actualAge < 25) && (V.slaves[i].actualAge > 18) && (random(1, 100) <= 20)) { - V.slaves[i].recruiter = "young sister"; - } - } else { - V.slaves[i].recruiter = 0; - } - } - /* closes family mode */ - V.slaves[i].counter.milk = 0; - V.slaves[i].counter.cum = 0; - V.slaves[i].counter.births = 0; - V.slaves[i].counter.mammary = 0; - V.slaves[i].counter.penetrative = 0; - V.slaves[i].counter.oral = 0; - V.slaves[i].counter.anal = 0; - V.slaves[i].counter.vaginal = 0; - V.slaves[i].lifetimeCashExpenses = 0; - V.slaves[i].lifetimeCashIncome = 0; - V.slaves[i].lastWeeksCashIncome = 0; - V.slaves[i].lifetimeRepExpenses = 0; - V.slaves[i].lifetimeRepIncome = 0; - V.slaves[i].lastWeeksRepExpenses = 0; - V.slaves[i].lastWeeksRepIncome = 0; - } -}; diff --git a/src/data/newGamePlus.js b/src/data/newGamePlus.js new file mode 100644 index 00000000000..acb9908f3be --- /dev/null +++ b/src/data/newGamePlus.js @@ -0,0 +1,206 @@ +App.Data.NewGamePlus = (function() { + const NGPOffset = 1200000; + + function ngpSlaveID(id, preserveSpecial=false) { + const minID = preserveSpecial ? -20 : 0; + if (id > 0) { + id += NGPOffset; + } else if (V.freshPC === 1 && id === -1) { + id = -NGPOffset; + } else if (id < minID) { + id -= NGPOffset; + } + } + + function slaveOrZero(id) { + if (id > 0 && !getSlave(id)) { + return 0; + } + return id; + } + + function PCInit() { + if (V.freshPC === 0) { + const prosperity = (arcologies && arcologies[0] && arcologies[0].prosperity) ? (250 * $arcologies[0].prosperity * $arcologies[0].ownership) : 0; + cashX(prosperity, "personalBusiness"); + const oldCash = V.cash; + V.cash = 0; + V.cashLastWeek = 0; + cashX((Math.clamp(1000*Math.trunc(oldCash/100000), 5000, 1000000)), "personalBusiness"); + if (V.retainCareer === 0) { + V.PC.career = "arcology owner"; + V.PC.skill.trading = 100; + V.PC.skill.warfare = 100; + V.PC.skill.hacking = 100; + V.PC.skill.slaving = 100; + V.PC.skill.engineering = 100; + V.PC.skill.medicine = 100; + } + V.PC.mother = ngpSlaveID(V.PC.mother); + V.PC.father = ngpSlaveID(V.PC.father); + V.PC.pregSource = slaveOrZero(ngpSlaveID(V.PC.pregSource, true)); + for (let fetus of V.PC.womb) { + fetus.fatherID = ngpSlaveID(fetus.fatherID, true); + fetus.genetics.father = ngpSlaveID(fetus.genetics.father, true); + fetus.genetics.mother = ngpSlaveID(fetus.genetics.mother, true); + } + } else { + V.PC = basePlayer(); + WombInit(V.PC); + V.cheater = 0; + V.cash = 0; + cashX(10000, "personalBusiness"); + for (let slave of V.slaves) { + if (V.familyTesting === 1) { + if (slave.mother === -1) { + slave.mother = V.missingParentID+NGPOffset; + } + if (slave.father === -1) { + slave.father = V.missingParentID+NGPOffset; + } + if (slave.pregSource === -1) { + slave.pregSource = 0; + } + if (slave.cloneID === -1) { + slave.cloneID = 0; + } + } + for (let fetus of slave.womb) { + if (fetus.father === -1) { + fetus.father = 0; + } + } + } + } + } + + function slaveLoopInit() { + const ngUpdateGenePool = function(genePool = []) { + const transferredSlaveIds = (State.variables.slaves || []) + .filter(s => s.ID >= NGPOffset) + .map(s => s.ID - NGPOffset); + return genePool + .filter(s => (transferredSlaveIds.includes(s.ID))) + .map(function(s) { + const result = jQuery.extend(true, {}, s); + result.ID += NGPOffset; + return result; + }); + }; + + const ngUpdateMissingTable = function(missingTable) { + const newTable = {}; + + (State.variables.slaves || []) + .forEach(s => ([s.pregSource + NGPOffset, s.mother + NGPOffset, s.father + NGPOffset] + .filter(i => (i in missingTable)) + .forEach(i => { + newTable[i - NGPOffset] = missingTable[i]; + newTable[i - NGPOffset].ID -= NGPOffset; + }))); + + return newTable; + }; + + V.slaves.deleteWith((s) => s.assignment !== "be imported"); + + for (let slave of V.slaves) { + slave.ID += NGPOffset; + slave.assignment = "rest"; + slave.weekAcquired = 0; + slave.newGamePlus = 1; + slave.mother = ngpSlaveID(slave.mother); + slave.father = ngpSlaveID(slave.father); + slave.canRecruit = 0; + slave.breedingMark = 0; + if (typeof V.ngpNationality === 'string') { + slave.nationality = V.ngpNationality; + } + slave.relationTarget = ngpSlaveID(slave.relationTarget); + slave.relationshipTarget = ngpSlaveID(slave.relationshipTarget); + slave.cloneID = ngpSlaveID(slave.cloneID); + slave.pregSource = ngpSlaveID(slave.pregSource, true); + for (let fetus of slave.womb) { + fetus.fatherID = ngpSlaveID(fetus.fatherID, true); + fetus.genetics.father = ngpSlaveID(fetus.genetics.father, true); + fetus.genetics.mother = ngpSlaveID(fetus.genetics.mother, true); + } + slave.rivalry = 0, slave.rivalryTarget = 0, slave.subTarget = 0; + slave.drugs = "no drugs"; + slave.porn.spending = 0; + slave.rules.living = "spare"; + slave.diet = "healthy"; + slave.pregControl = "none"; + } + V.slaveIndices = slaves2indices(); + for (let slave of V.slaves) { + slave.pregSource = slaveOrZero(slave.pregSource); + slave.cloneID = slaveOrZero(slave.cloneID); + slave.relationshipTarget = slaveOrZero(slave.relationshipTarget); + slave.relationTarget = slaveOrZero(slave.relationTarget); + } + V.genePool = ngUpdateGenePool(V.genePool); + if (typeof V.missingTable === undefined || V.showMissingSlaves === false) { + V.missingTable = {}; + } else { + V.missingTable = ngUpdateMissingTable(V.missingTable); + } + let validRelation = (s) => (s.relation !== 0 && s.relationTarget !== 0 && getSlave(s.relationTarget).relationTarget === s.ID); + let validRelationship = (s) => (s.relationship !== 0 && s.relationshipTarget !== 0 && getSlave(s.relationshipTarget).relationshipTarget === s.ID); + for (let slave of V.slaves) { + if (V.familyTesting === 1) { + if (slave.canRecruit === 1) { + /* V.recruiters.push(slave);*/ + } + } else { + if (slave.relation === 0) { + if (random(1, 100) <= 5) { + slave.recruiter = "twin"; + } else if ((slave.actualAge > 32) && (random(1, 100) <= 41)) { + slave.recruiter = "mother"; + } else if ((slave.actualAge < 24) && (random(1, 100) <= 40)) { + slave.recruiter = "daughter"; + } else if ((slave.actualAge < 43) && (random(1, 100) <= 20)) { + slave.recruiter = "older sister"; + } else if ((slave.actualAge < 25) && (slave.actualAge > 18) && (random(1, 100) <= 20)) { + slave.recruiter = "young sister"; + } + } else { + if (!validRelation(slave)) { + slave.relation = 0; + slave.relationTarget = 0; + } + slave.recruiter = 0; + } + } + if (!validRelationship(slave)) { + slave.relationship = 0; + slave.relationshipTarget = 0; + } + slave.counter.milk = 0; + slave.counter.cum = 0; + slave.counter.births = 0; + slave.counter.mammary = 0; + slave.counter.penetrative = 0; + slave.counter.oral = 0; + slave.counter.anal = 0; + slave.counter.vaginal = 0; + slave.lifetimeCashExpenses = 0; + slave.lifetimeCashIncome = 0; + slave.lastWeeksCashIncome = 0; + slave.lifetimeRepExpenses = 0; + slave.lifetimeRepIncome = 0; + slave.lastWeeksRepExpenses = 0; + slave.lastWeeksRepIncome = 0; + } + } + + function doNGPSetup() { + slaveLoopInit(); + PCInit(); + resetFamilyCounters(); + V.ngpSlaveNationality = 0; + } + + return doNGPSetup; +})(); diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index 243578a2187..cc124ea7944 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -12,12 +12,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -<<if def $arcologies && def $arcologies[0] && def $arcologies[0].prosperity>> - <<set _prosperity = (250*$arcologies[0].prosperity*$arcologies[0].ownership)>> -<<else>> - <<set _prosperity = 0>> -<</if>> - /* Set up the game as politely as possible. If values are already set, they are preserved. */ <<run App.Update.setNonexistantProperties(V, App.Data.defaultGameStateVariables)>> @@ -26,81 +20,19 @@ You should have received a copy of the GNU General Public License along with thi <<set $ver = App.Version.base, $pmodVer = App.Version.pmod, $releaseID = App.Version.release>> -<<set _NGPOffset = 1200000>> - -<<run App.Update.slaveLoopInit()>> - /* 0 out the record books as we start a new game */ <<run setupLastWeeksCash()>> <<run setupLastWeeksRep()>> <<if $saveImported == 0>> /* new game (not NG+) */ - <<set $PC = basePlayer()>> <<run WombInit($PC)>> <<run cashX(10000, "personalBusiness")>> <<include "Init Rules">> - <<else>> /* imported save (NG+) */ - - <<if $freshPC == 0>> - <<run cashX(_prosperity, "personalBusiness")>> - <<set _cash = $cash, $cash = 0, $cashLastWeek = 0>> - <<run cashX((Math.clamp(1000*Math.trunc(_cash/100000), 5000, 1000000)), "personalBusiness")>> - <<if $retainCareer == 0>> - <<set $PC.career = "arcology owner", $PC.skill.trading = 100, $PC.skill.warfare = 100, $PC.skill.hacking = 100, $PC.skill.slaving = 100, $PC.skill.engineering = 100, $PC.skill.medicine = 100>> - <</if>> - <<if $PC.mother > 0>> - <<set $PC.mother += _NGPOffset>> - <<elseif $PC.mother < 0>> - <<set $PC.mother -= _NGPOffset>> - <</if>> - <<if $PC.father > 0>> - <<set $PC.father += _NGPOffset>> - <<elseif $PC.father < 0>> - <<set $PC.father -= _NGPOffset>> - <</if>> - <<if $PC.pregSource > 0>> - <<set $PC.pregSource += _NGPOffset>> - <<set _getFather = $slaveIndices[$PC.pregSource]>> - <<if ndef _getFather>> - <<set $PC.pregSource = 0>> - <</if>> - <<for _sInit = 0; _sInit < $PC.womb.length; _sInit++>> - <<if $PC.womb[_sInit].fatherID > 0>> - <<set $PC.womb[_sInit].fatherID += _NGPOffset>> - <</if>> - <</for>> - <</if>> - <<else>> - <<set $PC = basePlayer()>> - <<run WombInit($PC)>> - <<set $cheater = 0>> - <<set $cash = 0>> - <<run cashX(10000, "personalBusiness")>> - <<for _i = 0; _i < _SL; _i++>> - <<if $familyTesting == 1>> - <<if $slaves[_i].mother == -1>> - <<set $slaves[_i].mother = $missingParentID+_NGPOffset>> - <</if>> - <<if $slaves[_i].father == -1>> - <<set $slaves[_i].father = $missingParentID+_NGPOffset>> - <</if>> - <<if $slaves[_i].pregSource == -1>> - <<set $slaves[_i].pregSource = 0>> - <</if>> - <<if $slaves[_i].cloneID == -1>> - <<set $slaves[_i].cloneID = 0>> - <</if>> - <</if>> - <<for _sInit = 0; _sInit < $slaves[_i].womb.length; _sInit++>> - <<if $slaves[_i].womb[_sInit].fatherID == -1>> - <<set $slaves[_i].womb[_sInit].fatherID = 0>> - <</if>> - <</for>> - <</for>> - <</if>> + <<run App.Data.NewGamePlus()>> <</if>> + /* Porn star counts (prestige 1) and ID's (prestige 3) */ <<set $pornStars = {}>> <<for _genre range App.Porn.getAllGenres()>> diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js index e10f433f13b..c1d74f93f29 100644 --- a/src/js/extendedFamilyModeJS.js +++ b/src/js/extendedFamilyModeJS.js @@ -481,3 +481,32 @@ window.relativeTerm = function(slave1, slave2) { return null; }; + +/** completely reset all the family counters in the game state (for both PC and slaves) */ +window.resetFamilyCounters = function() { + for (let slave of V.slaves) { + slave.daughters = 0; + slave.sisters = 0; + } + V.PC.daughters = 0; + V.PC.sisters = 0; + + if (V.familyTesting === 1) { + for (let slave of V.slaves) { + if (slave.mother === -1 || slave.father === -1) { + V.PC.daughters++; + } + if (areSisters(slave, V.PC)) { + V.PC.sisters++; + } + for (let otherSlave of V.slaves) { + if (isParentP(otherSlave, slave)) { + slave.daughters++; + } + if (areSisters(otherSlave, slave)) { + slave.sisters++; + } + } + } + } +}; diff --git a/src/js/generateGenetics.js b/src/js/generateGenetics.js index 07ed18740f3..6cacff3190c 100644 --- a/src/js/generateGenetics.js +++ b/src/js/generateGenetics.js @@ -1389,18 +1389,9 @@ window.generateChild = function(mother, ova, destination) { } 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"; + const revivalistNationality = getRevivalistNationality(); + if (typeof revivalistNationality === 'string') { + child.nationality = revivalistNationality; } } } else { @@ -1736,18 +1727,9 @@ window.generateChild = function(mother, ova, destination) { child.trust = 0; 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"; + const revivalistNationality = getRevivalistNationality(); + if (typeof revivalistNationality === 'string') { + child.nationality = revivalistNationality; } } diff --git a/src/js/storyJS.js b/src/js/storyJS.js index c7f91378a5b..b01452d869e 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -367,33 +367,6 @@ window.bodyguardSuccessorEligible = function(slave) { return (slave.devotion > 50 && slave.muscles >= 0 && slave.weight < 100 && slave.boobs < 8000 && slave.butt < 10 && slave.belly < 5000 && slave.balls < 10 && slave.dick < 10 && slave.preg < 20 && slave.fuckdoll === 0 && slave.fetish !== "mindbroken" && canWalk(slave) && canHold(slave) && canSee(slave) && canHear(slave)); }; -window.ngUpdateGenePool = function(genePool = []) { - const transferredSlaveIds = (State.variables.slaves || []) - .filter(s => s.ID >= 1200000) - .map(s => s.ID - 1200000); - return genePool - .filter(s => (transferredSlaveIds.includes(s.ID))) - .map(function(s) { - const result = jQuery.extend(true, {}, s); - result.ID += 1200000; - return result; - }); -}; - -window.ngUpdateMissingTable = function(missingTable) { - const newTable = {}; - - (State.variables.slaves || []) - .forEach(s => ([s.pregSource + 1200000, s.mother + 1200000, s.father + 1200000] - .filter(i => (i in missingTable)) - .forEach(i => { - newTable[i - 1200000] = missingTable[i]; - newTable[i - 1200000].ID -= 1200000; - }))); - - return newTable; -}; - /** * @param {any} obj * @returns {string} diff --git a/src/js/utilsFC.js b/src/js/utilsFC.js index 86717839ff1..4a4ee7b9382 100644 --- a/src/js/utilsFC.js +++ b/src/js/utilsFC.js @@ -2899,3 +2899,20 @@ window.ASDump = function() { } } }; + +window.getRevivalistNationality = function() { + if (V.arcologies[0].FSRomanRevivalist > 90) { + return "Roman Revivalist"; + } else if (V.arcologies[0].FSAztecRevivalist > 90) { + return "Aztec Revivalist"; + } else if (V.arcologies[0].FSEgyptianRevivalist > 90) { + return "Ancient Egyptian Revivalist"; + } else if (V.arcologies[0].FSEdoRevivalist > 90) { + return "Edo Revivalist"; + } else if (V.arcologies[0].FSArabianRevivalist > 90) { + return "Arabian Revivalist"; + } else if (V.arcologies[0].FSChineseRevivalist > 90) { + return "Ancient Chinese Revivalist"; + } + return 0; +}; diff --git a/src/npc/acquisition.tw b/src/npc/acquisition.tw index 963653ab185..3865480798c 100644 --- a/src/npc/acquisition.tw +++ b/src/npc/acquisition.tw @@ -122,10 +122,7 @@ <<set $PC.prostate = 0>> <</if>> <<set $PC.ovaryAge = $PC.physicalAge>> -<<else>> /*testtest*/ - <<set $PC.sisters = 0>> - <<set $PC.daughters = 0>> -<</if>> /*closes ng*/ +<</if>> <<if $familyTesting == 1>> <<set _pcMomFound = 0, _pcDadFound = 0>> <<if def $slaveIndices[$PC.mother]>> @@ -134,14 +131,6 @@ <<if def $slaveIndices[$PC.father]>> <<set _pcDadFound = 1>> <</if>> - <<for _i = 0; _i < $slaves.length; _i++>> - <<if $slaves[_i].mother == $PC.ID || $slaves[_i].father == $PC.ID>> - <<set $PC.daughters += 1>> - <</if>> - <<if areSisters($slaves[_i], $PC) > 0>> - <<set $PC.sisters += 1>> - <</if>> - <</for>> <<if _pcMomFound == 0 && $PC.mother > 0>> <<set _lostMom = $PC.mother>> <<set $PC.mother = $missingParentId>> @@ -205,6 +194,7 @@ <</if>> <<set $targetAge = $minimumSlaveAge>> <<set $targetAgeNursery = $minimumSlaveAge>> +<<run resetFamilyCounters()>> You've done it. <br><br> @@ -850,26 +840,6 @@ The previous owner seems to have left in something of a hurry. <</if>> <</if>> <</for>> -<<if $familyTesting == 1>> - <<set $slaves.forEach(function(s) { s.sisters = 0; s.daughters = 0; })>> - <<set $PC.daughters = 0, $PC.sisters = 0>> - <<for _fp = 0; _fp < $slaves.length; _fp++>> - <<if ($slaves[_fp].mother == -1 || $slaves[_fp].father == -1)>> - <<set $PC.daughters++>> - <</if>> - <<if areSisters($slaves[_fp], $PC) > 0>> - <<set $PC.sisters++>> - <</if>> - <<for _fpt = 0; _fpt < $slaves.length; _fpt++>> - <<if ($slaves[_fpt].mother == $slaves[_fp].ID) || ($slaves[_fpt].father == $slaves[_fp].ID)>> - <<set $slaves[_fp].daughters++>> - <</if>> - <<if areSisters($slaves[_fpt], $slaves[_fp]) > 0>> - <<set $slaves[_fp].sisters++>> - <</if>> - <</for>> - <</for>> -<</if>> <<if _slavesContributing != 0>> <<set $averageTrust = $averageTrust/_slavesContributing>> <<set $averageDevotion = $averageDevotion/_slavesContributing>> diff --git a/src/npc/familyPanic.tw b/src/npc/familyPanic.tw deleted file mode 100644 index b8edb689586..00000000000 --- a/src/npc/familyPanic.tw +++ /dev/null @@ -1,25 +0,0 @@ -:: family panic [nobr] - -<<set $nextButton = "Back", $nextLink = "Main">> - -<<set $slaves.forEach(function(s) { s.sisters = 0; s.daughters = 0; })>> -<<set $PC.daughters = 0, $PC.sisters = 0>> - -<<for _fp = 0; _fp < $slaves.length; _fp++>> - <<if ($slaves[_fp].mother == -1 || $slaves[_fp].father == -1)>> - <<set $PC.daughters++>> - <</if>> - <<if areSisters($slaves[_fp], $PC) > 0>> - <<set $PC.sisters++>> - <</if>> - <<for _fpt = 0; _fpt < $slaves.length; _fpt++>> - <<if ($slaves[_fpt].mother == $slaves[_fp].ID) || ($slaves[_fpt].father == $slaves[_fp].ID)>> - <<set $slaves[_fp].daughters++>> - <</if>> - <<if areSisters($slaves[_fpt], $slaves[_fp]) > 0>> - <<set $slaves[_fp].sisters++>> - <</if>> - <</for>> -<</for>> - -//Family relations flushed and rebuilt.// diff --git a/src/uncategorized/newGamePlus.tw b/src/uncategorized/newGamePlus.tw index ccacf4a86b0..ec0a9d7a7fd 100644 --- a/src/uncategorized/newGamePlus.tw +++ b/src/uncategorized/newGamePlus.tw @@ -23,6 +23,7 @@ You <<if $cash >= _fee>>have<<else>>lack<</if>> the funds to bring more than $sl <br> +<<set $ngpNationality = getRevivalistNationality()>> <<if $freshPC == 0>> <<if $retainCareer == 1 && $PC.career != "arcology owner">> <<if $week > 52 || ($PC.skill.slaving >= 100 && $PC.skill.trading >= 100 && $PC.skill.warfare >= 100 && $PC.skill.engineering >= 100 && $PC.skill.medicine >= 100 && $PC.skill.hacking >= 100)>> diff --git a/src/uncategorized/options.tw b/src/uncategorized/options.tw index 7ed9c60c58a..32670ed035e 100644 --- a/src/uncategorized/options.tw +++ b/src/uncategorized/options.tw @@ -58,7 +58,11 @@ This save was created using FC version $ver build $releaseID. <</link>> <</if>> <<if $familyTesting == 1>> - <br><<link "Reset extended family mode controllers">><<goto "family panic">><</link>> //Clears and rebuilds .sister and .daughter tracking.// + <br><<link "Reset extended family mode controllers">> + <<run resetFamilyCounters()>> + <<replace "#familyHint">>//@@.lightgreen;Done:@@ all family relations flushed and rebuilt.//<</replace>> + <</link>> + <span id="familyHint">//Clears and rebuilds .sister and .daughter tracking.//</span> <</if>> <<if isNaN($rep)>> <br>[[Reset Reputation|Options][$rep = 0]] -- GitLab