diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 8d62debb5..a12f78068 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -90,15 +90,23 @@ export class AttackExecution implements Execution { return; } - if ( - this.target.isPlayer() && - this.mg.config().numSpawnPhaseTurns() + - this.mg.config().spawnImmunityDuration() > + if (this.target.isPlayer()) { + if ( + this.mg.config().numSpawnPhaseTurns() + + this.mg.config().spawnImmunityDuration() > this.mg.ticks() - ) { - console.warn("cannot attack player during immunity phase"); - this.active = false; - return; + ) { + console.warn("cannot attack player during immunity phase"); + 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; + } } if (this.startTroops == null) {