ProductionPlan beta
Class of @v12-engine/engine/ai
export declare class ProductionPlanThe brain's production plan (ai.plans.production): what it trains and researches, by the wants of units, the composition and the counters, with supply kept ahead. train and research are the primitives any module uses to queue something through the purse; think runs the plan once a think
Members
constructor
constructor(
ai: Brain, options?: ProductionPlanOptions);Constructs a new instance of the ProductionPlan class
ai
readonly ai: Brain;The brain it plans for
configure
configure(options: ProductionPlanOptions): void;Takes options in, over what it had
nextResearch
nextResearch(): UpgradeDef | undefined;The upgrade to research next: the first of the list it can (research as a list), what the function gives, or, left to itself, the one the most of its units benefit from (UpgradeEffect.units), ties as the game lists them
queued
queued(type: string): number;How many of a unit type the player's buildings are training
report
report(): ProductionPlanReport;The composition as weighed, what was trained and researched this think, the wants trained towards, and the status
research
research(building: EntityState, upgrade: UpgradeDef, spare?: number, priority?: number): boolean;Researches an upgrade at a building, when it is not researching already, the building's queue has room and the purse allows with spare left over: whether it was sent. me.researching is bumped at once
researchable
researchable(upgrade: UpgradeDef): boolean;Whether an upgrade can be researched now: a level left, not under way, the player's to make, what the next level requires standing
restore
restore(memory: ProductionPlanMemory | undefined): void;Takes back what save gave, after the build plan's: the supply want is had again at once, before the first think, as the game saved from has it (the module sets it again only when supply runs short, after the build plan thinks)
save
save(): ProductionPlanMemory | undefined;What it remembers, for a save: what the supply want was set with, while it stands
settings
get settings(): Readonly<ProductionPlanOptions>;The plan's options as they stand
think
think(): void;The think, once a think: the unit wants first (each at a building that trains it, as many as wanted), then the composition's most urgent type at every building with room, as the supply, the queue and the purse allow; one more of what provides supply wanted when the next does not fit; then the research
train
train(building: EntityState, type: UnitTypeDef, priority?: number): boolean;Trains a unit at a building, when it fits the supply, the queue has room and the purse allows: whether it was sent. The supply used is bumped on the view's me at once, so that the next call this think does not queue past the cap before the command lands. What the economy, the hero module and this plan all train through
trainable
trainable(): UnitTypeDef[];The soldier types the player can train now: at a finished building of its own, their requirements standing
upkeepLimit
upkeepLimit(): number | undefined;The supply used the composition trains no further than for upkeep (upkeepTier): where the tier after the one it may be in begins. None in a game without upkeep, past its last tier, or with upkeepTier: false
wanted
wanted(): Want[];The unit wants the build plan holds that are to be trained now (their buildings up), most important first; the order's alone while it is followed
weigh
weigh(): CompositionReport[];The composition as weighed this think, for the types it can train: each type's share wanted (the composition's for its id, or for a tag or role where no type has that id, split among the types that have it; even when there is no composition), its share of the soldiers now, how well it answers the enemy's army seen, and its urge: target × (1 + counters × (counter − 1)) − share. The most urgent is trained first