AiConditionData beta
TypeAlias of @v12-engine/engine/ai
ts
export type AiConditionData =
/** Every one of them */
{
all: AiCondition[];
}
/** One of them at least */
| {
any: AiCondition[];
}
/** The other way round */
| {
not: AiCondition;
}
/** How much it has of a resource */
| {
resource: {
id: string;
} & AiRange;
}
/**
* How many units there are, of a type, a role or a tag, whose (`of`), near a named entity, point or region (`near`,
* `within`), finished only (`finished`); and for `of: 'enemy'`, those remembered out of sight too (`known`). At
* least one where neither `min` nor `max` is given
*/
| {
units: {
type?: string;
role?: AiRole;
tag?: string;
of?: AiWhose;
near?: string | Vec2;
within?: number;
finished?: boolean;
known?: boolean;
} & AiRange;
}
/** Its supply: free (cap less used), used, cap */
| {
supply: {
free?: AiRange;
used?: AiRange;
cap?: AiRange;
};
}
/** Seconds into the game: from `after`, before `before` */
| {
time: {
after?: number;
before?: number;
};
}
/**
* Whether its own are being hit: damage seen to its entities within so many seconds (5 when left out), anywhere, or
* near a named entity, a point or a region (`near`, `within` the reach: 16)
*/
| {
underAttack: true | {
seconds?: number;
near?: string | Vec2;
reach?: number;
};
}
/** Whether a rival's unit of a type or a role was seen, within so many seconds where given (ever, when left out) */
| {
seen: {
type?: string;
role?: AiRole;
within?: number;
};
}
/** The difficulty it plays on (its profile's: `AiOptions.difficulty`, normal when left out), one or any of a list */
| {
difficulty: string | string[];
}
/** Whether the game told it this word and nothing took it yet */
| {
told: string;
}
/** Yes so often, by the brain's own numbers (`ai.rng`): `0.3` is three times in ten. The same game says the same */
| {
chance: number;
}
/** Its heroes: one at least of this type (any where left out), alive where `alive` says, of a level */
| {
hero: {
type?: string;
alive?: boolean;
level?: AiRange;
};
}
/** The index of the wave whose turn it is (`ai.waves.index`, the waves sent and skipped before it); where it has no waves, the attacks it sent (its knowledge's `own.attacks`) */
| {
wave: AiRange;
}
/** One of its own objectives, by id, in this status (or any of these) */
| {
objective: {
id: string;
status: ObjectiveStatus | ObjectiveStatus[];
};
}
/** A value of the game's report to this player (`Rules.report`), by its path (`'waves.next'`): equal to, or within */
| {
report: {
path: string;
equals?: unknown;
} & AiRange;
}
/**
* A value of a component the game replicates to this player (`Component.replicate`) on an entity: one the map or
* the rules named (`entity`), or the first of its own of a type (`type`). By path in it, where it is an object
*/
| {
component: {
id: string;
entity?: string;
type?: string;
path?: string;
equals?: unknown;
} & AiRange;
}
/** How many units are in a region of the map, whose (`of`: its own when left out), of a type or a role */
| {
region: {
name: string;
of?: AiWhose;
type?: string;
role?: AiRole;
} & AiRange;
}
/** A condition of the game's own or the brain's (`GameAi.conditions`, `BrainDef.conditions`), by id, with its arguments (`{ is: 'mygame.bridge', args: { name: 'north' } }`) */
| {
is: string;
args?: Record<string, unknown>;
};A condition as plain data: what a map's file, a mission's JSON or the editor holds. Each form is one question; the table in docs/ai/scripting.md says what each asks