BUGFIX: Fixed bug that returned Infinity cost for most skills (#1084)

This commit is contained in:
Rinne 2024-02-10 06:01:42 -03:00 committed by GitHub
parent 9697a82e0c
commit 6bd50e6f24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2299,14 +2299,13 @@ export class Bladeburner {
} }
const skill = Skills[skillName]; const skill = Skills[skillName];
const currentLevel = this.skills[skillName]; const currentLevel = this.skills[skillName] ?? 0;
if (currentLevel == null) {
return skill.calculateCost(0, count); if (skill.maxLvl !== 0 && currentLevel + count > skill.maxLvl) {
} else if (currentLevel + count > skill.maxLvl) {
return Infinity; return Infinity;
} else {
return skill.calculateCost(currentLevel, count);
} }
return skill.calculateCost(currentLevel, count);
} }
upgradeSkillNetscriptFn(skillName: string, count: number, workerScript: WorkerScript): boolean { upgradeSkillNetscriptFn(skillName: string, count: number, workerScript: WorkerScript): boolean {