diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 185a473d1..2a4388d11 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -669,6 +669,10 @@ export class DefaultConfig implements Config { } if (attacker.isPlayer() && defender.isPlayer()) { + if (defender.isDisconnected() && attacker.isOnSameTeam(defender)) { + // No troop loss if defender is disconnected. + mag = 0; + } if ( attacker.type() === PlayerType.Human && defender.type() === PlayerType.Bot diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 402c3a0d5..13099b7b6 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -100,13 +100,6 @@ export class AttackExecution implements Execution { this.active = false; return; } - if (this._owner.isOnSameTeam(this.target)) { - console.warn( - `${this._owner.displayName()} cannot attack ${this.target.displayName()} because they are on the same team`, - ); - this.active = false; - return; - } } this.startTroops ??= this.mg diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index d19a1ca80..cb395cc1a 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -746,6 +746,9 @@ export class PlayerImpl implements Player { } isFriendly(other: Player): boolean { + if (other.isDisconnected()) { + return false; + } return this.isOnSameTeam(other) || this.isAlliedWith(other); }