From f2ccc63b2d91fa1e15212f4b4f036185e2fc6f4f Mon Sep 17 00:00:00 2001 From: Martin Fournier Date: Tue, 21 Dec 2021 06:53:24 -0500 Subject: [PATCH] Fix #1915: Check blade console skill max level Prevents you from leveling up a skill past its max level. --- src/Bladeburner/Bladeburner.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx index 5b5112516..06396301a 100644 --- a/src/Bladeburner/Bladeburner.tsx +++ b/src/Bladeburner/Bladeburner.tsx @@ -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]);