Merge branch 'main' into local-attack

This commit is contained in:
Aotumuri
2026-02-13 05:39:13 +09:00
committed by GitHub
38 changed files with 1466 additions and 1408 deletions
+1
View File
@@ -39,6 +39,7 @@ export class BotExecution implements Execution {
if (ticks % this.attackRate !== this.attackTick) return;
if (!this.bot.isAlive()) {
//removeOnDeath is called from bot's PlayerExecution
this.active = false;
return;
}
+1
View File
@@ -144,6 +144,7 @@ export class NationExecution implements Execution {
}
if (!this.player.isAlive()) {
//removeOnDeath is called from nation's PlayerExecution
this.active = false;
return;
}
+21 -13
View File
@@ -60,19 +60,7 @@ export class PlayerExecution implements Execution {
}
if (!this.player.isAlive()) {
// Player has no tiles, delete any remaining units and gold
const gold = this.player.gold();
this.player.removeGold(gold);
this.player.units().forEach((u) => {
if (
u.type() !== UnitType.AtomBomb &&
u.type() !== UnitType.HydrogenBomb &&
u.type() !== UnitType.MIRVWarhead &&
u.type() !== UnitType.MIRV
) {
u.delete();
}
});
this.removeOnDeath();
this.active = false;
this.mg.stats().playerKilled(this.player, ticks);
return;
@@ -400,4 +388,24 @@ export class PlayerExecution implements Execution {
return result;
}
private removeOnDeath(): void {
// Player (bot, human, nation) has no tiles
// Delete any remaining gold, non-nuke units and alliances
const gold = this.player.gold();
this.player.removeGold(gold);
this.player.units().forEach((u) => {
if (
u.type() !== UnitType.AtomBomb &&
u.type() !== UnitType.HydrogenBomb &&
u.type() !== UnitType.MIRVWarhead &&
u.type() !== UnitType.MIRV
) {
u.delete();
}
});
this.player.removeAllAlliances();
}
}