Skip to content

Conversation

gdavid04
Copy link
Contributor

@gdavid04 gdavid04 commented Mar 11, 2025

Replaces the limited constants system used for cost and spell stat calculation with interval arithmetic.

This means

  • piece costs no longer have to be monotonically increasing as the absolute value of a constant input increases
  • arbitrary intervals are supported as opposed to just -c<x<0 and 0<x<c with Constant Wrapper
  • in some cases, Constant Wrapper is no longer needed
  • even where Constant Wrapper is needed it doesn't have to be at the end of the calculation
  • the interval API is more extensible, making it easier to adapt to other types as well, e.g. vectors with bounds on length and components, entity lists with bounded size or any type added by addons

This is a breaking change and most addons will have to make changes to be compatible.
This should be fully backward compatible with older spells.

Closes #665

TODO

  • take Error Catcher into account when calculating the interval for its target
  • make interval checks more lenient so Constant Wrapper is needed less often, e.g. make Trick: Sleep accept [-a;+b] intervals as well, only showing an error for negative values at runtime in this case (interval arithmetic can often give much larger bounds than needed)
  • improve interval calculation for some operators
  • remove in-game references to constant values

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.

Constant: Wrapper Not able to emulate values between -1 and 1
4 participants