T08 iter 2: Reveal, Resolve, End; relations and the DARVO trigger

Round machinery, system-driven (GR-R04/R06/R08):

- GR-R06 fixed step order with GR-R07 Lead-first ordering inside a step.
  Steps 1 (GROUND), 3 (DARVO stages), 4 (INVESTIGATE) and 6 (SOLVE) are
  not implemented yet; their Actions resolve as no-ops and no scenario
  claims coverage of them.
- SUPPORT GR-A03/A04/A05 and ATTACK GR-A06..A09, with relation
  formation, flip and break per GR-L01/L03/L04 and Protection
  cancellation.
- GR-R08 End: DARVO trigger at Stress 5 in Lead order, Lead rotation,
  Round advance, per-round flags cleared.
- Stress clamps 0-5 on every application, the U2 default, so a mid-round
  spike that is reduced before End does not trigger DARVO.

Two consent-dependent rules are deliberately left out because they need
a decision command rather than a default: Bond formation (GR-L02) and
the target's flip-or-break choice on Support-through-Rivalry (GR-A05).
Both are noted in code and covered by a provisional scenario.

Fixes a defect in the T07 scaffold: relations were keyed by a tuple,
which JSON cannot use as an object key, so state_hash would have
panicked on any state holding a relation. Relation keys are now a Pair
newtype serialized as "a-b", with a regression test.

setup.patch may now create a final key so scenarios can seed open-ended
maps; a typo anywhere earlier in the path is still an error.

8 scenarios pass, 28 rules covered; 17 tests, fmt/clippy green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-07-31 02:19:34 +02:00
parent a09d76f370
commit b58a9139aa
7 changed files with 647 additions and 4 deletions

View file

@ -0,0 +1,48 @@
scenario: ground/gr-a04-bond-support
description: >
Support through an existing Bond: −2 Stress and the target's Freedom
token is readied (GR-A04, GR-F04). A Support with no relation forms no
Bond, because GR-L02 requires the target's consent.
covers: [GR-A04, GR-F04, GR-L02, GR-L05]
provisional: true
seed: 42
setup:
players: 3
preset: standard-3p
patch:
"lead": 0
"relations.0-1": Bond
"players.1.stress": 3
"players.1.freedom_ready": false
commands:
- actor: P1
cmd: select_action
args: { action: SUPPORT, target: P2 }
# No relation with P3: Stress drops but no Bond forms without consent.
- actor: P2
cmd: select_action
args: { action: SUPPORT, target: P3 }
- actor: P3
cmd: select_action
args: { action: GROUND }
- actor: SYSTEM
cmd: reveal
- actor: SYSTEM
cmd: resolve
expect:
events:
- kind: StressSet
player: 1
stress: 1
- kind: FreedomReadied
player: 1
- kind: StressSet
player: 2
stress: 1
state:
"players.1.stress": 1
"players.1.freedom_ready": true
"players.2.stress": 1
# No Bond formed with P3: the relation map is unchanged.
"relations": { "0-1": Bond }
rejects: []

View file

@ -0,0 +1,38 @@
scenario: ground/gr-a07-bond-flip
description: >
Attack through an existing Bond: +2 Stress and the Bond flips to a
Rivalry (GR-A07, GR-L04).
covers: [GR-A07, GR-L04, GR-O05]
provisional: false
seed: 42
setup:
players: 3
preset: standard-3p
patch:
"lead": 0
"relations.0-1": Bond
commands:
- actor: P1
cmd: select_action
args: { action: ATTACK, target: P2 }
- actor: P2
cmd: select_action
args: { action: GROUND }
- actor: P3
cmd: select_action
args: { action: GROUND }
- actor: SYSTEM
cmd: reveal
- actor: SYSTEM
cmd: resolve
expect:
events:
- kind: StressSet
player: 1
stress: 4
- kind: RelationFormed
relation: Rivalry
state:
"players.1.stress": 4
"relations.0-1": Rivalry
rejects: []

View file

@ -0,0 +1,42 @@
scenario: ground/gr-a08-rivalry-break
description: >
Attack through an existing Rivalry: +2 Stress and the relation breaks
(GR-A08, GR-L04). Protection absorbs a separate Attack (GR-A09).
covers: [GR-A08, GR-A09, GR-T01]
provisional: false
seed: 42
setup:
players: 3
preset: standard-3p
patch:
"lead": 0
"relations.0-1": Rivalry
"players.2.protection": 1
commands:
- actor: P1
cmd: select_action
args: { action: ATTACK, target: P2 }
# P3 is protected, so this Attack is cancelled and costs the token.
- actor: P2
cmd: select_action
args: { action: ATTACK, target: P3 }
- actor: P3
cmd: select_action
args: { action: GROUND }
- actor: SYSTEM
cmd: reveal
- actor: SYSTEM
cmd: resolve
expect:
events:
- kind: StressSet
player: 1
stress: 4
- kind: RelationBroken
- kind: AttackCancelled
target: 2
state:
"players.1.stress": 4
"players.2.stress": 2
"players.2.protection": 0
rejects: []

View file

@ -0,0 +1,42 @@
scenario: ground/gr-d01-darvo-trigger
description: >
DARVO trigger: a player who ends the round at Stress 5 with the marker
OFF is set to DENY (GR-D01, GR-R08). Stress clamps at 5 on every
application (GR-F01 under the U2 default).
covers: [GR-D01, GR-R08, GR-F01]
provisional: true
seed: 42
setup:
players: 3
preset: standard-3p
patch:
"lead": 0
"players.1.stress": 4
commands:
- actor: P1
cmd: select_action
args: { action: ATTACK, target: P2 }
- actor: P2
cmd: select_action
args: { action: GROUND }
- actor: P3
cmd: select_action
args: { action: GROUND }
- actor: SYSTEM
cmd: reveal
- actor: SYSTEM
cmd: resolve
- actor: SYSTEM
cmd: end_round
expect:
events:
- kind: StressSet
player: 1
stress: 5
- kind: DarvoTriggered
player: 1
state:
"players.1.stress": 5
"players.1.darvo": Deny
"round": 2
rejects: []

View file

@ -0,0 +1,50 @@
scenario: ground/gr-r06-round-resolve
description: >
A full round: Select, Reveal, Resolve in GR-R06 step order, End. An
unrelated Attack raises Stress and forms a Rivalry; a Support with no
relation lowers Stress without forming a Bond.
covers: [GR-R01, GR-R04, GR-R06, GR-R07, GR-R08, GR-A03, GR-A06, GR-L01, GR-L03, GR-F01]
provisional: false
seed: 42
setup:
players: 3
preset: standard-3p
patch:
"lead": 0
commands:
- actor: P1
cmd: select_action
args: { action: ATTACK, target: P2 }
- actor: P2
cmd: select_action
args: { action: SUPPORT, target: P3 }
- actor: P3
cmd: select_action
args: { action: GROUND }
- actor: SYSTEM
cmd: reveal
- actor: SYSTEM
cmd: resolve
- actor: SYSTEM
cmd: end_round
expect:
events:
- kind: Revealed
# GR-R06: Support (step 2) resolves before Attack (step 5).
- kind: StressSet
player: 2
stress: 1
- kind: StressSet
player: 1
stress: 3
- kind: RelationFormed
relation: Rivalry
- kind: RoundEnded
round: 2
state:
"round": 2
"lead": 1
"players.1.stress": 3
"players.2.stress": 1
"step": Select
rejects: []