HomeWildfire Games

Bugfix & optimisations to ApplyModifiers

Description

Bugfix & optimisations to ApplyModifiers

This functions is amongst the most called in JS, so it's important to make it speedy.

  • Bugfix: if 'originalValue' is falsy, the result was never cached. This in particular affected the minRange of archers, which is 0. It's a large optimisation on combatDemoHuge, but the effect elsewhere is less likely to be noticeable.
  • Don't go through the helper to get the player Entity ID, in this case it's slower.
  • Concat is slower than Flat() in this case according to my profiling.
  • Some micro-optimisation by strict equality.

Differential Revision: https://code.wildfiregames.com/D5012