MicroOptions beta
Interface of @v12-engine/engine/ai
export interface MicroOptionsHow a brain fights (BrainDef.micro, the seat's AiOptions.micro over it, the micro() module's own under both): whom it hits first, whether its ranged units kite, when its units flee, how it casts, what it buys, how its siege is used, which heroes it makes. Every field has a data form a save keeps; the function forms are the brain's to give again
Members
buyItems
buyItems?: boolean;Whether heroes buy from a shop in reach (Buy Items): yes when left out, where there is a shop and a list
focusEvery
focusEvery?: number;Seconds a squad keeps hitting the rival it was told to before another is chosen: 4
heroes
heroes?: HeroPlan[] | ((ai: Brain, candidates: readonly UnitTypeDef[]) => UnitTypeDef | string | undefined);The heroes to make, in order (HeroPlan: which, its skills, its items, a chance), or a function that picks the next of those that could be made. The first that can be made, and the ultimate first, when left out
heroesFlee
heroesFlee?: number | false;The same for heroes (Heroes Flee): 0.35. false never
hireUnits
hireUnits?: boolean;Whether it hires units at a place that hires in reach (a tavern, a mercenary camp: UnitTypeDef.hires): yes when left out, where there is one
hiring
hiring?: HiringItem[] | ((ai: Brain, offered: readonly UnitTypeDef[]) => string | undefined) | false;What it hires, in order (HiringItem), or a function that names the unit to hire next of those a place offers (none for nothing). When left out: no hero, the strongest soldier for its price, with money to spare (150 past it) and supply free, four at the most. false nothing
ignoreInjured
ignoreInjured?: boolean;Whether a unit that fled stays out until healed, however long (Ignore Injured): no when left out, so one nothing heals (or that heals too slowly to wait a minute for) comes back once safe
kite
kite?: boolean | 'ranged';Whether ranged units step back from the melee closing on them, when they are the faster: 'ranged' (or true) when left out, false never
potions
potions?: boolean;Whether a potion is drunk when it is needed: yes when left out
removeInjuries
removeInjuries?: boolean;Whether the hurt go home to heal between fights, not only out of one (Remove Injuries): no when left out
returnAt
returnAt?: number;The share of its health at which a unit that fled is back: 0.8
shopping
shopping?: ShoppingItem[] | ((ai: Brain, hero: EntityState) => string | undefined) | false;What a hero shops for, in order (ShoppingItem), or a function that names the item a hero should buy next (none for nothing). The cheapest item whose ability heals, one of it, when left out; false nothing
smartArtillery
smartArtillery?: boolean;Whether siege units shoot buildings when they may and stay behind the squad (Smart Artillery): yes when left out
spells
spells?: Record<string, SpellAim> | false;Where to use abilities, by ability id (SpellAim): before the ability's own ai, and before what the kit works out from its effects. false casts nothing: what is on autocast looks after itself
takeItems
takeItems?: boolean;Whether what lies about is picked up (Take Items): yes when left out
targetHeroes
targetHeroes?: boolean;Whether heroes are worth hitting first (the classic Target Heroes): yes when left out
targets
targets?: TargetRule[] | TargetPicker;Who is worth hitting first, as ranked rules (TargetRule), or a function that picks (TargetPicker). The kit's when left out: casters 2, heroes 1.5 (with targetHeroes), siege 1, healers 2, over the type's declared UnitTypeDef.ai.priority; among those alike, the weakest, the nearest
unitsFlee
unitsFlee?: number | false;The share of its health under which a unit leaves the fight for safety (the classic Units Flee): 0.25. false never