Skip to content

MicroOptions beta ​

Interface of @v12-engine/engine/ai

ts
export interface MicroOptions

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

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

ts
focusEvery?: number;

Seconds a squad keeps hitting the rival it was told to before another is chosen: 4

heroes ​

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

ts
heroesFlee?: number | false;

The same for heroes (Heroes Flee): 0.35. false never

hireUnits ​

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

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

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

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

ts
potions?: boolean;

Whether a potion is drunk when it is needed: yes when left out

removeInjuries ​

ts
removeInjuries?: boolean;

Whether the hurt go home to heal between fights, not only out of one (Remove Injuries): no when left out

returnAt ​

ts
returnAt?: number;

The share of its health at which a unit that fled is back: 0.8

shopping ​

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

ts
smartArtillery?: boolean;

Whether siege units shoot buildings when they may and stay behind the squad (Smart Artillery): yes when left out

spells ​

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

ts
takeItems?: boolean;

Whether what lies about is picked up (Take Items): yes when left out

targetHeroes ​

ts
targetHeroes?: boolean;

Whether heroes are worth hitting first (the classic Target Heroes): yes when left out

targets ​

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

ts
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