mwg API
    Preparing search index...

    Interface SkirmishTerrain

    A Wesnoth-style hex army-game rules layer: terrain that costs different movement points and grants a defence bonus per terrain kind, adjacent attacks that always let a surviving defender strike back, capturable villages that grant income and heal whoever stands on one, and per-side turn income built on both. Distinct from board.Tactics (an X-COM-style action-point/cover/overwatch layer, ranged attacks, no retaliation) - this is the other shape a hex army game needs, adjacency-only combat with a hit chance and no zone of control.

    mwg supplies the mechanism only: SkirmishTerrain's move cost and defence numbers, unit attack/hit-chance/hp values, and income rates are entirely the game's own data, the same policy board.Army's armyIncome already follows.

    import { startingSkirmish, setSkirmishTerrain, addSkirmishUnit, skirmishMoves, moveSkirmishUnit, skirmishAttack, endSkirmishTurn, skirmishIncome } from '@datamoc/mw_games/board';

    const terrain = { plain: { moveCost: 1, defense: 0 }, forest: { moveCost: 2, defense: 0.3 } };
    const state = startingSkirmish(6, 6, terrain);
    setSkirmishTerrain(state, 2, 2, 'forest');
    setSkirmishTerrain(state, 0, 0, 'plain', true); // a village at the corner

    addSkirmishUnit(state, { id: 'axeman', owner: 'blue', x: 0, y: 0, hp: 10, maxHp: 10, moves: 4, attack: 4, hitChance: 0.7 });
    addSkirmishUnit(state, { id: 'raider', owner: 'red', x: 1, y: 0, hp: 10, maxHp: 10, moves: 4, attack: 3, hitChance: 0.6 });

    const moves = skirmishMoves(state, 'axeman'); // reachable cells, weighted by terrain cost
    const exchange = skirmishAttack(state, 'axeman', 'raider'); // both strike if raider survives

    endSkirmishTurn(state); // hands the turn to red, refills moves, heals units on owned villages
    const income = skirmishIncome(state, 'blue', 2, 1); // base 2, +1 per village blue owns
    interface SkirmishTerrain {
        defense: number;
        moveCost: number;
    }
    Index
    defense: number

    0-1 defence bonus for whoever is standing here while defending - what it multiplies is skirmishAttack's own formula, not this terrain's own business

    moveCost: number

    movement points spent entering this terrain kind; Infinity makes it impassable