Skip to content

feat(parser): attach put Equipment to source follow-up (The Invincible Iron Man) (#4796)#5451

Merged
matthewevans merged 1 commit into
phase-rs:mainfrom
real-venus:feat/iron-man-put-attach-equipment-followup
Jul 9, 2026
Merged

feat(parser): attach put Equipment to source follow-up (The Invincible Iron Man) (#4796)#5451
matthewevans merged 1 commit into
phase-rs:mainfrom
real-venus:feat/iron-man-put-attach-equipment-followup

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Closes #4796.

Bug: The Invincible Iron Man ("At the beginning of combat on your turn, you may put an artifact card from your hand onto the battlefield. If it's an Equipment, attach it to The Invincible Iron Man.") misparsed the follow-up: the "if it's an Equipment, attach it to ~" clause lowered to an illegal self-attach Attach{ParentTarget, ParentTarget} (an Equipment can't equip itself, CR 301.5c) gated by a wrong-subject TargetMatchesFilter that tested the injected source (Iron Man) instead of the just-moved card. So a put Equipment was never attached.

Fix: A dedicated nom recognizer try_parse_moved_card_subtype_attach_followup (in oracle_effect/conditions.rs), dispatched in the effect-chunk loop before the generic conditional cascade and guarded on a preceding battlefield put, emits the already-supported forward_result idiom (the same one Armored Skyhunter / Gilgamesh use):

  • parent ChangeZone(Hand→Battlefield) with sub_ability = Attach{attachment: SelfRef (the moved card, rebound to the forwarded object), target: ParentTarget (the source host)}
  • gated by ZoneChangedThisWay{Equipment} (reads the moved card's type, not a target slot)

rewire_result_anchored_subchain re-affirms forward_result. No new variant, no new runtime — the runtime forward_result Attach path already resolves this shape.

Sibling cards phrased "if an Equipment is put onto the battlefield this way" use a different combinator and are unaffected; typed (non-source) hosts remain an honest gap.

CR 608.2c (later text modifies earlier), CR 301.5b (abilities may attach an Equipment), CR 301.5c (self-attach illegal), CR 701.3a (attach).

…e>, attach it to ~"

The Invincible Iron Man's begin-of-combat trigger ("you may put an
artifact card from your hand onto the battlefield. If it's an Equipment,
attach it to ~") misparsed the follow-up into an illegal self-attach
(Attach{ParentTarget, ParentTarget} -- an Equipment can't equip itself,
CR 301.5c) gated by a wrong-subject TargetMatchesFilter that tested the
injected source (Iron Man) instead of the just-moved card. So a put
Equipment was never attached.

Recognize the "if it's a[n] <subtype>, attach it to ~" follow-up as a
unit (try_parse_moved_card_subtype_attach_followup), guarded on a
preceding battlefield put, and emit the already-supported forward_result
idiom used by Armored Skyhunter / Gilgamesh: parent ChangeZone(Hand->
Battlefield) with sub_ability Attach{attachment: SelfRef (the moved
card), target: ParentTarget (the source)} gated by
ZoneChangedThisWay{Equipment}. No new variant, no new runtime -- the
runtime forward_result Attach path already resolves this shape;
rewire_result_anchored_subchain re-affirms forward_result.

Sibling cards phrased "if an Equipment is put onto the battlefield this
way" use a different combinator and are unaffected. Typed (non-source)
hosts remain an honest gap.

CR 608.2c (later text modifies earlier), CR 301.5b (abilities may attach
an Equipment to a creature), CR 301.5c (self-attach illegal), CR 701.3a
(attach).

Closes phase-rs#4796.
@real-venus
real-venus requested a review from matthewevans as a code owner July 9, 2026 18:04
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

1 similar comment
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Parse changes introduced by this PR · 1 card(s), 1 signature(s) (baseline: main a3b3f61959ea)

1 card(s) · ability/Attach · field conditional: target is EquipmentEquipment changed zones this way

Examples: The Invincible Iron Man

1 card(s) had Oracle-text changes (errata/reprint) — excluded as non-parser.

@matthewevans matthewevans self-assigned this Jul 9, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review: parser diff is scoped to The Invincible Iron Man, the change lands in the existing moved-card follow-up parser path, and the production parser test pins ChangeZone -> Attach wiring with forward_result and ZoneChangedThisWay. Green required checks and no blocking review comments.

@matthewevans matthewevans added the bug Bug fix label Jul 9, 2026
@matthewevans
matthewevans added this pull request to the merge queue Jul 9, 2026
@matthewevans matthewevans removed their assignment Jul 9, 2026
Merged via the queue into phase-rs:main with commit 58fa4c7 Jul 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Invincible Iron Man does not attach Equipment put onto the battlefield

2 participants