Continuously reapplies auras as who is adjacent to whom changes, unlike battle.BattleHooks
(triggered once) or actors.StatusEffect (expires on a timer) - neither re-checks "is a
qualifying unit still adjacent" on its own, which is exactly what a positional aura needs
every time anyone moves.
Call update once per relevant tick with the full roster and an adjacency test; "adjacent"
is deliberately left to the caller (square grid, hex grid, board-tactics neighbours all mean
something different) rather than assumed here. Each call diffs against who was affected by
each carrier last time: a unit that just became adjacent gets the carrier's modifiers added,
one that just left loses exactly those modifiers, and one that stays adjacent is left alone
rather than having its modifiers reapplied on every tick.
// call every time positions change, with whatever "adjacent" means on this grid field.update([captain, soldier], (a, b) =>a === captain && b === soldier); console.log(soldier.stats.get('attack')); // 7, while adjacent
Continuously reapplies auras as who is adjacent to whom changes, unlike
battle.BattleHooks(triggered once) oractors.StatusEffect(expires on a timer) - neither re-checks "is a qualifying unit still adjacent" on its own, which is exactly what a positional aura needs every time anyone moves.Call
updateonce per relevant tick with the full roster and an adjacency test; "adjacent" is deliberately left to the caller (square grid, hex grid, board-tactics neighbours all mean something different) rather than assumed here. Each call diffs against who was affected by each carrier last time: a unit that just became adjacent gets the carrier's modifiers added, one that just left loses exactly those modifiers, and one that stays adjacent is left alone rather than having its modifiers reapplied on every tick.Example