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

    Class SpellModel

    Basic Item model with actions and related data

    Hierarchy (View Summary)

    Index

    General

    actions?: ItemAction[]
    armorProf?: Trait<"med" | "lgt" | "hvy" | "shl" | "twr">
    attackNotes?: string[]
    atWill: boolean
    changeFlags?: Set<
        | "loseDexToAC"
        | "lowLightVision"
        | "seeInDarkness"
        | "seeInvisibility"
        | "immuneToMorale"
        | "noMediumEncumbrance"
        | "noHeavyEncumbrance"
        | "mediumArmorFullSpeed"
        | "heavyArmorFullSpeed"
        | "noAblScore.str"
        | "noAblScore.dex"
        | "noAblScore.con"
        | "noAblScore.int"
        | "noAblScore.wis"
        | "noAblScore.cha",
    >
    changes?: ItemChange[]
    classSkills?: Set<string>
    clOffset?: number
    components: {
        divineFocus?: number;
        emotion?: boolean;
        focus?: boolean;
        material?: boolean;
        somatic?: boolean;
        thought?: boolean;
        value?: string;
        verbal?: boolean;
    }
    contextNotes?: ContextNote[]
    description?: { instructions?: string; summary?: string; value?: string }
    descriptors?: Set<string>
    domain: boolean
    effectNotes?: string[]
    flags?: { boolean?: {}; dictionary?: {} }
    languages?: Set<string>
    learnedAt: {
        bloodline?: Record<string, number>;
        class?: Record<string, number>;
        domain?: Record<string, number>;
        elementalSchool?: Record<string, number>;
        subDomain?: Record<string, number>;
    }
    level?: number
    links?: { children?: LinkModel[]; supplements?: LinkModel[] }
    materials: { focus?: string; gpValue?: number; value?: string }
    parent?: ItemPF
    preparation: { max?: number; value?: number }
    school?: string
    scriptCalls?: ItemScriptCall[]
    showInCombat?: boolean

    Show item in combat tab.

    showInQuickbar?: boolean

    Display item and its actions in quick actions and token HUD.

    slOffset?: number
    slotCost?: number

    Number of slots the spell takes to prepare.

    Defaults to 1 if the data is not present, 0 if the spell is at-will.

    1

    spellbook: undefined | SpellbookModel
    spellbookId: any
    sr: boolean
    subschool?: Set<string>
    subType?: string
    tag?: string
    uses: { autoDeductChargesCost?: string }
    weaponProf?: Trait<"simple" | "martial" | "firearm" | "siege" | "heavy">
    • get activeState(): boolean

      Active state as per what setActive would correspond with.

      Returns boolean

    • get addonMaterial(): Set<string>

      The item's material addons.

      Returns Set<string>

    • get autoDeductCharges(): boolean

      Consumes are adds charges by default.

      Returns boolean

    • get baseMaterial(): null | string

      Base material

      Returns null | string

    • get canUse(): boolean

      Is this item usable at base level, disregarding per-action details.

      Returns boolean

    • get casterLevel(): null | number

      Effective caster level

      Returns null | number

      • Accounts for offset
      • Returns null if not linked to a valid spellbook.
    • get charges(): number

      Remaining charges

      Returns number

    • get effectiveLevel(): number

      Effective spell level

      Returns number

      • Accounts for offset
    • get hasFiniteCharges(): boolean

      Finite charges

      Returns boolean

    • get isActive(): boolean

      Is Active

      This returns composite result of if the item is equipped, has quantity, is not disabled, is not out of charges, etc. and is not representative if the item can be set active or not via setActive.

      Returns boolean

    • get isCharged(): boolean

      Returns boolean

    • get isPhysical(): boolean

      Is this a physical item?

      Returns boolean

    • get isProficient(): boolean

      Is the owning actor proficiency at using this as weapon.

      Returns boolean

      PF1 v10

    • get isSingleUse(): boolean

      Returns boolean

    • get maxCharges(): number

      Maximum possible charges this item can have.

      Returns number

      • Can return zero. Usually signifying something has reduced the potential uses below usability.
      • Can return infinity, signifying lack of limits.
    • get normalMaterial(): null | string

      The item's actual material.

      Returns null | string

    • get usesSpellPoints(): boolean

      Returns boolean

    • get isPhysical(): boolean

      Is this a physical item?

      Returns boolean

    • Internal Experimental

      Return active state change from data if present

      This is a hack to allow item-type agnostic active state change detection.

      Parameters

      • changed: object

      Returns boolean

    • Internal

      Handle charge update sanity checking, constraining them to reasonable values, and propagating to parent items if charges are shared.

      Parameters

      • changed: object

        Changed data

      • context: object

        Context

      Returns Promise<void>

    • Protected

      Update action limited uses

      {@inheritDoc ItemPF.recharge}

      Parameters

      • options: { exact: boolean; period?: string; rollData?: object } = {}

        Options

        • exact: boolean

          Exact time period only

        • Optionalperiod?: string

          Recharge only if matching this time period

        • OptionalrollData?: object

          Roll data

      Returns undefined | object

      • Update data or undefined if no update is needed.
    • Internal

      Parameters

      • options: any

      Returns undefined | { preparation: { value: any } }

    • Protected

      Recharges item's uses, if any.

      Parameters

      • options: {
            exact?: boolean;
            maximize?: boolean;
            period?: string;
            rollData?: object;
            value?: number;
        } = {}

        Options

        • Optionalexact?: boolean

          Match only exact time period

        • Optionalmaximize?: boolean

          Maximize instead of using recharge formula

        • Optionalperiod?: string

          Recharge only if it matches this time period

        • OptionalrollData?: object

          Roll data instance

        • Optionalvalue?: number

          Set charges to specific value

      Returns Promise<undefined | object>

      • Update data or undefined if no update is necessary.
    • Internal

      Update this item's charges based on provided item.

      Parameters

      • source: Item<"base" | ModuleSubType>

        Charge source

      Returns void

    • Add charges to the spell or its relevant resource pool (spell points or spontaneous spells).

      Parameters

      • value: number

        Number of charges to add

      • Optionaldata: object = null

        Additional data to pass to the update

      Returns Promise<void | SpellModel>

      Updated document or undefined if no update is possible or required.

    • Concentration DC

      Parameters

      • type: string = "defensive"

        Type of concentration check. See pf1.registry.Concentration.

      • Optionaloptions: object = {}

        Additional options

      Returns number

      • DC
      • If type is invalid
    • Get default charge cost for spell actions.

      Parameters

      • Optionaloptions: { rollData?: object } = {}

        Additional options

        • OptionalrollData?: object

          Roll data instance

      Returns number

      • Default cost.
    • Protected

      Called by ()

      Parameters

      • labels: object
      • Optionaloptions: { isolated?: boolean; rollData?: object } = {}

      Returns void

    • Visible item name

      Parameters

      • OptionalasPlayer: boolean = false

        If true, return value players see.

      Returns string

      • Item name
    • Parameters

      • Optional_weapon: boolean = true

        Get proficiency as a weapon. Armor otherwise.

      Returns boolean

      • Whether or not the owner of the item is proficient.
      • If item type does not support proficiency.

      PF1 v10

    • DataModel specific roll data

      Parameters

      • result: any

        Roll data

      Returns void

    • Retrieve associated spellbook

      Returns void | SpellbookModel

      • Spellbook
    • Spell components

      Parameters

      • options: { compact?: boolean } = {}

        Additional options

        • Optionalcompact?: boolean

          Remove redundant components (e.g. M/DF becomes DF for divine caster)

      Returns string[]

      • Component keys

      Example with Discern Lies on Cleric

      spell.system.getSpellComponents(); // => ["V", "S", "M/DF"]
      

      Same with compacted components

      spell.system.getSpellComponents({compact:true}); // => ["V","S", "DF"]
      
    • Number of remaining uses, or max.

      Parameters

      • max: boolean = false

        Return max uses.

      Returns number

      • Uses
    • Prepare data dependent on other items

      Called in actor.prepareDerivedData() when all items are guaranteed to be prepared.

      Parameters

      • final: boolean = false

      Returns void

    • Recharges item's uses, if any.

      Parameters

      • options: {} = {}

        Options

      Returns Promise<
          | Item<"base" | ModuleSubType>
          | { system: { actions: any; preparation: undefined | { value: any } } },
      >

      • Promise for the update, update data object, or undefined (no update needed).
    • Set item's active state.

      Parameters

      • active: boolean

        Active state

      • Optionalcontext: object

        Optional update context

      Returns Promise<SpellModel>

      • Update promise if item type supports the operation.
      • If item does not support the operation.
    • Adjust temporary item before creation

      Parameters

      • item: any

        Temporary document

      • data: any

        Creation data

      • override: boolean = false

        Override values even if defined

      Returns void

    • Internal

      Used in consumable creation

      Parameters

      • string: string

        String to convert

      • rollData: object

        Roll data instance

      Returns string

      • Converted string
    • Get the price of a consumable given the spell level and caster level.

      Parameters

      • itemData: object

        Spell item data.

      • type: "spell" | "potion" | "scroll" | "wand"

        Consumable type.

      • Optionaloverrides: { cl?: number; sl?: number; uses?: number } = {}

        Data overrides

        • Optionalcl?: number

          Caster level

        • Optionalsl?: number

          Spell level

        • Optionaluses?: number

          Number of uses (for wands)

      Returns undefined | number

      • Price in GP, or undefined if type is invalid.
    • Parameters

      • itemData: object

        A spell item's data.

      Returns [number, number]

      • A tuple containing the spell level and caster level in order.
    • Parent datamodel (item document) migration

      AVOID USING THIS

      Parameters

      • _source: object

        Document source data

      Returns void

    • Parameters

      • source: any

      Returns void

    • Convert spell into a consumable item.

      Parameters

      • origData: any

        Spell item data or spell item document

      • type: "potion" | "scroll" | "wand"

        Consumable type

      • Optionaloptions: {
            cl?: number;
            identified?: boolean;
            item: any;
            sl?: number;
            spellType?: string;
            unidentifiedName?: string;
            uses?: number;
        } = {}

        Options & overrides

        • Optionalcl?: number

          Caster level

        • Optionalidentified?: boolean
        • item: any
        • Optionalsl?: number

          Spell level

        • OptionalspellType?: string

          Spell type

        • OptionalunidentifiedName?: string
        • Optionaluses?: number

      Returns Promise<null | object>

      • Item data for appropriate consumable, or null if dialog option was used and it was cancelled.
    • Open Consumable conversion dialog.

      Automatically calls () as appropriate.

      Parameters

      • itemData: any

        Spell item data or spell item

      • Optionaloptions: {
            actor?: object;
            allowSpell?: boolean;
            identified?: boolean;
            item?: ItemPF;
            spellType?: string;
        } = {}

        Additional options

        • Optionalactor?: object

          The actor the consumable is being created on.

        • OptionalallowSpell?: boolean

          Allow spell creation

        • Optionalidentified?: boolean

          Initial identified state

        • Optionalitem?: ItemPF

          Source item document

        • OptionalspellType?: string

          Spell type

      Returns Promise<null | false | object>

      • Returns null if cancelled, false if no conversion is to take place (spell chosen), or converted data.

    Document

    metadata: Readonly<
        {
            classAssociation: false;
            isPhysical: false;
            label: "CONFIG.Item.typeLabels.spell";
            type: "spell";
        },
    > = ...