Dice

A set of dice, ready to be rolled.

Constructors

this
this(uint seed)

Initializes dice with a seed.

Members

Functions

meetTarget
DiceTargetResults meetTarget(uint val)

Roll the dice and count the number of rolls that met the specified target.

roll
DiceRollResults roll()

Roll one set of dice according to the set parameters.

rolls
DiceRollResults[] rolls()

Performs all rolls at once.

Variables

count
uint count;

Number of dice per set to roll.

lowerRerollThreshold
uint lowerRerollThreshold;

Lower bound of results to reroll.

numDiceQualified
uint numDiceQualified;

Maximum number of dice to consider in results.

sets
uint sets;

Number of sets of dice to roll.

sides
uint sides;

Number of sides on each die.

takeLowestRolls
bool takeLowestRolls;

Whether to take the lowest or highest rolls.

upperRerollThreshold
uint upperRerollThreshold;

Upper bound of results to reroll.

valAdd
int valAdd;

Value to add to the sum of each set.

weighting
Weight weighting;

What sort of weighting to apply to the dice, if any.

Examples

auto dice = dice(0);
dice.sides = 20;
assert(dice.roll().total == 5);

Meta