Skip to content

Add Valakut Fireboar: switch its power and toughness (pronoun form) - #4906

Merged
matthewevans merged 1 commit into
phase-rs:mainfrom
e11734937-beep:add-valakut-fireboar
Jul 2, 2026
Merged

Add Valakut Fireboar: switch its power and toughness (pronoun form)#4906
matthewevans merged 1 commit into
phase-rs:mainfrom
e11734937-beep:add-valakut-fireboar

Conversation

@e11734937-beep

Copy link
Copy Markdown
Contributor

Summary

Adds engine support for Valakut Fireboar (ZEN) — "Whenever this creature attacks, switch its power and toughness until end of turn." — by teaching the effect parser the pronoun surface form "switch its power and toughness".

Effect::SwitchPT and its layer-7d runtime already exist (Invert, Inversion Behemoth are the supported siblings). The parser recognized two surface forms — prepositional "switch the power and toughness of <target>" and possessive "switch <target>'s power and toughness" — but not the bare pronoun "switch its power and toughness". parse_target does not treat a bare "its" as a target, so both branches missed it and the trigger effect fell to Effect::Unimplemented; the P/T swap never fired.

The fix adds a third branch that matches "switch its power and toughness" and resolves the "its" anaphor through the shared resolve_it_pronoun(ctx) helper — the same anaphor resolution already used by the sacrifice/counter clauses. For Valakut Fireboar the trigger subject is this creature, so "its" resolves to SelfRef (the source switches its own P/T). The change is generic: any effect written as "switch its power and toughness" now lowers to Effect::SwitchPT.

Files changed

  • crates/engine/src/parser/oracle_effect/imperative.rs — pronoun branch in the SwitchPT parser
  • crates/engine/src/parser/oracle_effect/tests.rs — parser unit test effect_switch_pt_pronoun_its
  • crates/engine/tests/valakut_fireboar_switch_pt_on_attack.rs — integration test

Anchored on

  • crates/engine/src/parser/oracle_effect/imperative.rs (~4516) — the existing prepositional and possessive SwitchPT branches; this adds the pronoun sibling immediately before the possessive one.
  • crates/engine/src/parser/oracle_effect/mod.rs:172resolve_it_pronoun already maps "it/its" to SelfRef or TriggeringSource from ctx.subject; reused verbatim.
  • crates/engine/src/game/effects/switch_pt.rsEffect::SwitchPT runtime (layer-7d SwitchPowerToughness); unchanged. Invert and Inversion Behemoth exercise this handler today.

CR references

  • CR 613.4d — switching a creature's power and toughness is a single continuous effect applied in layer 7d.
  • CR 608.2c — the triggered ability's instruction resolves as written; "its" refers to the object established by the trigger (here, the attacking creature).

Track

Developer

LLM

Model: claude-opus-4-8
Thinking: high

Verification

  • cargo fmt --all — clean
  • cargo clippy-strict — clean (0 warnings)
  • ./scripts/check-parser-combinators.sh — clean
  • cargo test -p engine — full engine suite green, 0 failed across all binaries (adds effect_switch_pt_pronoun_its + valakut_fireboar_switches_power_and_toughness_when_it_attacks)
  • ./scripts/gen-card-data.sh — Valakut Fireboar: 0 Unimplemented entries
  • Coverage regression (clean main baseline vs this change, scripts/coverage-regression-check.sh --fail-on-engine): supported 31223 → 31224 (net +1). GAINED: Valakut Fireboar. REGRESSED (engine): 0. REGRESSED (coverage honesty): 0. ORACLE CHANGED: 0. (Invert / Inversion Behemoth unchanged.)
  • cargo semantic-audit — Valakut Fireboar: 0 findings.

The integration test drives the real declare-attackers → trigger → stack → resolution pipeline: Valakut Fireboar (printed 5/2) is declared as an attacker; after the trigger resolves, its effective power/toughness must be 2/5. It flips if the parser branch is reverted — the trigger effect becomes Unimplemented and the P/T stays 5/2.

Scope Expansion

None. (Mangled Soulrager's granted "twelve-time boon" also uses this phrasing, and its "switch its" orphan is now closed; but that card's boon-granting mechanic is a separate unsupported infra gap, so it stays gap_count 1 and is out of scope here.)

Validation Failures

None.

CI Failures

None.

Teach the effect parser the pronoun surface form "switch its power and
toughness" so Valakut Fireboar's attack trigger lowers to Effect::SwitchPT.
The prepositional ("switch the power and toughness of X") and possessive
("switch X's power and toughness") branches already existed; parse_target does
not treat a bare "its" as a target, so the pronoun form fell to
Effect::Unimplemented and the P/T swap never fired.

The new branch matches "switch its power and toughness" and resolves the "its"
anaphor via the shared resolve_it_pronoun helper (SelfRef for Valakut Fireboar's
self-attack trigger). CR 613.4d.
@github-actions github-actions Bot added the needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) label Jul 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for parsing the pronoun form "switch its power and toughness" (with optional "until end of turn" duration) in the MTG engine's imperative oracle effect parser, resolving "its" via the shared it-pronoun anaphor. It also introduces an integration test for Valakut Fireboar to verify this behavior during combat. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

1 card(s) · ability/SwitchPT · added: SwitchPT (duration=until end of turn)

Examples: Valakut Fireboar

1 card(s) · ability/switch · removed: switch (duration=until end of turn)

Examples: Valakut Fireboar

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

@matthewevans matthewevans self-assigned this Jul 2, 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.

Reviewed current head: scoped SwitchPT pronoun parser fix, matching parse-diff evidence for Valakut Fireboar only, green checks, and discriminating runtime coverage.

@matthewevans matthewevans added the bug Bug fix label Jul 2, 2026
@matthewevans
matthewevans added this pull request to the merge queue Jul 2, 2026
@matthewevans matthewevans removed their assignment Jul 2, 2026
Merged via the queue into phase-rs:main with commit cebc8c5 Jul 2, 2026
11 checks passed
@matthewevans matthewevans added enhancement New feature or request quality For high-quality minimal to no-churn PRs labels Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix enhancement New feature or request needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) quality For high-quality minimal to no-churn PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants