mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Fix #1915: Check blade console skill max level
Prevents you from leveling up a skill past its max level.
This commit is contained in:
parent
1427993a25
commit
f2ccc63b2d
@ -502,6 +502,7 @@ export class Bladeburner implements IBladeburner {
|
||||
const skill = Skills[skillName];
|
||||
if (skill == null || !(skill instanceof Skill)) {
|
||||
this.postToConsole("Invalid skill name (Note that it is case-sensitive): " + skillName);
|
||||
break;
|
||||
}
|
||||
if (args[1].toLowerCase() === "list") {
|
||||
let level = 0;
|
||||
@ -515,7 +516,11 @@ export class Bladeburner implements IBladeburner {
|
||||
currentLevel = this.skills[skillName];
|
||||
}
|
||||
const pointCost = skill.calculateCost(currentLevel);
|
||||
if (this.skillPoints >= pointCost) {
|
||||
if (skill.maxLvl !== 0 && currentLevel >= skill.maxLvl) {
|
||||
this.postToConsole(
|
||||
`This skill ${skill.name} is already at max level (${currentLevel}/${skill.maxLvl}).`,
|
||||
);
|
||||
} else if (this.skillPoints >= pointCost) {
|
||||
this.skillPoints -= pointCost;
|
||||
this.upgradeSkill(skill);
|
||||
this.log(skill.name + " upgraded to Level " + this.skills[skillName]);
|
||||
|
Loading…
Reference in New Issue
Block a user