@dice-roller/rpg-dice-roller / RollSettings
Class: RollSettings<T>
Defined in: src/RollSettings.ts:44
Resolved RollOptions, with the services built from them.
Shared by a Roller and its rolls, and by a roll and its re-rolls, so the generator, registries, parser and evaluator are only created once. It can also be created once and passed to many standalone rolls: new Roll("4d6", settings).
Type Parameters
T
T = string
the output type of the presenter
Constructors
Constructor
new RollSettings<
T>(options?):RollSettings<T>
Defined in: src/RollSettings.ts:54
Resolves options and validates limits; supplied registries and presenter are shared by reference.
Parameters
options?
RollOptions<T> = {}
Returns
RollSettings<T>
Properties
dice
readonlydice:DieRegistry
Defined in: src/RollSettings.ts:46
evaluator
readonlyevaluator:Evaluator
Defined in: src/RollSettings.ts:51
generator
readonlygenerator:NumberGenerator
Defined in: src/RollSettings.ts:45
limits
readonlylimits:RollLimits
Defined in: src/RollSettings.ts:48
modifiers
readonlymodifiers:ModifierRegistry
Defined in: src/RollSettings.ts:47
parser
readonlyparser:Parser
Defined in: src/RollSettings.ts:50
presenter
readonlypresenter:Presenter<T>
Defined in: src/RollSettings.ts:49
Methods
evaluate()
evaluate(
expression,mode?):ExpressionResult
Defined in: src/RollSettings.ts:86
Evaluates the AST in the given mode (default random); min and max select each die's extreme.
Parameters
expression
mode?
RollMode = "random"
Returns
parse()
parse(
notation):ExpressionNode
Defined in: src/RollSettings.ts:81
Parses notation into the AST, without rolling.
Parameters
notation
string
Returns
from()
staticfrom<T>(options?):RollSettings<T>
Defined in: src/RollSettings.ts:70
Returns settings as they are, or creates settings from options (undefined: fresh defaults).
Type Parameters
T
T = string
Parameters
options?
RollOptions<T> | RollSettings<T>
Returns
RollSettings<T>