From 9b67a780eba62f8354d738cb64901f8637f18e62 Mon Sep 17 00:00:00 2001 From: Quintine <15965533+Quintine@users.noreply.github.com> Date: Sun, 20 Sep 2026 11:45:47 +1000 Subject: [PATCH] Connect early Juice of Sapho battle aggressor During the existing public pre-plan opportunity, the holder can discard canonical unreserved Sapho to become aggressor before their readiness or any binding plan/Voice/inspection/Truthtrance commitment. Unchosen preparation prompts remain available. No new confirmation-only or holder-dependent response window is introduced. Later intervention and its allocation/privacy protocol remain unfinished. A battle/turn/revision-bound history and independent event list preserve accepted priority while keeping attacker, defender and chooser stable. Legitimately recovered cards can change priority again at a fresh event. Reads, actions and normalization reject corrupt histories/custody. Shared tie priority respects Habbanya in either physical slot and reaches pre-commit Stone/Voice checks, public views, bot calculations and actual ordinary/Stone resolution. The final quote previously assumed original attacker priority and now consumes the validated aggressor. Harkonnen capture still follows actual winner/loser. Owner controls, public aggressor/tie text, automatic notices and internal guidance are connected. Focused tests exercise actual tied results in Basic/Advanced, both Habbanya sides, mixed-force Stone finishability before opposing commitments, a real allied Prescience boundary, stale/late/cross-owner rejection, private rival noninterference, receipt corruption, saved recovered-card revision, actual policies at all four AI levels and authenticated SQLite races/seat restoration. Independent review found no material defect. A prior scheduling test now explicitly readies its human holder to save the card instead of allowing the new legal AI play. Types, lint and 4866 offline tests, production build and 43 HTTP/session tests pass on the unchanged source fingerprint below. Two genuine CHOAM/Richese samples completed with 1279 accepted actions, 34 periodic JSON restores and no rejected candidates. One movement Sapho play occurred; neither sample used aggressor. Targeted tests and browser evidence, not those samples, establish the new effect. Full expansion and module acceptance remain incomplete. In a new isolated browser room, genuine Advanced faction setup was followed by conserved battle staging. The human Guild used the actual aggressor button, restored the spent card and priority after refresh, readied, selected Master Bewt with zero dial/support, and declined a Traitor call. The staged Emperor opponent used real engine ready/plan/vote actions with Caid and zero dial/support. Guild won the 3-3 tie, retained four forces and 30 spice, and Emperor lost four forces. Final refresh and private JSON views restored the same outcome; the original seat row is unchanged. Screenshot capture timed out, so visual screenshot acceptance is not claimed. All 1072 original games and original seat/recovery/entry/handover records are unchanged; 1106 rooms remain including isolated QA and HTTP fixtures. SQLite quick-check and foreign keys pass. The healthy server was reused without reset/restart or automation. The Mirror audit now records why every genuine CHOAM/Richese setup includes unresolved copy candidates: an ordinary-copy-only gate would need hidden eligibility or altered inventory. Mirror stays gated pending the existing disposal ruling and copied-choice work. No mode/publication gate is opened. Verified source tree: 2fb3160efd713a3f7068aedb474868ba6863bccc420848a56e69e1df1d84441b --- components/game-table.tsx | 5 ++ components/juice-of-sapho.tsx | 18 +++-- components/residual-poison.tsx | 1 + docs/CURRENT_STATUS.md | 39 +++++---- docs/IMPLEMENTATION_STATUS.md | 18 +++++ docs/JUICE_OF_SAPHO_RUNTIME.md | 7 +- docs/MIRROR_WEAPON_ENGINE_AUDIT.md | 11 +++ docs/RULE_DECISIONS.md | 4 +- docs/SAPHO_AGGRESSOR.md | 62 +++++++++++++++ docs/SAPHO_BATTLE_ORDER.md | 4 + game/battle-resolution-quote.ts | 8 +- game/card-presentation.ts | 4 +- game/engine.ts | 58 ++++++++++++-- game/reference.ts | 11 ++- game/sapho-aggressor.ts | 72 +++++++++++++++++ tests/fixture-sapho-aggressor.ts | 44 +++++++++++ tests/juice-of-sapho-bots.test.ts | 2 +- tests/sapho-aggressor-recovery.test.ts | 37 +++++++++ tests/sapho-aggressor.test.ts | 92 ++++++++++++++++++++++ tests/sapho-battle-order-controls.test.tsx | 18 ++++- tests/sapho-battle-order.test.ts | 3 + 21 files changed, 467 insertions(+), 51 deletions(-) create mode 100644 docs/SAPHO_AGGRESSOR.md create mode 100644 game/sapho-aggressor.ts create mode 100644 tests/fixture-sapho-aggressor.ts create mode 100644 tests/sapho-aggressor-recovery.test.ts create mode 100644 tests/sapho-aggressor.test.ts diff --git a/components/game-table.tsx b/components/game-table.tsx index b05a8851..4ca147eb 100644 --- a/components/game-table.tsx +++ b/components/game-table.tsx @@ -4328,6 +4328,11 @@ export function GameTable({ {g.battle.locationName ?? combatName(g.battle.territory)}

+

+ Aggressor: {g.players.find(p => p.id === g.battle!.aggressor)?.name}. + {' '}Tied battle: {g.players.find(p => p.id === g.battle!.tieWinner)?.name} + {g.battle.tieWinner !== g.battle.aggressor ? ' (Habbanya Stronghold advantage)' : ''}. +

{!!g.battle.native && (

Only the native faction may reveal Traitors or Face diff --git a/components/juice-of-sapho.tsx b/components/juice-of-sapho.tsx index 8730c57f..a231369b 100644 --- a/components/juice-of-sapho.tsx +++ b/components/juice-of-sapho.tsx @@ -23,9 +23,9 @@ function unavailableReason(game: GameView) { return 'Movement order can change only before the current combined shipment and movement turn begins. First requires all remaining turns to be unstarted and the Advanced Guild to have finished or be absent. Completed turns stay completed. Already-held positions and committed cards are unavailable.'; if (game.phase === 6) return game.battle - ? 'Finish the current battle and its aftermath before changing the order of remaining battle choices. This does not change the current battle’s aggressor.' + ? 'Become aggressor only during your open pre-plan opportunity, before declaring ready or committing a plan. Already-held priority and committed cards are unavailable. Finish the current battle and its aftermath before changing remaining battle-choice order.' : 'You need an unresolved battle and an available first or last position. Completed battles stay resolved, and a card committed elsewhere cannot be used.'; - return 'These controls support Once Around bidding, movement order and remaining battle-choice order. Battle aggressor and other phase or auction modes remain unfinished.'; + return 'These controls support Once Around bidding, movement order, remaining battle-choice order and pre-plan aggressor. Later battle intervention and other phase or auction modes remain unfinished.'; } export function JuiceOfSapho({ @@ -47,7 +47,7 @@ export function JuiceOfSapho({ return (

- Juice of Sapho: change turn order + Juice of Sapho: change order or become aggressor

@@ -59,13 +59,16 @@ export function JuiceOfSapho({ options.map((option) => { const once = option.scope === 'onceAround'; const battle = option.scope === 'battleOrder'; + const aggressor = option.scope === 'battleAggressor'; return (

- {once + {aggressor + ? 'Become this battle’s aggressor before plans. You win ordinary ties; a Habbanya Stronghold advantage still takes precedence. The participants and later battle choices stay unchanged.' + : once ? `Bid ${option.mode} in the current Once Around lot. Each eligible player still has only one bidding opportunity.` : battle ? `Choose your remaining battles ${option.mode}. Completed battles stay resolved. This changes who chooses next, not the aggressor or tie advantage of a battle. Other players may still choose battles against you before your turn.` @@ -78,8 +81,8 @@ export function JuiceOfSapho({ if (!busy) act({ type: 'card', card: card.id, ...option }); }} > - {once ? 'Bid' : battle ? 'Choose battles' : 'Take your movement turn'} {option.mode} and - discard Juice of Sapho + {aggressor ? 'Become aggressor and discard Juice of Sapho' : + `${once ? 'Bid' : battle ? 'Choose battles' : 'Take your movement turn'} ${option.mode} and discard Juice of Sapho`}

); @@ -90,8 +93,7 @@ export function JuiceOfSapho({

)}

- Battle aggressor and other phase or auction modes are still - unfinished. + Later aggressor intervention and other phase or auction modes are still unfinished.

diff --git a/components/residual-poison.tsx b/components/residual-poison.tsx index e3416a6e..989662b8 100644 --- a/components/residual-poison.tsx +++ b/components/residual-poison.tsx @@ -84,6 +84,7 @@ export function BattleLeaderOpportunity({ game, act, busy }: PreparationProps) {

Both combatants have an opportunity to use available preparations before either commits a leader. Continue when you are ready to choose leaders. + {' '}A held Juice of Sapho can make you aggressor during this opportunity.