mwg API
    Preparing search index...

    Function skirmishIncome

    • Net income for one side, from a flat base plus every village it currently owns - purely a function of the map's own village ownership, no formula beyond that belongs here, the same policy board.Army's armyIncome already follows.

      Parameters

      • state: SkirmishState
      • owner: string
      • baseIncome: number
      • perVillage: number

      Returns number

      import { startingSkirmish, setSkirmishTerrain, skirmishIncome } from '@datamoc/mw_games/board';

      const state = startingSkirmish(4, 1, { plain: { moveCost: 1, defense: 0 } });
      setSkirmishTerrain(state, 0, 0, 'plain', true);
      state.cells[0].owner = 'blue';

      console.log(skirmishIncome(state, 'blue', 2, 1)); // 3 - base 2, plus 1 for the one village