mwg API
    Preparing search index...

    Type Alias TacticalShape

    TacticalShape: "square" | "hex"

    A tactical action-point battle layer: a grid or hex board where units spend action points to move and attack, with overwatch reactions and turn order rotating by owner. Distances and neighbours follow shape, reusing core.Hex for hex boards.

    import {
    startingTactics,
    addTacticalUnit,
    tacticalMoves,
    moveTacticalUnit,
    setTacticalOverwatch,
    triggerTacticalOverwatch,
    tacticalAttack,
    endTacticalTurn,
    } from '@datamoc/mw_games/board';

    const state = startingTactics(6, 6, 'square');
    addTacticalUnit(state, { id: 'ranger', owner: 'blue', x: 0, y: 0, hp: 10, maxHp: 10, actions: 2 });
    addTacticalUnit(state, { id: 'raider', owner: 'red', x: 3, y: 0, hp: 10, maxHp: 10, actions: 2 });

    const moves = tacticalMoves(state, 'ranger'); // reachable cells within 2 action points
    moveTacticalUnit(state, moves[0]);

    setTacticalOverwatch(state, 'ranger'); // spends the rest of blue's turn watching
    endTacticalTurn(state); // hands the turn to red

    const reactions = triggerTacticalOverwatch(state, 'raider', 4); // ranger fires if raider is in range
    const result = tacticalAttack(state, 'raider', 'ranger', 3); // red's own attack, 3 damage minus cover
    console.log(result.killed); // false - ranger has hp left