Skip to content

EffectContext beta ​

Interface of @v12-engine/engine

ts
export interface EffectContext

What an effect is run with: the world, the caster, the ability and its level, the target and where it landed

Members ​

ability ​

ts
ability: AbilityDef;

The definition of the ability being cast

caster ​

ts
caster: Entity;

The unit that cast the ability

charged ​

ts
charged?: boolean;

The ability went off charged, see charge on the ability

damage ​

ts
damage?: number;

For the effects of a trigger set off by damage (onDamaged, onAbilityHit, an onHit): the damage that did, after armor and shields, for the formula byDamage and a game's own amounts

distance ​

ts
distance?: number;

How far what carried the effect here has come, for what a missile does

heading ​

ts
heading?: number;

The way the effects face, for those with a shape (EffectCommon.shape): radians, as a unit's facing. From where they go off from to where they landed when left out (effectHeading): a zone keeps the way it was cast, or the way the unit it follows faces

held ​

ts
held?: number;

For an ability held to charge and let go (AbilityDef.hold): how full it was, 0 let go at once to 1 full. Its amounts are grown by it (HoldDef.scale); a game's own amounts read it. Carried by its missiles

interval ​

ts
interval?: number;

For an effect that is kept up all the time (a passive asked every round): the seconds since it was last asked. Something that works per second multiplies by this, rather than counting on how often it is asked

level ​

ts
level: number;

Level the ability was cast at

origin ​

ts
origin?: Entity | Vec2;

What the effects go off from, when not the caster: a unit of its (a ball, a shadow, a soldier) or a place. A missile starts there and aims from there, an area of the effects never takes it in, and the strike the screens hear says it came from there; the caster stays who does it (whose the damage and the kills are, whose stats scale it). The caster when left out (effectOrigin)

point ​

ts
point: Vec2;

Where the ability landed: the target, the chosen spot, or the caster

share ​

ts
share?: number;

What part of their amounts the effects come to (damage, heal, mana): less on every spring of a missile that bounces (EffectFields.bounce). All of it when left out; a game's own effect with an amount multiplies by it too

stacks ​

ts
stacks?: number;

How many of the buff that ran out there were, for what happens when it does

target ​

ts
target?: Entity;

The unit the ability was cast on, if any

world ​

ts
world: World;

The world the ability is cast in