Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/core/execution/BotExecution.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -58,6 +59,7 @@ export class BotExecution implements Execution {
}

this.acceptAllAllianceRequests();
this.deleteAllStructures();
this.maybeAttack();
}

Expand All @@ -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");
Expand Down
Loading