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?
The string modifiers applied to resolve the pool
An object of additional options which describes and modifies the term.
The array of dice pool results which have been rolled
Each component term of the dice pool as a Roll instance.
The original provided terms to the Dice Pool
StaticCLOSE_A regular expression pattern used to identify the closing of a dice pool expression.
StaticFLAVOR_A regular expression which identifies term-level flavor text
StaticFLAVOR_A regular expression pattern which identifies optional term-level flavor text
StaticMODIFIERSDefine the modifiers that can be used for this particular DiceTerm type.
StaticOPEN_The regular expression pattern used to identify the opening of a dice pool expression.
StaticREGEXPA regular expression pattern used to match the entirety of a DicePool expression.
StaticSERIALIZE_An array of additional attributes which should be retained when the term is serialized
Return an Array of each individual DiceTerm instances contained within the PoolTerm.
A string representation of the formula expression for this RollTerm, prior to evaluation.
Optional flavor text which modifies and describes this term.
A string representation of the formula, including optional flavor text.
Whether this term is entirely deterministic or contains some randomness.
A reference to the RollResolver app being used to externally resolve this term.
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 the PoolTerm
InternalUse the same logic as for the DiceTerm to avoid duplication
InternalUse the same logic as for the DiceTerm to avoid duplication
Alter the DiceTerm by adding or multiplying the number of dice which are rolled
Arguments passed to each contained Roll#alter method.
The altered pool
Count the number of failed results which occurred in a given result set. Failures are counted relative to some target, or relative to the lowest possible value if no target is given. Applying a count-failures modifier to the results re-casts all results to 1 (failure) or 0 (non-failure)
6d6cf Count the number of dice which rolled a 1 as failures 6d6cf<=3 Count the number of dice which rolled less than 3 as failures 6d6cf>4 Count the number of dice which rolled greater than 4 as failures
The matched modifier query
Count the number of successful results which occurred in the pool. Successes are counted relative to some target, or relative to the maximum possible value if no target is given. Applying a count-success modifier to the results re-casts all results to 1 (success) or 0 (failure)
20d20cs Count the number of dice which rolled a 20 20d20cs>10 Count the number of dice which rolled higher than 10 20d20cs<10 Count the number of dice which rolled less than 10
The matched modifier query
Keep a certain number of highest or lowest dice rolls from the result set.
{1d6,1d8,1d10,1d12}dl3 Drop the 3 worst results in the pool {1d12,6}dh Drop the highest result in the pool
The matched modifier query
Evaluate the term, processing its inputs and finalizing its total.
Optionaloptions: { allowStrings?: boolean; maximize?: boolean; minimize?: boolean } = {}Options which modify how the RollTerm is evaluated
OptionalallowStrings?: booleanIf true, string terms will not throw an error when evaluated.
Optionalmaximize?: booleanMaximize the result, obtaining the largest possible value.
Optionalminimize?: booleanMinimize the result, obtaining the smallest possible value.
Returns a Promise if the term is non-deterministic.
Keep a certain number of highest or lowest dice rolls from the result set.
{1d6,1d8,1d10,1d12}kh2 Keep the 2 best rolls from the pool {1d12,6}kl Keep the lowest result in the pool
The matched modifier query
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.
Protected_evaluateProtectedEvaluate this pool term when it contains any non-deterministic sub-terms.
Optionaloptions: object = {}Protected_evaluateProtectedEvaluate this pool term when it contains only deterministic sub-terms.
Optionaloptions: object = {}Static_fromDefine 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
StaticfromConstruct a RollTerm from a provided data object
Provided data from an un-serialized term
The constructed RollTerm
StaticfromGiven a string formula, create and return an evaluated PoolTerm object
The string formula to parse
Optionaloptions: object = {}Additional options applied to the PoolTerm
The evaluated PoolTerm object or null if the formula is invalid
StaticfromJSONReconstruct a RollTerm instance from a provided JSON string
A serialized JSON representation of a DiceTerm
A reconstructed RollTerm from the provided JSON
StaticfromStaticfromStaticisDetermine if evaluating a given RollTerm with certain evaluation options can be done so deterministically.
The term.
Optionaloptions: { maximize?: boolean; minimize?: boolean } = {}Options for evaluating the term.
Optionalmaximize?: booleanForce the result to be maximized.
Optionalminimize?: booleanForce the result to be minimized.
A type of RollTerm which encloses a pool of multiple inner Rolls which are evaluated jointly.
A dice pool represents a set of Roll expressions which are collectively modified to compute an effective total across all Rolls in the pool. The final total for the pool is defined as the sum over kept rolls, relative to any success count or margin.
Example: Keep the highest of the 3 roll expressions