Extend the base Actor class to implement additional game system logic.

Hierarchy

Constructors

Properties

Accessors

Methods

_applyArmorPenalties _calcBuffActiveEffects _calculateCoinWeight _computeEncumbrance _generateSpellbookCache _getInherentTotalsKeys _onCreateEmbeddedDocuments _onUpdate _onUpdateEmbeddedDocuments _preCreate _preUpdate _prepareArmorData _prepareChanges _prepareClassSkills _prepareContainerItems _prepareItemFlags _resetInherentTotals _restingHeal _setSourceDetails _syncTokenImage _updateSpellBook applyActiveEffects applyDamage convertCurrency createAttackFromWeapon createEmbeddedDocuments createSpellbook deleteEmbeddedDocuments displayDefenseCard expireActiveEffects formatContextNotes getCarriedWeight getCarryCapacity getContextNotes getContextNotesParsed getDefenseHeaders getFeatCount getInitiativeContextNotes getItemByTag getLabels getLevelExp getQuickActions getRollData getSkillInfo getTotalCurrency getWoundThresholdData getWoundThresholdMultiplier hasArmorProficiency hasCondition hasItemBooleanFlag importFromJSON mergeCurrency modifyTokenAttribute performRest preCreateData prepareBaseData prepareCMB prepareDerivedData prepareItemLinks prepareProficiencies prepareSpecificDerivedData rechargeItems refreshAbilityModifiers refreshDerivedData resetSpellbookUsage rollAbilityTest rollAttack rollBAB rollCL rollCMB rollConcentration rollInitiative rollSavingThrow rollSkill setCondition toggleCondition toggleConditionStatusIcons updateItemResources updateSpellbookInfo updateWoundThreshold _getChangeItemSubtype _onChatCardButtonAction _translateSourceInfo applyDamage chatListeners getActiveActor getReach getReducedMovementSpeed getSelectedActors getSpellSlotIncrease

Constructors

Properties

_initialized: undefined | boolean
_itemTypes: any

Cached result of .itemTypes

_race: undefined | null | ItemRacePF
_rollData: object

Cached roll data for this item.

_runningFunctions: any

Keeps track of currently running async functions that shouldn't run multiple times simultaneously.

_states: object

Tracks various states which need to be tracked.

changeFlags: undefined | {}

Type declaration

    changeItems: ItemPF[]

    A list of all the active items with changes.

    changes: Collection<ItemChange>

    Stores all ItemChanges from carried items.

    classes: undefined | {}

    Type declaration

      containerItems: ItemPF[]

      All items this actor is holding in containers.

      equipment: undefined | {
          armor: {
              id: undefined;
              type: number;
          };
          shield: {
              id: undefined;
              type: number;
          };
      }

      Type declaration

      • armor: {
            id: undefined;
            type: number;
        }
        • id: undefined
        • type: number
      • shield: {
            id: undefined;
            type: number;
        }
        • id: undefined
        • type: number
      itemFlags: {
          boolean: {};
          dictionary: {};
      }

      Init item flags.

      Type declaration

      • boolean: {}
        • dictionary: {}
          sourceDetails: undefined | {
              system.attributes.bab.total: any[];
          }

          Type declaration

          • system.attributes.bab.total: any[]
          sourceInfo: undefined | {}

          Type declaration

            Accessors

            • get allNotes(): {
                  item: ItemPF;
                  notes: {
                      subTarget: string;
                      text: string;
                  }[];
              }[]
            • An array of all context note data for this actor.

              Returns {
                  item: ItemPF;
                  notes: {
                      subTarget: string;
                      text: string;
                  }[];
              }[]

            Methods

            • Collect some basic spellbook info so it doesn't need to be gathered again for each spellbook.

              Returns object

              Spellbook cache

            • Returns {
                  abilities.cha.checkMod: number;
                  abilities.con.checkMod: number;
                  abilities.dex.checkMod: number;
                  abilities.int.checkMod: number;
                  abilities.str.checkMod: number;
                  abilities.wis.checkMod: number;
                  ac.natural.base: number;
                  ac.natural.enh: number;
                  ac.natural.misc: number;
                  ac.natural.total: number;
                  ac.normal.base: number;
                  ac.normal.enh: number;
                  ac.normal.misc: number;
                  ac.normal.total: number;
                  ac.shield.base: number;
                  ac.shield.enh: number;
                  ac.shield.misc: number;
                  ac.shield.total: number;
                  attributes.ac.flatFooted.total: number;
                  attributes.ac.normal.total: number;
                  attributes.ac.touch.total: number;
                  attributes.acp.armorBonus: number;
                  attributes.acp.attackPenalty: number;
                  attributes.acp.encumbrance: number;
                  attributes.acp.gear: number;
                  attributes.acp.shieldBonus: number;
                  attributes.acp.total: number;
                  attributes.attack.critConfirm: number;
                  attributes.attack.general: number;
                  attributes.attack.melee: number;
                  attributes.attack.ranged: number;
                  attributes.bab.total: number;
                  attributes.bab.value: number;
                  attributes.cmb.bonus: number;
                  attributes.cmb.total: number;
                  attributes.cmb.value: number;
                  attributes.cmd.flatFootedTotal: number;
                  attributes.cmd.total: number;
                  attributes.damage.general: number;
                  attributes.damage.shared: number;
                  attributes.damage.spell: number;
                  attributes.damage.weapon: number;
                  attributes.hp.max: any;
                  attributes.init.bonus: number;
                  attributes.init.total: number;
                  attributes.mDex: {
                      armorBonus: number;
                      shieldBonus: number;
                  };
                  attributes.maxDexBonus: null;
                  attributes.spells.spellbooks.primary.cl.total: number;
                  attributes.spells.spellbooks.primary.concentration.total: number;
                  attributes.spells.spellbooks.secondary.cl.total: number;
                  attributes.spells.spellbooks.secondary.concentration.total: number;
                  attributes.spells.spellbooks.spelllike.cl.total: number;
                  attributes.spells.spellbooks.spelllike.concentration.total: number;
                  attributes.spells.spellbooks.tertiary.cl.total: number;
                  attributes.spells.spellbooks.tertiary.concentration.total: number;
                  attributes.sr.total: number;
                  attributes.vigor.max: any;
                  attributes.woundThresholds.level: number;
                  attributes.woundThresholds.mod: number;
                  attributes.woundThresholds.override: number;
                  attributes.woundThresholds.penalty: number;
                  attributes.woundThresholds.penaltyBase: number;
                  attributes.wounds.max: any;
                  details.carryCapacity.bonus.total: number;
                  details.carryCapacity.multiplier.total: number;
              }

              • abilities.cha.checkMod: number
              • abilities.con.checkMod: number
              • abilities.dex.checkMod: number
              • abilities.int.checkMod: number
              • abilities.str.checkMod: number
              • abilities.wis.checkMod: number
              • ac.natural.base: number
              • ac.natural.enh: number
              • ac.natural.misc: number
              • ac.natural.total: number
              • ac.normal.base: number
              • ac.normal.enh: number
              • ac.normal.misc: number
              • ac.normal.total: number
              • ac.shield.base: number
              • ac.shield.enh: number
              • ac.shield.misc: number
              • ac.shield.total: number
              • attributes.ac.flatFooted.total: number
              • attributes.ac.normal.total: number
              • attributes.ac.touch.total: number
              • attributes.acp.armorBonus: number
              • attributes.acp.attackPenalty: number
              • attributes.acp.encumbrance: number
              • attributes.acp.gear: number
              • attributes.acp.shieldBonus: number
              • attributes.acp.total: number
              • attributes.attack.critConfirm: number
              • attributes.attack.general: number
              • attributes.attack.melee: number
              • attributes.attack.ranged: number
              • attributes.bab.total: number
              • attributes.bab.value: number
              • attributes.cmb.bonus: number
              • attributes.cmb.total: number
              • attributes.cmb.value: number
              • attributes.cmd.flatFootedTotal: number
              • attributes.cmd.total: number
              • attributes.damage.general: number
              • attributes.damage.shared: number
              • attributes.damage.spell: number
              • attributes.damage.weapon: number
              • attributes.hp.max: any
              • attributes.init.bonus: number
              • attributes.init.total: number
              • attributes.mDex: {
                    armorBonus: number;
                    shieldBonus: number;
                }
                • armorBonus: number
                • shieldBonus: number
              • attributes.maxDexBonus: null
              • attributes.spells.spellbooks.primary.cl.total: number
              • attributes.spells.spellbooks.primary.concentration.total: number
              • attributes.spells.spellbooks.secondary.cl.total: number
              • attributes.spells.spellbooks.secondary.concentration.total: number
              • attributes.spells.spellbooks.spelllike.cl.total: number
              • attributes.spells.spellbooks.spelllike.concentration.total: number
              • attributes.spells.spellbooks.tertiary.cl.total: number
              • attributes.spells.spellbooks.tertiary.concentration.total: number
              • attributes.sr.total: number
              • attributes.vigor.max: any
              • attributes.woundThresholds.level: number
              • attributes.woundThresholds.mod: number
              • attributes.woundThresholds.override: number
              • attributes.woundThresholds.penalty: number
              • attributes.woundThresholds.penaltyBase: number
              • attributes.wounds.max: any
              • details.carryCapacity.bonus.total: number
              • details.carryCapacity.multiplier.total: number
            • Parameters

              • embeddedName: "Item" | "ActiveEffect"
              • documents: ActiveEffect[] | Item[]
              • result: any
              • options: any
              • userId: string
              • Rest ...args: any[]

              Returns void

            • Parameters

              • embeddedName: "Item" | "ActiveEffect"
              • documents: ActiveEffect[] | Item[]
              • result: any
              • context: object
              • userId: string

              Returns void

            • Parameters

              • data: object
              • context: object
              • user: User

              Returns Promise<void>

            • Parameters

              • changed: object
              • context: object
              • user: User

              Returns Promise<void>

            • Private

              Prepare armor/shield data for roll data

              Parameters

              • equipment: {
                    id: string;
                    type: string;
                } = {}

                Equipment info

                • id: string

                  Item ID

                • type: string

                  Armor/Shield type

              • armorData: object

                Armor data object

              Returns void

            • Handler for character healing during rest.

              Parameters

              • options: object = {}

                Resting options.

              Returns object

              Update data object

            • Update specific spellbook.

              Parameters

              • bookId: string

                Spellbook identifier

              • Optional rollData: object

                Roll data instance

              • cache: object

                Pre-calculated data for re-use from _generateSpellbookCache

              Returns void

            • Wrapper for the static function, taking this actor as the only target.

              Parameters

              • value: number

                Value to adjust health by.

              • options: object = {}

                Additional options.

              Returns Promise<any>

            • Converts currencies of the given category to the given currency type

              Parameters

              • category: string = "currency"

                Either 'currency' or 'altCurrency'.

              • type: string = "pp"

                Either 'pp', 'gp', 'sp' or 'cp'. Converts as much currency as possible to this type.

              Returns undefined | Promise<ActorPF>

              Updated document or undefined if no update occurred.

            • Parameters

              • embeddedName: any
              • createData: any
              • options: {} = {}

                Returns Promise<StoredDocument<Document<any, ActorPF, Metadata<any>>>[]>

              • Enable and configure a new spellbook.

                Parameters

                • Optional casting: {
                      ability: undefined | string;
                      cantrips: undefined | boolean;
                      class: undefined | string;
                      domainSlots: undefined | number;
                      progression: undefined | "low" | "high" | "med";
                      spells: undefined | "arcane" | "divine" | "psychic" | "alchemy";
                      type: undefined | "prepared" | "spontaneous" | "hybrid";
                  } = {}

                  Book casting configuration

                  • ability: undefined | string

                    Spellcasting ability score ID

                  • cantrips: undefined | boolean

                    Has cantrips?

                  • class: undefined | string

                    Class tag

                  • domainSlots: undefined | number

                    Number of domain slots.

                  • progression: undefined | "low" | "high" | "med"

                    Casting progression type

                  • spells: undefined | "arcane" | "divine" | "psychic" | "alchemy"

                    Spell/spellcasting type

                  • type: undefined | "prepared" | "spontaneous" | "hybrid"

                    Spellbook type

                Returns Promise<ActorPF>

                Promise to updated document

              • Parameters

                • embeddedName: any
                • data: any
                • options: {} = {}

                  Returns Promise<void>

                • Show defenses in chat

                  Parameters

                  • Optional options: {
                        rollMode: undefined | null | string;
                        token: undefined | TokenDocument;
                    } = {}

                    Additional options

                    • rollMode: undefined | null | string

                      The roll mode to use for the roll; defaults to the user's current preference when null.

                    • token: undefined | TokenDocument

                      Relevant token if any.

                  Returns Promise<undefined>

                • Deletes expired temporary active effects and disables linked expired buffs.

                  Parameters

                  • Optional options: {
                        combat: undefined | Combat;
                        timeOffset: undefined | number;
                    } = {}

                    Additional options

                    • combat: undefined | Combat

                      Combat to expire data in, if relevant

                    • timeOffset: undefined | number

                      Time offset from world time

                  • Optional context: DocumentModificationContext = {}

                    Document update context

                  Returns Promise<void>

                • Parameters

                  • notes: any
                  • rollData: any
                  • __namedParameters: {
                        roll: undefined | boolean;
                    } = {}
                    • roll: undefined | boolean

                  Returns any[]

                • Returns {
                      heavy: number;
                      light: number;
                      medium: number;
                  }

                  • heavy: number
                  • light: number
                  • medium: number
                • Generates an array with all the active context-sensitive notes for the given context on this actor.

                  Parameters

                  • context: string | SafeString

                    The context to draw from.

                  Returns {
                      item: ItemPF;
                      notes: {
                          subTarget: string;
                          text: string;
                      }[];
                  }[]

                • Returns a list of already parsed context notes.

                  Parameters

                  • context: string

                    The context to draw notes from.

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

                    Additional options

                    • roll: undefined | boolean

                      Whether to roll inline rolls or not.

                  Returns string[]

                  The resulting notes, already parsed.

                • Parameters

                  • Optional options: {
                        damageResistances: undefined | boolean;
                        damageVulnerabilities: undefined | boolean;
                    } = {}

                    Additional options

                    • damageResistances: undefined | boolean

                      If false, damage resistances (DR, ER) are omitted.

                    • damageVulnerabilities: undefined | boolean

                      If false, damage vulnerabilities are omitted.

                  Returns {
                      header: string;
                      value: any;
                  }[]

                • Return the amount of experience required to gain a certain character level.

                  Parameters

                  • level: number

                    The desired level

                  Returns number

                  The XP required

                  Abstract

                • Returns {
                      isSingleUse: boolean;
                      item: ItemPF;
                      maxCharge: any;
                      get charges(): any;
                      get haveAnyCharges(): boolean;
                  }[]

                • Parameters

                  • skillId: any
                  • __namedParameters: {
                        rollData: any;
                    } = {}
                    • rollData: any

                  Returns any

                • Parameters

                  • category: string = "currency"
                  • __namedParameters: {
                        inLowestDenomination: undefined | boolean;
                    } = {}
                    • inLowestDenomination: undefined | boolean

                  Returns any

                • Returns Wound Threshold relevant data.

                  Parameters

                  • data: object = null

                    Provided valid rollData

                  Returns {
                      level: number;
                      multiplier: number;
                      penalty: number;
                      valid: boolean;
                  }

                  • level: number
                  • multiplier: number
                  • penalty: number
                  • valid: boolean
                • Returns effective Wound Threshold multiplier with rules and overrides applied.

                  Parameters

                  • Optional data: object = null

                  Returns number

                  Multiplier

                • Checks if there's any matching proficiency

                  Parameters

                  • item: ItemPF

                    The item to check for.

                  • proficiencyName: string

                    The proficiency name to look for. e.g. 'lightShield' or 'mediumArmor'.

                  Returns boolean

                  Whether the actor is proficient with that item.

                • Easy way to determine whether this actor has a condition.

                  Parameters

                  • conditionId: string

                    Condition identifier, as per PF1.conditions, such as shaken or dazed.

                  Returns boolean

                  Confirmation as boolean.

                • Parameters

                  • flagName: string

                    The name/key of the flag to search for.

                  Returns boolean

                  Whether this actor has any owned item with the given flag.

                • Parameters

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

                    Additional options

                    • inLowestDenomination: undefined | boolean

                      Use copper for calculations and return.

                  Returns number

                  The total amount of currency this actor has, in gold pieces.

                • Parameters

                  • attribute: any
                  • value: any
                  • isDelta: boolean = false
                  • isBar: boolean = true

                  Returns Promise<undefined | ActorPF>

                • Meant to be overridden.

                  Parameters

                  • data: any
                  • options: any
                  • userId: any

                  Returns object

                  Update data to replace with.

                  Abstract

                • Parameters

                  • Optional options: {
                        commit: undefined | boolean;
                        updateData: undefined | object;
                    } = {}

                    Additional options

                    • commit: undefined | boolean

                      If false, return update data object instead of directly updating the actor.

                    • updateData: undefined | object

                      Update data to complement or read changed values from.

                  Returns Promise<object[] | Item[]>

                  Result of an update or the update data.

                • Called just before the first change is applied, and after every change is applied. Sets additional variables (such as spellbook range)

                  Returns void

                • Restore spellbook used slots and spellpoints.

                  Parameters

                  • Optional options: {
                        commit: undefined | boolean;
                        rollData: undefined | object;
                    } = {}

                    Additional options

                    • commit: undefined | boolean

                      If false, return update data object instead of directly updating the actor.

                    • rollData: undefined | object

                      Roll data

                  Returns Promise<object | ActorPF>

                  Result of update or the update data.

                • Roll an Ability Test Prompt the user for input regarding Advantage/Disadvantage and any Situational Bonus

                  Parameters

                  • abilityId: string

                    The ability ID (e.g. "str")

                  • Optional options: object = {}

                    Options which configure how ability tests are rolled

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll a generic attack

                  Parameters

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll a 1d20 adding the actor's BAB

                  Parameters

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll a Caster Level check using a particular spellbook of this actor

                  Parameters

                  • bookId: string

                    Spellbook identifier

                  • Optional options: ActorRollOptions = {}

                    Roll options

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll a basic CMB check for this actor

                  Parameters

                  • Optional options: ActorRollOptions & {
                        ability: null | string;
                        ranged: boolean;
                    } = {}

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll a concentration check using a particular spellbook of this actor

                  Parameters

                  • bookId: string

                    Spellbook identifier

                  • Optional options: ActorRollOptions = {}

                    Roll options

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll initiative for one or multiple Combatants associated with this actor. If no combat exists, GMs have the option to create one. If viewing a full Actor document, all Tokens which map to that actor will be targeted for initiative rolls. If viewing a synthetic Token actor, only that particular Token will be targeted for an initiative roll.

                  Parameters

                  • Optional options: {
                        bonus: undefined | null | string;
                        createCombatants: undefined | boolean;
                        dice: undefined | null | string;
                        rerollInitiative: undefined | boolean;
                        rollMode: undefined | string;
                        skipDialog: undefined | boolean;
                        token: undefined | TokenDocumentPF;
                    } = {}

                    Options which configure how initiative is rolled

                    • bonus: undefined | null | string

                      Formula for bonus to initiative

                    • createCombatants: undefined | boolean

                      Create new Combatant entries for tokens associated with this actor.

                    • dice: undefined | null | string

                      Formula override for dice to roll

                    • rerollInitiative: undefined | boolean

                      Reroll initiative for existing Combatants

                    • rollMode: undefined | string

                      Roll mode override

                    • skipDialog: undefined | boolean

                      Skip roll dialog

                    • token: undefined | TokenDocumentPF

                      For which token this initiative roll is for

                  Returns Promise<null | CombatPF>

                  The updated Combat document in which initiative was rolled, or null if no initiative was rolled

                • Roll a specific saving throw

                  Parameters

                  • savingThrowId: "fort" | "ref" | "will"

                    Identifier for saving throw type.

                  • Optional options: ActorRollOptions = {}

                    Roll options.

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Roll a Skill Check

                  Parameters

                  • skillId: string

                    The skill id (e.g. "per", or "prf.subSkills.prf1")

                  • Optional options: ActorRollOptions = {}

                    Options which configure how the skill check is rolled

                  Returns void | object | ChatMessage

                  The chat message if one was created, or its data if not. void if the roll was cancelled.

                • Easy way to set a condition.

                  Parameters

                  • key: string

                    A direct condition key, as per PF1.conditions, such as shaken or dazed.

                  • enabled: boolean

                    Whether to enable (true) the condition, or disable (false) it.

                  Returns Promise<void>

                • Easy way to toggle a condition.

                  Parameters

                  • conditionId: string

                    A direct condition identiifer, as per PF1.conditions, such as shaken or dazed.

                  Returns undefined | Promise<ActorPF>

                  Promise to updated document, or nothing if no update occurs.

                • Parameters

                  • item: ItemPF

                    the item to add to the actor's resources

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

                    extra options

                    • warnOnDuplicate: undefined | boolean

                      Skips warning if item tag already exists in dictionary flags

                  Returns boolean

                  True if resources were set

                • Update all spellbooks

                  Parameters

                  • Optional rollData: object

                    Roll data instance

                  • Optional cache: object

                    Spellbook cache

                  Returns void

                • Apply rolled dice damage to the token or tokens which are currently controlled. This allows for damage to be scaled by a multiplier to account for healing, critical hits, or resistance If Shift is held, will prompt for adjustments based on damage reduction and energy resistances

                  Parameters

                  • value: number

                    The amount of damage to deal.

                  • Optional options: {
                        asNonlethal: undefined | boolean;
                        asWounds: boolean;
                        critMult: number;
                        forceDialog: undefined | boolean;
                        reductionDefault: undefined | string;
                        targets: undefined | (Actor | Token)[];
                    } = {}

                    Object containing default settings for overriding

                    • asNonlethal: undefined | boolean

                      Marks the damage as non-lethal

                    • asWounds: boolean

                      Apply damage to wounds directly instead of vigor, as needed for Wounds & Vigor variant health rule.

                    • critMult: number

                      Critical multiplier as needed for Wounds & Vigor variant health rule. Set to 0 for non-critical hits.

                    • forceDialog: undefined | boolean

                      Forces the opening of a Dialog as if Shift was pressed

                    • reductionDefault: undefined | string

                      Default value for Damage Reduction

                    • targets: undefined | (Actor | Token)[]

                      Override the targets to apply damage to

                  Returns Promise<any>

                • Parameters

                  • root0: {
                        actorId: undefined | null;
                        actorName: undefined | null;
                    } = {}
                    • actorId: undefined | null
                    • actorName: undefined | null

                  Returns undefined | ActorPF

                  Deprecated

                • Parameters

                  • size: string = "med"
                  • stature: string = "tall"

                  Returns {
                      melee: number;
                      reach: number;
                  }

                  • melee: number
                  • reach: number
                • Return reduced movement speed.

                  Parameters

                  • value: number

                    The non-reduced movement speed.

                  Returns number

                  The reduced movement speed.

                • Return increased amount of spell slots by ability score modifier.

                  Parameters

                  • mod: number

                    The associated ability modifier.

                  • level: number

                    Spell level.

                  Returns number

                  Amount of spell levels to increase.

                Generated using TypeDoc