mwg API
    Preparing search index...

    Class Goals

    Per-unit goals - "hold this village", "attack that leader" - kept as a small registry for a stage's weigh to read. mwg does not decide what a goal is worth, the same way it ships no damage formula: the registry answers what a unit has been told to do, and a game's weigh decides how much that matters.

    import { Goals } from '@datamoc/mw_games/ai';

    const goals = new Goals();
    goals.set({ unit: 'hero', kind: 'attack', target: 'rat', priority: 3 });
    console.log(goals.get('hero')?.kind); // 'attack'
    Index