Added check for aug status to stanek.acceptGift

Added a check to stanek.acceptGift for aug status. It's not
particularly elegant, but I copied the checks from the ui. Also
changed the way CotMG status is checked to be more robust.
This commit is contained in:
Undeemiss
2022-04-19 13:33:07 -05:00
parent 46a90e6271
commit b3e83dd976

View File

@@ -115,11 +115,15 @@ export function NetscriptStanek(
},
acceptGift: (_ctx: NetscriptContext) =>
function (): boolean {
//Check if the player has access to the church
if (player.canAccessCotMG()) {
//Check if the player is eligible to join the church
if (
player.canAccessCotMG() &&
player.augmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length == 0 &&
player.queuedAugmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length == 0
) {
//Attempt to join CotMG
const faction = Factions[FactionNames.ChurchOfTheMachineGod];
if (!player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
if (!faction.isMember) {
joinFaction(faction);
}
//Attempt to install the first Stanek aug
@@ -132,7 +136,7 @@ export function NetscriptStanek(
}
//Return true iff the player is in CotMG and has the first Stanek aug installed
return (
player.factions.includes(FactionNames.ChurchOfTheMachineGod) &&
Factions[FactionNames.ChurchOfTheMachineGod].isMember &&
player.hasAugmentation(AugmentationNames.StaneksGift1)
);
},