From bf0d677d42c6a1f46e884602709c2955d05b4472 Mon Sep 17 00:00:00 2001 From: 1brucben <1benjbruce@gmail.com> Date: Wed, 21 May 2025 11:59:03 +0200 Subject: [PATCH] border refresh --- src/core/execution/AttackExecution.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index d095d1a21..2accaa5ec 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -34,6 +34,8 @@ export class AttackExecution implements Execution { private attack: Attack | null = null; + private lastTroops: number = 0; + constructor( private startTroops: number | null = null, private _ownerID: PlayerID, @@ -119,6 +121,7 @@ export class AttackExecution implements Execution { // Record stats this.mg.stats().attack(this._owner, this.target, this.startTroops); + this.lastTroops = this.attack.troops(); for (const incoming of this._owner.incomingAttacks()) { if (incoming.attacker() === this.target) { // Target has opposing attack, cancel them out @@ -196,6 +199,12 @@ export class AttackExecution implements Execution { if (this.attack === null) { throw new Error("Attack not initialized"); } + const currentTroops = this.attack.troops(); + const prevTroops = this.lastTroops; + if (currentTroops > prevTroops) { + this.refreshToConquer(); // refresh the toConquer list if troops are added + } + this.lastTroops = currentTroops; if (this.attack.retreated()) { if (this.attack.target().isPlayer()) {