diff --git a/devTools/types/FC/facilities.d.ts b/devTools/types/FC/facilities.d.ts index 63008c92b666789ba61df31a9f536c338fd01051..9f3923fd007560e0833e38cb50e8597ab89ab93a 100644 --- a/devTools/types/FC/facilities.d.ts +++ b/devTools/types/FC/facilities.d.ts @@ -9,7 +9,7 @@ declare namespace FC { /** The variable name of the upgrade. */ property: string; /** Any prerequisites that must be met before the upgrade is available. */ - prereqs: boolean[]; + prereqs: Array<() => boolean>; /** The value to set `property` to upon purchase. */ value: any; /** The text displayed before the upgrade has been purchased. */ @@ -32,7 +32,7 @@ declare namespace FC { /** The variable name of the rule. */ property: string /** Any prerequisites that must be met for the rule to be displayed. */ - prereqs: boolean[]; + prereqs: Array<() => boolean> /** Properties to use when the rule is active. */ active: { /** The text displayed when the rule is active. */ diff --git a/src/facilities/Facility.js b/src/facilities/Facility.js index af7bde46fbfb92f1195e4d884f666a6b045788c0..b36d79752eedd374cbcc8b8f90cc6f65aed33944 100644 --- a/src/facilities/Facility.js +++ b/src/facilities/Facility.js @@ -170,7 +170,7 @@ App.Facilities.Facility = class { const div = document.createElement("div"); this._upgrades.forEach(upgrade => { - if (upgrade.prereqs.every(prereq => prereq === true)) { + if (upgrade.prereqs.every(prereq => prereq())) { if (V[upgrade.property] === upgrade.value) { App.UI.DOM.appendNewElement("div", div, upgrade.upgraded); } else { @@ -206,7 +206,7 @@ App.Facilities.Facility = class { const div = document.createElement("div"); this._rules.forEach(rule => { - if (rule.prereqs.every(prereq => prereq === true)) { + if (rule.prereqs.every(prereq => prereq())) { const options = new App.UI.OptionsGroup(); if (rule.active.value) { diff --git a/src/facilities/clinic/clinic.js b/src/facilities/clinic/clinic.js index db13d7c82a5c2d905f296e5fcefd469cd940c0b2..ca107c14896b92ff9ca26d5ece83cb53f713a59d 100644 --- a/src/facilities/clinic/clinic.js +++ b/src/facilities/clinic/clinic.js @@ -93,9 +93,7 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { return [ { property: "clinicUpgradeScanner", - prereqs: [ - true, - ], + prereqs: [], value: 1, base: `It mounts powerful medical scanning technology.`, upgraded: `${this.facility.nameCaps}'s scanners have been upgraded with a sampling system that can estimate carcinogenic damage to a slave's body.`, @@ -105,9 +103,7 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { note: `increases the effectiveness of ${V.clinicName}`, }, { property: "clinicUpgradeFilters", - prereqs: [ - true, - ], + prereqs: [], value: 1, base: `It includes standard dialysis equipment.`, upgraded: `The entire floor beneath ${V.clinicName} is occupied by a huge filtration plant that constantly cycles out the patients' blood to remove impurities.`, @@ -118,8 +114,8 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { }, { property: "clinicUpgradePurge", prereqs: [ - V.clinicUpgradeFilters > 0, - V.clinicUpgradePurge === 0, + () => V.clinicUpgradeFilters > 0, + () => V.clinicUpgradePurge === 0, ], value: 1, base: `${V.clinicUpgradeFilters ? `Microscopic magnets have been added to better facilitate the leeching of impurities from cells.` : ``}`, @@ -128,10 +124,14 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { cost: Math.trunc(150000 * V.upgradeMultiplierArcology * Math.min(V.upgradeMultiplierMedicine, V.HackingSkillMultiplier)), handler: () => V.PC.skill.hacking += 0.1, note: `may cause health problems in slaves`, + nodes: !S.Nurse + ? [`However, without a nurse in attendance, the <span class="yellow">blood treatment equipment remains idle.</span>`] + : null, }, { property: "clinicUpgradePurge", prereqs: [ - V.clinicUpgradePurge === 1, + () => V.clinicUpgradeFilters > 0, + () => V.clinicUpgradePurge === 1, ], value: 2, base: ``, @@ -140,9 +140,9 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { cost: Math.trunc(300000 * V.upgradeMultiplierArcology * Math.min(V.upgradeMultiplierMedicine, V.HackingSkillMultiplier)), handler: () => V.PC.skill.hacking += 0.1, note: `increases the effectiveness of ${V.clinicName}`, - nodes: !S.Nurse ? [ - `However, without a nurse in attendance, the <span class="yellow">blood treatment equipment remains idle.</span>`, - ] : null, + nodes: !S.Nurse + ? [`However, without a nurse in attendance, the <span class="yellow">blood treatment equipment remains idle.</span>`] + : null, } ]; } @@ -153,7 +153,7 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { { property: "clinicInflateBelly", prereqs: [ - !!S.Nurse, + () => !!S.Nurse, ], active: { get text() { return `${capFirstChar(V.clinicName)} is useful for keeping slaves healthy during long term procedures. Slaves in ${V.clinicName} with inflatable belly implants will be filled during their time under ${S.Nurse.slaveName}'s supervision to maximize growth with minimized health complications.`; }, @@ -168,9 +168,7 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { }, { property: "clinicObservePregnancy", - prereqs: [ - true, - ], + prereqs: [], active: { text: `Patients undergoing a high-risk pregnancy or are close to giving birth will be kept under observation.`, link: `Keep high-risk pregnancies under observation`, @@ -185,7 +183,7 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { { property: "clinicSpeedGestation", prereqs: [ - !!S.Nurse, + () => !!S.Nurse, ], active: { get text() { return `It's exceedingly dangerous to speed up gestation without constant supervision. In ${V.clinicName}, ${S.Nurse.slaveName} will monitor slaves on rapid gestation agents; making sure the growing patients' food demands are met, monitoring their skin and womb and, if need be, perform an emergency c-section should the need arise.`; }, @@ -193,7 +191,7 @@ App.Facilities.Clinic.clinic = class extends App.Facilities.Facility { value: 1, }, inactive: { - text: `${this.facility.nameCaps} is currently not applying rapid gestation agents to pregnant patients. Only individually selected slaves will undergo this procedure.`, + get text() { return `${capFirstChar(V.clinicName)} is currently not applying rapid gestation agents to pregnant patients. Only individually selected slaves will undergo this procedure.`; }, link: `Speed up gestation for all pregnant patients`, value: 0, }