[P1] Poison/Noxious Fumes tick-arming window is too wide (participants + dealer invariant) #252
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens#252
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Priority: P1. From the 2026-07-02 audit. Confirmed against decompiled game code. (The poison effective-damage math bug is already fixed in PR #248; this is the separate arming-window width bug.)
Problem
The poison-tick attribution window is too wide in both dimensions:
PoisonPowerAfterSideTurnStartPatchandNoxiousFumesAfterSideTurnStartPatchare unconditional prefixes, but decompiledHook.AfterSideTurnStartinvokes every power'sAfterSideTurnStarton every side's turn start; the powers' own bodies gate onparticipants.Contains(Owner)— the prefixes do not. So every player turn start arms a phantomPendingPoisonTicks[enemy]for each poisoned enemy even though no tick will occur.The disarm guard
historyCount >= pendingTick.ArmedAtHistoryCount(RunTracker.cs:~4990) is vacuously true, so an armed tick never expires and, while armed, bypasses both thedealer==nulland amount-match fallback guards.Failure (Necrobinder poison + Osty/Doom — the class's core mechanics): a player-turn-start phantom arm, then Osty attacks a poisoned enemy / a damage potion / DoomPower ticks first → each emits
DamageReceivedEntrywithCardSource==null→ routed toTryRecordPoisonTickDamage→armedTick=true→ the unrelated damage is credited to the poison-applying cards and the ownership ledger is corrupted for all later real ticks.Fix
PoisonPowerAfterSideTurnStartPatch.cs:22,NoxiousFumesAfterSideTurnStartPatch.cs:27) — Harmony injects by parameter name — and only arm whenparticipants.Contains(target)(mirrors the powers' own gate).TryRecordPoisonTickDamage, requireentry.Dealer == nullunconditionally and only consume the pending entry ondealer==null(real ticks always passdealer:null), so Osty attacks / potions are excluded even if an armed entry lingers.>=guard with a bounded freshness window (e.g.historyCount - ArmedAtHistoryCount <= 4).HittableEnemies.AfterSideTurnStartto clear — the method is async and the postfix runs at the firstawait, before the tick's damage entry.This window folds naturally into the AttributionWindow registry issue.
Uncapped audit pass — confirmed detail:
PoisonPowerAfterSideTurnStartPatch.cs:22-28andNoxiousFumesAfterSideTurnStartPatch.cs:27arm unconditionally on every side turn start, but the game gates onparticipants.Contains(Owner); the disarm guardhistoryCount >= ArmedAtHistoryCount(RunTracker.cs:4996) is vacuously true. BindIReadOnlyList<Creature> participantsby name into both prefixes, arm only when the resolved target/owner is a participant, and requireDealer==nullwhen armed (#28, #68, both confirmed HIGH). NOTE: the poison effective-damage math half of the original report is already fixed in PR #248.Implemented in #268: participants bound into the PoisonPower/NoxiousFumes AfterSideTurnStart prefixes, window armed only when the poisoned owner is a participant (mirrors PoisonPower.cs:57 / NoxiousFumesPower.cs:28); TryRecordPoisonTickDamage now requires Dealer==null before consuming and uses a bounded freshness window (<=24 history entries) instead of the vacuous guard. Prefix participants-binding verified live (patch binds, 0 failed). Behavioral tick-attribution still wants a live poison combat to confirm.
Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.