feat: added boat attacks to show up as regular attacks

This commit is contained in:
Rj Manhas
2025-11-10 15:50:26 -07:00
parent 6a78494404
commit 0577eb9d11
4 changed files with 42 additions and 2 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
import { renderTroops } from "../../client/Utils";
import {
Execution,
Game,
@@ -144,7 +145,7 @@ export class TransportShipExecution implements Execution {
mg.displayIncomingUnit(
this.boat.id(),
// TODO TranslateText
`Naval invasion incoming from ${this.attacker.displayName()}`,
`Boat: ${renderTroops(this.boat.troops())} ${this.attacker.displayName()}`,
MessageType.NAVAL_INVASION_INBOUND,
this.targetID,
);
+12
View File
@@ -269,6 +269,18 @@ export class UnitImpl implements Unit {
this.mg
.stats()
.boatDestroyTroops(destroyer, this._owner, this._troops);
// Notify the defender if the boat was targeting them
if (this.targetTile() !== undefined) {
const targetTile = this.targetTile()!;
const targetOwner = this.mg.owner(targetTile);
if (targetOwner.isPlayer() && targetOwner !== this._owner) {
this.mg.displayMessage(
`${this._owner.displayName()} boat was destroyed`,
MessageType.UNIT_DESTROYED,
targetOwner.id(),
);
}
}
break;
case UnitType.TradeShip:
this.mg.stats().boatDestroyTrade(destroyer, this._owner);