2019-05-14 10:35:37 +02:00
|
|
|
/**
|
|
|
|
* Augmentation-related methods for the Player class (PlayerObject)
|
|
|
|
*/
|
|
|
|
import { IPlayer } from "../IPlayer";
|
|
|
|
|
|
|
|
import { Augmentation } from "../../Augmentation/Augmentation";
|
|
|
|
|
2022-03-19 19:15:31 +01:00
|
|
|
import { applyEntropy as calculateEntropy } from "../Grafting/EntropyAccumulation";
|
|
|
|
|
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;
|
2019-05-14 10:35:37 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
for (const owned of this.augmentations) {
|
|
|
|
if (owned.name === augName) {
|
|
|
|
return true;
|
2019-05-14 10:35:37 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-05-14 10:35:37 +02:00
|
|
|
|
2021-11-12 22:54:34 +01:00
|
|
|
if (!installed) {
|
|
|
|
for (const owned of this.queuedAugmentations) {
|
|
|
|
if (owned.name === augName) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-05-14 10:35:37 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-05-14 10:35:37 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
return false;
|
2019-05-14 10:35:37 +02:00
|
|
|
}
|
2022-03-19 19:15:31 +01:00
|
|
|
|
|
|
|
export function applyEntropy(this: IPlayer, stacks = 1): void {
|
|
|
|
const newMultipliers = calculateEntropy(this, stacks);
|
|
|
|
for (const [mult, val] of Object.entries(newMultipliers)) {
|
|
|
|
this.setMult(mult, val);
|
|
|
|
}
|
|
|
|
}
|