mwg API
    Preparing search index...

    Class TriggerTracker

    Counts qualifying events (a landed hit, a heal, a kill) toward a streak, but restarts the streak once more than window turns pass without a qualifying event - the shape every "combo", "kill streak", or "stays hidden as long as you keep landing sneak attacks" talent proc shares. mwg tracks only the streak and its turn-window; what counts as a qualifying event, and what a streak length unlocks, stay the game's own rule, fired from trigger's own returned count.

    import { TriggerTracker } from '@datamoc/mw_games/roguelike';

    const combo = new TriggerTracker(2); // a hit must land within 2 turns of the last
    combo.trigger(1); // streak: 1
    combo.trigger(2); // streak: 2 - within the window
    combo.trigger(10); // streak restarts at 1 - the window lapsed
    Index
    • true while fewer than window turns have passed since the last trigger, as of turn

      Parameters

      • turn: number

      Returns boolean

    • ends the streak immediately - a missed attack, breaking stealth - without waiting out the window

      Returns void

    • Records a qualifying event on turn, extending the streak when it falls within window turns of the last one, or restarting it at 1 otherwise.

      Parameters

      • turn: number

      Returns number

      the streak length after this event