diff --git a/package.json b/package.json index 247c5fc113474cffcf883df2f1d3ae427f91b1b8..8597ed95c2aef8be7a4022b1bcf317a0e1b8ce43 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,12 @@ "@types/jquery": "^3.5.1", "@types/lodash": "^4.14.159", "@types/mousetrap": "^1.6.3", - "@types/twine-sugarcube": "^2.33.0", - "eslint": "^7.6.0", - "eslint-plugin-jsdoc": "^32.0.0", - "eslint-plugin-sonarjs": "^0.6.0", - "ts-essentials": "^7.0.0", - "typescript": "^4.2.0" + "@types/twine-sugarcube": "^2.36.1", + "eslint": "^8.0.0", + "eslint-plugin-jsdoc": "^37.0.0", + "eslint-plugin-sonarjs": "^0.11.0", + "ts-essentials": "^9.1.1", + "typescript": "^4.4.0" }, "dependencies": { "autoprefixer": "^10.0.0", diff --git a/src/js/pregJS.js b/src/js/pregJS.js index e0facf9fe6d6f3ca93ade68995391bf32a3d6b0b..44529f375689fbb08e58a532020a120335122e7f 100644 --- a/src/js/pregJS.js +++ b/src/js/pregJS.js @@ -474,10 +474,12 @@ globalThis.getNurseryReserved = function( /* slaves */ ) { return FetusGlobalReserveCount("nursery"); }; +/** Find a slave's father, if they are also one of your slaves, wherever they may be + * @param {number} fatherID + * @returns {FC.HumanState} + */ globalThis.findFather = function(fatherID) { - let father; - - father = getSlave(fatherID); + let father = getSlave(fatherID); if (father === undefined) { if (V.incubator.capacity > 0) { father = V.incubator.tanks.find(s => s.ID === fatherID); @@ -492,13 +494,6 @@ globalThis.findFather = function(fatherID) { return father; }; -globalThis.adjustFatherProperty = function(actor, property, newValue) { - let father = findFather(actor.ID); - if (father) { - father[property] = newValue; - } -}; - /* not to be used until that last part is defined. It may become slave.boobWomb.volume or some shit */ /** * @param {App.Entity.SlaveState} slave diff --git a/src/js/utilsAssessSlave.js b/src/js/utilsAssessSlave.js index 908a147fa1604c5950bd7bb3ea9f079de2cb3c4c..f223ccd7f189610f3a758f30bf1efa2fe7beeaf5 100644 --- a/src/js/utilsAssessSlave.js +++ b/src/js/utilsAssessSlave.js @@ -194,7 +194,7 @@ globalThis.getWrittenTitle = function(slave) { }; /** - * @param {App.Entity.SlaveState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.SlaveFullName = function(slave) { diff --git a/src/npc/descriptions/womb/superfetation.js b/src/npc/descriptions/womb/superfetation.js index 4be3a3870a587e7ae274c492c1b90e5b9a621ca5..f1841349f2e6cc05bd2836a0374bf4d2dd6a4cea 100644 --- a/src/npc/descriptions/womb/superfetation.js +++ b/src/npc/descriptions/womb/superfetation.js @@ -4,12 +4,22 @@ * @returns {string} */ App.Desc.superfetation = function(slave, descType) { + function daddyName(daddyID) { + if (daddyID > 0) { + const lsd = findFather(daddyID); + if (lsd) { + return SlaveFullName(lsd); + } + } else if (daddyID in V.missingTable && V.showMissingSlaves) { + return V.missingTable[daddyID].fullName; + } + return "another slave"; + } + const r = []; const { his, His } = getPronouns(slave); - let lsd; - let daddy; const slaveWD = WombGetLittersData(slave); if (slave.geneticQuirks.superfetation === 2 && slaveWD.litters.length > 1 && V.pregnancyMonitoringUpgrade === 1 && descType !== DescType.MARKET) { r.push(`${His} womb contains ${num(slaveWD.litters.length)} separate pregnancies:`); @@ -19,151 +29,43 @@ App.Desc.superfetation = function(slave, descType) { const was = countLitter > 1 ? "were" : "was"; if (litCount === 0) { r.push(`the eldest`); - if (countLitter > 1) { - r.push(`set of ${num(countLitter)},`); - } else { - r.push(`one,`); - } - r.push(`at ${slaveWD.litters[litCount]}`); - if (slaveWD.litters[litCount] > 1) { - r.push(`weeks`); - } else { - r.push(`week`); - } - r.push(`of development,`); - if (slaveWD.litterData[litCount][0].fatherID === -7) { - r.push(`${is} from the gene lab,`); - } else if (slaveWD.litterData[litCount][0].age > slave.pregData.normalBirth / 8) { - if (slaveWD.litterData[litCount][0].fatherID === -1) { - r.push(`${was} fathered by your seed,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -2) { - r.push(`${was} fathered by one of your citizens,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -3) { - r.push(`${was} fathered by your former Master,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -4) { - r.push(`${was} fathered by another arcology owner,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -5) { - r.push(`${was} fathered by one of your clients,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -6) { - r.push(`${was} fathered by a member of the Societal Elite,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -9) { - r.push(`${was} fathered by the Futanari Sisters,`); - } else if (slaveWD.litterData[litCount][0].fatherID === 0) { - r.push(`${is} from an unidentifiable source,`); - } else if (slaveWD.litterData[litCount][0].fatherID === slave.ID) { - r.push(`${is} from ${his} own handiwork,`); - } else { - if (slaveWD.litterData[litCount][0].fatherID > 0) { - lsd = findFather(slaveWD.litterData[litCount][0].fatherID); - if (lsd) { - daddy = SlaveFullName(lsd); - } else { - daddy = "another slave"; - } - } else if (slaveWD.litterData[litCount][0].fatherID in V.missingTable && V.showMissingSlaves) { - daddy = V.missingTable[slave.pregSource].fullName; - } - r.push(`${was} fathered by ${daddy}'s seed,`); - } - } else { - r.push(`${is} too young to tell the father of,`); - } } else if (litCount === slaveWD.litters.length - 1) { r.push(`and the youngest`); - if (countLitter > 1) { - r.push(`set of ${num(countLitter)},`); - } else { - r.push(`one,`); - } - r.push(`at ${slaveWD.litters[litCount]}`); - if (slaveWD.litters[litCount] > 1) { - r.push(`weeks`); - } else { - r.push(`week`); - } - r.push(`of development,`); - if (slaveWD.litterData[litCount][0].fatherID === -7) { - r.push(`${is} from the gene lab.`); - } else if (slaveWD.litterData[litCount][0].age > slave.pregData.normalBirth / 8) { - if (slaveWD.litterData[litCount][0].fatherID === -1) { - r.push(`${was} fathered by your seed.`); - } else if (slaveWD.litterData[litCount][0].fatherID === -2) { - r.push(`${was} fathered by one of your citizens.`); - } else if (slaveWD.litterData[litCount][0].fatherID === -3) { - r.push(`${was} fathered by your former Master. He was quite the busy man.`); - } else if (slaveWD.litterData[litCount][0].fatherID === -4) { - r.push(`${was} fathered by another arcology owner.`); - } else if (slaveWD.litterData[litCount][0].fatherID === -5) { - r.push(`${was} fathered by one of your clients.`); - } else if (slaveWD.litterData[litCount][0].fatherID === -6) { - r.push(`${was} fathered by a member of the Societal Elite.`); - } else if (slaveWD.litterData[litCount][0].fatherID === -9) { - r.push(`${was} fathered by the Futanari Sisters.`); - } else if (slaveWD.litterData[litCount][0].fatherID === 0) { - r.push(`${is} from an unidentifiable source.`); - } else if (slaveWD.litterData[litCount][0].fatherID === slave.ID) { - r.push(`${is} from ${his} own seed.`); - } else { - if (slaveWD.litterData[litCount][0].fatherID > 0) { - lsd = findFather(slaveWD.litterData[litCount][0].fatherID); - if (lsd) { - daddy = SlaveFullName(lsd); - } else { - daddy = "another slave"; - } - } else if (slaveWD.litterData[litCount][0].fatherID in V.missingTable && V.showMissingSlaves) { - daddy = V.missingTable[slave.pregSource].fullName; - } - r.push(`${was} fathered by ${daddy}'s seed.`); - } - } else { - r.push(`${is} too young to tell the father of.`); - } } else { - r.push(`the next set of ${num(countLitter)} at ${slaveWD.litters[litCount]}`); - if (slaveWD.litters[litCount] > 1) { - r.push(`weeks`); - } else { - r.push(`week`); - } - r.push(`of development`); - if (slaveWD.litterData[litCount][0].fatherID === -7) { - r.push(`${is} from the gene lab,`); - } else if (slaveWD.litterData[litCount][0].age > slave.pregData.normalBirth / 8) { - if (slaveWD.litterData[litCount][0].fatherID === -1) { - r.push(`${was} fathered by your seed,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -2) { - r.push(`${was} fathered by one of your citizens,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -3) { - r.push(`${was} fathered by your former Master,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -4) { - r.push(`${was} fathered by another arcology owner,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -5) { - r.push(`${was} fathered by one of your clients,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -6) { - r.push(`${was} fathered by a member of the Societal Elite,`); - } else if (slaveWD.litterData[litCount][0].fatherID === -9) { - r.push(`${was} fathered by the Futanari Sisters,`); - } else if (slaveWD.litterData[litCount][0].fatherID === 0) { - r.push(`${is} from an unidentifiable source,`); - } else if (slaveWD.litterData[litCount][0].fatherID === slave.ID) { - r.push(`${is} from ${his} own handiwork,`); - } else { - if (slaveWD.litterData[litCount][0].fatherID > 0) { - lsd = findFather(slaveWD.litterData[litCount][0].fatherID); - if (lsd) { - daddy = SlaveFullName(lsd); - } else { - daddy = "another slave"; - } - } else if (slaveWD.litterData[litCount][0].fatherID in V.missingTable && V.showMissingSlaves) { - daddy = V.missingTable[slave.pregSource].fullName; - } - r.push(`${was} fathered by ${daddy}'s seed,`); - } + r.push(`the next`); + } + if (countLitter > 1) { + r.push(`set of ${num(countLitter)},`); + } else { + r.push(`one,`); + } + r.push(`at ${numberWithPluralOne(slaveWD.litters[litCount], "week")} of development,`); + if (slaveWD.litterData[litCount][0].fatherID === -7) { + r.push(`${is} from the gene lab,`); + } else if (slaveWD.litterData[litCount][0].age > slave.pregData.normalBirth / 8) { + if (slaveWD.litterData[litCount][0].fatherID === -1) { + r.push(`${was} fathered by your seed,`); + } else if (slaveWD.litterData[litCount][0].fatherID === -2) { + r.push(`${was} fathered by one of your citizens,`); + } else if (slaveWD.litterData[litCount][0].fatherID === -3) { + r.push(`${was} fathered by your former Master,`); + } else if (slaveWD.litterData[litCount][0].fatherID === -4) { + r.push(`${was} fathered by another arcology owner,`); + } else if (slaveWD.litterData[litCount][0].fatherID === -5) { + r.push(`${was} fathered by one of your clients,`); + } else if (slaveWD.litterData[litCount][0].fatherID === -6) { + r.push(`${was} fathered by a member of the Societal Elite,`); + } else if (slaveWD.litterData[litCount][0].fatherID === -9) { + r.push(`${was} fathered by the Futanari Sisters,`); + } else if (slaveWD.litterData[litCount][0].fatherID === 0) { + r.push(`${is} from an unidentifiable source,`); + } else if (slaveWD.litterData[litCount][0].fatherID === slave.ID) { + r.push(`${is} from ${his} own handiwork,`); } else { - r.push(`${is} too young to tell the father of,`); + r.push(`${was} fathered by ${daddyName(slaveWD.litterData[litCount][0].fatherID)}'s seed,`); } + } else { + r.push(`${is} too young to tell the father of,`); } } } diff --git a/tsconfig.json b/tsconfig.json index bd2df2c88db402e947cf31ad8ee5edf5fcc49b78..2700b989a42888a3df54b1e201285dd85c036a5f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "allowJs": true, "checkJs": true, "noEmit": true, - "target": "ESNext", + "target": "es2021", "noImplicitAny": false, "disableSizeLimit": true },