feat(diplomacy): Sprint 3.2 – Diplomatic Plays 4-Phase Escalation System#104
Merged
Conversation
…tion system - SQL migration: trust/threat columns + diplomatic_plays table - Backend API: api/diplomatic_plays.php (propose_play, counter_play, mobilize, resolve, trust_threat, list) - Frontend: RuntimeDiplomaticPlaysDataModel.js + RuntimeDiplomaticPlaysPanel.js - Network: add diplomatic plays methods to api.js - Wiring: game.js + SocialControllersBootstrap + FactionsController - Tests: 38 unit tests in tests/js/diplomatic-plays.test.js - Docs: update ROADMAP.md and IMPLEMENTATION_AUDIT.md Agent-Logs-Url: https://github.com/makr-code/GalaxyQuest/sessions/1bcb83de-f4cb-4f24-8bc5-b7844a738ce9 Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement escalation model for diplomacy phases
feat(diplomacy): Sprint 3.2 – Diplomatic Plays 4-Phase Escalation System
Apr 12, 2026
makr-code
marked this pull request as ready for review
April 12, 2026 06:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The game had a basic treaty system but no escalation model. This implements the full Cooperation → Threat → Ultimatum → War pipeline with Trust/Threat as independent bilateral axes, per the design doc (
GAMEPLAY_DATA_MODEL.md§6.4).Data Layer
sql/migrate_diplomatic_plays_v1.sql— addstrust_level,threat_level,trust_decay_ratetodiplomacytable; createsdiplomatic_playstable tracking phase, timestamps, demands, outcome, and trust/threat snapshotsBackend (
api/diplomatic_plays.php)Six actions:
propose_play(opens Cooperation phase, +3 trust),counter_play(→ Threat, −5 trust, +10 threat),mobilize(→ Ultimatum, −10 trust, +10 threat),resolve(deal/war/withdrawal with standing + trust/threat deltas),trust_threat,list. AI acceptance probability factors in current trust, threat, faction aggression, and current phase:War resolution attempts to insert into a
warstable if it exists (graceful no-op otherwise).Frontend
RuntimeDiplomaticPlaysDataModel.js— pure data model: phase/goal/outcome metadata,trustBarHTML()(−100..+100 normalised),threatBarHTML()(0..100),phaseStepperHTML()(done/active/pending steps),playCardHTML()(contextual action buttons per phase)RuntimeDiplomaticPlaysPanel.js— renders Trust/Threat bars, active/historical play cards, new-play form; handles all phase transitions with confirmation guards on destructive actionsWiring
api.js— 6 new methods (diplomaticPlaysList,diplomaticPlaysTrustThreat,diplomaticPlaysPropose,diplomaticPlaysCounter,diplomaticPlaysMobilize,diplomaticPlaysResolve)RuntimeFactionsController.js— adds🎭 Playstab button +playsmode handler alongside existingtreatiesmodeRuntimeSocialControllersBootstrap.js+game.js— instantiate and wire both new runtime modulesTests
38 unit tests in
tests/js/diplomatic-plays.test.jscovering phase ordering, index lookups, trust/threat bar clamping/coloring, phase stepper done/active/pending counts, play card action button variants, and panel render/interaction flows.