Skip to content

Commit 8b30702

Browse files
committed
- afk() and hated() attack strategies no longer return MUCH stronger players
1 parent a225569 commit 8b30702

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/core/execution/utils/AiAttackBehavior.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ export class AiAttackBehavior {
8888

8989
const afk = (): boolean => {
9090
// borderingEnemies is already sorted by troops (ascending), so first match is weakest afk enemy
91-
const afk = borderingEnemies.find((enemy) => enemy.isDisconnected());
91+
const afk = borderingEnemies.find(
92+
(enemy) =>
93+
enemy.isDisconnected() && enemy.troops() < this.player.troops() * 3,
94+
);
9295
if (afk) {
9396
this.sendAttack(afk);
9497
return true;
@@ -120,6 +123,7 @@ export class AiAttackBehavior {
120123
if (relation.relation !== Relation.Hostile) continue;
121124
const other = relation.player;
122125
if (this.player.isFriendly(other)) continue;
126+
if (other.troops() > this.player.troops() * 3) continue;
123127
this.sendAttack(other);
124128
return true;
125129
}

0 commit comments

Comments
 (0)