Combat

Combat

The Combat Entity defines a particular combat encounter which can occur within the game session Combat instances belong to the CombatEncounters collection

Constructor

new Combat()

Source:

Members

(static) config

Source:

Configure the attributes of the Folder Entity

combatant :Object

Source:

Get the data object for the Combatant who has the current turn

Type:
  • Object

combatants :Array.<Object>

Source:

A convenience reference to the Array of combatant data within the Combat entity

Type:

round :number

Source:

The numeric round of the Combat encounter

Type:
  • number

scene

Source:

Get the Scene entity for this Combat encounter

settings

Source:

Return the object of settings which modify the Combat Tracker behavior

started :Boolean

Source:

Has this combat encounter been started?

Type:
  • Boolean

turn :number

Source:

The numeric turn of the combat round in the Combat encounter

Type:
  • number

turns :Array

Source:

Track the sorted turn order of this combat encounter

Type:

Methods

_onCreate()

Source:

_onDelete()

Source:

_onDeleteEmbeddedEntity()

Source:

_onModifyEmbeddedEntity()

Source:

_onUpdate()

Source:

(async) activate() → {Promise.<Combat>}

Source:

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

Returns:
Type
Promise.<Combat>

(async) createCombatant()

Source:

(async) deleteCombatant()

Source:

(async) endCombat() → {Promise}

Source:

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

Returns:
Type
Promise

getCombatant()

Source:

getCombatantByToken()

Source:

Get a Combatant using its Token id {string} tokenId The id of the Token for which to acquire the combatant

(async) nextRound() → {Promise}

Source:

Advance the combat to the next round

Returns:
Type
Promise

(async) nextTurn() → {Promise}

Source:

Advance the combat to the next turn

Returns:
Type
Promise

prepareEmbeddedEntities()

Source:

Prepare Embedded Entities which exist within the parent Combat. For example, in the case of an Actor, this method is responsible for preparing the Owned Items the Actor contains.

(async) previousRound() → {Promise}

Source:

Rewind the combat to the previous round

Returns:
Type
Promise

(async) previousTurn() → {Promise}

Source:

Rewind the combat to the previous turn

Returns:
Type
Promise

(async) resetAll() → {Promise}

Source:

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

Returns:
Type
Promise

(async) rollAll(…args)

Source:

Roll initiative for all combatants which have not already rolled

Parameters:
Name Type Attributes Description
args * <repeatable>

Additional arguments forwarded to the Combat.rollInitiative method

(async) rollInitiative(ids, formula, messageOptions) → {Promise.<Combat>}

Source:

Roll initiative for one or multiple Combatants within the Combat entity

Parameters:
Name Type Default Description
ids Array | string

A Combatant id or Array of ids for which to roll

formula string | null null

A non-default initiative formula to roll. Otherwise the system default is used.

messageOptions Object

Additional options with which to customize created Chat Messages

Returns:

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

Type
Promise.<Combat>

(async) rollNPC(…args)

Source:

Roll initiative for all non-player actors who have not already rolled

Parameters:
Name Type Attributes Description
args * <repeatable>

Additional arguments forwarded to the Combat.rollInitiative method

(async) setInitiative(id, value)

Source:

Set initiative for a single Combatant within the Combat encounter. Turns will be updated to keep the same combatant as current in the turn order

Parameters:
Name Type Description
id string

The combatant ID for which to set initiative

value Number

A specific initiative value to set

setupTurns() → {Array}

Source:

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

Returns:
Type
Array

(async) startCombat() → {Promise}

Source:

Begin the combat encounter, advancing to round 1 and turn 1

Returns:
Type
Promise

(async) updateCombatant()

Source: