API: Changing return value of ns.bladeburner.getSkillUpgradeCost to return Infinity when the skill's level overshoot the maximum level (#1060)

This commit is contained in:
Rinne 2024-01-31 21:40:27 -03:00 committed by GitHub
parent 497618dc2f
commit 5277db2c65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

@ -31,5 +31,5 @@ RAM cost: 4 GB
This function returns the number of skill points needed to upgrade the specified skill the specified number of times. This function returns the number of skill points needed to upgrade the specified skill the specified number of times.
The function returns -1 if an invalid skill name is passed in. The function returns -1 if an invalid skill name is passed in, and Infinity if the count overflows the maximum level.

@ -2299,10 +2299,13 @@ export class Bladeburner {
} }
const skill = Skills[skillName]; const skill = Skills[skillName];
if (this.skills[skillName] == null) { const currentLevel = this.skills[skillName];
if (currentLevel == null) {
return skill.calculateCost(0, count); return skill.calculateCost(0, count);
} else if (currentLevel + count > skill.maxLvl) {
return Infinity;
} else { } else {
return skill.calculateCost(this.skills[skillName], count); return skill.calculateCost(currentLevel, count);
} }
} }

@ -3257,7 +3257,7 @@ export interface Bladeburner {
* *
* This function returns the number of skill points needed to upgrade the specified skill the specified number of times. * This function returns the number of skill points needed to upgrade the specified skill the specified number of times.
* *
* The function returns -1 if an invalid skill name is passed in. * The function returns -1 if an invalid skill name is passed in, and Infinity if the count overflows the maximum level.
* *
* @param skillName - Name of skill. Case-sensitive and must be an exact match. * @param skillName - Name of skill. Case-sensitive and must be an exact match.
* @param count - Number of times to upgrade the skill. Defaults to 1 if not specified. * @param count - Number of times to upgrade the skill. Defaults to 1 if not specified.