Options
All
  • Public
  • Public/Protected
  • All
Menu

The client-side Combat document which extends the common BaseCombat model.

mixes

ClientDocumentMixin

see

{@link documents.Combats} The world-level collection of Combat documents

see

Combatant The Combatant embedded document which exists within a Combat document

see

{@link CombatConfig} The Combat configuration application

Hierarchy

  • any
    • Combat

Index

Constructors

  • new Combat(data: any, context: any): Combat
  • Parameters

    • data: any
    • context: any

    Returns Combat

Properties

turns: Combatant[]

Track the sorted turn order of this combat encounter

turn: any
CONFIG_SETTING: string = "combatTrackerConfig"

The configuration setting used to record Combat preferences

Accessors

  • Get the Combatant who has the current turn.

    Returns Combatant

  • Get the Combatant who has the next turn.

    Returns Combatant

  • get settings(): any
  • Return the object of settings which modify the Combat Tracker behavior

    Returns any

  • get started(): boolean
  • Has this combat encounter been started?

    Returns boolean

  • get visible(): boolean
  • inheritdoc

    Returns boolean

  • get isActive(): boolean
  • Is this combat active in the current scene?

    Returns boolean

Methods

  • activate(options: any): Promise<Combat>
  • Set the current Combat encounter as active within the Scene. Deactivate all other Combat encounters within the viewed Scene and set this one as active

    Parameters

    • options: any

    Returns Promise<Combat>

  • prepareDerivedData(): void
  • override

    Returns void

  • getCombatantByToken(tokenId: string): Combatant
  • Get a Combatant using its Token id

    Parameters

    • tokenId: string

      The id of the Token for which to acquire the combatant

    Returns Combatant

  • getCombatantByActor(actorId: string): Combatant
  • Get a Combatant using its Actor id

    Parameters

    • actorId: string

      The id of the Actor for which to acquire the combatant

    Returns Combatant

  • startCombat(): Promise<Combat>
  • Begin the combat encounter, advancing to round 1 and turn 1

    Returns Promise<Combat>

  • Advance the combat to the next round

    Returns Promise<Combat>

  • previousRound(): Promise<Combat>
  • Rewind the combat to the previous round

    Returns Promise<Combat>

  • Advance the combat to the next turn

    Returns Promise<Combat>

  • previousTurn(): Promise<Combat>
  • Rewind the combat to the previous turn

    Returns Promise<Combat>

  • Display a dialog querying the GM whether they wish to end the combat encounter and empty the tracker

    Returns Promise<Combat>

  • toggleSceneLink(): Promise<Combat>
  • Toggle whether this combat is linked to the scene or globally available.

    Returns Promise<Combat>

  • Reset all combatant initiative scores, setting the turn back to zero

    Returns Promise<Combat>

  • rollInitiative(ids: string | string[], [options={}]?: { formula: string; updateTurn: boolean; messageOptions: any }): Promise<Combat>
  • Roll initiative for one or multiple Combatants within the Combat document

    Parameters

    • ids: string | string[]

      A Combatant id or Array of ids for which to roll

    • [options={}]: { formula: string; updateTurn: boolean; messageOptions: any } = {}

      Additional options which modify how initiative rolls are created or presented.

      • formula: string
      • updateTurn: boolean
      • messageOptions: any

    Returns Promise<Combat>

    A promise which resolves to the updated Combat document once updates are complete.

  • rollAll(options: any): Promise<Combat>
  • Roll initiative for all combatants which have not already rolled

    Parameters

    • options: any

    Returns Promise<Combat>

  • rollNPC(options?: any): Promise<Combat>
  • Roll initiative for all non-player actors who have not already rolled

    Parameters

    • options: any = {}

    Returns Promise<Combat>

  • setInitiative(id: string, value: number): Promise<void>
  • Assign initiative for a single Combatant within the Combat encounter. Update the Combat turn order to maintain the same combatant as the current turn.

    Parameters

    • id: string

      The combatant ID for which to set initiative

    • value: number

      A specific initiative value to set

    Returns Promise<void>

  • Return the Array of combatants sorted into initiative order, breaking ties alphabetically by name.

    Returns Combatant[]

  • updateEffectDurations(): void
  • Update active effect durations for all actors present in this Combat encounter.

    Returns void

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

    Parameters

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

    Returns void

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

    Parameters

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

    Returns any

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

    Parameters

    • options: any
    • userId: any

    Returns void

  • _onCreateEmbeddedDocuments(type: any, documents: any, result: any, options: any, userId: any): void
  • inheritdoc

    Parameters

    • type: any
    • documents: any
    • result: any
    • options: any
    • userId: any

    Returns void

  • _onUpdateEmbeddedDocuments(embeddedName: any, documents: any, result: any, options: any, userId: any): void
  • inheritdoc

    Parameters

    • embeddedName: any
    • documents: any
    • result: any
    • options: any
    • userId: any

    Returns void

  • _onDeleteEmbeddedDocuments(embeddedName: any, documents: any, result: any, options: any, userId: any): void
  • inheritdoc

    Parameters

    • embeddedName: any
    • documents: any
    • result: any
    • options: any
    • userId: any

    Returns void

  • Define how the array of Combatants is sorted in the displayed list of the tracker. This method can be overridden by a system or module which needs to display combatants in an alternative order. The default sorting rules sort in descending order of initiative using combatant IDs for tiebreakers.

    Parameters

    Returns number

  • _playCombatSound(type: string): void
  • Loads the registered Combat Theme (if any) and plays the requested type of sound. If multiple exist for that type, one is chosen at random.

    Parameters

    • type: string

      One of [ "startEncounter", "nextUp", "yourTurn" ]

    Returns void