Skip to content

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 ​

ts
// 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:

PatternHowIn the default set
Punish whoever strikes the carrieronDamaged with attack: true, damage and a debuff backStoneheart's Thornhide
Save an ally about to diean aura keeps a ward buff on allies; the ward's onFatal puts a stasis buff on and spends it; a cooldown buff on the giverDawnmender's Second Dawn
Harmful spells slowonAbilityHit with a slow buffRimecaller's Rime
Faster the lower its healtha buff whose change reads the carrier's health and gives attack speedBloodreaver's Frenzy
A kill refreshes the basicsonKill with the refreshAbilities effect (the default items pack's)Nightfang's Hunt
Attacks finish what is lowonHit with an if on the target's health and damage of byCurrentHealthKingsedge's Execution
Every third attack strikes againonHit with every: 3 and a second damageGaleshot's Volley
Spells burn and anti-healonAbilityHit with a buff of onTick damage and incomingHealing: -0.4Embercrown's Embers
Spell hits sunderonAbilityHit with a stacking buff of incomingMagicDamage: 0.1Voidglass's Sunder
More against creeps, a spell cools fasteronHit with tags of the target, and the quicken effect on a hero spellWildheart
Through units and unseen for a momentan active: a buff with phasing and camouflageShadowveil

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, a where tells it from a hero), a structure (kinds: ['building']), an ally. Where a game has minions or towers, they are units with those tags, and tags on 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 (teleport with to: '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 ​

ts
{ id: 'greavesOfHaste', group: 'boots', ... } // groupLimit left out: the game's limit of the group, or 1

A 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 ​

FieldWhat it does
passiveThe ability whose passive part works while carried
uniqueThe passive's name: items sharing it work once (settings.items.unique)
groupA group a carrier has only so many of
groupLimitThe most of the group for this item; the game's groups, or 1, when left out
suitsThe callings it is for
tierlegendary; 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).