Skip to content

AbilityDef ​

Interface of @v12-engine/engine

ts
export interface AbilityDef

The definition of an ability: how it is aimed, what it costs and the effects it has

Members ​

ai ​

ts
ai?: (view: AbilityAiView, caster: EntityState, level: number) => {
        point: Vec2;
        target?: number;
        to?: Vec2;
    } | null | undefined;

How a computer player uses it, from what it sees (see AiView): where, or null for not now. What the engine works out from its core effects when it gives nothing; an ability of the game's own effects has to say

aim ​

ts
aim?: {
        shape: 'circle';
        radius: Scaled;
    } | {
        shape: 'line';
        length: Scaled;
        width: Scaled;
    } | {
        shape: 'cone';
        length: Scaled;
        angle: number;
    } | {
        shape: 'ring';
        radius: Scaled;
        width: Scaled;
    } | {
        shape: 'arc';
        radius: Scaled;
        angle: number;
        width: Scaled;
    } | {
        shape: 'rect';
        length: Scaled;
        width: Scaled;
    } | {
        shape: 'cross';
        length: Scaled;
        width: Scaled;
    };

The ground it covers, when that is not what its effects say: see aimOf

attackRange ​

ts
attackRange?: boolean;

The target may be as far away as the caster's attacks reach, and range farther

autoAim ​

ts
autoAim?: (world: World, caster: Entity, state: AbilityState) => {
        target?: number;
        point?: Vec2;
    } | null | undefined;

Autocast in code, for any kind of ability: where to use it now, or nothing. Asked when the unit has nothing to do, the ability is switched to autocast, ready and paid for. Without it, only abilities cast on a unit autocast, on the worst-off target their core effects would do good to

autocast ​

ts
autocast?: boolean;

Units use it on their own when they have nothing else to do. The player can switch this off

basedOn ​

ts
basedOn?: string;

The definition this one is a copy of, made from the data (copyOf in a data.json, the editor's Copy as new): what it is drawn, heard and pictured as where the game gives it no look of its own

castTime ​

ts
castTime?: number;

Seconds between starting to cast and the effect. The caster stands still for as long and cannot be called away: what it is told to do in the meantime, it does right after. None when left out

castTimeOf ​

ts
castTimeOf?: (world: World, caster: Entity, level: number) => number;

Seconds of the wind-up, in code: shortened by haste, say. castTime when left out

channel ​

ts
channel?: {
        duration: number | ((world: World, caster: Entity, level: number) => number);
        every?: number;
        effects?: EffectDef[];
        run?: (world: World, caster: Entity, level: number, target: Entity | undefined, point: Vec2) => void;
        interrupted?: (world: World, caster: Entity, level: number) => void;
        finished?: EffectDef[];
        breaksOnDamage?: boolean;
        leash?: number;
        aimed?: boolean;
        walks?: boolean;
    };

Kept up once it went off: the caster stands, for duration seconds, doing it every every seconds (effects, or code), until it is done or interrupted (another order, a stun), when interrupted runs. An ice storm

charge ​

ts
charge?: string;

A buff of the caster that charges the ability when it has as many stacks as it can: the ability shows it, its charged effects do their other thing, and casting it takes the buff away

charges ​

ts
charges?: {
        count: Scaled;
        refill: Scaled;
    };

Uses it holds, for one used so many times before it waits: count of them at the most, one more back every refill seconds while it holds fewer (shortened as the cooldown is). Each use spends one; with none left it is not ready. Its cooldown, where it has one, is then the time between two uses. Full when it is learned

cooldown ​

ts
cooldown?: Scaled;

Seconds before it can be used again

cost beta ​

ts
cost?: Record<string, Scaled>;

What it costs of the caster's pools (UnitTypeDef.pools), by pool, in a game with the resources pack (resourcesPack): it is not ready with less, and pays as it goes off (Akali's energy, a shot of ammo)

costGrowth beta ​

ts
costGrowth?: {
        buff: string;
        per: number;
    };

Its costs (its mana and cost) grow with the stacks of a buff of the caster's, in a game with the resources pack: times one and per for each stack (Kassadin's Riftwalk: per: 1, twice with one stack, three times with two)

describe ​

ts
describe?: (context: AbilityTextContext) => string | TextSegment[];

What it does, said in code instead of description: words with {values} in them, or words and values already put together

description ​

ts
description?: string;

What it does, in words: a template with values in braces, worked out for the caster as it is now ("Deals damage magic damage" shows "Deals 80 (50 + 60% ability power) magic damage"). The values are its own (values), or found in its effects: damage, heal, shield, amount, duration, radius, chance (in percent), range, cooldown, charges, refill, mana, count, distance (see abilityValues)

effects ​

ts
effects: EffectDef[];

What it does, one effect after the other, when it is cast

gain beta ​

ts
gain?: Record<string, Scaled>;

What it gives the caster's pools as it goes off, by pool, in a game with the resources pack: Rumble's heat, a fury's spender's opposite

healthCost ​

ts
healthCost?: Scaled;

Health it costs, as a part of all the caster can have. It cannot be cast with less than that left

hold beta ​

ts
hold?: HoldDef;

Held to charge and let go, in a game with the holds pack (holdsPack): the cast starts the hold where the caster stands, going on with what it was doing, and the release command (the key let go, or a click) sets it off, as full as it was held (HoldDef): farther, harder, or a tap's other effects. Paid as it is let go

hotkey ​

ts
hotkey?: string;

The key that casts it from the command card

how ​

ts
how?: string | ((hit: {
        caster: Entity;
        target: Entity;
        level: number;
        amount: number;
    }) => string | undefined);

How what its damage kills dies, for the screen ('burnt', 'frozen', 'blasted'): the death's how, which the view shows its way. A word, or one decided for each blow: by its level, its caster, what it hit. An effect's own (EffectDef.how) goes over it; the death hook has the last say

id ​

ts
id: string;

The ability's id, shared by every game: give it a prefix of the game's

levelStep ​

ts
levelStep?: number;

Hero levels between two levels of the ability. 2 when left out

manaCost ​

ts
manaCost?: Scaled;

Mana it costs per cast, by level

maxLevel ​

ts
maxLevel?: number;

Levels a hero can put into it. 3 when left out

name ​

ts
name: string;

What the player sees the ability called

passive ​

ts
passive?: EffectDef[];

What an ability that is cast does all the time besides, once it is learned: buffs, auras, onHit

piercesImmunity ​

ts
piercesImmunity?: boolean | ((world: World, target: Entity) => boolean);

Gets through a unit's immunity to spells (see UnitTypeDef.spellImmune), as an ultimate may. Or for the targets its function says

range ​

ts
range?: Scaled;

How far away the target may be

rangeOf ​

ts
rangeOf?: (world: World, caster: Entity, level: number) => number;

How far away the target may be, in code: the range on high ground, say. range is what the screen shows

recast beta ​

ts
recast?: AbilityRecast;

It may be cast again for a while after it is cast (AbilityRecast): Ahri's Spirit Rush thrice, Lee Sin's second Sonic Wave to the one the first marked, Lux's Lucent Singularity set off

requiresLevel ​

ts
requiresLevel?: number;

Hero level needed for the first level of the ability. 1 when left out, 6 for an ultimate

tags ​

ts
tags?: string[];

What kind of thing it is, for those who can keep out of its way: a buff that avoids one of these lets nothing of the ability happen to who carries it. ground is for what comes out of the ground or along it

target ​

ts
target: AbilityTarget;

none: happens at once. unit, point: needs a target, and the caster walks into range of it. direction: goes off from where the caster stands, towards where it was aimed. vector: two points, where it starts (walked into range of, its effects' origin) and the way it goes from there (their point): Death Ray, Seismic Shove. passive: always on, cannot be cast. Or a game's own (defineTargeting, Rules.targetings)

targets ​

ts
targets?: {
        allies?: boolean;
        enemies?: boolean;
        self?: boolean;
        kinds?: EntityKind[];
        layers?: Layer[];
        heroes?: boolean;
        tags?: string[];
    };

What may be targeted, for abilities cast on a unit

ultimate ​

ts
ultimate?: boolean;

A hero's ultimate: first learned at level 6 (unless requiresLevel says otherwise), what the AI uses on a crowd only (as it does what asks for a level), and what a game's own code can tell apart (what a possession of another hero leaves the hero's own: keeps)

upgrades beta ​

ts
upgrades?: string[];

What it may be made into for good, chosen once (upgradeAbility, the upgradeAbility command), in a game with the ability changes pack (abilityChangesPack): Viktor's augments, Engineering Upgrade's better abilities. The new one takes its place at its level and cooldown

values ​

ts
values?: Record<string, AbilityValueDef>;

Values of its own to put in its description, by name: an amount and what of the caster scales it, or worked out in code