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?
An object of additional options which describes and modifies the term.
An already-evaluated Roll instance used instead of the string term.
The original provided string term used to construct the parenthetical
StaticCLOSE_A regular expression pattern used to identify the closing of a parenthetical expression.
StaticFLAVOR_A regular expression which identifies term-level flavor text
StaticFLAVOR_A regular expression pattern which identifies optional term-level flavor text
StaticOPEN_The regular expression pattern used to identify the opening of a parenthetical expression. This could also identify the opening of a math function.
StaticREGEXPA regular expression used to match a term of this type
StaticSERIALIZE_An array of additional attributes which should be retained when the term is serialized
An array of evaluated DiceTerm instances that should be bubbled up to the parent Roll
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.
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.
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_evaluateProtected_evaluateStaticfromConstruct a RollTerm from a provided data object
Provided data from an un-serialized term
The constructed RollTerm
StaticfromJSONReconstruct a RollTerm instance from a provided JSON string
A serialized JSON representation of a DiceTerm
A reconstructed RollTerm from the provided JSON
StaticfromStaticfromConstruct a ParentheticalTerm from an Array of component terms which should be wrapped inside the parentheses.
The array of terms to use as internal parts of the parenthetical
Optionaloptions: objectAdditional options passed to the ParentheticalTerm constructor
The constructed ParentheticalTerm instance
StaticisDetermine 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.
Protected Static_fromProtectedDefine 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
A type of RollTerm used to enclose a parenthetical expression to be recursively evaluated.