Skip to content

Fix minimum/maximum damage mods not applying to fully converted damage - #10508

Open
lucaskarsten wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
lucaskarsten:fix/10407-max-lightning-conversion
Open

lucaskarsten wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
lucaskarsten:fix/10407-max-lightning-conversion

Conversation

@lucaskarsten

Copy link
Copy Markdown
Contributor

Fixes #10407

Description of the problem being solved:

Roiling Tempest ("25% more Maximum Lightning Damage / 50% less Minimum Lightning Damage") and any custom "more/increased Minimum/Maximum Damage" did nothing on spells whose damage is fully converted to that type (e.g. Divine Ire, Storm Burst or Hydrosphere with Physical to Lightning).

In calcDamage, a damage type with no base damage of its own (baseMin == 0 and baseMax == 0) returned the damage converted into it straight away, skipping all its modifiers. That is fine for the normal increased/more mods, because those of the destination type are already applied while calculating the source type (the type flags are carried down the conversion chain), but the Min<Type>Damage / Max<Type>Damage mods are only looked up for the type being calculated, so they were lost. When the type also has some base damage, the same mods were already applied to the converted part ((base... + addMax) * moreMaxDamage * incMaxDamage), so the result depended on whether the skill had any base damage of that type.

The min/max lookups now happen before that early return and are applied to the converted damage there too, for every damage type. The breakdown row of that type now shows the multipliers in the More/less column (e.g. x 0.5 min, x 1.25 max) so the jump from Converted Damage to Total is explained.

Side effects, all through the same calcDamage:

  • Chained conversion: with Physical to Lightning to Cold, "more Maximum Lightning Damage" now scales the Cold max through the Lightning step, as it already did when the skill had some base Lightning damage. Physical converted directly to Cold is unaffected.
  • Damage gained as extra Lightning with no Lightning base is now affected too.
  • Ailments that use the hit range (shock/ignite source damage via calcAilmentSourceDamage) and minions that convert damage get the same correction.

Steps taken to verify a working solution:

  • Added a test in TestOffence_spec.lua: Bladefall with 100% of Physical converted to Lightning, plus "25% more Maximum Lightning Damage" and "50% less Minimum Lightning Damage". Lightning max goes from 535 to 669 and min from 356 to 178. On dev it stays at 535 (the test fails).
  • Also tested: Physical to Lightning to Cold (Cold max x1.25, min x0.5 with the mods), Physical converted directly to Cold (unchanged), and 50% of Physical gained as extra Lightning (Lightning max x1.25, min x0.5, Physical unchanged). On dev the three Roiling tempest and custom modifier "more maximum lightning damage" doesnt seem to apply for phys2light conversion #10407 tests fail (26 successes / 3 failures in TestOffence_spec.lua); on this branch 29 / 0.
  • Headless, Lightning hit range with and without the Roiling Tempest mods:
Case dev This branch
Issue build (Storm Burst, Physical to Lightning) 277-416 → 277-416 277-416 → 138-520
Bladefall, 100% phys to lightning 356-535 → 356-535 356-535 → 178-669
Arc (pure lightning) 203-1150 → 101-1437 203-1150 → 101-1437
Bladefall, no conversion (physical) unchanged unchanged
  • Full busted suite: 749 successes, 0 failures.
  • --tags=builds (the saved 3.13 builds): the same 900 failures, with identical messages, on dev and on this branch, so no saved-build output changed.

Link to a build that showcases this PR:

The build in the issue, with "25% more Maximum Lightning Damage" and "50% less Minimum Lightning Damage" added as custom modifiers.

Before screenshot:

Storm Burst: 277 to 416 Lightning Damage, with or without the mods.

After screenshot:

Storm Burst: 138 to 520 Lightning Damage with the mods.

Damage types with no base damage of their own (e.g. Lightning on a spell whose
Physical damage is 100% converted) returned the converted damage before their
"more/increased Minimum/Maximum <Type> Damage" modifiers were applied, so
Roiling Tempest and similar mods did nothing for phys to lightning spells.
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.

Roiling tempest and custom modifier "more maximum lightning damage" doesnt seem to apply for phys2light conversion

1 participant