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

    Base actor class with minimal functionality.

    Provides only caching of .itemTypes and nothing else.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • data: CreateData

        Initial data from which to construct the Actor

      • Optionalcontext: ConstructionContext

        Construction context options

      Returns ActorBasePF

    Properties

    changeFlags: Record<string, boolean>

    Change flags

    changeOverrides: Record<keyof typeof buffTargets, Record<"add" | "set", any>>

    Overrides applied by changes

    changes: Collection<ItemChange>

    All changes from carried items and virtual ones.

    itemFlags: {
        boolean: Record<string, { sources: ItemPF[] }>;
        dictionary: Record<string, Record<any>>;
    }

    Item dictionary and boolean flags

    sourceInfo: Record<string, SourceInfoGroup>

    Source info

    Partial duplicate of changes and manual adjustments.

    This structure should be removed in favor of storing the info in changes.

    Accessors

    Methods

    • Internal

      Parameters

      • conditions: Record<string, boolean> = {}

        Condition toggle state

      Returns void

      • The condition notification needs to be smarter.
    • Configure actor before data preparation.

      Parameters

      • options: object = {}

        Document options

      Returns void

    • Internal

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

      Parameters

      • documents: ActiveEffect<"base" | ModuleSubType>[]

        Updated active effect documents

      Returns Promise<object>

    • Internal

      Parameters

      • parent: Actor<"base" | ModuleSubType> | Item<"base" | ModuleSubType>

        Parent document

      • collection: "items" | "effects"

        Collection name

      • documents: ActiveEffect<"base" | ModuleSubType>[] | Item<"base" | ModuleSubType>[]

        Created documents

      • result: object[]

        Creation data for the documents

      • context: object

        Create context options

      • userId: string

        Triggering user's ID

      • ...args: any

      Returns void

    • Internal

      Parameters

      • parent: any

        Parent document

      • collection: "items" | "effects"

        Collection name

      • documents: Item<"base" | ModuleSubType> | ActiveEffect<"base" | ModuleSubType>[]

        Document array

      • ids: string[]

        Document ID array

      • context: object

        Delete context

      • userId: string

        User ID

      Returns void

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

      Parameters

      • Optionaloptions: {
            combat?: Combat<"base" | ModuleSubType>;
            event?: string;
            initiative?: number;
            timeOffset?: number;
            worldTime?: number;
        } = {}

        Additional options

        • Optionalcombat?: Combat<"base" | ModuleSubType>

          Combat to expire data in, if relevant

        • Optionalevent?: string

          Expiration event

        • Optionalinitiative?: number

          Initiative based expiration marker

        • OptionaltimeOffset?: number

          Time offset from world time

        • OptionalworldTime?: number

          World time

      • Optionalcontext: any = {}

        Document update context

      Returns Promise<void>

      • With insufficient permissions to control the actor.
    • Get related combatants.

      Parameters

      • Optionalcombat: Combat<"base" | ModuleSubType> = game.combat

        Combat instance

      Returns Combatant<"base" | ModuleSubType>[]

      Related combatants.

    • Get item by its identifier tag.

      Parameters

      • tag: string

        Desired tag.

      Returns undefined | Item<"base" | ModuleSubType>

      • Matching item or undefined if no item is found.
    • Retrieve source details regarding a change target.

      Parameters

      • path: string

        Change target path

      Returns SourceInfo[]

      actor.getSourceDetails("system.attributes.hp.max");
      
      • Merge sourceInfo into the change system to reduce underlying system complexity
    • 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

      Test if user is grappled

      actor.hasCondition("grappled");
      

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

    • Prepare data related to this Document itself, before any embedded Documents or derived data is computed.

      Returns void

    • Internal

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

      Returns void

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

      • Optionalcontext: object

        Update context

      Returns Promise<object>

      Condition ID to boolean mapping of actual updates.

      Enable Dazzled

      await actor.setCondition("dazzled", true);
      

      Enable Sleep for 10 rounds

      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 ()

      • Optionalcontext: object = {}

        Update context

      Returns Record<string, boolean>

      Condition ID to boolean mapping of actual updates.

      Enable Blinded and Shaken conditions but disable Sleeping

      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.

      • OptionalaeData: object

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

      Returns Promise<object>

      Condition ID to boolean mapping of actual updates.

      Toggle Dazzled

      await actor.toggleCondition("dazzled");
      

      Toggle Blinded, set duration for 3 rounds if it's being enabled.

      await actor.toggleCondition("blinded", { duration: { seconds: 18 } });
      
    • Override to support toggling buffs and operating the system's condition tracks

      Called by TokenHUD

      Parameters

      • statusId: string

        Status/condition ID

      • Optionaloptions: { active?: boolean; interaction?: boolean; overlay?: boolean } = {}

        Additional options

        • Optionalactive?: boolean

          Force active state

        • Optionalinteraction?: boolean

          Nonstandard. Is this triggered by user interaction?

        • Optionaloverlay?: boolean

          Overlay effect

      Returns Promise<undefined | boolean | ActiveEffect<"base" | ModuleSubType>>

      Synced with Foundry v13.342

      Add separate listener for buffs