bufix: NPC is targeted at the same time it allies with targeter, causing it to try to attack itself

This commit is contained in:
Evan
2025-01-05 20:04:55 -08:00
parent 81d849dec1
commit 5e0367ae55
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -55,6 +55,10 @@ export class AttackExecution implements Execution {
this._owner = mg.player(this._ownerID)
this.target = this._targetID == this.mg.terraNullius().id() ? mg.terraNullius() : mg.player(this._targetID)
if (this._owner == this.target) {
throw new Error(`Player ${this._owner} cannot attack itself`)
}
if (this.troops == null) {
this.troops = this.mg.config().attackAmount(this._owner, this.target)
}