Srd.Dice.Roll (srd_5e v0.2.0)

Copy Markdown View Source

An immutable representation of a completed roll.

Summary

Types

t()

Represents the immutable result of a completed roll of dice. This is only ever used to represent a single type of die. Rolling a d20 and a d10 is two rolls while 2d10+3 is a single roll.

Types

t()

@type t() :: %Srd.Dice.Roll{
  count: pos_integer(),
  dice: [pos_integer()],
  modifier: integer(),
  reduce: :sum | :min | :max | :drop_lowest,
  sides: non_neg_integer(),
  total: integer()
}

Represents the immutable result of a completed roll of dice. This is only ever used to represent a single type of die. Rolling a d20 and a d10 is two rolls while 2d10+3 is a single roll.

Fields

  • :count - The number of times the die was rolled
  • :sides - The number of sides on the die
  • :modifier - A flat modifier applied to the die roll value after calculation
  • :dice - A list containing the raw value for each die roll. Occasionally needed for criticals, etc
  • :reduce - Indicates what function to run on the die rolls, e.g. sum (default), max, min, drop-lowest, etc
  • :total - The final result of the role. In most cases, this is the value used for rule resolution