mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 19:14:32 +02:00
BLADEBURNER: Fix NaN in getSuccessRange (#1394)
This commit is contained in:
@@ -20,7 +20,7 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
|
||||
const getBladeburner = function (ctx: NetscriptContext): Bladeburner {
|
||||
const apiAccess = Player.bitNodeN === 7 || Player.sourceFileLvl(7) > 0;
|
||||
if (!apiAccess) {
|
||||
throw helpers.errorMessage(ctx, "You have not unlocked the bladeburner API.", "API ACCESS");
|
||||
throw helpers.errorMessage(ctx, "You have not unlocked the Bladeburner API.", "API ACCESS");
|
||||
}
|
||||
const bladeburner = Player.bladeburner;
|
||||
if (!bladeburner)
|
||||
@@ -112,14 +112,10 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
|
||||
},
|
||||
getActionCurrentTime: (ctx) => () => {
|
||||
const bladeburner = getBladeburner(ctx);
|
||||
try {
|
||||
const timecomputed =
|
||||
Math.min(bladeburner.actionTimeCurrent + bladeburner.actionTimeOverflow, bladeburner.actionTimeToComplete) *
|
||||
1000;
|
||||
return timecomputed;
|
||||
} catch (e: unknown) {
|
||||
throw helpers.errorMessage(ctx, String(e));
|
||||
}
|
||||
return (
|
||||
Math.min(bladeburner.actionTimeCurrent + bladeburner.actionTimeOverflow, bladeburner.actionTimeToComplete) *
|
||||
1000
|
||||
);
|
||||
},
|
||||
getActionEstimatedSuccessChance: (ctx) => (type, name) => {
|
||||
const bladeburner = getBladeburner(ctx);
|
||||
|
||||
Reference in New Issue
Block a user