BUGFIX: Sleeves can earn exp and purchase augmentations when enabling disableSleeveExpAndAugmentation (#2467)

This commit is contained in:
catloversg
2026-02-05 19:47:24 +07:00
committed by GitHub
parent 77cc582bf9
commit 796bef81b3
8 changed files with 125 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
import { FactionName } from "@enums";
import { AugmentationName, FactionName } from "@enums";
import { Player } from "@player";
import { joinFaction } from "../../../src/Faction/FactionHelpers";
import { Factions } from "../../../src/Faction/Factions";
@@ -7,7 +7,7 @@ import {
MaxSleevesFromCovenant,
recalculateNumberOfOwnedSleeves,
} from "../../../src/PersonObjects/Sleeve/SleeveCovenantPurchases";
import { getNS, initGameEnvironment, setupBasicTestingEnvironment } from "../Utilities";
import { getNS, getWorkerScriptAndNS, initGameEnvironment, setupBasicTestingEnvironment } from "../Utilities";
import { prestigeSourceFile } from "../../../src/Prestige";
beforeAll(() => {
@@ -100,6 +100,15 @@ describe("Success", () => {
expect(sleeve.memory).toStrictEqual(100);
expect(Player.money).toStrictEqual(0);
});
test("purchaseSleeveAug", () => {
const ns = getNS();
const augName = AugmentationName.BitWire;
Player.sleeves[0].shock = 0;
// CyberSec offers BitWire.
joinFaction(Factions.CyberSec);
Factions.CyberSec.playerReputation = 1e10;
expect(ns.sleeve.purchaseSleeveAug(0, augName)).toStrictEqual(true);
});
});
describe("Failure", () => {
@@ -169,4 +178,39 @@ describe("Failure", () => {
expect(result.success).toStrictEqual(false);
expect(result.message).toContain("You must have at least");
});
test("purchaseSleeveAug", () => {
// Set BN10 and recalculate to get the first sleeve.
Player.bitNodeN = 10;
recalculateNumberOfOwnedSleeves();
const { ws, ns } = getWorkerScriptAndNS();
const augName = AugmentationName.BitWire;
// disableSleeveExpAndAugmentation = true
Player.bitNodeOptions.disableSleeveExpAndAugmentation = true;
expect(ns.sleeve.purchaseSleeveAug(0, augName)).toStrictEqual(false);
expect(ws.scriptRef.logs[0]).toMatch(`The "Disable Sleeves' experience and augmentation" option was enabled`);
// shock > 0
Player.bitNodeOptions.disableSleeveExpAndAugmentation = false;
expect(ns.sleeve.purchaseSleeveAug(0, augName)).toStrictEqual(false);
expect(ws.scriptRef.logs[1]).toMatch("You must reduce the sleeve shock to 0");
// Not enough money
Player.sleeves[0].shock = 0;
Player.money = 0;
expect(ns.sleeve.purchaseSleeveAug(0, augName)).toStrictEqual(false);
expect(ws.scriptRef.logs[2]).toMatch("You must have at least");
// Already have the augmentation
Player.money = 1e15;
Player.sleeves[0].augmentations.push({ name: augName, level: 1 });
expect(ns.sleeve.purchaseSleeveAug(0, augName)).toStrictEqual(false);
expect(ws.scriptRef.logs[3]).toMatch(`This sleeve already has "${augName}" augmentation`);
// Non-purchasable augmentation
Player.sleeves[0].augmentations = [];
expect(ns.sleeve.purchaseSleeveAug(0, augName)).toStrictEqual(false);
expect(ws.scriptRef.logs[4]).toMatch(`"${augName}" is not in the list of purchasable augmentations`);
});
});