do not allow attacking same team

This commit is contained in:
evanpelle
2025-05-23 11:29:28 -07:00
parent 69280d6273
commit e2d85e906f
+16 -8
View File
@@ -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) {