Skip to content

Commit

Permalink
MISC: Warn player that they cannot accept Stanek's Gift after joining…
Browse files Browse the repository at this point in the history
… Bladeburner with SF7.3 (#2005)
  • Loading branch information
catloversg authored Mar 7, 2025
1 parent a611c84 commit 8fe0ea1
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 36 deletions.
2 changes: 2 additions & 0 deletions markdown/bitburner.bladeburner.joinbladeburnerdivision.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ RAM cost: 4 GB

Attempts to join the Bladeburner division.

If you have SF 7.3, you will immediately receive "The Blade's Simulacrum" augmentation and won't be able to accept Stanek's Gift after joining. If you want to accept Stanek's Gift, you must do that before calling this API.

Returns true if you successfully join the Bladeburner division, or if you are already a member.

Returns false otherwise.
Expand Down
11 changes: 9 additions & 2 deletions src/BitNode/BitNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Player } from "@player";
import { CityName, FactionName } from "@enums";
import { AugmentationName, CityName, FactionName } from "@enums";
import { BitNodeMultipliers, replaceCurrentNodeMults } from "./BitNodeMultipliers";

class BitNode {
Expand Down Expand Up @@ -236,7 +236,10 @@ export function initBitNodes() {
<ul>
<li>Level 1: 8%</li>
<li>Level 2: 12%</li>
<li>Level 3: 14% and begin with The Blade's Simulacrum</li>
<li>
Level 3: 14% and immediately receive "{AugmentationName.BladesSimulacrum}" augmentation after joining the
Bladeburner division
</li>
</ul>
</>
),
Expand Down Expand Up @@ -415,6 +418,10 @@ export function initBitNodes() {
<br />
<br />
Each level of this Source-File increases the size of Stanek's Gift.
<br />
<br />
Due to the effect of Source-File 7.3, you must accept Stanek's Gift before joining the Bladeburner division if
you have that Source-File.
</>
),
);
Expand Down
11 changes: 11 additions & 0 deletions src/CotMG/Helper.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Player } from "@player";
import { AugmentationName } from "@enums";
import { dialogBoxCreate } from "../ui/React/DialogBox";
import { Reviver } from "../utils/GenericReviver";
import { BaseGift } from "./BaseGift";
Expand Down Expand Up @@ -49,3 +51,12 @@ export function calculateGrid(gift: BaseGift): number[][] {

return newGrid;
}

export function canAcceptStaneksGift(): boolean {
return (
Player.canAccessCotMG() &&
[...Player.augmentations, ...Player.queuedAugmentations].filter(
(a) => a.name !== AugmentationName.NeuroFluxGovernor,
).length === 0
);
}
4 changes: 3 additions & 1 deletion src/Documentation/doc/advanced/bitnodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Destroying this BitNode will give you Source-File 7, or if you already have this

- Level 1: 8%
- Level 2: 12%
- Level 3: 14%
- Level 3: Level 3: 14% and immediately receive "The Blade's Simulacrum" augmentation after joining the Bladeburner division

### BitNode 8: Ghost of Wall Street

Expand Down Expand Up @@ -228,6 +228,8 @@ Destroying this BitNode will give you Source-File 13, or if you already have thi

Each level of this Source-File increases the size of Stanek's Gift.

Due to the effect of Source-File 7.3, you must accept Stanek's Gift before joining the Bladeburner division if you have that Source-File.

### BitNode 14: IPvGO Subnet Takeover

In late 2070, the .org bubble burst, and most of the newly-implemented IPvGO 'net collapsed overnight. Since then, various factions have been fighting over small subnets to control their computational power. These subnets are very valuable in the right hands, if you can wrest them from their current owners. You will be opposed by the other factions, but you can overcome them with careful choices. Prevent their attempts to destroy your networks by controlling the open space in the 'net!
Expand Down
59 changes: 41 additions & 18 deletions src/Locations/ui/SpecialLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* This subcomponent creates all of the buttons for interacting with those special
* properties
*/
import React, { useState } from "react";
import React, { useCallback, useState } from "react";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";

Expand All @@ -36,38 +36,61 @@ import { GetServer } from "../../Server/AllServers";
import { ArcadeRoot } from "../../Arcade/ui/ArcadeRoot";
import { currentNodeMults } from "../../BitNode/BitNodeMultipliers";
import { canAccessBitNodeFeature, knowAboutBitverse } from "../../BitNode/BitNodeUtils";
import { useRerender } from "../../ui/React/hooks";
import { PromptEvent } from "../../ui/React/PromptManager";
import { canAcceptStaneksGift } from "../../CotMG/Helper";

interface SpecialLocationProps {
loc: Location;
}

export function SpecialLocation(props: SpecialLocationProps): React.ReactElement {
const setRerender = useState(false)[1];
const rerender = useRerender();

// Apply for Bladeburner division
const joinBladeburnerDivision = useCallback(() => {
Player.startBladeburner();
dialogBoxCreate("You have been accepted into the Bladeburner division!");
rerender();
}, [rerender]);

/** Click handler for Bladeburner button at Sector-12 NSA */
function handleBladeburner(): void {
if (Player.bladeburner) {
// Enter Bladeburner division
Router.toPage(Page.Bladeburner);
} else if (
Player.skills.strength >= 100 &&
Player.skills.defense >= 100 &&
Player.skills.dexterity >= 100 &&
Player.skills.agility >= 100
return;
}
if (
Player.skills.strength < 100 ||
Player.skills.defense < 100 ||
Player.skills.dexterity < 100 ||
Player.skills.agility < 100
) {
// Apply for Bladeburner division
Player.startBladeburner();
dialogBoxCreate("You have been accepted into the Bladeburner division!");
setRerender((old) => !old);

const worldHeader = document.getElementById("world-menu-header");
if (worldHeader instanceof HTMLElement) {
worldHeader.click();
worldHeader.click();
}
} else {
dialogBoxCreate("Rejected! Please apply again when you have 100 of each combat stat (str, def, dex, agi)");
return;
}
if (
Player.sourceFileLvl(7) >= 3 &&
canAcceptStaneksGift() &&
!Player.hasAugmentation(AugmentationName.StaneksGift1)
) {
PromptEvent.emit({
txt:
`After joining the Bladeburner division, you will immediately receive "${AugmentationName.BladesSimulacrum}"\n` +
`augmentation and won't be able to accept Stanek's Gift. If you want to accept Stanek's Gift,\n` +
`you must do that before joining the Bladeburner division.\n\n` +
"Do you really want to join the Bladeburner division now?",
resolve: (value: string | boolean) => {
if (value !== true) {
return;
}
joinBladeburnerDivision();
},
});
return;
}
joinBladeburnerDivision();
}

/** Click handler for Secret lab button at New Tokyo VitaLife */
Expand Down
25 changes: 10 additions & 15 deletions src/NetscriptFunctions/Stanek.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Player } from "@player";
import { AugmentationName, FactionName } from "@enums";

import { staneksGift } from "../CotMG/Helper";
import { canAcceptStaneksGift, staneksGift } from "../CotMG/Helper";
import { Fragments, FragmentById } from "../CotMG/Fragment";
import { FragmentType } from "../CotMG/FragmentType";

Expand Down Expand Up @@ -110,22 +110,17 @@ export function NetscriptStanek(): InternalAPI<IStanek> {
acceptGift: (ctx) => () => {
const cotmgFaction = Factions[FactionName.ChurchOfTheMachineGod];
// Check if the player is eligible to join the church
if (Player.canAccessCotMG()) {
const augs = [...Player.augmentations, ...Player.queuedAugmentations].filter(
(a) => a.name !== AugmentationName.NeuroFluxGovernor,
if (canAcceptStaneksGift()) {
// Join the CotMG factionn
joinFaction(cotmgFaction);
// Install the first Stanek aug
applyAugmentation({ name: AugmentationName.StaneksGift1, level: 1 });
helpers.log(
ctx,
() => `'${FactionName.ChurchOfTheMachineGod}' joined and '${AugmentationName.StaneksGift1}' installed.`,
);
if (augs.length == 0) {
// Join the CotMG factionn
joinFaction(cotmgFaction);
// Install the first Stanek aug
applyAugmentation({ name: AugmentationName.StaneksGift1, level: 1 });
helpers.log(
ctx,
() => `'${FactionName.ChurchOfTheMachineGod}' joined and '${AugmentationName.StaneksGift1}' installed.`,
);
}
}
// Return true iff the player is in CotMG and has the first Stanek aug installed
// Return true if the player is in CotMG and has the first Stanek aug installed
return cotmgFaction.isMember && Player.hasAugmentation(AugmentationName.StaneksGift1, true);
},
};
Expand Down
3 changes: 3 additions & 0 deletions src/ScriptEditor/NetscriptDefinitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3816,6 +3816,9 @@ export interface Bladeburner {
*
* Attempts to join the Bladeburner division.
*
* If you have SF 7.3, you will immediately receive "The Blade's Simulacrum" augmentation and won't be able to accept
* Stanek's Gift after joining. If you want to accept Stanek's Gift, you must do that before calling this API.
*
* Returns true if you successfully join the Bladeburner division, or if you are already a member.
*
* Returns false otherwise.
Expand Down

0 comments on commit 8fe0ea1

Please sign in to comment.