From c76602a5dfd2e1f171280dcd641bca85d1e71028 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 13 Apr 2022 12:24:01 -0400 Subject: [PATCH] rm aug woned --- src/Augmentation/Augmentation.tsx | 3 --- src/Augmentation/AugmentationHelpers.tsx | 2 -- src/Bladeburner/Bladeburner.tsx | 2 +- src/Faction/FactionHelpers.tsx | 3 ++- .../Player/PlayerObjectAugmentationMethods.ts | 4 ++-- .../Player/PlayerObjectGeneralMethods.tsx | 7 +------ src/Prestige.ts | 10 +++++----- src/engine.tsx | 2 +- 8 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/Augmentation/Augmentation.tsx b/src/Augmentation/Augmentation.tsx index 229309efc..88cbdc6f3 100644 --- a/src/Augmentation/Augmentation.tsx +++ b/src/Augmentation/Augmentation.tsx @@ -380,9 +380,6 @@ export class Augmentation { // Name of Augmentation name = ""; - // Whether the player owns this Augmentation - owned = false; - // Array of names of all prerequisites prereqs: string[] = []; diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index dc6d97d14..5da4d7228 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -118,8 +118,6 @@ function resetAugmentation(aug: Augmentation): void { } function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void { - Augmentations[aug.name].owned = true; - const augObj = Augmentations[aug.name]; // Apply multipliers diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx index 11ebf3122..402929b33 100644 --- a/src/Bladeburner/Bladeburner.tsx +++ b/src/Bladeburner/Bladeburner.tsx @@ -1920,7 +1920,7 @@ export class Bladeburner implements IBladeburner { } // If the Player starts doing some other actions, set action to idle and alert - if (Augmentations[AugmentationNames.BladesSimulacrum].owned === false && player.isWorking) { + if (player.hasAugmentation(AugmentationNames.BladesSimulacrum) === false && player.isWorking) { if (this.action.type !== ActionTypes["Idle"]) { let msg = "Your Bladeburner action was cancelled because you started doing something else."; if (this.automateEnabled) { diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx index 4c7ee2f56..729eb15be 100644 --- a/src/Faction/FactionHelpers.tsx +++ b/src/Faction/FactionHelpers.tsx @@ -63,7 +63,8 @@ export function hasAugmentationPrereqs(aug: Augmentation): boolean { console.error(`Invalid prereq Augmentation ${aug.prereqs[i]}`); continue; } - if (prereqAug.owned === false) { + + if (Player.hasAugmentation(prereqAug, true) === false) { hasPrereqs = false; // Check if the aug is purchased diff --git a/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts b/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts index 999689eef..4dcc9e61d 100644 --- a/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts @@ -7,7 +7,7 @@ import { Augmentation } from "../../Augmentation/Augmentation"; import { calculateEntropy } from "../Grafting/EntropyAccumulation"; -export function hasAugmentation(this: IPlayer, aug: string | Augmentation, installed = false): boolean { +export function hasAugmentation(this: IPlayer, aug: string | Augmentation, includeQueued = false): boolean { const augName: string = aug instanceof Augmentation ? aug.name : aug; for (const owned of this.augmentations) { @@ -16,7 +16,7 @@ export function hasAugmentation(this: IPlayer, aug: string | Augmentation, insta } } - if (!installed) { + if (!includeQueued) { for (const owned of this.queuedAugmentations) { if (owned.name === augName) { return true; diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index be9539c38..cca2e5737 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -2084,12 +2084,7 @@ export function reapplyAllAugmentations(this: IPlayer, resetMultipliers = true): const playerAug = this.augmentations[i]; const augName = playerAug.name; - const aug = Augmentations[augName]; - if (aug == null) { - console.warn(`Invalid augmentation name in Player.reapplyAllAugmentations(). Aug ${augName} will be skipped`); - continue; - } - aug.owned = true; + if (augName == AugmentationNames.NeuroFluxGovernor) { for (let j = 0; j < playerAug.level; ++j) { applyAugmentation(this.augmentations[i], true); diff --git a/src/Prestige.ts b/src/Prestige.ts index ab3df9ccc..518847522 100755 --- a/src/Prestige.ts +++ b/src/Prestige.ts @@ -55,15 +55,15 @@ export function prestigeAugmentation(): void { AddToAllServers(homeComp); prestigeHomeComputer(Player, homeComp); - if (augmentationExists(AugmentationNames.Neurolink) && Augmentations[AugmentationNames.Neurolink].owned) { + if (augmentationExists(AugmentationNames.Neurolink) && Player.hasAugmentation(AugmentationNames.Neurolink)) { homeComp.programs.push(Programs.FTPCrackProgram.name); homeComp.programs.push(Programs.RelaySMTPProgram.name); } - if (augmentationExists(AugmentationNames.CashRoot) && Augmentations[AugmentationNames.CashRoot].owned) { + if (augmentationExists(AugmentationNames.CashRoot) && Player.hasAugmentation(AugmentationNames.CashRoot)) { Player.setMoney(1e6); homeComp.programs.push(Programs.BruteSSHProgram.name); } - if (augmentationExists(AugmentationNames.PCMatrix) && Augmentations[AugmentationNames.PCMatrix].owned) { + if (augmentationExists(AugmentationNames.PCMatrix) && Player.hasAugmentation(AugmentationNames.PCMatrix)) { homeComp.programs.push(Programs.DeepscanV1.name); homeComp.programs.push(Programs.AutoLink.name); } @@ -151,7 +151,7 @@ export function prestigeAugmentation(): void { } // Red Pill - if (augmentationExists(AugmentationNames.TheRedPill) && Augmentations[AugmentationNames.TheRedPill].owned) { + if (augmentationExists(AugmentationNames.TheRedPill) && Player.hasAugmentation(AugmentationNames.TheRedPill)) { const WorldDaemon = GetServer(SpecialServers.WorldDaemon); const DaedalusServer = GetServer(SpecialServers.DaedalusServer); if (WorldDaemon && DaedalusServer) { @@ -160,7 +160,7 @@ export function prestigeAugmentation(): void { } } - if (augmentationExists(AugmentationNames.StaneksGift1) && Augmentations[AugmentationNames.StaneksGift1].owned) { + if (augmentationExists(AugmentationNames.StaneksGift1) && Player.hasAugmentation(AugmentationNames.StaneksGift1)) { joinFaction(Factions[FactionNames.ChurchOfTheMachineGod]); } diff --git a/src/engine.tsx b/src/engine.tsx index 5987ce284..dad19a100 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -214,7 +214,7 @@ const Engine: { if (Engine.Counters.messages <= 0) { checkForMessagesToSend(); - if (Augmentations[AugmentationNames.TheRedPill].owned) { + if (Player.hasAugmentation(AugmentationNames.TheRedPill)) { Engine.Counters.messages = 4500; // 15 minutes for Red pill message } else { Engine.Counters.messages = 150;