Skip to content

MeleeArmy beta ​

Class of @v12-engine/engine/ai

ts
export declare class MeleeArmy

The melee player's army: its waves of its own and the goals beside them (the file's comment), its numbers from its options (firstAttack, attackEvery, waveSize) and the defence's radius, its memory. Made for a brain by the army() module; reached as ai.module(MELEE_ARMY)?.army (meleeArmyOf(ai))

Members ​

constructor ​

ts
constructor(
    ai: Brain, 
    options: MeleeArmyOptions);

Constructs a new instance of the MeleeArmy class

ai ​

ts
readonly ai: Brain;

The brain it is the army of

attackEvery ​

ts
readonly attackEvery: number;

Seconds between one wave's time and the next

defendRadius ​

ts
readonly defendRadius: number;

How far from a base, in cells, the army defends

firstAttack ​

ts
readonly firstAttack: number;

Seconds into the game the first wave is due

goals ​

ts
goals(): GoalDef[];

The goals, for the picker: attack, creep, raid, harass, expand (each unless left out)

inspect ​

ts
inspect(): Record<string, unknown>;

What it is thinking, for the debug tools: how hard it plays, its next wave, its roles

memory ​

ts
readonly memory: MeleeArmyMemory;

What the army remembers between thinks: wave size, next times and counts

options ​

ts
readonly options: MeleeArmyOptions;

How it goes: the module's options, the brain's settings over them (ai.settings.army)

ready ​

ts
ready(): UnitSet;

The fighters no goal holds and with nothing to do: what a wave or a party is made of. Once a think

restore ​

ts
restore(data: unknown): void;

Takes back what save gave

save ​

ts
save(): MeleeArmyMemory;

What it remembers, for a save: a copy

think ​

ts
think(): void;

Once a think, before the picker: whether the wave began waiting past its time, short of its size or outmatched