Legendaries, uniques and groups
A legendary is what a build tree leads to. Its stats are the sum of its parts and a little more; what makes it worth the price is a unique effect: a passive that asks for a different way to play. The engine brings twelve, one at least for every calling (Every default item); this page is how to make your own, and the rules around them.
Quick start
// the item
{
id: 'stoneheart',
name: 'Stoneheart',
description: '+400 health, +60 armor. Thornhide: whoever strikes it takes 40 magic damage and heals 40% less for 3 seconds',
tier: 'legendary',
cost: { gold: 2700 },
from: ['chainVest', 'giantsBelt', 'paddedCoat'],
bonus: { stats: { health: 400, armor: 60 } },
passive: 'stoneheartThornhide',
unique: 'thornhide',
tags: ['defence', 'health', 'anti-heal'],
suits: ['vanguard']
}
// its passive: an ability with no cast, only triggers
{
id: 'stoneheartThornhide',
name: 'Thornhide',
target: 'passive',
effects: [{ type: 'onDamaged', attack: true, effects: [{ type: 'damage', amount: 40 }, { type: 'buff', buff: 'thornhideBleed' }] }]
}
// the debuff it puts on
{ id: 'thornhideBleed', name: 'Thornhide', harmful: true, duration: 3, stats: { incomingHealing: -0.4 } }Common tasks
Give an item a unique effect
The passive is an ability with target: 'passive' (or passive effects beside a cast), named by the item's passive. unique: 'thornhide' names the effect: two Stonehearts carried, or a Stoneheart and another item whose unique is thornhide, work once (the first carried); their stats still both count. settings.items.unique: false turns the rule off for a game where everything stacks.
A unique can be an active instead: the item's ability, with its own cooldown. Oathhorn's horn is one.
Make a passive that changes play
What the twelve do, as patterns to copy:
| Pattern | How | In the default set |
|---|---|---|
| Punish whoever strikes the carrier | onDamaged with attack: true, damage and a debuff back | Stoneheart's Thornhide |
| Save an ally about to die | an aura keeps a ward buff on allies; the ward's onFatal puts a stasis buff on and spends it; a cooldown buff on the giver | Dawnmender's Second Dawn |
| Harmful spells slow | onAbilityHit with a slow buff | Rimecaller's Rime |
| Faster the lower its health | a buff whose change reads the carrier's health and gives attack speed | Bloodreaver's Frenzy |
| A kill refreshes the basics | onKill with the refreshAbilities effect (the default items pack's) | Nightfang's Hunt |
| Attacks finish what is low | onHit with an if on the target's health and damage of byCurrentHealth | Kingsedge's Execution |
| Every third attack strikes again | onHit with every: 3 and a second damage | Galeshot's Volley |
| Spells burn and anti-heal | onAbilityHit with a buff of onTick damage and incomingHealing: -0.4 | Embercrown's Embers |
| Spell hits sunder | onAbilityHit with a stacking buff of incomingMagicDamage: 0.1 | Voidglass's Sunder |
| More against creeps, a spell cools faster | onHit with tags of the target, and the quicken effect on a hero spell | Wildheart |
| Through units and unseen for a moment | an active: a buff with phasing and camouflage | Shadowveil |
Every trigger and buff field is in Triggers and passives and Buffs and debuffs: every field. What the engine's fields do not say, a game writes as an effect of its own (Write your own effect) and lists in a pack: the default items bring defaultItemsPack with allyWard, wardSpent, refreshAbilities, quicken, outOfFights, reward and nightCompanion, which your items may use too.
Keep it fit for every kind of game
A passive that says "a kill near a tower" works in one game. Say it in general words and it works in all:
- Who: a hero (
only: 'heroes'), a creep (the creeps player's unit:affects: 'enemies'reaches it, awheretells it from a hero), a structure (kinds: ['building']), an ally. Where a game has minions or towers, they are units with thosetags, andtagson the effect matches them. - When: a kill (
onKill), being hurt (onDamaged), out of fights for a while (outOfFights), night (world.night). - Where: around the carrier (
radius), at home (teleportwithto: 'home'), never a named place of a map.
The default set is tested on a melee map, a campaign map and a lanes map alike (packages/engine/tests/defaultItems.test.ts).
Groups: one pair of boots
{ id: 'greavesOfHaste', group: 'boots', ... } // groupLimit left out: the game's limit of the group, or 1A hero may carry so many of a group: the item's groupLimit, the game's settings.items.groups[group], or one. One more is refused as it is bought, picked up or handed over, and the player told (groupLimit: "Only one pair of boots"). The parts a recipe uses up are not counted, so Greaves of Haste build from Boots. The shop window says so before the buy, from groupRefusal; a recipe that would break its own group's limit is flagged by the check.
Relics: loot, never sold
tier: 'relic' is for what no shop sells: the default set's Ember Idol (a burst of fire on death), Ring of the Old King (gold for each kill near) and Wolfhide Charm (a wolf at your side at night). Give them out with drops on a camp's creep or a boss (Drop it as loot). useDefaults takes a set's relics off a shop that lists the set whole.
Say what suits whom
suits: ['vanguard'] names the callings the item is for (Callings). The shop puts what suits the hero first and offers the callings as filters; the AI will pick by it. It never locks: any hero buys anything.
Reference
| Field | What it does |
|---|---|
passive | The ability whose passive part works while carried |
unique | The passive's name: items sharing it work once (settings.items.unique) |
group | A group a carrier has only so many of |
groupLimit | The most of the group for this item; the game's groups, or 1, when left out |
suits | The callings it is for |
tier | legendary; relic for loot |
Tests: packages/engine/tests/itemRules.test.ts (uniques counted once, a group's refusal and its words), packages/engine/tests/defaultItems.test.ts (each legendary's unique in each kind of game).