Abilities cookbook
Twenty-five famous abilities from Warcraft III and League of Legends, built end to end. Each block is a whole file: the docs test type-checks it, and packages/engine/tests/cookbook.test.ts loads every block into one game and casts it.
| Ability | Game | How | Stands on |
|---|---|---|---|
| Storm Bolt | WC3 | data, a duration in code | a homing missile, a stun, EffectValue |
| Blizzard | WC3 | data | a channel of waves |
| Bash | WC3 | data | onHit with chance |
| Chain Lightning | WC3 | data | a missile's bounce |
| Death Coil | WC3 | data | an if on tags |
| Starfall | WC3 | data | a channel around the caster |
| Metamorphosis | WC3 | data | a morph |
| Resurrection | WC3 | data | revive |
| Water Elemental | WC3 | data | a summon |
| Devotion Aura | WC3 | data | an aura |
| Orb of Deception | League | data | returns, hitsOnReturn |
| Spirit Rush | League | data | recast, seek, when |
| Wind Wall | League | data | a line of things that blocksMissiles |
| Sonic Wave | League | data | a recast to the marked, revealed |
| Death Sentence | League | data | a hook that marks, a recast that leaps |
| Zed's shadows | League | data | proxies, a recast that swaps |
| Orianna's ball | League | data and a listener | proxies, sendProxy |
| Powder Keg | League | data | uses, burst and its chain |
| Jhin's fourth shot | League | data | a pool of ammo, onHit every |
| Death from Below | League | data and a condition in code | a cross, an execute, refresh |
| Rumble's heat | League | data | a pool with thresholds, a zone that follows |
| Hijack | League | data | stealAbility |
| Piercing Arrow | League | data | a hold |
| Rebirth | League | data | onFatal and a morph |
| Mark of the Kindred | League | data, the hunts a system | revealed, onCarrierDeath |
Put the packs a recipe exports in Rules.packs, its hooks in Rules.hooks, its listeners in Rules.listeners. How each looks is the client's: see Ability visuals.
Warcraft III
Storm Bolt
A hammer at an enemy: 100/225/350 damage and a 5-second stun, 3 on a hero. The stun's time differs by target, so it is a function asked per unit.
import type { AbilityDef, BuffDef } from '@v12-engine/engine'
export const stormBoltStun: BuffDef = { id: 'stormBoltStun', name: 'Storm Bolt', harmful: true, duration: 5, stun: true }
export const stormBolt: AbilityDef = {
id: 'stormBolt',
name: 'Storm Bolt',
target: 'unit',
targets: { enemies: true },
range: 6,
manaCost: 75,
cooldown: 9,
effects: [
{
type: 'missile',
homing: true,
speed: 10,
effects: [
{ type: 'damage', amount: [100, 225, 350] },
{ type: 'buff', buff: 'stormBoltStun', duration: (_context, target) => (target?.def.hero ? 3 : 5) }
]
}
]
}Blizzard
Waves of ice on a spot while the caster channels.
import type { AbilityDef } from '@v12-engine/engine'
export const blizzard: AbilityDef = {
id: 'blizzard',
name: 'Blizzard',
target: 'point',
range: 8,
manaCost: 75,
cooldown: 6,
aim: { shape: 'circle', radius: 2 },
effects: [],
channel: { duration: 6, every: 1, effects: [{ type: 'damage', amount: [30, 40, 50], radius: 2 }] }
}Bash
A chance on every attack that lands to stun and hurt.
import type { AbilityDef, BuffDef } from '@v12-engine/engine'
export const bashed: BuffDef = { id: 'bashed', name: 'Bashed', harmful: true, duration: 2, stun: true }
export const bash: AbilityDef = {
id: 'bash',
name: 'Bash',
target: 'passive',
effects: [
{
type: 'onHit',
chance: [0.2, 0.3, 0.4],
effects: [
{ type: 'buff', buff: 'bashed' },
{ type: 'damage', amount: 25 }
]
}
]
}Chain Lightning
A bolt that jumps to the nearest enemy it hasn't hit, three more times, 15% weaker each time.
import type { AbilityDef } from '@v12-engine/engine'
export const chainLightning: AbilityDef = {
id: 'chainLightning',
name: 'Chain Lightning',
target: 'unit',
targets: { enemies: true },
range: 7,
manaCost: 120,
cooldown: 9,
effects: [
{ type: 'missile', homing: true, speed: 30, bounce: { count: 3, range: 5, falloff: 0.15 }, effects: [{ type: 'damage', amount: [85, 125, 180] }] }
]
}Death Coil
Hurts a living enemy, heals an undead ally. The undead are a unit type's tags.
import type { AbilityDef, UnitTypeDef } from '@v12-engine/engine'
export const ghoul: UnitTypeDef = {
id: 'ghoul',
name: 'Ghoul',
kind: 'unit',
radius: 0.5,
tags: ['undead'],
stats: { health: 340, attackDamage: 13, attackSpeed: 1, attackRange: 0.6, moveSpeed: 4 },
sight: 8
}
export const deathCoil: AbilityDef = {
id: 'deathCoil',
name: 'Death Coil',
target: 'unit',
targets: { allies: true, enemies: true, self: false },
range: 8,
manaCost: 75,
cooldown: 6,
effects: [
{
type: 'missile',
homing: true,
speed: 12,
effects: [
{
type: 'if',
target: { tags: ['undead'], is: 'ally' },
effects: [{ type: 'heal', amount: [200, 400, 600] }],
otherwise: [{ type: 'if', target: { notTags: ['undead'], is: 'enemy' }, effects: [{ type: 'damage', amount: [100, 200, 300] }] }]
}
]
}
]
}Starfall
Stars fall on every enemy around the caster while she channels.
import type { AbilityDef } from '@v12-engine/engine'
export const starfall: AbilityDef = {
id: 'starfall',
name: 'Starfall',
target: 'none',
ultimate: true,
manaCost: 200,
cooldown: 180,
effects: [],
channel: { duration: 30, every: 1.5, effects: [{ type: 'damage', amount: [50, 75, 100], radius: 10 }] }
}Metamorphosis
The Demon Hunter becomes a ranged demon for a minute, keeping his level, items, buffs and health share.
import type { AbilityDef, UnitTypeDef } from '@v12-engine/engine'
export const demonForm: UnitTypeDef = {
id: 'demonForm',
name: 'Demon Hunter (demon)',
kind: 'unit',
radius: 0.6,
stats: { health: 1500, attackDamage: 40, attackSpeed: 1, attackRange: 4, moveSpeed: 3.2 },
sight: 10,
attacks: [{ damagePoint: 0.3, acquisitionRange: 6, projectileSpeed: 12 }]
}
export const metamorphosis: AbilityDef = {
id: 'metamorphosis',
name: 'Metamorphosis',
target: 'none',
ultimate: true,
manaCost: 150,
cooldown: 180,
effects: [{ type: 'morph', into: 'demonForm', duration: 60 }]
}Resurrection
Brings up to six of your side's dead nearby back to life, whole.
import type { AbilityDef } from '@v12-engine/engine'
export const resurrection: AbilityDef = {
id: 'resurrection',
name: 'Resurrection',
target: 'none',
ultimate: true,
manaCost: 200,
cooldown: 240,
effects: [{ type: 'revive', count: 6, radius: 9 }]
}Water Elemental
A summon for a minute that follows its master and attacks whoever attacks it.
import type { AbilityDef, UnitTypeDef } from '@v12-engine/engine'
export const waterElemental: UnitTypeDef = {
id: 'waterElemental',
name: 'Water Elemental',
kind: 'unit',
radius: 0.5,
stats: { health: 525, attackDamage: 20, attackSpeed: 1, attackRange: 3, moveSpeed: 3 },
sight: 8,
attacks: [{ damagePoint: 0.3, acquisitionRange: 6, projectileSpeed: 10 }]
}
export const summonWaterElemental: AbilityDef = {
id: 'summonWaterElemental',
name: 'Summon Water Elemental',
target: 'none',
manaCost: 125,
cooldown: 20,
effects: [{ type: 'summon', unit: 'waterElemental', count: 1, lifetime: 60, follow: true }]
}Devotion Aura
Armor for every ally near the Paladin, kept up as they come and go.
import type { AbilityDef, BuffDef } from '@v12-engine/engine'
export const devotion: BuffDef = { id: 'devotion', name: 'Devotion Aura', stats: { armor: [1.5, 3, 4.5] } }
export const devotionAura: AbilityDef = {
id: 'devotionAura',
name: 'Devotion Aura',
target: 'passive',
effects: [{ type: 'aura', buff: 'devotion', radius: 9 }]
}League of Legends
Orb of Deception
Ahri's orb flies out and back, hitting each enemy both ways. (In League the way back is true damage: a beforeDamage hook reading the missile's returning would do that.)
import type { AbilityDef } from '@v12-engine/engine'
export const orbOfDeception: AbilityDef = {
id: 'orbOfDeception',
name: 'Orb of Deception',
target: 'direction',
range: 9,
manaCost: 60,
cooldown: 7,
effects: [
{ type: 'missile', speed: 15, distance: 9, radius: 0.6, returns: true, hitsOnReturn: true, effects: [{ type: 'damage', amount: [40, 65, 90] }] }
]
}Spirit Rush
Three dashes within ten seconds, the cooldown after the last. Where each lands, three bolts find the nearest enemies.
import { type AbilityDef } from '@v12-engine/engine'
export const spiritRush: AbilityDef = {
id: 'spiritRush',
name: 'Spirit Rush',
target: 'point',
range: 5,
ultimate: true,
manaCost: 100,
cooldown: [130, 105, 80],
recast: { window: 10, count: 2 },
effects: [
{ type: 'dash', distance: 5, speed: 30 },
{
type: 'missile',
when: 'landed',
count: 3,
spread: 2 * Math.PI,
speed: 16,
distance: 7,
seek: 6,
effects: [{ type: 'damage', amount: [60, 90, 120] }]
}
]
}Wind Wall
Five pieces of a unit type that blocksMissiles, laid across Yasuo's way for four seconds (ground objects pack).
import { type AbilityDef, groundObjectsPack, type UnitTypeDef } from '@v12-engine/engine'
export const windWallPiece: UnitTypeDef = {
id: 'windWallPiece',
name: 'Wind Wall',
kind: 'unit',
radius: 0.6,
stats: { health: 1 },
sight: 2,
invulnerable: true,
lifetime: 4,
blocksMissiles: 'enemies'
}
export const windWall: AbilityDef = {
id: 'windWall',
name: 'Wind Wall',
target: 'point',
range: 3,
cooldown: 25,
effects: [{ type: 'spawn', unit: 'windWallPiece', line: { count: 5, length: 4, across: true } }]
}
export const packs = [groundObjectsPack()]Sonic Wave
The wave marks and reveals who it hits. Cast again within three seconds and Lee Sin rushes to them, hitting harder the more health they've lost (moves and vision packs).
import { type AbilityDef, type BuffDef, movesPack, visionPack } from '@v12-engine/engine'
export const sonicWaveMark: BuffDef = { id: 'sonicWaveMark', name: 'Sonic Wave', harmful: true, duration: 3, revealed: true }
export const sonicWave: AbilityDef = {
id: 'sonicWave',
name: 'Sonic Wave',
target: 'direction',
range: 12,
manaCost: 50,
cooldown: 8,
recast: {
window: 3,
mark: 'sonicWaveMark',
effects: [
{ type: 'dash', to: 'target', speed: 30, effects: [{ type: 'damage', amount: [55, 80, 105], byMissingHealth: 0.08, damageType: 'physical' }] }
]
},
effects: [
{
type: 'missile',
speed: 40,
distance: 12,
radius: 0.6,
pierce: false,
effects: [
{ type: 'damage', amount: [55, 80, 105], damageType: 'physical' },
{ type: 'buff', buff: 'sonicWaveMark' }
]
}
]
}
export const packs = [movesPack(), visionPack()]Death Sentence
Thresh's hook holds the first enemy it meets. Cast again while it holds and he leaps to it.
import { type AbilityDef, type BuffDef, movesPack } from '@v12-engine/engine'
export const deathSentenceHeld: BuffDef = { id: 'deathSentenceHeld', name: 'Death Sentence', harmful: true, duration: 1.5, stun: true }
export const deathSentence: AbilityDef = {
id: 'deathSentence',
name: 'Death Sentence',
target: 'direction',
range: 11,
manaCost: 70,
cooldown: 18,
recast: { window: 1.5, mark: 'deathSentenceHeld', effects: [{ type: 'dash', to: 'target', speed: 25 }] },
effects: [
{
type: 'missile',
speed: 19,
distance: 11,
radius: 0.5,
pierce: false,
effects: [
{ type: 'damage', amount: [100, 140, 180] },
{ type: 'buff', buff: 'deathSentenceHeld' }
]
}
]
}
export const packs = [movesPack()]Zed's shadows
Living Shadow puts a shadow down; cast again, Zed swaps places with it. Razor Shuriken flies from him and from each shadow, in his name.
import { type AbilityDef, movesPack, type UnitTypeDef } from '@v12-engine/engine'
export const zedShadow: UnitTypeDef = {
id: 'zedShadow',
name: 'Living Shadow',
kind: 'unit',
radius: 0.4,
stats: { health: 1, moveSpeed: 4 },
sight: 4,
invulnerable: true
}
export const livingShadow: AbilityDef = {
id: 'livingShadow',
name: 'Living Shadow',
target: 'point',
range: 6.5,
cooldown: 20,
recast: { window: 5, target: 'none', effects: [{ type: 'swap', origin: { proxy: 'zedShadow', pick: 'newest', target: true } }] },
effects: [{ type: 'spawn', unit: 'zedShadow', duration: 5 }]
}
export const razorShuriken: AbilityDef = {
id: 'razorShuriken',
name: 'Razor Shuriken',
target: 'point',
range: 9,
cooldown: 6,
effects: [
{
type: 'missile',
speed: 17,
distance: 9,
radius: 0.4,
pierce: true,
origin: { proxy: 'zedShadow', pick: 'all', caster: true },
effects: [{ type: 'damage', amount: [80, 115, 150], damageType: 'physical' }]
}
]
}
export const packs = [movesPack()]Orianna's ball
Command: Attack throws the ball, hurting on the way, and it stays there. Dissonance pulses around it. A listener gives Orianna her ball as she spawns. (Calling the ball back when she walks off is a small system of your game's.)
import { type AbilityDef, defineListener, entitySpawned, type UnitTypeDef } from '@v12-engine/engine'
export const oriannaBall: UnitTypeDef = {
id: 'oriannaBall',
name: 'The Ball',
kind: 'unit',
radius: 0.3,
stats: { health: 1, moveSpeed: 6 },
sight: 4,
invulnerable: true
}
export const commandAttack: AbilityDef = {
id: 'commandAttack',
name: 'Command: Attack',
target: 'point',
range: 8,
cooldown: 6,
effects: [
{
type: 'missile',
speed: 12,
toPoint: true,
radius: 0.5,
pierce: true,
origin: { proxy: 'oriannaBall', caster: 'otherwise' },
effects: [{ type: 'damage', amount: [60, 90, 120] }]
},
{ type: 'sendProxy', speed: 12, origin: { proxy: 'oriannaBall' } }
]
}
export const commandDissonance: AbilityDef = {
id: 'commandDissonance',
name: 'Command: Dissonance',
target: 'none',
cooldown: 7,
effects: [{ type: 'damage', amount: [60, 105, 150], radius: 2.25, origin: { proxy: 'oriannaBall', caster: 'otherwise', at: 'proxy' } }]
}
export const listeners = [
defineListener({
event: entitySpawned,
id: 'cookbook.oriannaBall',
run(world, entity) {
if (entity.def.abilities?.includes('commandAttack')) world.spawn('oriannaBall', entity.owner, { x: entity.pos.x + 1, z: entity.pos.z })
}
})
]Powder Keg
Gangplank's barrels go down after three hits whatever they deal (uses). Where one dies it blows up, setting off nearby barrels in turn (burst, ground objects pack).
import { type AbilityDef, groundObjectsPack, type UnitTypeDef } from '@v12-engine/engine'
export const powderKegBarrel: UnitTypeDef = {
id: 'powderKegBarrel',
name: 'Powder Keg',
kind: 'unit',
radius: 0.4,
stats: { health: 3 },
sight: 2,
uses: 3,
burst: { ability: 'powderKegBlast', chain: 4 }
}
export const powderKeg: AbilityDef = {
id: 'powderKeg',
name: 'Powder Keg',
target: 'point',
range: 10,
cooldown: 18,
effects: [{ type: 'spawn', unit: 'powderKegBarrel' }]
}
export const powderKegBlast: AbilityDef = {
id: 'powderKegBlast',
name: 'Powder Keg',
target: 'none',
effects: [{ type: 'damage', amount: 200, radius: 3, damageType: 'physical' }]
}
export const packs = [groundObjectsPack()]Jhin's fourth shot
Four shots, one per attack; the fourth hits harder the more health the target has lost. Empty, he reloads for 2.5 seconds (resources pack).
import { type AbilityDef, resourcesPack, type UnitTypeDef } from '@v12-engine/engine'
export const whisper: AbilityDef = {
id: 'whisper',
name: 'Whisper',
target: 'passive',
effects: [{ type: 'onHit', every: 4, effects: [{ type: 'damage', amount: 40, byMissingHealth: 0.15, damageType: 'physical' }] }]
}
export const jhin: UnitTypeDef = {
id: 'jhin',
name: 'Jhin',
kind: 'unit',
radius: 0.5,
stats: { health: 2000, attackDamage: 60, attackSpeed: 2, attackRange: 5.5, moveSpeed: 3.3 },
sight: 12,
attacks: [{ damagePoint: 0.2, acquisitionRange: 0, projectileSpeed: 30 }],
abilities: ['whisper'],
pools: { ammo: { name: 'Ammo', max: 4, reload: 2.5 } },
attackCost: { ammo: 1 }
}
export const packs = [resourcesPack()]Death from Below
An X where Pyke aims: anyone left under a health threshold is executed and the ultimate resets; the rest take damage. The threshold is a number of health growing by level, so the condition is a function.
import type { AbilityDef } from '@v12-engine/engine'
const threshold = [250, 400, 550]
export const deathFromBelow: AbilityDef = {
id: 'deathFromBelow',
name: 'Death from Below',
target: 'point',
range: 7.5,
ultimate: true,
manaCost: 100,
cooldown: [120, 100, 80],
effects: [
{
type: 'if',
shape: 'cross',
length: 8,
width: 0.6,
target: (context, unit) => unit.health <= threshold[Math.min(context.level, threshold.length) - 1],
effects: [
{ type: 'damage', amount: 9999, damageType: 'true' },
{ type: 'refresh', on: 'caster' }
],
otherwise: [{ type: 'damage', amount: [100, 150, 200], damageType: 'physical' }]
}
]
}Rumble's heat
Abilities heat Rumble up. At 50 his danger zone kicks in; at 100 he overheats, silenced, and his heat empties as it ends. Flamespitter burns a cone in front of him as he walks (resources pack).
import { type AbilityDef, type BuffDef, resourcesPack, type UnitTypeDef } from '@v12-engine/engine'
export const dangerZone: BuffDef = { id: 'dangerZone', name: 'Danger Zone' }
export const overheated: BuffDef = { id: 'overheated', name: 'Overheated', duration: 3, silence: true }
export const flamespitter: AbilityDef = {
id: 'flamespitter',
name: 'Flamespitter',
target: 'none',
cooldown: 6,
gain: { heat: 10 },
effects: [
{ type: 'zone', duration: 3, follow: 'caster', effects: [{ type: 'damage', amount: [20, 35, 50], shape: 'cone', length: 5, angle: Math.PI / 2 }] }
]
}
export const rumble: UnitTypeDef = {
id: 'rumble',
name: 'Rumble',
kind: 'unit',
radius: 0.5,
stats: { health: 2000, attackDamage: 60, attackSpeed: 1, attackRange: 0.8, moveSpeed: 3.4 },
sight: 12,
attacks: [{ damagePoint: 0.3, acquisitionRange: 0 }],
abilities: ['flamespitter'],
pools: {
heat: {
name: 'Heat',
color: '#ff6a00',
max: 100,
start: 0,
decay: 10,
idle: 4,
thresholds: [
{ at: 50, buff: 'dangerZone', kept: true },
{ at: 100, buff: 'overheated', empties: true }
]
}
}
}
export const packs = [resourcesPack()]Hijack
Sylas takes his target's ultimate and casts it once as his own (ability changes pack).
import { abilityChangesPack, type AbilityDef } from '@v12-engine/engine'
export const hijack: AbilityDef = {
id: 'hijack',
name: 'Hijack',
target: 'unit',
targets: { enemies: true },
range: 9.5,
ultimate: true,
cooldown: [100, 80, 60],
effects: [{ type: 'stealAbility' }]
}
export const packs = [abilityChangesPack()]Piercing Arrow
Varus draws as he walks, slowed. Let go, the arrow flies farther and hits harder the longer he held, up to 1.25 seconds (holds pack).
import { type AbilityDef, type BuffDef, holdsPack } from '@v12-engine/engine'
export const drawing: BuffDef = { id: 'drawing', name: 'Drawing', percent: { moveSpeed: -0.2 } }
export const piercingArrow: AbilityDef = {
id: 'piercingArrow',
name: 'Piercing Arrow',
target: 'direction',
manaCost: 70,
cooldown: 16,
hold: { max: 1.25, upTo: 4, range: { from: 9, to: 16 }, scale: 1.5, buff: 'drawing' },
effects: [
{
type: 'missile',
speed: 40,
distance: 16,
toPoint: true,
pierce: true,
falloff: 0.15,
effects: [{ type: 'damage', amount: [60, 110, 160], damageType: 'physical' }]
}
]
}
export const packs = [holdsPack()]Rebirth
A killing blow turns Anivia into an egg. If it lives six seconds she's back; if it breaks she dies. Once every four minutes.
import type { AbilityDef, UnitTypeDef } from '@v12-engine/engine'
export const aniviaEgg: UnitTypeDef = {
id: 'aniviaEgg',
name: 'Eggnivia',
kind: 'unit',
radius: 0.5,
stats: { health: 400, armor: 10 },
sight: 6
}
export const rebirth: AbilityDef = {
id: 'rebirth',
name: 'Rebirth',
target: 'passive',
cooldown: 240,
effects: [{ type: 'onFatal', cooldown: 240, effects: [{ type: 'morph', into: 'aniviaEgg', duration: 6 }] }]
}Mark of the Kindred
The marked target is seen by Kindred's team wherever it goes; dying with the mark gives them a stack for good (onCarrierDeath, vision pack). Only counting their own takedowns needs an entityDied listener, and choosing hunt targets is a system of your game's.
import { type AbilityDef, type BuffDef, visionPack } from '@v12-engine/engine'
export const kindredMarks: BuffDef = { id: 'kindredMarks', name: 'Marks', maxStacks: 99, stats: { attackRange: 0.25 }, perStack: true }
export const kindredHunted: BuffDef = {
id: 'kindredHunted',
name: 'Mark of the Kindred',
harmful: true,
duration: 30,
revealed: true,
onCarrierDeath: [{ type: 'buff', buff: 'kindredMarks', stack: true, on: 'caster' }]
}
export const kindredMark: AbilityDef = {
id: 'kindredMark',
name: 'Mark of the Kindred',
target: 'unit',
targets: { enemies: true },
range: 12,
cooldown: 45,
effects: [{ type: 'buff', buff: 'kindredHunted' }]
}
export const packs = [visionPack()]What is still a system
A few abilities are one champion's own idea and are best written as a small system of your game's (defineComponent, a system in Rules.systems, runEffects, the hooks): Fiora's vitals, Kindred's hunts, Pyke's grey health, Taliyah's speed by walls, Kalista's hop after each attack, a ball that returns to its owner. None needs the engine changed. See Write your own effect.