diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index f0ee3731c7161241a31dd187d770126a9d355023..3099aa5cc7bff4da41e486e6b6aa1e0f0228f723 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -60,7 +60,7 @@ App.Data.defaultGameStateVariables = { }, compressSocialEffects: 0 }, - /** @type {marketGlobal|null} */ + /** @type {App.Markets.Global|null} */ market: null, FSNamePref: 0, HGFormality: 1, @@ -910,6 +910,7 @@ App.Data.resetOnNGPlus = { ConcubineID: 0, justiceEvents: ["slave deal", "slave training", "majority deal", "indenture deal", "virginity deal", "breeding deal"], /* not in setupVars because we remove events from this array as they occur */ + /** @type {Array<FC.SlaveMarketName>} */ prisonCircuit: ["low tier criminals", "gangs and smugglers", "white collar", "military prison"], prisonCircuitIndex: 0, diff --git a/src/arcologyBuilding/markets.js b/src/arcologyBuilding/markets.js index 34fc2eb9c2de1fedcfded6e0551b52bba11deaeb..402c9ffafca2973f65bf7aa85f311f57afce5ade 100644 --- a/src/arcologyBuilding/markets.js +++ b/src/arcologyBuilding/markets.js @@ -141,10 +141,7 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell { * @private */ _prepareCorporateMarket() { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = "corporate"; - V.market.newSlaves = []; - V.market.numArcology = 1; + V.market = new App.Markets.Global("corporate"); V.nextButton = "Back to Main"; V.nextLink = "Main"; V.returnTo = "Main"; diff --git a/src/endWeek/saRecruitGirls.js b/src/endWeek/saRecruitGirls.js index e901877d7e810173370047486f2c8652af92b9f1..77b105fd9b5e52e845cdb86aa85a612553462f79 100644 --- a/src/endWeek/saRecruitGirls.js +++ b/src/endWeek/saRecruitGirls.js @@ -69,56 +69,11 @@ App.SlaveAssignment.recruitGirls = (function() { return seed; } - /** - * @param {App.Entity.SlaveState} slave - * - */ - function calcIdleTarget(slave) { - /* Note on target sum: HG and Recruiter are the initial 2 counted (no facility req'd), while HGSuite counts the HG's girl, other facilities count associated leader */ + function calcIdleTarget() { if (V.recruiterIdleRule === "number") { idleTarget = V.recruiterIdleNumber; } else if (V.recruiterIdleRule === "facility") { - idleTarget = (2 + V.brothel + V.club + V.arcade + V.dairy + V.servantsQuarters + V.masterSuite); - if (V.HGSuite) { - idleTarget++; - } - if (V.dojo) { - idleTarget++; - } - if (V.brothel) { - idleTarget++; - } - if (V.club) { - idleTarget++; - } - if (V.dairy && V.dairyRestraintsSetting < 2) { - idleTarget++; - } - if (V.farmyard) { - idleTarget++; - } - if (V.servantsQuarters) { - idleTarget++; - } - if (V.masterSuite) { - idleTarget++; - } - if (V.schoolroom) { - idleTarget++; - } - if (V.spa) { - idleTarget++; - } - if (V.nursery) { - idleTarget++; - } - if (V.clinic) { - idleTarget++; - } - if (V.cellblock) { - idleTarget++; - } - idleTarget = Math.max(idleTarget, 20); + idleTarget = App.Utils.recruiterFacilitySpace(); } else { idleTarget = Infinity; } diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js index e5094ece96f52dfe1926a003298534431ecfa621..c57ddb8cc01b48944fca35934064c936e400c6fa 100644 --- a/src/events/randomEvent.js +++ b/src/events/randomEvent.js @@ -354,7 +354,7 @@ App.Events.getNonindividualRecruitmentEvents = function() { new App.Events.recFSDegradationist(), new App.Events.recFSDegradationistTwo(), new App.Events.recFSEdoRevivalist(), - new App.Events.recFSEgyptianRevivalistAcquisition(), + new App.Events.recFSEgyptianRevivalist(), new App.Events.recFSGenderFundamentalist(), new App.Events.recFSGenderFundamentalistTwo(), new App.Events.recFSGenderRadicalist(), diff --git a/src/events/recFS/recfsFSEgyptianRevivalistAcquisition.js b/src/events/recFS/recfsEgyptianRevivalist.js similarity index 94% rename from src/events/recFS/recfsFSEgyptianRevivalistAcquisition.js rename to src/events/recFS/recfsEgyptianRevivalist.js index 217c2aacab4976216d9ceeccfd1933e39098d73d..35e9315c3d1be210a463d3f7e3d6f8ee8042b5f3 100644 --- a/src/events/recFS/recfsFSEgyptianRevivalistAcquisition.js +++ b/src/events/recFS/recfsEgyptianRevivalist.js @@ -1,4 +1,4 @@ -App.Events.recFSEgyptianRevivalistAcquisition = class recFSEgyptianRevivalistAcquisition extends App.Events.BaseEvent { +App.Events.recFSEgyptianRevivalist = class recFSEgyptianRevivalist extends App.Events.BaseEvent { eventPrerequisites() { return [ () => V.FSAnnounced === 1, @@ -9,7 +9,9 @@ App.Events.recFSEgyptianRevivalistAcquisition = class recFSEgyptianRevivalistAcq execute(node) { /* Written and coded by Boney M */ V.encyclopedia = "Enslaving People"; - V.market = Object.assign(App.Markets.GlobalVariable(), {introType: "egyptian", newSlavesDone: 0, newSlaveIndex: 0}); + + V.market = new App.Markets.Global("generic"); + V.market.introType = "egyptian"; const contractCost = 3000; const slave = GenerateNewSlave(null, {minAge: Math.max(16, V.minimumSlaveAge + 3), maxAge: 29, disableDisability: 1}); diff --git a/src/facilities/penthouse/RecruiterSelect.js b/src/facilities/penthouse/RecruiterSelect.js index ca4d22c6bab962dac9190ffa2a16e55b6f41e771..403a9e4fa83684258f3939213e53aa6141084809 100644 --- a/src/facilities/penthouse/RecruiterSelect.js +++ b/src/facilities/penthouse/RecruiterSelect.js @@ -82,21 +82,13 @@ App.Facilities.RecruiterSelect = function() { newLine.append(App.UI.DOM.makeCheckbox("recruiterEugenics"), App.UI.DOM.makeElement("span", " Target only individuals that can pass eugenics SMRs. This option will increase time it takes to recruit depending on how many eugenics SMR are active.", "note")); App.UI.DOM.appendNewElement("div", f, newLine); - let idleTarget = 2 + - (V.brothel + V.club + V.arcade + V.dairy + V.servantsQuarters) + - V.masterSuite + V.HGSuite + V.dojo + V.brothel + V.club; - if (V.dairy && V.dairyRestraintsSetting < 2) { - idleTarget++; - } - idleTarget += V.farmyard + V.servantsQuarters + V.masterSuite + V.schoolroom + V.spa; - idleTarget += V.nursery + V.clinic + V.cellblock; - f.append("Suspend active recruiting and focus on publicity when: "); if (V.recruiterIdleRule === "number") { f.append(`${V.recruiterIdleNumber} sex slaves owned`); } else if (V.recruiterIdleRule === "facility") { + const idleTarget = App.Utils.recruiterFacilitySpace(); f.append(`match facility expansion, `); - if (idleTarget >= 20) { + if (idleTarget > 20) { f.append(`${idleTarget} positions.`); } else { f.append("20 positions (rule minimum)."); diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index ca7c2763b8855a977caa59f08abd1443ccdd0f81..5a105417ded8c5b3b9ccb5d70fef65953beddb95 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -255,10 +255,7 @@ App.UI.View.mainLinks = function() { schObj.title, "Market", () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = SCH; - V.market.newSlaves = []; - V.market.numArcology = 1; + V.market = new App.Markets.Global(SCH); V.nextButton = "Back to Main"; V.nextLink = "Main"; V.returnTo = "Main"; diff --git a/src/js/utilsMisc.js b/src/js/utilsMisc.js index c189f61c3ad67fe8d94e20f1af7d02da8f114f56..094034701a79af2216055e0fbac543c68b59671a 100644 --- a/src/js/utilsMisc.js +++ b/src/js/utilsMisc.js @@ -252,3 +252,49 @@ App.Utils.totalNetWorth = function() { return total; }; + +/** Calculate the target number of slaves to recruit when the recruiter is set to fill facilities */ +App.Utils.recruiterFacilitySpace = function() { + /* Note on target sum: HG and Recruiter are the initial 2 counted (no facility req'd), while HGSuite counts the HG's girl, other facilities count associated leader */ + let idleTarget = (2 + V.brothel + V.club + V.arcade + V.dairy + V.servantsQuarters + V.masterSuite); + if (V.HGSuite) { + idleTarget++; + } + if (V.dojo) { + idleTarget++; + } + if (V.brothel) { + idleTarget++; + } + if (V.club) { + idleTarget++; + } + if (V.dairy && V.dairyRestraintsSetting < 2) { + idleTarget++; + } + if (V.farmyard) { + idleTarget++; + } + if (V.servantsQuarters) { + idleTarget++; + } + if (V.masterSuite) { + idleTarget++; + } + if (V.schoolroom) { + idleTarget++; + } + if (V.spa) { + idleTarget++; + } + if (V.nursery) { + idleTarget++; + } + if (V.clinic) { + idleTarget++; + } + if (V.cellblock) { + idleTarget++; + } + return Math.max(idleTarget, 20); +}; diff --git a/src/markets/gingering.js b/src/markets/gingering.js index f51c6d913f991219260324a4dd5bafb372d2dcf5..11f90fbbf5a934a06fb036ce9e44275d8ba659e7 100644 --- a/src/markets/gingering.js +++ b/src/markets/gingering.js @@ -102,6 +102,11 @@ globalThis._makeGingeredSlaveHandler = function(gParams, gKeys) { globalThis.getGingeredSlave = function(slave, market, arcIndex) { const gingering = new App.Entity.GingeringParameters(slave, market, arcIndex); + // if the slave didn't actually get gingered, just give the original back + if (gingering.type === 0) { + return slave; + } + /** @type {Map<string, string|number>} */ const gingeredKeys = new Map(); /** Add a key to override on the gingered slave object diff --git a/src/markets/marketUI.js b/src/markets/marketUI.js index 981baec4b2e0a85ca42e932cb084708eb4eff5ad..d292d940f632a56a15351c120f2a778532ae8088 100644 --- a/src/markets/marketUI.js +++ b/src/markets/marketUI.js @@ -154,23 +154,15 @@ App.Markets.purchaseFramework = function(slaveMarket, {sTitleSingular = "slave", } } }; -/** - * @typedef {object} marketGlobal - * @property {FC.SlaveMarketName} slaveMarket - * @property {string} introType - * @property {Array<FC.GingeredSlave>} newSlaves - * @property {number} newSlaveIndex - * @property {number} newSlavesDone - * @property {number} numSlaves - * @property {number} numArcology - * @property {number} totalCost - */ -/** @this {marketGlobal} */ -App.Markets.GlobalVariable = function() { - /** @type {FC.SlaveMarketName} */ - this.slaveMarket = "kidnappers"; +/** Construct the market global + * @param {string} market + */ +App.Markets.Global = function(market) { + /** @type {string} - overlaps with but is not contained by @see {FC.SlaveMarketName} */ + this.slaveMarket = market; this.introType = ""; + /** @type {Array<FC.GingeredSlave>} */ this.newSlaves = []; this.newSlaveIndex = 0; this.newSlavesDone = 0; @@ -182,10 +174,10 @@ App.Markets.GlobalVariable = function() { /** * User facing names for the markets - * @param {*} market - * @param {*} arcIndex + * @param {FC.SlaveMarketName} market + * @param {number} arcIndex */ -App.Markets.marketName = function(market = "kidnappers", arcIndex = 1) { +App.Markets.marketName = function(market, arcIndex = 1) { if (App.Data.misc.schools.has(market)) { return App.Data.misc.schools.get(market).title; } else { diff --git a/src/markets/specificMarkets/customSlaveMarket.js b/src/markets/specificMarkets/customSlaveMarket.js index e982318348594b9f2cf5e79d8ce8bbaa32cef8f5..3ac9f8f5a466f3e6f86fa685d77b1102c3a68e8e 100644 --- a/src/markets/specificMarkets/customSlaveMarket.js +++ b/src/markets/specificMarkets/customSlaveMarket.js @@ -988,9 +988,7 @@ App.Markets["Custom Slave"] = function() { "Reset custom order form", () => { V.customSlave = new App.Entity.CustomSlaveOrder(); - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = "Custom Slave"; - V.market.newSlaves = []; + V.market = new App.Markets.Global("Custom Slave"); }, [], "Market" diff --git a/src/markets/theMarket/buySlaves.js b/src/markets/theMarket/buySlaves.js index 7c8be3b43e6af80f917f57fbfd73afdd16941abd..d71c10c94e2ab22ba15482f408b706bffe3ee8d5 100644 --- a/src/markets/theMarket/buySlaves.js +++ b/src/markets/theMarket/buySlaves.js @@ -67,9 +67,7 @@ App.UI.buySlaves = function() { App.UI.DOM.link( "Slaves from", () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = "neighbor"; - V.market.newSlaves = []; + V.market = new App.Markets.Global("neighbor"); V.market.numArcology = i; updateNav(); }, @@ -84,8 +82,7 @@ App.UI.buySlaves = function() { App.UI.DOM.link( "x5", () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = "neighbor"; + V.market = new App.Markets.Global("neighbor"); V.market.introType = "bulk"; V.market.numSlaves = 5; V.market.numArcology = i; @@ -100,8 +97,7 @@ App.UI.buySlaves = function() { App.UI.DOM.link( "x10", () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = "neighbor"; + V.market = new App.Markets.Global("neighbor"); V.market.introType = "bulk"; V.market.numSlaves = 10; V.market.numArcology = i; @@ -141,10 +137,7 @@ App.UI.buySlaves = function() { App.UI.DOM.link( store.title, () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = store.marketType; - V.market.newSlaves = []; - V.market.numArcology = 1; + V.market = new App.Markets.Global(store.marketType); updateNav(store); }, [], @@ -157,8 +150,8 @@ App.UI.buySlaves = function() { App.UI.DOM.link( `x5`, () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = store.marketType; + V.market = new App.Markets.Global(store.marketType); + V.market.introType = "bulk"; V.market.numSlaves = 5; }, [], @@ -171,8 +164,7 @@ App.UI.buySlaves = function() { App.UI.DOM.link( `x10`, () => { - V.market = new App.Markets.GlobalVariable(); - V.market.slaveMarket = store.marketType; + V.market = new App.Markets.Global(store.marketType); V.market.introType = "bulk"; V.market.numSlaves = 10; },