Give a hero an innate
An innate is an ability the hero has from level 1, for no point, that grows with its level: hero.innate. Make it a passive that changes how the hero is played.
// in src/rules.ts
import { heroesPack, type Rules } from '@v12-engine/engine'
export const rules: Rules = {
id: 'my-game',
name: 'My game',
units: [
{
id: 'reaver',
name: 'Reaver',
kind: 'unit',
radius: 0.5,
sight: 10,
stats: { health: 640, attackDamage: 55, attackSpeed: 0.65, attackRange: 0.6, moveSpeed: 4.3 },
// Harvest from level 1, stronger at hero levels 5 and 9
hero: { growth: { stats: { health: 90 } }, learns: [], innate: 'harvest', innateLevels: [1, 5, 9], meter: 'harvested' }
}
],
abilities: [
{
id: 'harvest',
name: 'Harvest',
description: 'Each kill gives a lasting stack: +8, +12 or +16 health and +1, +1.5 or +2 attack damage, up to thirty',
target: 'passive',
maxLevel: 3,
effects: [{ type: 'onKill', effects: [{ type: 'buff', buff: 'harvested', stack: true, on: 'caster' }] }]
}
],
buffs: [{ id: 'harvested', name: 'Harvested', description: 'Health and attack damage for every kill', maxStacks: 30, perStack: true, stats: { health: [8, 12, 16], attackDamage: [1, 1.5, 2] } }],
packs: [heroesPack()]
}Done: every kill gives the reaver a stack of health and damage; its stacks show by its bars (meter), and each stack is worth more as the innate's level goes up at hero levels 5 and 9 (the buff's level is the innate's). The innate is on the hero panel before the learned abilities, and its tooltip is the ability's description.
Let it grow level by level
Leave innateLevels out: the innate's level is the hero's, up to the ability's maxLevel. innateLevel(world, hero) reads it.
Make it change the play
The melee starter's eight: a share of allies' damage taken (an aura and a beforeDamage hook), healing past full as a shield (overheal), every fourth spell free and chaining (onCast stacks, a charged effect), range and crit while standing still (onTick), health instead of mana (paysWithHealth), holds that end for more damage (a hook), camouflage out of fights (outOfFights), kills that last (onKill on a kept component). Each is a buff field or a trigger; where none says it, a hook does (Innates, Change a rule with a hook). Name heroes, creeps, allies and kills, never a lane, so the innate fits every kind of game.