The number of dice of this term to roll, before modifiers are applied
The number of faces on the die
An Array of dice term modifiers which are applied
The array of dice term results which have been rolled
An internal flag for whether the term has been evaluated
An object of additional options which describes and modifies the term.
Is this term intermediate, and should be evaluated first as part of the simplification process?
Define the denomination string used to register this DiceTerm type in CONFIG.Dice.terms
Define the named modifiers that can be applied for this particular DiceTerm type.
A regular expression pattern which captures the full set of term modifiers Anything until a space, group symbol, or arithmetic operator
A regular expression used to separate individual modifiers
A regular expression used to match a term of this type
An array of additional attributes which should be retained when the term is serialized
A regular expression pattern which identifies optional term-level flavor text
A regular expression which identifies term-level flavor text
Return an array of rolled values which are still active within this term
A string representation of the formula, including optional flavor text.
Optional flavor text which modifies and describes this term.
Alter the DiceTerm by adding or multiplying the number of dice which are rolled
A factor to multiply. Dice are multiplied before any additions.
A number of dice to add. Dice are added after multiplication.
The altered term
This method is temporarily factored out in order to provide different behaviors synchronous evaluation. This will be removed in 0.10.x
Roll the DiceTerm by mapping a random uniform draw against the faces of the dice term.
Options which modify how a random result is produced
The produced result
Return a string used as the label for each rolled result
The rolled result
The result label
Get the CSS classes that should be used to display each rolled result
The rolled result
The desired classes
Render the tooltip HTML for a Roll instance
The data object used to render the default tooltip template for this DiceTerm
Evaluate the term, processing its inputs and finalizing its total.
Options which modify how the RollTerm is evaluated
The evaluated RollTerm
Serialize the RollTerm to a JSON string which allows it to be saved in the database or embedded in text. This method should return an object suitable for passing to the JSON.stringify function.
Sequentially evaluate each dice roll modifier by passing the term to its evaluation function Augment or modify the results array.
Evaluate a single modifier command, recording it in the array of evaluated modifiers
The parsed modifier command
The full modifier request
A helper comparison function. Returns a boolean depending on whether the result compares favorably against the target.
The result being compared
The comparison operator in [=,<,<=,>,>=]
The target value
Is the comparison true?
A helper method to modify the results array of a dice term by flagging certain results are kept or dropped.
The results array
The number to keep or drop
The modified results array
A reusable helper function to handle the identification and deduction of failures
A reusable helper function to handle the identification and deduction of failures
Determine whether a string expression matches this type of term
The expression to parse
Additional options which customize the match
Construct a term of this type given a matched regular expression array.
The matched regular expression array
The constructed term
Construct a RollTerm from a provided data object
Provided data from an un-serialized term
The constructed RollTerm
Reconstruct a RollTerm instance from a provided JSON string
A serialized JSON representation of a DiceTerm
A reconstructed RollTerm from the provided JSON
Define term-specific logic for how a de-serialized data object is restored as a functional RollTerm
The de-serialized term data
The re-constructed RollTerm object
An abstract base class for any type of RollTerm which involves randomized input from dice, coins, or other devices.
Data used to create the Dice Term, including the following:
The number of dice of this term to roll, before modifiers are applied
The number of faces on each die of this type
An array of modifiers applied to the results
An optional array of pre-cast results for the term
Additional options that modify the term