Pathfinder 1e for Foundry VTT
    Preparing search index...

    Class D20RollPF

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

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    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

    standardRoll: "1d20"

    Standard roll used by the system (1d20).

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

    Static roll results

    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 isFailure(): undefined | boolean

      Is this roll a failure against its DC?

      Returns undefined | boolean

      • Returns undefined if no DC is known or if the roll is not evaluated yet.
    • 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 isSuccess(): undefined | boolean

      Is this roll a success against its DC?

      Returns undefined | boolean

      • Returns undefined if no DC is known or if the roll is not evaluated yet.
    • get natural(): number | void

      Natural roll value. Undefined if the roll isn't evaluated.

      Returns number | void

    • get offset(): number

      DC offset

      Returns number

      • Returns NaN if no DC is defined.
      • Returns NaN if the roll has not been evaluated.
    • get overBy5(): number

      How many 5s over the DC is this?

      Primarily meant for things like Heal check bonus healing or similar.

      Returns number

      • Returns NaN if no DC is defined.

    Methods

    • Protected

      Apply static roll, such as Take 10/20

      Parameters

      • Optionalforce: boolean = false

        Ignore evaluated state of the roll and apply static roll config anyway.

      Returns void

    • 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

      • app: DialogV2<EmptyObject, Configuration<any>, RenderOptions>
      • button: HTMLElement

        Button

      • OptionalstaticRoll: null | number

        A static roll result to use instead of rolling the dice

      Returns D20RollPF

      This roll

    • Render a Roll instance to HTML

      Parameters

      • Optionaloptions: { flavor?: string; isPrivate?: boolean; template?: string } = {}

        Options which affect how the Roll is rendered

        • Optionalflavor?: string

          Flavor text to include

        • OptionalisPrivate?: boolean

          Is the Roll displayed privately?

        • Optionaltemplate?: string

          A custom HTML template path

      Returns Promise<string>

      • The rendered HTML template as a string Synced with Foundry v12.331
    • 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<"base" | ModuleSubType>>

      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.

      • Optionaloptions: { suppressError?: boolean } = {}

        Additional options

        • OptionalsuppressError?: boolean

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

      • OptionalevalOpts: object = {}

        Additional options to pass to Roll.evaluate()

      Returns Promise<RollPF>

      • Evaluated roll, or placeholder if error occurred.
      • 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: string

        Roll formula

      • OptionalrollData: object = {}

        Data supplied to roll

      • Optionalcontext: any

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

      • Optionaloptions: { suppressError?: boolean } = {}

        Additional options

        • OptionalsuppressError?: boolean

          If true, no error will be printed

      • OptionalevalOpts: object = {}

        Additional options to pass to Roll.evaluate()

      Returns RollPF

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