mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 23:31:55 +00:00
do not allow attacking same team
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user