BLADEBURNER: Fix wrong behavior of ns.bladeburner.getSkillUpgradeCost (#1471)

This commit is contained in:
catloversg
2024-07-08 04:49:23 +07:00
committed by GitHub
parent 1613eb38ed
commit 2b6ec5cd33
3 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -214,7 +214,11 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
const skillName = getEnumHelper("BladeSkillName").nsGetMember(ctx, _skillName, "skillName");
const count = helpers.positiveInteger(ctx, "count", _count ?? 1);
const currentLevel = bladeburner.getSkillLevel(skillName);
return Skills[skillName].calculateCost(currentLevel, count);
const skill = Skills[skillName];
if (currentLevel + count > skill.maxLvl) {
return Infinity;
}
return skill.calculateCost(currentLevel, count);
},
upgradeSkill: (ctx) => (_skillName, _count) => {
const bladeburner = getBladeburner(ctx);