rm aug woned

This commit is contained in:
Olivier Gagnon 2022-04-13 12:24:01 -04:00
parent 0d11a18ca9
commit c76602a5df
8 changed files with 12 additions and 21 deletions

@ -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[] = [];

@ -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

@ -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) {

@ -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

@ -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;

@ -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);

@ -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]);
}

@ -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;