Skip to content

Sprint 3.4: War Exhaustion & Status Quo — enforcement, forced peace, and UX transparency#106

Merged
makr-code merged 3 commits into
mainfrom
copilot/sprint-3-4-war-exhaustion-status-quo
Apr 12, 2026
Merged

Sprint 3.4: War Exhaustion & Status Quo — enforcement, forced peace, and UX transparency#106
makr-code merged 3 commits into
mainfrom
copilot/sprint-3-4-war-exhaustion-status-quo

Conversation

Copilot AI commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

War endings by exhaustion were invisible to players, status quo had no player-triggerable path, and two silent rendering bugs corrupted the war list display.

Backend

  • war_list_active(): now includes recently-ended wars (48h window) with ended_reason + ended_at; ended wars skip expensive goal enrichment
  • respond_peace: sets ended_reason = "status_quo" when accepted offer contains a white_peace term (previously always "peace_accepted")
  • New force_status_quo action: ends war with ended_reason = "status_quo" when requester's side exhaustion ≥ WAR_EXHAUSTION_PRESSURE_THRESHOLD (80); rejects with 403 if threshold not met
  • New constants in combat_config.php: WAR_EXHAUSTION_PRESSURE_THRESHOLD = 80, WAR_ENDED_VISIBILITY_SECONDS = 172800

Frontend (RuntimeWarController.js)

Bug fixes:

  • summary.pressure is an object {own_exhaustion, enemy_exhaustion, …} — was being passed to Number(), producing NaN in the Pressure column
  • summary.primary_goal is an object — was rendered as [object Object] in the Goal column; now uses primaryGoal.label

Exhaustion UX:

  • Color-coded exhaustion: green → yellow (≥50) → orange+⚠ HIGH badge (≥80) → red+⚠ MAX badge (≥100)
  • Detail view gains per-side exhaustion progress bars with inline warnings at ≥80%
  • ⚡ Force Status Quo button appears in detail toolbar when own exhaustion ≥ 80 (active wars only)

Ended wars visibility:

  • Ended wars render as dimmed rows with human-readable reason labels (⚖ Status Quo, 🕊 Peace Treaty, 😮 Forced Peace (Exhaustion))
  • Section heading shows Active Wars (+ N recently ended) when mixed

API client

forceStatusQuo({ war_id }) added to api.jsPOST api/war.php?action=force_status_quo

Tests

14 new tests added to war-events.test.js (34 total); covers exhaustion badges, force-status-quo button visibility, ended-war list rendering, and primaryGoal label fix.

- config/combat_config.php: add WAR_EXHAUSTION_PRESSURE_THRESHOLD (80) and WAR_ENDED_VISIBILITY_SECONDS (48h)
- api/war.php: war_list_active() now includes recently-ended wars (48h window) with ended_reason + ended_at
- api/war.php: respond_peace sets ended_reason='status_quo' when white_peace term is accepted
- api/war.php: new force_status_quo action (ends war with status_quo when own exhaustion >= 80)
- js/network/api.js: add forceStatusQuo() API client method
- RuntimeWarController.js: fix pressure display bug (was treating object as number)
- RuntimeWarController.js: fix primaryGoal display bug (was rendering [object Object])
- RuntimeWarController.js: add exhaustionColor/Badge helpers with HIGH/MAX warnings
- RuntimeWarController.js: add endedReasonLabel() helper (status_quo, forced_peace, peace_treaty)
- RuntimeWarController.js: show ended wars with reason in list (with dimmed row style)
- RuntimeWarController.js: show recently-ended count in section title
- RuntimeWarController.js: add exhaustion progress bars in detail view with warning messages
- RuntimeWarController.js: add Force Status Quo button in detail when own exhaustion >= 80
- RuntimeWarController.js: wire Force Status Quo listener with confirm dialog
- tests/js/war-events.test.js: 14 new tests covering all new features (34 total, all passing)

Agent-Logs-Url: https://github.com/makr-code/GalaxyQuest/sessions/5c95e5e2-93e4-4740-baa5-a103b7bebc55

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot AI changed the title [WIP] Refine war exhaustion and status quo mechanics Sprint 3.4: War Exhaustion & Status Quo — enforcement, forced peace, and UX transparency Apr 12, 2026
Copilot AI requested a review from makr-code April 12, 2026 07:01
@makr-code
makr-code marked this pull request as ready for review April 12, 2026 07:11
@makr-code
makr-code merged commit 86a1a84 into main Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sprint 3.4: War Exhaustion & Status Quo verfeinern

2 participants