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

    err?: Error
    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 action(): void | SubAction

      The action associated with this roll if any.

      Returns void | SubAction

    • get bonus(): number | void

      Modifier on the roll besides natural roll. Undefined if the roll isn't evaluated.

      Returns number | void

    • get d20(): Die

      The D20 die this roll is based on.

      Returns Die

    • get dc(): undefined | number

      Difficulty Class

      Returns undefined | number

    • get flavor(): string

      The flavor this roll was created with.

      Returns string

    • get isAbnormal(): boolean

      Returns boolean

    • get isCheck(): boolean

      Is this a proper check?

      Returns boolean

    • 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 isManual(): boolean

      Returns boolean

    • get isMisfire(): boolean | void

      Is this roll a misfire.

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

      Is not an actual roll.

      Returns boolean

    • get isNormal(): boolean

      Is a normal d20

      Returns boolean

    • get isStatic(): boolean

      Is static roll (e.g. Take 20)

      Returns boolean

    • 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.
    • get defaultOptions(): Partial<D20RollOptions>

      Default options for D20Rolls

      Returns Partial<D20RollOptions>

    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

    • Parameters

      • options: any

      Returns Promise<D20RollPF>

    • Parameters

      • options: any

      Returns D20RollPF

    • Protected

      Converts form element to object

      Parameters

      • html: HTMLFormElement
      • Optionald20: string

        d20 override

      Returns object

      • Expanded form data
    • Protected

      Process user's input from the dialog and apply it to the roll and its options.

      Parameters

      • formData: object

        Form data

      Returns void

    • Protected

      Reset base check

      Returns void

    • Internal

      Parameters

      • bonus: string

      Returns void

    • 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

      • Optionaloptions: D20RollDialogOptions = {}

        Additional options determining what options to show in the dialog

      Returns Promise<null | object>

      • A promise that resolves when the dialog is closed, representing dialog data, or null if cancelled
    • Parameters

      • options: any

      Returns Promise<null | object>

      Use prompt instead

    • 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

    • Parameters

      • flavor: any

      Returns any

    • Parameters

      • term: any

      Returns any

    • 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.