mwg API
    Preparing search index...

    Function canPlaceTacticalUnit

    • whether a unit could be placed at (x, y) right now - on the map, and not already occupied

      Parameters

      Returns boolean

      import { startingTactics, addTacticalUnit, canPlaceTacticalUnit } 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 });

      console.log(canPlaceTacticalUnit(state, 1, 1)); // true
      console.log(canPlaceTacticalUnit(state, 0, 0)); // false - ranger is already there