Skip to content

Fix sidebar percentage stat truncation#2152

Open
Divinicus1st wants to merge 1 commit into
PathOfBuildingCommunity:devfrom
Divinicus1st:fix-sidebar-percent-rounding
Open

Fix sidebar percentage stat truncation#2152
Divinicus1st wants to merge 1 commit into
PathOfBuildingCommunity:devfrom
Divinicus1st:fix-sidebar-percent-rounding

Conversation

@Divinicus1st

Copy link
Copy Markdown

Sidebar percentage stats using %d can display one point too low when the underlying value is a floating point number slightly below the expected integer, e.g. 229.99999999999997 displayed as 229%.

This changes affected sidebar percentage formats from %d%% to %.0f%% so they round for display instead of truncating.

Confirmed with a blank build taking only two 15% increased Critical Damage Bonus nodes (cf. screenshots):

  • Calcs tab correctly shows x2.30
  • Sidebar now shows 230% Crit Multiplier instead of 229%

Modified sidebar stats in src/Modules/BuildDisplayStats.lua:

  • Line 36: CritMultiplier
  • Line 81: ManaPercentCost
  • Line 85: LifePercentCost
  • Line 124: LifeUnreservedPercent
  • Line 133: ManaUnreservedPercent
  • Line 141: SpiritUnreservedPercent
  • Line 162: EvadeChance
  • Line 163: MeleeEvadeChance
  • Line 164: ProjectileEvadeChance
  • Line 165: SpellEvadeChance
  • Line 166: SpellProjectileEvadeChance
  • Line 168: DeflectChance
  • Line 172: PhysicalDamageReduction
  • Line 174: EffectiveBlockChance
  • Line 175: EffectiveSpellBlockChance
  • Line 176: AttackDodgeChance
  • Line 177: SpellDodgeChance
  • Line 178: EffectiveSpellSuppressionChance

Left resistance display unchanged, since there's a comment saying resistances are explicitly truncated in the calc output.

Before screenshot:

image

After screenshot:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant