Roles beta
Class of @v12-engine/engine/ai
export declare class RolesWhat the unit types of a game are for (AiView.roles): the inferred roles (inferRoles, or a game's own finder in its place) with what the game declares on a type over them (UnitTypeDef.ai), and the queries over them
Members
constructor
constructor(
table: RoleTable, registry: Registry);Constructs a new instance of the Roles class
explain
explain(type: string): string;Why a type has the roles it has, in words, for the report: declared: worker for what the game said, a line per inferred role otherwise
has
has(type: string, role: AiRole): boolean;Whether a unit type has a role
hasTag
hasTag(type: string, tag: string): boolean;Whether a unit type has a tag
hints
hints(type: string): AiHints | undefined;What a game declared of a type (UnitTypeDef.ai): nothing where it declared nothing
of
of(type: string): readonly AiRole[];The roles of a unit type: none for one that has none, or is not a unit type at all
report
report(): Record<string, string[]>;Every role and the types that have it, for the report (the debug tools)
table
readonly table: RoleTable;Every unit type's roles and tags, by id
tagged
tagged(tag: string): readonly UnitTypeDef[];The unit types with a tag, in the game's order
tags
tags(type: string): readonly string[];The tags of a unit type: the kit's (ranged, melee, hitsAir) and the game's (UnitTypeDef.ai.tags)
types
types(role: AiRole): readonly UnitTypeDef[];The unit types with a role, in the game's order (the first of a kind is the one meant first)