An Array of dice term modifiers which are applied
The array of dice term results which have been rolled
An object of additional options which describes and modifies the term.
Internal
_rootA reference to the Roll at the root of the evaluation tree.
Is this term intermediate, and should be evaluated first as part of the simplification process?
Protected
_numberThe number of dice of this term to roll, before modifiers are applied, or a Roll instance that will be evaluated to a number.
Protected
_facesThe number of faces on the die, or a Roll instance that will be evaluated to a number.
Static
DENOMINATIONDefine the denomination string used to register this DiceTerm type in CONFIG.Dice.terms
Static
MODIFIERSDefine the named modifiers that can be applied for this particular DiceTerm type.
Re-roll the Die, rolling additional results for any values which fall within a target set. If no target number is specified, re-roll the lowest possible result.
20d20r reroll all 1s 20d20r1 reroll all 1s 20d20r=1 reroll all 1s 20d20r1=1 reroll a single 1
The matched modifier query
Reroll recursively, continuing to reroll until the condition is no longer met
False if the modifier was unmatched
Keep a certain number of highest or lowest dice rolls from the result set.
20d20k Keep the 1 highest die 20d20kh Keep the 1 highest die 20d20kh10 Keep the 10 highest die 20d20kl Keep the 1 lowest die 20d20kl10 Keep the 10 lowest die
The matched modifier query
Keep a certain number of highest or lowest dice rolls from the result set.
20d20k Keep the 1 highest die 20d20kh Keep the 1 highest die 20d20kh10 Keep the 10 highest die 20d20kl Keep the 1 lowest die 20d20kl10 Keep the 10 lowest die
The matched modifier query
Keep a certain number of highest or lowest dice rolls from the result set.
20d20k Keep the 1 highest die 20d20kh Keep the 1 highest die 20d20kh10 Keep the 10 highest die 20d20kl Keep the 1 lowest die 20d20kl10 Keep the 10 lowest die
The matched modifier query
Drop a certain number of highest or lowest dice rolls from the result set.
20d20d Drop the 1 lowest die 20d20dh Drop the 1 highest die 20d20dl Drop the 1 lowest die 20d20dh10 Drop the 10 highest die 20d20dl10 Drop the 10 lowest die
The matched modifier query
Drop a certain number of highest or lowest dice rolls from the result set.
20d20d Drop the 1 lowest die 20d20dh Drop the 1 highest die 20d20dl Drop the 1 lowest die 20d20dh10 Drop the 10 highest die 20d20dl10 Drop the 10 lowest die
The matched modifier query
Drop a certain number of highest or lowest dice rolls from the result set.
20d20d Drop the 1 lowest die 20d20dh Drop the 1 highest die 20d20dl Drop the 1 lowest die 20d20dh10 Drop the 10 highest die 20d20dl10 Drop the 10 lowest die
The matched modifier query
Static
MODIFIERS_A regular expression pattern which captures the full set of term modifiers Anything until a space, group symbol, or arithmetic operator
Static
MODIFIER_A regular expression used to separate individual modifiers
Static
REGEXPA regular expression used to match a term of this type
Static
SERIALIZE_An array of additional attributes which should be retained when the term is serialized
Static
FLAVOR_A regular expression pattern which identifies optional term-level flavor text
Static
FLAVOR_A regular expression which identifies term-level flavor text
The resolution method used to resolve this DiceTerm.
The number of dice of this term to roll. Returns undefined if the number is a complex term that has not yet been evaluated.
The number of faces on the die. Returns undefined if the faces are represented as a complex term that has not yet been evaluated.
A string representation of the formula expression for this RollTerm, prior to evaluation.
The denomination of this DiceTerm instance.
A string or numeric representation of the final output for this term, after evaluation.
Return an array of rolled values which are still active within this term
Whether this term is entirely deterministic or contains some randomness.
A string representation of the formula, including optional flavor text.
Optional flavor text which modifies and describes this term.
A reference to the RollResolver app being used to externally resolve this term.
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
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
Get the CSS classes that should be used to display each rolled result
The rolled result
The desired classes
Evaluate the term, processing its inputs and finalizing its total.
Optional
options: { Options which modify how the RollTerm is evaluated
Minimize the result, obtaining the smallest possible value.
Maximize the result, obtaining the largest possible value.
If true, string terms will not throw an error when evaluated.
Returns a Promise if the term is non-deterministic.
Protected
_evaluateProtected
_evaluateProtected
Evaluate deterministic values of this term synchronously.
Optional
options: { Force the result to be maximized.
Force the result to be minimized.
Throw an error if attempting to evaluate a die term in a way that cannot be done synchronously.
Protected
_rollProtected
Generate a roll result value for this DiceTerm based on its fulfillment method.
Optional
options: object = {}Options forwarded to the fulfillment method handler.
Returns a Promise that resolves to the fulfilled number, or undefined if it could not be fulfilled.
Private
#invokeInvoke the configured fulfillment handler for this term to produce a result value.
Optional
options: object = {}Options forwarded to the fulfillment method handler.
Returns a Promise that resolves to the fulfilled number, or undefined if it could not be fulfilled.
Static
compareA 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?
Static
_keepA 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
Optional
__namedParameters: boolean = {}The modified results array
Static
_applyA reusable helper function to handle the identification and deduction of failures
Static
_applyA reusable helper function to handle the identification and deduction of failures
Static
matchDetermine whether a string expression matches this type of term
The expression to parse
Optional
options: { Additional options which customize the match
Allow the number of dice to be optional, i.e. "d6"
Static
fromStatic
fromStatic
_fromStatic
isDetermine if evaluating a given RollTerm with certain evaluation options can be done so deterministically.
The term.
Optional
options: { Options for evaluating the term.
Force the result to be maximized.
Force the result to be minimized.
Static
fromStatic
fromJSON
A type of DiceTerm used to represent a three-sided Fate/Fudge die. Mathematically behaves like 1d3-2