diff --git a/src/core/execution/BotExecution.ts b/src/core/execution/BotExecution.ts index 4f9f178f9..85fabb34a 100644 --- a/src/core/execution/BotExecution.ts +++ b/src/core/execution/BotExecution.ts @@ -1,7 +1,8 @@ -import { Execution, Game, Player } from "../game/Game"; +import { Execution, Game, isStructureType, Player } from "../game/Game"; import { PseudoRandom } from "../PseudoRandom"; import { simpleHash } from "../Util"; import { AllianceExtensionExecution } from "./alliance/AllianceExtensionExecution"; +import { DeleteUnitExecution } from "./DeleteUnitExecution"; import { AiAttackBehavior } from "./utils/AiAttackBehavior"; export class BotExecution implements Execution { @@ -58,6 +59,7 @@ export class BotExecution implements Execution { } this.acceptAllAllianceRequests(); + this.deleteAllStructures(); this.maybeAttack(); } @@ -80,6 +82,14 @@ export class BotExecution implements Execution { } } + private deleteAllStructures() { + for (const unit of this.bot.units()) { + if (isStructureType(unit.type()) && this.bot.canDeleteUnit()) { + this.mg.addExecution(new DeleteUnitExecution(this.bot, unit.id())); + } + } + } + private maybeAttack() { if (this.attackBehavior === null) { throw new Error("not initialized");