mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-27 21:42:25 +00:00
do not allow attacking same team
This commit is contained in:
@@ -90,15 +90,23 @@ export class AttackExecution implements Execution {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (this.target.isPlayer()) {
|
||||||
this.target.isPlayer() &&
|
if (
|
||||||
this.mg.config().numSpawnPhaseTurns() +
|
this.mg.config().numSpawnPhaseTurns() +
|
||||||
this.mg.config().spawnImmunityDuration() >
|
this.mg.config().spawnImmunityDuration() >
|
||||||
this.mg.ticks()
|
this.mg.ticks()
|
||||||
) {
|
) {
|
||||||
console.warn("cannot attack player during immunity phase");
|
console.warn("cannot attack player during immunity phase");
|
||||||
this.active = false;
|
this.active = false;
|
||||||
return;
|
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) {
|
if (this.startTroops == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user