Skip to content

BeforeDamage beta ​

Interface of @v12-engine/engine

ts
export interface BeforeDamage

Damage about to be dealt, before armor and shields. Change amount or type, or cancel()

Members ​

ability ​

ts
readonly ability?: string;

The ability that deals it, by id. Left out for a basic attack

amount ​

ts
amount: number;

The damage in hit points before armor and shields; a handler may change it

attack ​

ts
readonly attack: boolean;

A basic attack, not an ability

cancel ​

ts
cancel(reason?: MessageRef): void;

Stops it. The reason is what the player is told, where this hook tells them (reason)

cancelled ​

ts
cancelled: boolean;

Whether a handler has called it off; set by cancel()

crit ​

ts
readonly crit: boolean;

Whether the blow is a critical hit

source ​

ts
readonly source?: Entity;

The entity that deals it, left out when nothing does (the rules, a trap)

tags ​

ts
readonly tags?: readonly string[];

Words of the game's own about it, see DamageOptions.tags

target ​

ts
readonly target: Entity;

The entity about to take the damage

type ​

ts
type: DamageType;

The damage type, which armor and resistance read; a handler may change it