Nations prefer bots over players

This commit is contained in:
Scott Anderson
2025-05-19 22:26:34 -04:00
parent da18f7d4b1
commit d68ec66cbe
+11 -9
View File
@@ -89,6 +89,7 @@ export class BotBehavior {
}
}
// Nation enemy selection
selectEnemy(): Player | null {
if (this.enemy === null) {
// Save up troops until we reach the trigger ratio
@@ -97,6 +98,15 @@ export class BotBehavior {
if (ratio < this.triggerRatio) return null;
}
// Select the most hated player
if (this.enemy === null) {
const mostHated = this.player.allRelationsSorted()[0];
if (mostHated !== undefined && mostHated.relation === Relation.Hostile) {
this.enemy = mostHated.player;
this.enemyUpdated = this.game.ticks();
}
}
// Prefer neighboring bots
if (this.enemy === null) {
const bots = this.player
@@ -109,15 +119,6 @@ export class BotBehavior {
}
}
// Select the most hated player
if (this.enemy === null) {
const mostHated = this.player.allRelationsSorted()[0];
if (mostHated !== undefined && mostHated.relation === Relation.Hostile) {
this.enemy = mostHated.player;
this.enemyUpdated = this.game.ticks();
}
}
// Sanity check, don't attack our allies or teammates
if (this.enemy && this.player.isFriendly(this.enemy)) {
this.enemy = null;
@@ -125,6 +126,7 @@ export class BotBehavior {
return this.enemy;
}
// Bot enemy selection
selectRandomEnemy(): Player | TerraNullius | null {
if (this.enemy === null) {
// Save up troops until we reach the trigger ratio