Give heroes callings
A calling is what a hero is good at; a hero has several, each 1 to 3. The shop suggests items by them, the HUD shows them, and they lock nothing.
// in src/rules.ts
import { heroesPack, type Rules } from '@v12-engine/engine'
export const rules: Rules = {
id: 'my-game',
name: 'My game',
units: [
{
id: 'warden',
name: 'Warden',
kind: 'unit',
radius: 0.5,
sight: 10,
stats: { health: 700, attackDamage: 40, attackSpeed: 0.7, attackRange: 0.6, moveSpeed: 4 },
hero: { growth: { stats: { health: 90 } }, learns: [], callings: { vanguard: 3, binder: 2 } }
}
],
items: [{ id: 'chainVest', name: 'Chain Vest', tier: 'intermediate', cost: { gold: 1000 }, bonus: { stats: { armor: 40 } }, tags: ['defence'], suits: ['vanguard'] }],
packs: [heroesPack()]
}Done: the warden shows Vanguard 3 and Binder 2 on its panel, the altar's button and its tooltip; the shop puts the Chain Vest in its For this hero row. The heroes pack brings the engine's eight callings when told none: Vanguard, Keeper, Binder, Reaver, Stalker, Ranger, Arcanist, Roamer (every calling).
Rename one, add one, leave one out
import { defaultCallings, heroesPack } from '@v12-engine/engine'
packs: [
heroesPack({
callings: [
...defaultCallings()
.filter((calling) => calling.id !== 'roamer')
.map((calling) => (calling.id === 'vanguard' ? { ...calling, name: 'Bulwark' } : calling)),
{ id: 'siegemaster', name: 'Siegemaster', description: 'Brings buildings down', color: '#c08040' }
]
})
]Or in data.json (the editor's Data › Callings writes it): "callings": { "vanguard": { "name": "Bulwark" } }; and to leave one out, "defaults": { "callings": { "except": ["roamer"] } } in a game that took the set with useDefaults(rules, [defaultCallingSet()]).
Replace them all
heroesPack({ callings: [{ id: 'tank', name: 'Tank' }, { id: 'healer', name: 'Healer' }, { id: 'carry', name: 'Carry' }] })Then heroes say callings: { tank: 3 } and items suits: ['tank']. The rules' check names a calling the game does not have. Callings has the whole of it.