mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
fix getActionRepGain
This commit is contained in:
parent
0ec4ef31ab
commit
80d751e32b
@ -116,9 +116,9 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getActionEstimatedSuccessChance: (ctx) => (_type, _name) => {
|
getActionEstimatedSuccessChance: (ctx) => (_type, _name) => {
|
||||||
|
const bladeburner = getBladeburner(ctx);
|
||||||
const type = helpers.string(ctx, "type", _type);
|
const type = helpers.string(ctx, "type", _type);
|
||||||
const name = helpers.string(ctx, "name", _name);
|
const name = helpers.string(ctx, "name", _name);
|
||||||
const bladeburner = getBladeburner(ctx);
|
|
||||||
try {
|
try {
|
||||||
const chance = bladeburner.getActionEstimatedSuccessChanceNetscriptFn(Player, type, name);
|
const chance = bladeburner.getActionEstimatedSuccessChanceNetscriptFn(Player, type, name);
|
||||||
if (typeof chance === "string") {
|
if (typeof chance === "string") {
|
||||||
@ -133,24 +133,18 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getActionRepGain: (ctx) => (_type, _name, _level) => {
|
getActionRepGain: (ctx) => (_type, _name, _level) => {
|
||||||
|
checkBladeburnerAccess(ctx);
|
||||||
const type = helpers.string(ctx, "type", _type);
|
const type = helpers.string(ctx, "type", _type);
|
||||||
const name = helpers.string(ctx, "name", _name);
|
const name = helpers.string(ctx, "name", _name);
|
||||||
const level = helpers.number(ctx, "level", _level);
|
|
||||||
checkBladeburnerAccess(ctx);
|
|
||||||
const action = getBladeburnerActionObject(ctx, type, name);
|
const action = getBladeburnerActionObject(ctx, type, name);
|
||||||
let rewardMultiplier;
|
const level = _level === undefined ? action.level : helpers.number(ctx, "level", _level);
|
||||||
if (level == null || isNaN(level)) {
|
const rewardMultiplier = Math.pow(action.rewardFac, level - 1);
|
||||||
rewardMultiplier = Math.pow(action.rewardFac, action.level - 1);
|
|
||||||
} else {
|
|
||||||
rewardMultiplier = Math.pow(action.rewardFac, level - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return action.rankGain * rewardMultiplier * BitNodeMultipliers.BladeburnerRank;
|
return action.rankGain * rewardMultiplier * BitNodeMultipliers.BladeburnerRank;
|
||||||
},
|
},
|
||||||
getActionCountRemaining: (ctx) => (_type, _name) => {
|
getActionCountRemaining: (ctx) => (_type, _name) => {
|
||||||
|
const bladeburner = getBladeburner(ctx);
|
||||||
const type = helpers.string(ctx, "type", _type);
|
const type = helpers.string(ctx, "type", _type);
|
||||||
const name = helpers.string(ctx, "name", _name);
|
const name = helpers.string(ctx, "name", _name);
|
||||||
const bladeburner = getBladeburner(ctx);
|
|
||||||
try {
|
try {
|
||||||
return bladeburner.getActionCountRemainingNetscriptFn(type, name, ctx.workerScript);
|
return bladeburner.getActionCountRemainingNetscriptFn(type, name, ctx.workerScript);
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
|
Loading…
Reference in New Issue
Block a user