mwg API
    Preparing search index...

    Class MultiTurnBeam<T>

    Advances a beam one front per turn.

    The framework owns traversal and timing. A game supplies target lookup and damage application, so this stays useful for hit points, shields, status effects and any other combat model. The default shape is a straight line captured at construction time; fronts opts into a per-turn front resolver, which is what expresses a cone, a burst, a fork or a moving front without any of those rules living here. Blockers and targets are checked when each cell is reached, so advance is deterministic when those callbacks are.

    import { Level, FLOOR, WALL, MultiTurnBeam } from '@datamoc/mw_games/roguelike';

    const level = new Level(8, 1, [WALL, FLOOR], 1);
    const beam = new MultiTurnBeam({ level, from: { x: 0, y: 0 }, target: { x: 3, y: 0 }, damage: 4 });
    beam.start();
    beam.advance(); // reaches x=1; call again on the next turn

    Type Parameters

    • T = unknown
    Index