fix: add Unit.maxHealth() missing from cherry-picked warship decay

The doomsday-clock warship decay commit (#4499) calls ws.maxHealth(),
which was introduced on main by the warship veterancy PR (#4433) — not
present on this branch — breaking the build.

Add maxHealth() to the Unit interface and UnitImpl, returning the
unit-info base (info().maxHealth ?? 1), the same value modifyHealth
already caps against. No veterancy bonus here since this branch lacks
the veterancy system; merging with main will pick up the adjusted
version with only a one-line conflict in the method body.
This commit is contained in:
evanpelle
2026-07-03 17:13:44 -07:00
parent 27679297fa
commit 53e1a5b03e
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -479,6 +479,8 @@ export interface Unit {
transportShipState(): TransportShipState;
updateTransportShipState(update: Partial<TransportShipState>): void;
health(): number;
/** Max health from unit info (1 for units without health). */
maxHealth(): number;
modifyHealth(delta: number, attacker?: Player): void;
// Troops
+3
View File
@@ -185,6 +185,9 @@ export class UnitImpl implements Unit {
health(): number {
return Number(this._health);
}
maxHealth(): number {
return this.info().maxHealth ?? 1;
}
hasHealth(): boolean {
return this.info().maxHealth !== undefined;
}