From e8f9882e2ddf399be165df1ebef1039cdb715b82 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Tue, 18 Mar 2025 06:04:36 +0700 Subject: [PATCH] MISC: Disable effect of SF7.3 and SF10 if player disables them with advanced options (#2019) * MISC: Disable effect of SF7.3 and SF10 if player disables them with advanced options * Update based on feedback --- src/Locations/ui/SpecialLocation.tsx | 2 +- src/NetscriptFunctions/Sleeve.ts | 6 +++++- src/PersonObjects/Person.ts | 4 ++++ src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts | 2 +- src/PersonObjects/Sleeve/Sleeve.ts | 5 +++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Locations/ui/SpecialLocation.tsx b/src/Locations/ui/SpecialLocation.tsx index cb6f789fa..cda69445f 100644 --- a/src/Locations/ui/SpecialLocation.tsx +++ b/src/Locations/ui/SpecialLocation.tsx @@ -71,7 +71,7 @@ export function SpecialLocation(props: SpecialLocationProps): React.ReactElement return; } if ( - Player.sourceFileLvl(7) >= 3 && + Player.activeSourceFileLvl(7) >= 3 && canAcceptStaneksGift() && !Player.hasAugmentation(AugmentationName.StaneksGift1) ) { diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index b3571a3af..312dec69d 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -17,7 +17,11 @@ import { SleeveWorkType } from "../PersonObjects/Sleeve/Work/Work"; import { canAccessBitNodeFeature } from "../BitNode/BitNodeUtils"; export const checkSleeveAPIAccess = function (ctx: NetscriptContext) { - if (Player.bitNodeN !== 10 && !Player.sourceFileLvl(10)) { + /** + * Don't change sourceFileLvl to activeSourceFileLvl. The ability to control Sleeves (via both UI and APIs) is a + * permanent benefit. + */ + if (Player.bitNodeN !== 10 && Player.sourceFileLvl(10) <= 0) { throw helpers.errorMessage( ctx, "You do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10", diff --git a/src/PersonObjects/Person.ts b/src/PersonObjects/Person.ts index ad7629a5a..cc64be8af 100644 --- a/src/PersonObjects/Person.ts +++ b/src/PersonObjects/Person.ts @@ -147,6 +147,10 @@ export abstract class Person implements IPerson { console.error("ERROR: NaN passed into Player.gainIntelligenceExp()"); return; } + /** + * Don't change sourceFileLvl to activeSourceFileLvl. When the player has int level, the ability to gain more int is + * a permanent benefit. + */ if (Player.sourceFileLvl(5) > 0 || this.skills.intelligence > 0 || Player.bitNodeN === 5) { this.exp.intelligence += exp; this.skills.intelligence = Math.floor(this.calculateSkill(this.exp.intelligence, 1)); diff --git a/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts b/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts index 7e6b4f6e4..ea427b220 100644 --- a/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts @@ -11,7 +11,7 @@ export function startBladeburner(this: PlayerObject): void { this.bladeburner = new Bladeburner(); this.bladeburner.init(); // Give Blades Simulacrum if you have unlocked it - if (this.sourceFileLvl(7) >= 3) { + if (this.activeSourceFileLvl(7) >= 3) { this.augmentations.push({ name: AugmentationName.BladesSimulacrum, level: 1, diff --git a/src/PersonObjects/Sleeve/Sleeve.ts b/src/PersonObjects/Sleeve/Sleeve.ts index 13d6d5d2a..39b781bee 100644 --- a/src/PersonObjects/Sleeve/Sleeve.ts +++ b/src/PersonObjects/Sleeve/Sleeve.ts @@ -558,6 +558,11 @@ export class Sleeve extends Person implements SleevePerson { } static recalculateNumOwned() { + /** + * Don't change sourceFileLvl to activeSourceFileLvl. The number of sleeves is a permanent effect. It's too + * troublesome for the player if they lose Sleeves and have to go BN10 to buy them again when they override the + * level of SF 10. + */ const numSleeves = Math.min(3, Player.sourceFileLvl(10) + (Player.bitNodeN === 10 ? 1 : 0)) + Player.sleevesFromCovenant; while (Player.sleeves.length > numSleeves) {