Options
All
  • Public
  • Public/Protected
  • All
Menu

A type of RollTerm used to represent strings which have not yet been matched.

Hierarchy

Index

Constructors

  • new StringTerm(__namedParameters?: { term: any; options: any }): StringTerm

Properties

term: any
options: any

An object of additional options which describes and modifies the term.

_evaluated: boolean

An internal flag for whether the term has been evaluated

isIntermediate: boolean = false

Is this term intermediate, and should be evaluated first as part of the simplification process?

SERIALIZE_ATTRIBUTES: string[] = ...

An array of additional attributes which should be retained when the term is serialized

FLAVOR_REGEXP_STRING: string = "(?:\\[([^\\]]+)\\])"

A regular expression pattern which identifies optional term-level flavor text

FLAVOR_REGEXP: RegExp = ...

A regular expression which identifies term-level flavor text

REGEXP: RegExp = undefined

A regular expression used to match a term of this type

Accessors

  • get expression(): any
  • inheritdoc

    Returns any

  • get total(): any
  • inheritdoc

    Returns any

  • get isDeterministic(): boolean
  • inheritdoc

    Returns boolean

  • get formula(): string
  • A string representation of the formula, including optional flavor text.

    Returns string

  • get flavor(): string
  • Optional flavor text which modifies and describes this term.

    Returns string

Methods

  • evaluate(options?: {}): void
  • Evaluate the term, processing its inputs and finalizing its total.

    Parameters

    • options: {} = {}

      Options which modify how the RollTerm is evaluated

      Returns void

      The evaluated RollTerm

    • toJSON(): any
    • 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.

      Returns any

    • Construct a RollTerm from a provided data object

      Parameters

      • data: any

        Provided data from an un-serialized term

      Returns RollTerm

      The constructed RollTerm

    • Reconstruct a RollTerm instance from a provided JSON string

      Parameters

      • json: string

        A serialized JSON representation of a DiceTerm

      Returns RollTerm

      A reconstructed RollTerm from the provided JSON

    • Define term-specific logic for how a de-serialized data object is restored as a functional RollTerm

      Parameters

      • data: any

        The de-serialized term data

      Returns RollTerm

      The re-constructed RollTerm object