diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx index 38276949a..355d3b2d5 100644 --- a/src/Bladeburner/Bladeburner.tsx +++ b/src/Bladeburner/Bladeburner.tsx @@ -109,12 +109,23 @@ export class Bladeburner { this.stamina = this.maxStamina; this.create(); } + /* + just a quick fix for the broken implementation + BlackOperations are only initialized on game load with a count of 1 + and are not reset on BitNode change or dev menu reset of bladeburner + */ + resetBlackOps(): void { + for (const [blackopName, blackop] of Object.entries(BlackOperations)) { + blackop.count = Number(!this.blackops[blackopName]); + } + } getCurrentCity(): City { return this.cities[this.city]; } calculateStaminaPenalty(): number { + if (this.stamina === this.maxStamina) return 1; return Math.min(1, this.stamina / (0.5 * this.maxStamina)); } @@ -1998,6 +2009,8 @@ export class Bladeburner { process(): void { // Edge race condition when the engine checks the processing counters and attempts to route before the router is initialized. if (!Router.isInitialized) return; + //safety measure this needs to be removed in a bigger refactor + this.resetBlackOps(); // If the Player starts doing some other actions, set action to idle and alert if (!Player.hasAugmentation(AugmentationName.BladesSimulacrum, true) && Player.currentWork) { @@ -2166,6 +2179,7 @@ export class Bladeburner { try { this.startAction(actionId); + if (!Player.hasAugmentation(AugmentationName.BladesSimulacrum, true)) Player.finishWork(true); workerScript.log( "bladeburner.startAction", () => `Starting bladeburner action with type '${type}' and name '${name}'`, diff --git a/src/Bladeburner/ui/StartButton.tsx b/src/Bladeburner/ui/StartButton.tsx index 39327277f..b472af4d2 100644 --- a/src/Bladeburner/ui/StartButton.tsx +++ b/src/Bladeburner/ui/StartButton.tsx @@ -31,10 +31,11 @@ export function StartButton(props: IProps): React.ReactElement { } function onStart(): void { if (disabled) return; - props.bladeburner.action.type = props.type; - props.bladeburner.action.name = props.name; + const action = new ActionIdentifier(); + action.type = props.type; + action.name = props.name; if (!Player.hasAugmentation(AugmentationName.BladesSimulacrum, true)) Player.finishWork(true); - props.bladeburner.startAction(props.bladeburner.action); + props.bladeburner.startAction(action); props.rerender(); }