duel-core: monotonic attack/block declarations; optional permanent counters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 21:36:41 -05:00
co-authored by Claude Opus 5.5
parent 5365611c4a
commit 4daf87edde
2 changed files with 13 additions and 6 deletions
+3 -3
View File
@@ -64,12 +64,12 @@ Engine-side keyword meanings (designer §3.4; duel-design owns the wording):
|---|---|---|
| `mulligan` | each seat not yet ready (seat 0 first) | `keep`, `mulligan` |
| `main` | active | `play {uid, target?}` (cost ≤ Citations; Events and permanents), `endPhase` |
| `attack` | active | `toggleAttacker {uid}` (untapped, non-sick Figure), `confirmAttack` |
| `block` | defender | `block {blocker, attacker}`, `unblock {blocker}`, `confirmBlocks` |
| `attack` | active | `toggleAttacker {uid}` (declare an untapped, non-sick Figure not yet declared), `confirmAttack` |
| `block` | defender | `block {blocker, attacker}` (unassigned blocker, unblocked attacker), `confirmBlocks` |
| any | either seat | `concede` (not listed; always accepted) |
| any | host only | `timeout` for the seat that must act: in `main`/`attack` ends the turn without attacking, in `block` confirms the current blocks, in `mulligan` keeps. It does **not** lose the game; the host decides when a bank is exhausted and may then send `concede`. |
`confirmAttack` with no attackers ends the turn. Attacking taps the attackers. `onAttack` triggers resolve at `confirmAttack`.
Declarations are **monotonic** (no un-declare action), so every turn has a bounded number of actions; UIs stage choices locally and send them on confirm. If the defender has no legal block, combat damage resolves at `confirmAttack` without a block phase. `confirmAttack` with no attackers ends the turn. Attacking taps the attackers. `onAttack` triggers resolve at `confirmAttack`.
## Views and log
- `viewFor(state, seat): PlayerView`: your hand, sizes of the opponent's hand and library, both graveyards, the battlefield with **current** power/toughness and Connected badge, combat, `toAct`, `version`, `result`.
+10 -3
View File
@@ -176,6 +176,12 @@ export interface Permanent extends CardInstance {
tempToughness: number;
/** Doctrines: uid of the Figure they're attached to. */
attachedTo?: string;
/** Well-sourced: prevention already used this turn. */
shielded?: boolean;
/** Stub: counters gained from Stub so far (≤ 2). */
stubCounters?: number;
/** Connected bonus already logged. */
connectedLogged?: boolean;
}
export interface PlayerState {
@@ -193,6 +199,8 @@ export interface PlayerState {
ready: boolean; // kept the opening hand
/** Remaining time bank, in seconds (the host decrements it). */
bankSeconds: number;
/** libraryEmpty 'fatigue': damage of the next empty draw minus 1. */
fatigue?: number;
}
export interface CombatState {
@@ -236,10 +244,9 @@ export type DuelAction =
| { type: 'mulligan' }
| { type: 'play'; uid: string; target?: TargetRef }
| { type: 'endPhase' } // main → attack
| { type: 'toggleAttacker'; uid: string } // attack phase
| { type: 'toggleAttacker'; uid: string } // attack phase: declare one more attacker (monotonic; UIs stage undo locally)
| { type: 'confirmAttack' } // no attackers → end turn
| { type: 'block'; blocker: string; attacker: string } // block phase (defender)
| { type: 'unblock'; blocker: string }
| { type: 'block'; blocker: string; attacker: string } // block phase (defender), monotonic
| { type: 'confirmBlocks' } // damage, then end of turn
| { type: 'concede' } // any time, either seat
| { type: 'timeout' }; // host-only, for the seat that must act