From e5e4e2693ff27da52aa1a458d6719a095d88843a Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:27:59 +0700 Subject: [PATCH] DOCUMENTATION: Clarify getSkillUpgradeCost and fix typo in BaseTask (#1749) --- .../bitburner.bladeburner.getskillupgradecost.md | 8 +++++++- src/ScriptEditor/NetscriptDefinitions.d.ts | 12 ++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/markdown/bitburner.bladeburner.getskillupgradecost.md b/markdown/bitburner.bladeburner.getskillupgradecost.md index f20f8dd62..23750202b 100644 --- a/markdown/bitburner.bladeburner.getskillupgradecost.md +++ b/markdown/bitburner.bladeburner.getskillupgradecost.md @@ -31,5 +31,11 @@ RAM cost: 4 GB This function returns the number of skill points needed to upgrade the specified skill the specified number of times. -The function returns Infinity if the sum of the current level and count exceeds the maximum level. +The function may return 0 or Infinity in special cases: + +- Return 0 if the current skill level is too high and the specified count is too small. In normal situations, you don't need to worry about this case. It only happens when involved numbers surpass Number.MAX\_SAFE\_INTEGER and be affected by the floating-point inaccuracy. + +- Return Infinity if the sum of the current level and count exceeds the maximum level. + +[skillMaxUpgradeCount](./bitburner.bladeburnerformulas.skillmaxupgradecount.md) is the inverse function of this one. diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 3fa62e4d1..8d6bca26f 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1653,7 +1653,7 @@ export interface TIX { */ export interface BaseTask { /** - * The number of game engine cycles that has passed since this task started. 1 engine cycle = 200ms. + * The number of game engine cycles has passed since this task started. 1 engine cycle = 200ms. */ cyclesWorked: number; } @@ -3584,7 +3584,15 @@ export interface Bladeburner { * * This function returns the number of skill points needed to upgrade the specified skill the specified number of times. * - * The function returns Infinity if the sum of the current level and count exceeds the maximum level. + * The function may return 0 or Infinity in special cases: + * + * - Return 0 if the current skill level is too high and the specified count is too small. In normal situations, you + * don't need to worry about this case. It only happens when involved numbers surpass Number.MAX_SAFE_INTEGER and be + * affected by the floating-point inaccuracy. + * + * - Return Infinity if the sum of the current level and count exceeds the maximum level. + * + * {@link BladeburnerFormulas.skillMaxUpgradeCount | skillMaxUpgradeCount} is the inverse function of this one. * * @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.