Crowd control
Stuns, roots, silences, fears, charms, taunts and the like are buffs with a flag. Put them on with the buff effect.
Quick start
import type { AbilityDef, BuffDef } from '@v12-engine/engine'
export const stunned: BuffDef = { id: 'stunned', name: 'Stunned', harmful: true, duration: 2, stun: true }
export const thunderBolt: AbilityDef = {
id: 'thunderBolt',
name: 'Thunder Bolt',
target: 'unit',
targets: { enemies: true },
range: 6,
cooldown: 9,
effects: [
{ type: 'damage', amount: 100 },
{ type: 'buff', buff: 'stunned' }
]
}The target takes 100 damage and can't act for 2 seconds. What it was told to do waits and resumes after.
Common tasks
Root, silence, disarm
import type { BuffDef } from '@v12-engine/engine'
const entangle: BuffDef = { id: 'entangle', name: 'Entangle', harmful: true, duration: 3, root: true } // can't move; still attacks and casts
const silenced: BuffDef = { id: 'silenced', name: 'Silence', harmful: true, duration: 3, silence: true } // can't cast
const disarmed: BuffDef = { id: 'disarmed', name: 'Disarm', harmful: true, duration: 3, disarm: true } // can't attacksilence can also be a function that picks which abilities it blocks: (ability) => ability.tags?.includes('fire') ?? false.
Knock up or knock down
airborne is a stun that throws the unit in the air; down lays it on the ground. Both are stuns with a look.
import type { BuffDef } from '@v12-engine/engine'
const knockedUp: BuffDef = { id: 'knockedUp', name: 'Airborne', harmful: true, duration: 1, stun: true, airborne: true }Fear, charm or taunt
control takes the unit's orders while it lasts. fear walks it away from who put it on, charm toward them, taunt makes it attack them.
import type { BuffDef } from '@v12-engine/engine'
const terrify: BuffDef = { id: 'terrify', name: 'Terrify', harmful: true, duration: 1.5, control: 'fear' }
const charmed: BuffDef = { id: 'charmed', name: 'Charm', harmful: true, duration: 1.5, control: 'charm' }
const taunted: BuffDef = { id: 'taunted', name: 'Frenzying Taunt', harmful: true, duration: 2.5, control: 'taunt' }A control in code steers the unit itself every tick: control: (world, carrier, instance, dt, source) => { /* moveTo, engage… */ }.
Sleep, polymorph
Sleep is a stun that breaks on damage. A polymorph is a disarm, a silence and a slow, drawn as another unit type.
import type { BuffDef } from '@v12-engine/engine'
const sleep: BuffDef = { id: 'sleep', name: 'Sleep', harmful: true, duration: 6, stun: true, breaksOn: ['damage'] }
const hex: BuffDef = { id: 'hex', name: 'Hex', harmful: true, duration: 4, disarm: true, silence: true, percent: { moveSpeed: -0.3 } }Draw hex as a sheep with drawnAs: 'sheep' on its look (Ability visuals).
Suppress, ground, unstoppable
import type { BuffDef } from '@v12-engine/engine'
// like a stun, but tenacity doesn't shorten it and cleanse doesn't remove it
const netherGrasp: BuffDef = { id: 'netherGrasp', name: 'Nether Grasp', harmful: true, duration: 2.5, suppress: true }
// can't dash or blink
const adhesive: BuffDef = { id: 'adhesive', name: 'Mega Adhesive', harmful: true, duration: 2, grounded: true }
// immune to every hold, knockback and pull; slows still slow
const ragnarok: BuffDef = { id: 'ragnarok', name: 'Ragnarok', duration: 6, unstoppable: true, percent: { attackSpeed: 0.5 } }Cleanse
cleanse takes off stuns, roots, silences, disarms, controls and slows. It reaches allies when affects is left out. It doesn't remove a suppression or a knock-up.
import type { AbilityDef } from '@v12-engine/engine'
const scurvy: AbilityDef = { id: 'removeScurvy', name: 'Remove Scurvy', target: 'none', effects: [{ type: 'cleanse', on: 'caster' }] }dispel takes off any buff whose dispellable allows it, and hurts summons by amount.
Bring a flyer down
grounds: true makes a flying unit count as on the ground for whatever is aimed at it.
Walk through units
import type { BuffDef } from '@v12-engine/engine'
const ghost: BuffDef = { id: 'ghost', name: 'Ghost', duration: 10, phasing: true, percent: { moveSpeed: 0.3 } }phasing: the carrier walks through other units, and they through it; neither steers round nor pushes the other. Walls, cliffs, buildings and trees still stop it. A function (world, carrier, instance) => boolean says so for one moment. isPhasing(world, entity) reads it. Phantom Stride and Shadowveil use it.
Reference
| Flag | What it does |
|---|---|
stun | Can't act: no moving, attacking or casting. Orders wait; a channel breaks |
airborne | Thrown up: a stun with a look |
down | Knocked down: lies on the ground, gets up at the end |
root | Can't move; still attacks and casts |
silence | Can't cast (or a function: which abilities it blocks). Items and hero spells still work |
disarm | Doesn't attack |
control | fear, charm, taunt, or a BuffControl function run every tick |
suppress | Held like a stun; tenacity doesn't shorten it, cleanse doesn't remove it |
grounded | Can't dash or blink of its own: such an ability is refused ("Grounded") |
grounds | A flyer counts as on the ground |
unstoppable | Nothing that holds a unit up affects it, and it isn't thrown or pulled; slows still slow |
phasing | Walks through units and they through it; walls and buildings still stop it |
breaksOn | damage, attack, cast |
Notes
- Tenacity (
mobaStatsPack) shortens harmful stuns and controls. - A controlled unit refuses every new order, the player's or anyone's, and doesn't autocast. The last control it got is the one it follows; a stun holds it still.
- While controlled, a unit carries the
controlledcomponent (the buff and its source; saved, sent to everyone who sees it).controlOfandisControlledread it. isCleansablesays whatcleansetakes off.holdsUpis the setunstoppableignores.- The screen draws a mark over feared, charmed and taunted units;
marker: falseon the look hides it.