BeforeCast beta
Interface of @v12-engine/engine
export interface BeforeCastAn ability about to go off, before it is paid for. Change what it costs, or call it off with a reason. Whether the caster has the mana was already checked against the ability's own cost before it wound up: a lower cost here does not let it cast with less than that
Members
ability
readonly ability: AbilityDef;The ability being cast
cancel
cancel(reason?: MessageRef): void;Stops it. The reason is what the player is told, where this hook tells them (reason)
cancelled
cancelled: boolean;Whether a handler has called the cast off; set by cancel()
caster
readonly caster: Entity;The unit that casts
cooldown
cooldown: number;Seconds until it can be used again
item
readonly item?: ItemInstance;What it is cast from, for an item's ability
level
readonly level: number;The level of the ability it is cast at
manaCost
manaCost: number;The mana it costs; a handler may change it
point
readonly point: Vec2;The point it is cast at (the target's place for a unit target)
reason
reason?: MessageRef;What the player is told of why it was called off
target
readonly target?: Entity;The unit it is cast on, left out for a point or no target