mwg API
    Preparing search index...

    Class AuraField

    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.

    import { AuraField, StatBlock, type AuraParticipant } from '@datamoc/mw_games/actors';

    const field = new AuraField();
    const captain: AuraParticipant = {
    stats: new StatBlock({ base: {} }),
    aura: { name: 'rally', modifiers: [{ stat: 'attack', op: 'add', value: 2 }] },
    };
    const soldier: AuraParticipant = { stats: new StatBlock({ base: { attack: 5 } }) };

    // 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
    Index