Srd.Rules.D20 (srd_5e v0.2.0)

Copy Markdown View Source

Basic support for the d20 test

Summary

Types

t()

Many rules rely on a simple d20 test that compares a d20 roll total against a target number. These rules need the actual value as well as the unmodified (natural) roll. The D20 type exposes that functionality to other rules.

Functions

Performs the d20 test against a completed die roll

Types

t()

@type t() :: %Srd.Rules.D20{
  margin: integer(),
  natural: 1..20,
  success?: boolean(),
  target: integer(),
  total: integer()
}

Many rules rely on a simple d20 test that compares a d20 roll total against a target number. These rules need the actual value as well as the unmodified (natural) roll. The D20 type exposes that functionality to other rules.

Attack, save, and ability check are all rulesets that rely on the d20 test.

Functions

test(roll, target)

@spec test(Srd.Dice.Roll.t(), integer()) :: t()

Performs the d20 test against a completed die roll