mwg API
    Preparing search index...

    Class TypeMatrix

    An effectiveness matrix between arbitrary types - mwg supplies the matrix, not a type chart. Type names are whatever strings a game defines; an unset pairing multiplies by 1, so a matrix only has to name the pairings that are not neutral.

    import { TypeMatrix } from '@datamoc/mw_games/battle';

    const matrix = new TypeMatrix();
    matrix.set('fire', 'grass', 2); // super effective
    matrix.set('fire', 'water', 0.5); // not very effective

    const total = matrix.multiplierFor('fire', ['grass', 'ice']); // 2 * 1 = 2
    Index
    • Parameters

      • attacking: string
      • defending: string

      Returns number

    • the combined multiplier of one attacking type against every one of a target's types

      Parameters

      • attacking: string
      • defendingTypes: readonly string[]

      Returns number

    • Parameters

      • attacking: string
      • defending: string
      • multiplier: number

      Returns void