The original provided string term used to construct the parenthetical
An already-evaluated Roll instance used instead of the string term.
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.
Internal
_rootA reference to the Roll at the root of the evaluation tree.
Static
OPEN_The regular expression pattern used to identify the opening of a parenthetical expression. This could also identify the opening of a math function.
Static
CLOSE_A regular expression pattern used to identify the closing of a parenthetical expression.
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
Static
REGEXPA regular expression used to match a term of this type
An array of evaluated DiceTerm instances that should be bubbled up to the parent Roll
A string or numeric representation of the final output for this term, after evaluation.
A string representation of the formula expression for this RollTerm, prior to evaluation.
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.
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
_evaluateStatic
fromConstruct 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
Optional
options: objectAdditional options passed to the ParentheticalTerm constructor
The constructed ParentheticalTerm instance
const d6 = new Die({number: 4, faces: 6});
const plus = new OperatorTerm({operator: "+"});
const bonus = new NumericTerm({number: 4});
t = ParentheticalTerm.fromTerms([d6, plus, bonus]);
t.formula; // (4d6 + 4)
Static
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
fromJSONStatic
Protected
_from
A type of RollTerm used to enclose a parenthetical expression to be recursively evaluated.