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 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 ActorPF

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

      • get activeOwner(): null | User
      • Returns first active owner, favoring players and GM as fallback.

        Returns null | User

      Methods

      • Internal

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

        Returns object

        Spellbook cache

      • Internal

        Returns {
            abilities.cha.checkMod: number;
            abilities.cha.total: number;
            abilities.cha.undrained: number;
            abilities.con.checkMod: number;
            abilities.con.total: number;
            abilities.con.undrained: number;
            abilities.dex.checkMod: number;
            abilities.dex.total: number;
            abilities.dex.undrained: number;
            abilities.int.checkMod: number;
            abilities.int.total: number;
            abilities.int.undrained: number;
            abilities.str.checkMod: number;
            abilities.str.total: number;
            abilities.str.undrained: number;
            abilities.wis.checkMod: number;
            abilities.wis.total: number;
            abilities.wis.undrained: 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.skill: number;
            attributes.acp.total: number;
            attributes.attack.critConfirm: number;
            attributes.attack.general: number;
            attributes.attack.melee: number;
            attributes.attack.natural: number;
            attributes.attack.ranged: number;
            attributes.attack.shared: number;
            attributes.attack.thrown: number;
            attributes.bab.total: 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.melee: number;
            attributes.damage.meleeAll: number;
            attributes.damage.natural: number;
            attributes.damage.ranged: number;
            attributes.damage.rangedAll: number;
            attributes.damage.shared: number;
            attributes.damage.spell: number;
            attributes.damage.thrown: number;
            attributes.damage.weapon: number;
            attributes.hp.max: any;
            attributes.init.bonus: number;
            attributes.init.total: any;
            attributes.mDex: {
                armorBonus: number;
                shieldBonus: number;
            };
            attributes.maxDexBonus: null;
            attributes.savingThrows.fort.total: any;
            attributes.savingThrows.ref.total: any;
            attributes.savingThrows.will.total: any;
            attributes.speed.burrow.add: number;
            attributes.speed.climb.add: number;
            attributes.speed.fly.add: number;
            attributes.speed.land.add: number;
            attributes.speed.swim.add: number;
            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.penalty: number;
            attributes.woundThresholds.penaltyBase: number;
            attributes.wounds.max: any;
            attributes.wounds.threshold: number;
            details.carryCapacity.bonus.total: number;
            details.carryCapacity.multiplier.total: number;
            details.feats.bonus: number;
            details.skills.bonus: number;
        }

        • abilities.cha.checkMod: number
        • abilities.cha.total: number
        • abilities.cha.undrained: number
        • abilities.con.checkMod: number
        • abilities.con.total: number
        • abilities.con.undrained: number
        • abilities.dex.checkMod: number
        • abilities.dex.total: number
        • abilities.dex.undrained: number
        • abilities.int.checkMod: number
        • abilities.int.total: number
        • abilities.int.undrained: number
        • abilities.str.checkMod: number
        • abilities.str.total: number
        • abilities.str.undrained: number
        • abilities.wis.checkMod: number
        • abilities.wis.total: number
        • abilities.wis.undrained: 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.skill: number
        • attributes.acp.total: number
        • attributes.attack.critConfirm: number
        • attributes.attack.general: number
        • attributes.attack.melee: number
        • attributes.attack.natural: number
        • attributes.attack.ranged: number
        • attributes.attack.shared: number
        • attributes.attack.thrown: number
        • attributes.bab.total: 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.melee: number
        • attributes.damage.meleeAll: number
        • attributes.damage.natural: number
        • attributes.damage.ranged: number
        • attributes.damage.rangedAll: number
        • attributes.damage.shared: number
        • attributes.damage.spell: number
        • attributes.damage.thrown: number
        • attributes.damage.weapon: number
        • attributes.hp.max: any
        • attributes.init.bonus: number
        • attributes.init.total: any
        • attributes.mDex: {
              armorBonus: number;
              shieldBonus: number;
          }
          • armorBonus: number
          • shieldBonus: number
        • attributes.maxDexBonus: null
        • attributes.savingThrows.fort.total: any
        • attributes.savingThrows.ref.total: any
        • attributes.savingThrows.will.total: any
        • attributes.speed.burrow.add: number
        • attributes.speed.climb.add: number
        • attributes.speed.fly.add: number
        • attributes.speed.land.add: number
        • attributes.speed.swim.add: number
        • 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.penalty: number
        • attributes.woundThresholds.penaltyBase: number
        • attributes.wounds.max: any
        • attributes.wounds.threshold: number
        • details.carryCapacity.bonus.total: number
        • details.carryCapacity.multiplier.total: number
        • details.feats.bonus: number
        • details.skills.bonus: number
      • Internal

        Handle condition track toggling post active effect creation if there's still some issues.

        Parameters

        • documents: ActiveEffect[]

          Updated active effect documents

        Returns Promise<any>

      • 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

        Parameters

        • parent: any
        • collection: "effects" | "items"
        • documents: Item | ActiveEffect[]
        • ids: string[]
        • context: object

          Delete context

        • userId: string

        Returns void

      • Internal

        Parameters

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

        Returns Promise<void>

      • Internal

        Parameters

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

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

      • Protected

        Handler for character healing during rest.

        Parameters

        • options: object = {}

          Resting options.

        Returns object

        Update data object

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

        • 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
      • Converts currencies of the given category to the given currency type

        Parameters

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

          Currency category, altCurrency is for weightless

        • Optional type: "pp" | "gp" | "sp" | "cp" = "pp"

          Target currency.

        Returns undefined | Promise<ActorPF>

        Updated document or undefined if no update occurred.

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

        • 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
      • Generates an array with all the active context-sensitive notes for the given context on this actor.

        Parameters

        • context: string

          The context to draw from.

        • Optional all: boolean = true

          Retrieve notes meant for all, such as notes targeting all skills.

        Returns ItemContextNotes[]

      • Returns a list of already parsed context notes.

        Parameters

        • context: string

          The context to draw notes from.

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

          Additional options

          • all: undefined | boolean

            Option to pass to getContextNotes

          • roll: undefined | boolean

            Whether to roll inline rolls or not.

        Returns Promise<ParsedContextNoteEntry[]>

        The resulting notes, already parsed.

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

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

        Parameters

        • level: number

          The desired level

        Returns number

        • The XP required

        Abstract

      • 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

        • Optional options: object = ...

          Additional options

        Returns object

        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

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

          Additional options

          • inLowestDenomination: undefined | boolean

            Use copper for calculations and return.

        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

      • Checks if there's any matching proficiency

        Parameters

        • item: ItemEquipmentPF

          The item to check for.

        Returns boolean

        Whether the actor is proficient with that item.

      • 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")

      • Check if actor has item with specified boolean flag.

        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.

      • 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

        Parameters

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

        Returns Promise<undefined | ActorPF>

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

      • Protected

        Meant to be overridden.

        Parameters

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

        Returns object

        Update data to replace with.

        Abstract

      • Internal

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

          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

        Update all spellbooks

        Parameters

        • Optional rollData: object

          Roll data instance

        • Optional cache: object

          Spellbook cache

        Returns void

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

        Synchronize actor and token vision

        Parameters

        • initializeVision: boolean = false
        • refreshLighting: boolean = false

        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 = 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 reduced movement speed.

        Parameters

        • value: number

          The non-reduced movement speed.

        Returns number

        The reduced movement speed.

        Example

        pf1.documents.actor.ActorPF.getReducedMovementSpeed(30); // => 20
        
      • 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