mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-04 20:06:06 +00:00
feat: added boat attacks to show up as regular attacks
This commit is contained in:
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user