Files
OpenFrontIO/tests
Zixer1andevanpelle 225743206d fix(doomsday): keep doomed warships on patrol instead of idling at ports (#4597)
Follow-up to #4587 (the 5% drain floor).

## Description:

A side below the Doomsday Clock bar cannot repair its navy: warship
healing is suppressed in `WarshipExecution.healWarship` so the decay
actually lands. Since #4587 floors the drain at 5% of max instead of
sinking ships to zero, warships now survive at 5% health, which is below
the 75% `warshipRetreatHealthPercent` retreat threshold. The result was
that every doomed warship peeled off to the nearest port, docked, and
then never healed, sitting idle and out of combat, instead of the
intended crippled-but-still-fighting state.

This gates the repair-retreat on the Doomsday Clock, mirroring the
existing heal gate: a doomed warship no longer starts a retreat, and any
in-flight retreat or dock is cancelled so it returns to patrol. It keeps
fighting at the floor until its side climbs back above the bar (healing
resumes) or it is destroyed in combat.

No config, schema, or UI change. Deterministic (a boolean check over
existing player/warship state). Covered by three new tests in
`tests/Warship.test.ts` (doomed stays on patrol, non-doomed still
retreats, doomed undocks).

## Please complete the following:

- [x] I have added screenshots for all UI updates (no UI changes)
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file (no user-facing text)
- [x] I have added relevant tests to the test directory

## Please put your Discord username so you can be contacted if a bug or
regression is found:

zixer._
2026-07-16 10:38:51 -07:00
..
2026-05-22 13:19:22 +01:00
2026-03-17 15:55:47 -07:00