Files
bitburner-src/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts
Snarling e578bd7681 Remove IPlayer interface
Use PlayerObject instead when referring to the type of "The Player."
2022-09-27 15:35:41 -04:00

37 lines
931 B
TypeScript

/**
* Augmentation-related methods for the Player class (PlayerObject)
*/
import { PlayerObject } from "./PlayerObject";
import { Augmentation } from "../../Augmentation/Augmentation";
import { calculateEntropy } from "../Grafting/EntropyAccumulation";
export function hasAugmentation(this: PlayerObject, aug: string | Augmentation, ignoreQueued = false): boolean {
const augName: string = aug instanceof Augmentation ? aug.name : aug;
for (const owned of this.augmentations) {
if (owned.name === augName) {
return true;
}
}
if (!ignoreQueued) {
for (const owned of this.queuedAugmentations) {
if (owned.name === augName) {
return true;
}
}
}
return false;
}
export function applyEntropy(this: PlayerObject, stacks = 1): void {
// Re-apply all multipliers
this.reapplyAllAugmentations();
this.reapplyAllSourceFiles();
this.mults = calculateEntropy(stacks);
}