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

Hierarchy

Constructors

Properties

Accessors

Methods

_applyArmorPenalties _calculateCoinWeight _cleanItemLinksTo _computeEncumbrance _conditionToggleNotify _configure _generateSpellbookCache _getBaseValueFillKeys _getInherentTotalsKeys _handleConditionTracks _initialize _onCreateDescendantDocuments _onDeleteDescendantDocuments _onUpdate _preCreate _preUpdate _prepareArmorData _prepareChanges _prepareClassSkills _prepareContainerItems _prepareItemFlags _prepareNaturalReach _prepareOverlandSpeeds _prepareSenses _prepareTypeChanges _resetInherentTotals _restingHeal _setSourceDetails _updateSpellBook addTempHP applyActiveEffects applyDamage convertCurrency createSpellbook displayDefenseCard enrichContextNotes expireActiveEffects getCarriedWeight getCarryCapacity getCombatants getConditionImmunities getContextNotes getContextNotesParsed getCurrency getDefenseHeaders getFeatCount getInitiativeContextNotes getItemByTag getLabels getLevelExp getQuickActions getRollData getSkillInfo getTokenDocument getTotalCurrency getWoundThresholdData getWoundThresholdMultiplier hasArmorProficiency hasCondition hasItemBooleanFlag hasWeaponProficiency modifyTokenAttribute parseResistances performRest preCreateData prepareBaseData prepareCMB prepareConditions prepareDerivedData prepareHealth prepareItemLinks prepareProficiencies prepareSpecificDerivedData rechargeItems refreshAbilityModifiers refreshDerivedData reset resetSpellbookUsage rollAbilityTest rollAttack rollBAB rollCL rollConcentration rollInitiative rollSavingThrow rollSkill setCondition setConditions toggleCondition toggleStatusEffect updateItemResources updateSpellbookInfo updateTokenSize updateVision updateWoundThreshold _getSourceLabel _onChatCardButtonAction applyDamage chatListeners getDefaultArtwork getReach getReducedMovementSpeed getSpellSlotIncrease

Constructors

  • Parameters

    • data: undefined | ActorDataConstructorData

      Initial data provided to construct the Actor document

    • Optional context: Context<TokenDocument>

      The document context, see foundry.abstract.Document

    Returns ActorVehiclePF

Properties

_initialized: undefined | boolean
_itemTypes: ItemTypesMap

Cached result of .itemTypes

_rollData: any
changeFlags: undefined | {}

Type declaration

    changes: undefined | Collection<any>
    classes: undefined | {}

    Type declaration

      containerItems: undefined | any[]
      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
      sourceDetails: undefined | {
          system.attributes.bab.total: any[];
      }

      Type declaration

      • system.attributes.bab.total: any[]
      sourceInfo: undefined | Record<string, SourceInfo>

      Accessors

      Methods

      • Internal

        Returns {
            attributes.hp.max: any;
            details.carryCapacity.bonus.total: number;
            details.carryCapacity.multiplier.total: number;
        }

        • attributes.hp.max: any
        • details.carryCapacity.bonus.total: number
        • details.carryCapacity.multiplier.total: number
      • Internal

        Parameters

        • parent: Actor | Item

          Parent document

        • collection: "effects" | "items"

          Collection name

        • documents: ActiveEffect[] | Item[]

          Created documents

        • result: object[]

          Creation data for the documents

        • context: object

          Create context options

        • userId: string

          Triggering user's ID

        • Rest ...args: any

        Returns void

      • Internal

        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

      • Internal

        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

      • Adjust temporary hit points.

        Parameters

        • value: number

          Value to add to temp HP

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

          Additonal optons

          • set: undefined | boolean

            If true, the temporary hit points are set to the provide value instead of added to existing.

        Returns Promise<undefined | ActorVehiclePF>

        • Updated document or undefined if no update occurred

        Example

        actor.addTempHP(50); // Gain 50 THP
        actor.addTempHP(-10); // Lose 10 THP
        actor.addTempHP(0, {set:true}); // Set THP to zero
      • 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>

        See

        ActorPF.applyDamage

        Example

        await actor.applyDamage(10); // Cause 10 damage
        await actor.applyDamage(-10): // Heal 10 damage
        await actor.applyDamage(3, { asWounds: true }); // Apply 3 damage directly to Wounds instead of Vigor
      • Enable and configure a new spellbook.

        Parameters

        • Optional casting: {
              ability: undefined | string;
              cantrips: undefined | boolean;
              class: undefined | string;
              domain: undefined | number;
              offset: 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

          • domain: undefined | number

            Domain/School slots

          • offset: undefined | number

            Level offset

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

            Casting progression type

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

            Spell/spellcasting type

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

            Spellbook type

        • __namedParameters: {
              commit: undefined | boolean;
          } = {}
          • commit: undefined | boolean

        Returns Promise<ActorVehiclePF>

        • Promise to updated document

        Example

        // Create spellbook for inquisitor
        actor.createSpellbook({ type: "spontaneous", progression: "med", ability: "wis", spells: "divine", class: "inquisitor", cantrips: true, domain: 0 });
      • 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<any>

      • Enrich context notes with item specific roll data.

        Adds enriched array to each note object.

        Parameters

        • notes: ItemContextNotes
        • Optional rollData: object

          Roll data instance

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

          Additional options

          • roll: undefined | boolean

            Handle rolls

        Returns Promise<void>

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

        Parameters

        • Optional options: {
              combat: undefined | Combat;
              event: undefined | string;
              initiative: undefined | number;
              timeOffset: undefined | number;
              worldTime: undefined | number;
          } = {}

          Additional options

          • combat: undefined | Combat

            Combat to expire data in, if relevant

          • event: undefined | string

            Expiration event

          • initiative: undefined | number

            Initiative based expiration marker

          • timeOffset: undefined | number

            Time offset from world time

          • worldTime: undefined | number

            World time

        • Optional context: DocumentModificationContext = {}

          Document update context

        Returns Promise<void>

        Throws

        • With insufficient permissions to control the actor.
      • Calculate current carry capacity limits.

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

        • heavy: number
        • light: number
        • medium: number
      • Get total currency in category.

        Parameters

        • Optional category: "currency" | "altCurrency" = "currency"

          Currency category.

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

          Additional options

          • inLowestDenomination: undefined | boolean

            Return result in lowest denomination. If false, returns gold instead.

        Returns number

        • Total currency in category.
      • Protected

        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;
        }[]

      • Protected

        Returns {
            id: null | string;
            img: null | string;
            item: ItemPF;
            name: null | string;
            type: string;
            get charges(): number;
            get haveAnyCharges(): boolean;
            get isSingleUse(): boolean;
            get maxCharge(): number;
        }[]

      • Retrieve data used to fill in roll variables.

        Parameters

        • options: {
              refresh: boolean;
          } = ...

          Additional options

          • refresh: boolean

        Returns any

        Example

        await new Roll("1d20 + @abilities.wis.mod[Wis]", actor.getRollData()).toMessage();

        @override
      • Retrieve information about a skill.

        Parameters

        • skillId: string

          Skill ID

        • Optional options: {
              rollData: undefined | {
                  skills: {
                      [key: string]: SkillData;
                  };
              };
          } = {}

          Additional options

          • rollData: undefined | {
                skills: {
                    [key: string]: SkillData;
                };
            }

            Roll data instance to use.

        Returns SkillInfo

        Example

        actor.getSkillInfo("per"); // Perception skill info
        actor.getSkillInfo("crf.alchemy"); // Craft (Alchemy) subskill info

        Throws

        • If defined skill is not found.
      • Create a new Token document, not yet saved to the database, which represents the Actor, and apply actor size to it.

        Parameters

        • Optional data: object = {}

          Additional data, such as x, y, rotation, etc. for the created token data

        • Optional options: object = {}

          The options passed to the TokenDocument constructor

        Returns Promise<TokenDocumentPF>

        The created TokenDocument instance

      • Total coinage in both weighted and weightless.

        Parameters

        • __namedParameters: {
              inLowestDenomination: undefined | boolean;
          } = {}

          Additional options

          • inLowestDenomination: undefined | boolean

        Returns number

        • The total amount of currency, in copper pieces.
      • Protected

        Returns Wound Threshold relevant data.

        Parameters

        • Optional options: {
              healthConfig: undefined | object;
          } = {}
          • healthConfig: undefined | object

            PC/NPC health config variant data

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

        • level: number
        • multiplier: number
        • penalty: number
        • valid: boolean
      • Protected

        Returns effective Wound Threshold multiplier with rules and overrides applied.

        Parameters

        • Optional options: {
              healthConfig: undefined | object;
          } = {}
          • healthConfig: undefined | object

            PC/NPC health config variant data

        Returns number

        Multiplier

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

        Parameters

        • conditionId: string

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

        Returns boolean

        Condition state

        Example

        actor.hasCondition("grappled");
        

        Deprecated

        This is identical to actor.statuses.has("conditionId")

      • Test if actor is proficient with specified weapon.

        Parameters

        • item: ItemPF

          Item to test

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

          Additional options

          • override: undefined | boolean

            Allow item's proficiency override to influence the result.

        Returns boolean

        • Proficiency state

        Remarks

        Natural attacks incorrectly do not count as proficient.

      • Protected

        Helper function for actor energy resistance and damage reduction feedback.

        Parameters

        • damage: string

          Value to check resistances for. Either "dr" or "eres".

        Returns object

        Entry to label mapping of resistances or reductions.

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

        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 = {}

          Additional options

        Returns Promise<void | object | ChatMessage>

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

        Example

        await actor.rollAbilityTest("str");
        
      • Roll a generic attack

        Parameters

        Returns Promise<void | object | ChatMessage>

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

        Example

        await actor.rollAttack({ ranged: true }); // Basic ranged attack
        await actor.rollAttack({ maneuver: true }); // Basic melee maneuver
      • Roll basic BAB check

        Parameters

        Returns Promise<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 Promise<void | object | ChatMessage>

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

        Example

        await actor.rollCL("primary");
        
      • Roll a concentration check using a particular spellbook of this actor

        Parameters

        • bookId: string

          Spellbook identifier

        • Optional options: ActorRollOptions = {}

          Roll options

        Returns Promise<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

        Example

        await actor.rollInitiative({ dice: "2d20kh", createCombatants: true, skipDialog: true });

        @override

        See

        pf1.documents.CombatPF#rollInitiative

      • Roll a specific saving throw

        Parameters

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

          Identifier for saving throw type.

        • Optional options: ActorRollOptions = {}

          Roll options.

        Returns Promise<void | object | ChatMessage>

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

        Example

        await actor.rollSavingThrow("ref", { skipDialog: true, dice: "2d20kh", bonus: "4" });
        
      • Roll a Skill Check

        Parameters

        • skillId: string

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

        • Optional options: ActorRollOptions = {}

          Options which configure how the skill check is rolled

        Returns Promise<void | object | ChatMessage>

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

        Example

        await actor.rollSkill("per", { skipDialog: true, bonus: "1d6", dice: "2d20kh" });
        
      • Easy way to set a condition.

        Parameters

        • conditionId: string

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

        • enabled: boolean | object

          Whether to enable (true) the condition, or disable (false) it. Or object for merging into the active effect as part of enabling.

        • Optional context: object

          Update context

        Returns object

        Condition ID to boolean mapping of actual updates.

        Example

        await actor.setCondition("dazzled", true);
        await actor.setCondition("sleep", { duration: { seconds: 60 } });
      • Set state of multiple conditions. Also handles condition tracks to minimize number of updates.

        Parameters

        • conditions: object = {}

          Condition ID to boolean (or update data) mapping of new condition states. See ()

        • Optional context: object = {}

          Update context

        Returns Record<string, boolean>

        Condition ID to boolean mapping of actual updates.

        Example

        await actor.setConditions({ blind: true, sleep: false, shaken:true });
        
      • Easy way to toggle a condition.

        Parameters

        • conditionId: boolean

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

        • Optional aeData: object

          Extra data to add to the AE if it's being enabled

        Returns object

        Condition ID to boolean mapping of actual updates.

        Example

        await actor.toggleCondition("dazzled");
        
      • Internal

        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

      • Internal

        Resize token sizes based on actor size.

        Ignores tokens with static size set.

        Parameters

        • Optional sizeKey: string = undefined

          Size key to update to. If not provided, will use actor's current size.

        • Optional options: object = {}

          Additional options

        Returns null | Promise<TokenDocument[]>

        • Updated token documents, or null if no update was performed.

        Todo

        Add option to update token size on all scenes.

        Throws

        • On invalid parameters
      • 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 = 0

          The amount of damage to deal.

        • Optional options: {
              asNonlethal: undefined | boolean;
              asWounds: undefined | boolean;
              critMult: undefined | number;
              dualHeal: undefined | boolean;
              element: undefined | Element;
              event: undefined | Event;
              forceDialog: undefined | boolean;
              instances: undefined | DamageInstance[];
              message: undefined | ChatMessage;
              reductionDefault: undefined | string;
              targets: undefined | (Actor | Token)[];
          } = {}

          Object containing default settings for overriding

          • asNonlethal: undefined | boolean

            Marks the damage as non-lethal

          • asWounds: undefined | boolean

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

          • critMult: undefined | number

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

          • dualHeal: undefined | boolean

            Is this dual dealing? If enabled, healing affects both normal health and nonlethal.

          • element: undefined | Element

            Triggering element, if any.

          • event: undefined | Event

            Triggering event, if any

          • forceDialog: undefined | boolean

            Forces the opening of a Dialog as if Shift was pressed

          • instances: undefined | DamageInstance[]

            Individual instances of damage. This is not processed currently.

          • message: undefined | ChatMessage

            Chat message reference if any. This is to help modules, the system does not use it.

          • reductionDefault: undefined | string

            Default value for Damage Reduction

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

            Override the targets to apply damage to

        Returns Promise<false | Actor[]>

        • False if cancelled or array of updated actors.
      • Get melee and reach maximum ranges.

        Parameters

        • size: number | "col" | "med" | "fine" | "dim" | "tiny" | "sm" | "lg" | "huge" | "grg" = "med"

          Actor size as size key or number

        • stature: "tall" | "long" = "tall"

          Actor stature

        Returns {
            melee: number;
            reach: number;
        }

        • Ranges
        • melee: number
        • reach: number
      • 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.

        Example

        pf1.documents.actor.ActorPF.getSpellSlotIncrease(2, 1); // => 1
        pf1.documents.actor.ActorPF.getSpellSlotIncrease(6, 1); // => 2
        pf1.documents.actor.ActorPF.getSpellSlotIncrease(6, 7); // => 0

      Generated using TypeDoc