Co-op stat scoping, AttributionWindow registry, poison window gate (#260/#250/#252) #268

Merged
nelsong6 merged 3 commits from claude/coop-registry-poison into main 2026-07-03 11:45:12 -07:00
nelsong6 commented 2026-07-03 11:15:40 -07:00 (Migrated from github.com)

Implements the three requested changes. Stacks on #267 (the consolidated audit branch). Designed against the decompiled game via a 4-agent verification fan-out, applied in dependency order (poison → registry → scoping), each phase build+test-green and hot-reloaded into a live game (final reload: Patch install: 86 classes patched, 0 failed/skipped, TrackedPlayer resolved: net_id=1, run resumed clean). 259/259 tests pass.

#260 — Co-op: track YOUR OWN stats (not a kill-switch)

Resolve the local player from the game's LocalContext.NetId (verified set by RunManager.Launch before RunStarted) with a sole-player fallback, at run start and every adopt/resume. Fail-open: _trackedNetId==null → every guard allows, so single-player is byte-identical and a detection miss can't disable tracking. Gate the player-keyed ingresses on ownership (card play → cascades to energy/draw/power; deck entry; enemy-damage-taken; block; energy dispatch; Red Mask / Bag of Marbles / The Abacus relic patches). Ownership via LocalContext.IsMe semantics (IsMutable-guarded).

#250 — AttributionWindow registry

New AttributionWindowRegistry (per-combat, FIFO, exclusive-consumption, lives on PendingCombat so new PendingCombat() IS the reset). Multiple windows per kind, FIFO at consume — Orichalcum + Cloak Clasp each fire a distinct block gain in one turn and each claims its own window. Ported the four confirmed-buggy families via single dispatchers replacing the un-arbitrated fan-out: block (Orichalcum/Anchor/Abacus/BoneFlute/CloakClasp), energy (HappyFlower/BoomingConch/GremlinHorn + card fallback), draw (GremlinHorn owner-keyed). Fixes: Gremlin Horn energy+draw double-credit; Cloak Clasp per-card overcount + Orichalcum overlap; Happy Flower disarm-before-arm; Bone Flute stale-flag race. Arbitration core pinned by 9 AttributionWindowRegistryTests. Deferred (non-buggy): Akabeko, Pendulum, Parrying Shield, Horn Cleat.

#252 — Poison / Noxious Fumes window gate

Bind participants into the AfterSideTurnStart prefixes and arm only when the poisoned owner is a participant (mirrors PoisonPower.cs:57 / NoxiousFumesPower.cs:28). Require Dealer==null before consuming a tick, and replace the vacuous history guard with a bounded freshness window.

Verification honesty

Verified: 259 unit tests (incl. the registry arbitration core), decompile-fidelity, and live hot-reload (clean bind + correct tracked-player resolution + run resume). NOT yet verified: the in-combat behavioral scenarios (the 4 relic double-attribution setups; a live co-op run) — they need specific relics / a co-op session. The registry leaves the old per-relic Record methods as dead code (never armed) pending a cleanup pass.

🤖 Generated with Claude Code

Implements the three requested changes. **Stacks on #267** (the consolidated audit branch). Designed against the decompiled game via a 4-agent verification fan-out, applied in dependency order (poison → registry → scoping), each phase build+test-green and **hot-reloaded into a live game** (final reload: `Patch install: 86 classes patched, 0 failed/skipped`, `TrackedPlayer resolved: net_id=1`, run resumed clean). **259/259 tests pass.** ## #260 — Co-op: track YOUR OWN stats (not a kill-switch) Resolve the local player from the game's `LocalContext.NetId` (verified set by `RunManager.Launch` before `RunStarted`) with a sole-player fallback, at run start and every adopt/resume. **Fail-open**: `_trackedNetId==null` → every guard allows, so single-player is byte-identical and a detection miss can't disable tracking. Gate the player-keyed ingresses on ownership (card play → cascades to energy/draw/power; deck entry; enemy-damage-taken; block; energy dispatch; Red Mask / Bag of Marbles / The Abacus relic patches). Ownership via `LocalContext.IsMe` semantics (`IsMutable`-guarded). ## #250 — AttributionWindow registry New `AttributionWindowRegistry` (per-combat, FIFO, exclusive-consumption, lives on `PendingCombat` so `new PendingCombat()` IS the reset). **Multiple windows per kind, FIFO at consume** — Orichalcum + Cloak Clasp each fire a distinct block gain in one turn and each claims its own window. Ported the four confirmed-buggy families via single dispatchers replacing the un-arbitrated fan-out: block (Orichalcum/Anchor/Abacus/BoneFlute/CloakClasp), energy (HappyFlower/BoomingConch/GremlinHorn + card fallback), draw (GremlinHorn owner-keyed). Fixes: Gremlin Horn energy+draw double-credit; Cloak Clasp per-card overcount + Orichalcum overlap; Happy Flower disarm-before-arm; Bone Flute stale-flag race. Arbitration core pinned by 9 `AttributionWindowRegistryTests`. Deferred (non-buggy): Akabeko, Pendulum, Parrying Shield, Horn Cleat. ## #252 — Poison / Noxious Fumes window gate Bind `participants` into the `AfterSideTurnStart` prefixes and arm only when the poisoned owner is a participant (mirrors `PoisonPower.cs:57` / `NoxiousFumesPower.cs:28`). Require `Dealer==null` before consuming a tick, and replace the vacuous history guard with a bounded freshness window. ## Verification honesty Verified: 259 unit tests (incl. the registry arbitration core), decompile-fidelity, and live hot-reload (clean bind + correct tracked-player resolution + run resume). **NOT yet verified:** the in-combat *behavioral* scenarios (the 4 relic double-attribution setups; a live co-op run) — they need specific relics / a co-op session. The registry leaves the old per-relic Record methods as dead code (never armed) pending a cleanup pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens!268
No description provided.