Skip to content

test(engine): verify Land Grant's reveal-hand alternative cost#5354

Merged
matthewevans merged 1 commit into
phase-rs:mainfrom
rykerwilliams:fix-land-grant-reveal-hand-gate
Jul 8, 2026
Merged

test(engine): verify Land Grant's reveal-hand alternative cost#5354
matthewevans merged 1 commit into
phase-rs:mainfrom
rykerwilliams:fix-land-grant-reveal-hand-gate

Conversation

@rykerwilliams

Copy link
Copy Markdown
Contributor

Summary

Closes the verification gap on #1098 (Land Grant: "Alternative cost - show hand with no land cards - doesn't work").

Verified Oracle text via Scryfall: "If you have no land cards in hand, you may reveal your hand rather than pay this spell's mana cost. Search your library for a Forest card, reveal that card, put it into your hand, then shuffle." ({1}{G})

Traced the full production chain:

  • The parser already emits an EffectCost(RevealHand) casting option gated by a Not(ZoneCoreTypeCardCountAtLeast{Hand, Land, 1}) condition (existing parser test land_grant_reveal_hand_alternative_cost_option).
  • payable_spell_alternative_cost_detailsrestrictions::evaluate_condition already handles that exact condition shape correctly (existing unit test zone_core_type_card_count_condition_checks_hand_card_types).
  • The same mechanism class (conditional-gate alternative cost via payable_spell_alternative_cost_details) already has full runtime coverage for Ravenous Trap, immediately above in casting_tests.rs.

The one genuine gap was an end-to-end test for this card's specific condition+cost combination. Added two tests driving the real payable_spell_alternative_cost_details / can_cast_object_now production seam:

  • with no land cards in hand, the alt-cost is offered and the spell is castable with zero mana available
  • with a land card in hand, the alt-cost is withheld and the spell is not castable without mana (hostile fixture for an inverted/ignored gate)

No production code change was needed — Land Grant's alternative cost already works correctly on current main.

Test plan

🤖 Generated with Claude Code

https://claude.ai/code/session_01DMa6DrxXyFHBdGxz3uLgvM

…-rs#1098)

Land Grant ("If you have no land cards in hand, you may reveal your hand
rather than pay this spell's mana cost.") reports the alt-cost as
non-functional. Traced the full production chain: the parser already emits
an EffectCost(RevealHand) casting option gated by a
Not(ZoneCoreTypeCardCountAtLeast{Hand, Land, 1}) condition, and
payable_spell_alternative_cost_details already evaluates that exact
condition shape correctly (see the pre-existing
zone_core_type_card_count_condition_checks_hand_card_types unit test in
restrictions.rs). The one gap was an end-to-end runtime test for this
specific card's condition+cost combination, following the Ravenous Trap
precedent immediately above in this file.

Adds two tests driving the real payable_spell_alternative_cost_details /
can_cast_object_now production seam:
- with no land cards in hand, the alt-cost is offered and the spell is
  castable with zero mana available
- with a land card in hand, the alt-cost is withheld and the spell is not
  castable without mana (hostile fixture for an inverted/ignored gate)

No production code change needed — already correct on current main.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@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.

Clean test-only coverage PR. I verified the diff is limited to casting tests, the new assertions exercise the parsed Land Grant alternative-cost condition through payable_spell_alternative_cost_details and can_cast_object_now, and there are no actionable review comments.

@matthewevans matthewevans added test Add tests quality For high-quality minimal to no-churn PRs labels Jul 8, 2026
@matthewevans matthewevans enabled auto-merge July 8, 2026 01:46
@matthewevans matthewevans removed their assignment Jul 8, 2026
@matthewevans matthewevans added this pull request to the merge queue Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Parse changes introduced by this PR

✓ No card-parse changes detected.

Merged via the queue into phase-rs:main with commit 4f84635 Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

quality For high-quality minimal to no-churn PRs test Add tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants