mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-03 22:37:06 +02:00
BUGFIX: Wrong success chance in ns.bladeburner.getActionEstimatedSuccessChance (#1450)
This commit is contained in:
@@ -120,16 +120,21 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
|
||||
getActionEstimatedSuccessChance: (ctx) => (type, name, _sleeve) => {
|
||||
const bladeburner = getBladeburner(ctx);
|
||||
const action = getAction(ctx, type, name);
|
||||
if (_sleeve != null) {
|
||||
checkSleeveAPIAccess(ctx);
|
||||
const sleeveNumber = helpers.number(ctx, "sleeve", _sleeve);
|
||||
checkSleeveNumber(ctx, sleeveNumber);
|
||||
if (action.type === BladeActionType.contract) {
|
||||
if (_sleeve == null) {
|
||||
return action.getSuccessRange(bladeburner, Player);
|
||||
}
|
||||
checkSleeveAPIAccess(ctx);
|
||||
const sleeveNumber = helpers.number(ctx, "sleeve", _sleeve);
|
||||
checkSleeveNumber(ctx, sleeveNumber);
|
||||
switch (action.type) {
|
||||
case BladeActionType.general:
|
||||
return [1, 1];
|
||||
case BladeActionType.contract: {
|
||||
const sleevePerson = Player.sleeves[sleeveNumber];
|
||||
return action.getSuccessRange(bladeburner, sleevePerson);
|
||||
} else return [0, 0];
|
||||
} else {
|
||||
return action.getSuccessRange(bladeburner, Player);
|
||||
}
|
||||
default:
|
||||
return [0, 0];
|
||||
}
|
||||
},
|
||||
getActionRepGain: (ctx) => (type, name, _level) => {
|
||||
|
||||
@@ -28,7 +28,6 @@ export const checkSleeveAPIAccess = function (ctx: NetscriptContext) {
|
||||
export const checkSleeveNumber = function (ctx: NetscriptContext, sleeveNumber: number) {
|
||||
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
|
||||
const msg = `Invalid sleeve number: ${sleeveNumber}`;
|
||||
helpers.log(ctx, () => msg);
|
||||
throw helpers.errorMessage(ctx, msg);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user