bitburner-src/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts

27 lines
632 B
TypeScript
Raw Normal View History

/**
* Augmentation-related methods for the Player class (PlayerObject)
*/
import { IPlayer } from "../IPlayer";
import { Augmentation } from "../../Augmentation/Augmentation";
2021-11-12 22:54:34 +01:00
export function hasAugmentation(this: IPlayer, aug: string | Augmentation, installed = false): boolean {
2021-09-05 01:09:30 +02:00
const augName: string = aug instanceof Augmentation ? aug.name : aug;
2021-09-05 01:09:30 +02:00
for (const owned of this.augmentations) {
if (owned.name === augName) {
return true;
}
2021-09-05 01:09:30 +02:00
}
2021-11-12 22:54:34 +01:00
if (!installed) {
for (const owned of this.queuedAugmentations) {
if (owned.name === augName) {
return true;
}
}
2021-09-05 01:09:30 +02:00
}
2021-09-05 01:09:30 +02:00
return false;
}