Internal
_evaluatedAn internal flag for whether the term has been evaluated
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 term's numeric value.
An object of additional options which describes and modifies the term.
Static
FLAVOR_A regular expression which identifies term-level flavor text
Static
FLAVOR_A regular expression pattern which identifies optional term-level flavor text
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
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.
Optional
options: { allowStrings?: boolean; maximize?: boolean; minimize?: boolean } = {}Options which modify how the RollTerm is evaluated
Optional
allowStrings?: booleanIf true, string terms will not throw an error when evaluated.
Optional
maximize?: booleanMaximize the result, obtaining the largest possible value.
Optional
minimize?: 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
_evaluateStatic
fromConstruct a RollTerm from a provided data object
Provided data from an un-serialized term
The constructed RollTerm
Static
fromJSONReconstruct a RollTerm instance from a provided JSON string
A serialized JSON representation of a DiceTerm
A reconstructed RollTerm from the provided JSON
Static
fromConstruct a term of this type given a matched regular expression array.
The matched regular expression array
The constructed term
Static
fromConstruct a RollTerm from parser information.
The node.
Static
isDetermine if evaluating a given RollTerm with certain evaluation options can be done so deterministically.
The term.
Optional
options: { maximize?: boolean; minimize?: boolean } = {}Options for evaluating the term.
Optional
maximize?: booleanForce the result to be maximized.
Optional
minimize?: booleanForce the result to be minimized.
Static
matchDetermine whether a string expression matches a NumericTerm
The expression to parse
Protected
Static
_fromProtected
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
A type of RollTerm used to represent static numbers.