Technical Details

This page summarizes game v1.4.0 and competitive rules spec v3.0 in player-readable form. Implementation-grade details live in the Phalanx Duel game repository.

Turn Sequence

Rules spec v3.0 executes a deterministic 8-phase lifecycle, including the optional DeploymentPhase. Attack declaration and combat resolution happen inside that lifecycle, not as a standalone loop.

flowchart LR A[StartTurn] --> B[DeploymentPhase optional] B --> C[AttackPhase] C --> D[AttackResolution] D --> E[CleanupPhase] E --> F[ReinforcementPhase] F --> G[DrawPhase] G --> H[EndTurn]

Gameplay Loop

The game alternates deterministic turns. Each turn emits events for all phases, even if no state changes occur.

flowchart TD S[Classic Setup
Draw 12, alternate deploy] --> T[Turn Trace] T --> U[8 Phase Execution] U --> V{Continue Match?} V -- Yes --> T V -- No --> X[Match Termination]

Statechart

State-level view of the canonical turn lifecycle.

stateDiagram-v2 [*] --> Setup Setup --> TurnStart TurnStart --> AttackPhase TurnStart --> DeploymentPhase: optional deployment DeploymentPhase --> AttackPhase AttackPhase --> AttackResolution AttackResolution --> CleanupPhase CleanupPhase --> ReinforcementPhase ReinforcementPhase --> DrawPhase DrawPhase --> EndTurn EndTurn --> TurnStart: next turn EndTurn --> GameOver: termination / forfeit / system error GameOver --> [*]

Suit Ability Timing

Suit effects are evaluated at boundaries during attack resolution. Canonical boundary order is Shield -> Weapon -> Clamp.

SuitRoleBoundaryCanonical TriggerPractical Effect
DiamondsShieldCard -> CardIf the current destroyed card is a Diamond and the next target is a cardReduces carryover before the next defender takes damage
HeartsShieldCard -> PlayerIf the last destroyed card before the player is a HeartReduces final player damage (Hearts do not stack)
ClubsWeaponCard -> CardIf the attacker is Club and this is the first eligible boundary after the first destructionDoubles carryover once per attack
SpadesWeaponCard -> PlayerIf the attacker is Spade and carryover reaches the playerDoubles final player damage

Match Termination Signals (Canonical Concepts)

Classic Special Cards

Competitive Model (Glicko-2)

Combat Mathematics

For incoming damage d and target HP h, a normal card transition is absorbed = min(d, h), remainingHp = max(0, h - d), and carryover = max(0, d - h). Classic Ace and Face eligibility are explicit branches, not hidden randomness.

At a Card -> Card boundary, a destroyed Diamond subtracts its shield before an eligible Club doubles the remainder. At Card -> Player, the final destroyed Heart subtracts its shield before an attacking Spade doubles the remainder. All values clamp at zero.

The server records these integer operations as a schema-versioned witness. The same witness drives live events, previews, narration, replay, and the post-match Proof of Damage.

Observability & Verification

Trust Model (Why This Matters Online)