mwg API
    Preparing search index...

    Function skillCheck

    • A skill checked against a difficulty.

      The default mechanic - a proficiency plus a die roll, compared against a target number - is deliberately the simplest one that exists, because it is a shape every game recognises and every game also wants to replace with its own dice. Pass roll to use anything else; the default draws from mwg/core's seeded RNG, so a check replays the same way from a save file.

      Parameters

      • value: number
      • difficulty: number
      • roll: () => number = ...

      Returns boolean

      true if the check succeeds

      import { skillCheck } from '@datamoc/mw_games/actors';

      const success = skillCheck(5, 15); // proficiency 5, difficulty 15, default d20 roll
      const withCustomDice = skillCheck(5, 15, () => 12); // an injected, non-random roll