diff --git a/devTools/dictionaries/misc.txt b/devTools/dictionaries/misc.txt index 607e433212f6f097d38de4ac30a57377314ca728..4dac21b18d7d7a4cfb932ebc529552146cd87d92 100644 --- a/devTools/dictionaries/misc.txt +++ b/devTools/dictionaries/misc.txt @@ -1,3 +1,4 @@ +Engineerix orthodontal SDXL swinir diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 2baa9a734b1055a93b0184970bbdd2258a1c41aa..63b7074d97c3eb352402f816cf01ef134d5e5276 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -17,8 +17,10 @@ App.Data.defaultGameStateVariables = { releaseID: 0, // Slaves - /** @type {{[key: number]: number}} */ + /** @type {ReadonlyDeep<{[key: number]: number}>} */ slaveIndices: {}, + /** @type {Readonly<Array<Readonly<FC.SlaveState>>>} */ + slaves: [], /** * @readonly * Each slave and the player gets a genepool record when they are created @@ -37,8 +39,6 @@ App.Data.defaultGameStateVariables = { */ genePoolDefaults: undefined, // new App.Entity.GenePoolRecord(); App.Entity.GenePoolRecord doesn't exist yet... missingTable: {}, - /** @type {FC.SlaveState[]} */ - slaves: [], // PC /** @type {FC.PlayerState} */ diff --git a/js/medicine/surgery/extreme/fuckdoll.js b/js/medicine/surgery/extreme/fuckdoll.js index 900913f6882f5768703f80760a19d77c8f0c90b0..65158ded13f0f8ba5f5127678887253d33ef34be 100644 --- a/js/medicine/surgery/extreme/fuckdoll.js +++ b/js/medicine/surgery/extreme/fuckdoll.js @@ -23,7 +23,7 @@ App.Medicine.Surgery.Reactions.Fuckdoll = class extends App.Medicine.Surgery.Sim reaction(slave, diff) { const reaction = super.reaction(slave, diff); const {He, he, His, his, him, sister, wife} = getPronouns(slave); - const relations = V.slaves.filter((s) => areRelated(s, slave) && (s.ID !== slave.relationshipTarget)); + const relations = getSlaves().filter((s) => areRelated(s, slave) && (s.ID !== slave.relationshipTarget)); let r = []; let relatedCount = 0; diff --git a/js/rulesAssistant/conditionEditorTree.js b/js/rulesAssistant/conditionEditorTree.js index 8e4607d5eb32b7770aaec8e8dfa38abcee48ba2a..6253c9d15bea0d0af768697c23f4e19449e73b53 100644 --- a/js/rulesAssistant/conditionEditorTree.js +++ b/js/rulesAssistant/conditionEditorTree.js @@ -1016,7 +1016,7 @@ App.RA.Activation.TreeEditor = (function() { } _validateRule(check) { - const slave = createReadonlyProxy(V.slaves[0]); + const slave = createReadonlyProxy(getSlaves()[0]); const context = new App.RA.Activation.Context(slave); (new Function("c", `return (${check})(c)`))(context); return true; diff --git a/src/004-base/baseEvent.js b/src/004-base/baseEvent.js index 33f36c67b89a5574f5b354697d6c71276521aae5..f1dda12c4e2af4df95af0b44324c927f754cb20a 100644 --- a/src/004-base/baseEvent.js +++ b/src/004-base/baseEvent.js @@ -108,7 +108,7 @@ App.Events.BaseEvent = class BaseEvent { } for (; i < prereqs.length; ++i) { - const qualified = V.slaves.filter(s => !this.actors.includes(s.ID) && prereqs[i].every(p => p(s))); + const qualified = getSlaves().filter(s => !this.actors.includes(s.ID) && prereqs[i].every(p => p(s))); if (qualified.length === 0) { return false; // a required actor was not found } diff --git a/src/004-base/facility.js b/src/004-base/facility.js index f3ffe9953c8e0fba149c85b6a18222dc2024f7f0..2f144f39f225b4cf37c90fb38243d0b8f89c2c81 100644 --- a/src/004-base/facility.js +++ b/src/004-base/facility.js @@ -99,7 +99,7 @@ App.Entity.Facilities.Job = class { */ assignmentLinkElement(ID, passage, callback, linkText) { linkText = linkText || this.desc.position; - return App.UI.DOM.assignmentLink(slaveStateById(ID), this.desc.assignment, passage, callback, linkText); + return App.UI.DOM.assignmentLink(getSlave(ID), this.desc.assignment, passage, callback, linkText); } /** @@ -107,7 +107,7 @@ App.Entity.Facilities.Job = class { * @returns {FC.SlaveState[]} */ employees() { - return [...this.employeesIDs()].map(id => slaveStateById(id)); + return [...this.employeesIDs()].map(id => getSlave(id)); } /** @@ -471,7 +471,7 @@ App.Entity.Facilities.Facility = class { */ assignmentLinkElements(ID, job, passage, callback) { /** @type {FC.SlaveState} */ - const slave = slaveStateById(ID); + const slave = getSlave(ID); const jobs = job === undefined ? this._jobs : {job: this._jobs[job]}; let res = []; @@ -569,7 +569,7 @@ App.Entity.Facilities.FacilitySingleJob = class extends App.Entity.Facilities.Jo */ assignmentLinkElement(ID, targetPassage, callback, linkText) { linkText = linkText || this.desc.position; - return App.UI.DOM.assignmentLink(slaveStateById(ID), this.desc.assignment, "", + return App.UI.DOM.assignmentLink(getSlave(ID), this.desc.assignment, "", (slave, assignment) => { if (callback) { callback(slave, assignment); diff --git a/src/004-base/specialSlavesProxy.js b/src/004-base/specialSlavesProxy.js index 66e3e91824dea7f78409d0df536133ff9f5050c5..13b9339ed2dbdf0a40c68788b08143bb35201fca 100644 --- a/src/004-base/specialSlavesProxy.js +++ b/src/004-base/specialSlavesProxy.js @@ -3,55 +3,52 @@ App.SpecialSlavesProxy = class SpecialSlavesProxy { } get Attendant() { - return slaveStateById(V.AttendantID); + return getSlave(V.AttendantID); } get Bodyguard() { - return slaveStateById(V.BodyguardID); + return getSlave(V.BodyguardID); } get Concubine() { - return slaveStateById(V.ConcubineID); + return getSlave(V.ConcubineID); } get DJ() { - return slaveStateById(V.djID); + return getSlave(V.djID); } get Farmer() { - return slaveStateById(V.FarmerID); + return getSlave(V.FarmerID); } get HeadGirl() { - return slaveStateById(V.HeadGirlID); + return getSlave(V.HeadGirlID); } get Lurcher() { - return slaveStateById(V.LurcherID); + return getSlave(V.LurcherID); } get Madam() { - return slaveStateById(V.MadamID); + return getSlave(V.MadamID); } get Matron() { - return slaveStateById(V.MatronID); + return getSlave(V.MatronID); } get Milkmaid() { - return slaveStateById(V.MilkmaidID); + return getSlave(V.MilkmaidID); } get Nurse() { - return slaveStateById(V.NurseID); + return getSlave(V.NurseID); } get Recruiter() { - return slaveStateById(V.RecruiterID); + return getSlave(V.RecruiterID); } get Schoolteacher() { - return slaveStateById(V.SchoolteacherID); + return getSlave(V.SchoolteacherID); } get Stewardess() { - return slaveStateById(V.StewardessID); + return getSlave(V.StewardessID); } get Stud() { - return slaveStateById(V.StudID); + return getSlave(V.StudID); } get Wardeness() { - return slaveStateById(V.WardenessID); - } - get activeSlave() { - return V.activeSlave; + return getSlave(V.WardenessID); } }; diff --git a/src/Mods/DinnerParty.js b/src/Mods/DinnerParty.js index 1a2860262131285f99df8630f7fcd7660bd64ad5..eb478467eef01376e92f7fbf6ef495c32bf3fdd2 100644 --- a/src/Mods/DinnerParty.js +++ b/src/Mods/DinnerParty.js @@ -141,7 +141,7 @@ App.Mods.DinnerParty.Execution = function() { App.Events.addNode(t, [], "p"); // Clean up and slaves reactions App.Events.addNode(t, ["When the last of your guests has stumbled drunkenly out your door, your slaves begin the daunting task of cleanup."], "div"); - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { let relation; let feeling; const {his3, sister3, daughter3, He3} = getPronouns(aliveSlave).appendSuffix("3"); @@ -182,7 +182,7 @@ App.Mods.DinnerParty.Execution = function() { } } - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { let relation; let feeling; const {his3, sister3, daughter3, He3} = getPronouns(aliveSlave).appendSuffix("3"); @@ -223,7 +223,7 @@ App.Mods.DinnerParty.Execution = function() { } } - let aliveSlave = V.slaves.find(s => s.ID === slave.relationshipTarget && s.fetish !== Fetish.MINDBROKEN); + let aliveSlave = getSlaves().find(s => s.ID === slave.relationshipTarget && s.fetish !== Fetish.MINDBROKEN); if (slave.relationship !== 0 && aliveSlave) { const {his3} = getPronouns(aliveSlave).appendSuffix("3"); App.Events.addNode(t, [`${aliveSlave.slaveName} is`, App.UI.DOM.makeElement("span", "distraught", ["mediumorchid"]), `that you ate ${his3} best source of comfort and companionship in a life of bondage.`], "div"); @@ -231,7 +231,7 @@ App.Mods.DinnerParty.Execution = function() { aliveSlave.devotion -= 20; } - aliveSlave = V.slaves.find(s => s.ID === slave.rivalryTarget && s.fetish !== Fetish.MINDBROKEN); + aliveSlave = getSlaves().find(s => s.ID === slave.rivalryTarget && s.fetish !== Fetish.MINDBROKEN); if (slave.rivalry !== 0 && aliveSlave) { const {his3, He3} = getPronouns(aliveSlave).appendSuffix("3"); App.Events.addNode(t, [`${aliveSlave.slaveName} is`, App.UI.DOM.makeElement("span", "pleased", ["hotpink"]), `that ${He3} won't have to see ${his3} rival any more.`], "div"); @@ -243,12 +243,12 @@ App.Mods.DinnerParty.Execution = function() { r.push(`The fat slaves are`, App.UI.DOM.makeElement("span", "worried", ["gold"]), "they are being fattened for consumption."); r.push(`But your worshipful chattel are`, App.UI.DOM.makeElement("span", "pleased", ["hotpink"]), "that you could find a use for them even in death and", App.UI.DOM.makeElement("span", "hope", ["mediumaquamarine"]), "a similar fate awaits them."); App.Events.addNode(t, r, "p"); - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { aliveSlave.devotion -= 5; aliveSlave.trust -= (aliveSlave.diet === "fattening" || aliveSlave.weight > 10 ? 10 : 5); } - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { aliveSlave.devotion += 5; aliveSlave.trust += 5; } @@ -277,7 +277,7 @@ App.Mods.DinnerParty.Execution = function() { V.MOD_enemy = {leader: 0, numSlave: 0, slaveTotalHP: 0, numDrone: 0, droneTotalHP: 0, numMerc: 0, mercTotalHP: 0, weekCreated: 0, enemyIndex: -1, hostility: 0}; V.MOD_enemy.leader = _slave; V.MOD_enemy.weekCreated = V.week; - V.MOD_enemy.numSlave = random(Math.trunc(V.slaves.length * 0.7), Math.trunc(V.slaves.length * 1.3)); + V.MOD_enemy.numSlave = random(Math.trunc(getSlaves().length * 0.7), Math.trunc(getSlaves().length * 1.3)); V.MOD_enemy.numDrone = random(25, 75); V.MOD_enemy.numMerc = random(10, 60); V.MOD_enemyList.push(V.MOD_enemy); @@ -292,7 +292,7 @@ App.Mods.DinnerParty.Execution = function() { App.Events.addNode(t, r, "p"); repX(forceNeg(dinnerRating * 100), "event"); - for (const aliveSlave of V.slaves) { + for (const aliveSlave of getSlaves()) { if (random(0, 1) > 0) { healthDamage(aliveSlave, 10); } @@ -348,7 +348,7 @@ App.Mods.DinnerParty.Execution = function() { App.Events.addNode(t, [], "p"); // Clean up and slaves reactions App.Events.addNode(t, ["When the last of your guests has stumbled drunkenly out your door, your slaves begin the daunting task of cleanup."], "div"); - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { let relation; let feeling; const {his3, sister3, daughter3, He3} = getPronouns(aliveSlave).appendSuffix("3"); @@ -389,7 +389,7 @@ App.Mods.DinnerParty.Execution = function() { } } - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { let relation; let feeling; const {his3, sister3, daughter3, He3} = getPronouns(aliveSlave).appendSuffix("3"); @@ -430,7 +430,7 @@ App.Mods.DinnerParty.Execution = function() { } } - let aliveSlave = V.slaves.find(s => s.ID === slave.relationshipTarget && s.fetish !== Fetish.MINDBROKEN); + let aliveSlave = getSlaves().find(s => s.ID === slave.relationshipTarget && s.fetish !== Fetish.MINDBROKEN); if (slave.relationship !== 0 && aliveSlave) { const {his3} = getPronouns(aliveSlave).appendSuffix("3"); App.Events.addNode(t, [`${aliveSlave.slaveName} is`, App.UI.DOM.makeElement("span", "distraught", ["mediumorchid"]), `that you ate ${his3} best source of comfort and companionship in a life of bondage.`], "div"); @@ -438,7 +438,7 @@ App.Mods.DinnerParty.Execution = function() { aliveSlave.devotion -= 20; } - aliveSlave = V.slaves.find(s => s.ID === slave.rivalryTarget && s.fetish !== Fetish.MINDBROKEN); + aliveSlave = getSlaves().find(s => s.ID === slave.rivalryTarget && s.fetish !== Fetish.MINDBROKEN); if (slave.rivalry !== 0 && aliveSlave) { const {his3, He3} = getPronouns(aliveSlave).appendSuffix("3"); App.Events.addNode(t, [`${aliveSlave.slaveName} is`, App.UI.DOM.makeElement("span", "pleased", ["hotpink"]), `that ${He3} won't have to see ${his3} rival any more.`], "div"); @@ -450,12 +450,12 @@ App.Mods.DinnerParty.Execution = function() { r.push(`The fat slaves are`, App.UI.DOM.makeElement("span", "worried", ["gold"]), "they are being fattened for consumption."); r.push(`But your worshipful chattel are`, App.UI.DOM.makeElement("span", "pleased", ["hotpink"]), "that you could find a use for them even in death and", App.UI.DOM.makeElement("span", "hope", ["mediumaquamarine"]), "a similar fate awaits them."); App.Events.addNode(t, r, "p"); - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion < 50)) { aliveSlave.devotion -= 5; aliveSlave.trust -= (aliveSlave.diet === "fattening" || aliveSlave.weight > 10 ? 10 : 5); } - for (const aliveSlave of V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { + for (const aliveSlave of getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.devotion >= 85)) { aliveSlave.devotion += 5; aliveSlave.trust += 5; } @@ -484,7 +484,7 @@ App.Mods.DinnerParty.Execution = function() { V.MOD_enemy = {leader: 0, numSlave: 0, slaveTotalHP: 0, numDrone: 0, droneTotalHP: 0, numMerc: 0, mercTotalHP: 0, weekCreated: 0, enemyIndex: -1, hostility: 0}; V.MOD_enemy.leader = _slave; V.MOD_enemy.weekCreated = V.week; - V.MOD_enemy.numSlave = random(Math.trunc(V.slaves.length * 0.7), Math.trunc(V.slaves.length * 1.3)); + V.MOD_enemy.numSlave = random(Math.trunc(getSlaves().length * 0.7), Math.trunc(getSlaves().length * 1.3)); V.MOD_enemy.numDrone = random(25, 75); V.MOD_enemy.numMerc = random(10, 60); V.MOD_enemyList.push(V.MOD_enemy); diff --git a/src/art/genAI/archivingAI.js b/src/art/genAI/archivingAI.js index 666d2b0da762abf667093d84561cd1f3d1eddb35..c5a258daeff0cb0e1dd06ac12950b208350b8cfa 100644 --- a/src/art/genAI/archivingAI.js +++ b/src/art/genAI/archivingAI.js @@ -73,7 +73,7 @@ App.Art.GenAI.Archiving = class Archiving { let imagesCount = V.PC.custom.aiImageIds.length; let manifest = {"PC": []}; - for (const s of V.slaves) { + for (const s of getSlaves()) { imagesCount += s.custom.aiImageIds.length; manifest[s.ID] = []; } @@ -85,7 +85,7 @@ App.Art.GenAI.Archiving = class Archiving { let zip = new JSZip(); manifest.PC = await Archiving.#exportImages(V.PC, zip, beforeAdding, afterAdding); - for (const s of V.slaves) { + for (const s of getSlaves()) { manifest[s.ID] = await Archiving.#exportImages(s, zip, beforeAdding, afterAdding); } @@ -214,7 +214,7 @@ App.Art.GenAI.Archiving = class Archiving { for (const [k, v] of Object.entries(manifest)) { let characterManifest = {}; characterManifest[k] = v; - let character = (k === "PC" ? V.PC : V.slaves[V.slaveIndices[k]]); + let character = (k === "PC" ? V.PC : getSlave(Number(k))); message.textContent = `Importing ${i}/${Object.keys(manifest).length}: ${character.slaveSurname} ${character.slaveName}`; await Archiving.#processCharacter(zip, character, characterManifest, updateProgress); i++; @@ -260,7 +260,7 @@ App.Art.GenAI.Archiving = class Archiving { * according to the given manifest. * * @param {JSZip} zip - * @param {FC.SlaveState} s + * @param {FC.HumanState} s * @param {object} manifest See exportImages() * @param {Function} callback Callback after each image * @returns {Promise<void>} @@ -272,7 +272,7 @@ App.Art.GenAI.Archiving = class Archiving { s = V.PC; } else if (!Object.keys(V.slaveIndices).includes(Object.keys(manifest)[0])) { throw new Error(`Character ID ${Object.keys(manifest)[0]} is not present in current game!`); - } else if (s.ID !== V.slaves[V.slaveIndices[Object.keys(manifest)[0]]].ID) { + } else if (s.ID !== getSlave(Number(Object.keys(manifest)[0])).ID) { throw new Error(`The loaded archive has not been made from the selected character!`); } diff --git a/src/art/genAI/reactiveImageDB.js b/src/art/genAI/reactiveImageDB.js index 7d0cd08a8e553c418d6403e5c9ab7631fb64718e..78763851bb003a98f6d30e297857608fbc572035 100644 --- a/src/art/genAI/reactiveImageDB.js +++ b/src/art/genAI/reactiveImageDB.js @@ -517,7 +517,7 @@ App.Art.GenAI.reactiveImageDB = (function() { * Regenerates images for all slaves */ async function regenAllImages() { - V.slaves.forEach((s) => getImage([s], {forceRegenerate: true})); + getSlaves().forEach((s) => getImage([s], {forceRegenerate: true})); } @@ -547,7 +547,7 @@ App.Art.GenAI.reactiveImageDB = (function() { /** * Flow control */ - /** Initalizes database */ + /** Initializes database */ init, /** Resolves promise when DB has been initalized */ waitForInit, diff --git a/src/art/genAI/stableDiffusion.js b/src/art/genAI/stableDiffusion.js index 24e219b2803c5e1703019bb8a124ad48259ef1e0..30e12053b1fc6d42a2a25caa0bed4934d2dc4ffb 100644 --- a/src/art/genAI/stableDiffusion.js +++ b/src/art/genAI/stableDiffusion.js @@ -976,8 +976,8 @@ App.Art.GenAI.StaticCaching = class { const imageData = getImageData(base64Image); const imagePreexisting = await compareExistingImages(slave, imageData); if (!isEventImage) { - let vSlave = globalThis.getSlave(slave.ID); - // if `slave` is owned but the variable has become detached from V.slaves, save the image changes to V.slaves instead + let vSlave = getSlave(slave.ID); + // if `slave` is owned but the variable has become detached from the main slave pool, save the image changes to the main slave pool instead // but don't do it for temporary images because they might be intentionally using a copy of a slave for temporary changes if (vSlave && slave !== vSlave) { slave = vSlave; @@ -1114,8 +1114,8 @@ App.Art.GenAI.ReactiveCaching = class { } const imageData = getImageData(base64Image); const imagePreexisting = await compareExistingImages(slave, imageData); - const vSlave = globalThis.getSlave(slave.ID); - // if `slave` is owned but the variable has become detached from V.slaves, save the image changes to V.slaves instead + const vSlave = getSlave(slave.ID); + // if `slave` is owned but the variable has become detached from the main slave pool, save the image changes to the main slave pool instead if (vSlave && slave !== vSlave) { slave = vSlave; } @@ -1144,7 +1144,7 @@ App.Art.GenAI.reactiveCache = new App.Art.GenAI.ReactiveCaching(); /** * Search slave's existing images for a match with the new image. - * @param {FC.SlaveState} slave - The slave we're updating + * @param {FC.HumanState} slave - The slave we're updating * @param {string} newImageData - new image * @returns {Promise<number>} index of the image in aiImageIds or -1 */ diff --git a/src/art/genAI/uiOptions.js b/src/art/genAI/uiOptions.js index b74438e764636d290e6bbffd6f5049eb1c28edde..28cfb5b32ef4ecb1a586c0a10e684bf74b1e0557 100644 --- a/src/art/genAI/uiOptions.js +++ b/src/art/genAI/uiOptions.js @@ -398,13 +398,13 @@ App.Art.GenAI.UI.Options.artOptions = (options) => { .addButton("Regenerate images for all slaves", () => { // queue all slaves for regeneration in the background if (V.aiCachingStrategy === 'static') { - V.slaves.forEach(s => App.Art.GenAI.staticCache.updateSlave(s) + getSlaves().forEach(s => App.Art.GenAI.staticCache.updateSlave(s) .catch(error => { console.log(error.message || error); })); } else { // reactive - V.slaves.forEach(s => App.Art.GenAI.reactiveCache.updateSlave(s) + getSlaves().forEach(s => App.Art.GenAI.reactiveCache.updateSlave(s) .catch(error => { console.log(error.message || error); })); diff --git a/src/cheats/cheatEditActor.js b/src/cheats/cheatEditActor.js index 88619d83183bc7c2c99fa45afde135084d97b087..02d9a1b4a77f6c072e9ba05dc58cad709e6f61dc 100644 --- a/src/cheats/cheatEditActor.js +++ b/src/cheats/cheatEditActor.js @@ -2157,7 +2157,7 @@ App.UI.Cheat.cheatEditActor = function(actor) { V.PC = player; } else if (realSlave) { normalizeRelationship(); - V.slaves[V.slaveIndices[actor.ID]] = slave; + overwriteSlave(actor.ID, slave); } else if (realTankSlave) { normalizeRelationship(); V.incubator.tanks[V.incubator.tankIndices[actor.ID]] = tankSlave; diff --git a/src/cheats/cheatEditSlave.js b/src/cheats/cheatEditSlave.js index c84be7dc39b182cbbdb614a52d6df310a1c2e299..da4ef0ac881ffb16b00765d0223cf3f3f718128f 100644 --- a/src/cheats/cheatEditSlave.js +++ b/src/cheats/cheatEditSlave.js @@ -60,9 +60,9 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link( "Apply cheat edits", () => { - App.Verify.slaveState("V.tempActor", asSlave(V.tempActor), "V.slaves"); + App.Verify.slaveState("V.tempActor", asSlave(V.tempActor), "main slave pool"); normalizeRelationship(); - V.slaves[V.slaveIndices[slave.ID]] = asSlave(V.tempActor); + overwriteSlave(slave.ID, asSlave(V.tempActor)); ibc.recalculate_coeff_id(slave.ID); delete V.tempActor; }, diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 4c88e0fd057f22b6a256c39e14b742de5498341b..b176d51e8221c5428c3df51ad9ae6d84c0bde29d 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -1445,12 +1445,12 @@ App.Update.globalVariables = function(node) { V.rival = V.rival || {}; V.rival.FS = V.rival.FS || {}; - if (V.slaves.find(s => s.origin.includes("You were acquainted with $him before you were an arcology owner") && s.newGamePlus === 0)) { + if (getSlaves().find(s => s.origin.includes("You were acquainted with $him before you were an arcology owner") && s.newGamePlus === 0)) { V.rival.hostageState = 2; V.hostage = 0; delete V.hostageWife; } - if (V.hostageAnnounced && !V.slaves.find(s => s.origin.includes("You were acquainted with $him before you were an arcology owner") && s.newGamePlus === 0)) { + if (V.hostageAnnounced && !getSlaves().find(s => s.origin.includes("You were acquainted with $him before you were an arcology owner") && s.newGamePlus === 0)) { V.rival.hostageState = 1; } V.rival.hostageState = V.rival.hostageState || 0; @@ -1484,7 +1484,7 @@ App.Update.globalVariables = function(node) { V.rival.state = 5; } if (V.releaseID < 1180) { - const rivalEnslaved = V.slaves.filter(s => s.newGamePlus === 0 && s.origin.includes("$He was once an arcology owner like yourself.")).length > 0; + const rivalEnslaved = getSlaves().filter(s => s.newGamePlus === 0 && s.origin.includes("$He was once an arcology owner like yourself.")).length > 0; if (V.rival.state === 1 && rivalEnslaved) { V.rival.state = 5; } else if (V.rival.state === 1 && !rivalEnslaved && V.arcologies.find(a => a.direction !== 0 && a.rival !== 1)) { @@ -2929,6 +2929,7 @@ App.Update.globalVariables = function(node) { * @param {Node} node */ App.Update.slaveIndices = function(node) { + if (!Array.isArray(V.slaves)) { return; } // future proofing; if we move to an object and this was somehow called it could be bad for (let bci = 0; bci < V.slaves.length; bci++) { if (typeof V.slaves[bci] !== "object") { V.slaves.deleteAt(bci); @@ -2967,7 +2968,7 @@ App.Update.slaveRecords = function(node) { App.Update.SlaveDatatypeCleanup(slave); }; - V.slaves.forEach((slave) => updateRecord(slave)); + getSlaves().forEach((slave) => updateRecord(slave)); for (const slave of detachedSlaves) { if (typeof slave !== "undefined" && slave !== 0) { updateRecord(slave); @@ -3025,7 +3026,7 @@ App.Update.slaveRecords = function(node) { } // fix anything that has to do with fetuses - V.slaves.concat([V.PC]).forEach(human => { + getSlaves().concat([V.PC]).forEach(human => { human.womb.forEach(fetus => { // variables releated to App.Events.PregnancyNotice fetus.noticeData = fetus.noticeData || {}; @@ -3043,7 +3044,7 @@ App.Update.slaveRecords = function(node) { }); // update clitoridal drugs - V.slaves.concat([V.PC]).forEach(s => { + getSlaves().concat([V.PC]).forEach(s => { if (s.drugs.includes("penis") && s.dick === 0 && s.vagina >= 0) { s.drugs = s.drugs.replace("penis", "clitoris"); } @@ -3091,7 +3092,6 @@ App.Update.logIssue = (primaryMessage, secondaryMessage=undefined, node=undefine * @param {Node} [node=undefined] * @returns {FC.HumanState} this should be assigned to the original variable, with the exception of hero slave templates * @example V.PC = App.Update.human(V.PC, "PC"); - * @example V.slaves[V.slaveIndices[slave.ID]] = App.Update.human(V.slaves[V.slaveIndices[slave.ID]], "normal"); */ App.Update.human = (actor, slaveType, node=undefined) => { let slaveLoc = (actor.ID === -1) ? "V.PC" : "Slave"; @@ -3223,7 +3223,7 @@ App.Update.humanRecords = (node) => { heroSlaves.forEach((slave) => App.Update.human(slave, "hero", node)); // normal slaves - V.slaves.forEach((slave) => V.slaves[V.slaveIndices[slave.ID]] = App.Update.human(slave, "normal", node)); + getSlaves().forEach((slave) => overwriteSlave(slave.ID, App.Update.human(slave, "normal", node))); // detached slaves V.hostage = (V.hostage) ? App.Update.human(V.hostage, "detached", node) : V.hostage; @@ -3277,8 +3277,8 @@ App.Update.genePoolRecords = function(node) { deduplication(slave); let dontDeleteMe = 0; - if (typeof V.slaveIndices[slave.ID] !== "undefined") { - /* are we still in the V.slaves array? */ + if (typeof getSlave(slave.ID) !== "undefined") { + /* are we still in the main slave pool? */ dontDeleteMe = 1; } if (V.traitor !== 0) { @@ -3299,8 +3299,9 @@ App.Update.genePoolRecords = function(node) { } if (dontDeleteMe === 0) { /* avoid going through this loop if possible */ - for (let bci2 = 0; bci2 < V.slaves.length; bci2++) { - if (isImpregnatedBy(V.slaves[bci2], slave, true)) { + const slaves = getSlaves(); + for (let bci2 = 0; bci2 < slaves.length; bci2++) { + if (isImpregnatedBy(slaves[bci2], slave, true)) { /* have we impregnated a slave on the slaves array? */ dontDeleteMe = 1; break; @@ -3393,7 +3394,7 @@ App.Update.genePoolRecords = function(node) { */ App.Update.RAassistantData = function(node) { const ruleIDs = V.defaultRules.map(rule => rule.ID); - const slaveIDs = V.slaves.map(slave => slave.ID); + const slaveIDs = getSlaves().map(slave => slave.ID); V.defaultRules = V.defaultRules.map(rule => App.Update.RARuleDatatypeCleanup(rule)); for (const ruleID of Object.keys(V.rulesToApplyOnce)) { @@ -3450,13 +3451,13 @@ App.Update.arcology = function(node) { * @deprecated Future BC should be handled in `/src/data/patches/patch.js` and `/src/data/verification/zVerify.js`. */ App.Update.oldVersions = function(node) { - V.slaves.filter(s => s.career === 0).forEach(s => s.career = "a slave"); - V.slaves.filter(s => s.origin === 0).forEach(s => s.origin = ""); + getSlaves().filter(s => s.career === 0).forEach(s => s.career = "a slave"); + getSlaves().filter(s => s.origin === 0).forEach(s => s.origin = ""); if (V.releaseID === 1021 || V.releaseID === 1020 || V.releaseID === 1019 || V.releaseID === 2022) { V.releaseID = 1022; } if (V.releaseID === 1043) { - V.slaves.forEach(s => { + getSlaves().forEach(s => { if (s.skill && s.skill.whore) { s.skill.whoring = s.skill.whore / 2; } @@ -4148,7 +4149,7 @@ App.Update.oldVersions = function(node) { } } if (V.releaseID < 1207) { - V.slaves.forEach(s => { + getSlaves().forEach(s => { if (s.geneMods.NCS === 1 || (s.geneticQuirks.neoteny >= 2 && s.geneticQuirks.progeria !== 2)) { s.ovaryAge = Math.max(s.ovaryAge, Math.min(s.physicalAge * 0.5, s.physicalAge - 2, 45)); } else { diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js index ae186d1ac4d419bb8d5ad250881a7d851fc47854..d07247ac764f353248d038291572a44978a50b59 100644 --- a/src/data/backwardsCompatibility/datatypeCleanup.js +++ b/src/data/backwardsCompatibility/datatypeCleanup.js @@ -2028,7 +2028,7 @@ App.Update.FacilityDatatypeCleanup = (function() { * @returns {number} ID of the first matched slave or 0 if no match was found */ function findSlaveId(predicate) { - const s = V.slaves.find(predicate); + const s = getSlaves().find(predicate); return s ? s.ID : 0; } diff --git a/src/data/newGamePlus.js b/src/data/newGamePlus.js index 2758d89cf81dda1657604eacdb765e3dda9478e8..29cd3ffe1ec2a39faea3f30c1137f77887a6fd35 100644 --- a/src/data/newGamePlus.js +++ b/src/data/newGamePlus.js @@ -59,7 +59,7 @@ App.Data.NewGamePlus = (function() { * @returns {Readonly<{[key: string]: Partial<FC.GenePoolRecord>}>} */ const ngUpdateGenePool = function(genePool = {}) { - const transferredSlaveIds = (V.slaves || []) + const transferredSlaveIds = (getSlaves() || []) .filter(s => s.ID >= NGPOffset) .map(s => s.ID - NGPOffset); /** @type {{[key: string]: Partial<FC.GenePoolRecord>}} */ @@ -84,7 +84,7 @@ App.Data.NewGamePlus = (function() { const newTable = {}; let needed = []; - (V.slaves || []) + (getSlaves() || []) .forEach(s => ([s.pregSource + NGPOffset, s.mother + NGPOffset, s.father + NGPOffset] .filter(i => (i in missingTable)) .forEach(i => { @@ -92,7 +92,7 @@ App.Data.NewGamePlus = (function() { needed.push(i); } }))); - (V.slaves || []).forEach(s => (s.womb + (getSlaves() || []).forEach(s => (s.womb .forEach(f => ([f.fatherID, f.genetics.father, f.genetics.mother] .filter(i => (i in missingTable)) .forEach(i => { @@ -131,7 +131,7 @@ App.Data.NewGamePlus = (function() { }; let oldMissingParentID = Math.min(-10000, ...Object.keys(V.missingTable)) - 1; - V.slaves.filter(s => (s.assignment !== Job.IMPORTED)).forEach(s => { + getSlaves().filter(s => (s.assignment !== Job.IMPORTED)).forEach(s => { V.missingTable[oldMissingParentID] = { slaveName: s.slaveName, slaveSurname: s.slaveSurname, @@ -151,7 +151,7 @@ App.Data.NewGamePlus = (function() { so.father = oldMissingParentID; } }); - [].concat(V.slaves).concat([V.PC]).forEach(so => { + [].concat(getSlaves()).concat([V.PC]).forEach(so => { if (so.mother === s.ID) { so.mother = oldMissingParentID; } @@ -165,9 +165,9 @@ App.Data.NewGamePlus = (function() { oldMissingParentID--; }); - V.slaves.deleteWith((s) => s.assignment !== Job.IMPORTED); + getSlaves().deleteWith((s) => s.assignment !== Job.IMPORTED); - for (let slave of V.slaves) { + for (let slave of getSlaves()) { slave.ID += NGPOffset; slave.assignment = Job.REST; if (V.freshPC === 1) { // check whether to reset weekAcquired same way we check whether to change father of fetus @@ -204,7 +204,7 @@ App.Data.NewGamePlus = (function() { slave.pregControl = "none"; } V.slaveIndices = slaves2indices(); - for (let slave of V.slaves) { + for (let slave of getSlaves()) { slave.pregSource = slaveOrZero(slave.pregSource); slave.cloneID = slaveOrZero(slave.cloneID); slave.relationshipTarget = slaveOrZero(slave.relationshipTarget); @@ -213,7 +213,7 @@ App.Data.NewGamePlus = (function() { V.genePool = ngUpdateGenePool(V.genePool); V.missingTable = ngUpdateMissingTable(V.missingTable); let validRelationship = (s) => (s.relationshipTarget !== 0 && getSlave(s.relationshipTarget).relationshipTarget === s.ID); - for (let slave of V.slaves) { + for (let slave of getSlaves()) { if ((slave.relationship < 0 && V.freshPC === 1) || (slave.relationship > 0 && !validRelationship(slave))) { slave.relationship = 0; slave.relationshipTarget = 0; diff --git a/src/data/patches/patch.js b/src/data/patches/patch.js index 3abc2d7c05925f0b6ac86e5d6a472e06a3214596..4a6a712a25f85d829ab9e3803654159a9d13ce2e 100644 --- a/src/data/patches/patch.js +++ b/src/data/patches/patch.js @@ -269,13 +269,14 @@ App.Patch.applyAll = () => { App.Patch.Utils.playerState("V.PC", V.PC, "V.PC", App.Patch.Utils.current.div, patchID); wombs.push({identifier: `V.PC`, actor: V.PC, div: App.Patch.Utils.current.div}); - // SlaveState - for (i in V.slaves ?? []) { - App.Patch.Utils.slaveState( - `V.slaves[${i}]`, V.slaves[i], "V.slaves", App.Patch.Utils.current.div, patchID - ); - wombs.push({identifier: `V.slaves[${i}]`, actor: V.slaves[i], div: App.Patch.Utils.current.div}); - } + // SlaveState + const slaves = getSlaves(); + for (i in slaves ?? []) { + App.Patch.Utils.slaveState( + `getSlaves()[${i}]`, slaves[i], "main slave pool", App.Patch.Utils.current.div, patchID + ); + wombs.push({identifier: `getSlaves()[${i}]`, actor: slaves[i], div: App.Patch.Utils.current.div}); + } if (V.hostage) { App.Patch.Utils.slaveState( diff --git a/src/data/patches/patchUtils.js b/src/data/patches/patchUtils.js index 3fefb1a596084e2f2b5f56746a9e6284a3ad583f..22e90b6b5a521d366d07939416b052f4d71e315c 100644 --- a/src/data/patches/patchUtils.js +++ b/src/data/patches/patchUtils.js @@ -349,7 +349,7 @@ App.Patch.Utils.current = { */ /** - * @typedef {"V.slaves"|"V.PC"|"V.hostage"|"V.boomerangSlave"|"V.traitor"|"V.shelterSlave"|"V.incubator.tanks"|"V.genePool"|"V.cribs"|"none"} App.Patch.Utils.HumanStateLocation + * @typedef {"main slave pool"|"V.PC"|"V.hostage"|"V.boomerangSlave"|"V.traitor"|"V.shelterSlave"|"V.incubator.tanks"|"V.genePool"|"V.cribs"|"none"} App.Patch.Utils.HumanStateLocation */ /** diff --git a/src/data/verification/verifyFetus.js b/src/data/verification/verifyFetus.js index a2ce680f42551db9fed2ab9bf990854b4252a4bf..24377e0f589ef10209e54379324d3668769aa70a 100644 --- a/src/data/verification/verifyFetus.js +++ b/src/data/verification/verifyFetus.js @@ -7,10 +7,11 @@ App.Verify.fetuses = (div) => { let i; let f; - for (i in V.slaves) { - if (V.slaves[i].womb && Array.isArray(V.slaves[i].womb)) { - for (f in V.slaves[i].womb) { - App.Verify.fetus(`V.slaves[${i}].womb[${f}]`, V.slaves[i].womb[f], V.slaves[i], div); + const slaves = getSlaves(); + for (i in slaves) { + if (slaves[i].womb && Array.isArray(slaves[i].womb)) { + for (f in slaves[i].womb) { + App.Verify.fetus(`getSlaves()[${i}].womb[${f}]`, slaves[i].womb[f], slaves[i], div); } } } diff --git a/src/data/verification/verifyGameVariables.js b/src/data/verification/verifyGameVariables.js index 551298f816b5dc5c8ee10da043d063115758903d..59a02d133d09d6db6de422f51ebdb7c646af35a1 100644 --- a/src/data/verification/verifyGameVariables.js +++ b/src/data/verification/verifyGameVariables.js @@ -23,7 +23,7 @@ App.Verify.gameVariables = (div) => { * @type {App.Verify.Utils.FunctionGameVariables} */ App.Verify.I.genePool = () => { - const AllHumanIDs = getAllHumans().map((s) => s.ID); + const AllHumanIDs = getHumanStates().map((s) => s.ID); // remove all unneeded records from the genePool for (const [key, record] of Object.entries(_.cloneDeep(V.genePool))) { if (key === "-1" || AllHumanIDs.includes(Number(key))) { continue; } @@ -70,7 +70,7 @@ App.Verify.I.genePool = () => { }); // add any missing records to the genePool - getAllHumans().forEach((human) => { + getHumanStates().forEach((human) => { if (!isInGenePool(human)) { addToGenePool(human); } diff --git a/src/data/verification/verifySlaveState.js b/src/data/verification/verifySlaveState.js index 240d1b8f2a995d88494a72d7b5223833a060dffb..4ac8c2e8a9c68ac4b6bc48f6178797c460ddb5fa 100644 --- a/src/data/verification/verifySlaveState.js +++ b/src/data/verification/verifySlaveState.js @@ -7,8 +7,9 @@ */ App.Verify.slaveStates = (div) => { let i; - for (i in V.slaves) { - App.Verify.slaveState(`V.slaves[${i}]`, V.slaves[i], "V.slaves", div); + const slaves = getSlaves(); + for (i in slaves) { + App.Verify.slaveState(`getSlaves()[${i}]`, slaves[i], "main slave pool", div); } if (V.hostage) { App.Verify.slaveState("V.hostage", V.hostage, "V.hostage", div); diff --git a/src/data/verification/verifyUtils.js b/src/data/verification/verifyUtils.js index c0d867715224a77d410ddc7ebb7562902bc12fdc..be0b47d88ebd45ea3ff60c82ec759e132735a42e 100644 --- a/src/data/verification/verifyUtils.js +++ b/src/data/verification/verifyUtils.js @@ -4,7 +4,7 @@ * @returns {number} ID of the first matched slave or 0 if no match was found */ App.Verify.Utils.findSlaveId = (predicate) => { - const s = V.slaves.find(predicate); + const s = getSlaves().find(predicate); return s ? s.ID : 0; }; diff --git a/src/debugging/debugJS.js b/src/debugging/debugJS.js index aba847a385a179199499466caf9c9eed87aec37f..dfc06f842474aa8ce3d00709fc034e3531fe9b21 100644 --- a/src/debugging/debugJS.js +++ b/src/debugging/debugJS.js @@ -120,6 +120,6 @@ App.Debug.dumpGameState = function() { App.Debug.slaveSummaryText = function(idx) { let span = document.createElement("span"); - span.appendChild(App.UI.SlaveSummary.render(V.slaves[idx])); + span.appendChild(App.UI.SlaveSummary.render(getSlaves()[idx])); return span.outerHTML; }; diff --git a/src/descriptions/arcologyDescription.js b/src/descriptions/arcologyDescription.js index 8c78e751bd5f696cc9b5bf372c9926113aa5b904..529fe2853987a8a51419ab6de77f21f97700a183 100644 --- a/src/descriptions/arcologyDescription.js +++ b/src/descriptions/arcologyDescription.js @@ -962,7 +962,7 @@ App.Desc.playerArcology = function(lastElement) { return buffer.join(" "); } - const citizenCount = `${num(V.ACitizens)} citizens and ${num(V.ASlaves + V.slaves.length)} slaves live in ${A.name}.`; + const citizenCount = `${num(V.ACitizens)} citizens and ${num(V.ASlaves + getSlaves().length)} slaves live in ${A.name}.`; function fsLaws() { let buffer = []; diff --git a/src/descriptions/familySummaries.js b/src/descriptions/familySummaries.js index b75e03cf9338cc5076b5a32f72876f91a0f331b6..6b523495ee6544b152d8d48ab2217dc8f800a418 100644 --- a/src/descriptions/familySummaries.js +++ b/src/descriptions/familySummaries.js @@ -126,7 +126,7 @@ App.Desc.family = (function() { r.push(`${He} was `, familySpan(`born from `, knownSlave(slave.mother, allowLinks), `'s`), ` fertile womb.`); } - let children = V.slaves.filter((s) => slave.ID === s.father && slave.ID === s.mother); + let children = getSlaves().filter((s) => slave.ID === s.father && slave.ID === s.mother); const isSoleParent = children.length > 0; if (children.length > 2) { r.push(He, familySpan(`is the sole parent of `, slaveListToText(children, allowLinks), `.`)); @@ -136,7 +136,7 @@ App.Desc.family = (function() { r.push(He, familySpan(`is the sole parent of a single slave of yours: `, slaveListToText(children, allowLinks), `.`)); } - children = V.slaves.filter((s) => slave.ID === s.father && slave.ID !== s.mother); + children = getSlaves().filter((s) => slave.ID === s.father && slave.ID !== s.mother); if (children.length > 2) { r.push(He, familySpan(`fathered `, slaveListToText(children, allowLinks), `${isSoleParent ? " with other mothers" : ""}.`)); } else if (children.length > 1) { @@ -145,7 +145,7 @@ App.Desc.family = (function() { r.push(He, familySpan(`fathered a single slave of yours${isSoleParent ? " with another mother" : ""}: `, slaveListToText(children, allowLinks), `.`)); } - children = V.slaves.filter((s) => slave.ID === s.mother && slave.ID !== s.father); + children = getSlaves().filter((s) => slave.ID === s.mother && slave.ID !== s.father); if (children.length > 2) { r.push(He, familySpan(`gave birth to `, slaveListToText(children, allowLinks), `${isSoleParent ? " with other fathers" : ""}.`)); } else if (children.length > 1) { @@ -313,7 +313,7 @@ App.Desc.family = (function() { } /* grandchild - determines how many grandchildren the current slave has */ - children = V.slaves.filter((s) => isGrandparentP(s, slave)); + children = getSlaves().filter((s) => isGrandparentP(s, slave)); if (children.length > 0) { r.push(`${He} has`); if (children.length > 2) { @@ -327,7 +327,7 @@ App.Desc.family = (function() { /* PC aunt and uncle - determines how many aunts and uncles you have */ if (isAunt(V.PC, slave)) { - const {m: uncles, f: aunts} = splitBySex(V.slaves.filter((s) => s.ID !== slave.ID && isAunt(V.PC, s))); + const {m: uncles, f: aunts} = splitBySex(getSlaves().filter((s) => s.ID !== slave.ID && isAunt(V.PC, s))); r.push(`${He} is`); if (slave.genes === "XX") { @@ -346,7 +346,7 @@ App.Desc.family = (function() { } /* aunt and uncle - determines how many aunts and uncles a slave has*/ - const {m: uncles, f: aunts} = splitBySex(V.slaves.filter((s) => isAunt(slave, s))); + const {m: uncles, f: aunts} = splitBySex(getSlaves().filter((s) => isAunt(slave, s))); if (aunts.length > 0) { r.push(`${He} has`); @@ -372,7 +372,7 @@ App.Desc.family = (function() { /* PC niece and nephew - determines how many nieces and nephews you have*/ if (isAunt(slave, V.PC)) { const {m: nephews, f: nieces} = - splitBySex(V.slaves.filter((s) => s.ID !== slave.ID && isAunt(s, V.PC))); + splitBySex(getSlaves().filter((s) => s.ID !== slave.ID && isAunt(s, V.PC))); r.push(`${He} is`); if (slave.genes === "XX") { @@ -391,7 +391,7 @@ App.Desc.family = (function() { } /* niece and nephew - determines how many nieces and nephews a slave has*/ - const {m: nephews, f: nieces} = splitBySex(V.slaves.filter((s) => isAunt(s, slave))); + const {m: nephews, f: nieces} = splitBySex(getSlaves().filter((s) => isAunt(s, slave))); if (nieces.length > 0) { r.push(`${He} has`); @@ -422,7 +422,7 @@ App.Desc.family = (function() { let halfBrothers = []; let cousins = []; - for (const s of V.slaves) { + for (const s of getSlaves()) { let sisterCheck = areSisters(s, slave); if (sisterCheck === 1) { twins.push(s); @@ -552,7 +552,7 @@ App.Desc.family = (function() { if (V.showDistantRelatives) { /* PC cousin - determines how many cousins you have*/ if (areCousins(slave, V.PC)) { - const PCcousins = V.slaves.filter((s) => s.ID !== slave.ID && areCousins(V.PC, s)); + const PCcousins = getSlaves().filter((s) => s.ID !== slave.ID && areCousins(V.PC, s)); r.push(`${He} is`); if (PCcousins.length > 0) { r.push(familySpan(`your cousin along with `, slaveListToText(PCcousins, allowLinks), `.`)); @@ -620,7 +620,7 @@ App.Desc.family = (function() { parents.push(V.missingTable[V.PC.father]); } } - parents = parents.concat(V.slaves.filter((s) => isParentP(V.PC, s))); + parents = parents.concat(getSlaves().filter((s) => isParentP(V.PC, s))); if (parents.length > 1) { r.push(`<br>Your parents are `, familySpan(knownSlave(parents[0].ID, allowLinks), ` and `, knownSlave(parents[1].ID, allowLinks), `.`)); @@ -636,7 +636,7 @@ App.Desc.family = (function() { /* Player aunts and uncles */ if (V.showDistantRelatives) { - const {m: uncles, f: aunts} = splitBySex(V.slaves.filter((s) => isAunt(V.PC, s))); + const {m: uncles, f: aunts} = splitBySex(getSlaves().filter((s) => isAunt(V.PC, s))); if (aunts.length > 0) { r.push(`<br>You have`); @@ -667,7 +667,7 @@ App.Desc.family = (function() { let halfBrothers = []; let cousins = []; - for (const s of V.slaves) { + for (const s of getSlaves()) { let sisterCheck = areSisters(s, V.PC); if (sisterCheck === 1) { twins.push(s); @@ -729,7 +729,7 @@ App.Desc.family = (function() { /* Player nieces and nephews */ if (V.showDistantRelatives) { - const {m: nephews, f: nieces} = splitBySex(V.slaves.filter((s) => isAunt(s, V.PC))); + const {m: nephews, f: nieces} = splitBySex(getSlaves().filter((s) => isAunt(s, V.PC))); if (nieces.length > 0) { r.push(`<br>You have`); @@ -754,27 +754,27 @@ App.Desc.family = (function() { } /* Player is sole parent */ - let children = V.slaves.filter((s) => s.father === V.PC.ID && s.mother === V.PC.ID); + let children = getSlaves().filter((s) => s.father === V.PC.ID && s.mother === V.PC.ID); if (children.length > 0) { r.push(`<br>You are the sole parent of ${num(children.length)} of your slaves, `, familySpan(slaveListToText(children, allowLinks), `.`)); } const isSoleParent = children.length > 0; /* Player is Father, lists children you fathered */ - children = V.slaves.filter((s) => s.father === V.PC.ID && s.mother !== V.PC.ID); + children = getSlaves().filter((s) => s.father === V.PC.ID && s.mother !== V.PC.ID); if (children.length > 0) { r.push(`<br>You fathered ${num(children.length)} of your slaves${isSoleParent ? " with other mothers" : ''}, `, familySpan(slaveListToText(children, allowLinks), `.`)); } /* Player is Mother, lists birthed children */ - children = V.slaves.filter((s) => s.mother === V.PC.ID && s.father !== V.PC.ID); + children = getSlaves().filter((s) => s.mother === V.PC.ID && s.father !== V.PC.ID); if (children.length > 0) { r.push(`<br>You gave birth to ${num(children.length)} of your slaves${isSoleParent ? " who had other fathers" : ''}, `, familySpan(slaveListToText(children, allowLinks), `.`)); } /* Player is grandparent */ if (V.showDistantRelatives) { - children = V.slaves.filter((s) => isGrandparentP(s, V.PC)); + children = getSlaves().filter((s) => isGrandparentP(s, V.PC)); if (children.length > 0) { r.push(`<br>You have ${num(children.length)} grandchildren as your slaves, `, familySpan(slaveListToText(children, allowLinks), `.`)); } diff --git a/src/descriptions/officeDescription.js b/src/descriptions/officeDescription.js index cab86ea0efe694e7b70c5e40f41e75738ce9be2c..1a11a807303621355c34704acab41f1dd9d2e449 100644 --- a/src/descriptions/officeDescription.js +++ b/src/descriptions/officeDescription.js @@ -60,7 +60,7 @@ App.Desc.officeDescription = function(lastElement) { r.push(`A corner of your desk`); } r.push(`is piled with sample merchandise from the campaign promoting your club.`); - const clubSlaves = V.slaves.filter(s => s.assignment === Job.CLUB); + const clubSlaves = getSlaves().filter(s => s.assignment === Job.CLUB); if (clubSlaves.length > 0) { const modeledSlave = clubSlaves.random(); const {He, his} = getPronouns(modeledSlave); @@ -198,7 +198,7 @@ App.Desc.officeDescription = function(lastElement) { } r.push(`is piled with sample merchandise from the campaign promoting ${V.brothelName}.`); } - const brothelSlaves = V.slaves.filter(s => s.assignment === Job.BROTHEL); + const brothelSlaves = getSlaves().filter(s => s.assignment === Job.BROTHEL); if (brothelSlaves.length > 0) { const modeledSlave = brothelSlaves.random(); const {he, his} = getPronouns(modeledSlave); @@ -294,13 +294,14 @@ App.Desc.officeDescription = function(lastElement) { const r = []; r.push("Next to your desk is a sturdy black leather couch. All the walls on this floor are glass, so you can see your"); - if (V.slaves.length > 50) { + const slavesLength = getSlaves().length; + if (slavesLength > 50) { r.push(`innumerable`); - } else if (V.slaves.length > 20) { + } else if (slavesLength > 20) { r.push(`many`); - } else if (V.slaves.length > 10) { + } else if (slavesLength > 10) { r.push(`numerous`); - } else if (V.slaves.length > 5) { + } else if (slavesLength > 5) { r.push(`handful of`); } else { r.push(`few`); diff --git a/src/endWeek/economics/reputation.js b/src/endWeek/economics/reputation.js index 7aa9041acbf85e44d19cebc79ecc9815485b31ba..eab84baaf942dfe416d0e75ec7a4a63eaad25d04 100644 --- a/src/endWeek/economics/reputation.js +++ b/src/endWeek/economics/reputation.js @@ -14,10 +14,10 @@ App.EndWeek.reputation = function() { if (V.arcologies[0].FSChattelReligionistCreed === 1) { r.push(`${V.arcologies[0].name} keeps the creed of the ${V.nicaea.name}. The faithful`); if (V.nicaea.achievement === "slaves") { - if (V.slaves.length > 50) { + if (getSlaves().length > 50) { r.push(`<span class="green">strongly approve</span> of the large`); FutureSocieties.Change("Chattel Religionist", 5); - } else if (V.slaves.length > 20) { + } else if (getSlaves().length > 20) { r.push(`<span class="green">approve</span> of the good`); FutureSocieties.Change("Chattel Religionist", 2); } else { @@ -720,7 +720,7 @@ App.EndWeek.reputation = function() { r.push(`Society <span class="green">approves</span> of how you are providing for the defense of the state, as should all citizens of the new Rome.`); FutureSocieties.Change("Roman Revivalist", V.mercenaries); } - if (V.slaves.length > 20 && V.cash > 50000) { + if (getSlaves().length > 20 && V.cash > 50000) { r.push(`Society <span class="green">strongly approves</span> of your wealth and prosperity, fit goals for the`); if (V.PC.customTitle) { r.push(`${V.PC.customTitle}`); @@ -766,7 +766,7 @@ App.EndWeek.reputation = function() { r.push(`Society <span class="green">approves</span> of your strong militarism and elite mercenaries, as your tradition of Imperial conquest glorifies military success above all else.`); FutureSocieties.Change("Neo-Imperialist", V.mercenaries); } - if (V.slaves.length > 20 && V.cash > 50000) { + if (getSlaves().length > 20 && V.cash > 50000) { r.push(`Society <span class="green">strongly approves</span> of your great wealth and prosperity, as is only fitting for an`); if (V.PC.customTitle) { r.push(`${V.PC.customTitle}.`); @@ -792,7 +792,7 @@ App.EndWeek.reputation = function() { FutureSocieties.Change("Neo-Imperialist", 2); } } else if (FutureSocieties.isActive('FSEgyptianRevivalist')) { - const racialVarieties = new Set(V.slaves.map((s) => s.race)); + const racialVarieties = new Set(getSlaves().map((s) => s.race)); if (racialVarieties.size > 4) { r.push(`Society <span class="green">strongly approves</span> of how you own a cornucopia of different races, which advances the ancient Egyptian ideal of cosmopolitan sex slavery.`); FutureSocieties.Change("Egyptian Revivalist", 5); @@ -803,7 +803,7 @@ App.EndWeek.reputation = function() { } } else if (FutureSocieties.isActive('FSEdoRevivalist')) { const threshold = Math.trunc(V.rep / 2000); - if (V.slaves.filter(s => [Job.CLUB, Job.DJ, Job.PUBLIC].includes(s.assignment) || (s.assignment === Job.RECRUITER && V.recruiterTarget === "other arcologies" && V.arcologies[0].influenceTarget !== -1)).length <= threshold) { + if (getSlaves().filter(s => [Job.CLUB, Job.DJ, Job.PUBLIC].includes(s.assignment) || (s.assignment === Job.RECRUITER && V.recruiterTarget === "other arcologies" && V.arcologies[0].influenceTarget !== -1)).length <= threshold) { r.push(`Society <span class="red">disapproves</span> of your failure to provide for cultural development by offering public servants or club slaves in a number that befits your reputation.`); FutureSocieties.Change("Edo Revivalist", -2); } else { @@ -876,22 +876,23 @@ App.EndWeek.reputation = function() { } // 200 is probably a bit ridiculous side, but might as well give a fun little reward for it - if (V.slaves.length >= 200) { + const slavesLength = getSlaves().length; + if (slavesLength >= 200) { r.push(`Society is in <span class="green">awe</span> with the sheer size of your stable of slaves.`); FutureSocieties.Change("Antebellum Revivalist", 25); - } else if (V.slaves.length >= 100) { + } else if (slavesLength >= 100) { r.push(`Society is <span class="green">impressed</span> with the number of slaves you own.`); FutureSocieties.Change("Antebellum Revivalist", 10); - } else if (V.slaves.length >= 50) { + } else if (slavesLength >= 50) { r.push(`Society holds <span class="green">great respect</span> for the number of slaves you own.`); FutureSocieties.Change("Antebellum Revivalist", 5); - } else if (V.slaves.length >= 25) { + } else if (slavesLength >= 25) { r.push(`Society <span class="green">approves</span> of the number of slaves you own.`); FutureSocieties.Change("Antebellum Revivalist", 3); - } else if (V.slaves.length >= 10) { + } else if (slavesLength >= 10) { r.push(`Society <span class="green">slightly approves</span> of the number of slaves you own.`); FutureSocieties.Change("Antebellum Revivalist", 1); - } else if (V.slaves.length >= 5) { + } else if (slavesLength >= 5) { r.push(`Society neither approves or disapproves of the size of your stable of slaves, but would respectively approve or disapprove if it grew or shrank.`); } else { r.push(`Society finds it <span class="green">strange</span> for someone of your stature to own so few slaves.`); diff --git a/src/endWeek/endWeek.js b/src/endWeek/endWeek.js index 51977908dbd2eb8455f976f3c414e1c9a7c71a1e..02ce128478c22a0345beda910eeef4efde031aee 100644 --- a/src/endWeek/endWeek.js +++ b/src/endWeek/endWeek.js @@ -9,7 +9,7 @@ globalThis.endWeek = (function() { // globals setup resetSlaveMarkets(); - for (const s of V.slaves) { + for (const s of getSlaves()) { slavePrep(s); } setUseWeights(); @@ -309,7 +309,7 @@ globalThis.endWeek = (function() { } function advance() { - if (V.slaves.length < 1) { + if (getSlaves().length < 1) { V.gameover = "no slaves"; Engine.play("Gameover"); } else if (V.arcologies[0].ownership < V.arcologies[0].minority) { diff --git a/src/endWeek/endWeekAnim.js b/src/endWeek/endWeekAnim.js index e331ef0ed53780009c6cef187fd4675fe6cd5d7d..1829252902c537f8e3b627acc77b49c7ff34d81d 100644 --- a/src/endWeek/endWeekAnim.js +++ b/src/endWeek/endWeekAnim.js @@ -6,7 +6,7 @@ App.UI.EndWeekAnim = (function() { infoDiv = $(` <div class="endweek-titleblock"> <div class="endweek-maintitle">Processing week ${V.week}...</div> - <div class="endweek-subtitle">${V.arcologies[0].name} | ${V.slaves.length} slaves</div> + <div class="endweek-subtitle">${V.arcologies[0].name} | ${getSlaves().length} slaves</div> </div> `); } diff --git a/src/endWeek/events/expire.js b/src/endWeek/events/expire.js index 193856b04974b9b516a33e73bc6763b285dcb3a3..e227008808f866408a9063321827f3cd6b733127 100644 --- a/src/endWeek/events/expire.js +++ b/src/endWeek/events/expire.js @@ -5,7 +5,7 @@ App.Events.SEExpiration = class SEExpiration extends App.Events.BaseEvent { /** Custom casting: all expiring slaves are cast automatically. If no slaves are cast, casting fails and the event does not run. */ castActors() { - this.actors = V.slaves.filter(s => s.indenture === 0).map(s => s.ID); + this.actors = getSlaves().filter(s => s.indenture === 0).map(s => s.ID); return this.actors.length > 0; } @@ -60,7 +60,7 @@ App.Events.SEExpiration = class SEExpiration extends App.Events.BaseEvent { V.lowerClass++; let seed = 0; - for (const seeXp of V.slaves.filter(s => s.devotion <= 20)) { + for (const seeXp of getSlaves().filter(s => s.devotion <= 20)) { seed = 1; seeXp.devotion--; } diff --git a/src/endWeek/events/retire.js b/src/endWeek/events/retire.js index c1bab25e017a6335c3d1067b0d03223ec6855671..c28677675bb312314221be051bafc602d22749f6 100644 --- a/src/endWeek/events/retire.js +++ b/src/endWeek/events/retire.js @@ -5,7 +5,7 @@ App.Events.SERetire = class SERetire extends App.Events.BaseEvent { /** Custom casting: all slaves ready for retirement are cast automatically. if no slaves are cast, casting fails and the event does not run. */ castActors() { - this.actors = V.slaves.filter(s => retirementReady(s)).map(s => s.ID); + this.actors = getSlaves().filter(s => retirementReady(s)).map(s => s.ID); return this.actors.length > 0; } @@ -68,7 +68,7 @@ App.Events.retire = function(originalSlave, artRenderer) { if (V.policies.retirement.fate === "citizen") { r.push(`in a way that will fill the rest of your property with envy and <span class="mediumaquamarine">trust.</span>`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust += 3; } if (lover) { @@ -326,7 +326,7 @@ App.Events.retire = function(originalSlave, artRenderer) { } } else if (V.policies.retirement.fate === "bioreactor") { r.push(`in a way that will inevitably fill the rest of your property with <span class="gold">fear.</span>`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust -= 3; } @@ -375,7 +375,7 @@ App.Events.retire = function(originalSlave, artRenderer) { V.menialBioreactors += 1; } else if (V.policies.retirement.fate === "arcade") { r.push(`in a way that will inevitably fill the rest of your property with <span class="gold">fear.</span>`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust -= 3; } diff --git a/src/endWeek/healthFunctions.js b/src/endWeek/healthFunctions.js index c8dd4cfbe10fc463c57cd9ec95b84afa70729df4..9b642482f03ee57a933d36f188983d72cb25efed 100644 --- a/src/endWeek/healthFunctions.js +++ b/src/endWeek/healthFunctions.js @@ -298,7 +298,7 @@ globalThis.nurseEffectiveness = function(slave) { const clinicScreening = V.clinicRegularCheckups || 0; if (S.Nurse) { const nurseSkill = App.Data.Careers.Leader.nurse.includes(S.Nurse.career) ? 200 : S.Nurse.skill.nurse; - let nurseEffectiveness = Math.trunc((nurseSkill * clinicUpgrade / Math.max((App.Entity.facilities.clinic.employeesIDs().size * 10 + (V.slaves.length * 2) * clinicScreening), 1)) * 20); + let nurseEffectiveness = Math.trunc((nurseSkill * clinicUpgrade / Math.max((App.Entity.facilities.clinic.employeesIDs().size * 10 + (getSlaves().length * 2) * clinicScreening), 1)) * 20); if (H.illness > 1 && slave.assignment === Job.CLINIC) { if (nurseEffectiveness < 20) { return nurseEffectiveness; diff --git a/src/endWeek/nextWeek/nextWeek.js b/src/endWeek/nextWeek/nextWeek.js index 2aa0ee7e961ec8e36aacbcc15d71b450a4736af9..3b596471e3e03778b0b20f6cc45f0dd5fc3dbb17 100644 --- a/src/endWeek/nextWeek/nextWeek.js +++ b/src/endWeek/nextWeek/nextWeek.js @@ -8,7 +8,7 @@ App.EndWeek.nextWeek = function() { if (rival && V.rival.prosperity !== 0) { V.rival.prosperity = rival.prosperity; } else if (!rival) { - if (V.slaves.filter(s => s.newGamePlus === 0 && s.origin.includes("$He was once an arcology owner like yourself.")).length > 0) { + if (getSlaves().filter(s => s.newGamePlus === 0 && s.origin.includes("$He was once an arcology owner like yourself.")).length > 0) { V.rival.state = 5; } else if (V.plot > 0 && V.rival.prosperity > 0) { if (V.arcologies.length > 1) { @@ -175,7 +175,7 @@ App.EndWeek.nextWeek = function() { V.pornStars[genre.fameVar].p1count = 0; } } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { ageSlaveWeeks(slave); if (slave.indenture > 0) { slave.indenture -= 1; @@ -454,7 +454,7 @@ App.EndWeek.nextWeek = function() { while (isTemporaryImage()) { await sleep(); } - V.slaves.forEach(s => { + getSlaves().forEach(s => { if ((V.week - s.weekAcquired) % V.aiAutoGenFrequency === 0 && !s.custom.aiAutoRegenExclude){ App.Art.GenAI.staticCache.updateSlave(s, null, false) .catch(error => { diff --git a/src/endWeek/player/prHealth.js b/src/endWeek/player/prHealth.js index 909628ed8e9d10ab45788f91e6dd902124f8c08f..efd12cd48eb771d38d0cea343c8254688ecebf35 100644 --- a/src/endWeek/player/prHealth.js +++ b/src/endWeek/player/prHealth.js @@ -203,9 +203,9 @@ App.EndWeek.Player.health = function(PC = V.PC) { * then personal attention targets, * and lastly, anything in the penthouse. */ - const sexPartners = V.slaves.filter(s => App.Utils.sexAllowed(PC, s) && isSlaveAvailable(s)); - const fucktoys = V.slaves.filter(s => [Job.FUCKTOY, Job.MASTERSUITE, Job.CONCUBINE].includes(s.assignment)); - const wives = V.slaves.filter(s => s.relationship === -3); + const sexPartners = getSlaves().filter(s => App.Utils.sexAllowed(PC, s) && isSlaveAvailable(s)); + const fucktoys = getSlaves().filter(s => [Job.FUCKTOY, Job.MASTERSUITE, Job.CONCUBINE].includes(s.assignment)); + const wives = getSlaves().filter(s => s.relationship === -3); if (PCH.illness === 0 && wives.length > 0) { for (const other of wives.filter(s => s.health.illness > 1)) { if (catchesIllness(20)) { diff --git a/src/endWeek/player/prLongTermPhysicalEffects.js b/src/endWeek/player/prLongTermPhysicalEffects.js index f842e9754c3a19fa687036df1d291a9991f61902..c0b9bc691bef13f000ed4e682eddb44001a28a64 100644 --- a/src/endWeek/player/prLongTermPhysicalEffects.js +++ b/src/endWeek/player/prLongTermPhysicalEffects.js @@ -8,7 +8,7 @@ App.EndWeek.Player.longTermPhysicalEffects = function(PC = V.PC) { const boobSize = App.Medicine.fleshSize(PC, 'boobs'); const buttSize = App.Medicine.fleshSize(PC, 'butt'); const faceValue = PC.face - PC.faceImplant; - const averageDicking = V.slaves.filter(s => canAchieveErection(s) && isSlaveAvailable(s) && ((V.policies.sexualOpenness === 1 && s.devotion > 20 && App.Utils.sexAllowed(V.PC, s)) || s.toyHole === ToyHole.DICK)); + const averageDicking = getSlaves().filter(s => canAchieveErection(s) && isSlaveAvailable(s) && ((V.policies.sexualOpenness === 1 && s.devotion > 20 && App.Utils.sexAllowed(V.PC, s)) || s.toyHole === ToyHole.DICK)); const isNull = PC.dick === 0 && PC.vagina === -1; teeth(); @@ -305,7 +305,7 @@ App.EndWeek.Player.longTermPhysicalEffects = function(PC = V.PC) { } function sexualSatisfaction() { - const sexPartners = V.slaves.filter(s => App.Utils.sexAllowed(V.PC, s) && isSlaveAvailable(s) && s.assignment !== Job.FUCKTOY).shuffle(); + const sexPartners = getSlaves().filter(s => App.Utils.sexAllowed(V.PC, s) && isSlaveAvailable(s) && s.assignment !== Job.FUCKTOY).shuffle(); const wives = sexPartners.filter(s => s.relationship === -3); if (V.debugMode) { r.push(`Need: ${PC.need}.`); @@ -402,7 +402,7 @@ App.EndWeek.Player.longTermPhysicalEffects = function(PC = V.PC) { } PC.lusty = 0; // Needs more holes to fuck, or more dedicated fucktoys. - const fuckpitSlaves = V.slaves.filter(s => s.assignment === Job.MASTERSUITE || s.assignment === Job.CONCUBINE || (s.assignment === Job.FUCKTOY && (canWalk(s) || (canMove(s) && s.rules.mobility === "permissive"))) && s.rules.release.master !== 0); + const fuckpitSlaves = getSlaves().filter(s => s.assignment === Job.MASTERSUITE || s.assignment === Job.CONCUBINE || (s.assignment === Job.FUCKTOY && (canWalk(s) || (canMove(s) && s.rules.mobility === "permissive"))) && s.rules.release.master !== 0); if (V.masterSuiteUpgradeLuxury === 2 && fuckpitSlaves.length > 1 && !isPlayerFrigid()) { let fuckpitSex = Math.ceil(V.PC.energy / 2); r.push(`Whenever you feel the urge for sexual release building and have the time to slip away, you head back to ${V.masterSuiteName} to slide into the fuckpit orgy to sate your lust.`); diff --git a/src/endWeek/player/prPregnancy.js b/src/endWeek/player/prPregnancy.js index a02026bf19916b5e5f7079b7a4c703017ddae116..f8e0b6e511f74052949a2c27d7302a1f5a3b2055 100644 --- a/src/endWeek/player/prPregnancy.js +++ b/src/endWeek/player/prPregnancy.js @@ -515,9 +515,9 @@ App.EndWeek.Player.pregnancy = function(PC = V.PC) { let eligibleSlaves; if (V.policies.sexualOpenness === 1) { - eligibleSlaves = V.slaves.filter(s => canImpreg(V.PC, s) && App.Utils.sexAllowed(V.PC, s) && isSlaveAvailable(s) && canAchieveErection(s) && s.devotion > 20 && raceIsAcceptable); + eligibleSlaves = getSlaves().filter(s => canImpreg(V.PC, s) && App.Utils.sexAllowed(V.PC, s) && isSlaveAvailable(s) && canAchieveErection(s) && s.devotion > 20 && raceIsAcceptable); } else { - eligibleSlaves = V.slaves.filter(s => canImpreg(V.PC, s) && isSlaveAvailable(s) && s.toyHole === ToyHole.DICK); + eligibleSlaves = getSlaves().filter(s => canImpreg(V.PC, s) && isSlaveAvailable(s) && s.toyHole === ToyHole.DICK); } const dadHash = eligibleSlaves.reduce((acc, cur, i) => Object.assign(acc, {[i]: score(cur)}), {}); const chosenDadIndex = hashChoice(dadHash); @@ -527,7 +527,7 @@ App.EndWeek.Player.pregnancy = function(PC = V.PC) { } if (canGetPregnant(PC) && !onBedRest(PC, true) && !isPCCareerInCategory("servant")) { // Sperm mod leavings around the penthouse. Gives servants more of a point too. - let slobs = V.slaves.filter(s => isSlaveAvailable(s) && s.geneMods.aggressiveSperm === 1 && (s.fetish === Fetish.MINDBROKEN || s.energy > 95 || (s.devotion < -20 && s.trust > 20) || (s.intelligence + s.intelligenceImplant < -10))); + let slobs = getSlaves().filter(s => isSlaveAvailable(s) && s.geneMods.aggressiveSperm === 1 && (s.fetish === Fetish.MINDBROKEN || s.energy > 95 || (s.devotion < -20 && s.trust > 20) || (s.intelligence + s.intelligenceImplant < -10))); if (slobs.length > (totalServantCapacity() / 5)) { tryKnockMeUp(PC, -50, 2, slobs.random()); } diff --git a/src/endWeek/reports/penthouseReport.js b/src/endWeek/reports/penthouseReport.js index ac3732e14735f7012265277bb3317dc355d34074..f41cf1adc65bd2b5f4495e79da9f53716e0ee7eb 100644 --- a/src/endWeek/reports/penthouseReport.js +++ b/src/endWeek/reports/penthouseReport.js @@ -4,7 +4,7 @@ App.EndWeek.penthouseReport = function() { const beforeFrag = document.createElement("p"); - const penthouseSlaves = V.slaves.filter(s => assignmentVisible(s) || !App.EndWeek.saVars.slaveCheckedIn.includes(s.ID)); + const penthouseSlaves = getSlaves().filter(s => assignmentVisible(s) || !App.EndWeek.saVars.slaveCheckedIn.includes(s.ID)); const HGSuiteSlaves = App.Utils.jobForAssignment(Job.HEADGIRLSUITE).employees(); const hgSlave = HGSuiteSlaves.length > 0 ? App.SlaveAssignment.reportSlave(HGSuiteSlaves[0]) : null; const HGTrainSlavesIDs = slavesToTrain(); diff --git a/src/endWeek/reports/rulesAssistantReport.js b/src/endWeek/reports/rulesAssistantReport.js index 0bfd98b6bbdb4e472730b49e52d48c469ef6ed33..093f6c352f7f4028e354a167d86af0fb0d1b34b9 100644 --- a/src/endWeek/reports/rulesAssistantReport.js +++ b/src/endWeek/reports/rulesAssistantReport.js @@ -4,7 +4,7 @@ App.EndWeek.rulesAssistantReport = function() { const frag = $(document.createDocumentFragment()); const lines = []; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.useRulesAssistant === 1) { try { lines.push(DefaultRules(slave)); diff --git a/src/endWeek/saBeYourHeadGirl.js b/src/endWeek/saBeYourHeadGirl.js index 66a43046fbce594ab89dd901f1de5db6332de270..81083950201f72a6a3fbef53989b807c819bcafe 100644 --- a/src/endWeek/saBeYourHeadGirl.js +++ b/src/endWeek/saBeYourHeadGirl.js @@ -239,7 +239,7 @@ App.SlaveAssignment.beYourHeadGirl = function saBeYourHeadGirl(slave) { if (slave.dick > 0 && V.universalRulesImpregnation === "HG" && canPenetrate(slave)) { r.push(`${He} finds ${his} duty to impregnate slaves at will sexually satisfying.`); slave.need = 0; - } else if (V.slaves.length > 5) { + } else if (getSlaves().length > 5) { r.push(`Seldom a day goes by without ${him} finding an outlet among your slaves for ${his} sexual desires.`); slave.need = 0; } diff --git a/src/endWeek/saDevotion.js b/src/endWeek/saDevotion.js index eb3a1096e8cad114d3d4c79d184906ca4dcaa176..6c6aa9181e3c64bd1beaab8cf5ff0e5ba352b7e3 100644 --- a/src/endWeek/saDevotion.js +++ b/src/endWeek/saDevotion.js @@ -729,7 +729,7 @@ App.SlaveAssignment.devotion = function saDevotion(slave) { * */ function collectiveSpirit(slave) { - if (V.slaves.length > 3) { + if (getSlaves().length > 3) { let collectiveTrustEffect = 0; let collectiveDevotionEffect = 0; if (V.enduringDevotion > 50) { diff --git a/src/endWeek/saGuardYou.js b/src/endWeek/saGuardYou.js index 72bee0a0bbe39c15d9adf225f1ae112af3cdf1d2..c37b52888ab08b9b6ba3a70b21611ad419fe090c 100644 --- a/src/endWeek/saGuardYou.js +++ b/src/endWeek/saGuardYou.js @@ -292,7 +292,7 @@ App.SlaveAssignment.guardYou = function saGuardYou(slave) { r.push(`<span class="yellow">${He} is ${toSentence(requirements.filter(s => s[0]).map(s => s[1]))} to train any successors.</span>`); } } else { - const successorCandidates = V.slaves.filter(s => (assignmentVisible(s) || [Job.CONCUBINE, Job.WARDEN, Job.HEADGIRL, Job.QUARTER, Job.MASTERSUITE].includes(s.assignment)) && bodyguardSuccessorEligible(s)); + const successorCandidates = getSlaves().filter(s => (assignmentVisible(s) || [Job.CONCUBINE, Job.WARDEN, Job.HEADGIRL, Job.QUARTER, Job.MASTERSUITE].includes(s.assignment)) && bodyguardSuccessorEligible(s)); const combatSkilled = successorCandidates.filter(s => s.skill.combat > 60); r.push(`${He}'s confident in ${his} martial skills, but smart enough to know that${slave.geneMods.immortality > 0 ? `, while technically immortal, ${he} isn't invincible` : ` ${he} isn't immortal`}, and devoted enough to worry about who will protect you should ${he} die.`); diff --git a/src/endWeek/saPleaseYou.js b/src/endWeek/saPleaseYou.js index f645816137dfa423a4b6e6d6a79cc22eab44cb8b..2a2c1a81a14e74b830a9503360249b04d6a75bd3 100644 --- a/src/endWeek/saPleaseYou.js +++ b/src/endWeek/saPleaseYou.js @@ -4430,7 +4430,7 @@ App.SlaveAssignment.pleaseYou = function saPleaseYou(slave) { function familyBonus(slave) { let multiplier = 0; const isFucktoy = (s) => [Job.CONCUBINE, Job.MASTERSUITE, Job.FUCKTOY].includes(s.assignment); - const fucktoys = V.slaves.filter(s => isFucktoy(s)); + const fucktoys = getSlaves().filter(s => isFucktoy(s)); if (areRelated(V.PC, slave)) { r.push(`Keeping your own ${relativeTerm(V.PC, slave)} as a personal ${canFuck ? `fucktoy` : `bedwarmer`} leaves quite a public impression.`); diff --git a/src/endWeek/saPregnancy.js b/src/endWeek/saPregnancy.js index 10589109b5dca5a2ba2721219f26f167947818f0..8f868f1e8f67dc6d86580e90fede48a84e5b800a 100644 --- a/src/endWeek/saPregnancy.js +++ b/src/endWeek/saPregnancy.js @@ -901,7 +901,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) { */ function impregnation(slave) { const conceptionSeed = random(1, 100); - let Stud = slaveStateById(V.StudID); // May be null! + let Stud = getSlave(V.StudID); // May be undefined! const studIgnoresRules = (Stud && V.universalRulesImpregnation === "Stud" && Stud.career === "a breeding bull" && Stud.fetish === Fetish.MINDBROKEN && canMove(Stud)); const pussy = (slave.mpreg === 1 ? "asspussy" : "pussy"); let satisfiedPregFetish = 0; @@ -1746,7 +1746,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) { } } } else if (V.universalRulesImpregnation === "Slaves" && slave.preg === 0 && slave.inseminationExclude !== 1 && ((![Job.CONCUBINE, Job.MASTERSUITE, Job.FUCKTOY].includes(slave.assignment) && slave.relationship !== -3 ) || V.universalHGImpregnateMasterSuiteToggle === 1)) { - const potentialSlaveFathers = V.slaves.filter(s => s.ID !== slave.ID && canBreed(slave, s) && ![Job.AGENT, Job.AGENTPARTNER].includes(s.assignment)); + const potentialSlaveFathers = getSlaves().filter(s => s.ID !== slave.ID && canBreed(slave, s) && ![Job.AGENT, Job.AGENTPARTNER].includes(s.assignment)); if (potentialSlaveFathers.length === 0) { r.push(`${slave.slaveName} is ripe for breeding, but you have no other slaves to harvest sperm from to use on ${him}.`); } else { @@ -1956,7 +1956,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) { if (pcCanKnockUpSlave(slave)) { pcDoKnockUpSlave(slave); } else { // look for a random father among master suite slaves - const msSlaves = V.slaves.filter((s) => s.assignment === Job.MASTERSUITE).shuffle(); + const msSlaves = getSlaves().filter((s) => s.assignment === Job.MASTERSUITE).shuffle(); for (const msSlave of msSlaves) { if (canImpreg(slave, msSlave) && App.Utils.sexAllowed(slave, msSlave)) { /* catch for self-impregnation */ @@ -2057,7 +2057,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) { } else if (random(1, 100) > 95 && slave.eggType === "human" && slave.trust > 20 && slave.relationship.isBetween(-2, 4) && (slave.devotion <= 20 || slave.energy > 95)) { // 5% chance of impregnation by random citizen in defiant and nymphomaniac slaves. pregSource = -2; } else { - const potentialFathers = V.slaves.filter(s => canImpreg(slave, s)).shuffle(); + const potentialFathers = getSlaves().filter(s => canImpreg(slave, s)).shuffle(); const motherDisobeys = disobedience(slave) > random(0, 100); for (const father of potentialFathers) { if (father.ID === slave.ID) { /* self-impregnation check */ @@ -2092,7 +2092,7 @@ App.SlaveAssignment.pregnancy = function saPregnancy(slave) { } /* closes random chance and non-zero sex acts check */ if (canGetPregnant(slave) && canWalk(slave) && isSlaveAvailable(slave) && (V.personalAttention.task !== PersonalAttention.MAID || onBedRest(V.PC))) { // Sperm mod leavings around the penthouse. Gives servants more of a point too. - let slobs = V.slaves.filter(s => canFemImpreg(slave, s) && isSlaveAvailable(s) && s.geneMods.aggressiveSperm === 1 && (s.fetish === Fetish.MINDBROKEN || s.energy > 95 || (s.devotion < -20 && s.trust > 20) || (s.intelligence + s.intelligenceImplant < -10))); + let slobs = getSlaves().filter(s => canFemImpreg(slave, s) && isSlaveAvailable(s) && s.geneMods.aggressiveSperm === 1 && (s.fetish === Fetish.MINDBROKEN || s.energy > 95 || (s.devotion < -20 && s.trust > 20) || (s.intelligence + s.intelligenceImplant < -10))); if (slobs.length > (totalServantCapacity() / 5)) { tryKnockMeUp(slave, -50, 2, slobs.random()); } diff --git a/src/endWeek/saRecruitGirls.js b/src/endWeek/saRecruitGirls.js index 6e1a9f1e621c42251f598d507ee1539908218e63..743dd0c643bbf53d00c7bd8bf9ed995d1b6f8764 100644 --- a/src/endWeek/saRecruitGirls.js +++ b/src/endWeek/saRecruitGirls.js @@ -15,6 +15,7 @@ App.SlaveAssignment.recruitGirls = function recruitGirls(slave) { const targetArcologyInfo = targetArcology ? new App.Utils.Arcology(targetArcology) : null; const totalInt = slave.intelligence + slave.intelligenceImplant; + const slavesLength = getSlaves().length; const { he, him, his, himself, girl, woman, women, He, His, @@ -26,7 +27,7 @@ App.SlaveAssignment.recruitGirls = function recruitGirls(slave) { tooTired(); } else if (V.recruiterTarget === "other arcologies") { influenceNeighbor(slave); - } else if (V.slaves.length < idleTarget) { + } else if (slavesLength < idleTarget) { recruiting(slave); } else { idlePublicity(slave); @@ -91,7 +92,7 @@ App.SlaveAssignment.recruitGirls = function recruitGirls(slave) { delete V.oldRecruiterTarget; } } - } else if (V.slaves.length < idleTarget) { + } else if (slavesLength < idleTarget) { r.push(`better prepare to manipulate ${V.recruiterTarget} into enslavement.`); } else { r.push(`prepare methods to better support your cultural directions.`); @@ -890,7 +891,7 @@ App.SlaveAssignment.recruitGirls = function recruitGirls(slave) { const modScore = SlaveStatsChecker.modScore(slave); r.push(`tries to maintain ${his} network of prospects without promising anyone a space in ${arcology.name}, since you already control`); - if (V.slaves.length > idleTarget) { + if (slavesLength > idleTarget) { r.push(`more sex slaves than`); } else { r.push(`as many sex slaves as`); @@ -1678,7 +1679,7 @@ App.SlaveAssignment.recruitGirls = function recruitGirls(slave) { FSmatch++; seed += 5; arcology.FSAntebellumRevivalist += 0.02 * V.FSSingleSlaveRep; - } else if (V.slaves.length < 10) { + } else if (slavesLength < 10) { pushFS(`${He} wants to show-off your Penthouse to try and garner interest, but can't hide just how empty it is on camera.`); } else if (V.servantsQuarters === 0) { pushFS(`${He} doesn't feel right selling the idea of Southern hospitality without a stable of servants to cater to any would-be visitors.`); diff --git a/src/endWeek/saRelationships.js b/src/endWeek/saRelationships.js index 8297ded19eac2691cc8bf14044eda1055e2e0f2d..eb8067b0059f1b05efa9f8a12a9773d8d3325539 100644 --- a/src/endWeek/saRelationships.js +++ b/src/endWeek/saRelationships.js @@ -140,13 +140,13 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { slave.relationship = -2; } } else if (slave.career === "a Futanari Sister" && slave.rules.relationship === "permissive") { - const potentialFriend = V.slaves.find((s) => s.career === "a Futanari Sister" && s.rules.relationship === "permissive" && canStartFriendship(slave, s)); + const potentialFriend = getSlaves().find((s) => s.career === "a Futanari Sister" && s.rules.relationship === "permissive" && canStartFriendship(slave, s)); if (potentialFriend !== undefined) { r.push(`${slave.slaveName} greets ${potentialFriend.slaveName} with joy. It's not clear whether they ever knew each other during their lives as Futanari Sisters, but it seems that they believe themselves to be in a relationship by simple virtue of having been Sisters. In any case, ${slave.slaveName} and ${potentialFriend.slaveName} <span class="relationship">become inseparable lovers</span> instantly, as though there's no possibility they would do anything else. They're even surprised when other slaves ask them about it; it's as though they're unaware that other possibilities even exist.`); startFriendship(slave, potentialFriend, 4); } } else if (slave.origin === "You were acquainted with $him before you were an arcology owner; your rival tried to use $him to manipulate you, but you rescued $him." && V.rival.duration > 20 && !["Intellectual Dependency", "Paternalism", "Racial Supremacism", "Slave Professionalism"].includes(V.rival.FS.name) && slave.newGamePlus === 0) { - const potentialFriend = V.slaves.find((s) => (s.prestigeDesc === "You bankrupted and enslaved $him in revenge for $his part in the attack on your arcology by the Daughters of Liberty." && s.fuckdoll === 0 && s.fetish !== Fetish.MINDBROKEN && s.newGamePlus === 0)); + const potentialFriend = getSlaves().find((s) => (s.prestigeDesc === "You bankrupted and enslaved $him in revenge for $his part in the attack on your arcology by the Daughters of Liberty." && s.fuckdoll === 0 && s.fetish !== Fetish.MINDBROKEN && s.newGamePlus === 0)); if (potentialFriend !== undefined) { r.push(`${slave.slaveName} greets ${potentialFriend.slaveName} with joy, happy to see a familiar face again. Without any regard to you, <span class="relationship">they continue their prior relationship.</span>`); if (potentialFriend.relationship > 0) { // remove me with multi-friend system @@ -168,7 +168,7 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { const manipulationSkill = (slave.devotion + slave.trust + ((slave.intelligence + slave.intelligenceImplant) / 10)); // intended for defiant slaves to ingrain themselves with facility heads if (randomSeed > 75) { let resentment = 0; - for (const potentialFriend of V.slaves) { + for (const potentialFriend of getSlaves()) { if (canStartFriendship(slave, potentialFriend) && potentialFriend.assignment !== Job.CONFINEMENT) { const {him2, He2} = getPronouns(potentialFriend).appendSuffix("2"); if (potentialFriend.ID === V.MadamID && slave.assignment === Job.BROTHEL) { @@ -297,11 +297,11 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { } } } - } else if (mutualChildren(slave, potentialFriend, V.slaves) > 0) { + } else if (mutualChildren(slave, potentialFriend, getSlaves()) > 0) { if (App.Utils.sexAllowed(slave, potentialFriend)) { if (potentialFriend.rules.relationship === "permissive") { r.push(`${slave.slaveName} and ${potentialFriend.slaveName} have`); - if (mutualChildren(slave, potentialFriend, V.slaves) === 1) { + if (mutualChildren(slave, potentialFriend, getSlaves()) === 1) { r.push(`a child`); } else { r.push(`children`); @@ -631,7 +631,7 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { r.push(`They build on their family relationship and become <span class="relationship">best friends.</span>`); slave.relationship++; friend.relationship = slave.relationship; - } else if (mutualChildren(slave, friend, V.slaves) > 0 && (random(1, 100) < (50 + (10 * mutualChildren(slave, friend, V.slaves))))) { + } else if (mutualChildren(slave, friend, getSlaves()) > 0 && (random(1, 100) < (50 + (10 * mutualChildren(slave, friend, getSlaves()))))) { r.push(`Hoping to benefit their mutual children, they draw closer together, becoming <span class="relationship">best friends.</span>`); slave.relationship++; friend.relationship = slave.relationship; @@ -683,7 +683,7 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { friend.relationshipTarget = 0; slave.relationshipTarget = 0; } else if (App.Utils.sexAllowed(slave, friend) && slave.rules.relationship !== "just friends" && friend.rules.relationship !== "just friends") { - if (mutualChildren(slave, friend, V.slaves) > 0 && random(1, 100) < (50 + (10 * mutualChildren(slave, friend, V.slaves)) + seed)) { + if (mutualChildren(slave, friend, getSlaves()) > 0 && random(1, 100) < (50 + (10 * mutualChildren(slave, friend, getSlaves())) + seed)) { r.push(`Having already had kids together, their relationship turns sexual once again, turning them into <span class="relationship">friends with benefits.</span>`); slave.relationship++; friend.relationship = slave.relationship; @@ -747,7 +747,7 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { r.push(`${He} gets deep, perverse satisfaction by constant commission of the sin of incest, which is extreme enough to appease even ${his} appetite for transgression. ${His} incestuous relationship becomes <span class="relationship">romantically emotional</span> as well as physical and familial.`); slave.relationship++; friend.relationship = slave.relationship; - } else if (mutualChildren(slave, friend, V.slaves) > 0 && random(1, 100) < (50 + (10 * mutualChildren(slave, friend, V.slaves)) + seed)) { + } else if (mutualChildren(slave, friend, getSlaves()) > 0 && random(1, 100) < (50 + (10 * mutualChildren(slave, friend, getSlaves())) + seed)) { r.push(`Between their children and common sexual flings, they begin seeing each other as a traditional couple. Their relationship becomes <span class="relationship">strongly emotional</span> as well as physical.`); if (slave.pregSource === friend.ID && friend.pregSource === slave.ID && slave.pregKnown === 1 && friend.pregKnown === 1) { r.push(`Not very surprising, since they both have the other's child growing in their womb.`); @@ -1252,7 +1252,7 @@ App.SlaveAssignment.relationships = function saRelationships(slave) { const overwhelmed = 5; if (slave.trust <= 95) { - let relatives = V.slaves.filter((s) => areRelated(slave, s)); + let relatives = getSlaves().filter((s) => areRelated(slave, s)); if (slave.trust < -20) { /** @type {Array<FC.SlaveState>} */ const worriedAboutChildren = []; diff --git a/src/endWeek/saRivalries.js b/src/endWeek/saRivalries.js index f1d74be68b520d4a91454f515016e4f0ac1ea686..81bf8140793b7012188898ce3e2ef3e6c666d9a2 100644 --- a/src/endWeek/saRivalries.js +++ b/src/endWeek/saRivalries.js @@ -43,7 +43,7 @@ App.SlaveAssignment.rivalries = function saRivalries(slave) { function generateRivalry(slave) { let foundRival = 0; - for (const potentialRival of V.slaves) { + for (const potentialRival of getSlaves()) { if (canStartRivalry(potentialRival) && potentialRival.ID !== slave.ID && potentialRival.ID !== slave.relationshipTarget) { if (potentialRival.origBodyOwnerID === slave.ID && potentialRival.devotion > 0 && slave.devotion < -30) { r.push(`${slave.slaveName} loathes that ${SlaveFullName(potentialRival)} is using <span class="em">${his}</span> body to benefit you and makes it abundantly clear every chance ${he} gets. <span class="rivalry inc">They start to dislike each other.</span>`); diff --git a/src/endWeek/saRules.js b/src/endWeek/saRules.js index 3aa9c1a768da46eebdde12978436cfa9b3f0dbb7..838298b29247bd66a6f1fad167b2efb17541722e 100644 --- a/src/endWeek/saRules.js +++ b/src/endWeek/saRules.js @@ -1653,7 +1653,7 @@ App.SlaveAssignment.rules = function(slave) { r.push(App.SlaveAssignment.rewardAndPunishment(slave)); break; case Job.QUARTER: - slave.need -= V.slaves.length * 5; + slave.need -= getSlaves().length * 5; if (slave.devotion < -50) { r.push(`is so unhappy that ${he} has little interest in getting off.`); slave.need = 0; diff --git a/src/endWeek/saRulesFunctions.js b/src/endWeek/saRulesFunctions.js index b5037478ab5763edfcf14fdaf4c7a768f828cf79..82bb6396d0b568bcb0bf08d2f8f5487dc0e8db24 100644 --- a/src/endWeek/saRulesFunctions.js +++ b/src/endWeek/saRulesFunctions.js @@ -1653,7 +1653,7 @@ App.EndWeek.Rules.consentRules = function(slave) { case Job.QUARTER: case Job.HOUSE: return Object.assign(obj, { - peers: V.slaves, // ALL THE SLAVES! + peers: getSlaves(), // ALL THE SLAVES! (Not all the slaves, so hopefully thats okay -FranklyGeorge) emptyPlace: "your penthouse" // always, even for servants' quarter slaves }); case Job.MILKMAID: diff --git a/src/endWeek/saServeThePublic.js b/src/endWeek/saServeThePublic.js index 31ff534440300fb300aa3b71394b3bcac72dfd88..cc4bbf7a343160141bddca7ad8f5ba1de7db55f0 100644 --- a/src/endWeek/saServeThePublic.js +++ b/src/endWeek/saServeThePublic.js @@ -590,7 +590,7 @@ App.SlaveAssignment.serveThePublic = function saServeThePublic(slave) { } if (totalRelatives(slave) > 0) { - let children = V.slaves.filter((s) => areRelated(slave, s) && (s.assignment === slave.assignment)); + let children = getSlaves().filter((s) => areRelated(slave, s) && (s.assignment === slave.assignment)); if (children.length > 1) { r += ` Since ${his} relatives, ${toSentence(children.map(s => s.slaveName))}, are public sluts too, ${he} earns extra attention.`; } else if (children.length > 0) { diff --git a/src/endWeek/saWhore.js b/src/endWeek/saWhore.js index cade9765463d9d49ac01a63bb74b70949259c322..ec0499760cec4c01e882906f02479ac80d52989e 100644 --- a/src/endWeek/saWhore.js +++ b/src/endWeek/saWhore.js @@ -683,7 +683,7 @@ App.SlaveAssignment.whore = function(slave) { } if (totalRelatives(slave) > 0) { - let children = V.slaves.filter((s) => areRelated(slave, s) && (s.assignment === slave.assignment)); + let children = getSlaves().filter((s) => areRelated(slave, s) && (s.assignment === slave.assignment)); if (children.length > 1) { r += ` Since ${his} relatives, ${toSentence(children.map(s => s.slaveName))}, are selling themselves too, ${he} earns extra ¤ by working with them.`; } else if (children.length > 0) { diff --git a/src/endWeek/slaveAssignmentReport.js b/src/endWeek/slaveAssignmentReport.js index be6d7f9a4f7be95aa1ebb4024203bd1423586c59..fcfb044cc56ae4901f04a6b2a806f788dfa31e87 100644 --- a/src/endWeek/slaveAssignmentReport.js +++ b/src/endWeek/slaveAssignmentReport.js @@ -30,7 +30,7 @@ App.EndWeek.slaveAssignmentReport = function() { const res = document.createDocumentFragment(); /* perform reassignments before generating reports */ - for (const slave of V.slaves) { + for (const slave of getSlaves()) { for (const sk in skillsToTest) { if (_.isNil(slave.skill[sk])) { _printSlaveError(`Reset bad ${skillsToTest[sk]} skill`, slave); @@ -50,7 +50,7 @@ App.EndWeek.slaveAssignmentReport = function() { App.EndWeek.computeSexualServicesModel(res); let slavesWithWorkingDicks = 0; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if ((V.seeDicks > 0) && canPenetrate(slave) && App.Utils.hasNonassignmentSex(slave)) { App.EndWeek.saVars.averageDick += slave.dick; slavesWithWorkingDicks++; @@ -183,7 +183,7 @@ App.EndWeek.slaveAssignmentReport = function() { } } } - } // for (const slave of V.slaves) + } // for (const slave of slaves) // Optimized sperm slaves cumming up the spa pool. if (facilities.spa.established) { @@ -199,7 +199,7 @@ App.EndWeek.slaveAssignmentReport = function() { if (V.HeadGirlID !== 0) { App.EndWeek.saVars.HGEnergy++; - const slave = slaveStateById(V.HeadGirlID); + const slave = S.HeadGirl; if (V.personalAttention.task === PersonalAttention.SUPPORT_HG && !onBedRest(V.PC, true)) { App.EndWeek.saVars.HGEnergy++; if (slave.trust > 95) { @@ -232,7 +232,7 @@ App.EndWeek.slaveAssignmentReport = function() { App.EndWeek.saVars.StudCum += 1; } let studCumLimit = App.EndWeek.saVars.StudCum; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (studCumLimit === 0 || stud.need <= 0) { break; } @@ -268,7 +268,7 @@ App.EndWeek.slaveAssignmentReport = function() { if (V.seeImages && V.seeReportImages) { // agents and partners are not drawn; penthouse partners and the head girl's slave will be drawn via a different mechanism (since they are larger and right-aligned) const undrawnJobs = [Job.AGENT, Job.AGENTPARTNER, Job.HEADGIRLSUITE]; - const drawnSlaveIDs = V.slaves.filter(s => !assignmentVisible(s) && !undrawnJobs.includes(s.assignment)).map(s => s.ID); + const drawnSlaveIDs = getSlaves().filter(s => !assignmentVisible(s) && !undrawnJobs.includes(s.assignment)).map(s => s.ID); // this batch renderer object will be accessible to all the facility reports App.EndWeek.saVars.slaveArt = new App.Art.SlaveArtBatch(drawnSlaveIDs, 0); res.append(App.EndWeek.saVars.slaveArt.writePreamble()); diff --git a/src/events/PESS/pessHeadgirlDickgirl.js b/src/events/PESS/pessHeadgirlDickgirl.js index ececef0edf267893253f629cf9b2f0d54ccd08d6..0f57eff1f7b6a696a49c36e9e462251d0944670e 100644 --- a/src/events/PESS/pessHeadgirlDickgirl.js +++ b/src/events/PESS/pessHeadgirlDickgirl.js @@ -75,7 +75,7 @@ App.Events.pessHeadgirlDickgirl = class pessHeadgirlDickgirl extends App.Events. } r.push(`cheek. In the coming week, no shirker is safe from ${his} wrath. <span class="devotion inc">Every single slave in your penthouse has become better broken to your will.</span>`); seX(S.HeadGirl, "oral", V.PC, "penetrative"); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (assignmentVisible(slave)) { slave.devotion += 2; } diff --git a/src/events/PESS/pessLovingHeadgirl.js b/src/events/PESS/pessLovingHeadgirl.js index 5bec0d6339419fff53ebb0ddb64b437d341fb043..a580c3a48bc915e4494783dff5da3b8f3f47e785 100644 --- a/src/events/PESS/pessLovingHeadgirl.js +++ b/src/events/PESS/pessLovingHeadgirl.js @@ -3,7 +3,7 @@ App.Events.pessLovingHeadgirl = class pessLovingHeadgirl extends App.Events.Base return [ () => !!S.HeadGirl, () => S.HeadGirl.devotion > 95, - () => V.slaves.length > 4 + () => getSlaves().length > 4 ]; } @@ -15,7 +15,7 @@ App.Events.pessLovingHeadgirl = class pessLovingHeadgirl extends App.Events.Base const {title: Master} = getEnunciation(S.HeadGirl); const art = App.UI.DOM.appendNewElement("span", node); App.Events.drawEventArt(art, S.HeadGirl); - const subSlave = V.slaves.find((s) => s.ID !== V.HeadGirlID && s.devotion <= 20); + const subSlave = getSlaves().find((s) => s.ID !== V.HeadGirlID && s.devotion <= 20); App.Events.addParagraph(node, [ `You and`, @@ -153,7 +153,7 @@ App.Events.pessLovingHeadgirl = class pessLovingHeadgirl extends App.Events.Base if (subSlave.anus === 0) { subSlave.anus = 1; } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.devotion += 4; slave.trust -= 4; } diff --git a/src/events/PESS/pessMadamStrategy.js b/src/events/PESS/pessMadamStrategy.js index ad7c7a54144ff644624462a94c0d6e8b255416b0..1b64be91cb403f606117c64c65ad25b7195b933d 100644 --- a/src/events/PESS/pessMadamStrategy.js +++ b/src/events/PESS/pessMadamStrategy.js @@ -29,7 +29,7 @@ App.Events.pessMadamStrategy = class pessMadamStrategy extends App.Events.BaseEv function review() { S.Madam.devotion += 4; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.assignment === Job.BROTHEL) { if (slave.skill.oral < 100) { slave.skill.oral += 5; @@ -47,7 +47,7 @@ App.Events.pessMadamStrategy = class pessMadamStrategy extends App.Events.BaseEv function surgery() { S.Madam.devotion += 4; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.assignment === Job.BROTHEL) { if (slave.boobs < 400) { slave.boobs += 200; diff --git a/src/events/PESS/pessWorriedHeadgirl.js b/src/events/PESS/pessWorriedHeadgirl.js index 514e43e5a3edd223eba32610256bd015f94cf020..aa46839f3d0404e746af016f73776d2cc4293c16 100644 --- a/src/events/PESS/pessWorriedHeadgirl.js +++ b/src/events/PESS/pessWorriedHeadgirl.js @@ -91,7 +91,7 @@ App.Events.pessWorriedHeadgirl = class pessWorriedHeadgirl extends App.Events.Ba r.push(`up`); } r.push(`to look at you, <span class="devotion inc">${his} ${App.Desc.eyesColor(S.HeadGirl)} glittering at the compliment.</span> "Thank you, ${Master}," ${he} murmurs. There's another flash on the horizon, followed by a series of smaller flashes and a low, slowly growing glow as secondaries go off and start a fire. ${S.HeadGirl.slaveName} seems affected, a certain amount of moisture gathering in ${his} eyes, but ${he} turns away to return to ${his} duties when it becomes clear that you intend to keep watching for a while, and aren't going to have sex with ${him} right this minute. ${He} does ${his} best to communicate the new reality to those of your slaves who are obedient enough to understand the truth: though they are slaves, <span class="trust inc">there is safety to be found in slavery.</span>`); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.devotion > 20) { slave.trust += 1; } diff --git a/src/events/PESS/pessWorshipfulImpregnatrix.js b/src/events/PESS/pessWorshipfulImpregnatrix.js index da1e3aba500f3e96df0e5209b0fa18b59ded068e..bfa1903169a3fd497a970d828a007ea528454e02 100644 --- a/src/events/PESS/pessWorshipfulImpregnatrix.js +++ b/src/events/PESS/pessWorshipfulImpregnatrix.js @@ -155,7 +155,7 @@ App.Events.pessWorshipfulImpregnatrix = class pessWorshipfulImpregnatrix extends seX(S.HeadGirl, "anal", V.PC, "penetrative"); } S.HeadGirl.devotion += 5; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (assignmentVisible(slave)) { slave.devotion += 2; } @@ -191,7 +191,7 @@ App.Events.pessWorshipfulImpregnatrix = class pessWorshipfulImpregnatrix extends } r.push(`producing a shiver of pleasure as your fingers massage ${his} scalp. As you cuddle with your Head Girl, you praise ${his} hard work, and tell ${him} that the next generation of sex slaves in the Free Cities will owe a lot to ${him}. They'll learn from ${his} leadership, of course, but they'll also have ${his} genes. ${He} stiffens a little, and there's a slight moisture against your skin as tears begin to run down ${his} cheeks. ${He} cranes ${his} neck up and <span class="devotion inc">kisses you rapturously.</span> ${He} seems to have absorbed a bit of your vision for the future, and over the next couple of days ${he} takes special care to make sure the slaves in your penthouse <span class="trust inc">know their place in the new world you're building.</span>`); S.HeadGirl.devotion += 5; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (assignmentVisible(slave)) { slave.trust += 2; } diff --git a/src/events/PETS/petsAggressiveWardeness.js b/src/events/PETS/petsAggressiveWardeness.js index fd7b68960cac3a282011730b9ab07a6febd6b3a2..33686079b3b2a5a0c4f4820b1f02e8fe9caa2493 100644 --- a/src/events/PETS/petsAggressiveWardeness.js +++ b/src/events/PETS/petsAggressiveWardeness.js @@ -49,7 +49,7 @@ App.Events.petsAggressiveWardeness = class petsAggressiveWardeness extends App.E App.Events.addResponses(node, choices); function encourage() { - V.slaves.forEach(function(s) { + getSlaves().forEach(function(s) { if (s.assignment === Job.CELLBLOCK) { s.devotion += 10; healthDamage(s, 10); @@ -59,7 +59,7 @@ App.Events.petsAggressiveWardeness = class petsAggressiveWardeness extends App.E } function quiet() { - V.slaves.forEach(function(s) { + getSlaves().forEach(function(s) { if (s.assignment === Job.CELLBLOCK) { improveCondition(s, 10); } diff --git a/src/events/PETS/petsNurseMolestation.js b/src/events/PETS/petsNurseMolestation.js index ccf017c45701f6db5866a02c95ca2786cec7b253..62150b8aa648ee36fd2cdae95996d1e761b9f10d 100644 --- a/src/events/PETS/petsNurseMolestation.js +++ b/src/events/PETS/petsNurseMolestation.js @@ -72,7 +72,7 @@ App.Events.petsNurseMolestation = class petsNurseMolestation extends App.Events. seX(S.Nurse, "anal", V.PC, "penetrative"); } actX(S.Nurse, "oral", 20); - V.slaves.forEach(function(s) { + getSlaves().forEach(function(s) { if (s.assignment === Job.CLINIC) { s.trust += 2; } diff --git a/src/events/RE/REBusyBrothel.js b/src/events/RE/REBusyBrothel.js index 326a1891aa016193dd7e7f36052655cd95d463c0..0f4a50b48f99af2b59f31c39083d13e8e2eae07b 100644 --- a/src/events/RE/REBusyBrothel.js +++ b/src/events/RE/REBusyBrothel.js @@ -19,7 +19,7 @@ App.Events.REBusyBrothel = class REBusyBrothel extends App.Events.BaseEvent { function rest() { cashX(-1000, "event"); - for (const slave of V.slaves.filter(s => s.assignment === Job.BROTHEL)) { + for (const slave of getSlaves().filter(s => s.assignment === Job.BROTHEL)) { slave.devotion += 4; slave.health.tired = 0; } @@ -27,7 +27,7 @@ App.Events.REBusyBrothel = class REBusyBrothel extends App.Events.BaseEvent { } function lessons() { cashX(-2000, "event"); - for (const slave of V.slaves.filter(s => s.assignment === Job.BROTHEL)) { + for (const slave of getSlaves().filter(s => s.assignment === Job.BROTHEL)) { slave.lastWeeksCashIncome += 250; slave.lifetimeCashIncome += 250; if (slave.skill.whoring < 100) { @@ -41,7 +41,7 @@ App.Events.REBusyBrothel = class REBusyBrothel extends App.Events.BaseEvent { function promote() { repX(1000, "event"); cashX(-2000, "event"); - for (const slave of V.slaves.filter(s => s.assignment === Job.BROTHEL)) { + for (const slave of getSlaves().filter(s => s.assignment === Job.BROTHEL)) { healthDamage(slave, 10); if (canDoVaginal(slave)) { seX(slave, "vaginal", "public", "penetrative", 5); diff --git a/src/events/RE/REBusyDairy.js b/src/events/RE/REBusyDairy.js index 2f3b27b3a950f4a7c09e46f8f17570dbf7cb8041..de95918106940ea07282053e12e8833df35b708e 100644 --- a/src/events/RE/REBusyDairy.js +++ b/src/events/RE/REBusyDairy.js @@ -23,7 +23,7 @@ App.Events.REBusyDairy = class REBusyDairy extends App.Events.BaseEvent { App.Events.addResponses(node, choices); function share() { - const dairySlaves = V.slaves.filter(s => s.assignment === Job.DAIRY); + const dairySlaves = getSlaves().filter(s => s.assignment === Job.DAIRY); cashX(-1000, "event"); for (const slave of dairySlaves) { slave.devotion += 4; diff --git a/src/events/RE/reArcologyInspection.js b/src/events/RE/reArcologyInspection.js index 8e45cdea4e5d09aa34e5f04393b22776a12372e3..0a4c3847baddcf6ed619e8f7a971cce1a20974e1 100644 --- a/src/events/RE/reArcologyInspection.js +++ b/src/events/RE/reArcologyInspection.js @@ -27,7 +27,7 @@ App.Events.REArcologyInspection = class REArcologyInspection extends App.Events. const {He, him, himself, his, he} = agent ? getPronouns(agent) : getPronouns({pronoun: App.Data.Pronouns.Kind.plural}); const Master = agent ? getEnunciation(agent).title : (V.PC.title ? "Sir" : "Madam"); const BG = S.Bodyguard; - const agentLover = agent ? V.slaves.find(s => (s.ID === agent.relationshipTarget && s.assignment === Job.AGENTPARTNER)) : undefined; + const agentLover = agent ? getSlaves().find(s => (s.ID === agent.relationshipTarget && s.assignment === Job.AGENTPARTNER)) : undefined; App.Events.drawEventArt(node, [BG, agent, agentLover].filter(x => !!x)); diff --git a/src/events/RE/reBoomerang.js b/src/events/RE/reBoomerang.js index 52d9d01eb17ba431e8aa785491bb99bd18f56f4f..e1d8f447aeb9ffb74c6dfefc67490d5ace33fdac 100644 --- a/src/events/RE/reBoomerang.js +++ b/src/events/RE/reBoomerang.js @@ -872,7 +872,7 @@ App.Events.REBoomerang = class REBoomerang extends App.Events.BaseEvent { if (V.boomerangStats.PCfather > 0) { V.PC.father = slave.ID; } - for (const s of V.slaves) { + for (const s of getSlaves()) { if (V.boomerangStats.boomerangMother.includes(s.ID)) { s.mother = slave.ID; } diff --git a/src/events/RE/reBrothelFunction.js b/src/events/RE/reBrothelFunction.js index d4b2e70484abaaf36b6f563652e95ec6520edca1..0938bb755f267bda8bf7dc09c5be11ea2786b55f 100644 --- a/src/events/RE/reBrothelFunction.js +++ b/src/events/RE/reBrothelFunction.js @@ -35,7 +35,7 @@ App.Events.REBrothelFunction = class REBrothelFunction extends App.Events.BaseEv const frag = new DocumentFragment(); let r = []; r.push(`Though you close down ${brothelNameCaps} for a day, it's far from a day off for your hard-working brothel slaves. In the absence of the convenient center for the sale of sexual services that a brothel represents, you disperse them onto the streets to sell their bodies the old fashioned way. At the end of the day you receive a brief message of gratitude from your fellow arcology owner while your whores <span class="devotion inc">appreciate the opportunity to stretch their legs on the street</span> for a change of pace.`); - for (const slave of V.slaves.filter(s => s.assignment === Job.BROTHEL)) { + for (const slave of getSlaves().filter(s => s.assignment === Job.BROTHEL)) { slave.devotion += 4; } cashX(largeCash, "event"); @@ -47,7 +47,7 @@ App.Events.REBrothelFunction = class REBrothelFunction extends App.Events.BaseEv const frag = new DocumentFragment(); let r = []; r.push(`Though a citizen he may be, this serial seducer may have more notches on his proverbial bedpost than even your oldest slaves. Though you are not present to view his mastery of the sexual craft first-hand, the dreamy fucked-out looks of exhaustion and gratified satisfaction painting every single one of your slaves' faces at the end of the day speak volumes. Indeed, all of your brothel slaves with any room for improvement in their whoring skills <span class="skill inc">learn from his skillful coupling,</span> while even those with nothing to learn from him <span class="devotion inc">gain confidence</span> from the intensity of their sexual congress.`); - for (const slave of V.slaves.filter(s => s.assignment === Job.BROTHEL)) { + for (const slave of getSlaves().filter(s => s.assignment === Job.BROTHEL)) { if (slave.skill.whoring < 100) { slave.skill.whoring += 10; } else { @@ -71,7 +71,7 @@ App.Events.REBrothelFunction = class REBrothelFunction extends App.Events.BaseEv const frag = new DocumentFragment(); let r = []; r.push(`Though he was but a boy yesterday, none can say that this newly made man entered his manhood with anything less than a sterling display of enthusiasm and virility, though he is somewhat lacking in general technique. Nevertheless, any man able to fuck his way through an entire brothel of sex slaves and back again is clearly capable of bearing the mantle of citizenry in ${V.arcologies[0].name}. The story of a boy entering manhood in such a spectacular manner spreads rapidly and reflects well in the court of <span class="reputation inc">public opinion,</span> with many citizens recalling their own passage past the age of majority. However, a lifetime of indulgence and spoiling have rendered this new citizen unable to understand the concept of being refused — not that your slaves could refuse him, in any case. His rough treatment has left your poor slave whores <span class="health dec">battered</span> by his brutally selfish lovemaking.`); - for (const slave of V.slaves.filter(s => s.assignment === Job.BROTHEL)) { + for (const slave of getSlaves().filter(s => s.assignment === Job.BROTHEL)) { healthDamage(slave, 5); if (canDoVaginal(slave) && canDoAnal(slave)) { actX(slave, "vaginal"); diff --git a/src/events/RE/reBusyMasterSuite.js b/src/events/RE/reBusyMasterSuite.js index cde28721bf0d117dc4102d5854774d0fdee95edf..b124fea48970951e32272728bd8b1fecf39571df 100644 --- a/src/events/RE/reBusyMasterSuite.js +++ b/src/events/RE/reBusyMasterSuite.js @@ -23,7 +23,7 @@ App.Events.REBusyMasterSuite = class REBusyMasterSuite extends App.Events.BaseEv } execute(node) { - const msSlaves = V.slaves.filter((s) => s.fuckdoll === 0 && s.assignment === Job.MASTERSUITE) + const msSlaves = getSlaves().filter((s) => s.fuckdoll === 0 && s.assignment === Job.MASTERSUITE) .map((s) => { /** @type {Array<FC.SlaveActs|"none">} */ let options = []; diff --git a/src/events/RE/reBusyServantsQuarters.js b/src/events/RE/reBusyServantsQuarters.js index a8be6118ef3c1b9304efdc206fe97685069f82de..c9efe7b90eb6921c6e41b6e04d180a301a54d97e 100644 --- a/src/events/RE/reBusyServantsQuarters.js +++ b/src/events/RE/reBusyServantsQuarters.js @@ -16,7 +16,7 @@ App.Events.REBusyServantsQuarters = class REBusyServantsQuarters extends App.Eve ]); function share() { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.assignment !== Job.QUARTER) { slave.devotion += 4; if (canPenetrate(slave)) { diff --git a/src/events/RE/reRelativeRecruiter.js b/src/events/RE/reRelativeRecruiter.js index ecc82e907b1eccd3ebdea7ed0e1587ad47e3f965..23e3ded0fad63b43763fe8df01e9d85fe51c6bc2 100644 --- a/src/events/RE/reRelativeRecruiter.js +++ b/src/events/RE/reRelativeRecruiter.js @@ -608,7 +608,7 @@ App.Events.RERelativeRecruiter = class RERelativeRecruiter extends App.Events.Ba newSlave.origin = relativeOrigin(); applyBackground(newSlave); if (that.params.relative === "mother") { - newSlave.counter.birthsTotal += V.slaves.reduce((acc, cur) => acc + (sameDad(eventSlave, cur) ? 1 : 0), 0); + newSlave.counter.birthsTotal += getSlaves().reduce((acc, cur) => acc + (sameDad(eventSlave, cur) ? 1 : 0), 0); } applyCommon(newSlave); return newSlave; @@ -645,7 +645,7 @@ App.Events.RERelativeRecruiter = class RERelativeRecruiter extends App.Events.Ba switch (that.params.relative) { case "mother": { setUnknownParents(eventSlave, {mother: newSlave.ID} ); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (sameDad(eventSlave, slave)) { setUnknownParents(slave, {mother: newSlave.ID} ); } @@ -654,7 +654,7 @@ App.Events.RERelativeRecruiter = class RERelativeRecruiter extends App.Events.Ba } case "father": { setUnknownParents(eventSlave, {father: newSlave.ID} ); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (sameMom(eventSlave, slave)) { setUnknownParents(slave, {father: newSlave.ID} ); } @@ -672,7 +672,7 @@ App.Events.RERelativeRecruiter = class RERelativeRecruiter extends App.Events.Ba } else if (eventSlave.father === 0) { setMissingParents(eventSlave); setUnknownParents(newSlave, {father: eventSlave.father}); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (sameMom(eventSlave, slave)) { setUnknownParents(slave, {father: eventSlave.father}); } @@ -680,7 +680,7 @@ App.Events.RERelativeRecruiter = class RERelativeRecruiter extends App.Events.Ba } else if (eventSlave.mother === 0) { setMissingParents(eventSlave); setUnknownParents(newSlave, {mother: eventSlave.mother}); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (sameDad(eventSlave, slave)) { setUnknownParents(slave, {mother: eventSlave.mother}); } diff --git a/src/events/RE/reReputedDaughter.js b/src/events/RE/reReputedDaughter.js index 84439dfc8dfb3ae677aa6e232478fb0e30893bd6..5b5aad2cd293cff370ee5f4dea15948077c2ed06 100644 --- a/src/events/RE/reReputedDaughter.js +++ b/src/events/RE/reReputedDaughter.js @@ -27,7 +27,9 @@ App.Events.REReputedDaughter = class REReputedDaughter extends App.Events.BaseEv const {His, He, he, his, him, himself} = getPronouns(slave); const {HeF, heF, hisF, himF, womanF, fatherF} = getNonlocalPronouns(PC.title === 0 && FutureSocieties.isActive("FSGenderRadicalist") ? 0 : 100).appendSuffix('F'); const newAge = Math.max(V.minimumSlaveAge, V.fertilityAge - (V.precociousPuberty ? V.pubertyHormones ? 3 : 1 : 0)); - const rDaughter = GenerateNewSlave("XX", {minAge: newAge, maxAge: newAge, race: "nonslave", disableDisability: 1}); + const rDaughter = GenerateNewSlave("XX", { + minAge: newAge, maxAge: newAge, race: "nonslave", disableDisability: 1 + }); const {HisD, HeD, heD, hisD, himD, girlD, daughterD} = getPronouns(rDaughter).appendSuffix('D'); const kid = rDaughter.actualAge > 12 ? rDaughter.actualAge < 18 ? "teenager" : "young "+ girlD : "kid"; const child = rDaughter.actualAge > 12 ? girlD : "child"; @@ -126,7 +128,7 @@ App.Events.REReputedDaughter = class REReputedDaughter extends App.Events.BaseEv const compensation = 1000 + (Math.min(Math.round(V.cash / 5000), 4) * 500); // from 1,000 to 3,000 const value = 30000 + Math.clamp((Math.round(((slaveCost(rDaughter) - 35000) * .9) / 500) * 500), 0, 30000); // from 30,000 to 60,000 - const canBuy = !V.slaves.some(s => s.origin.includes("disinherited $him and sold $him into slavery") && V.week - s.weekAcquired < 6) && V.seeDicks !== 100; // we don't want a legion of reputed daughters + const canBuy = !getSlaves().some(s => s.origin.includes("disinherited $him and sold $him into slavery") && V.week - s.weekAcquired < 6) && V.seeDicks !== 100; // we don't want a legion of reputed daughters const choices = []; choices.push(V.cash > compensation ? new App.Events.Result(`Offer ${himF} ${cashFormat(compensation)} as financial compensation.`, money) @@ -694,7 +696,7 @@ App.Events.REReputedDaughter = class REReputedDaughter extends App.Events.BaseEv } } r.push(`When they learn what has happened, your other slaves are <span class="devotion inc">glad that you'd protect them</span> from false accusations, although the more rebellious ones feel <span class="defiant inc">they can take advantage of your benevolence.</span>`); - V.slaves.forEach(s => { + getSlaves().forEach(s => { if (s.devotion < -20 && s.trust > 50) { s.devotion--; s.trust += 5; @@ -705,7 +707,7 @@ App.Events.REReputedDaughter = class REReputedDaughter extends App.Events.BaseEv return r; } else if (action === "given" || action === "punished") { r.push(`After learning of what happened to ${slave.slaveName}, <span class="trust dec">your other slaves are afraid</span> that any accusation against them, no matter how fabricated, could have unpredictable consequences. Those not devoted to you begin to have <span class="devotion dec">serious doubts</span> about their futures.`); - V.slaves.forEach(s => { + getSlaves().forEach(s => { s.trust -= 5; if (s.devotion <= 50) { s.devotion -= 5; @@ -755,7 +757,7 @@ App.Events.REReputedDaughter = class REReputedDaughter extends App.Events.BaseEv if (mindbroken) { r.push(`This opinion of you is further tarnished by the fact that ${slave.slaveName} ${exitus ? "was" : "is"} mindbroken and incapable of doing anything wrong on purpose.`); } - V.slaves.forEach(s => { + getSlaves().forEach(s => { s.trust -= (8 + (exitus ? 2 : 0) + (mindbroken ? 1 : 0)); s.devotion -= ((exitus ? 1 : 0) + (mindbroken ? 2 : 0)); if (s.devotion <=51) { diff --git a/src/events/REFS/refsAztecArtifact.js b/src/events/REFS/refsAztecArtifact.js index b5f37989661d99f437df7ac08bfaf16f26901af2..d200227ccae7c192e56017c9a37eec7ed74a941a 100644 --- a/src/events/REFS/refsAztecArtifact.js +++ b/src/events/REFS/refsAztecArtifact.js @@ -62,7 +62,7 @@ App.Events.refsAztecArtifact = class refsAztecArtifact extends App.Events.BaseEv frag.append(`Choose a slave to sacrifice. This slave will die.`); - V.slaves + getSlaves() .filter(s => (s.breedingMark === 0 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || !FutureSocieties.isActive('FSRestart'))) .forEach(slave => { App.Events.addNode(frag, [ diff --git a/src/events/RESS/escapee.js b/src/events/RESS/escapee.js index 343fc2640a99c19ff2abdf318ff2229cd403df6c..e15bc3ab47718197602f3026bdc2553405eeb254 100644 --- a/src/events/RESS/escapee.js +++ b/src/events/RESS/escapee.js @@ -83,7 +83,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { t.push(newRumor.weakness()); eventSlave.devotion -= 10; eventSlave.trust += 2; - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust += 8; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust += 8; } }); return t; } @@ -95,7 +95,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { eventSlave.devotion += 4; assignJob(eventSlave, "stay confined"); - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust += 4; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust += 4; } }); return t; } @@ -107,7 +107,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { eventSlave.trust -= 5; healthDamage(eventSlave, 40); - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust -= 5; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust -= 5; } }); return t; } @@ -121,7 +121,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { eventSlave.trust -= 5; eventSlave.heels = 1; surgeryDamage(eventSlave, 10); - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust -= 5; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust -= 5; } }); return t; } @@ -136,7 +136,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { eventSlave.diet = "healthy"; removeLimbs(eventSlave, "all"); surgeryDamage(eventSlave, 40); - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust -= 10; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust -= 10; } }); return t; } @@ -150,7 +150,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { eventSlave.trust -= 50; eyeSurgery(eventSlave, "both", "blind"); surgeryDamage(eventSlave, 20); - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust -= 10; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust -= 10; } }); return t; } @@ -164,7 +164,7 @@ App.Events.RESSEscapee = class RESSEscapee extends App.Events.BaseEvent { eventSlave.trust -= 25; eventSlave.voice = 0; surgeryDamage(eventSlave, 10); - V.slaves.forEach(function(s) { if (s.devotion <= 20) { s.trust -= 5; } }); + getSlaves().forEach(function(s) { if (s.devotion <= 20) { s.trust -= 5; } }); return t; } diff --git a/src/events/RESS/kitchenMolestation.js b/src/events/RESS/kitchenMolestation.js index 62ad9f54e73ba32aa20d7366cf621f764b2f673a..d665c4e0338030ca0d56a86f1bff14aa3d2b4bba 100644 --- a/src/events/RESS/kitchenMolestation.js +++ b/src/events/RESS/kitchenMolestation.js @@ -33,7 +33,7 @@ App.Events.RESSKitchenMolestation = class RESSKitchenMolestation extends App.Eve } = getNonlocalPronouns(V.seeDicks).appendSuffix('U'); const belly = bellyAdjective(eventSlave); const targetJobs = ["be a servant", "be a subordinate slave", "get milked", "learn in the schoolroom", "please you", "rest in the spa", "rest", "serve in the club", "serve the public", "take classes", "whore", "work a glory hole", "work as a servant", "work in the brothel"]; - const targetSlaves = V.slaves.filter(s => targetJobs.includes(s.assignment) && s.ID !== eventSlave.ID); + const targetSlaves = getSlaves().filter(s => targetJobs.includes(s.assignment) && s.ID !== eventSlave.ID); const PC = V.PC; App.Events.drawEventArt(node, eventSlave, "no clothing"); diff --git a/src/events/RESS/mutinyAttempt.js b/src/events/RESS/mutinyAttempt.js index 431a3c3dcfa714587a8bdd40f45a5a941557c496..8b187d592a0b5f40271e4204e755a0050eaa2e1b 100644 --- a/src/events/RESS/mutinyAttempt.js +++ b/src/events/RESS/mutinyAttempt.js @@ -307,14 +307,14 @@ App.Events.RESSMutinyAttempt = class RESSMutinyAttempt extends App.Events.BaseEv function lock() { eventSlave.trust += 10; eventSlave.chastityPenis = 1; - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust += 5; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust += 5; } }); return `You simply clamp a chastity cage onto ${his} limp dick; ${he}'ll be taking a little break from fucking girls for the time being. When ${he} comes to and finds ${himself} locked in chastity, ${he} immediately begins fiddling with it in an attempt to remove it. ${He} feels this punishment is laughable and only <span class="defiant inc">grows more defiant.</span> Word spreads through your chattel that the only downside of trying to rape ${getWrittenTitle(eventSlave)} is getting locked in chastity, <span class="defiant inc">spreading defiance</span> through your rebellious slaves.`; } function flog() { eventSlave.trust -= 15; healthDamage(eventSlave, 15); - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust -= 5; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust -= 5; } }); return `You bind ${his} naked body to the wall in preparation for a good beating. Going against one's master is bad, but going against you is even worse. You thoroughly strike ${him}, showering extra attention to ${his} crotch, while making sure ${he} will be in pain for days to come. Such a beating leaves ${him} <span class="health dec">in agonizing pain</span> and makes a clear example to ${him} and all your other rebellious slaves that <span class="trust dec">you are not to be trifled with.</span>`; } @@ -322,7 +322,7 @@ App.Events.RESSMutinyAttempt = class RESSMutinyAttempt extends App.Events.BaseEv eventSlave.trust += 5; eventSlave.devotion -= 15; eventSlave.voice = 0; - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust += 10; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust += 10; } }); cashX(forceNeg(V.surgeryCost), "slaveSurgery", eventSlave); return `As you pull ${his} limp body to the remote surgery, you notice ${he} understands what ${he} has done and begs you to reconsider your decision; but your mind is set. ${He} tried to rape you, ${he} must be silenced. Restrained as ${he} is, the most ${he} can do is cry and beg. When ${he} awakens from surgery, ${he} realizes all you did was stop ${him} from talking; <span class="defiant inc">what stops ${him} from making another go at you?</span> Your other rebellious slaves see this as a minor loss for a potentially huge gain and, if anything, <span class="defiant inc">become more defiant.</span>`; } @@ -332,7 +332,7 @@ App.Events.RESSMutinyAttempt = class RESSMutinyAttempt extends App.Events.BaseEv eventSlave.devotion -= 10; eventSlave.balls = 0; eventSlave.scrotum = 0; - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust -= 10; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust -= 10; } }); cashX(forceNeg(V.surgeryCost), "slaveSurgery", eventSlave); surgeryDamage(eventSlave, 10); return `As you pull ${his} limp body to the remote surgery, you notice ${he} understands what ${he} has done and begs you to reconsider your decision; but your mind is set. ${He} had the balls to try and rape you, and now ${he} won't. Restrained as ${he} is, the most ${he} can do is cry and beg. Once ${he} comes to after the surgery, ${he} faces ${his} new life; <span class="devotion dec">${he}'ll never get hard again</span> and ${he}'s <span class="trust dec">the only one to blame</span> for ${his} <span class="health dec">suffering.</span> Every other rebellious slave is <span class="trust dec">mortified by the example.</span>`; @@ -348,7 +348,7 @@ App.Events.RESSMutinyAttempt = class RESSMutinyAttempt extends App.Events.BaseEv eventSlave.dickAccessory = "none"; eventSlave.vagina = 1; eventSlave.chastityPenis = 0; - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust -= 15; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust -= 15; } }); cashX(forceNeg(V.surgeryCost*2), "slaveSurgery", eventSlave); surgeryDamage(eventSlave, 20); @@ -367,7 +367,7 @@ App.Events.RESSMutinyAttempt = class RESSMutinyAttempt extends App.Events.BaseEv eventSlave.scrotum = 0; eventSlave.dickAccessory = "none"; eventSlave.chastityPenis = 0; - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust -= 15; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust -= 15; } }); cashX(forceNeg(V.surgeryCost*2), "slaveSurgery", eventSlave); surgeryDamage(eventSlave, 20); return `You ask ${him} if ${he} enjoyed the last time ${he} used ${his} dick and if it was worth crossing you, because it will not happen again. Restrained as ${he} is, the most ${he} can do is cry and beg. Once ${he} comes to after the surgery, ${he} faces ${his} new body; <span class="devotion dec">${he}'s now a surgical null</span> and ${he}'s <span class="trust dec">the only one to blame</span> for ${his} <span class="health dec">suffering.</span> Every other rebellious slave is <span class="trust dec">horrified by the example.</span>`; @@ -387,7 +387,7 @@ App.Events.RESSMutinyAttempt = class RESSMutinyAttempt extends App.Events.BaseEv eventSlave.vaginalAccessory = "none"; eventSlave.vaginalAttachment = "none"; eventSlave.chastityVagina = 0; - V.slaves.forEach(function(s) { if (s.devotion < -50) { s.trust -= 15; } }); + getSlaves().forEach(function(s) { if (s.devotion < -50) { s.trust -= 15; } }); cashX(forceNeg(V.surgeryCost*4), "slaveSurgery", eventSlave); surgeryDamage(eventSlave, 20); diff --git a/src/events/RESS/obedientAddict.js b/src/events/RESS/obedientAddict.js index 6917eef9a57af4038521985e2817a5c0fdbd741e..822615c96459e07a6f40c69b2742546204389df2 100644 --- a/src/events/RESS/obedientAddict.js +++ b/src/events/RESS/obedientAddict.js @@ -83,7 +83,7 @@ App.Events.RESSObedientAddict = class RESSObedientAddict extends App.Events.Base } t.push(`For the hour or so it takes ${him} to pass out, slaves using the kitchen have to step over ${his} prostrate, orgasming body, lying in a pool of ${his} own drool, tears, sweat, and fluids. The next time you see ${him} in the kitchen, ${he} takes ${his} medicine like a <span class="gold">good ${girl}.</span> All your aphrodisiac addicts recognize the symptoms and the punishment, and <span class="gold">avoid even thinking</span> about resisting the system.`); - V.slaves.forEach(function(s) { if (s.aphrodisiacs > 0 || s.inflationType === "aphrodisiac") { s.trust -= 5; } }); + getSlaves().forEach(function(s) { if (s.aphrodisiacs > 0 || s.inflationType === "aphrodisiac") { s.trust -= 5; } }); return t; } diff --git a/src/events/RESS/review/confidentTanning.js b/src/events/RESS/review/confidentTanning.js index 2faeb2161212a72a3014527f001b0d4f56e72f27..9df415c99473c4772f1656365d07bdbaa838b352 100644 --- a/src/events/RESS/review/confidentTanning.js +++ b/src/events/RESS/review/confidentTanning.js @@ -315,7 +315,7 @@ App.Events.RESSConfidentTanning = class RESSConfidentTanning extends App.Events. } r.push(`that a slave can receive credit for finding a good thing.`); eventSlave.trust++; - V.slaves.forEach((s) => { + getSlaves().forEach((s) => { if (s.devotion > 20) { s.trust++; } }); r.toParagraph(); diff --git a/src/events/RESS/review/hugeTits.js b/src/events/RESS/review/hugeTits.js index af027551133a0f21152da524f165ac07b3f9a026..b2751e8656ed46939592ac63970f2e0413b88c4d 100644 --- a/src/events/RESS/review/hugeTits.js +++ b/src/events/RESS/review/hugeTits.js @@ -4,7 +4,7 @@ App.Events.RESSHugeTits = class RESSHugeTits extends App.Events.BaseEvent { () => V.boobAccessibility !== 1, () => V.ballsAccessibility !== 1, () => V.pregAccessibility !== 1, - () => V.slaves.length > 2, + () => getSlaves().length > 2, ]; // always valid if sufficient actors can be cast successfully } diff --git a/src/events/RESS/review/millenary.js b/src/events/RESS/review/millenary.js index fd7f18297274c9fb89f8c7e9a3e72061b48b29ab..83894d9b3f5e8f07648da697e156c76624109a10 100644 --- a/src/events/RESS/review/millenary.js +++ b/src/events/RESS/review/millenary.js @@ -37,7 +37,7 @@ App.Events.RESSMillenary = class RESSMillenary extends App.Events.BaseEvent { App.Events.addParagraph(node, [`As the Free Cities grow and evolve, slave culture does too. It seems this is a new tradition among obedient sex slaves. ${He} obviously expects you to do the honors, and it seems the rest of your slaves are looking forward to it.`]); let choices = [new App.Events.Result(`Give ${him} ${his} thousandth fuck`, fuck)]; - if (V.slaves.length > 2) { + if (getSlaves().length > 2) { choices.push(new App.Events.Result(`Include everyone in ${his} millenary`, everyone)); } if (canDoAnal(slave) && slave.counter.anal !== 0) { @@ -154,8 +154,8 @@ App.Events.RESSMillenary = class RESSMillenary extends App.Events.BaseEvent { } r.push(`gently pumping ${his} butt the whole time. When ${he}'s done, ${he} thanks you exhaustedly and begs you to do this for ${his} next millenary. <span class="devotion inc">${His} love for you has greatly increased.</span>`); slave.devotion += 10; - seX(slave, "oral", "slaves", "penetrative", (V.slaves.length * 2)); - V.slaves.forEach(function(s) { if (s.ID !== slave.ID) { s.counter.oral++; } }); + seX(slave, "oral", "slaves", "penetrative", (getSlaves().length * 2)); + getSlaves().forEach(function(s) { if (s.ID !== slave.ID) { s.counter.oral++; } }); if (canDoVaginal(slave)) { r.push(VCheck.Vaginal(slave, 1)); } else { @@ -249,8 +249,8 @@ App.Events.RESSMillenary = class RESSMillenary extends App.Events.BaseEvent { slave.devotion += 4; slave.trust += 4; seX(slave, "oral", V.PC, "penetrative"); - seX(slave, "anal", "slaves", "penetrative", V.slaves.length+1); - V.slaves.forEach(function(s) { if (s.ID !== slave.ID) { s.counter.penetrative++; } }); + seX(slave, "anal", "slaves", "penetrative", getSlaves().length + 1); + getSlaves().forEach(function(s) { if (s.ID !== slave.ID) { s.counter.penetrative++; } }); return r; } diff --git a/src/events/RESS/review/tendonFall.js b/src/events/RESS/review/tendonFall.js index 9646daee96564227fecc0eb7ffd34efd27783c54..fd0f74e924fd9423bed63c4146d0b5937a9e6683 100644 --- a/src/events/RESS/review/tendonFall.js +++ b/src/events/RESS/review/tendonFall.js @@ -1,7 +1,7 @@ App.Events.RESSTendonFall = class RESSTendonFall extends App.Events.BaseEvent { eventPrerequisites() { return [ - () => V.slaves.length > 2, + () => getSlaves().length > 2, ]; } diff --git a/src/events/RESS/review/torpedoSqueeze.js b/src/events/RESS/review/torpedoSqueeze.js index 762a38de419add6a94913c4638c1362eb253ca8e..0417eaf1b38e06b980432e22193b251fd427c7d9 100644 --- a/src/events/RESS/review/torpedoSqueeze.js +++ b/src/events/RESS/review/torpedoSqueeze.js @@ -29,7 +29,7 @@ App.Events.RESSTorpedoSqueeze = class RESSTorpedoSqueeze extends App.Events.Base const r = new SpacedTextAccumulator(node); r.push(`The penthouse bathroom has a long counter and mirror arrangement with many sinks, so a number of slaves can get ready at once. During those moments of the day when`); - if (V.slaves.length > 10) { + if (getSlaves().length > 10) { r.push(`many`); } else { r.push(`more than one`); diff --git a/src/events/assistant/assistantSP.js b/src/events/assistant/assistantSP.js index df38c28055bd841e5e83d7530ab4bbb73db755f9..d3f243cd8c0b1651c78973133d182df1719c8a08 100644 --- a/src/events/assistant/assistantSP.js +++ b/src/events/assistant/assistantSP.js @@ -21,7 +21,7 @@ App.Events.assistantSP = class assistantSP extends App.Events.BaseEvent { let r = []; V.assistant.options = 1; - const slave = V.slaves.find(s => (s.vagina > 0 || s.anus > 0) && s.rules.release.masturbation === 1) || V.slaves.random(); + const slave = getSlaves().find(s => (s.vagina > 0 || s.anus > 0) && s.rules.release.masturbation === 1) || getSlaves().random(); const {him} = getPronouns(slave); App.Events.drawEventArt(node, "assistant"); @@ -30,7 +30,7 @@ App.Events.assistantSP = class assistantSP extends App.Events.BaseEvent { App.Events.addParagraph(node, r); r = []; r.push(`${HeA} continues more seriously,`); - if (V.slaves.some(s => s.piercing.genitals.smart)) { + if (getSlaves().some(s => s.piercing.genitals.smart)) { r.push(`"You may have noticed that the smart implants you've got your slaves wearing are working a little bit better than when I was a boring old secretary type. I'm not a true artificial intelligence, but I can adapt with experience, and I've had a lot of lovely experience lately! Also, a lot of the computing power I use to be sexy helps me adapt smart piercings to individual slaves' sexualities."`); } else { r.push(`"I'm sure you've seen those expensive smart piercings the body mod studio can implant. I think they would work a little bit better now than when I was a boring old secretary type. I'm not a true artificial intelligence, but I can adapt with experience, and I've had a lot of lovely experience lately! Also, a lot of the computing power I use to be sexy would help me adapt smart piercings to individual slaves' sexualities."`); diff --git a/src/events/debugEvent.js b/src/events/debugEvent.js index 7524721ba7a31c0f2ad4370629377baf6f1d7b95..564b26418dbf27f5d38974d3e9fba0d950bcf360 100644 --- a/src/events/debugEvent.js +++ b/src/events/debugEvent.js @@ -58,7 +58,7 @@ App.Events.debugEvent = function(eventName, hostPassage) { } )); } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { let slaveDiv = App.UI.DOM.makeElement("div", App.UI.DOM.makeElement("span", SlaveFullName(slave), "slave-name")); let slaveFails = false; for (const p of actorRequirements[i]) { diff --git a/src/events/intro/acquisition.js b/src/events/intro/acquisition.js index ff8a46727ddaa65fa59c3ce44b0122eb21fbb989..6d9800668b95c7b63f0aae4ea75cefbb57e5b93a 100644 --- a/src/events/intro/acquisition.js +++ b/src/events/intro/acquisition.js @@ -6,11 +6,11 @@ App.Intro.acquisition = function() { const r = []; if (_.isArray(V.careerBonusNeeded)) { - V.slaves.filter(s => V.careerBonusNeeded.includes(s.ID)).forEach(App.StartingGirls.applyCareerBonus); + getSlaves().filter(s => V.careerBonusNeeded.includes(s.ID)).forEach(App.StartingGirls.applyCareerBonus); delete V.careerBonusNeeded; delete V.applyCareerBonus; } - V.slaves.filter(s => s.origin === "$auto").forEach(x => App.StartingGirls.playerOrigin(x).apply()); + getSlaves().filter(s => s.origin === "$auto").forEach(x => App.StartingGirls.playerOrigin(x).apply()); if (V.freshPC === 1 || V.saveImported === 0) { PCSetup(); @@ -54,7 +54,7 @@ App.Intro.acquisition = function() { } newSlave(slave); } - const {He, his, girl} = getPronouns(V.slaves.random()); + const {He, his, girl} = getPronouns(getSlaves().random()); switch (V.targetArcology.fs) { case "FSSupremacist": r.push(`They kept a personal stable of fearful ${V.arcologies[0].FSSupremacistRace} sex slaves, but their sexual training is incomplete. Several of them are still here.`); @@ -253,7 +253,7 @@ App.Intro.acquisition = function() { // Set incestuous relationship. Checking "addFamilyMember" makes sure we only do this after both family members have been added. let incestTarget = undefined; if (V.seeIncest === 1 && !addFamilyMember && secondMemberDatabaseID in incestFamilies) { - incestTarget = V.slaves.find(s => areSisters(s, slave) > 0); + incestTarget = getSlaves().find(s => areSisters(s, slave) > 0); slave.relationship = 3; slave.relationshipTarget = incestTarget.ID; incestTarget.relationship = 3; @@ -326,7 +326,7 @@ App.Intro.acquisition = function() { V.averageTrust = 0; V.averageDevotion = 0; let slavesContributing = 0; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { updateHealth(slave); slave.oldDevotion = slave.devotion; slave.oldTrust = slave.trust; @@ -411,7 +411,7 @@ App.Intro.acquisition = function() { V.PC.counter.birthMaster = 8; } } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.mother === -1) { V.PC.counter.birthsTotal++; if (slave.father === -1) { @@ -423,7 +423,7 @@ App.Intro.acquisition = function() { } } } else if (isPCCareerInCategory("escort")) { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.mother === -1) { V.PC.counter.birthsTotal++; if (slave.father === -1) { @@ -437,7 +437,7 @@ App.Intro.acquisition = function() { } } } else { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.mother === -1) { V.PC.counter.birthsTotal++; if (slave.father === -1) { @@ -555,17 +555,17 @@ App.Intro.acquisition = function() { } } checkMissingParents(V.PC); - V.slaves.forEach(checkMissingParents); + getSlaves().forEach(checkMissingParents); } function PCChildrenCount() { let PCPregnancies = []; let SPregnancies = []; let birthData = ""; - V.slaves.forEach(function(s) { + getSlaves().forEach(function(s) { PCPregnancies = []; SPregnancies = []; - V.slaves.filter(s0 => s0.newGamePlus === 0).forEach(function(s1) { + getSlaves().filter(s0 => s0.newGamePlus === 0).forEach(function(s1) { if (s1.father === s.ID && s1.mother === -1) { birthData = s1.actualAge + " " + s1.birthWeek + " " + s1.father; if (!PCPregnancies.includes(birthData)) { @@ -592,7 +592,7 @@ App.Intro.acquisition = function() { function inbreedingCalc() { const coeffSlaves = []; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.newGamePlus === 0) { slave.inbreedingCoeff = -1; getGenePoolRecord(slave, false, true).inbreedingCoeff = -1; diff --git a/src/events/intro/newGamePlusPassage.js b/src/events/intro/newGamePlusPassage.js index f2b27c4f23d9903b776116f85fa32c0a1e262123..3b2c31e620f4d6952d8d14265d107a2887b726b8 100644 --- a/src/events/intro/newGamePlusPassage.js +++ b/src/events/intro/newGamePlusPassage.js @@ -80,7 +80,7 @@ App.Intro.newGamePlus = function() { App.UI.DOM.appendNewElement("div", node, App.UI.DOM.link( "DEBUG: Add all slaves to import list", () => { - V.slaves.forEach(s => assignJob(s, Job.IMPORTED)); + getSlaves().forEach(s => assignJob(s, Job.IMPORTED)); App.UI.reload(); } )); diff --git a/src/events/intro/takeoverTarget.js b/src/events/intro/takeoverTarget.js index a69a399b99809bc1ed4d92233e6d635da4d01db3..0f9d18c0655a240d5fefc5541029ba20219067be 100644 --- a/src/events/intro/takeoverTarget.js +++ b/src/events/intro/takeoverTarget.js @@ -1,7 +1,7 @@ // cSpell:ignore maskirovka App.Intro.takeoverTarget = function() { - const slavesImported = V.slaves.filter(s => s.newGamePlus === 1); + const slavesImported = getSlaves().filter(s => s.newGamePlus === 1); if (slavesImported.length > 0) { V.retirementAge = Math.max(V.retirementAge, _.max(slavesImported.map(s => s.actualAge)) + 2); const highestActualAge = _.max(slavesImported.map(s => s.actualAge)); diff --git a/src/events/nonRandom/daughters/pUndergroundRailroad.js b/src/events/nonRandom/daughters/pUndergroundRailroad.js index b1fc03872f825196ef6274b136462d074170f4d4..9f1d894e0333d352b12a027adb700709929739b1 100644 --- a/src/events/nonRandom/daughters/pUndergroundRailroad.js +++ b/src/events/nonRandom/daughters/pUndergroundRailroad.js @@ -249,7 +249,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. (s) => s.trust < 75, ]; let rankedSlaves = []; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { let value = 0; for (const quality of qualities) { if (quality(slave)) { @@ -305,7 +305,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. if (V.PC.father === V.traitor.ID) { V.traitorStats.PCfather = V.traitor.ID; } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.ID !== V.traitor.ID) { if (slave.mother === V.traitor.ID) { V.traitorStats.traitorMother.push(slave.ID); @@ -341,7 +341,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. V.traitor.sisters = 0; V.traitor.daughters = 0; if (V.traitor.bodySwap > 0) { - const myBody = V.slaves.find(s => s.origBodyOwnerID === traitor.ID); + const myBody = getSlaves().find(s => s.origBodyOwnerID === traitor.ID); if (myBody) { V.traitorStats.traitorBody = myBody.ID; } @@ -369,7 +369,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. let r = []; unlock(); r.push(`${traitor.slaveName} nods ${his} head in acceptance. There is too much at stake to take such a risk. All attempts to use your monitoring systems to find the citizens who contacted ${him} fail; it seems their ability to corrupt your systems is considerable. ${He} keeps ${his} lips shut tight in an effort to prevent rumors from spreading, but <span class="devotion dec">whispers of freedom</span> still manage to run through your chattel.`); - V.slaves.filter(desiresFreedom).forEach(s => s.devotion -= 5); + getSlaves().filter(desiresFreedom).forEach(s => s.devotion -= 5); App.Events.addParagraph(frag, r); return frag; } @@ -378,7 +378,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. const frag = new DocumentFragment(); let r = []; unlock(); - r.push(`You decide to release ${him} into the streets and keep an eye on ${him}. ${He} is quickly scooped up by several citizens, some of which you recognize from the earlier video, and taken away. There is a plot in motion against you, and it extends worringly deep into your domain.`); + r.push(`You decide to release ${him} into the streets and keep an eye on ${him}. ${He} is quickly scooped up by several citizens, some of which you recognize from the earlier video, and taken away. There is a plot in motion against you, and it extends worryingly deep into your domain.`); sendTraitor(); App.Events.addParagraph(frag, r); return frag; @@ -389,7 +389,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. let r = []; unlock(); r.push(`You see no reason to humor them. All attempts to use your monitoring systems to find the citizens who visited ${traitor.slaveName} fail; it seems their ability to corrupt your systems is considerable. While ${he} doesn't talk, <span class="devotion dec">whispers of freedom</span> still manage to run through your chattel.`); - V.slaves.filter(desiresFreedom).forEach(s => s.devotion -= 5); + getSlaves().filter(desiresFreedom).forEach(s => s.devotion -= 5); App.Events.addParagraph(frag, r); return frag; } @@ -420,7 +420,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. r.push(`${traitor.slaveName} almost <span class="devotion dec">faints with relief</span> when it becomes apparent you aren't going to punish ${him} for speaking of freedom.`); } r.push(`All attempts to use your monitoring systems to find the citizens who contacted ${him} fail; it seems their ability to corrupt your systems is considerable. <span class="devotion dec">Whispers of freedom</span> run like wildfire amongst your slaves.`); - V.slaves.filter(desiresFreedom).forEach(s => s.devotion -= 10); + getSlaves().filter(desiresFreedom).forEach(s => s.devotion -= 10); traitor.devotion -= 15; newRumor.weakness(); App.Events.addParagraph(frag, r); @@ -471,7 +471,7 @@ App.Events.PUndergroundRailroad = class PUndergroundRailroad extends App.Events. } r.push(`The populace understands the necessity of the punishment, though they are <span class="reputation dec">disturbed</span> that such a thing could happen in your penthouse of all places. The surviving slaves are <span class="trust dec">terrified</span> at the display, but at least you can be sure they will remember the price of failing you.`); repX(-500, "event", traitor); - V.slaves.forEach(function(s) { + getSlaves().forEach(function(s) { s.trust -= 10 + random(10); }); removeSlave(traitor); diff --git a/src/events/nonRandom/mercs/pMercenaryRomeo.js b/src/events/nonRandom/mercs/pMercenaryRomeo.js index 9652f0dd255b6e84c15446126ea6be0949208690..5324905be4b202cbf4ad5f6f4710f208430616b1 100644 --- a/src/events/nonRandom/mercs/pMercenaryRomeo.js +++ b/src/events/nonRandom/mercs/pMercenaryRomeo.js @@ -12,9 +12,9 @@ App.Events.PMercenaryRomeo = class PMercenaryRomeo extends App.Events.BaseEvent this.actors = []; const juliet = // first try - find an available sex worker - V.slaves.filter(s => s.fetish !== Fetish.MINDBROKEN && s.fuckdoll === 0 && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment)).random() || + getSlaves().filter(s => s.fetish !== Fetish.MINDBROKEN && s.fuckdoll === 0 && ["serve in the club", "serve the public", "whore", "work in the brothel"].includes(s.assignment)).random() || // second try - find a slave who had public exposure and is hopefully not important to the PC personally - V.slaves.filter(s => (s.counter.publicUse > 0) && (s.newGamePlus === 0) && (s.relationship > -3) && !["be your Concubine", "serve in the master suite"].includes(s.assignment)).random(); + getSlaves().filter(s => (s.counter.publicUse > 0) && (s.newGamePlus === 0) && (s.relationship > -3) && !["be your Concubine", "serve in the master suite"].includes(s.assignment)).random(); if (juliet) { this.actors.push(juliet.ID); return true; diff --git a/src/events/nonRandom/pBadBreasts.js b/src/events/nonRandom/pBadBreasts.js index f3c7db1924a1cc544d2379088a8d5c57e6d05204..e03d08abc14c081a0800508c812014d482d66947 100644 --- a/src/events/nonRandom/pBadBreasts.js +++ b/src/events/nonRandom/pBadBreasts.js @@ -23,9 +23,9 @@ App.Events.pBadBreasts = class pBadBreasts extends App.Events.BaseEvent { const [slave] = this.actors.map(a => getSlave(a)); const {He, him} = getPronouns(slave); - cashX(500 * V.slaves.length, "event"); + cashX(500 * getSlaves().length, "event"); V.badB = 1; - V.slaves.forEach(function(s) { + getSlaves().forEach(function(s) { if (["breast injections", "hyper breast injections", "intensive breast injections"].includes(s.drugs)) { healthDamage(s, Math.floor(Math.random() * 2 + 1)); } @@ -49,7 +49,7 @@ App.Events.pBadBreasts = class pBadBreasts extends App.Events.BaseEvent { return node; function keepPreg() { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.drugs.includes("breast injections")) { const isIntense = slave.drugs.includes("intensive"); const isHyper = slave.drugs.includes("hyper"); @@ -127,12 +127,12 @@ App.Events.pBadBreasts = class pBadBreasts extends App.Events.BaseEvent { } function wantMoney() { - cashX(2000 * V.slaves.length, "event"); + cashX(2000 * getSlaves().length, "event"); return `You muster all the contractual remedies available to you and join the crowd of slaveowners laying into the hapless manufacturer. Of course, with so many attackers, there is as much infighting between them as conflict with the helpless enemy, since everyone knows the business will go bankrupt before everyone gets paid. Nevertheless you <span class="cash inc">approximately double</span> the money you make out of the situation, plenty to deal with the pregnancies.`; } function repair() { - for (const s of V.slaves) { + for (const s of getSlaves()) { if (canGetPregnant(s)) { if (s.drugs === "breast injections") { if (s.geneMods.NCS > 0) { diff --git a/src/events/nonRandom/pBadCuratives.js b/src/events/nonRandom/pBadCuratives.js index aadb504a9d18c75dda9960bf99c71785ecbd1fe7..69c98536afc5a1f949a1e999c78c3ddca4fb51a8 100644 --- a/src/events/nonRandom/pBadCuratives.js +++ b/src/events/nonRandom/pBadCuratives.js @@ -21,7 +21,7 @@ App.Events.pBadCuratives = class pBadCuratives extends App.Events.BaseEvent { const [slave] = this.actors.map(a => getSlave(a)); const {He, him} = getPronouns(slave); - cashX(500 * V.slaves.length, "event"); + cashX(500 * getSlaves().length, "event"); V.badC = 1; let r = []; r.push(`Early one morning, you hear convulsive dry heaving coming from one of the bathrooms. On investigation, it seems that ${slave.slaveName} woke up feeling terribly nauseous. ${He}'s in no danger, but you've hardly checked ${him} over before more slaves stagger in. Every one of your slaves on curatives has been struck by the mysterious malady and has <span class="health dec">sickened.</span>`); @@ -42,7 +42,7 @@ App.Events.pBadCuratives = class pBadCuratives extends App.Events.BaseEvent { return node; function freeGrowth() { - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.curatives > 1) { if (s.geneMods.NCS > 0) { s.boobs += Math.floor(Math.random() * 10 + 1) * 50; @@ -68,7 +68,7 @@ App.Events.pBadCuratives = class pBadCuratives extends App.Events.BaseEvent { } function wantMoney() { - cashX(500 * V.slaves.length, "event"); + cashX(500 * getSlaves().length, "event"); return `You muster all the contractual remedies available to you and join the crowd of slaveowners laying into the hapless manufacturer. Of course, with so many attackers, there is as much infighting between them as conflict with the helpless enemy, since everyone knows the business will go bankrupt before everyone gets paid. Nevertheless you <span class="cash inc">approximately double</span> the money you make out of the situation.`; } diff --git a/src/events/nonRandom/pLoanshark.js b/src/events/nonRandom/pLoanshark.js index 0af998a46bef67cac6b7eaaffaabca2b0f699487..e1b0128efaf21e2d3b130a7d86c526770f505d62 100644 --- a/src/events/nonRandom/pLoanshark.js +++ b/src/events/nonRandom/pLoanshark.js @@ -17,7 +17,7 @@ App.Events.pLoanshark = class pLoanshark extends App.Events.BaseEvent { V.cash > loan.full ? new App.Events.Result(`Pay the man`, pay) : new App.Events.Result(null, null, `You do not have enough cash to pay the loan back`), - V.slaves.some(slave => slaveCost(slave) > loan.full) + getSlaves().some(slave => slaveCost(slave) > loan.full) ? new App.Events.Result(`Offer one of your slaves instead`, slave) : new App.Events.Result(null, null, `You do not have any slaves valuable enough to cover the loan`), new App.Events.Result(`Refuse`, refuse) @@ -47,7 +47,7 @@ App.Events.pLoanshark = class pLoanshark extends App.Events.BaseEvent { frag.append(`Choose a slave to send with the group:`); - V.slaves + getSlaves() .filter(slave => slaveCost(slave) > loan.full) .sort((a, b) => slaveCost(a) - slaveCost(b)) .forEach(slave => { @@ -74,7 +74,7 @@ App.Events.pLoanshark = class pLoanshark extends App.Events.BaseEvent { function refuse() { const text = []; - if (V.cash > loan.full || V.slaves.some(slave => slaveCost(slave) > loan.full)) { + if (V.cash > loan.full || getSlaves().some(slave => slaveCost(slave) > loan.full)) { text.push(`You simply give the man a cold smile and cross your arms, a clear signal of defiance and refusal. The envoy gives a subtle signal to one of his compatriots, and the large soldier takes a step forward, restraints in hand. "As you know," the representative begins, "Anyone with significant enough debt is subject to enslavement, and the contract you signed with my employer states that you are now a slave. You're coming with us."`); } else { text.push(`Unfortunately, you're in a little over your head – you have neither the cash needed, nor any slaves valuable enough to cover the cost. Upon hearing this, the envoy nods, his face expressionless. "As you know," he starts, "Anyone with significant enough debt is subject to enslavement, and the contract you signed with my employer states that you are now a slave. You're coming with us."`); diff --git a/src/events/nonRandom/rival/pRivalInitiation.js b/src/events/nonRandom/rival/pRivalInitiation.js index d83e355010ed6531d2a892f32b4b5913fe2cb474..36ed99c8aba56d5fc006815911f943ce004a6eb4 100644 --- a/src/events/nonRandom/rival/pRivalInitiation.js +++ b/src/events/nonRandom/rival/pRivalInitiation.js @@ -68,15 +68,15 @@ App.Events.PRivalInitiation = class PRivalInitiation extends App.Events.BaseEven let r = []; const { his2, him2, - } = getPronouns(V.slaves[1]).appendSuffix("2"); - r.push(`${V.slaves[0].slaveName} leads ${him} out into the arcology's largest atrium, forces ${him} to`); + } = getPronouns(getSlaves()[1]).appendSuffix("2"); + r.push(`${getSlaves()[0].slaveName} leads ${him} out into the arcology's largest atrium, forces ${him} to`); if (hasBothLegs(slave)) { r.push(`${his} knees,`); } else { r.push(`the ground,`); } - r.push(`and, in full view of the whole arcology, orally rapes someone who was until this week a slaveowner ${himself}. Behind them, ${V.slaves[1].slaveName} is standing ready for ${his2} turn, and all your other slaves stand behind ${him2}. Public opinion is divided; the precedent is universally agreed to be bad, but the punishment is generally thought to be terrible and deserved. Your slaves, however, are almost insufferably <span class="hotpink">pleased with you</span> for forcing ${slave.slaveName}, whom they still view as a slaveowner, to pleasure them.`); - V.slaves.forEach(s => { + r.push(`and, in full view of the whole arcology, orally rapes someone who was until this week a slaveowner ${himself}. Behind them, ${getSlaves()[1].slaveName} is standing ready for ${his2} turn, and all your other slaves stand behind ${him2}. Public opinion is divided; the precedent is universally agreed to be bad, but the punishment is generally thought to be terrible and deserved. Your slaves, however, are almost insufferably <span class="hotpink">pleased with you</span> for forcing ${slave.slaveName}, whom they still view as a slaveowner, to pleasure them.`); + getSlaves().forEach(s => { seX(slave, "oral", s); s.devotion += 10; }); diff --git a/src/events/scheduled/burst/burst.js b/src/events/scheduled/burst/burst.js index 4fd5ee214cb95336bbfb05084feee0416bd410e7..4a96589d66552feddf841a0c5a5431d55c752907 100644 --- a/src/events/scheduled/burst/burst.js +++ b/src/events/scheduled/burst/burst.js @@ -5,7 +5,7 @@ App.Events.SEBurst = class SEBurst extends App.Events.BaseEvent { /** Custom casting: all bursting slaves are cast automatically. If no slaves are cast, casting fails and the event does not run. */ castActors() { - this.actors = V.slaves.filter(s => burstCheck(s)).map(s => s.ID); + this.actors = getSlaves().filter(s => burstCheck(s)).map(s => s.ID); return this.actors.length > 0; } @@ -157,7 +157,7 @@ globalThis.horrifiedSlaves = function(slave) { el.append(`Word of the late slave and ${his} gruesome fate spread fast, `); App.UI.DOM.appendNewElement("span", el, "terrifying", "gold"); el.append(` your untrusting slaves.`); - for (const bystander of V.slaves) { + for (const bystander of getSlaves()) { if (bystander.trust <= 50) { if (slave.inflation > 0) { bystander.trust -= (Math.pow(slave.inflation, 3) * 5); diff --git a/src/events/schools/resFailure.js b/src/events/schools/resFailure.js index 4ec6e819073fc02eeaa4c86121441c869efb2c41..d91e76478b6843abca8cfb403fdd70f8a462ec6f 100644 --- a/src/events/schools/resFailure.js +++ b/src/events/schools/resFailure.js @@ -269,7 +269,7 @@ App.Events.RESFailure = class RESFailure extends App.Events.BaseEvent { let r = []; const isMatron = (s) => (s.origin === "$He was the leader of your arcology's Futanari Sisters until you engineered $his community's failure and enslavement.") && (s.newGamePlus !== 1); // player can choose "Rape her" before or after the other choices...if she's not been enslaved yet, alter her template instead - const matron = V.slaves.find(isMatron) || slaveArray.find(isMatron); + const matron = getSlaves().find(isMatron) || slaveArray.find(isMatron); matron.devotion += 10; seX(matron, "anal", V.PC, "penetrative"); seX(matron, "vaginal", V.PC, "penetrative"); diff --git a/src/facilities/dairy/dairyReportUtilities.js b/src/facilities/dairy/dairyReportUtilities.js index 0ec04674de12890ce4bd72c52d560eaa629d4eba..45c4409ed42ddf5cd17ac0e8f06b37f6673a0719 100644 --- a/src/facilities/dairy/dairyReportUtilities.js +++ b/src/facilities/dairy/dairyReportUtilities.js @@ -3,7 +3,7 @@ App.Facilities.Dairy.inflation = function() { milk: 0, cum: 0 }; - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.inflationMethod === 1 || s.inflationMethod === 2) { if (s.inflationType === "milk") { inflatedSlaves.milk++; diff --git a/src/facilities/dairy/freeRangeDairyAssignmentScene.js b/src/facilities/dairy/freeRangeDairyAssignmentScene.js index b9c1d7f3da08898b7514957a64fc1f56aa693682..e364205314e14ee1234dfb34a81c279955727feb 100644 --- a/src/facilities/dairy/freeRangeDairyAssignmentScene.js +++ b/src/facilities/dairy/freeRangeDairyAssignmentScene.js @@ -33,7 +33,7 @@ App.Facilities.Dairy.freeRangeAssignmentScene = function(slave) { r.push(`to ${his} designated stall, ${he} passes the other cows currently at their milking machines. Not being hurried, ${he} occasionally watches a cow in detail.`); App.Events.addParagraph(node, r); r = []; - if (slave.fetish === "boobs" && V.slaves.filter(s => s.assignment === Job.DAIRY && s.lactation > 0).length > 0) { + if (slave.fetish === "boobs" && getSlaves().filter(s => s.assignment === Job.DAIRY && s.lactation > 0).length > 0) { aroused = true; r.push(`${He} cannot help but to feel aroused at the view of all those udders being thoroughly milked.`); if (slave.sexualFlaw === "breast growth") { @@ -55,7 +55,7 @@ App.Facilities.Dairy.freeRangeAssignmentScene = function(slave) { App.Events.addParagraph(node, r); r = []; - const cow = V.slaves.find(s => s.assignment === Job.DAIRY && s.ID !== slave.ID && s.balls >= 10 && s.dick > 0); + const cow = getSlaves().find(s => s.assignment === Job.DAIRY && s.ID !== slave.ID && s.balls >= 10 && s.dick > 0); if (cow) { const { He2, His2, diff --git a/src/facilities/dressingRoom/dressingRoom.js b/src/facilities/dressingRoom/dressingRoom.js index adb9562de53f362b67da0605db9ce9fdab801960..68250d553816d485211b7d447022fbe082c61786 100644 --- a/src/facilities/dressingRoom/dressingRoom.js +++ b/src/facilities/dressingRoom/dressingRoom.js @@ -8,7 +8,7 @@ App.UI.DressingRoom.render = function() { // If modelId isn't set or the model no longer exists, set it from existing slaves if (!App.UI.DressingRoom.modelId || !getSlave(App.UI.DressingRoom.modelId)) { // If favorites exist, choose from them, otherwise choose from all slaves - const defaultModelChoices = V.favorites?.length ? V.favorites.map(slaveId => getSlave(slaveId)) : V.slaves; + const defaultModelChoices = V.favorites?.length ? V.favorites.map(slaveId => getSlave(slaveId)) : getSlaves(); const defaultModel = defaultModelChoices.sort((a, b) => Beauty(b) - Beauty(a))[0]; App.UI.DressingRoom.modelId = defaultModel?.ID; } @@ -33,7 +33,7 @@ App.UI.DressingRoom.render = function() { } App.UI.DOM.appendNewElement('p', el, `${SlaveFullName(model)} is the model.`); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { const div = App.UI.DOM.appendNewElement("div", el, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); div.append(" ", App.UI.DOM.link( "Select", diff --git a/src/facilities/farmyard/food/food.js b/src/facilities/farmyard/food/food.js index 970846d5e3f300893ff1e5d1b8ac3a75bb66c5d8..40cdbee4388ea78df899d1010b8a466cdeab8d39 100644 --- a/src/facilities/farmyard/food/food.js +++ b/src/facilities/farmyard/food/food.js @@ -151,7 +151,7 @@ App.Facilities.Farmyard.foodConsumption = function(target = 'both') { function slaveConsumption() { let total = 0; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { let amount = 8; if (slave.diet === "restricted") { diff --git a/src/facilities/farmyard/food/foodMarket.js b/src/facilities/farmyard/food/foodMarket.js index 1c433b893280a4717843066ba0d3e8756abb3830..f8709e2080bd23cd1beb9d875b680d3db73e4275 100644 --- a/src/facilities/farmyard/food/foodMarket.js +++ b/src/facilities/farmyard/food/foodMarket.js @@ -107,9 +107,9 @@ App.UI.foodMarket.foodStorageDescription = () => { if (V.mods.food.enabled && V.eventResults.foodCrisis) { if (foodAvailable > consumption) { - text.push(`This is enough to provide for ${numberWithPluralOne(V.slaves.length, `slave`)} and ${numberWithPluralOne(citizens, `citizen`)} for about ${years(Math.trunc(foodAvailable / consumption))}.`); + text.push(`This is enough to provide for ${numberWithPluralOne(getSlaves().length, `slave`)} and ${numberWithPluralOne(citizens, `citizen`)} for about ${years(Math.trunc(foodAvailable / consumption))}.`); } else if (foodAvailable < consumption) { - text.push(`You will need an additional ${massFormat(consumption - foodAvailable)} to provide for ${numberWithPluralOne(V.slaves.length, `slave`)} and ${numberWithPluralOne(citizens, `citizen`)} during the upcoming week.`); + text.push(`You will need an additional ${massFormat(consumption - foodAvailable)} to provide for ${numberWithPluralOne(getSlaves().length, `slave`)} and ${numberWithPluralOne(citizens, `citizen`)} during the upcoming week.`); } } diff --git a/src/facilities/incubator/incubatorInteract.js b/src/facilities/incubator/incubatorInteract.js index bfa98b76856eefda9a2f6195d527b90628f1a8af..83876c9563d85dc9f60be876ee822a7bca3b1f50 100644 --- a/src/facilities/incubator/incubatorInteract.js +++ b/src/facilities/incubator/incubatorInteract.js @@ -188,7 +188,7 @@ App.UI.incubator = function() { ["Number of Children", "data-preg-count"], ]); - if (V.slaves.length > 0) { + if (getSlaves().length > 0) { /** * @param {Map<string, string>} sortingOptions */ @@ -225,7 +225,7 @@ App.UI.incubator = function() { } const qlIncubator = document.createElement("div"); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.preg > 0 && slave.pregKnown === 1 && slave.eggType === "human") { const r = []; const reserveDisallowed = (slave.assignment === Job.DAIRY && V.dairyPregSetting > 0) || slave.assignment === Job.AGENT || slave.assignment === Job.AGENTPARTNER; @@ -490,7 +490,7 @@ App.UI.incubator = function() { App.UI.DOM.link( "Clear all reserved children", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (WombReserveCount(slave, "incubator") !== 0) { WombCleanGenericReserve(slave, 'incubator', 9999); } diff --git a/src/facilities/nursery/nursery.js b/src/facilities/nursery/nursery.js index fe548bf0a95096d137d742804a03d61b896378a1..eea471a1a6d91de007f49a18b82c74e6d0651c89 100644 --- a/src/facilities/nursery/nursery.js +++ b/src/facilities/nursery/nursery.js @@ -337,7 +337,7 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { ["Number of Children", "data-preg-count"], ]); - if (V.slaves.length > 0) { + if (getSlaves().length > 0) { /** * @param {Map<string, string>} sortingOptions */ @@ -374,7 +374,7 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { } const qlNursery = document.createElement("div"); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.preg > 0 && slave.pregKnown === 1 && slave.eggType === "human") { const r = []; const reserveDisallowed = (slave.assignment === Job.DAIRY && V.dairyPregSetting > 0) || slave.assignment === Job.AGENT || slave.assignment === Job.AGENTPARTNER; @@ -742,7 +742,7 @@ App.Facilities.Nursery.nursery = class Nursery extends App.Facilities.Facility { App.UI.DOM.link( "Clear all reserved children", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (WombReserveCount(slave, "incubator") !== 0) { WombCleanGenericReserve(slave, 'incubator', 9999); } diff --git a/src/facilities/nursery/nurseryDatatypeCleanup.js b/src/facilities/nursery/nurseryDatatypeCleanup.js index 70808cba1d7344c34aa36808cbc5df6046a597c5..5975cced18beb25513048603bf9fa6e57fc969ce 100644 --- a/src/facilities/nursery/nurseryDatatypeCleanup.js +++ b/src/facilities/nursery/nurseryDatatypeCleanup.js @@ -529,7 +529,7 @@ App.Facilities.Nursery.InfantDatatypeCleanup = function(child) { // old versions of FC assign overlapping IDs to infants and other slaves, which needs to be fixed // resolve conflicting IDs between infants and older children/tank babies/adults by reassigning the infant's ID if (V.cribs.find((s) => s.ID === child.ID && (s.birthWeek !== child.birthWeek || s.actualAge !== child.actualAge)) !== undefined || - V.slaves.find((s) => s.ID === child.ID) !== undefined || (V.incubator.tanks.find((s) => s.ID === child.ID) !== undefined)) { + getSlaves().find((s) => s.ID === child.ID) !== undefined || (V.incubator.tanks.find((s) => s.ID === child.ID) !== undefined)) { child.ID = generateSlaveID(); } diff --git a/src/facilities/nursery/utils/nurseryUtils.js b/src/facilities/nursery/utils/nurseryUtils.js index c4718bc65afdfc445c52984fccbb5f07f640bd7e..02b0bc1d5dd6b7d836393c1d6cb0bdadee6d4ebd 100644 --- a/src/facilities/nursery/utils/nurseryUtils.js +++ b/src/facilities/nursery/utils/nurseryUtils.js @@ -429,7 +429,6 @@ App.Facilities.Nursery.removeChild = function removeChild(index) { */ App.Facilities.Nursery.nurserySort = function nurserySort() { const PC = V.PC; - const SL = V.slaves.length; const arcology = V.arcologies[0]; const freeCribs = (V.nurseryCribs - V.cribs.length); @@ -448,7 +447,7 @@ App.Facilities.Nursery.nurserySort = function nurserySort() { r += `<div id="ql-nursery">`; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { const {His, his} = getPronouns(slave); if (slave.preg > 0 && !slave.broodmother && slave.pregKnown && slave.eggType === "human") { @@ -633,7 +632,7 @@ App.Facilities.Nursery.nurserySort = function nurserySort() { if (reservedChildrenNursery || nurseryHasReservedChildren) { r += `<br>`; - r += App.UI.passageLink("Clear all reserved children", "Nursery", `${V.slaves.forEach((slave) => WombCleanGenericReserve(slave, "nursery", 9999))}, ${WombCleanGenericReserve(PC, "nursery", 9999)}`); + r += App.UI.passageLink("Clear all reserved children", "Nursery", `${getSlaves().forEach((slave) => WombCleanGenericReserve(slave, "nursery", 9999))}, ${WombCleanGenericReserve(PC, "nursery", 9999)}`); } function byName() { diff --git a/src/facilities/penthouse/penthouseFramework.js b/src/facilities/penthouse/penthouseFramework.js index 91bfe5848cb41973aa013bf123ae9954a4deb026..ceb90bacfda81b35b2fcb8a8c1ff0f92c37635b6 100644 --- a/src/facilities/penthouse/penthouseFramework.js +++ b/src/facilities/penthouse/penthouseFramework.js @@ -139,7 +139,7 @@ App.Entity.Facilities.PenthouseJobs = { assignmentLinkElement(ID, passage, callback, linkText) { linkText = linkText || this.desc.position; - return App.UI.DOM.assignmentLink(slaveStateById(ID), this.desc.assignment, "Subordinate Targeting", + return App.UI.DOM.assignmentLink(getSlave(ID), this.desc.assignment, "Subordinate Targeting", (slave, assignment) => { if (callback) { callback(slave, assignment); diff --git a/src/facilities/pit/pitWorkaround.js b/src/facilities/pit/pitWorkaround.js index 411bc93a7f07a10305f490ede139773d1f2e1932..96dbf7c74d4be371dd8bd1043cdd88c614fea3bf 100644 --- a/src/facilities/pit/pitWorkaround.js +++ b/src/facilities/pit/pitWorkaround.js @@ -39,7 +39,7 @@ App.Facilities.Pit.workaround = function() { App.UI.DOM.appendNewElement("div", grid, "Slave"); App.UI.DOM.appendNewElement("div", grid, "Deadliness"); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { const div = document.createElement("div"); if (V.pit.slavesFighting.includes(slave.ID)) { div.append("Assign"); diff --git a/src/facilities/servantsQuarters/servantsQuarters.js b/src/facilities/servantsQuarters/servantsQuarters.js index f9a714bab380977e9e56945352d9239127a2bf3d..611912f47f9d2effd0df776fce0cbc27add94ae5 100644 --- a/src/facilities/servantsQuarters/servantsQuarters.js +++ b/src/facilities/servantsQuarters/servantsQuarters.js @@ -149,20 +149,21 @@ App.Facilities.ServantsQuarters.servantsQuarters = class ServantsQuarters extend /** @returns {HTMLDivElement} */ get staffing() { const div = document.createElement("div"); + const slavesLength = getSlaves().length; div.append(`Your household servants are `); const capacity = totalServantCapacity(); - if (capacity > V.slaves.length * 1.5) { + if (capacity > slavesLength * 1.5) { div.append(`frankly more numerous than you really need at this point, and some have to be occupied with unproductive "busy work." You should consider reassigning some to other tasks.`); - } else if (capacity >= V.slaves.length * 0.95) { + } else if (capacity >= slavesLength * 0.95) { div.append(`capable of adequately cleaning your facilities and seeing to your slaves, without having too much idle time. You have neither too many nor too few.`); - } else if (capacity >= V.slaves.length * 0.5) { + } else if (capacity >= slavesLength * 0.5) { div.append(`constantly busy, and could probably use a little more help.`); } else { div.append(`severely understaffed. Assigning additional slaves would yield financial benefits.`); } - div.append(` They can currently help reduce the maintenance of up to ${num(capacity)} slaves, and you have ${num(V.slaves.length)}.`); + div.append(` They can currently help reduce the maintenance of up to ${num(capacity)} slaves, and you have ${num(slavesLength)}.`); return div; } diff --git a/src/facilities/studio/studio.js b/src/facilities/studio/studio.js index bda2b42639c700c0afd8526c8590510280a1dd4b..b2465d16f38cf63692ac8a7f60e31558c04f32e6 100644 --- a/src/facilities/studio/studio.js +++ b/src/facilities/studio/studio.js @@ -72,7 +72,7 @@ App.UI.mediaStudio = function() { type: genre.type.name, }); } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.porn.feed) { summary.actors++; if (slave.porn.spending > 0) { @@ -96,7 +96,7 @@ App.UI.mediaStudio = function() { } } } - r.push(`${num(summary.actors)} of your ${num(V.slaves.length)} slaves are currently featured in porn. You are spending a total of ${cashFormatColor(summary.totalCost)} promoting ${num(summary.promoted)} of them.`); + r.push(`${num(summary.actors)} of your ${num(getSlaves().length)} slaves are currently featured in porn. You are spending a total of ${cashFormatColor(summary.totalCost)} promoting ${num(summary.promoted)} of them.`); r.toParagraph(); App.UI.DOM.appendNewElement("h2", t, `Genre Coverage`); @@ -239,16 +239,15 @@ App.UI.mediaStudio = function() { } // just dump them all into one giant list for now. TODO: sorting and filtering might come later? - const slaves = V.slaves; let batchRenderer = null; if ((V.seeImages === 1) && (V.seeSummaryImages === 1)) { - batchRenderer = new App.Art.SlaveArtBatch(slaves.map(s => s.ID), 1); + batchRenderer = new App.Art.SlaveArtBatch(getSlaves().map(s => s.ID), 1); t.appendChild(batchRenderer.writePreamble()); } else { batchRenderer = null; } - for (const slave of slaves) { + for (const slave of getSlaves()) { const slaveDiv = document.createElement("div"); slaveDiv.id = `slave-${slave.ID}`; slaveDiv.classList.add("slaveSummary"); diff --git a/src/facilities/surgery/multiImplant.js b/src/facilities/surgery/multiImplant.js index e35f5de192a757ae2ba399d06c64babcd81d1a94..5490a5758ca7e16378ccca4220c49c2b9544532e 100644 --- a/src/facilities/surgery/multiImplant.js +++ b/src/facilities/surgery/multiImplant.js @@ -6,7 +6,7 @@ App.UI.multipleOrganImplant = function() { App.UI.DOM.appendNewElement("h1", node, "Implant Prosthetics"); /* prosthetics */ - for (const slave of V.slaves) { + for (const slave of getSlaves()) { /* count for estimating health impact */ const prostheticCount = V.adjustProsthetics.filter(p => p.slaveID === slave.ID && p.workLeft <= 0).length; @@ -327,7 +327,7 @@ App.UI.multipleOrganImplant = function() { const f = new DocumentFragment(); let F = App.Medicine.OrganFarm; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { let sortedOrgans = F.getSortedOrgans(slave); if (sortedOrgans.length === 0) { continue; diff --git a/src/facilities/toyShop/toyShop.js b/src/facilities/toyShop/toyShop.js index 795e094a1b405e8e549ce037b5a5199fba928c56..d6055b4135c1dd36a0c44b6564448311f3923c7e 100644 --- a/src/facilities/toyShop/toyShop.js +++ b/src/facilities/toyShop/toyShop.js @@ -162,7 +162,7 @@ App.UI.toyShop = function() { function deleteVA() { V.customItem.vaginalAccessory.delete(vaginalAcc.name); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.vaginalAccessory === vaginalAcc.name) { slave.vaginalAccessory = "none"; } @@ -261,7 +261,7 @@ App.UI.toyShop = function() { function deletePlug() { V.customItem.buttplug.delete(buttPlug.name); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.buttplug === buttPlug.name) { slave.buttplug = "none"; } diff --git a/src/facilities/wardrobe/wardrobeShopping.js b/src/facilities/wardrobe/wardrobeShopping.js index 42df5b82f079e4ed2e7157d22cd9e3aa16f7e3eb..e17d919066eb062875cd957bd6f5d980ae1c7e96 100644 --- a/src/facilities/wardrobe/wardrobeShopping.js +++ b/src/facilities/wardrobe/wardrobeShopping.js @@ -71,8 +71,8 @@ App.UI.WardrobeShopping = function() { let model; if (V?.favorites.length > 0) { modelChoices = V.favorites.map(slaveId => getSlave(slaveId)); - } else if (V.slaves?.length > 0) { - modelChoices = V.slaves; + } else if (getSlaves()?.length > 0) { + modelChoices = getSlaves(); } if (modelChoices.length > 1) { diff --git a/src/futureSocieties/aztec/slaveSacrificeLife.js b/src/futureSocieties/aztec/slaveSacrificeLife.js index a3e9b5234cd875fe4f31d03f2aa8e3322141590f..ca266472d914cd8cd07708e0bce74e0b5b440614 100644 --- a/src/futureSocieties/aztec/slaveSacrificeLife.js +++ b/src/futureSocieties/aztec/slaveSacrificeLife.js @@ -46,9 +46,9 @@ App.UI.SlaveInteract.aztecSlaveSacrificeLife = function(sacrifice) { } else { r.push(`The crowd cheers to the bloody spectacle.`); } - if (V.slaves.length > 0) { + if (getSlaves().length > 0) { r.push(`On the other hand, your remaining ${asPlural("slave is", "slaves are")} suitably <span class="trust dec">terrified.</span>`); - for (const slave of V.slaves.filter((s) => !isVegetable(s))) { + for (const slave of getSlaves().filter((s) => !isVegetable(s))) { slave.trust -= 5 + random(5); } } diff --git a/src/futureSocieties/fsPassage.js b/src/futureSocieties/fsPassage.js index b27b4eca53dfceee925c8190b6f77eda42421ac9..24e409eb9f105d557c3078c5c34a8684c1e6a1c4 100644 --- a/src/futureSocieties/fsPassage.js +++ b/src/futureSocieties/fsPassage.js @@ -187,7 +187,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Give all your slaves devotional names", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.chattelReligionistSlaveNames.random(); } refresh(); @@ -201,7 +201,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Give all your lactating slaves cow names", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.lactation) { slave.slaveName = App.Data.misc.cowSlaveNames.random(); } @@ -217,7 +217,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Give all your idiotic slaves stripper names", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.intelligence < -15) { slave.slaveName = App.Data.misc.bimboSlaveNames.random(); } @@ -233,7 +233,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename all your slaves according to Roman custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.romanSlaveNames.random(); slave.slaveSurname = App.Data.misc.romanSlaveSurnames.random(); } @@ -246,7 +246,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename all your slaves according to ancient Aztec custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.aztecSlaveNames.random(); slave.slaveSurname = 0; } @@ -259,7 +259,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename all your slaves according to ancient Egyptian custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.ancientEgyptianSlaveNames.random(); slave.slaveSurname = 0; } @@ -272,7 +272,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename all your slaves according to feudal Japanese custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.edoSlaveNames.random(); slave.slaveSurname = App.Data.misc.edoSlaveSurnames.random(); } @@ -285,7 +285,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename all your slaves according to old Southern custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.antebellumSlaveNames.random(); slave.slaveSurname = App.Data.misc.antebellumSlaveSurnames.random(); } @@ -299,7 +299,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename all your slaves according to Degradationist custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { DegradingName(slave); } refresh(); @@ -313,7 +313,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Rename your obedient slaves according to Paternalist custom", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.devotion > 20 || (slave.devotion >= -20 && slave.trust < -20)) { if (!["Miss", "Ms.", "Mrs."].some(title => slave.slaveName.includes(title))) { if (slave.relationship > 4) { @@ -337,7 +337,7 @@ App.UI.fsPassage = function() { App.UI.DOM.link( "Give all your slaves simple bimbo names", () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveName = App.Data.misc.bimboSlaveNames.random(); slave.slaveSurname = 0; } @@ -365,7 +365,7 @@ App.UI.fsPassage = function() { */ function evaluation(proposedFS) { const effectCounts = new Map(); - for (const slave of App.SlaveAssignment.reportSlaves(V.slaves)) { + for (const slave of App.SlaveAssignment.reportSlaves(getSlaves())) { const slaveEffects = App.SlaveAssignment.saSocialEffects(slave).newForFS(proposedFS); for (const effect of slaveEffects) { const curVal = effectCounts.get(effect.shortDesc); @@ -386,7 +386,7 @@ App.UI.fsPassage = function() { App.UI.DOM.appendNewElement("div", grid, key); avg += count; } - avg /= V.slaves.length; + avg /= getSlaves().length; const grid2 = document.createElement("div"); grid2.classList.add("grid-2columns-auto"); diff --git a/src/gui/options/summaryOptions.js b/src/gui/options/summaryOptions.js index 50816d19f7f15ee1795dfbf6574b4974ca583b82..6fbae0e805dd95779e46e985336c8349d36cc49c 100644 --- a/src/gui/options/summaryOptions.js +++ b/src/gui/options/summaryOptions.js @@ -31,7 +31,7 @@ App.UI.summaryOptions = function() { App.UI.DOM.appendNewElement("h2", el, "Individual panels"); App.UI.DOM.appendNewElement("div", el, "Sample summary:"); - el.append(App.UI.SlaveList.render([V.slaves.random().ID], [], App.UI.SlaveList.SlaveInteract.stdInteract)); + el.append(App.UI.SlaveList.render([getSlaves().random().ID], [], App.UI.SlaveList.SlaveInteract.stdInteract)); options = (new App.UI.OptionsGroup()).enableDoubleColumn(); diff --git a/src/gui/storyCaption.js b/src/gui/storyCaption.js index b97ed4f0df2906e22b1624f31af28bb924fe41d6..c1ebec8b77782ec9a111a960b6b13754559ca4ba 100644 --- a/src/gui/storyCaption.js +++ b/src/gui/storyCaption.js @@ -278,7 +278,7 @@ App.UI.StoryCaption.render = function() { } App.UI.DOM.appendNewElement("span", div, "Total Sex Slaves", css); - div.append(` | ${V.slaves.length}`); + div.append(` | ${getSlaves().length}`); if (V.sideBarOptions.roomPop > 0 && V.sideBarOptions.Style === 'compact') { div.classList.add("has-tooltip"); const popupDiv = document.createElement("div"); @@ -298,7 +298,7 @@ App.UI.StoryCaption.render = function() { function slavesGrid(container) { App.UI.DOM.appendNewElement("span", container, "Total Sex Slaves", ["pink"]); App.UI.DOM.appendNewElement("div", container, "|"); - App.UI.DOM.appendNewElement("div", container, `${V.slaves.length}`); + App.UI.DOM.appendNewElement("div", container, `${getSlaves().length}`); } /** diff --git a/src/interaction/artificialInsemination.js b/src/interaction/artificialInsemination.js index 4215c5aceef335304ce61121143fbc59b4f9e2bf..02c903e985083a4b11fad3349edbd873a763562a 100644 --- a/src/interaction/artificialInsemination.js +++ b/src/interaction/artificialInsemination.js @@ -11,7 +11,7 @@ App.UI.SlaveInteract.artificialInsemination = function() { r = []; let any = false; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.balls > 0 && slave.pubertyXY === 1 && canBreed(getSlave(V.AS), slave)) { const {his} = getPronouns(slave); diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index 5b35aee873a43182a992623ffcc101d76cf9e6bc..9b8b3d82607ff14da9866a6bed2d7d7acabdb274 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -133,7 +133,7 @@ App.UI.View.mainLinks = function() { App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Head Girl", "Head Girl Select"), "major-link"), " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Head Girl Select"), "hotkey")); div.id = "manageHG"; - } else if (V.slaves.length > 1) { + } else if (getSlaves().length > 1) { div.append(`You have not selected a Head Girl`); if (V.arcologies[0].FSEgyptianRevivalistLaw === 1) { div.append(` and Consort`); @@ -180,7 +180,7 @@ App.UI.View.mainLinks = function() { return (typeof organ === 'object' && getSlave(organ.ID) !== undefined); }); /* cycle through slaves, for each slave cycle through completed organs and track how many are of the interrogated slave (and if organs have a slaves to be implanted on) */ - for (const slave of V.slaves) { + for (const slave of getSlaves()) { const slaveOrgans = V.completedOrgans.reduce((acc, organ) => organ.ID === slave.ID ? acc + 1 : acc, 0); /* if the interrogated slave has one or more organs ready: */ if (slaveOrgans > 0) { diff --git a/src/interaction/main/walkPastList.js b/src/interaction/main/walkPastList.js index de78109e5a573fda69447578a225a7ae03c3a9a5..e8ff9dd5f908182e9a8609833c41f74639da3086 100644 --- a/src/interaction/main/walkPastList.js +++ b/src/interaction/main/walkPastList.js @@ -30,7 +30,7 @@ App.UI.walkPastAll = function() { * @returns {DocumentFragment} */ function walkPastCategory(fixedTarget) { - return App.UI.DOM.combineNodes(...V.slaves.map( + return App.UI.DOM.combineNodes(...getSlaves().map( (s) => App.UI.DOM.makeElement("p", walkPast(s, fixedTarget)) )); } diff --git a/src/interaction/policies/changeLanguage.js b/src/interaction/policies/changeLanguage.js index 1c70d6ed7d646f57945d836378ddd735f0617b62..74ab085bb769e4ee74fe049c1481b6f9917b9c41 100644 --- a/src/interaction/policies/changeLanguage.js +++ b/src/interaction/policies/changeLanguage.js @@ -52,7 +52,7 @@ App.Arcology.changeLanguage = function() { function setLanguage(targetLanguage) { V.language = targetLanguage; V.arcologies[0].prosperity = Math.trunc(0.9 * V.arcologies[0].prosperity); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.fetish !== Fetish.MINDBROKEN) { nationalityToAccent(slave); if (slave.accent >= 3) { diff --git a/src/interaction/policies/coursingAssociation.js b/src/interaction/policies/coursingAssociation.js index aaa780153aa066133ed061d2c8fe0e7a506c0ac9..174da7d8605d134445aaecb6bc75c4a9f5ffdf13 100644 --- a/src/interaction/policies/coursingAssociation.js +++ b/src/interaction/policies/coursingAssociation.js @@ -7,7 +7,7 @@ App.UI.coursingAssociation = function() { r.push(`The chasing slaves are known as lurchers, the term once used for the sighthounds. They require speed most of all, but must also be able to tackle their quarry; lurchers with the ability and willingness to make a spectacle of molesting the hares can improve their owners' reputations.`); if (V.LurcherID !== 0) { - r.push(`${SlaveFullName(slaveStateById(V.LurcherID))} is assigned to compete as your lurcher.`); + r.push(`${SlaveFullName(getSlave(V.LurcherID))} is assigned to compete as your lurcher.`); } else { r.push(`You have not selected a lurcher, meaning that you will not participate in coursing events.`); } diff --git a/src/interaction/saleFunctions.js b/src/interaction/saleFunctions.js index 6fe020d2f77c4fce58d16b7bfb8c1dbe312f9e6c..68c900458f187c450a1d46047909940538cc287d 100644 --- a/src/interaction/saleFunctions.js +++ b/src/interaction/saleFunctions.js @@ -2,7 +2,7 @@ App.Interact.Sale.separationReactions = function(slave) { const {sister, daughter, father, mother} = getPronouns(slave); const resultNode = document.createDocumentFragment(); - for (const s of V.slaves) { + for (const s of getSlaves()) { const {his2} = getPronouns(s).appendSuffix("2"); if (slave.mother === s.ID) { App.Events.addNode(resultNode, [`${s.slaveName} is <span class="devotion dec">grieved</span> that you are selling ${his2} ${daughter}.`], "div"); @@ -45,7 +45,7 @@ App.Interact.Sale.separationReactions = function(slave) { } else if (slave.relationship === -3) { App.Events.addParagraph(resultNode, [`Selling one of your slave wives is <span class="reputation dec">socially unacceptable.</span> In addition, your other devoted slaves are <span class="trust dec">worried</span> that you may not respect their status.`]); repX(-200, "slaveTransfer"); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion > 50) { s.trust -= 5; } diff --git a/src/interaction/selectPartner.js b/src/interaction/selectPartner.js index 8090292e0c642217da6026262209c35dd33ad106..5734d914902d0a65248be5e71202bd79e4d44831 100644 --- a/src/interaction/selectPartner.js +++ b/src/interaction/selectPartner.js @@ -41,7 +41,7 @@ App.Interact.choosePartner = function(renderer, target, refresh) { App.UI.DOM.appendNewElement("div", node, renderer.intro); const slave = renderer.slave; - const eligibles = V.slaves.filter((s) => (s.ID !== slave.ID) && renderer.eligible(s)); + const eligibles = getSlaves().filter((s) => (s.ID !== slave.ID) && renderer.eligible(s)); for (const eligible of eligibles) { const div = App.UI.DOM.appendNewElement("div", node); div.append(App.UI.DOM.link( diff --git a/src/interaction/sellSlave.js b/src/interaction/sellSlave.js index dfcac8902bc953f78f14805cb07ade497bbafbae..f3781dd4a4c8fc0baf22ae993d774bdeaea1d30a 100644 --- a/src/interaction/sellSlave.js +++ b/src/interaction/sellSlave.js @@ -859,7 +859,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is quickly escorted out by ${his} new master. ${He} is rarely seen in public anymore, but ${his} records show ${he} is settling well into being ${his} new owner's breeder.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.breedingMark !== 1 && V.propOutcome === 1) { s.devotion -= 5; slaveImpact = 1; @@ -958,7 +958,7 @@ App.Interact.sellSlave = function(slave) { if (V.PC.father === V.AS) { V.boomerangStats.PCfather = V.AS; } - for (const s of V.slaves) { // TODO: review for hyper fertility compatibility + for (const s of getSlaves()) { // TODO: review for hyper fertility compatibility if (s.ID !== V.AS) { if (s.mother === V.AS) { V.boomerangStats.boomerangMother.push(s.ID); @@ -1000,7 +1000,7 @@ App.Interact.sellSlave = function(slave) { V.boomerangStats.boomerangRivalry = slave.rivalryTarget; } if (slave.bodySwap > 0) { - const myBody = V.slaves.find(s => s.origBodyOwnerID === V.AS); + const myBody = getSlaves().find(s => s.origBodyOwnerID === V.AS); if (myBody) { V.boomerangStats.boomerangBody = myBody.ID; } @@ -1036,7 +1036,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} settles into ${his} new life in a humbler part of ${V.arcologies[0].name}, and can occasionally be seen accompanying ${his} master in public.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.trust >= -20) { if (s.physicalAge > 30) { s.trust += 1; @@ -1059,7 +1059,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} settles in to ${his} new role easily enough; ${he}'s one of the most pampered slaves in the arcology. All ${he}'s expected to do is light housework and self-maintenance, along with gentle unprotected vaginal sex with ${his} new master.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "pregnancy") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1082,7 +1082,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is seen in a research report nine months later; ${he} has undergone some interesting changes. As expected by someone interested in ${his} odd womb, ${he} is quite pregnant, but what really stands out is the massive size of ${his} testicles and ${his} huge round implants. A quick glance at the article reveals that they aren't implants; in fact, ${his} breasts and testicles are rounded with children.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.mpreg === 1) { s.trust -= 5; slaveImpact = 1; @@ -1121,7 +1121,7 @@ App.Interact.sellSlave = function(slave) { r.push(`${his} torso teetering`); } r.push(`pathetically atop its quivering mass. The headline reads "New drug allows for upwards of seven hundred children carried at once". Live on stream, ${his} body loses stability and ruptures, flooding the room with fluid and children.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.vagina === 0) { if (isFertile(s)) { s.trust -= 20; @@ -1145,7 +1145,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is seen nearly a year later, happy and healthy, along with ${his} owner and newborn son. They are quite a good looking family.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant < -15) { if (isFertile(s)) { s.devotion -= 2; @@ -1174,7 +1174,7 @@ App.Interact.sellSlave = function(slave) { } else { r.push(`moans lewdly as ${his} children kick away in ${his} womb.`); } - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.vagina === 0) { if (isFertile(s)) { if (s.fetish === "pregnancy") { @@ -1200,7 +1200,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is seen in a shipment of slaves leaving the arcology a month later, with just the slightest hint of a gravid belly and a worn-down expression on ${his} face.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.vagina === 0) { if (s.ovaries === 1) { s.trust -= 2; @@ -1223,7 +1223,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is soon seen on live TV, restrained and still grotesquely pregnant. ${He} screams into ${his} restraints as the host approaches with a comically large syringe of abortifacients and drives it deep into ${his} womb. Within minutes, a flood of liquid and fetuses are pouring from ${his} gaping cunt, all the while he times how long it takes ${his} overburdened womb to drain of all its contents.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.bellyPreg >= 300000) { s.trust -= 15; slaveImpact = 1; @@ -1245,7 +1245,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s new mistress is an exhibitionist as well as a nipple fetishist, and before long, she's seen in the club, riding ${slave.slaveName}'s chest with her wet pussy. The slave is expected to keep ${his} nipples erect for her at all times.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "boobs") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1268,7 +1268,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s new master is an exhibitionist as well as a nipple fetishist, and before long, he's seen in the club, plowing ${slave.slaveName}'s engorged breasts. Since nipple cunts aren't naturally lubricated, some owners find stimulating milk production a suitable replacement; judging from the pooling fluids and sympathetic gushes from ${his} ignored tit, he is one of them.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "boobs") { if (s.fetishKnown === 1) { if (s.nipples === "fuckable") { @@ -1299,7 +1299,7 @@ App.Interact.sellSlave = function(slave) { r.push(`moving`); } r.push(`a little oddly. ${His} naked dick has the flaccidity of sexual satiation, and ${he} has a tired but dreamy expression on ${his} face.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "buttslut") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1322,7 +1322,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`The next time ${slave.slaveName} is seen in public, ${he}'s obediently accompanying ${his} new master. After doing some business on the promenade, he pulls ${him} into an alcove and lets ${him} masturbate as he uses ${his} throat.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "cumslut") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1345,7 +1345,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is not seen again in public for a long time, but the crack of leather on flesh and the resultant hoarse female howling that issues from ${his} new mistress's apartment is well-known.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "masochist") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1368,7 +1368,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} rarely leaves ${his} new mistress's apartments, but the slave rumor mill bears stories about ${him} to your penthouse anyway. ${His} mistress uses ${him} as a rapist on demand, and ${his} dumbly obedient brutality is renowned.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "sadist") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1391,7 +1391,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} wins ${himself} a leadership position with ${his} new master, who repays ${his} hard work by allowing ${him} to use his slaves at will.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "dom") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1414,7 +1414,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`The back of ${slave.slaveName}'s head becomes a well-known sight in business circles, since ${his} mistress rarely lets it out from between her legs.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === Fetish.SUBMISSIVE) { if (s.fetishKnown === 1) { s.trust += 1; @@ -1437,7 +1437,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`In short order, ${slave.slaveName} is heard out on the promenade, sobbing and screaming as ${his} new owner breaks in ${his} virgin butt in public.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.anus === 0) { s.trust -= 2; slaveImpact = 1; @@ -1458,7 +1458,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is soon well-known among the slaves of the arcology, as many of them are sold after passing under ${his} hands in training. ${He} performs effectively, imparting good sex slave ethics in a generation of sluts.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant > 15) { s.trust += 1; slaveImpact = 1; @@ -1479,7 +1479,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} becomes a common sight around the arcology, training slaves for ${his} new master. They're usually seen hanging close by ${him} as ${he} manages them with an air at once protective and frankly sexual.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.actualAge > 35) { s.trust += 1; slaveImpact = 1; @@ -1500,7 +1500,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} becomes quite a fixture at social events hosted by ${his} new master; he enjoys showing off how healthy, happy and productive his cow is.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.lactation > 0) { s.trust += 1; slaveImpact = 1; @@ -1521,7 +1521,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} heads off to form part of whatever great design ${his} new master is pursuing; all you know is that it apparently requires lots of lithe, sharp toothed slave ${girl}s.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion <= 20) { s.trust += 1; slaveImpact = 1; @@ -1542,7 +1542,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is quickly embraced by ${his} new owner and spirited away like all the other ${girl}s that catch his fancy.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion <= 20) { s.trust += 1; slaveImpact = 1; @@ -1563,7 +1563,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s buyer takes charge of ${him}, and cannot resist immediately running a hand between ${his} buttocks to sink a couple of groping fingers into ${his} soft asspussy.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "buttslut") { s.trust += 1; slaveImpact = 1; @@ -1610,7 +1610,7 @@ App.Interact.sellSlave = function(slave) { if (random(1, 3) === 1 && V.seePreg !== 0) { // Monster movie r.push(`${slave.slaveName} soon makes ${his} debut on the big screen in a thrilling horror movie. At its end, the male lead finds his partner, played by ${him} in this scene, glued to a wall with a massively distended middle filled to capacity with the monster's spawn. The camera slowly zooms in on ${him} as ${he} gives birth to a future sequel.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.sexualFlaw === "breeder") { s.devotion -= 2; slaveImpact = 1; @@ -1622,7 +1622,7 @@ App.Interact.sellSlave = function(slave) { } else { // Sex Double r.push(`${slave.slaveName} soon makes ${his} debut on the big screen in a debaucherous gangbang in place of the popular lead. ${He} is a spitting image of the actress, even when coated in layers of semen.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.sexualFlaw === "attention whore") { s.devotion -= 2; slaveImpact = 1; @@ -1644,7 +1644,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is an occasional sight around the arcology; ${he}'s never seen outside the company of ${his} new slave superior. This is one of ${his} new master's more favored slaves. ${He} has a huge cock, and ${slave.slaveName} is usually seen crouching down, hugging one of ${his} superior's legs and keeping ${his} mouth obediently near that dick.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetishKnown === 1) { if (s.fetish === "cumslut") { s.trust += 1; @@ -1667,7 +1667,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} becomes a frequent sight around the arcology, accompanying ${his} new master. ${He}'s clearly happy, and is frequently seen to offer ${his} butt to him with a smile.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.dick > 0) { if (s.devotion > 20) { s.trust += 1; @@ -1690,7 +1690,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s buyer arrives promptly; he seems pleased with his new slave's bountiful bottom, so far off the ground.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "buttslut") { if (s.fetishKnown === 1) { s.trust += 1; @@ -1713,7 +1713,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s buyer arrives and seems pleased with ${his} lovely feminine appearance; he verifies ${his} lactation and ${his} ability to achieve erection despite ${his} lack of visible balls.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.dick > 0) { if (s.boobs > 400) { s.trust += 1; @@ -1735,7 +1735,7 @@ App.Interact.sellSlave = function(slave) { get completeSale() { const r = []; r.push(`When ${slave.slaveName}'s buyer appears, the big ${girl} is almost bashful. He tries to resist the impulse, but quickly breaks down and sweeps ${him} into a tight hug. ${He} accepts the embrace meekly. Your other slaves find this <span class="trust inc">very romantic.</span>`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust += 1; } return r; @@ -1750,7 +1750,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s lithe, muscular form is rarely seen after ${his} buyer takes charge of ${him}, since ${he} seems to spend most of ${his} time at home making babies.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetish === "pregnancy") { if (s.fetishKnown === 1) { s.trust += 4; @@ -1773,7 +1773,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is an occasional sight around the arcology; ${he}'s never seen outside the company of ${his} new slave superior. This is one of ${his} new master's more favored slaves. ${He} has a huge cock, and ${slave.slaveName} is usually seen crouching down, hugging one of ${his} superior's legs and keeping ${his} mouth obediently near that dick.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.fetishKnown === 1) { if (s.fetish === "cumslut") { s.trust += 1; @@ -1796,7 +1796,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s nervous buyer comes to collect ${him}, stammering and sweating and doing his best to pretend he does this all the time.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.counter.vaginal + s.counter.anal < 20) { s.trust += 1; slaveImpact = 1; @@ -1816,7 +1816,7 @@ App.Interact.sellSlave = function(slave) { get completeSale() { const r = []; r.push(`${slave.slaveName} is never seen again. ${His} buyer prefers to keep whatever happened to ${him} private. However, rumors of steaks, rump roasts, sweetbreads, and blood pudding eaten at three in the morning filter out from time to time. Naturally, these murmurs never fail to <span class="trust dec">terrify</span> your other slaves.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust -= 2; } return r; @@ -1831,7 +1831,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is rarely seen after ${his} buyer takes charge of ${him}, since he prefers to keep his prize safe and sound at home.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.porn.prestige === 1) { if (s.devotion > 20) { s.trust += 1; @@ -1854,7 +1854,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} becomes a frequent sight in ${slave.porn.fameType} smut and attracts huge crowds with each public appearance.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.porn.prestige.isBetween(0, 3)) { if (s.devotion > 20) { s.trust += 2; @@ -1877,7 +1877,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is not pleased by ${his} change in circumstances, since ${he} is soon subjected to training rigor that ${he} did not experience while your property.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligenceImplant < 15) { s.trust -= 2; slaveImpact = 1; @@ -1898,7 +1898,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`A few weeks later, ${slave.slaveName} is seen in a shipment of slaves heading out of the arcology. ${He} has new fake tits, a bigger butt, lip implants, and even some facial bone structure alterations, but ${his} balloon breasts are the most shocking change.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.boobsImplant === 0) { s.trust -= 2; slaveImpact = 1; @@ -1919,7 +1919,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`A few weeks later, ${slave.slaveName} is seen in a shipment of slaves heading out of the arcology. ${He} is almost unrecognizable, having been quickly returned to as natural an appearance as skillful removal of ${his} implants could manage.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.boobsImplant > 800) { s.trust += 1; slaveImpact = 1; @@ -1940,7 +1940,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is occasionally visible around the arcology, looking rather tired and gaunt under the stresses of a severe crash diet coupled with a punishing cardio regime.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.weight > 10) { s.trust -= 2; slaveImpact = 1; @@ -1961,7 +1961,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is only rarely seen around the arcology, since ${his} new owners force ${him} to spend most of ${his} time sleeping, eating and looking after ${himself}. But ${his} belly, painfully distended with food, makes ${his} situation obvious.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.weight > 10) { s.trust -= 2; slaveImpact = 1; @@ -1982,7 +1982,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is last seen somewhat later, packed into a shipment of cows heading out of the arcology. ${He} looks rather ill from the drugs ${he}'s been filled with, and ${his} now-distended breasts are marred by unsightly stretch marks.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.lactation === 0) { s.trust -= 2; slaveImpact = 1; @@ -2003,7 +2003,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is frequently seen in public over the next few weeks, since ${he}'s being trained to improve ${his} feminine deportment. ${He} grows visibly more feminine as time passes, as the hormonal effects of having ${his} balls cut off become apparent.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.balls > 0) { s.trust -= 2; slaveImpact = 1; @@ -2024,7 +2024,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is next seen after some weeks of surgery. ${He}'s barely recognizable, and now possesses a serviceable vagina which ${he} clearly is unsure of. ${His} original status is scarcely discernible.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.dick > 0) { s.trust -= 2; slaveImpact = 1; @@ -2045,7 +2045,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is subjected to a stock assay and then packed off to take ${his} place as a prize heifer.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.lactation === 0) { if (s.devotion <= 20) { s.trust -= 2; @@ -2068,7 +2068,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s journey to ${his} new home is respectful, even celebratory, as far as you can see. ${He} is gravely informed by the purchasing agent that many slaves await ${his} learned instruction.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant < -50) { s.devotion -= 2; slaveImpact = 1; @@ -2089,7 +2089,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is transported after losing a military engagement. Though ${his} will remains strong, ${he}'s <span class="trust dec">filled with fear</span> when ${he} sees the rivers of blood that flow through the city.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.skill.combat > 30) { s.trust -= 2; slaveImpact = 1; @@ -2110,7 +2110,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is shipped to a new arcology, and culturally, across the centuries. ${His} skill at arms is well enough known that ${his} impending role as a gladiatrix is easily deduced.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.skill.combat > 30) { s.trust -= 2; slaveImpact = 1; @@ -2131,7 +2131,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is taken away by an expensive, flashy shuttle shortly after you finalize the trade. ${He} is swept into a life of luxury; the next time you see ${him}, ${he}'s dressed in a manner more befitting of a consort than a simple slave.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant > 50) { s.devotion -= 2; slaveImpact = 1; @@ -2152,7 +2152,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is terrified of ${his} impending religious life; perhaps ${he}'s heard the new text that reads 'no woman come of age is holy unless she performs the act as many times per day as she has years less than forty.'`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.counter.anal < 200) { s.trust -= 2; slaveImpact = 1; @@ -2173,7 +2173,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`Stories about the arcology ${slave.slaveName} is headed to have circulated among slaves. Most intelligent slaves see a life of workouts as relatively harmless.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.weight > 10) { if (s.intelligence + s.intelligenceImplant < -15) { s.trust -= 2; @@ -2196,7 +2196,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is taken away to join a quivering mass of plump, pampered ladies that crowd the bedroom of ${his} new owner.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.behavioralFlaw === "gluttonous") { s.devotion -= 2; slaveImpact = 1; @@ -2217,7 +2217,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s new owner is quite fond of his work and typically sends out photos of his progress. This is no exception; you are treated to a series of images featuring ${slave.slaveName} being force-fed until ${his} stomach bulges. Day after day, you watch ${him} handle more and more food until ${his} belly is big enough to fill ${his} lap even when empty.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.weight < 10) { s.trust -= 2; slaveImpact = 1; @@ -2238,7 +2238,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`A purchasing agent arrives for ${slave.slaveName}; he uses a lull in the proceedings to use a permanent marker to begin mapping out surgical sites across ${his} body. There are a lot of them.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion <= 20) { s.trust -= 2; slaveImpact = 1; @@ -2260,7 +2260,7 @@ App.Interact.sellSlave = function(slave) { let slaveImpact; r.push(`A shipping container arrives for ${slave.slaveName}; as ${he}'s loaded into it, it sedates ${him} and begins to pump hormones, curatives and growth enhancers into no less than seven places scattered over ${his} body.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion <= 20) { s.trust -= 2; slaveImpact = 1; @@ -2281,7 +2281,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is taken away to join the tribe of squealing, slim forms that populate the arcology of ${his} new owner.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant > 50) { s.devotion -= 2; slaveImpact = 1; @@ -2302,7 +2302,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is shipped to ${his} new owner's arcology to have ${his} implants extracted and the resultant damage addressed.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion <= 50) { if (s.boobsImplant > 1000) { s.devotion -= 2; @@ -2325,7 +2325,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`Stories about the place ${he}'s going have reached ${V.arcologies[0].name}, and ${slave.slaveName} suspects the fate ${he}'s been condemned to when ${he}'s loaded into a shipping container expressly designed to keep the inmate awake and uncomfortable.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion > 20) { s.trust -= 2; slaveImpact = 1; @@ -2346,7 +2346,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is shipped off to be improved into a happy, educated slave at the best pace ${his} new owner can manage.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion < -20) { if (s.intelligence + s.intelligenceImplant < -15) { s.devotion -= 2; @@ -2369,7 +2369,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is taken away to join the legion of airheaded, big-titted sex slaves that throng the arcology owned by ${his} purchaser.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant > 50) { s.devotion -= 2; slaveImpact = 1; @@ -2390,7 +2390,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is shipped off, but ${his} buyer is so unwilling to waste any time that the shipment container includes hormonal injectors to get ${him} started on an intensive feminization regime as quickly as possible.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.dick > 0) { if (s.devotion <= 20) { s.trust -= 2; @@ -2413,7 +2413,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} leaves your control forthwith, to be freed and installed in a favored life in an arcology that gives ${slave.race} people every possible advantage.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion < 10) { s.devotion -= 2; slaveImpact = 1; @@ -2434,7 +2434,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is shipped off to help produce a race of ${slave.race} idiots to perform eternal servitude. ${He} is not perceptive enough to fear ${his} upcoming life as a downtrodden breeder.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.intelligence + s.intelligenceImplant > 15) { s.trust -= 2; slaveImpact = 1; @@ -2455,7 +2455,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is soon seen on shift outside a seedy establishment in the lower arcology, mechanically offering ${his} holes to passersby and flinching whenever ${his} superiors come out to check on ${him}.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.assignment === Job.WHORE || s.assignment === Job.BROTHEL) { s.trust -= 2; slaveImpact = 1; @@ -2483,7 +2483,7 @@ App.Interact.sellSlave = function(slave) { } else { r.push(`tits.`); } - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion <= 50) { s.trust -= 2; slaveImpact = 1; @@ -2504,7 +2504,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`The upper half of ${slave.slaveName}'s body is never seen again. ${His} butt, on the other hand, is periodically visible in a lower-level arcade, ${his} orifices gradually showing the wear and ${his} price gradually decreasing, until finally ${he} is seen no more.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.devotion < 10) { s.trust -= 2; slaveImpact = 1; @@ -2525,7 +2525,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`The breeder already has stud stock, and ${slave.slaveName} is rapidly impregnated. ${He}'s kept in a stockyard on the lower service levels of the arcology, one of a dense crowd of beaten-down women with gravid bellies.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.ovaries === 1) { s.trust -= 2; slaveImpact = 1; @@ -2546,7 +2546,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} disappears for a time as ${his} training is perfected, but ${he} reappears in the refined brothel, wearing classy clothes and flirting gracefully with patrons of ${his} body.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if ((s.assignment === Job.WHORE) || (s.assignment === Job.BROTHEL)) { s.trust += 1; slaveImpact = 1; @@ -2567,7 +2567,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is a common sight around the arcology, since free range cows are allowed to range between milkings. ${He} seems reasonably content.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if ((s.assignment === Job.MILKED) || (s.assignment === Job.DAIRY)) { s.trust += 1; slaveImpact = 1; @@ -2588,7 +2588,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName} is a common sight around the arcology, since free range cows are allowed to range between milkings. ${He} seems reasonably content.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.milkFlavor !== "none") { s.trust += 1; slaveImpact = 1; @@ -2608,7 +2608,7 @@ App.Interact.sellSlave = function(slave) { get completeSale() { const r = []; r.push(`Though ${slave.slaveName}'s fate as a source of organs for transplantation is not announced, rumors of what happens to those who <span class="trust dec">fail to be valuable to you</span> pass among your slaves.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust -= 2; } return r; @@ -2622,7 +2622,7 @@ App.Interact.sellSlave = function(slave) { get completeSale() { const r = []; r.push(`Though ${slave.slaveName}'s fate as a living fucktoy is not obvious, since most of ${his} body will forever after be encased in thick latex, rumors of what happens to those who <span class="trust dec">fail to be valuable to you</span> pass among your slaves.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { s.trust -= 2; } return r; @@ -2637,7 +2637,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`Sometime later, a snuff film starring ${slave.slaveName} as a heroine captured, raped, and fatally bred by tentacles is released. It receives rave reviews for the scene involving ${slave.slaveName}, depicting ${his} aphrodisiac-filled body being penetrated in all ${his} holes by tentacles. Their thrusting into ${him} increases until large bulges of cum pass through the ones filling ${his} stretched cunt, visibly bloating ${his} belly. ${He} then collapses to the ground, ${his} swollen belly rapidly growing with the tentacle spawn gestating within ${him}. As they bulge against the straining walls of ${his} implant-filled middle; ${he} lets out a final moan as ${his} belly ruptures, releasing ${his} "spawn" to hunt down the other heroines.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (canSee(s)) { if (s.intelligence + s.intelligenceImplant < -15) { s.devotion -= 4; @@ -2673,7 +2673,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`As ${slave.slaveName} now spends all ${his} time backstage, ${he}'s rarely seen again. Occasionally, however, a roadie will bring ${him} outside as he hauls the equipment, and ${he} jacks him off.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.hears < 0) { s.trust += 1; slaveImpact = 1; @@ -2694,7 +2694,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`${slave.slaveName}'s new etiquette trainer sends you courtesy updates on ${his} progress, as ${he} learns proper poise and enunciation, the correct locations of silverware, and how to avoid making vulgar comments while performing lascivious acts.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.sexualFlaw === "crude") { s.trust -= 1; slaveImpact = 1; @@ -2715,7 +2715,7 @@ App.Interact.sellSlave = function(slave) { const r = []; let slaveImpact; r.push(`The mercenary sniper greets ${slave.slaveName} before the two of them head off for a battlefield halfway around the world. "Let's hope you've got a good eye for political assassinations," he says humorlessly.`); - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.skill.combat <= 15) { s.trust -= 3; slaveImpact = 1; diff --git a/src/interaction/siFamily.js b/src/interaction/siFamily.js index 555727de9e5d688cf80827e02503a9a976251eb9..c4622adc52c8856c6cf9d4d9b059d8313a3b4b07 100644 --- a/src/interaction/siFamily.js +++ b/src/interaction/siFamily.js @@ -5,7 +5,7 @@ App.UI.SlaveInteract.family = function(slave) { const p = document.createElement("p"); p.id = "family"; - p.append(renderFamilyTree(V.slaves, slave.ID)); + p.append(renderFamilyTree(getSlaves(), slave.ID)); return p; }; diff --git a/src/interaction/siNavigation.js b/src/interaction/siNavigation.js index f0368d774e6a18e3c08d24b18533c22bc5f07243..b22ce706203b40fd7d1e7ed27de935bdf2dbdbdf 100644 --- a/src/interaction/siNavigation.js +++ b/src/interaction/siNavigation.js @@ -17,7 +17,7 @@ App.UI.SlaveInteract.navigation = function(slave) { */ App.UI.DOM.appendNewElement("div", f, App.UI.DOM.passageLink("Cheat Edit Slave", "Cheat Edit Actor", () => { - App.Verify.slaveState(`getSlave(${V.AS})`, getSlave(V.AS), "V.slaves"); + App.Verify.slaveState(`getSlave(${V.AS})`, getSlave(V.AS), "main slave pool"); V.tempActor = clone(getSlave(V.AS)); }), "cheat-menu" diff --git a/src/interaction/siRecords.js b/src/interaction/siRecords.js index 6b19c336f9426c3dc8c85100119873ae42af3a3e..bb3034658e3cf9b37668948a5379abfd4a04ff70 100644 --- a/src/interaction/siRecords.js +++ b/src/interaction/siRecords.js @@ -251,7 +251,7 @@ App.UI.SlaveInteract.records = function (slave, refresh) { r.push(App.UI.DOM.makeElement("span", `The slave market is bearish; the price of slaves is low.`, ["yellow"])); } - if (V.slaves.length < 2) { + if (getSlaves().length < 2) { r.push("You cannot sell your last slave"); } else if (slave.origin === "You bought $him from a body dump, completely broken." && (V.week - slave.weekAcquired <= 8)) { r.push(`A discarded slave must be kept for at least two months to ensure health before being sold.`); diff --git a/src/interaction/siUtilities.js b/src/interaction/siUtilities.js index d344f78c0c99c4fb853b6ced2bff26477f3603de..da656f4a41931f166483223584421d8db1b6ccb8 100644 --- a/src/interaction/siUtilities.js +++ b/src/interaction/siUtilities.js @@ -4,7 +4,7 @@ */ App.UI.SlaveInteract.placeInLine = function(slave) { const useSlave = assignmentVisible(slave) ? ((s) => assignmentVisible(s)) : ((s) => slave.assignment === s.assignment); - const slaveList = V.slaves.filter(useSlave); + const slaveList = getSlaves().filter(useSlave); SlaveSort.slaves(slaveList); const curSlaveIndex = slaveList.findIndex((s) => s.ID === slave.ID); diff --git a/src/interaction/siWork.js b/src/interaction/siWork.js index 8e9aee6800852f3cb7ee01fce6002b6256ed115f..05f2d8c280bfc08abf312b7521af2aa478727f49 100644 --- a/src/interaction/siWork.js +++ b/src/interaction/siWork.js @@ -614,7 +614,7 @@ App.UI.SlaveInteract.work = function(slave, refresh) { } sexOptions.push({text: `Abuse ${him}`, scene: () => App.Interact.fAbuse(slave)}); if (V.seeIncest === 1 && totalRelatives(slave) > 0) { - const availableRelatives = V.slaves.filter(s => areRelated(s, slave) && isSlaveAvailable(s)); + const availableRelatives = getSlaves().filter(s => areRelated(s, slave) && isSlaveAvailable(s)); if (availableRelatives.length > 1) { sexOptions.push({ text: `Fuck ${him} with one of ${his} close relatives`, diff --git a/src/interaction/universalRules.js b/src/interaction/universalRules.js index d4adb34ba6c0414c9bf9eee14ff16126441f7601..6bcf9fbb0e7688527f82c2193778282992bad255 100644 --- a/src/interaction/universalRules.js +++ b/src/interaction/universalRules.js @@ -83,7 +83,7 @@ App.UI.universalRules = function() { .addValue("Yes", 0).on() .addValue(`No going forward`, 1).off() .customButton(`No and strip all current surnames`, () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slave.slaveSurname = 0; } V.surnamesForbidden = 1; @@ -199,7 +199,7 @@ App.UI.universalRules = function() { if (!V.StudID) { r.push(`Fertile slaves will be systematically impregnated by a Stud, once you designate a subordinate slave to act as such.`); } else { - const stud = slaveStateById(V.StudID); + const stud = getSlave(V.StudID); const {he} = getPronouns(stud ? stud : {pronoun: App.Data.Pronouns.Kind.plural}); r.push(`Fertile slaves will be systematically impregnated by your Stud, if ${he} is able to do so.`); } diff --git a/src/interaction/useSlave/useSlaveOptions.js b/src/interaction/useSlave/useSlaveOptions.js index a637a1adb4852eddf99cd3442d63eeb511695689..bb5f693b073beb118d7cb4960583e2cd3eede815 100644 --- a/src/interaction/useSlave/useSlaveOptions.js +++ b/src/interaction/useSlave/useSlaveOptions.js @@ -832,7 +832,7 @@ App.UI.SlaveInteract.useSlave.options = function(player, clone, slave, playerSta link: `Bring in another slave`, desc: generalText.bringInSlave(clone), tooltip: `Have another slave join the two of you.`, - prereq: () => V.slaves.length > 1 && + prereq: () => getSlaves().length > 1 && slaveState.sexAct === null, effect: () => { return; // temporarily disabled diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 2d5881ac3e98a83cb366b8717389549dab23dee3..767287b679da553d63a0d0eff706b243ea336980 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -42,7 +42,7 @@ globalThis.assignJob = function(slave, job) { const specialIDProp = `${propName}ID`; const prevAssigneeID = V[specialIDProp]; if (prevAssigneeID !== slave.ID) { - removeJob(slaveStateById(prevAssigneeID), job, true); + removeJob(getSlave(prevAssigneeID), job, true); } V[specialIDProp] = slave.ID; } @@ -638,7 +638,7 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) { case "be your head girl": { slave.assignment = Job.REST; - const HGSlave = V.slaves.find(s => s.assignment === Job.HEADGIRLSUITE); + const HGSlave = getSlaves().find(s => s.assignment === Job.HEADGIRLSUITE); if (HGSlave) { removeJob(HGSlave, Job.HEADGIRLSUITE); if (V.HGSuiteEquality === 1 && HGSlave.devotion > 50) { @@ -667,7 +667,7 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) { slave.assignment = Job.REST; if (slave.relationshipTarget > 0) { /* following code assumes there can be at most one companion */ - const lover = V.slaves.find(s => haveRelationshipP(s, slave) && s.assignment === Job.AGENTPARTNER); + const lover = getSlaves().find(s => haveRelationshipP(s, slave) && s.assignment === Job.AGENTPARTNER); if (lover) { removeJob(lover, Job.AGENTPARTNER, saveRecord); } @@ -754,7 +754,7 @@ globalThis.makeJobIdMap = function() { res[jn] = new Set(); } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { res[slave.assignment].add(slave.ID); } @@ -804,7 +804,7 @@ App.UI.jobLinks = function() { */ function assignmentsFragment(ID, passage, callback) { let penthouseJobs = App.Entity.facilities.penthouse.assignmentLinkElements(ID, undefined, passage, callback); - const slave = slaveStateById(ID); + const slave = getSlave(ID); const sp = getPronouns(slave); if (slave.fuckdoll === 0) { @@ -836,7 +836,7 @@ App.UI.jobLinks = function() { function transfersFragment(ID, callback) { /** @type {HTMLElement[]} */ const transfers = []; - const slave = slaveStateById(ID); + const slave = getSlave(ID); for (const f of facilitiesOrder) { if (!f.established || f.jobs.length === 0) { diff --git a/src/js/birth/birth.js b/src/js/birth/birth.js index 842e263b05d290f9caa7f40dcc0ecfdb1ccb07f4..53f735a3a0e51053c4d61193eb3d2393c7d167b7 100644 --- a/src/js/birth/birth.js +++ b/src/js/birth/birth.js @@ -7,7 +7,7 @@ App.Events.SEBirth = class SEBirth extends App.Events.BaseEvent { /** Custom casting: all slaves in labor are cast automatically. If no slaves are cast, casting fails and the event does not run. */ castActors() { - this.actors = V.slaves.filter(s => isInLabor(s)).map(s => s.ID); + this.actors = getSlaves().filter(s => isInLabor(s)).map(s => s.ID); return this.actors.length > 0; } diff --git a/src/js/consistencyCheck.js b/src/js/consistencyCheck.js index cdd1e986184471fe30b217d8a0e32119d0494f98..ece35cf408677a7b10dd07ed3da9f7f3ef93c968 100644 --- a/src/js/consistencyCheck.js +++ b/src/js/consistencyCheck.js @@ -1,25 +1,25 @@ /** - * checks V.slaves for consistency + * checks the main slave pool for consistency * @param {JQuery.PassageRenderingEvent} event */ App.Debug.slavesConsistency = function(event) { - if (V.slaves !== undefined) { // no V.slaves at game start - if (V.slaves.includes(null)) { + if (getSlaves() !== undefined) { // the main slave pool doesn't exist at game start + if (getSlaves().includes(null)) { const p = document.createElement("p"); p.append(App.UI.DOM.makeElement("span", "ERROR: Main slaves array contains a null entry! Please report this. ", "error"), // we can't reload the passage as we could be on a passage that changes the game state. - App.UI.DOM.link("Fix for next passage.", () => { V.slaves.deleteAll(null); })); + App.UI.DOM.link("Fix for next passage.", () => { getSlaves().deleteAll(null); })); event.content.append(p); } else { // This part would break with a null entry. - _(V.slaves).countBy(s => s.ID) + _(getSlaves()).countBy(s => s.ID) .pickBy(count => count > 1) .keys() .map(id => Number(id)) .value() .forEach(id => { event.content.append(App.UI.DOM.makeElement("p", `Duplicate slave ID ${id} at indices ${ - _(V.slaves) + _(getSlaves()) .map((s, idx) => ({ ID: s.ID, idx: idx, name: s.slaveName, assignment: s.assignment })) diff --git a/src/js/economyJS.js b/src/js/economyJS.js index a3b5fe3988e22c7b320fdea415e8d0fc6340b6b8..9b1984d5cd8069a48d8c58fbb569b21e243554c9 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -429,13 +429,13 @@ globalThis.calculateCosts = (function() { // slave expenses function predictTotalSlaveCosts() { let loopCosts = 0; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { loopCosts += getSlaveCost(slave); } const reducibleUpkeep = Math.trunc(loopCosts * 0.2); const servantCapacity = totalServantCapacity(); - if (V.slaves.length > servantCapacity) { - loopCosts -= Math.trunc(reducibleUpkeep / V.slaves.length * servantCapacity); + if (getSlaves().length > servantCapacity) { + loopCosts -= Math.trunc(reducibleUpkeep / getSlaves().length * servantCapacity); } else { loopCosts -= reducibleUpkeep; } @@ -448,7 +448,7 @@ globalThis.calculateCosts = (function() { let loopCosts = 0; // Find the total slave upkeep, calculate and subtract per assignment - for (const slave of V.slaves) { + for (const slave of getSlaves()) { slaveCost = getSlaveCost(slave); loopCosts += slaveCost; // Switch to subtract and track upkeep per assignment @@ -587,7 +587,7 @@ globalThis.calculateCosts = (function() { // Calculate the servant reduction and credit them for it const reducibleUpkeep = Math.trunc(loopCosts * 0.2); - const actualNumberServed = Math.min(V.slaves.length, totalServantCapacity()); + const actualNumberServed = Math.min(getSlaves().length, totalServantCapacity()); const savedPerSlot = reducibleUpkeep / actualNumberServed; App.Utils.jobForAssignment(Job.QUARTER).employees().forEach(s => { slaveCostMinor = Math.trunc(savedPerSlot * houseServantEffectiveness(s)); diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js index 4708755c71f092320ebff2a18c64389761f0c914..03ffdf47b60fa2344babaae6fb14ac0bea5c3246 100644 --- a/src/js/extendedFamilyModeJS.js +++ b/src/js/extendedFamilyModeJS.js @@ -334,7 +334,7 @@ globalThis.randomRelatedSlave = function(slave, filterFunction) { if (typeof filterFunction !== 'function') { filterFunction = () => true; } - const arr = V.slaves.filter((s) => areRelated(slave, s) && filterFunction(s)); + const arr = getSlaves().filter((s) => areRelated(slave, s) && filterFunction(s)); return arr.random(); }; @@ -483,21 +483,21 @@ globalThis.relativeTerm = function(slave1, slave2) { /** completely reset all the family counters in the game state (for both PC and slaves) */ globalThis.resetFamilyCounters = function() { - for (let slave of V.slaves) { + for (let slave of getSlaves()) { slave.daughters = 0; slave.sisters = 0; } V.PC.daughters = 0; V.PC.sisters = 0; - for (let slave of V.slaves) { + for (let slave of getSlaves()) { if (slave.mother === -1 || slave.father === -1) { V.PC.daughters++; } if (areSisters(slave, V.PC)) { V.PC.sisters++; } - for (let otherSlave of V.slaves) { + for (let otherSlave of getSlaves()) { if (isParentP(otherSlave, slave)) { slave.daughters++; } diff --git a/src/js/findSlave.js b/src/js/findSlave.js index 9902580009bdb7c21687c4b4e1f162723cdb503f..662369b9c7ecdfe03e6607055ee45fbd16296427 100644 --- a/src/js/findSlave.js +++ b/src/js/findSlave.js @@ -114,7 +114,7 @@ App.UI.findSlave = function() { * @returns {number[]} */ function _slaveIDs(predicate) { - return V.slaves.reduce((acc, slave) => { + return getSlaves().reduce((acc, slave) => { if (predicate(createReadonlyProxy(slave))) { acc.push(slave.ID); } diff --git a/src/js/fsConformance.js b/src/js/fsConformance.js index 8dc11dd48cdf70c0c5b4b95538c172be0bc3c12d..68b80102a09aaa3dcc231da7f785bd80cc8ef67c 100644 --- a/src/js/fsConformance.js +++ b/src/js/fsConformance.js @@ -61,7 +61,7 @@ App.FSConformance = function() { /** @type {{slave: FC.ReportSlave, effects: FC.SlaveSocialEffect[]}[]} */ const slaveSocialEffects = []; - for (const rpSlave of App.SlaveAssignment.reportSlaves(V.slaves)) { + for (const rpSlave of App.SlaveAssignment.reportSlaves(getSlaves())) { slaveSocialEffects.push({slave: rpSlave, effects: App.SlaveAssignment.saSocialEffects(rpSlave).effects()}); } diff --git a/src/js/ibcJS.js b/src/js/ibcJS.js index 6525c7ad20a36f04b368faefa9d2f554b61f6cc7..03530d9a74a5e08ddb2e577b243a9317277fdcea 100644 --- a/src/js/ibcJS.js +++ b/src/js/ibcJS.js @@ -27,7 +27,7 @@ globalThis.ibc = (() => { */ findSlaveState(id) { let record; - record = slaveStateById(id); + record = getSlave(id); if (!record) { if (Array.isArray(V.genePool)) { record = V.genePool.find((s) => { return s.ID === id; }); @@ -45,7 +45,7 @@ globalThis.ibc = (() => { */ getSlavesAndSuch() { /** @type {FC.GenePoolRecord[]} */ - let allSlaveRecords = getAllSlaves() + let allSlaveRecords = getSlaveStates() // @ts-ignore you shouldn't access V.genePool directly because it isn't supposed to change; this is an exception; For normal use use getGenePoolRecord() .concat(Object.values(V.genePool)) .concat(Object.values(V.missingTable)); @@ -57,12 +57,12 @@ globalThis.ibc = (() => { }, /** - * get all FC.FetusGenetics that exist in V.slaves + * get all FC.FetusGenetics that exist in the main slave pool * @returns {FC.FetusGenetics[]} */ getFetuses() { /** @type {FC.FetusGenetics[]} */ - return V.slaves.filter(s => s.preg > 0).map(s => s.womb.map(i => i.genetics)).reduce((res, cur) => res.concat(cur), []); + return getSlaves().filter(s => s.preg > 0).map(s => s.womb.map(i => i.genetics)).reduce((res, cur) => res.concat(cur), []); } }; diff --git a/src/js/main.js b/src/js/main.js index fe3f8c36b451972e763878d2c478d134905cd7e9..75507558d8f4e4c45a73e6846e1815509b64b9cc 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -198,7 +198,7 @@ App.MainView.full = function() { } else { V.currentRule = null; } - SlaveSort.slaves(V.slaves); + SlaveSort.slaves(getSlaves()); App.UI.SlaveList.ScrollPosition.restore(); } @@ -234,7 +234,7 @@ App.MainView.full = function() { } links.push(App.UI.DOM.link(`Re-apply Rules Assistant now`, () => { - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (assignmentVisible(slave) && slave.useRulesAssistant === 1) { DefaultRules(slave); } @@ -254,7 +254,7 @@ App.MainView.full = function() { */ function useFucktoys() { const fragment = document.createDocumentFragment(); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.assignment !== Job.FUCKTOY) { continue; } @@ -270,7 +270,7 @@ App.MainView.full = function() { const outerDiv = document.createElement("div"); outerDiv.id = "walkpast"; - const slave = V.slaves.filter(s => ![Job.BODYGUARD, Job.FUCKTOY].includes(s.assignment) && (!getPersonalAttention(s.ID, "torture") || onBedRest(V.PC, true))).random(); + const slave = getSlaves().filter(s => ![Job.BODYGUARD, Job.FUCKTOY].includes(s.assignment) && (!getPersonalAttention(s.ID, "torture") || onBedRest(V.PC, true))).random(); if (slave) { App.UI.DOM.appendNewElement("span", outerDiv, globalThis.walkPast(slave), "scene-intro"); } diff --git a/src/js/pregJS.js b/src/js/pregJS.js index 288da21c4d447347c7b9e4b9b12e9ee7832ca4d5..2b5a5ff77cb2e7b60101ec98f6135d32c9d61e96 100644 --- a/src/js/pregJS.js +++ b/src/js/pregJS.js @@ -540,7 +540,7 @@ globalThis.findFather = function(fatherID) { if (father === undefined) { // fast methods didn't find them so do a search through all HumanState objects - father = getAllHumans().find((s) => s.ID === fatherID); + father = getHumanStates().find((s) => s.ID === fatherID); } return father; diff --git a/src/js/releaseRules.js b/src/js/releaseRules.js index bd3deb69e67bb36f9d87757dd08d20854f58dbba..892774cbb9a0755c64f50dcb75bcb51c96ed9658 100644 --- a/src/js/releaseRules.js +++ b/src/js/releaseRules.js @@ -72,7 +72,7 @@ App.Utils.hasFamilySex = function hasFamilySex(slave) { if (slave.sisters + slave.daughters === 0) { return false; } - return V.slaves.some(s => areRelated(slave, s) && this.sexAllowed(slave, s)); + return getSlaves().some(s => areRelated(slave, s) && this.sexAllowed(slave, s)); }; /** diff --git a/src/js/removeSlave.js b/src/js/removeSlave.js index 0deb18d630655c8d9ad732da7cba5bdad5866da1..13804b8f1ae8fe6f975ac40141a5216140a4fc8f 100644 --- a/src/js/removeSlave.js +++ b/src/js/removeSlave.js @@ -5,7 +5,7 @@ globalThis.removeSlave = function(slave) { const AS_ID = slave.ID; - let LENGTH = V.slaves.length; + let LENGTH = getSlaves().length; const INDEX = V.slaveIndices[AS_ID]; let missing = false; @@ -63,7 +63,7 @@ globalThis.removeSlave = function(slave) { } }); } - V.slaves.forEach(s => { + getSlaves().forEach(s => { WombChangeID(s, AS_ID, V.missingParentID); if (s.pregSource === V.missingParentID) { missing = true; @@ -241,7 +241,7 @@ globalThis.removeSlave = function(slave) { // remove slaves from V.rulesToApplyOnce if needed removeFromRulesToApplyOnce(slave); - V.slaves.deleteAt(INDEX); + getSlaves().deleteAt(INDEX); V.slaveIndices = slaves2indices(); LENGTH--; V.JobIDMap = makeJobIdMap(); /* need to call this once more to update count of resting slaves*/ diff --git a/src/js/rulesAssistantOptions.js b/src/js/rulesAssistantOptions.js index c351cc2a608e0393d94714c8ef0589e08bae821f..1d8eae27a200526bafc815ca326f4bf9cf3d36b6 100644 --- a/src/js/rulesAssistantOptions.js +++ b/src/js/rulesAssistantOptions.js @@ -1351,7 +1351,7 @@ App.RA.options = (function() { render() { const elem = document.querySelector("#application-log") || document.createElement("div"); elem.id = "application-log"; - elem.innerHTML = V.slaves.map(slave => DefaultRules(slave)).join(""); + elem.innerHTML = getSlaves().map(slave => DefaultRules(slave)).join(""); if (V.experimental.raSortOutput === 1) { // sort RA output mod // Get the text content from the element const text = elem.innerHTML; @@ -1435,7 +1435,7 @@ App.RA.options = (function() { class SlaveSelection extends ButtonList { constructor() { super("Include specific slaves"); - V.slaves.forEach(slave => this.appendChild(new ButtonItem( + getSlaves().forEach(slave => this.appendChild(new ButtonItem( [slave.slaveName, slave.slaveSurname].join(" "), slave.ID, current_rule.condition.selectedSlaves.includes(slave.ID)))); @@ -1449,7 +1449,7 @@ App.RA.options = (function() { class SlaveExclusion extends ButtonList { constructor() { super("Exclude specific slaves"); - V.slaves.forEach(slave => this.appendChild(new ButtonItem( + getSlaves().forEach(slave => this.appendChild(new ButtonItem( [slave.slaveName, slave.slaveSurname].join(" "), slave.ID, current_rule.condition.excludedSlaves.includes(slave.ID)))); diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index 88a9d98fbbb00282d7e5d6d213d00e21f04438b0..19ea26b1c83db45068b8204ce47a78bf186c9330 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -1955,7 +1955,7 @@ globalThis.FResultArray = (function() { * @param {FC.SlaveState} slave */ function calcWorksWithRelatives(slave) { - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if (sameAssignmentP(slave, potentialRel)) { if (isParentP(slave, potentialRel)) { adjustFResult(`Works with their parent(s)`, 1); @@ -1983,7 +1983,7 @@ globalThis.FResultArray = (function() { * @param {FC.SlaveState} slave */ function calcWorksWithRelationship(slave) { - const fre = V.slaves.find(s => haveRelationshipP(slave, s) && sameAssignmentP(slave, s)); + const fre = getSlaves().find(s => haveRelationshipP(slave, s) && sameAssignmentP(slave, s)); if (fre) { adjustFResult(`Works with lover`, 1); } diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index 90c5b939cd957f722ee619f4e5784dc562cb2430..9f4c0930b5aae15727e2759de829d63bdeaa5319 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -79,7 +79,7 @@ App.UI.SlaveList.render = function(IDs, rejectedSlaves, interactionLink, postNot } for (const rs of rejectedSlaves) { - const slave = slaveStateById(rs.id); + const slave = getSlave(rs.id); const rejects = rs.rejects; const slaveName = SlaveFullName(slave); let slaveDiv = document.createElement("div"); @@ -119,7 +119,7 @@ App.UI.SlaveList.render = function(IDs, rejectedSlaves, interactionLink, postNot hr.style.margin = "0"; res.appendChild(hr); } - const slave = slaveStateById(id); + const slave = getSlave(id); if (batchRenderer && (!V.seeCustomImagesOnly || (V.seeCustomImagesOnly && slave.custom.image))) { let imgDiv = document.createElement("div"); @@ -566,7 +566,7 @@ App.UI.SlaveList.listJFacilitySlaves = function(jobName, facility, facilityPassa if (facility.hasFreeSpace) { const assignableSlaveIDs = job.desc.partTime - ? V.slaves.map(slave => slave.ID) // all slaves can work here + ? getSlaves().map(slave => slave.ID) // all slaves can work here : [...App.Entity.facilities.penthouse.employeesIDs()]; // only slaves from the penthouse can be transferred here tabBar.addTab(tabCaptions.assign, "assign", assignableTabContent(assignableSlaveIDs)); } else { @@ -596,7 +596,7 @@ App.UI.SlaveList.listJFacilitySlaves = function(jobName, facility, facilityPassa if (showTransfersTab) { if (facility.hasFreeSpace) { // slaves from other facilities can be transferred here - const transferableIDs = V.slaves.reduce((acc, slave) => { + const transferableIDs = getSlaves().reduce((acc, slave) => { if (!assignmentVisible(slave) && !facility.isHosted(slave)) { acc.push(slave.ID); } @@ -621,7 +621,7 @@ App.UI.SlaveList.listJFacilitySlaves = function(jobName, facility, facilityPassa let rejectedSlaves = []; let passedSlaves = []; slaveIDs.forEach((id) => { - const rejects = facility.canHostSlave(slaveStateById(id), jobName); + const rejects = facility.canHostSlave(getSlave(id), jobName); if (rejects.length > 0) { rejectedSlaves.push({id: id, rejects: rejects}); } else { @@ -669,7 +669,7 @@ App.UI.SlaveList.listNGPSlaves = function() { let imported = []; let nonImported = []; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { // @ts-ignore: handle the legacy assignment string if (slave.assignment === "be imported") { slave.assignment = Job.IMPORTED; @@ -766,7 +766,7 @@ App.UI.SlaveList.penthousePage = function() { slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Head Girl Select"), "hotkey")); slaveWrapper.append(App.UI.SlaveList.render([HG.ID], [], interactRenderer)); } else { - if (V.slaves.length > 1) { + if (getSlaves().length > 1) { slaveWrapper.append("You have ", App.UI.DOM.makeElement("span", "not", "warning"), " selected a Head Girl"); if (A.FSEgyptianRevivalistLaw === 1) { slaveWrapper.append(" and Consort"); @@ -954,7 +954,7 @@ App.UI.SlaveList.penthousePage = function() { } function arcologyTab() { - const allSlaveIDs = V.slaves.map((slave) => slave.ID); + const allSlaveIDs = getSlaves().map((slave) => slave.ID); SlaveSort.IDs(allSlaveIDs); return makeTabDesc("arcology", `Arcology${V.useSlaveSummaryTabs > 0 ? ` (${allSlaveIDs.length})` : ""}`, App.UI.SlaveList.render(allSlaveIDs, [], interactRenderer)); @@ -1113,15 +1113,14 @@ App.UI.SlaveList.slaveSelectionList = function() { * @returns {DocumentFragment} */ function _listSlaves(assignmentStr) { - const slaves = V.slaves; /** @type {Array<number>} */ let unfilteredIDs; switch (assignmentStr) { case 'all': - unfilteredIDs = slaves.map(s => s.ID); + unfilteredIDs = getSlaves().map(s => s.ID); break; case 'experienced': - unfilteredIDs = slaves.reduce((acc, s) => { + unfilteredIDs = getSlaves().reduce((acc, s) => { if (options.expCheck(s)) { acc.push(s.ID); } @@ -1137,7 +1136,7 @@ App.UI.SlaveList.slaveSelectionList = function() { let rejects = []; unfilteredIDs.forEach(id => { - const fr = options.filter(slaveStateById(id)); + const fr = options.filter(getSlave(id)); if (fr === true || (Array.isArray(fr) && fr.length === 0)) { passingIDs.push(id); } else { diff --git a/src/js/slaveSummaryHelpers.js b/src/js/slaveSummaryHelpers.js index 5c2b79dff9c3235dd94b09c8e086fdfc976d3e3c..9f6482abfe9754005f68de42628688a0d42c61cb 100644 --- a/src/js/slaveSummaryHelpers.js +++ b/src/js/slaveSummaryHelpers.js @@ -247,7 +247,7 @@ App.UI.SlaveSummaryImpl = function() { } } if (slave.mother > 0) { - const ssj = V.slaves.find(s => s.ID === slave.mother); + const ssj = getSlaves().find(s => s.ID === slave.mother); if (ssj) { helpers.referenceSlaveWithPreview(block, ssj, SlaveFullName(ssj)); addText(block, "'s "); @@ -263,7 +263,7 @@ App.UI.SlaveSummaryImpl = function() { makeSpan(block, bits.makeBit(getPronouns(slave).daughter), cssClassName); } if (slave.father > 0 && slave.father !== slave.mother) { - const ssj = V.slaves.find(s => s.ID === slave.father); + const ssj = getSlaves().find(s => s.ID === slave.father); if (ssj) { helpers.referenceSlaveWithPreview(block, ssj, SlaveFullName(ssj)); addText(block, "'s "); @@ -279,7 +279,7 @@ App.UI.SlaveSummaryImpl = function() { makeSpan(block, bits.makeBit(getPronouns(slave).daughter), cssClassName); } if (slave.daughters === 1) { - const ssj = V.slaves.find(s => s.mother === slave.ID || s.father === slave.ID); + const ssj = getSlaves().find(s => s.mother === slave.ID || s.father === slave.ID); if (ssj) { helpers.referenceSlaveWithPreview(block, ssj, SlaveFullName(ssj)); addText(block, "'s "); @@ -300,7 +300,7 @@ App.UI.SlaveSummaryImpl = function() { } } if (slave.sisters === 1) { - const ssj = V.slaves.find(s => areSisters(s, slave) > 0); + const ssj = getSlaves().find(s => areSisters(s, slave) > 0); if (ssj) { helpers.referenceSlaveWithPreview(block, ssj, SlaveFullName(ssj)); addText(block, "'s "); @@ -321,7 +321,7 @@ App.UI.SlaveSummaryImpl = function() { } } if (slave.relationship > 0 && handled !== 1) { - const ssj = V.slaves.find(s => s.ID === slave.relationshipTarget); + const ssj = getSlaves().find(s => s.ID === slave.relationshipTarget); if (ssj) { helpers.referenceSlaveWithPreview(block, ssj, SlaveFullName(ssj)); addText(block, "'s "); @@ -1499,7 +1499,7 @@ App.UI.SlaveSummaryImpl = function() { function shortRival(slave, c) { if (slave.rivalry !== 0) { const block = makeBlock(c, "lightsalmon"); - const ssj = V.slaves.find(s => s.ID === slave.rivalryTarget); + const ssj = getSlaves().find(s => s.ID === slave.rivalryTarget); if (ssj) { if (slave.rivalry <= 1) { block.textContent = 'Disl '; @@ -1543,7 +1543,7 @@ App.UI.SlaveSummaryImpl = function() { function longRival(slave, c) { if (slave.rivalry !== 0) { const block = makeBlock(c); - const ssj = V.slaves.find(s => s.ID === slave.rivalryTarget); + const ssj = getSlaves().find(s => s.ID === slave.rivalryTarget); if (ssj) { if (slave.rivalry <= 1) { makeSpan(block, "Dislikes", "lightsalmon"); diff --git a/src/js/states/001-GenePoolRecord.js b/src/js/states/001-GenePoolRecord.js index 97074c4f84fd6f6a72476f67b32a9bea09f8f799..68a157eca9ddce46739241b9c5e0f4a130bb0ba1 100644 --- a/src/js/states/001-GenePoolRecord.js +++ b/src/js/states/001-GenePoolRecord.js @@ -237,7 +237,7 @@ globalThis.deleteGenePoolRecord = (actor, force=false) => { } if (!keep) { /* avoid going through this loop if possible */ - keep = getAllSlaves().some(slave => { + keep = getSlaveStates().some(slave => { /* have we impregnated a slave that is not ourselves? */ return (slave.ID !== actor.ID && isImpregnatedBy(slave, actor)); }); diff --git a/src/js/states/002-HumanState.js b/src/js/states/002-HumanState.js index 374e5cf0d6c45df62c898418f41dcafd018f2b0d..e87dca5a6545bf40aaa67a99682fb10e4d2d192f 100644 --- a/src/js/states/002-HumanState.js +++ b/src/js/states/002-HumanState.js @@ -6,10 +6,10 @@ * Doesn't return partial HumanState objects from V.missingTable; * @returns {FC.HumanState[]} */ -globalThis.getAllHumans = () => { +globalThis.getHumanStates = () => { // TODO:@franklygeorge once ChildState is implemented add it to this let allHumanRecords = [] - .concat(getAllSlaves()) + .concat(getSlaveStates()) .concat([V.PC]); diff --git a/src/js/states/003-SlaveState.js b/src/js/states/003-SlaveState.js index 7d93d3f9530a9aa3454e3b54b6d1d121dbced7a6..bc7e9382eb024df9c191a6bf88a3a605403d80c3 100644 --- a/src/js/states/003-SlaveState.js +++ b/src/js/states/003-SlaveState.js @@ -6,10 +6,10 @@ * Doesn't return partial SlaveState objects from V.missingTable; * @returns {FC.SlaveState[]} */ -globalThis.getAllSlaves = () => { +globalThis.getSlaveStates = () => { // TODO:@franklygeorge once ChildState is implemented add it to this let allSlaveRecords = [] - .concat(V.slaves) + .concat(getSlaves()) .concat(V.cribs) .concat(V.incubator.tanks); diff --git a/src/js/utilsArcology.js b/src/js/utilsArcology.js index afb864c8dbd2bb169fca80c27f7be669d53a37a7..d54dccf4f3e2865594f64bb84de3cba75603abf4 100644 --- a/src/js/utilsArcology.js +++ b/src/js/utilsArcology.js @@ -152,14 +152,14 @@ globalThis.penetrativeSocialUse = function(slave = null) { } if (total >= 40) { // Once dicks are trendy, availability starts to increase interest - let haveDick = V.slaves.filter(s => s.dick > 0).length; + let haveDick = getSlaves().filter(s => s.dick > 0).length; if (haveDick) { - let withDick = (haveDick / V.slaves.length); // percentage of slaves with dicks + let withDick = (haveDick / getSlaves().length); // percentage of slaves with dicks total += withDick > .2 ? 15 * withDick : 0; - let toyHole = V.slaves.filter(s => s.toyHole === "dick").length; + let toyHole = getSlaves().filter(s => s.toyHole === "dick").length; total += 10 * (toyHole / haveDick); let penetrativeAverage = 0; - V.slaves.filter(s => s.dick > 0).forEach(s1 => { + getSlaves().filter(s => s.dick > 0).forEach(s1 => { penetrativeAverage += s1.skill.penetrative; }); total += (penetrativeAverage / haveDick) * .1; diff --git a/src/js/utilsMisc.js b/src/js/utilsMisc.js index 2e0f5c1662cec3b658ba0b0fcd4894886c20a869..74946aff6a277f3a54b166d8b5e2918db3127fe0 100644 --- a/src/js/utilsMisc.js +++ b/src/js/utilsMisc.js @@ -392,7 +392,7 @@ App.Utils.totalNetWorth = function() { total += V.cash; - for (const slave of V.slaves) { + for (const slave of getSlaves()) { total += slaveCost(slave); } @@ -689,7 +689,7 @@ App.Utils.getSaveFilename = (baseName='free-cities', extension='save', s = null) const arcologyName = V.arcologies === undefined || V.arcologies.length === 0 ? "New_Game_Setup" : V.arcologies[0].name.replaceAll(' ', '_').substring(0, 20); const week = String(V.week).padStart(5, '0'); const slave = !s - ? String(V.slaves.length).padStart(5, '0') + ? String(getSlaves().length).padStart(5, '0') : `${s.ID > 0 ? 'ID' + String(s.ID).padStart(5, '0'): 'PC'}-${((s.slaveSurname ? s.slaveSurname : '' ) + s.slaveName).replaceAll(' ', '').substring(0, 30)}`; const release = String(V.releaseID).padStart(5, '0'); const date = App.Utils.getDatestamp(); diff --git a/src/js/utilsPC.js b/src/js/utilsPC.js index c1be65a74922a9ead2a3a920e72449252d246c7c..2188711a3c88ca24569c203581f0f0e7a88a7716 100644 --- a/src/js/utilsPC.js +++ b/src/js/utilsPC.js @@ -550,19 +550,19 @@ globalThis.PCTitle = function() { } } - if (V.slaves.length > 50) { + if (getSlaves().length > 50) { if (V.PC.title === 1) { titles.push("Master of Slaves"); } else { titles.push("Mistress of Slaves"); } - } else if (V.slaves.length > 40) { + } else if (getSlaves().length > 40) { titles.push("Holder of Slaves"); - } else if (V.slaves.length > 30) { + } else if (getSlaves().length > 30) { titles.push("Keeper of Slaves"); - } else if (V.slaves.length > 20) { + } else if (getSlaves().length > 20) { titles.push("Manager of Slaves"); - } else if (V.slaves.length > 10) { + } else if (getSlaves().length > 10) { titles.push("owner of slaves"); } const corpValue = App.Corporate.calculateValue(); @@ -1123,7 +1123,11 @@ globalThis.isPlayerReceptive = function(penetrator = null) { return true; // penetrative campaign } else if (V.PC.drugs.includes("fertility") || V.PC.diet.includes("fertility") || V.PC.refreshment.includes("fertility")) { return true; // PC wants to be pregnant, even if not fertile - } else if (V.slaves.filter(s => s.toyHole === "dick").length * 4 > V.slaves.filter(s => s.dick > 0).length || V.slaves.filter(s => s.toyHole === "dick").length * 10 > V.slaves.length || V.slaves.filter(s => s.toyHole === "dick").length >= 8) { + } else if ( + getSlaves().filter(s => s.toyHole === "dick").length * 4 > getSlaves().filter(s => s.dick > 0).length || + getSlaves().filter(s => s.toyHole === "dick").length * 10 > getSlaves().length || + getSlaves().filter(s => s.toyHole === "dick").length >= 8 + ) { return true; // at least 8 slaves, or 25% of the slaves with penises, or 10% of all the slaves, have dick as toyHole } else if (V.PC.counter.anal * 2 > V.week) { return true; // player is used to anal penetration @@ -1186,21 +1190,20 @@ globalThis.isPlayerFrigid = function() { if ((rumorType === "weakness" || rumorType === "all") && result.weakness > 0) { result.weakness = 1 + Math.round((result.weakness - 1) * 0.5); // weakness is not as devastating as other bad rumors. if (result.penetrative + result.birth > 20) { - result.weakness = Math.round(result.weakness * 0.66); // other rumors downplay the impact of weakness ones. + result.weakness = Math.round(result.weakness * 0.66); // other rumors downplay the impact of weakness ones. } } return rumorType === "all" ? result.penetrative + result.birth + result.weakness : result[rumorType]; -} - - /** Records possible harmful rumors about the player. */ - globalThis.newRumor = (function() { +}; - return{ +/** Records possible harmful rumors about the player. */ +globalThis.newRumor = (function() { + return { penetrative: penetrated, birth: miscegenated, weakness: weak, // other: other, - } + }; /** Records rumors about the player being penetrated by a slave, if applicable, and returns a warning text in that case. * @param {FC.SlaveState} slave - penetrator @@ -1234,7 +1237,7 @@ globalThis.isPlayerFrigid = function() { * @param {number} strength - multiplier, defaults to 1 */ function miscegenated(strength = 10) { - if (V.arcologies[0].FSChattelReligionistLaw === 1) { // society accepts the acts of the prophet + if (V.arcologies[0].FSChattelReligionistLaw === 1) { // society accepts the acts of the prophet return; } let weight = FutureSocieties.isActive("FSRepopulationFocus") && V.arcologies[0].FSRepopulationFocus > 99 ? .1 : 2; @@ -1261,16 +1264,15 @@ globalThis.isPlayerFrigid = function() { } })(); - /** Softens harmful rumors about the player. */ - globalThis.softenRumors = (function() { - - return{ +/** Softens harmful rumors about the player. */ +globalThis.softenRumors = (function() { + return { penetrative: penetrated, birth: miscegenated, weakness: weak, // other: other, all: all, - } + }; /** Softens rumors about the player being penetrated by slaves. * @param {number} strength - multiplier, defaults to 1 @@ -1351,4 +1353,4 @@ globalThis.getPCPreferredHole = function() { } else { return "anus"; } -} +}; diff --git a/src/js/utilsSlave.js b/src/js/utilsSlave.js index 3534b170e861f19bada454baca5d0ce294946a1a..c4fc5638987da3e88764d6a639534a6d8b0fb548 100644 --- a/src/js/utilsSlave.js +++ b/src/js/utilsSlave.js @@ -1488,7 +1488,7 @@ globalThis.newSlave = function(slave) { if (areSisters(V.PC, slave) > 0) { V.PC.sisters += 1; } - for (const other of V.slaves) { + for (const other of getSlaves()) { if (other.mother === slave.ID || other.father === slave.ID) { slave.daughters++; } @@ -1567,7 +1567,8 @@ globalThis.newSlave = function(slave) { generatePronouns(slave); SetBellySize(slave); - V.slaveIndices[slave.ID] = V.slaves.push(slave) - 1; + // @ts-expect-error slave indices are read only + V.slaveIndices[slave.ID] = getSlaves().push(slave) - 1; if (isInGenePool(slave)) { console.warn(`A gene pool record already exists for a slave with the ID '${slave.ID}', leaving old record intact`); @@ -2524,9 +2525,8 @@ globalThis.PaternalistName = function(slave) { * @param {FC.SlaveState} child */ globalThis.parentNames = function(parent, child) { - const slaves = V.slaves; - let currentSlaveNames = slaves.map(s => s.slaveName); + let currentSlaveNames = getSlaves().map(s => s.slaveName); let continentNationality; const useMaleName = (child.genes === "XY" && V.allowMaleSlaveNames === true); @@ -3795,7 +3795,7 @@ globalThis.generateSlaveID = function() { // get the ID props for all objects that have slave IDs // note that V.missingTable has IDs too but those aren't included here because they're always negative by design const allSlaveIDs = [ - ...getAllSlaves().map((s) => s.ID), + ...getSlaveStates().map((s) => s.ID), ...Object.values(V.genePool).map((s) => s.ID) ]; @@ -3813,21 +3813,41 @@ globalThis.generateSlaveID = function() { }; /** + * Returns a slave for the given ID from the main slave pool. + * If the ID doesn't exist in the main slave pool then undefined is returned. * @param {number} ID - * @returns {FC.SlaveState} + * @returns {FC.SlaveState} will return undefined if the ID is invalid */ -globalThis.slaveStateById = function(ID) { +globalThis.getSlave = function(ID) { const index = V.slaveIndices[ID]; - return index === undefined ? null : V.slaves[index]; + return index === undefined ? undefined : V.slaves[index]; }; /** + * Overwrite the given ID in the main slave pool with the given slave object. + * Will throw an error if slave is not an object or if the given ID is not in the main slave pool * @param {number} ID - * @returns {FC.SlaveState} will return undefined if the ID is invalid + * @param {FC.SlaveState} slave */ -globalThis.getSlave = function(ID) { +globalThis.overwriteSlave = function(ID, slave) { + if (!slave || !(typeof slave === "object") || slave === null || Array.isArray(slave)) { + throw new Error(`Passed object is not a SlaveState object. Object: ${JSON.stringify(slave)}`); + } const index = V.slaveIndices[ID]; - return index === undefined ? undefined : V.slaves[index]; + if (index !== undefined) { + // @ts-expect-error V.slaves is read only + V.slaves[index] = slave; + } else { + throw new Error(`No slave exists with ID '${ID}' in the main slave pool`); + } +}; + +/** + * returns an array of all slaves from the main slave pool + * @returns {FC.SlaveState[]} + */ +globalThis.getSlaves = () => { + return /** @type {FC.SlaveState[]} */ (V.slaves); }; /** @@ -3849,7 +3869,7 @@ globalThis.getTankSlave = function(ID) { }; /** - * NOTE: this only checks V.PC and V.slaves, search through `getAllHumans()` if you need to truly check all humans + * NOTE: this only checks V.PC and the main slave pool, search through `getAllHumanStates()` if you need to truly check all humans * @param {number} ID * @returns {FC.HumanState} will return undefined if the ID is invalid */ @@ -3939,7 +3959,7 @@ globalThis.randomRapeRivalryTarget = function(slave, predicate) { predicate = (() => true); } - const arr = V.slaves.filter((s) => { return canBeARapeRival(s) && canRape(slave, s); }).shuffle(); + const arr = getSlaves().filter((s) => { return canBeARapeRival(s) && canRape(slave, s); }).shuffle(); return arr.find(predicate); }; @@ -3961,7 +3981,7 @@ globalThis.restoreTraitor = function() { if (V.traitorStats.PCfather > 0) { V.PC.father = V.traitor.ID; } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (V.traitorStats.traitorMother.includes(slave.ID)) { slave.mother = V.traitor.ID; } @@ -3998,7 +4018,7 @@ globalThis.restoreTraitor = function() { pca.origBodyOwnerID = V.traitor.ID; } } - for (const slave of V.slaves) { + for (const slave of getSlaves()) { WombChangeID(slave, V.traitor.missingParentTag, V.traitor.ID); } newSlave(V.traitor); /* skip New Slave Intro */ diff --git a/src/js/utilsSlaves.js b/src/js/utilsSlaves.js index 2a7d32f07ba42368eb255383312102d3d507bdc4..e16652bb384472f6c3bfb43e6fb3eb9ff23404a4 100644 --- a/src/js/utilsSlaves.js +++ b/src/js/utilsSlaves.js @@ -5,20 +5,20 @@ globalThis.cumSlaves = function() { - return V.slaves.filter(s => (s.assignment === Job.MILKED || s.assignment === Job.DAIRY) && s.balls > 0 && s.ballType === "human"); + return getSlaves().filter(s => (s.assignment === Job.MILKED || s.assignment === Job.DAIRY) && s.balls > 0 && s.ballType === "human"); }; globalThis.haremLength = function() { - return V.slaves.filter(s => [Job.FUCKTOY, Job.MASTERSUITE, Job.CONCUBINE].includes(s.assignment)).length; + return getSlaves().filter(s => [Job.FUCKTOY, Job.MASTERSUITE, Job.CONCUBINE].includes(s.assignment)).length; }; globalThis.fuckSlavesLength = function() { - return V.slaves.filter(s => [Job.FUCKTOY, Job.MASTERSUITE, Job.CONCUBINE].includes(s.assignment) && s.rules.release.master !== 0).length; + return getSlaves().filter(s => [Job.FUCKTOY, Job.MASTERSUITE, Job.CONCUBINE].includes(s.assignment) && s.rules.release.master !== 0).length; }; globalThis.servantsLength = function() { - return V.slaves.filter(s => [Job.HOUSE, Job.QUARTER].includes(s.assignment)).length; + return getSlaves().filter(s => [Job.HOUSE, Job.QUARTER].includes(s.assignment)).length; }; globalThis.getRieEligibleSlaves = function() { - return V.slaves.filter(s => s.fuckdoll === 0 && + return getSlaves().filter(s => s.fuckdoll === 0 && (assignmentVisible(s) || [Job.MASTERSUITE, Job.CONCUBINE, Job.QUARTER].includes(s.assignment)) && !V.eventControl.RIESkip.includes(s.ID) ); @@ -97,16 +97,16 @@ globalThis.SlaveSort = function() { /** @param {FC.SlaveState[]} [slaves] */ function sortSlaves(slaves) { - slaves = slaves || V.slaves; + slaves = slaves || getSlaves(); slaves.sort(_comparator()); - if (slaves === V.slaves) { + if (slaves === getSlaves()) { V.slaveIndices = slaves2indices(); } } /** @param {number[]} [slaveIDs] */ function sortIDs(slaveIDs) { - const slaves = V.slaves; + const slaves = getSlaves(); const slaveIndices = V.slaveIndices; const cmp = _comparator(); slaveIDs = slaveIDs || slaves.map(s => s.ID); @@ -115,7 +115,7 @@ globalThis.SlaveSort = function() { /** @param {number[]} [slaveIndices] */ function sortIndices(slaveIndices) { - const slaves = V.slaves; + const slaves = getSlaves(); const cmp = _comparator(); slaveIndices = slaveIndices || [...slaves.keys()]; slaveIndices.sort((ia, ib) => cmp(slaves[ia], slaves[ib])); @@ -167,7 +167,7 @@ globalThis.slaveSortMinor = function(slaves) { * @param {FC.SlaveState[]} [slaveArray] * @returns {FC.SlaveState[]} sorted from best to worst */ -globalThis.getBestSlaves = function({part, count = 3, largest = true, filter = (() => true)}, slaveArray = V.slaves) { +globalThis.getBestSlaves = function({part, count = 3, largest = true, filter = (() => true)}, slaveArray = getSlaves()) { const partCB = _.isFunction(part) ? part : (slave) => slave[part]; const sortMethod = largest ? (left, right) => right.value - left.value : (left, right) => left.value - right.value; @@ -190,7 +190,7 @@ globalThis.getBestSlavesIDs = function(info) { * @param {FC.SlaveState[]} [slaves] * @returns {{[key: string]: number}} */ -globalThis.slaves2indices = function(slaves = V.slaves) { +globalThis.slaves2indices = function(slaves = getSlaves()) { return slaves.reduce((acc, slave, i) => { acc[slave.ID] = i; return acc; @@ -247,7 +247,7 @@ globalThis.penthouseCensus = function() { return true; // takes her own room } - const penthouseSlaves = V.slaves.filter(s => assignmentVisible(s)); + const penthouseSlaves = getSlaves().filter(s => assignmentVisible(s)); V.roomsPopulation = penthouseSlaves.filter(occupiesRoom).length; V.dormitoryPopulation = penthouseSlaves.filter(s => s.rules.living !== "luxurious").length; }; diff --git a/src/js/wombJS.js b/src/js/wombJS.js index 5d4d09387c17d44dad2a20e3fd25dfeba6b116f7..2c1ac93c3bc16663f26d6e70c32fc5fb4f978c9f 100644 --- a/src/js/wombJS.js +++ b/src/js/wombJS.js @@ -797,7 +797,7 @@ globalThis.FetusGlobalReserveCount = function(reserveType) { return 0; } - V.slaves.forEach(function(slave) { + getSlaves().forEach(function(slave) { slave.womb.forEach(function(ft) { if (ft.reserve === reserveType) { cnt++; diff --git a/src/js/wombT+T.js b/src/js/wombT+T.js index 86885bc4fdec151feb5aced9f89e0dcd92cd21ab..504acaf07ec74b01aacdfddad2184aa169dba4d7 100644 --- a/src/js/wombT+T.js +++ b/src/js/wombT+T.js @@ -230,7 +230,7 @@ globalThis.transplantingTool = ( let option = options.addOption(`Select a host`, "receptrix"); App.UI.DOM.appendNewElement("h4", transplantDiv, "Slave details"); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if ((mother.ID !== slave.ID && slave.ovaries > 0 || slave.mpreg > 0) && isSlaveAvailable(slave) && slave.preg >= 0 && slave.preg < slave.pregData.normalBirth / 10 && slave.pregWeek >= 0 && slave.pubertyXX === 1 && slave.pregType < 12 && diff --git a/src/neighbor/neighborInteract.js b/src/neighbor/neighborInteract.js index 3d57af47c0ce43d8028319bbc31fa65ccbc107b5..96ee2c3be3ce3c4e6cae5c66f35b98afc5d11b0b 100644 --- a/src/neighbor/neighborInteract.js +++ b/src/neighbor/neighborInteract.js @@ -313,7 +313,7 @@ App.Neighbor.Interact = function() { } else { let linkText = `Recall and reenslave ${him}`; const residentList = [agent.ID]; - const agentPartner = V.slaves.find((s) => s.assignment === Job.AGENTPARTNER && s.relationshipTarget === agent.ID); + const agentPartner = getSlaves().find((s) => s.assignment === Job.AGENTPARTNER && s.relationshipTarget === agent.ID); if (agentPartner) { linkText = `Recall them and reenslave your agent`; residentList.push(agentPartner.ID); diff --git a/src/npc/children/childSummary.js b/src/npc/children/childSummary.js index 66cbd7e5c02a2a85a703348784c273d08afffa57..d6116eb858a232ee7b7c3a322cc773fd0b2f343d 100644 --- a/src/npc/children/childSummary.js +++ b/src/npc/children/childSummary.js @@ -3812,12 +3812,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { const {daughter, sister, wife} = getPronouns(child); let handled = 0; if (child.mother > 0) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.mother; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s ${daughter}`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s ${daughter}`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; @@ -3835,12 +3835,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { r += `${V.missingTable[child.mother].fullName}'s ${daughter} `; } if (child.father > 0 && child.father !== child.mother) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.father; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s ${daughter}`; - if (child.relationshipTarget === V.slaves[_ssj].ID && handled !== 1) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s ${daughter}`; + if (child.relationshipTarget === getSlaves()[_ssj].ID && handled !== 1) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; @@ -3858,24 +3858,24 @@ App.Facilities.Nursery.ChildSummary = function(child) { r += `${V.missingTable[child.father].fullName}'s ${daughter}`; } if (child.daughters === 1) { - let _ssj = V.slaves.findIndex(function(s) { + let _ssj = getSlaves().findIndex(function(s) { return s.mother === child.ID; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s mother`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s mother`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; } } r += " "; - _ssj = V.slaves.findIndex(function(s) { + _ssj = getSlaves().findIndex(function(s) { return s.father === child.ID; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s father`; - if (child.relationshipTarget === V.slaves[_ssj].ID && handled !== 1) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s father`; + if (child.relationshipTarget === getSlaves()[_ssj].ID && handled !== 1) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; @@ -3886,12 +3886,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { r += `multiple daughters `; } if (child.sisters === 1) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return areSisters(s, child) > 0; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s ${sister}`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s ${sister}`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTermShort(child); r += `& ${friendShipShort}`; handled = 1; @@ -3902,11 +3902,11 @@ App.Facilities.Nursery.ChildSummary = function(child) { r += `multiple sisters `; } if (child.relationship > 0 && handled !== 1) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.relationshipTarget; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s`; + r += `${SlaveFullName(getSlaves()[_ssj])}'s`; const friendShipShort = relationshipTermShort(child); r += ` ${friendShipShort}`; } @@ -3934,17 +3934,17 @@ App.Facilities.Nursery.ChildSummary = function(child) { function shortRival(child) { if (child.rivalry !== 0) { r += ` `; - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.rivalryTarget; }); if (_ssj !== -1) { r += `<span class="lightsalmon">`; if (child.rivalry <= 1) { - r += `Disl ${SlaveFullName(V.slaves[_ssj])}`; + r += `Disl ${SlaveFullName(getSlaves()[_ssj])}`; } else if (child.rivalry <= 2) { - r += `${SlaveFullName(V.slaves[_ssj])}'s rival`; + r += `${SlaveFullName(getSlaves()[_ssj])}'s rival`; } else { - r += `Hates ${SlaveFullName(V.slaves[_ssj])}`; + r += `Hates ${SlaveFullName(getSlaves()[_ssj])}`; } r += `</span> `; } @@ -3957,12 +3957,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { function longExtendedFamily(child) { let handled = 0; if (child.mother > 0) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.mother; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s <span class="lightgreen">daughter`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s <span class="lightgreen">daughter`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -3981,12 +3981,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { r += `${V.missingTable[child.mother].fullName}'s <span class="lightgreen">daughter.</span> `; } if (child.father > 0 && child.father !== child.mother) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.father; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s <span class="lightgreen">daughter`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s <span class="lightgreen">daughter`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -4005,24 +4005,24 @@ App.Facilities.Nursery.ChildSummary = function(child) { r += `${V.missingTable[child.father].fullName}'s <span class="lightgreen">daughter.</span> `; } if (child.daughters === 1) { - let _ssj = V.slaves.findIndex(function(s) { + let _ssj = getSlaves().findIndex(function(s) { return s.mother === child.ID; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s <span class="lightgreen">mother`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s <span class="lightgreen">mother`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; } r += `.</span> `; } - _ssj = V.slaves.findIndex(function(s) { + _ssj = getSlaves().findIndex(function(s) { return s.father === child.ID; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s <span class="lightgreen">father`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s <span class="lightgreen">father`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -4039,12 +4039,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { } } if (child.sisters === 1) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return areSisters(s, child) > 0; }); if (_ssj !== -1) { - r += `${SlaveFullName(V.slaves[_ssj])}'s <span class="lightgreen">sister`; - if (child.relationshipTarget === V.slaves[_ssj].ID) { + r += `${SlaveFullName(getSlaves()[_ssj])}'s <span class="lightgreen">sister`; + if (child.relationshipTarget === getSlaves()[_ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -4061,12 +4061,12 @@ App.Facilities.Nursery.ChildSummary = function(child) { } } if (child.relationship > 0 && handled !== 1) { - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.relationshipTarget; }); if (_ssj !== -1) { const friendship = relationshipTerm(child); - r += `${SlaveFullName(V.slaves[_ssj])}'s `; + r += `${SlaveFullName(getSlaves()[_ssj])}'s `; r += `<span class="lightgreen">${friendship}.</span> `; } } else if (child.relationship === -3 && child.mother !== -1 && child.father !== -1) { @@ -4093,16 +4093,16 @@ App.Facilities.Nursery.ChildSummary = function(child) { function longRival(child) { if (child.rivalry !== 0) { r += ` `; - const _ssj = V.slaves.findIndex(function(s) { + const _ssj = getSlaves().findIndex(function(s) { return s.ID === child.rivalryTarget; }); if (_ssj !== -1) { if (child.rivalry <= 1) { - r += `<span class="lightsalmon">Dislikes</span> ${SlaveFullName(V.slaves[_ssj])}. `; + r += `<span class="lightsalmon">Dislikes</span> ${SlaveFullName(getSlaves()[_ssj])}. `; } else if (child.rivalry <= 2) { - r += `${SlaveFullName(V.slaves[_ssj])}'s <span class="lightsalmon">rival.</span> `; + r += `${SlaveFullName(getSlaves()[_ssj])}'s <span class="lightsalmon">rival.</span> `; } else { - r += `<span class="lightsalmon">Hates</span> ${SlaveFullName(V.slaves[_ssj])}. `; + r += `<span class="lightsalmon">Hates</span> ${SlaveFullName(getSlaves()[_ssj])}. `; } } r += " "; diff --git a/src/npc/children/longChildDescription.js b/src/npc/children/longChildDescription.js index f0b7f89278862f3aed316e17bc432ff158a59321..70c7a14279a9ffba1389140f22152ce1e1d06406 100644 --- a/src/npc/children/longChildDescription.js +++ b/src/npc/children/longChildDescription.js @@ -7,7 +7,6 @@ App.Facilities.Nursery.LongChildDescription = function(child, {market = 0, event // MARK: Declarations const arcology = V.arcologies[0]; const PC = V.PC; - const slaves = V.slaves; const desc = child.actualAge < 13 ? `child` : `teen`; // TODO: const father = child.father === -1 ? PC : getSlave(child.father); const mother = child.mother === -1 ? PC : getSlave(child.mother); diff --git a/src/npc/descriptions/descriptionWidgets.js b/src/npc/descriptions/descriptionWidgets.js index 9ff56a5facb9f0c38cb85fb27e3b8c8f596a8c36..d330576e16744b7a764fea5eefa10cb0301eef11 100644 --- a/src/npc/descriptions/descriptionWidgets.js +++ b/src/npc/descriptions/descriptionWidgets.js @@ -1393,7 +1393,7 @@ App.Desc.sexualHistory = function(slave) { } if (slave.counter.slavesKnockedUp > 0 || slave.counter.slavesFathered > 0 || slave.counter.PCKnockedUp > 0) { - let PCChildrenFatheredCount = V.slaves.filter(s => s.father === slave.ID && s.mother === -1).length; // The slave is also the father of the children transferred from the PC's womb to other slave's one. + let PCChildrenFatheredCount = getSlaves().filter(s => s.father === slave.ID && s.mother === -1).length; // The slave is also the father of the children transferred from the PC's womb to other slave's one. r += `<span class="relationship">`; if (slave.counter.slavesKnockedUp > 0) { r += `${He}'s knocked up ${numberWithPluralOne(slave.counter.slavesKnockedUp, "other slave girl")} `; diff --git a/src/npc/generate/heroCreator.js b/src/npc/generate/heroCreator.js index fb06e20777f5d696bcf61838ea7cc3c35492cc8d..6d22c630da6f9b85cd3eefd0dc565d4398468e30 100644 --- a/src/npc/generate/heroCreator.js +++ b/src/npc/generate/heroCreator.js @@ -203,7 +203,7 @@ App.Utils.getHeroSlave = function(template, newAge = undefined) { */ let slave; if (heroSlave.mother === -9999 && heroSlave.father === -9998) { // The twins — Camille & Kennerly - slave = V.slaves.find(s => areSisters(s, heroSlave) > 0); + slave = getSlaves().find(s => areSisters(s, heroSlave) > 0); if (slave) { heroSlave.actualAge = slave.actualAge; heroSlave.physicalAge = heroSlave.actualAge; @@ -223,7 +223,7 @@ App.Utils.getHeroSlave = function(template, newAge = undefined) { } } if (heroSlave.mother === -9997 && heroSlave.father === -9996) { // The rebel siblings — Elisa & Martin - slave = V.slaves.find(s => areSisters(s, heroSlave) > 0); + slave = getSlaves().find(s => areSisters(s, heroSlave) > 0); if (slave) { const adjustedAge = adjustNewSiblingAge(heroSlave, slave, "Elisa", "Martin", 1, 1); newAge = adjustedAge; @@ -238,7 +238,7 @@ App.Utils.getHeroSlave = function(template, newAge = undefined) { } } if (heroSlave.mother === -9995 && heroSlave.father === -9994) { // The fruit siblings — Green & Purple Grape - slave = V.slaves.find(s => areSisters(s, heroSlave) > 0); + slave = getSlaves().find(s => areSisters(s, heroSlave) > 0); if (slave) { const adjustedAge = adjustNewSiblingAge(heroSlave, slave, "Green Grape", "Purple Grape", 5, 3); newAge = adjustedAge; @@ -253,7 +253,7 @@ App.Utils.getHeroSlave = function(template, newAge = undefined) { } } if (heroSlave.mother === -9993 && heroSlave.father === -9992) { // The professional siblings — Bai & Qiang - slave = V.slaves.find(s => areSisters(s, heroSlave) > 0); + slave = getSlaves().find(s => areSisters(s, heroSlave) > 0); if (slave) { const adjustedAge = adjustNewSiblingAge(heroSlave, slave, "Qiang", "Bai", 2, 2); newAge = adjustedAge; diff --git a/src/npc/infants/infantSummary.js b/src/npc/infants/infantSummary.js index 90bf6f628d4285ea45443eb51cdb10307bad7a97..ea4747450f651711b667b87e605d254155037f96 100644 --- a/src/npc/infants/infantSummary.js +++ b/src/npc/infants/infantSummary.js @@ -1563,12 +1563,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { let r = ``; if (child.mother > 0) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.mother; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s ${daughter}`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s ${daughter}`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; @@ -1587,12 +1587,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.father > 0 && child.father !== child.mother) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.father; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s ${daughter}`; - if (child.relationshipTarget === V.slaves[ssj].ID && handled !== 1) { + r += `${SlaveFullName(getSlaves()[ssj])}'s ${daughter}`; + if (child.relationshipTarget === getSlaves()[ssj].ID && handled !== 1) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; @@ -1611,24 +1611,24 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.daughters === 1) { - let ssj = V.slaves.findIndex(function(s) { + let ssj = getSlaves().findIndex(function(s) { return s.mother === child.ID; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s mother`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s mother`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; } } r += " "; - ssj = V.slaves.findIndex(function(s) { + ssj = getSlaves().findIndex(function(s) { return s.father === child.ID; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s father`; - if (child.relationshipTarget === V.slaves[ssj].ID && handled !== 1) { + r += `${SlaveFullName(getSlaves()[ssj])}'s father`; + if (child.relationshipTarget === getSlaves()[ssj].ID && handled !== 1) { const friendShipShort = relationshipTermShort(child); r += ` & ${friendShipShort}`; handled = 1; @@ -1640,12 +1640,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.sisters === 1) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return areSisters(s, child) > 0; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s ${sister}`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s ${sister}`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTermShort(child); r += `& ${friendShipShort}`; handled = 1; @@ -1657,11 +1657,11 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.relationship > 0 && handled !== 1) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.relationshipTarget; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s`; + r += `${SlaveFullName(getSlaves()[ssj])}'s`; const friendShipShort = relationshipTermShort(child); r += ` ${friendShipShort}`; } @@ -1683,12 +1683,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { let r = ``; if (child.mother > 0) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.mother; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s <span class="lightgreen">${daughter}`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s <span class="lightgreen">${daughter}`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -1709,12 +1709,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.father > 0 && child.father !== child.mother) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.father; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s <span class="lightgreen">${daughter}`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s <span class="lightgreen">${daughter}`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -1734,24 +1734,24 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.daughters === 1) { - let ssj = V.slaves.findIndex(function(s) { + let ssj = getSlaves().findIndex(function(s) { return s.mother === child.ID; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s <span class="lightgreen">mother`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s <span class="lightgreen">mother`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; } r += `.</span> `; } - ssj = V.slaves.findIndex(function(s) { + ssj = getSlaves().findIndex(function(s) { return s.father === child.ID; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s <span class="lightgreen">father`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s <span class="lightgreen">father`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -1769,12 +1769,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.sisters === 1) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return areSisters(s, child) > 0; }); if (ssj !== -1) { - r += `${SlaveFullName(V.slaves[ssj])}'s <span class="lightgreen">${sister}`; - if (child.relationshipTarget === V.slaves[ssj].ID) { + r += `${SlaveFullName(getSlaves()[ssj])}'s <span class="lightgreen">${sister}`; + if (child.relationshipTarget === getSlaves()[ssj].ID) { const friendShipShort = relationshipTerm(child); r += ` and ${friendShipShort}`; handled = 1; @@ -1792,12 +1792,12 @@ App.Facilities.Nursery.InfantSummary = function(child) { } if (child.relationship > 0 && handled !== 1) { - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.relationshipTarget; }); if (ssj !== -1) { const friendship = relationshipTerm(child); - r += `${SlaveFullName(V.slaves[ssj])}'s `; + r += `${SlaveFullName(getSlaves()[ssj])}'s `; r += `<span class="lightgreen">${friendship}.</span> `; } } else if (child.relationship === -3 && child.mother !== -1 && child.father !== -1) { @@ -1816,17 +1816,17 @@ App.Facilities.Nursery.InfantSummary = function(child) { if (child.rivalry !== 0) { r += ` `; - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.rivalryTarget; }); if (ssj !== -1) { r += `<span class="lightsalmon">`; if (child.rivalry <= 1) { - r += `Disl ${SlaveFullName(V.slaves[ssj])}`; + r += `Disl ${SlaveFullName(getSlaves()[ssj])}`; } else if (child.rivalry <= 2) { - r += `${SlaveFullName(V.slaves[ssj])}'s rival`; + r += `${SlaveFullName(getSlaves()[ssj])}'s rival`; } else { - r += `Hates ${SlaveFullName(V.slaves[ssj])}`; + r += `Hates ${SlaveFullName(getSlaves()[ssj])}`; } r += `</span> `; } @@ -1840,17 +1840,17 @@ App.Facilities.Nursery.InfantSummary = function(child) { if (child.rivalry !== 0) { r += ` `; - const ssj = V.slaves.findIndex(function(s) { + const ssj = getSlaves().findIndex(function(s) { return s.ID === child.rivalryTarget; }); if (ssj !== -1) { if (child.rivalry <= 1) { - r += `<span class="lightsalmon">Dislikes</span> ${SlaveFullName(V.slaves[ssj])}. `; + r += `<span class="lightsalmon">Dislikes</span> ${SlaveFullName(getSlaves()[ssj])}. `; } else if (child.rivalry <= 2) { - r += `${SlaveFullName(V.slaves[ssj])}'s <span class="lightsalmon">rival.</span> `; + r += `${SlaveFullName(getSlaves()[ssj])}'s <span class="lightsalmon">rival.</span> `; } else { - r += `<span class="lightsalmon">Hates</span> ${SlaveFullName(V.slaves[ssj])}. `; + r += `<span class="lightsalmon">Hates</span> ${SlaveFullName(getSlaves()[ssj])}. `; } } r += " "; diff --git a/src/npc/interaction/fSuckDick.js b/src/npc/interaction/fSuckDick.js index 55737558913acb96b3edf167219b1ad3b8551939..e9c48e77f21817ea74c8a68ced4dbde76894f92a 100644 --- a/src/npc/interaction/fSuckDick.js +++ b/src/npc/interaction/fSuckDick.js @@ -654,7 +654,7 @@ App.Interact.fSuckDick = function(slave) { function cleanup() { const text = []; - if (V.slaves.length > 1) { + if (getSlaves().length > 1) { text.push(`You order one of your other slaves to clean up the mess on the floor.`); } else if (canMove(slave)) { text.push(`You order ${slave.slaveName} to clean up the mess on the floor, which ${he} does.`); diff --git a/src/npc/interaction/killSlave.js b/src/npc/interaction/killSlave.js index 9d1fc74ffe3e513a3d12d91094c2d9646fcae6fd..ed2f6d2a448698bbee2a6d491de1a1d3f161ac86 100644 --- a/src/npc/interaction/killSlave.js +++ b/src/npc/interaction/killSlave.js @@ -308,7 +308,7 @@ App.UI.SlaveInteract.killSlave = function(slave) { let relationshipTarget = null; let rival = null; - for (const target of V.slaves) { + for (const target of getSlaves()) { if (target.devotion > 50 && isWife) { target.trust -= 25; } @@ -567,7 +567,7 @@ App.UI.SlaveInteract.killSlave = function(slave) { function getWifeEffects() { const subDiv = document.createElement("div"); - V.slaves + getSlaves() .filter(slave => slave.devotion > 50) .forEach(slave => slave.devotion -= 15); diff --git a/src/npc/interaction/slaveOnSlaveFeeding/slaveOnSlaveFeeding.js b/src/npc/interaction/slaveOnSlaveFeeding/slaveOnSlaveFeeding.js index 2efe2a856a1092a999f48546fb2f0dccb075f55a..90b4771aef030cb02874b4c3e99942cb1e83b94c 100644 --- a/src/npc/interaction/slaveOnSlaveFeeding/slaveOnSlaveFeeding.js +++ b/src/npc/interaction/slaveOnSlaveFeeding/slaveOnSlaveFeeding.js @@ -40,7 +40,7 @@ App.UI.SlaveInteract.slaveOnSlaveFeedingSelection = function(slave) { header.append(App.UI.DOM.makeElement("th", name)); } - for (const tapSlave of V.slaves) { + for (const tapSlave of getSlaves()) { let output; if (inflationType === "milk") { output = (tapSlave.lactation > 0) ? milkLoad(tapSlave) : 0; diff --git a/src/npc/slaveBot/slaveBotGreetings.js b/src/npc/slaveBot/slaveBotGreetings.js index fd8a9e5f786980ae782deb92f4ff8d68f718fe25..04315e1dea5c1706598a17f06d0f593bc6a13ffe 100644 --- a/src/npc/slaveBot/slaveBotGreetings.js +++ b/src/npc/slaveBot/slaveBotGreetings.js @@ -1583,7 +1583,7 @@ App.UI.SlaveInteract.SlaveBotGreetings = [ // SRC torpedoSqueeze let r = []; r.push(`The penthouse bathroom has a long counter and mirror arrangement with many sinks, so a number of slaves can get ready at once. During those moments of the day when`); - if (V.slaves.length > 10) { + if (getSlaves().length > 10) { r.push(`many`); } else { r.push(`more than one`); diff --git a/src/npc/startingGirls/editFamily.js b/src/npc/startingGirls/editFamily.js index 8568f8c131075887055dbed0e61136899dac6352..32b90d13d782ce762c0dfdc75c6075cef0f8a30d 100644 --- a/src/npc/startingGirls/editFamily.js +++ b/src/npc/startingGirls/editFamily.js @@ -122,7 +122,7 @@ App.Intro.editFamily = function(slave, cheat) { ) ); - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { const relTerm = relativeTerm(slave, potentialRel); const link = document.createElement("span"); link.append(App.UI.DOM.link( @@ -192,7 +192,7 @@ App.Intro.editFamily = function(slave, cheat) { ) ); - for (const potentialRival of V.slaves) { + for (const potentialRival of getSlaves()) { linkArray.push(App.UI.DOM.link( potentialRival.slaveName, () => { @@ -241,7 +241,7 @@ App.Intro.editFamily = function(slave, cheat) { ); } - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if (canBecomeMotherOf(slave, potentialRel) && potentialRel.newGamePlus === 0) { linkArray.push( App.UI.DOM.link( @@ -294,7 +294,7 @@ App.Intro.editFamily = function(slave, cheat) { ); } - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if (canBecomeFatherOf(slave, potentialRel) && potentialRel.newGamePlus === 0) { linkArray.push( App.UI.DOM.link( @@ -349,7 +349,7 @@ App.Intro.editFamily = function(slave, cheat) { ); } - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if ((!mother || canBecomeMotherOf(potentialRel, mother)) && potentialRel.newGamePlus === 0) { linkArray.push( App.UI.DOM.link( @@ -418,7 +418,7 @@ App.Intro.editFamily = function(slave, cheat) { ); } - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if ((!father || canBecomeFatherOf(potentialRel, father)) && potentialRel.newGamePlus === 0) { linkArray.push( App.UI.DOM.link( @@ -461,7 +461,7 @@ App.Intro.editFamily = function(slave, cheat) { App.UI.DOM.link( "Reset", () => { - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.mother === slave.ID && s.newGamePlus === 0) { s.mother = 0; } @@ -486,7 +486,7 @@ App.Intro.editFamily = function(slave, cheat) { ); } - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if (canBecomeMotherOf(potentialRel, slave) && potentialRel.newGamePlus === 0) { linkArray.push( App.UI.DOM.link( @@ -536,7 +536,7 @@ App.Intro.editFamily = function(slave, cheat) { App.UI.DOM.link( "Reset", () => { - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.father === slave.ID && s.newGamePlus === 0) { s.father = 0; } @@ -561,7 +561,7 @@ App.Intro.editFamily = function(slave, cheat) { ); } - for (const potentialRel of V.slaves) { + for (const potentialRel of getSlaves()) { if (canBecomeFatherOf(potentialRel, slave) && potentialRel.newGamePlus === 0) { linkArray.push( App.UI.DOM.link( @@ -599,7 +599,7 @@ App.Intro.editFamily = function(slave, cheat) { App.UI.DOM.link( "Reset ALL PC Relatives", () => { - for (const s of V.slaves) { + for (const s of getSlaves()) { if (s.newGamePlus === 0) { if (s.mother === V.PC.ID || s.mother === V.PC.mother) { s.mother = 0; diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js index b32f2cdd5a04d7f1322df4e4ef942570a471b619..0b33b65ef084ee5cb68cacb8cbf1fa19d0e80b28 100644 --- a/src/npc/startingGirls/startingGirls.js +++ b/src/npc/startingGirls/startingGirls.js @@ -308,7 +308,7 @@ App.StartingGirls.listOfSlavesWithParent = function(parent, id) { if (V.PC[parent] === id) { slaveNames.push("You"); } - const slavesWithParent = V.slaves.filter((s) => s[parent] === id); + const slavesWithParent = getSlaves().filter((s) => s[parent] === id); slaveNames = slaveNames.concat(slavesWithParent.map((s) => s.slaveName)); return slaveNames.join(" | "); }; @@ -319,7 +319,7 @@ App.StartingGirls.listOfSlavesWithParent = function(parent, id) { */ App.StartingGirls.uncommittedFamilyTree = function(slave) { /** @type {FC.HumanState[]} */ - let tSlaves = V.slaves.filter(s => s.ID !== slave.ID); // exclude the unedited copy of this slave, if it exists + let tSlaves = getSlaves().filter(s => s.ID !== slave.ID); // exclude the unedited copy of this slave, if it exists return renderFamilyTree(tSlaves.concat([slave]), slave.ID); }; diff --git a/src/npc/startingGirls/startingGirlsPassage.js b/src/npc/startingGirls/startingGirlsPassage.js index 53061c92c655ebf2169057d988aba5bac19f3125..8adc6b750e72b2b35032ae7148efa0c335027746 100644 --- a/src/npc/startingGirls/startingGirlsPassage.js +++ b/src/npc/startingGirls/startingGirlsPassage.js @@ -6,7 +6,7 @@ App.StartingGirls.passage = function() { const el = new DocumentFragment(); let r = []; let linkArray = []; - if (V.slaves.length === 0) { + if (getSlaves().length === 0) { r.push(`You're no stranger to the Free Cities, which means you're no stranger to slavery. If you wish, you can bring slaves from your past life with you to your arcology. You can spend your cash reserves on slaves here, or bring it with you to start the game. Slaves created here will be much cheaper than if they were purchased on the market.`); if (V.PC.dick !== 0 && V.PC.vagina !== -1 && (V.seeDicks !== 0 || V.makeDicks === 1)) { r.push(`Since you have both a penis and a vagina yourself, you've obviously had access to a source of advanced surgery and organ farming. <span class="skill player">Slaves get a smaller cost increase here for having both penises and vaginas, and for having both testicles and ovaries.</span>`); @@ -23,13 +23,13 @@ App.StartingGirls.passage = function() { r.push(`these slaves, <span class="skill player">they cost half of what they normally would have here.</span>`); } } else { - const pronoun = V.slaves.length > 1 ? "they" : getPronouns(V.slaves[0]).he; + const pronoun = getSlaves().length > 1 ? "they" : getPronouns(getSlaves()[0]).he; r.push(`The following slave records have been finalized; ${pronoun} will arrive with you when you take over your new arcology.`); } r.push(App.UI.DOM.makeElement("div", "Current cash reserves can be found on the far left sidebar.")); App.Events.addNode(el, r, "p"); - if (V.slaves.length > 0) { - for (const slave of V.slaves) { + if (getSlaves().length > 0) { + for (const slave of getSlaves()) { const cost = slave.slaveCost; App.Events.addNode(el, [ App.UI.DOM.slaveDescriptionDialog(slave), @@ -344,7 +344,7 @@ App.StartingGirls.passage = function() { ) ); - const newSlaves = V.slaves.filter(s => s.newGamePlus === 0); + const newSlaves = getSlaves().filter(s => s.newGamePlus === 0); if (newSlaves.length > 0) { linkArray.push( App.UI.DOM.link( diff --git a/src/npc/surgery/bodySwap/bodySwap.js b/src/npc/surgery/bodySwap/bodySwap.js index 99af7253e2dc64f60f40cd5866daa8b104df290f..3cfeb506efe31b1a372be31ee7e46ea0e0d6ef3e 100644 --- a/src/npc/surgery/bodySwap/bodySwap.js +++ b/src/npc/surgery/bodySwap/bodySwap.js @@ -259,7 +259,7 @@ globalThis.bodySwapSelection = function(soul) { App.UI.DOM.appendNewElement("div", el, `The surgeon awaits the pair of slaves to be strapped into the surgery. So far only ${soul.slaveName} is prepped:`, "scene-intro"); App.UI.DOM.appendNewElement("div", el, `Select ${(V.seeExtreme) ? `an eligible slave (any slave who is not a fuckdoll)` : `a slave`} who will be trading bodies with ${him}. This operation will cost ${cashFormat(cost)}.`); - for (const body of V.slaves) { + for (const body of getSlaves()) { if (body.ID === soul.ID) { // Do not allow slave to be swapped with themselves continue; } @@ -333,7 +333,7 @@ globalThis.huskSwapSelection = function(body) { `, "scene-intro"); App.UI.DOM.appendNewElement("div", el, `Select the slave whose mind will be transferred into the waiting husk. Amputated slaves must not be wearing prosthetics. This operation will cost ${cashFormat(cost)}.`); - for (const soul of V.slaves) { + for (const soul of getSlaves()) { if (isSlaveAvailable(soul)) { if (soul.fuckdoll === 0) { if (!hasAnyProstheticLimbs(soul)) { diff --git a/src/npc/surgery/bodySwap/huskSlaveSwap.js b/src/npc/surgery/bodySwap/huskSlaveSwap.js index 65399965cbdfb9e1188b37a8b861626720376ad1..0e00486cd02f4c1b7fa66e4cc41ef03fc73a9000 100644 --- a/src/npc/surgery/bodySwap/huskSlaveSwap.js +++ b/src/npc/surgery/bodySwap/huskSlaveSwap.js @@ -33,7 +33,7 @@ App.UI.SlaveInteract.huskSlaveSwap = function() { let r = []; r.push(`${target.slaveName}'s old body was bought by the Flesh Heap for ${cashFormat(payout)}.`); if (target.bodySwap > 0) { - const origBodyOwner = V.slaves.find(s => s.origBodyOwnerID === target.ID); + const origBodyOwner = getSlaves().find(s => s.origBodyOwnerID === target.ID); if (origBodyOwner) { origBodyOwner.origBodyOwnerID = 0; const { diff --git a/src/npc/surgery/bodySwap/slaveSlaveSwap.js b/src/npc/surgery/bodySwap/slaveSlaveSwap.js index 22d6a135bd4ba5c4577908d687232e80ee7b09bb..629dc291687635d16bcc0b0809528b6c2d99c4b6 100644 --- a/src/npc/surgery/bodySwap/slaveSlaveSwap.js +++ b/src/npc/surgery/bodySwap/slaveSlaveSwap.js @@ -72,7 +72,7 @@ App.UI.SlaveInteract.slaveSlaveSwap = function() { // if my new body originally belonged to someone else, update the original owner's reference to point to me // note that the original owner may also be me; we'll take care of that later (after generating the reaction) // but we never want to find a self-reference, since those are always temporary - const originalOwner = V.slaves.find(s => s.origBodyOwnerID === opposingClone.ID && s.origBodyOwnerID !== s.ID); + const originalOwner = getSlaves().find(s => s.origBodyOwnerID === opposingClone.ID && s.origBodyOwnerID !== s.ID); if (originalOwner) { originalOwner.origBodyOwnerID = target.ID; } diff --git a/src/npc/surgery/cloningWorkaround.js b/src/npc/surgery/cloningWorkaround.js index 907c283cd094aafcd79e351d3b6d3e317ce85d37..9a3f22b49246a0e98539be6239a530d1d6c04d55 100644 --- a/src/npc/surgery/cloningWorkaround.js +++ b/src/npc/surgery/cloningWorkaround.js @@ -30,7 +30,7 @@ App.UI.cloningWorkaround = function() { App.UI.reload(); } )); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); if (donatrix === slave.ID) { div.classList.add("note"); @@ -47,7 +47,7 @@ App.UI.cloningWorkaround = function() { App.UI.DOM.appendNewElement("h2", node, `Surrogate`); App.UI.DOM.appendNewElement("div", node, `Chosen surrogate: ${receive}`); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (canBeReceptrix(slave)) { const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); if (receptrix === slave.ID) { diff --git a/src/npc/surgery/surrogacyWorkaround.js b/src/npc/surgery/surrogacyWorkaround.js index 6d660d50746fcf81d3aa82fdd23016bd3447d29a..a3aa41053f16fc2eb702a16c7111a7ea8314dbe5 100644 --- a/src/npc/surgery/surrogacyWorkaround.js +++ b/src/npc/surgery/surrogacyWorkaround.js @@ -50,7 +50,7 @@ App.UI.surrogacyWorkaround = function() { App.UI.DOM.appendNewElement("h2", node, `Semen donatrix: ${impreg}`); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (slave.balls > 0 && slave.pubertyXY === 1 && isSlaveAvailable(slave) && canBreed(getHuman(donatrix), slave)) { const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); div.append(" ", App.UI.DOM.link( @@ -109,7 +109,7 @@ App.UI.surrogacyWorkaround = function() { App.UI.DOM.appendNewElement("h2", node, `Chosen surrogate: ${receive}`); - for (const slave of V.slaves) { + for (const slave of getSlaves()) { if (canBeReceptrix(slave)) { const div = App.UI.DOM.appendNewElement("div", node, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); div.append(" ", App.UI.DOM.link( diff --git a/src/personalAssistant/assistantAppearance.js b/src/personalAssistant/assistantAppearance.js index b7fa3065b70269a86457a60bdce6eee9ef1c7429..65d2bd27f3c88a6151b5043c7c755b9174c1aae3 100644 --- a/src/personalAssistant/assistantAppearance.js +++ b/src/personalAssistant/assistantAppearance.js @@ -34,7 +34,7 @@ globalThis.PersonalAssistantAppearance = function() { const { hisU, himU, himselfU, girlU } = getNonlocalPronouns(V.seeDicks).appendSuffix('U'); - const masturbationAllowed = V.slaves.some((s) => s.rules.release.masturbation === 1) ? 1 : 0; + const masturbationAllowed = getSlaves().some((s) => s.rules.release.masturbation === 1) ? 1 : 0; const paSeed = random(1, 8); const r = []; switch (V.assistant.appearance) { diff --git a/src/player/managePersonalAffairs.js b/src/player/managePersonalAffairs.js index 7abb1feb747ceb83b13877899a360f56b7b3bf36..46c2e1369ea2bdf3bea2a88c381216ea11679cc2 100644 --- a/src/player/managePersonalAffairs.js +++ b/src/player/managePersonalAffairs.js @@ -348,7 +348,7 @@ App.UI.managePersonalAffairs = function() { function family() { App.UI.DOM.appendNewElement("h3", familyDiv, `Family`); - familyDiv.append(App.UI.DOM.linkReplace(`Pull up the file on your family tree`, renderFamilyTree(V.slaves, -1))); + familyDiv.append(App.UI.DOM.linkReplace(`Pull up the file on your family tree`, renderFamilyTree(getSlaves(), -1))); if (totalPlayerRelatives(PC) > 0 || (V.showMissingSlaves && (PC.mother in V.missingTable || PC.father in V.missingTable))) { familyDiv.append(App.Desc.family(PC, true));