alert when getting attacked

This commit is contained in:
evanpelle
2024-12-10 15:20:37 -08:00
committed by Evan
parent e7316c8fe9
commit 67288cb49f
2 changed files with 9 additions and 5 deletions
+4 -1
View File
@@ -1,5 +1,5 @@
import { PriorityQueue } from "@datastructures-js/priority-queue";
import { Cell, Execution, MutableGame, MutablePlayer, Player, PlayerID, TerrainType, TerraNullius, Tile } from "../game/Game";
import { Cell, Execution, MutableGame, MutablePlayer, Player, PlayerID, PlayerType, TerrainType, TerraNullius, Tile } from "../game/Game";
import { PseudoRandom } from "../PseudoRandom";
import { manhattanDist } from "../Util";
import { MessageType } from "../../client/graphics/layers/EventsDisplay";
@@ -87,6 +87,9 @@ export class AttackExecution implements Execution {
}
}
}
if (this._owner.type() != PlayerType.Bot && this.target.isPlayer() && this.target.type() == PlayerType.Human) {
mg.displayMessage(`You are being attacked by ${this._owner.displayName()}`, MessageType.ERROR, this._targetID)
}
if (this.sourceCell != null) {
this.addNeighbors(mg.tile(this.sourceCell))
} else {