fix(parser): scope "that player" to triggering player for Aura/Equipment damage triggers#6540
fix(parser): scope "that player" to triggering player for Aura/Equipment damage triggers#6540hitomi1 wants to merge 4 commits into
Conversation
…ent damage triggers
Article-less damage-source subjects ("enchanted creature" / "equipped
creature") failed the DamageDone-pattern check in
`parse_damage_source_subject` (it required a leading article), so a later
"that player controls/'s" anaphor mis-bound to `ControllerRef::TargetPlayer`
— surfacing a phantom companion Player target slot that froze the game
(Sigil of Sleep). Recognize the two determiner subjects as
`TargetFilter::AttachedTo` so the DamageDone pattern matches and the
anaphor binds to `TriggeringPlayer`.
Covers Sigil of Sleep, Hammer of Ruin, Fishing Gear, Whispersteel Dagger.
Komainu Battle Armor's compound "this creature or equipped creature"
subject is a separate follow-up.
CR 303.4b + CR 301.5a + CR 120.3a.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughChangesOracle trigger parsing
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Parse changes introduced by this PR · 6 card(s), 4 signature(s) (baseline: main
|
matthewevans
left a comment
There was a problem hiding this comment.
Requested change
P1 — Explain or constrain the parser blast radius
The fresh coverage-parse-diff shows parser-output changes for four cards outside this PR’s claimed Sigil of Sleep / Hammer of Ruin scope: Sword of Fire and Ice, Sword of War and Peace, Quietus Spike, and Scytheclaw.
Please either narrow the grammar so these changes do not occur, or document why each change is intended and add card-level runtime coverage for the affected behavior. Re-run the parse diff on the updated head.
This is blocking because parse_damage_source_subject is shared damage-trigger grammar, and the current PR does not provide evidence that those additional behavior changes are correct.
Fixes #4240.
Problem
Sigil of Sleep froze the game (p0 softlock — the "set resolve order" prompt could not be actioned). Its trigger — "Whenever enchanted creature deals damage to a player, return target creature that player controls to its owner's hand" — surfaced two target slots (a Player and a creature) instead of one. The phantom Player slot has no meaningful prompt, so the client hung waiting on it.
Root cause
parse_damage_source_subject(inparser/oracle_trigger.rs) required a leading article, so the article-less Aura/Equipment subjects"enchanted creature"/"equipped creature"failed the strictis_damage_done_trigger_patterncheck and fell through tocondition_introduces_target_player. That mis-bound the effect's"that player controls"anaphor toControllerRef::TargetPlayer— whose documented behavior is to auto-surface a companionPlayertarget slot — instead ofControllerRef::TriggeringPlayer(the damaged player identified by the triggering event).Fix
Recognize the two article-less determiner subjects at the top of
parse_damage_source_subject, resolving them toTargetFilter::AttachedTo(which is also the correctvalid_sourcefor the source-led trigger path — notTyped(Enchanted/EquippedBy), which would match any attached creature). TheDamageDonepattern now matches, sorelative_player_scope_for_conditionreturnsTriggeringPlayerand the anaphor binds correctly — a single creature target scoped to the damaged player.Scope (built for the class, not the card)
Fixes Sigil of Sleep, Hammer of Ruin, Fishing Gear, Whispersteel Dagger. Komainu Battle Armor's compound
"this creature or equipped creature"subject is a disjunctive variant left for a follow-up (unchanged here — no regression).Tests
relative_player_scope_for_conditionasserting both determiner subjects →TriggeringPlayer(covers the class).TriggeringPlayer-scoped creature target (was red before the fix).clippy -D warningsclean,cargo fmtapplied.CR 303.4b + CR 301.5a + CR 120.3a.
🤖 Generated with Claude Code
Summary by CodeRabbit