Skip to content

Missiles ​

The missile effect sends something flying: an arrow, a bolt that chases its target, a grenade, a boomerang, a hook. What it does to what it hits is its own effects list.

Quick start ​

ts
import type { AbilityDef } from '@v12-engine/engine'

const shockwave: AbilityDef = {
	id: 'shockwave',
	name: 'Shockwave',
	target: 'direction',
	range: 10,
	manaCost: 100,
	cooldown: 8,
	effects: [{ type: 'missile', speed: 14, distance: 10, radius: 1, pierce: true, effects: [{ type: 'damage', amount: [75, 130, 200] }] }]
}

A wave flies 10 cells from the caster toward where the player clicked, hurting every enemy it passes through.

Common tasks ​

Chase a unit ​

homing follows the unit it was cast on. Storm Bolt, Death Coil.

ts
import type { EffectDef } from '@v12-engine/engine'

const stormBolt: EffectDef = {
	type: 'missile',
	homing: true,
	speed: 10,
	effects: [
		{ type: 'damage', amount: 100 },
		{ type: 'buff', buff: 'stunned' }
	]
}

Stop at the first enemy ​

pierce: false stops at the first. pierce: 2 goes through two and stops at the third. blocked: true stops at buildings and trees.

ts
import type { EffectDef } from '@v12-engine/engine'

const lightBinding: EffectDef = { type: 'missile', speed: 12, distance: 11, radius: 0.6, pierce: 1, effects: [{ type: 'buff', buff: 'rooted' }] }

Fly to the spot and blow up there ​

toPoint stops at the spot clicked. onEnd runs where it ends.

ts
import type { EffectDef } from '@v12-engine/engine'

const rocket: EffectDef = { type: 'missile', speed: 20, distance: 12, toPoint: true, pierce: true, onEnd: [{ type: 'damage', amount: 150, radius: 2.5 }] }

Throw it in an arc ​

arc flies over everything and hits what is within radius where it lands.

ts
import type { EffectDef } from '@v12-engine/engine'

const grenade: EffectDef = { type: 'missile', toPoint: true, distance: 12, radius: 2, arc: { height: 3, time: 1 }, effects: [{ type: 'damage', amount: 120 }] }

Bounce to the next target ​

bounce springs on to the nearest it hasn't hit, count times, each falloff weaker. Chain Lightning.

ts
import type { EffectDef } from '@v12-engine/engine'

const glaive: EffectDef = { type: 'missile', homing: true, speed: 18, bounce: { count: 2, range: 6, falloff: 0.33 }, effects: [{ type: 'damage', amount: 80 }] }

Fire several in a fan ​

count and spread (radians, total). None of them hits what another already hit.

ts
import type { EffectDef } from '@v12-engine/engine'

const volley: EffectDef = { type: 'missile', count: 5, spread: Math.PI / 3, speed: 15, distance: 8, pierce: false, effects: [{ type: 'damage', amount: 40 }] }

Come back to the caster ​

returns flies back to the caster from where it ends. With hitsOnReturn it hits on the way back too (Ahri's orb).

ts
import type { EffectDef } from '@v12-engine/engine'

const orb: EffectDef = { type: 'missile', speed: 15, distance: 9, returns: true, hitsOnReturn: true, effects: [{ type: 'damage', amount: 40 }] }

Hook an enemy and pull it in ​

ts
import type { EffectDef } from '@v12-engine/engine'

const hook: EffectDef = {
	type: 'missile',
	speed: 28,
	distance: 9,
	pierce: false,
	returns: true,
	effects: [
		{ type: 'pull', seconds: 0.6, effects: [{ type: 'damage', amount: [70, 120, 170] }] },
		{ type: 'buff', buff: 'grabbed' }
	]
}

The first enemy it meets is dragged in over 0.6 seconds, hurt as it arrives, and held by the grabbed buff. See Moves.

Find its own targets ​

seek flies after the nearest enemy within that radius. Fox-Fire, Spirit Rush's bolts.

ts
import type { EffectDef } from '@v12-engine/engine'

const wisps: EffectDef = { type: 'missile', count: 3, spread: 2 * Math.PI, speed: 16, distance: 7, seek: 6, effects: [{ type: 'damage', amount: 60 }] }

Split where it ends ​

split runs effects from where it ended, facing the way it flew. Vel'Koz's Plasma Fission.

ts
import type { EffectDef } from '@v12-engine/engine'

const fission: EffectDef = {
	type: 'missile',
	speed: 13,
	distance: 11,
	effects: [{ type: 'damage', amount: 80 }],
	split: [{ type: 'missile', count: 2, spread: Math.PI, speed: 13, distance: 11, effects: [{ type: 'damage', amount: 80 }] }]
}

Stun on a wall, steer in flight ​

ts
import type { EffectDef } from '@v12-engine/engine'

// stops at a cliff, building or tree, and stuns the last unit it hit there
const binding: EffectDef = { type: 'missile', speed: 14, distance: 10, pierce: 1, onWall: [{ type: 'buff', buff: 'stunned' }] }
// the owner turns it toward the pointer, up to 2 radians a second
const steered: EffectDef = { type: 'missile', speed: 10, distance: 20, steer: { rate: 2 }, effects: [{ type: 'damage', amount: 90 }] }

Chain effects with when ​

Instead of nesting, put an effect after the missile with when. It waits for the nearest effect before it that reaches that moment. This is the hook above, flat:

ts
import type { EffectDef } from '@v12-engine/engine'

const hook: EffectDef[] = [
	{ type: 'missile', speed: 28, distance: 9, pierce: false, returns: true },
	{ type: 'pull', seconds: 0.6, when: 'hit' },
	{ type: 'damage', amount: [70, 120, 170], when: 'arrived' },
	{ type: 'buff', buff: 'grabbed', when: 'hit' }
]
// a leap, then a hook thrown from where it lands
const pounce: EffectDef[] = [
	{ type: 'dash', distance: 5, leap: 2 },
	{ type: 'damage', amount: 60, radius: 2, when: 'landed' },
	{ type: 'missile', speed: 28, distance: 9, pierce: false, when: 'landed' },
	{ type: 'pull', seconds: 0.4, when: 'hit' }
]

Reference ​

The missile effect ​

FieldTypeDefaultWhat it does
speednumberCells a second
distanceEffectValueHow far it flies
radiusEffectValueHow wide it hits
effectsEffectDef[]What happens to each it hits
onEndEffectDef[]What happens where it ends for good
homingbooleanfalseFollows the target unit
toPointbooleanfalseEnds at the spot clicked
pierceboolean or numbertruetrue through all, false stops at the first, n through n
falloffnumberWith pierce: each one passed takes this share off the next (context.share)
count, spreadnumber, radians1Several in a fan
delaynumber0Takes shape where cast this long before it sets off; the caster is free
arc{ height, time? }Thrown: flies over everything, hits around where it lands
bounce{ count, range, falloff? }Springs on to the nearest it hasn't hit
returnsbooleanfalseComes back to the caster; its onEnd runs at the caster
hitsOnReturnbooleanfalseWith returns: hits again on the way back
seeknumberFlies after the nearest it may hit within this radius
splitEffectDef[]Run from where it ended, the way it flew
steer{ rate }The owner steers it, rate radians a second at most
onWallEffectDef[]Stops at a wall; these run there, to the last it hit
blockedbooleanfalseBuildings and trees stop it
sightnumberThe caster's team sees around it as it flies
kinds, layersfrom EffectCommonWhat it may hit

when ​

whenWaits forThe same as nesting in
hita missileits effects
arriveda pullits effects
landeda dashits effects
enda missile or a zoneits onEnd

An effect with nothing before it to wait for never happens, and checkRules calls it an error. Every effects list takes when: an ability's, a passive's, a channel's, a buff's, and those inside effects. lowerChain(effects) turns a chain into the nested form.

In code ​

launchMissile(context, effect) sends one off and hands back the missiles. removeMissile(world, missile, { end? }) takes one out early (a wind wall), running its onEnd with end. splitMissile(world, missile) splits it early (a recast). steerMissile turns one. The client draws a returning missile facing the way it went out (MissileState.returning), a thrown one at its height (MissileState.arc).

Notes ​

  • A missile's damage, heal and mana are reduced by bounce.falloff and falloff; your own effect reads context.share.
  • bounce springs from wherever the missile would be done: it hit its target, was used up, landed, or reached its end.
  • checkRules warns of missile fields on an effect that isn't a missile, hitsOnReturn without returns, and a seek not above 0.
  • A ground object with blocksMissiles eats missiles that meet it; an arc flies over it.