Skip to content

@vttforge/core / CombatLike

Interface: CombatLike<System> ​

An encounter.

Extends ​

Type Parameters ​

System ​

System = Record<string, unknown>

Properties ​

active ​

readonly active: boolean


combatant ​

readonly combatant: CombatantLike<Record<string, unknown>> | null


combatants ​

readonly combatants: EmbeddedCollection<CombatantLike<Record<string, unknown>>>


current ​

readonly current: CombatHistoryData


documentName ​

readonly documentName: string

'Actor', 'Item', 'ActiveEffect', and so on.

Inherited from ​

DocumentMembers.documentName


flags ​

readonly flags: DocumentFlags

Inherited from ​

DocumentMembers.flags


id ​

readonly id: string | null

Inherited from ​

DocumentMembers.id


img ​

readonly img: string | null

Inherited from ​

DocumentMembers.img


isActive ​

readonly isActive: boolean


isOwner ​

readonly isOwner: boolean

Whether the current user owns this document.

Inherited from ​

DocumentMembers.isOwner


name ​

readonly name: string

Inherited from ​

DocumentMembers.name


nextCombatant ​

readonly nextCombatant: CombatantLike<Record<string, unknown>> | null


parent ​

readonly parent: DocumentMembers<Record<string, unknown>> | null

The document this one is embedded in, or null at the top level.

Inherited from ​

DocumentMembers.parent


previous ​

readonly previous: CombatHistoryData


round ​

readonly round: number


scene ​

readonly scene: SceneLike<Record<string, unknown>> | null


started ​

readonly started: boolean


system ​

readonly system: System

The type data model instance. Its fields are the schema's fields.

Inherited from ​

DocumentMembers.system


turn ​

readonly turn: number | null


turns ​

readonly turns: CombatantLike<Record<string, unknown>>[]


type ​

readonly type: string

The subtype, as declared under documentTypes in the manifest.

Inherited from ​

DocumentMembers.type


uuid ​

readonly uuid: string

Inherited from ​

DocumentMembers.uuid


visible ​

readonly visible: boolean

Methods ​

delete() ​

delete(operation?): Promise<CombatLike<System> | undefined>

Parameters ​

operation? ​

Record<string, unknown>

Returns ​

Promise<CombatLike<System> | undefined>

Inherited from ​

DocumentMembers.delete


endCombat() ​

endCombat(): Promise<CombatLike<System>>

Returns ​

Promise<CombatLike<System>>


getCombatantsByActor() ​

getCombatantsByActor(actor): CombatantLike<Record<string, unknown>>[]

Both return arrays since v14. The singular pair is deprecated.

Parameters ​

actor ​

string | ActorLike<Record<string, unknown>, ItemLike<Record<string, unknown>>>

Returns ​

CombatantLike<Record<string, unknown>>[]


getCombatantsByToken() ​

getCombatantsByToken(token): CombatantLike<Record<string, unknown>>[]

Parameters ​

token ​

string | TokenDocumentLike<Record<string, unknown>>

Returns ​

CombatantLike<Record<string, unknown>>[]


getFlag() ​

getFlag<T>(scope, key): T | undefined

Type Parameters ​

T ​

T = unknown

Parameters ​

scope ​

string

key ​

string

Returns ​

T | undefined

Inherited from ​

DocumentMembers.getFlag


nextRound() ​

nextRound(): Promise<CombatLike<System>>

Returns ​

Promise<CombatLike<System>>


nextTurn() ​

nextTurn(): Promise<CombatLike<System>>

Returns ​

Promise<CombatLike<System>>


previousRound() ​

previousRound(): Promise<CombatLike<System>>

Returns ​

Promise<CombatLike<System>>


previousTurn() ​

previousTurn(): Promise<CombatLike<System>>

Returns ​

Promise<CombatLike<System>>


resetAll() ​

resetAll(options?): Promise<CombatLike<System>>

Parameters ​

options? ​
updateTurn? ​

boolean

Returns ​

Promise<CombatLike<System>>


rollAll() ​

rollAll(options?): Promise<CombatLike<System>>

Parameters ​

options? ​

Record<string, unknown>

Returns ​

Promise<CombatLike<System>>


rollInitiative() ​

rollInitiative(ids, options?): Promise<CombatLike<System>>

Roll initiative for the named combatants.

messageMode replaced messageOptions.rollMode in v14.

Parameters ​

ids ​

readonly string[]

options? ​
formula? ​

string | null

messageMode? ​

string

messageOptions? ​

Record<string, unknown>

updateTurn? ​

boolean

Returns ​

Promise<CombatLike<System>>


rollNPC() ​

rollNPC(options?): Promise<CombatLike<System>>

Parameters ​

options? ​

Record<string, unknown>

Returns ​

Promise<CombatLike<System>>


setFlag() ​

setFlag(scope, key, value): Promise<CombatLike<System>>

Parameters ​

scope ​

string

key ​

string

value ​

unknown

Returns ​

Promise<CombatLike<System>>

Inherited from ​

DocumentMembers.setFlag


setInitiative() ​

setInitiative(id, value): Promise<void>

Parameters ​

id ​

string

value ​

number

Returns ​

Promise<void>


setupTurns() ​

setupTurns(): CombatantLike<Record<string, unknown>>[]

Returns ​

CombatantLike<Record<string, unknown>>[]


startCombat() ​

startCombat(): Promise<CombatLike<System>>

Returns ​

Promise<CombatLike<System>>


toObject() ​

toObject(source?): Record<string, unknown>

A plain-object copy. source reads the stored data instead of the prepared data.

Parameters ​

source? ​

boolean

Returns ​

Record<string, unknown>

Inherited from ​

DocumentMembers.toObject


unsetFlag() ​

unsetFlag(scope, key): Promise<CombatLike<System>>

Parameters ​

scope ​

string

key ​

string

Returns ​

Promise<CombatLike<System>>

Inherited from ​

DocumentMembers.unsetFlag


update() ​

update(data, operation?): Promise<CombatLike<System> | undefined>

Parameters ​

data ​

Record<string, unknown>

operation? ​

Record<string, unknown>

Returns ​

Promise<CombatLike<System> | undefined>

Inherited from ​

DocumentMembers.update

MIT licensed.