mwg API
    Preparing search index...

    Function tacticalMoves

    • Every cell a unit can reach with its remaining action points, respecting terrain, occupancy, and enemy zones of control.

      Parameters

      Returns TacticalMove[]

      import { startingTactics, addTacticalUnit, tacticalMoves } 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');
      console.log(moves.length, moves[0]); // 5 { unit: 'ranger', x: 1, y: 0, cost: 1 }