Skip to content

HookEvents beta ​

Interface of @v12-engine/engine

ts
export interface HookEvents

The map of hooks the engine runs, by name, to the event each one hands its handlers

Members ​

afterCast ​

ts
afterCast: AfterCast;

Its handlers get a AfterCast: an ability that went off

afterDamage ​

ts
afterDamage: AfterDamage;

Its handlers get a AfterDamage: damage that was dealt. The target may have died of it

afterDeath ​

ts
afterDeath: Death;

Its handlers get a Death: something dies. In death it still stands where it was; in afterDeath it is gone from the world

approach ​

ts
approach: Approach;

Its handlers get a Approach: where an attacker goes to fight a target from: its spot around it (see engagement.ts), or the target itself, in point, to change. A flank for cavalry, behind for assassins. Asked...

available ​

ts
available: Available;

Its handlers get a Available: whether a player may make a unit type or research an upgrade at all, before what it requires (see isAvailable): by default (available), what is of no race or of theirs (race)....

beforeAttack ​

ts
beforeAttack: BeforeAttack;

Its handlers get a BeforeAttack: an attack going off, as the engine has it: change what it does, or call it off. target is left out for an attack at the ground. splash is the radius of an attack that hits an area;...

beforeBuff ​

ts
beforeBuff: BeforeBuff;

Its handlers get a BeforeBuff: a buff about to be put on, or put on again. Change how long it lasts or how strong it is, or call it off (immunity)

beforeBuy ​

ts
beforeBuy: BeforeBuy;

Its handlers get a BeforeBuy: an item about to be bought at a shop: change what it costs, or call it off with a reason

beforeCast ​

ts
beforeCast: BeforeCast;

Its handlers get a BeforeCast: an 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...

beforeDamage ​

ts
beforeDamage: BeforeDamage;

Its handlers get a BeforeDamage: damage about to be dealt, before armor and shields. Change amount or type, or cancel()

beforeDeath ​

ts
beforeDeath: BeforeDeath;

Its handlers get a BeforeDeath: something is about to die. cancel() keeps it alive: it is then up to the handler what health it has

beforeDeposit ​

ts
beforeDeposit: BeforeDeposit;

Its handlers get a BeforeDeposit: resources a worker hands in: change amount (more from mines near the keep), or call it off

beforeDrop ​

ts
beforeDrop: BeforeDrop;

Its handlers get a BeforeDrop: an item about to be put down: call it off with a reason (a cursed blade)

beforeEffect ​

ts
beforeEffect: BeforeEffect;

An effect about to reach one target: cancel it for that one (BeforeEffect).

beforeHeal ​

ts
beforeHeal: BeforeHeal;

Its handlers get a BeforeHeal: health about to be given back. Change amount, or cancel()

beforeOrder ​

ts
beforeOrder: BeforeOrder;

Its handlers get a BeforeOrder: an order about to be given to a unit. Set rejected to refuse it

beforePause ​

ts
beforePause: BeforePause;

Its handlers get a BeforePause: a player asks for a pause (see askPause): how many they have left before this one (left), and how long it lasts at most (seconds, which can be changed); call it off with a reason

beforePickUp ​

ts
beforePickUp: BeforePickUp;

Its handlers get a BeforePickUp: an item about to be picked up off the ground (ground its id there): call it off with a reason

beforeProduce ​

ts
beforeProduce: BeforeProduce;

Its handlers get a BeforeProduce: something about to be made: a unit trained, an upgrade researched, a building upgraded, a hero brought back, a structure put down by a worker. Change what it costs and how long it takes,...

beforeSurrender ​

ts
beforeSurrender: BeforeSurrender;

Its handlers get a BeforeSurrender: a player is about to give up (see surrender): call it off with a reason, as a game that does not let them before a time

beforeTalk ​

ts
beforeTalk: BeforeTalk;

Its handlers get a BeforeTalk: a player about to ping the map or say a line (see ping, chat): change the words (text) or who hears them (to), or call it off: a muted player, a word filter, no talking in a...

beforeTrade ​

ts
beforeTrade: BeforeTrade;

Its handlers get a BeforeTrade: resources about to be given to an ally (see give): change how much arrives (received), or call it off with a reason: no trading in the first minutes, a cap on what goes to one player

beforeXp ​

ts
beforeXp: BeforeXp;

Its handlers get a BeforeXp: experience about to go to a hero: change amount (the killer gets more), or make it 0. from is what was killed, when that is where it comes from

buffEnd ​

ts
buffEnd: BuffEnd;

Its handlers get a BuffEnd: a buff that came off: it ran out (expired), or was taken off. Not called for the buffs of something that dies

canAttack ​

ts
canAttack: CanAttack;

Its handlers get a CanAttack: whether an attacker may attack a target: what the engine makes of it (its attack's targets, whether they are enemies) is in cancelled, to change. A buff that lets a unit hit what...

canCast ​

ts
canCast: CanCast;

Its handlers get a CanCast: whether an ability can be used now: what the engine makes of it (level, cooldown, mana, silence) is cancelled with its reason: cancelled = false clears it ("free while Clearcasting"),...

canHarvest ​

ts
canHarvest: CanHarvest;

Its handlers get a CanHarvest: whether a worker may gather from a resource: by default, a resource of a kind it gathers (harvester.ids). Refuse it for a game's own rule: a mine only its owner's cursed mine stands...

canLearn ​

ts
canLearn: CanLearn;

Its handlers get a CanLearn: whether a hero may put a point into an ability: what the engine makes of it in cancelled, to change. The screen hears of it with what the hero can learn

canPlace ​

ts
canPlace: CanPlace;

Its handlers get a CanPlace: whether a structure may be placed. cancel(reason) refuses it, with what the player is told

canTarget ​

ts
canTarget: CanTarget;

Its handlers get a CanTarget: whether an ability may be used on a target: what the engine makes of it (the ability's targets) is cancelled, with its reason: cancelled = false to clear ("can target allied...

death ​

ts
death: Death;

Its handlers get a Death: something dies. In death it still stands where it was; in afterDeath it is gone from the world

detour ​

ts
detour: Detour;

Its handlers get a Detour: a unit is about to go round units standing in its way (around), by point, which is longer ground units more than the straight way to the next corner of its path (see RuleSettings.movement.goesAround):...

effectLanded ​

ts
effectLanded: EffectLanded;

An effect reached one target, its handler done (EffectLanded).

fallenHero ​

ts
fallenHero: FallenHero;

Whether what died stays in the world's entities, out of the world, to be brought back (FallenHero).

formation ​

ts
formation: Formation;

Its handlers get a Formation: units ordered to a point together have their places in a formation worked out (FormationDef, formationPoints): change any in points, by the unit's id, or add or remove some. units...

idle ​

ts
idle: Idle;

Its handlers get a Idle: a unit with nothing to do, this tick: no orders. Set handled and do what it does instead of what idle units do (fight back, go for enemies that come close, which is only for those...

made ​

ts
made: Entity;

Something just made, its type's parts set (abilities, an inventory, an attack), not in the world yet: what a pack gives it of its own, as the heroes pack makes a hero of a hero's type (makeHero) and stocks a shop.

makeWay ​

ts
makeWay: MakeWay;

Its handlers get a MakeWay: an ally standing in a unit's way is asked to step aside, to point (see RuleSettings.movement.makesWay, lookAhead): change where it goes, or make it null to leave it standing....

mapCamp ​

ts
mapCamp: FromMapCamp;

A camp placed on a map is in the world, see mapObject

mapObject ​

ts
mapObject: FromMapObject;

Something placed on a map has become an entity, as the world is made from the map: what the game does with its own fields

mapRegion ​

ts
mapRegion: FromMapRegion;

A region of a map is an area of the world, see mapObject

mapStart ​

ts
mapStart: FromMap;

The world made from a map is all there, about to start (FromMap): what a pack starts from the map's own data.

morphed ​

ts
morphed: Morphed;

Something became another type where it stands (morph): what a pack gives it of its own for the new type (Morphed).

produced ​

ts
produced: Produced;

Its handlers get a Produced: something was made: a unit trained (unit), research done (level), a building upgraded, a hero brought back

remove ​

ts
remove: Entity;

Something left the world for good, at the end of the tick it died in

requirement ​

ts
requirement: Requirement;

Its handlers get a Requirement: whether a player may make something, as far as what it requires goes: a unit, a level of research (level), what a building upgrades to, a structure. What the engine makes of it (the...

spawn ​

ts
spawn: Entity;

Something came into the world, and is in it now

stats ​

ts
stats: StatsHook;

Its handlers get a StatsHook: the stats of an entity being added up, once what the engine knows of (its type, levels, research, items, buffs) is in: add more, as a stat change ({ stats: { armor: 2 } }, percent:...

supplyCap ​

ts
supplyCap: SupplyCap;

Its handlers get a SupplyCap: a player's cap of a pool of supply, once what their buildings provide is added up (see the supply system): change cap (a starting amount, an upgrade, a rule of the game's own). The...

targetScore ​

ts
targetScore: TargetScore;

Its handlers get a TargetScore: how much a unit wants to attack something, as it looks for a target by itself. Higher is picked first: raise or lower score, or make it -Infinity to pass the target over. Towers...

visible ​

ts
visible: Visible;

Its handlers get a Visible: whether a team sees an entity of someone else's: what the fog and invisibility make of it in visible, to change. Units in brush seen only from up close; a watchtower. Asked very often: keep it cheap