A class adding additional functionality to Roll Rolls for d20 based Pathfinder rolls.

Hierarchy

Constructors

Properties

_formula: any
_total: any
terms: RollTerm[]
CHAT_TEMPLATE: string = "systems/pf1/templates/chat/roll-ext.hbs"

The default handlebars template used to render the roll's chat message

DIALOG_TEMPLATE: string = "systems/pf1/templates/chat/roll-dialog.hbs"

The default handlebars template used to render the roll's dialog

STATIC_ROLL: {
    TEN: number;
    TWENTY: number;
} = ...

Static roll results

Type declaration

  • TEN: number
  • TWENTY: number
standardRoll: string = "1d20"

Standard roll used by the system (1d20).

Accessors

  • get bonus(): number | void
  • Modifier on the roll besides natural roll. Undefined if the roll isn't evaluated.

    Returns number | void

  • get formula(): string
  • Return a standardized representation for the displayed formula associated with this Roll. This formula includes any bonus that might not be part of this roll's terms.

    Returns string

  • get isCrit(): boolean | void
  • Is this roll a critical success? Returns undefined if roll isn't evaluated.

    Returns boolean | void

  • get isNat1(): boolean | void
  • Is this roll a natural 1? Returns undefined if roll isn't evaluated.

    Returns boolean | void

  • get isNat20(): boolean | void
  • Is this roll a natural 20? Returns undefined if roll isn't evaluated.

    Returns boolean | void

  • get natural(): number | void
  • Natural roll value. Undefined if the roll isn't evaluated.

    Returns number | void

Methods

  • Private

    Apply the bonus the roll was created with or the user entered into the dialog.

    Returns void

  • Private

    Replace the rolled result of the active d20 (or its replacement) with a static value, and adjust the total accordingly.

    Returns void

    Remarks

    This requires the roll to be evaluated.

  • Protected

    Converts form element to object

    Parameters

    • html: HTMLFormElement

    Returns object

    • Expanded form data
  • Protected

    A callback applying the user's input from the dialog to the roll and its options.

    Parameters

    • html: HTMLElement

      The dialog's submitted HTML

    • Optional staticRoll: null | number

      A static roll result to use instead of rolling the dice

    Returns D20RollPF

    This roll

  • Render the tooltip HTML for a RollPF instance

    Returns Promise<string>

    The rendered HTML tooltip as a string

  • Render a Dialog for the user to enter additional bonuses, set a static roll result, or take 10/20.

    Parameters

    • Optional options: D20RollDialogOptions = {}

      Additional options determining what options to show in the dialog

    Returns Promise<null | D20RollPF>

    A promise that resolves when the dialog is closed

  • Transform this roll into a ChatMessage displaying the result. This function can either create a ChatMessage (by default) or return the data object that would be used to create one.

    Parameters

    • messageData: object = {}

      The data object to use when creating the message

    • options: D20RollChatOptions = {}

      Additional options which configure how the message is created

    Returns Promise<object | ChatMessage>

    The created ChatMessage document, or the object of data that would be used to create one

  • Synchronous and thrown error consuming roll evaluation.

    Parameters

    • formula: string

      Roll formula

    • rollData: object = {}

      Data supplied to roll

    • context: object

      If error occurs, this will be included in the error message.

    • Optional options: {
          suppressError: undefined | boolean;
      } = {}

      Additional options

      • suppressError: undefined | boolean

        If true, no error will be printed even if one occurs.

    • Optional evalOpts: object = {}

      Additional options to pass to Roll.evaluate()

    Returns Promise<RollPF>

    • Evaluated roll, or placeholder if error occurred.

    Remarks

    • Returned roll has .err set if an error occurred during evaluation.
    • If error occurs, the returned roll will have its formula replaced.
  • Synchronous and thrown error consuming roll evaluation.

    Parameters

    • formula: any

      Roll formula

    • rollData: {} = {}

      Data supplied to roll

      • context: any

        If error occurs, this will be included in the error message.

      • options: {
            suppressError: undefined | boolean;
        } = {}

        Additional options

        • suppressError: undefined | boolean

          If true, no error will be printed

      • evalOpts: {} = {}

        Additional options to pass to Roll.evaluate()

        Returns RollPF

        • Evaluated roll

        Remarks

        • Returned roll has .err set if an error occurred during evaluation.
        • If error occurs, the returned roll will have its formula replaced.

      Generated using TypeDoc