diff --git a/src/art/genAI/ponyPrompts/demographicsPromptPart.js b/src/art/genAI/ponyPrompts/demographicsPromptPart.js index 8ddf19e63cf435334c08a28d12f2e345585fbc79..b8c3d2108f64c6cf077a1e2974003c25e47a25c4 100644 --- a/src/art/genAI/ponyPrompts/demographicsPromptPart.js +++ b/src/art/genAI/ponyPrompts/demographicsPromptPart.js @@ -31,7 +31,7 @@ App.Art.GenAI.DemographicsPromptPart = class DemographicsPromptPart extends App. * @override */ positive() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); const parts = []; // height, age, gender @@ -278,7 +278,7 @@ App.Art.GenAI.DemographicsPromptPart = class DemographicsPromptPart extends App. * @override */ negative() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); const parts = []; if (slave?.visualAge < 18 && V.aiAgeFilter) { diff --git a/src/art/genAI/ponyPrompts/structurePromptPart.js b/src/art/genAI/ponyPrompts/structurePromptPart.js index 3ff2ee1e08fc22d1372bd40a6f4137aef0e6d95c..f3b0feaf5da79509a1b305e41cefc97950ce4cea 100644 --- a/src/art/genAI/ponyPrompts/structurePromptPart.js +++ b/src/art/genAI/ponyPrompts/structurePromptPart.js @@ -5,7 +5,7 @@ App.Art.GenAI.StructurePromptPart = class StructurePromptPart extends App.Art.Ge positive() { // define stance and image composition - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); const parts = []; parts.push('realistic, portrait, solo'); // portrait structure prompt may become unnecessary once rest of body part prompts are in? diff --git a/src/art/genAI/prompts/androidPromptPart.js b/src/art/genAI/prompts/androidPromptPart.js index 32d0ca1454362b3267fac64b83cc1ab3971666bb..5ba5d8c8685a3eb534abb7680d01107c8f28e0f9 100644 --- a/src/art/genAI/prompts/androidPromptPart.js +++ b/src/art/genAI/prompts/androidPromptPart.js @@ -5,10 +5,9 @@ App.Art.GenAI.AndroidPromptPart = class AndroidPromptPart extends App.Art.GenAI. positive() { const parts = []; - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { // limbs covered by fuckdoll suit - } - else if (App.Art.GenAI.sdClient.hasLora("hololive_roboco-san-10")) { + } else if (App.Art.GenAI.sdClient.hasLora("hololive_roboco-san-10")) { if (hasBothProstheticArms(this.slave) && hasBothProstheticLegs(this.slave) && !(this.slave.visualAge < 18 && V.aiAgeFilter)) { parts.push(`<lora:hololive_roboco-san-10:1>, android, mechanical arms, mechanical legs`); } else if (hasBothProstheticArms(this.slave)) { @@ -28,7 +27,7 @@ App.Art.GenAI.AndroidPromptPart = class AndroidPromptPart extends App.Art.GenAI. * @override */ negative() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return; // limbs covered by fuckdoll suit } if (App.Art.GenAI.sdClient.hasLora("hololive_roboco-san-10")) { diff --git a/src/art/genAI/prompts/arousalPromptPart.js b/src/art/genAI/prompts/arousalPromptPart.js index 4de3b655fbc882ac660777ab76cfc8f8c585c74b..36f04abb2feebe6f75868204f57d3fe920cc6420 100644 --- a/src/art/genAI/prompts/arousalPromptPart.js +++ b/src/art/genAI/prompts/arousalPromptPart.js @@ -5,7 +5,7 @@ App.Art.GenAI.ArousalPromptPart = class ArousalPromptPart extends App.Art.GenAI. positive() { let prompt = {terms: [], weight: 1}; if (this.slave.visualAge < 18 && V.aiAgeFilter) { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return undefined; } if (this.slave.energy > 60) { @@ -17,7 +17,7 @@ App.Art.GenAI.ArousalPromptPart = class ArousalPromptPart extends App.Art.GenAI. if (this.slave.energy > 95) { prompt.weight = 1.1; } - } else if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + } else if (asSlave(this.slave)?.fuckdoll > 0) { // fuckdolls are kept in a state of permanent arousal, with genitals exposed if (this.slave.vagina >= 0) { prompt.terms.push("pussy juice"); diff --git a/src/art/genAI/prompts/beautyPromptPart.js b/src/art/genAI/prompts/beautyPromptPart.js index 32e35ad513bca225296a53bdfce2a15384fbe7ae..29f1142229b9528fedc404d04a45b47760b0aa6b 100644 --- a/src/art/genAI/prompts/beautyPromptPart.js +++ b/src/art/genAI/prompts/beautyPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.BeautyPromptPart = class BeautyPromptPart extends App.Art.GenAI.Pr * @override */ positive() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return undefined; // face not visible } @@ -24,7 +24,7 @@ App.Art.GenAI.BeautyPromptPart = class BeautyPromptPart extends App.Art.GenAI.Pr * @override */ negative() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return undefined; // face not visible } diff --git a/src/art/genAI/prompts/collarPromptPart.js b/src/art/genAI/prompts/collarPromptPart.js index 75b4a83685dc9eb9db721c4126735cc71f4778c1..13733c1451d89f5aa6df2c9455de53a9fa0a3d48 100644 --- a/src/art/genAI/prompts/collarPromptPart.js +++ b/src/art/genAI/prompts/collarPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.CollarPromptPart = class CollarPromptPart extends App.Art.GenAI.Pr * @override */ positive() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return undefined; // fuckdolls can't wear collars } diff --git a/src/art/genAI/prompts/customPromptPart.js b/src/art/genAI/prompts/customPromptPart.js index ac601fb48532f568623a10511bec994f3878c4e1..18c377f76168b5a97cc8127ff42bf1ec381c5288 100644 --- a/src/art/genAI/prompts/customPromptPart.js +++ b/src/art/genAI/prompts/customPromptPart.js @@ -4,7 +4,7 @@ App.Art.GenAI.CustomPromptPart = class CustomPromptPart extends App.Art.GenAI.Pr */ positive() { let positive = ""; - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); if (slave && slave.useRulesAssistant === 1 && slave.custom.aiPrompts?.positiveRA) { positive += slave.custom.aiPrompts?.positiveRA; } @@ -28,7 +28,7 @@ App.Art.GenAI.CustomPromptPart = class CustomPromptPart extends App.Art.GenAI.Pr */ negative() { let negative = ""; - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); if (slave && slave.useRulesAssistant === 1 && slave.custom.aiPrompts?.negativeRA) { negative += slave.custom.aiPrompts?.negativeRA; } diff --git a/src/art/genAI/prompts/expressionPromptPart.js b/src/art/genAI/prompts/expressionPromptPart.js index ac9910d48eff2024bb8ceefc5186780279534ece..110ac4b3031302cfbb75e90872799a10249a90ee 100644 --- a/src/art/genAI/prompts/expressionPromptPart.js +++ b/src/art/genAI/prompts/expressionPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.ExpressionPromptPart = class ExpressionPromptPart extends App.Art. * @override */ positive() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); const customPrompt = slave?.custom?.aiPrompts?.expressionPositive; if (customPrompt) { return customPrompt; @@ -66,7 +66,7 @@ App.Art.GenAI.ExpressionPromptPart = class ExpressionPromptPart extends App.Art. * @override */ negative() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); const customPrompt = slave?.custom?.aiPrompts?.expressionNegative; if (customPrompt) { return customPrompt; diff --git a/src/art/genAI/prompts/eyePromptPart.js b/src/art/genAI/prompts/eyePromptPart.js index 94bf57df02c1845396fbc1502133b309221a87b3..c448a77c9ccc6986a3e36cb1178a79d9b507bef6 100644 --- a/src/art/genAI/prompts/eyePromptPart.js +++ b/src/art/genAI/prompts/eyePromptPart.js @@ -4,7 +4,7 @@ App.Art.GenAI.EyePromptPart = class EyePromptPart extends App.Art.GenAI.PromptPa */ positive() { const positive = []; - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); if (slave?.fuckdoll > 0) { return undefined; // eyes are not visible behind fuckdoll mask } else if (hasBothEyes(this.slave)) { diff --git a/src/art/genAI/prompts/eyebrowPromptPart.js b/src/art/genAI/prompts/eyebrowPromptPart.js index 58358dfca8cc2b4b7a5c01254dc623ad8ed7b2ec..2a01a29e36448f3a0ad3e28630784368a95c03dd 100644 --- a/src/art/genAI/prompts/eyebrowPromptPart.js +++ b/src/art/genAI/prompts/eyebrowPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.EyebrowPromptPart = class EyebrowPromptPart extends App.Art.GenAI. * @override */ positive() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); if (slave?.fuckdoll > 0) { return; // covered by fuckdoll mask } diff --git a/src/art/genAI/prompts/healthPromptPart.js b/src/art/genAI/prompts/healthPromptPart.js index cb57c8802d041dc170f112801337dcc464549404..a30768ef2f8814d0c602f32ff82b5da5b0389499 100644 --- a/src/art/genAI/prompts/healthPromptPart.js +++ b/src/art/genAI/prompts/healthPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.HealthPromptPart = class HealthPromptPart extends App.Art.GenAI.Pr * @override */ positive() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return undefined; } if (this.slave.health.condition < -90) { @@ -23,7 +23,7 @@ App.Art.GenAI.HealthPromptPart = class HealthPromptPart extends App.Art.GenAI.Pr * @override */ negative() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0) { + if (asSlave(this.slave)?.fuckdoll > 0) { return undefined; } if (this.slave.health.condition > 50) { diff --git a/src/art/genAI/prompts/nationalityPromptPart.js b/src/art/genAI/prompts/nationalityPromptPart.js index f9dd157e47d428584a10dc90b014cb2091a8ea16..068b74631cedb516846f97efb9ae8f74a25a6a36 100644 --- a/src/art/genAI/prompts/nationalityPromptPart.js +++ b/src/art/genAI/prompts/nationalityPromptPart.js @@ -29,7 +29,7 @@ App.Art.GenAI.NationalityPromptPart = class NationalityPromptPart extends App.Ar * @override */ positive() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; + const slave = asSlave(this.slave); if (["Stateless", "none", "slave", ""].includes(this.slave.nationality) || slave?.fuckdoll > 0) { return; } diff --git a/src/art/genAI/prompts/piercingsPromptPart.js b/src/art/genAI/prompts/piercingsPromptPart.js index 707ff16b795e46c03fcba1290fc03097245d88f9..113de44e7044a30f6f144cf5af8e350057b5717a 100644 --- a/src/art/genAI/prompts/piercingsPromptPart.js +++ b/src/art/genAI/prompts/piercingsPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.PiercingsPromptPart = class PiercingsPromptPart extends App.Art.Ge * @override */ positive() { - const isFuckdoll = isSlave(this.slave) && asSlave(this.slave)?.fuckdoll !== 0; + const isFuckdoll = asSlave(this.slave)?.fuckdoll !== 0; const skipIt = this.slave.visualAge < 18 && V.aiAgeFilter; let piercingParts = []; diff --git a/src/art/genAI/prompts/posturePromptPart.js b/src/art/genAI/prompts/posturePromptPart.js index dea65d83992789c89e4f2058b25ae3c7e307d5ed..f9e4a0fabe8308e18e73b1fd2dee2cd06c82c462 100644 --- a/src/art/genAI/prompts/posturePromptPart.js +++ b/src/art/genAI/prompts/posturePromptPart.js @@ -3,8 +3,8 @@ App.Art.GenAI.PosturePromptPart = class PosturePromptPart extends App.Art.GenAI. * @override */ positive() { - const slave = isSlave(this.slave) ? asSlave(this.slave) : undefined; - const customPrompt = slave?.custom.aiPrompts?.pose; + const slave = asSlave(this.slave); + const customPrompt = slave?.custom?.aiPrompts?.pose; if (customPrompt) { return customPrompt; } @@ -53,7 +53,7 @@ App.Art.GenAI.PosturePromptPart = class PosturePromptPart extends App.Art.GenAI. * @override */ negative() { - if (isSlave(this.slave) && asSlave(this.slave)?.custom.aiPrompts?.pose) { + if (asSlave(this.slave)?.custom?.aiPrompts?.pose) { return undefined; } diff --git a/src/art/genAI/prompts/pubicHairPromptPart.js b/src/art/genAI/prompts/pubicHairPromptPart.js index 422df5a6ea9ee92d364037d7c1bf716db8e1b4da..4ec49185c1b20c4e29c1dff15cd6b1cef4b7e1d2 100644 --- a/src/art/genAI/prompts/pubicHairPromptPart.js +++ b/src/art/genAI/prompts/pubicHairPromptPart.js @@ -10,7 +10,7 @@ App.Art.GenAI.PubicHairPromptPart = class PubicHairPromptPart extends App.Art.Ge if (this.slave.pubicHStyle === "waxed" || this.slave.pubicHStyle === "bald" || this.slave.pubicHStyle === "hairless" || this.slave.physicalAge < Math.min(this.slave.pubertyAgeXX, this.slave.pubertyAgeXY)) { return; } - if (App.Data.clothes.get(this.slave.clothes).exposure < 3 || (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0)) { + if (App.Data.clothes.get(this.slave.clothes).exposure < 3 || (asSlave(this.slave)?.fuckdoll > 0)) { return; // pubic region should be covered by clothes } const style = (this.slave.pubicHStyle === "bushy in the front and neat in the rear" ? "bushy" : this.slave.pubicHStyle); // less complicated prompt works better for the long style diff --git a/src/art/genAI/prompts/tattoosPromptPart.js b/src/art/genAI/prompts/tattoosPromptPart.js index b46c7f53399c0883ae3f0e287bec369ea4080231..93db774024b7ec8083e16920571edf91fe1da1d0 100644 --- a/src/art/genAI/prompts/tattoosPromptPart.js +++ b/src/art/genAI/prompts/tattoosPromptPart.js @@ -3,7 +3,7 @@ App.Art.GenAI.TattoosPromptPart = class TattoosPromptPart extends App.Art.GenAI. * @override */ positive() { - if (isSlave(this.slave) && asSlave(this.slave)?.fuckdoll > 0 || this.slave.race === "catgirl") { + if (asSlave(this.slave)?.fuckdoll > 0 || this.slave.race === "catgirl") { return undefined; // fuckdoll suit covers all possible tattoo locations, catgirl covered with fur } // TODO: clothes can cover limbs/belly/boobs. diff --git a/src/cheats/cheatEditActor.js b/src/cheats/cheatEditActor.js index 8c74873b588a3189c53f5b880dcf08d77e15c7fa..b9739374609a8c8205014c882fcaa6e821570ac4 100644 --- a/src/cheats/cheatEditActor.js +++ b/src/cheats/cheatEditActor.js @@ -9,6 +9,7 @@ App.UI.Cheat.cheatEditActor = function(actor) { const el = new DocumentFragment(); + // TODO:@franklygeorge make these call as* instead and then use them in the code below instead of calling as* multiple times const player = isPlayer(actor); const infant = isInfant(actor); const child = isChild(actor) && false; // TODO: remove ` && false` once ChildState is actually implemented diff --git a/src/data/patches/patchUtils.js b/src/data/patches/patchUtils.js index 3f7306e23b7bb54a4ab3b0e675c218e254167f84..496bb9f49fcc979366817fee58888a42a336e4c8 100644 --- a/src/data/patches/patchUtils.js +++ b/src/data/patches/patchUtils.js @@ -368,7 +368,7 @@ App.Patch.Utils.current = { * @property {(div: HTMLDivElement, human: FC.HumanState, location: App.Patch.Utils.HumanStateLocation) => FC.HumanState} [humanState] * @property {(div: HTMLDivElement, slave: FC.SlaveState, location: App.Patch.Utils.HumanStateLocation) => FC.SlaveState} [slaveState] * @property {(div: HTMLDivElement, tank: FC.TankSlaveState) => FC.TankSlaveState} [tankSlaveState] - * @property {(div: HTMLDivElement, player: FC.PlayerState) => FC.PlayerState} [playerState] + * @property {(div: HTMLDivElement, player: FC.PlayerState, location: App.Patch.Utils.HumanStateLocation) => FC.PlayerState} [playerState] * * @property {(div: HTMLDivElement, fetus: FC.Fetus, mother: FC.HumanState) => FC.Fetus} [fetus] * @property {(div: HTMLDivElement, infant: FC.InfantState) => FC.InfantState} [infantState] diff --git a/src/data/patches/releases/1258_runLegacyBC.js b/src/data/patches/releases/1258_runLegacyBC.js index 78045e8e08a8b707b86eb38f1a4a4beead1c5b7d..7790e258057020d237b356db683d3b5b73cbf984 100644 --- a/src/data/patches/releases/1258_runLegacyBC.js +++ b/src/data/patches/releases/1258_runLegacyBC.js @@ -10,10 +10,19 @@ App.Patch.register({ slaveState: (div, actor, location) => { // call the valid parts of legacy BC for the slave App.Patch.log(`** Calling legacy BC **`); - App.Update.Slave(actor); + App.Update.Slave(actor, location === "V.genePool"); App.Update.SlaveDataSchemeCleanup(actor); - App.Update.SlaveDatatypeCleanup(actor); - actor = /** @type {FC.SlaveState} */ (App.Update.human(actor, "normal", div)); + App.Update.SlaveDatatypeCleanup(actor, location === "V.incubator.tanks"); + /** @type {"normal" | "PC" | "detached" | "incubator"} */ + let slaveType = "normal"; + /** @type {App.Patch.Utils.HumanStateLocation[]} */ + const detachedLocations = ["V.boomerangSlave", "V.hostage", "V.shelterSlave", "V.traitor"]; + if (location === "V.incubator.tanks") { + slaveType = "incubator"; + } else if (detachedLocations.includes(location)) { + slaveType = "detached"; + } + actor = /** @type {FC.SlaveState} */ (App.Update.human(actor, slaveType, div)); return actor; }, tankSlaveState: (div, actor) => { @@ -25,10 +34,10 @@ App.Patch.register({ actor = /** @type {FC.TankSlaveState} */ (App.Update.human(actor, "incubator", div)); return actor; }, - playerState: (div, actor) => { + playerState: (div, actor, location) => { // call the valid parts of legacy BC for the player App.Patch.log("** Calling legacy BC **"); - App.Update.Player(actor); + App.Update.Player(actor, location === "V.genePool"); actor = /** @type {FC.PlayerState} */ (App.Update.human(actor, "PC", div)); return actor; }, diff --git a/src/data/patches/releases/legacy_1045.js b/src/data/patches/releases/legacy_1045.js index da7731705823693b6c8096b3b172749e6500de35..f4e4f1935e56fd80269acc093421e42736b4ceb7 100644 --- a/src/data/patches/releases/legacy_1045.js +++ b/src/data/patches/releases/legacy_1045.js @@ -37,7 +37,7 @@ App.Patch.register({ } return actor; }, - playerState: (div, actor) => { + playerState: (div, actor, location) => { if (!App.Utils.objectExistsAndHasKeys(actor.badRumors, ["penetrative", "birth", "weakness"])) { App.Patch.log("Patching badRumors"); const template = { diff --git a/src/data/verification/verifyGameVariables.js b/src/data/verification/verifyGameVariables.js index 49ad831aa487f9aec2c5d55e9d4df9a2992f5f26..b418bef457801644fbb91762fa993a68452a1b1d 100644 --- a/src/data/verification/verifyGameVariables.js +++ b/src/data/verification/verifyGameVariables.js @@ -25,27 +25,17 @@ App.Verify.gameVariables = (div) => { App.Verify.I.genePool = () => { const AllHumanIDs = getAllHumans().map((s) => s.ID); // remove all unneeded records from the genePool - let records = _.cloneDeep(V.genePool); - let recordKeys = Object.keys(records); - for (const k in recordKeys) { - const key = recordKeys[k]; + for (const [key, record] of Object.entries(_.cloneDeep(V.genePool))) { if (key === "-1" || AllHumanIDs.includes(Number(key))) { continue; } - // @ts-ignore gene pool records in the gene pool are protected. Normally you would access them via getGenePoolRecord() - const record = records[key]; deleteGenePoolRecord(/** @type {FC.HumanState} */ (record)); // by default deleteGenePoolRecord only deletes records that are no longer needed } // update all records in the genePool /** @type {FC.HumanState[]} */ const updatedRecords = []; - records = _.cloneDeep(V.genePool); - recordKeys = Object.keys(records); - for (const k in recordKeys) { - const key = recordKeys[k]; - // @ts-ignore gene pool records in the gene pool are protected. Normally you would access them via getGenePoolRecord() - const record = /** @type {FC.HumanState} */ (records[key]); + for (const [key, record] of Object.entries(_.cloneDeep(V.genePool))) { const actor = key === "-1" ? V.PC : getSlave(record.ID) ?? baseSlave(); - + console.log("1", clone(key), _.cloneDeep(record), clone(record.inbreedingCoeff)); // make the record a valid PlayerState or HumanState object App.Utils.assignMissingDefaults(record, actor); @@ -66,9 +56,9 @@ App.Verify.I.genePool = () => { ); } // force delete old record - deleteGenePoolRecord(record, true); // force deletion; by default deleteGenePoolRecord only deletes records that are no longer needed + deleteGenePoolRecord(/** @type {FC.HumanState} */ (record), true); // force deletion; by default deleteGenePoolRecord only deletes records that are no longer needed // store new record - updatedRecords.push(record); + updatedRecords.push(/** @type {FC.HumanState} */ (record)); } // update V.genePoolDefaults to ensure it matches any changes in structure @@ -515,3 +505,10 @@ App.Verify.I.arcologies = () => { arc.rival = Math.clamp(arc.rival, 0, 1) ?? 0; } }; + +/** + * @type {App.Verify.Utils.FunctionGameVariables} + */ +App.Verify.I.jobIDMap = () => { + V.JobIDMap = makeJobIdMap(); +}; diff --git a/src/data/verification/verifyHumanState.js b/src/data/verification/verifyHumanState.js index 55949584d735a43ac28ee4af4e43d631d0aecb42..9427160ad573038cd17654f1754bef05175a07e2 100644 --- a/src/data/verification/verifyHumanState.js +++ b/src/data/verification/verifyHumanState.js @@ -377,5 +377,9 @@ App.Verify.I.humanMisc = (actor, location) => { // @ts-expect-error Type 'number' is not assignable to type '0 | 1 | 2 | 3' actor.accent = Math.clamp(+actor.accent, 0, 4) ?? 0; actor.origBodyOwnerID = Math.max(+actor.origBodyOwnerID, 0) ?? 0; + + if (actor.drugs.includes("penis") && actor.dick === 0 && actor.vagina >= 0) { + actor.drugs = /** @type {FC.PCDrug} */ (actor.drugs.replace("penis", "clitoris")); + } return actor; }; diff --git a/src/data/verification/verifySlaveState.js b/src/data/verification/verifySlaveState.js index d2f37de37b4f5f4ec22ae05b7c283b9267cc5641..0bacdcbd8bc169002a38ce1a59f6e577ed7ec096 100644 --- a/src/data/verification/verifySlaveState.js +++ b/src/data/verification/verifySlaveState.js @@ -350,6 +350,7 @@ App.Verify.I.slaveMisc = (actor, location) => { actor.whoreClass = Math.max(+actor.whoreClass, 0) ?? 0; if (!Object.values(Job).includes(actor.assignment)) { actor.assignment = Job.REST; + App.Verify.I.jobIDMap(); } actor = /** @type {FC.SlaveState} */ (App.Verify.I.humanMisc(actor, location)); return actor; diff --git a/src/data/verification/zVerify.js b/src/data/verification/zVerify.js index 262fba93799af592720f36adc392d4c0d839a287..56ae0667fb178e362d80f88e58b6c78320448d94 100644 --- a/src/data/verification/zVerify.js +++ b/src/data/verification/zVerify.js @@ -98,6 +98,7 @@ App.Verify.instructions = { facilityNursery: App.Verify.I.facilityNursery, futureSocieties: App.Verify.I.futureSocieties, arcologies: App.Verify.I.arcologies, + jobIDMap: App.Verify.I.jobIDMap, }, slaveState: { slaveAge: App.Verify.I.slaveAge, diff --git a/src/endWeek/healthFunctions.js b/src/endWeek/healthFunctions.js index 8677012f9806bac216857116ec39899252c69915..c8dd4cfbe10fc463c57cd9ec95b84afa70729df4 100644 --- a/src/endWeek/healthFunctions.js +++ b/src/endWeek/healthFunctions.js @@ -233,7 +233,7 @@ globalThis.canCatchIllness = function(human) { return false; } - if (isSlave(human) && asSlave(human).assignment === Job.CLINIC) { // slaves in the clinic are monitored + if (asSlave(human)?.assignment === Job.CLINIC) { // slaves in the clinic are monitored return false; } return true; diff --git a/src/js/health.js b/src/js/health.js index 80b86d62d97b5c9c1687966f6644e2c36d27dd92..ebdc688f240d94288e345ef805ce756ff17a3bdf 100644 --- a/src/js/health.js +++ b/src/js/health.js @@ -7,8 +7,8 @@ globalThis.healthPenalty = function(slave) { const H = slave.health; let penalty = 100; - if (isSlave(slave)) { - const realSlave = asSlave(slave); + const realSlave = asSlave(slave); + if (realSlave) { if (realSlave.assignment !== Job.GLORYHOLE) { if (H.illness > 0) { penalty *= (100 - Math.min((Math.pow(H.illness, 2) * 5 + 5), 95)) / 100; diff --git a/src/js/relationshipChecks.js b/src/js/relationshipChecks.js index 8b0750dc1cf0bbbd5ec1852ee5408ed98fea9044..a197d5d381e0a881e543f479e897ac71c2af96e1 100644 --- a/src/js/relationshipChecks.js +++ b/src/js/relationshipChecks.js @@ -77,7 +77,7 @@ globalThis.contextualIntro = function(context, actor, asLink = false, insertComm let r = ``; const preamble = (context === V.PC) ? "your" : getPronouns(context).possessive; - const slave = isSlave(actor) ? asSlave(actor) : undefined; + const slave = asSlave(actor); let terms = []; if (slave && slave.relationship > 0 && slave.relationshipTarget === slave.ID) { terms.push(relationshipTerm(slave)); diff --git a/src/js/states/001-GenePoolRecord.js b/src/js/states/001-GenePoolRecord.js index 12b5a7dd02b21267435701f8f13d5ac4052d63ce..ba36625353c9fedb12a6f6ceed69c84a64bf2490 100644 --- a/src/js/states/001-GenePoolRecord.js +++ b/src/js/states/001-GenePoolRecord.js @@ -72,12 +72,17 @@ globalThis.isInGenePool = (key) => { * @param {FC.HumanState} actor */ globalThis.addToGenePool = (actor) => { - if (isPlayer(actor)) { - App.Verify.playerState(asPlayer(actor)); - } else if (isSlave(actor)) { + const player = asPlayer(actor); + const slave = asSlave(actor); + if (player) { + App.Verify.playerState( + player, + `<Player with ID '${actor.ID}' passed to addToGenePool()>`, + ); + } else if (slave) { App.Verify.slaveState( `<Slave with ID '${actor.ID}' passed to addToGenePool()>`, - asSlave(actor), + slave, "none" ); } else { @@ -119,6 +124,9 @@ globalThis.addToGenePool = (actor) => { */ const removeDefaults = (obj, template) => { for (const key in obj) { + if (["inbreedingCoeff", "birthWeek"].includes(key)) { + continue; + } if (key in template) { if (JSON.stringify(obj[key]) === JSON.stringify(template[key])) { delete obj[key]; diff --git a/src/js/states/002-HumanState.js b/src/js/states/002-HumanState.js index 53ad3ca0075af54836a56bc28a0f820b66681e40..374e5cf0d6c45df62c898418f41dcafd018f2b0d 100644 --- a/src/js/states/002-HumanState.js +++ b/src/js/states/002-HumanState.js @@ -1056,6 +1056,9 @@ App.Entity.HumanState = class HumanState extends App.Entity.GenePoolRecord { * 0: sated */ this.need = 0; + + /** @type {FC.PCDrug} */ + this.drugs = "no drugs"; /** * A list of IDs of anyone they have ever slept with. * diff --git a/src/js/utilsAssessSlave.js b/src/js/utilsAssessSlave.js index c2b2d4217e29fdf7be4e11afbe9ca4bd363e8a47..f70fb790aa884359471765e0e0b869c1bfe577ba 100644 --- a/src/js/utilsAssessSlave.js +++ b/src/js/utilsAssessSlave.js @@ -304,7 +304,7 @@ globalThis.perceivedGender = function(slave) { degree--; } degree += Math.trunc(slave.hormoneBalance / 200); - const PC = isPlayer(slave) ? asPlayer(slave) : undefined; + const PC = asPlayer(slave); if (PC) { if (PC.title === 1) { degree--; diff --git a/src/npc/startingGirls/editFamily.js b/src/npc/startingGirls/editFamily.js index 5ba0c6a2a0d54c3ceeb34b0bd4db31268f138fbb..8568f8c131075887055dbed0e61136899dac6352 100644 --- a/src/npc/startingGirls/editFamily.js +++ b/src/npc/startingGirls/editFamily.js @@ -40,7 +40,7 @@ App.Intro.editFamily = function(slave, cheat) { function makeFamilyTable() { const familyTable = makeElWithID("family-table"); - const notPlayer = isSlave(slave) ? asSlave(slave) : undefined; + const notPlayer = asSlave(slave); if (cheat && notPlayer) { familyTable.append(relationshipTarget(notPlayer)); familyTable.append(relationshipType(notPlayer));