Srd.Dice.Rolls (srd_5e v0.2.0)

Copy Markdown View Source

The SRD's standard rolls, named by intent.

Every function here returns a Srd.Dice.Roll and applies no meaning to the roll. These are convenience functions so developers don't have to memorize the SRD rules for dice rolling.

Summary

Functions

An ability score: 4d6, drop the lowest.

An attack roll: 1d20 + bonus (2d20 keep highest/lowest under advantage).

An ability check: 1d20 + modifier.

A death saving throw: 1d20, no modifier.

An initiative roll: 1d20 + Dex modifier.

A saving throw: 1d20 + bonus.

Functions

ability_score()

@spec ability_score() :: Srd.Dice.Roll.t()

An ability score: 4d6, drop the lowest.

attack(bonus, opts \\ [])

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

An attack roll: 1d20 + bonus (2d20 keep highest/lowest under advantage).

check(modifier, opts \\ [])

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

An ability check: 1d20 + modifier.

death_save()

@spec death_save() :: Srd.Dice.Roll.t()

A death saving throw: 1d20, no modifier.

initiative(dex_mod, opts \\ [])

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

An initiative roll: 1d20 + Dex modifier.

save(bonus, opts \\ [])

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

A saving throw: 1d20 + bonus.