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

25 lines
579 B
TypeScript
Raw Normal View History

/**
* Augmentation-related methods for the Player class (PlayerObject)
*/
import { IPlayer } from "../IPlayer";
import { Augmentation } from "../../Augmentation/Augmentation";
2021-09-09 05:47:34 +02:00
export function hasAugmentation(this: IPlayer, aug: string | Augmentation): 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-09-05 01:09:30 +02:00
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;
}