mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 19:14:32 +02:00
Merge pull request #3513 from Undeemiss/join-stanek-api
STANEK: FIX #3282 Added NS function stanek.acceptGift
This commit is contained in:
@@ -70,6 +70,7 @@ export const RamCostConstants: IMap<number> = {
|
|||||||
ScriptStanekPlace: 5,
|
ScriptStanekPlace: 5,
|
||||||
ScriptStanekFragmentAt: 2,
|
ScriptStanekFragmentAt: 2,
|
||||||
ScriptStanekDeleteAt: 0.15,
|
ScriptStanekDeleteAt: 0.15,
|
||||||
|
ScriptStanekAcceptGift: 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
function SF4Cost(cost: number): (player: IPlayer) => number {
|
function SF4Cost(cost: number): (player: IPlayer) => number {
|
||||||
@@ -284,6 +285,7 @@ const stanek: IMap<any> = {
|
|||||||
placeFragment: RamCostConstants.ScriptStanekPlace,
|
placeFragment: RamCostConstants.ScriptStanekPlace,
|
||||||
getFragment: RamCostConstants.ScriptStanekFragmentAt,
|
getFragment: RamCostConstants.ScriptStanekFragmentAt,
|
||||||
removeFragment: RamCostConstants.ScriptStanekDeleteAt,
|
removeFragment: RamCostConstants.ScriptStanekDeleteAt,
|
||||||
|
acceptGift: RamCostConstants.ScriptStanekAcceptGift,
|
||||||
};
|
};
|
||||||
|
|
||||||
// UI API
|
// UI API
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import {
|
|||||||
} from "../ScriptEditor/NetscriptDefinitions";
|
} from "../ScriptEditor/NetscriptDefinitions";
|
||||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||||
import { NetscriptContext, InternalAPI } from "../Netscript/APIWrapper";
|
import { NetscriptContext, InternalAPI } from "../Netscript/APIWrapper";
|
||||||
|
import { applyAugmentation } from "../Augmentation/AugmentationHelpers";
|
||||||
|
import { FactionNames } from "../Faction/data/FactionNames";
|
||||||
|
import { joinFaction } from "../Faction/FactionHelpers";
|
||||||
|
import { Factions } from "../Faction/Factions";
|
||||||
|
|
||||||
export function NetscriptStanek(
|
export function NetscriptStanek(
|
||||||
player: IPlayer,
|
player: IPlayer,
|
||||||
@@ -109,5 +113,29 @@ export function NetscriptStanek(
|
|||||||
checkStanekAPIAccess("removeFragment");
|
checkStanekAPIAccess("removeFragment");
|
||||||
return staneksGift.delete(rootX, rootY);
|
return staneksGift.delete(rootX, rootY);
|
||||||
},
|
},
|
||||||
|
acceptGift: (_ctx: NetscriptContext) =>
|
||||||
|
function (): boolean {
|
||||||
|
//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
|
||||||
|
joinFaction(Factions[FactionNames.ChurchOfTheMachineGod]);
|
||||||
|
//Attempt to install the first Stanek aug
|
||||||
|
if (
|
||||||
|
!player.hasAugmentation(AugmentationNames.StaneksGift1) &&
|
||||||
|
!player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1)
|
||||||
|
) {
|
||||||
|
applyAugmentation({ name: AugmentationNames.StaneksGift1, level: 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Return true iff the player is in CotMG and has the first Stanek aug installed
|
||||||
|
return (
|
||||||
|
Factions[FactionNames.ChurchOfTheMachineGod].isMember &&
|
||||||
|
player.hasAugmentation(AugmentationNames.StaneksGift1)
|
||||||
|
);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -4261,6 +4261,16 @@ interface Stanek {
|
|||||||
* @returns The fragment at [rootX, rootY], if any.
|
* @returns The fragment at [rootX, rootY], if any.
|
||||||
*/
|
*/
|
||||||
removeFragment(rootX: number, rootY: number): boolean;
|
removeFragment(rootX: number, rootY: number): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accept Stanek's Gift by joining the Church of the Machine God
|
||||||
|
* @remarks
|
||||||
|
* RAM cost: 2 GB
|
||||||
|
*
|
||||||
|
* @returns true if the player is a member of the church and has the gift installed,
|
||||||
|
* false otherwise.
|
||||||
|
*/
|
||||||
|
acceptGift(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user