Options
All
  • Public
  • Public/Protected
  • All
Menu

The client-side ActiveEffect document which extends the common BaseActiveEffect model. Each ActiveEffect belongs to the effects collection of its parent Document. Each ActiveEffect contains a ActiveEffectData object which provides its source data.

mixes

ClientDocumentMixin

see

{@link documents.Actor} The Actor document which contains ActiveEffect embedded documents

see

{@link documents.Item} The Item document which contains ActiveEffect embedded documents

property

{ActiveEffectDuration} duration Expanded effect duration data.

Hierarchy

  • any
    • ActiveEffect

Index

Constructors

  • Returns ActiveEffect

Accessors

  • get isSuppressed(): boolean
  • Is there some system logic that makes this active effect ineligible for application?

    Returns boolean

  • get img(): string
  • Provide forward-compatibility with other Document types which use img as their primary image or icon. We are likely to formally migrate this in the future, but for now this getter provides compatible read access.

    Returns string

  • get target(): Document
  • Retrieve the Document that this ActiveEffect targets for modification.

    Returns Document

  • get active(): boolean
  • Whether the Active Effect currently applying its changes to the target.

    Returns boolean

  • get modifiesActor(): boolean
  • Does this Active Effect currently modify an Actor?

    Returns boolean

  • get isTemporary(): boolean
  • Describe whether the ActiveEffect has a temporary duration based on combat turns or rounds.

    Returns boolean

  • get sourceName(): string
  • The source name of the Active Effect. The source is retrieved synchronously. Therefore "Unknown" (localized) is returned if the origin points to a document inside a compendium. Returns "None" (localized) if it has no origin, and "Unknown" (localized) if the origin cannot be resolved.

    Returns string

Methods

  • prepareBaseData(): void
  • inheritdoc

    Returns void

  • prepareDerivedData(): void
  • inheritdoc

    Returns void

  • updateDuration(): EffectDurationData
  • Update derived Active Effect duration data. Configure the remaining and label properties to be getters which lazily recompute only when necessary.

    Returns EffectDurationData

  • _prepareDuration(): { type: string; duration: number; remaining: number; label: string }
  • Compute derived data related to active effect duration.

    internal

    Returns { type: string; duration: number; remaining: number; label: string }

    {{ type: string, duration: number|null, remaining: number|null, label: string, [_worldTime]: number, [_combatTime]: number} }

    • type: string
    • duration: number
    • remaining: number
    • label: string
  • apply(actor: Actor, change: EffectChangeData): any
  • Apply this ActiveEffect to a provided Actor. TODO: This method is poorly conceived. Its functionality is static, applying a provided change to an Actor TODO: When we revisit this in Active Effects V2 this should become an Actor method, or a static method

    Parameters

    • actor: Actor

      The Actor to whom this effect should be applied

    • change: EffectChangeData

      The change data being applied

    Returns any

    The resulting applied value

  • getFlag(scope: any, key: any): any
  • inheritdoc

    Parameters

    • scope: any
    • key: any

    Returns any

  • _preCreate(data: any, options: any, user: any): Promise<void>
  • inheritdoc

    Parameters

    • data: any
    • options: any
    • user: any

    Returns Promise<void>

  • _onCreate(data: any, options: any, userId: any): void
  • inheritdoc

    Parameters

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

    Returns void

  • _preUpdate(data: any, options: any, userId: any): Promise<any>
  • inheritdoc

    Parameters

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

    Returns Promise<any>

  • _onUpdate(data: any, options: any, userId: any): void
  • inheritdoc

    Parameters

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

    Returns void

  • _onDelete(options: any, userId: any): void
  • inheritdoc

    Parameters

    • options: any
    • userId: any

    Returns void

  • _requiresDurationUpdate(): boolean
  • Determine whether the ActiveEffect requires a duration update. True if the worldTime has changed for an effect whose duration is tracked in seconds. True if the combat turn has changed for an effect tracked in turns where the effect target is a combatant.

    Returns boolean

  • _displayScrollingStatus(enabled: boolean): void
  • Display changes to active effects as scrolling Token status text.

    Parameters

    • enabled: boolean

      Is the active effect currently enabled?

    Returns void

  • _getCombatTime(round: number, turn: number, nTurns: number): number
  • Format a round+turn combination as a decimal

    Parameters

    • round: number

      The round number

    • turn: number

      The turn number

    • nTurns: number

    Returns number

    The decimal representation

  • _getDurationLabel(rounds: number, turns: number): string
  • Format a number of rounds and turns into a human-readable duration label

    Parameters

    • rounds: number

      The number of rounds

    • turns: number

      The number of turns

    Returns string

    The formatted label

  • _castDelta(raw: string, type: string): any
  • Cast a raw EffectChangeData change string to the desired data type.

    Parameters

    • raw: string

      The raw string value

    • type: string

      The target data type that the raw value should be cast to match

    Returns any

    The parsed delta cast to the target data type

  • _castArray(raw: string, type: string): any[]
  • Cast a raw EffectChangeData change string to an Array of an inner type.

    Parameters

    • raw: string

      The raw string value

    • type: string

      The target data type of inner array elements

    Returns any[]

    The parsed delta cast as a typed array

  • _parseOrString(raw: string): any
  • Parse serialized JSON, or retain the raw string.

    Parameters

    • raw: string

      A raw serialized string

    Returns any

    The parsed value, or the original value if parsing failed

  • _applyAdd(actor: Actor, change: EffectChangeData, current: any, delta: any, changes: any): void
  • Apply an ActiveEffect that uses an ADD application mode. The way that effects are added depends on the data type of the current value.

    If the current value is null, the change value is assigned directly. If the current type is a string, the change value is concatenated. If the current type is a number, the change value is cast to numeric and added. If the current type is an array, the change value is appended to the existing array if it matches in type.

    Parameters

    • actor: Actor

      The Actor to whom this effect should be applied

    • change: EffectChangeData

      The change data being applied

    • current: any

      The current value being modified

    • delta: any

      The parsed value of the change object

    • changes: any

      An object which accumulates changes to be applied

    Returns void

  • _applyMultiply(actor: Actor, change: EffectChangeData, current: any, delta: any, changes: any): void
  • Apply an ActiveEffect that uses a MULTIPLY application mode. Changes which MULTIPLY must be numeric to allow for multiplication.

    Parameters

    • actor: Actor

      The Actor to whom this effect should be applied

    • change: EffectChangeData

      The change data being applied

    • current: any

      The current value being modified

    • delta: any

      The parsed value of the change object

    • changes: any

      An object which accumulates changes to be applied

    Returns void

  • _applyOverride(actor: Actor, change: EffectChangeData, current: any, delta: any, changes: any): any
  • Apply an ActiveEffect that uses an OVERRIDE application mode. Numeric data is overridden by numbers, while other data types are overridden by any value

    Parameters

    • actor: Actor

      The Actor to whom this effect should be applied

    • change: EffectChangeData

      The change data being applied

    • current: any

      The current value being modified

    • delta: any

      The parsed value of the change object

    • changes: any

      An object which accumulates changes to be applied

    Returns any

  • _applyUpgrade(actor: Actor, change: EffectChangeData, current: any, delta: any, changes: any): void
  • Apply an ActiveEffect that uses an UPGRADE, or DOWNGRADE application mode. Changes which UPGRADE or DOWNGRADE must be numeric to allow for comparison.

    Parameters

    • actor: Actor

      The Actor to whom this effect should be applied

    • change: EffectChangeData

      The change data being applied

    • current: any

      The current value being modified

    • delta: any

      The parsed value of the change object

    • changes: any

      An object which accumulates changes to be applied

    Returns void

  • _applyCustom(actor: Actor, change: EffectChangeData, current: any, delta: any, changes: any): void
  • Apply an ActiveEffect that uses a CUSTOM application mode.

    Parameters

    • actor: Actor

      The Actor to whom this effect should be applied

    • change: EffectChangeData

      The change data being applied

    • current: any

      The current value being modified

    • delta: any

      The parsed value of the change object

    • changes: any

      An object which accumulates changes to be applied

    Returns void

  • getInitialDuration(): { duration: { startTime: number } }
  • Retrieve the initial duration configuration.

    Returns { duration: { startTime: number } }

    • duration: { startTime: number }
      • startTime: number