Skip to content

Count auto-tapped mana toward Expend - #7245

Merged
matthewevans merged 1 commit into
mainfrom
agent/on-deck-expend-auto-payment
Aug 12, 2026
Merged

Count auto-tapped mana toward Expend#7245
matthewevans merged 1 commit into
mainfrom
agent/on-deck-expend-auto-payment

Conversation

@matthewevans

@matthewevans matthewevans commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Use the authoritative cast-payment mana stamp when finalizing a spell, including auto-tapped mana produced and spent between pool snapshots.
  • Remove the obsolete snapshot from deferred cast resumption.
  • Add a Bakersbane Duo regression covering an automatically paid four-mana spell.

Validation

  • Tilt clippy: green.
  • Tilt test-engine: 23,687 passed, including issue_7232_expend_auto_land_payment.

Closes #7232.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected casting-cost tracking to accurately include mana paid through automatically tapped lands.
    • Fixed Expend-related effects so they recognize the full mana amount used to cast a spell.
    • Improved deferred and alternate payment handling for spell costs.
  • Tests

    • Added integration coverage confirming that auto-tapped land mana correctly contributes to Expend bonuses.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2061f03d-3fd6-4ca0-afd3-c21bd22f89a6

📥 Commits

Reviewing files that changed from the base of the PR and between 678d198 and 8606308.

📒 Files selected for processing (4)
  • crates/engine/src/game/casting_costs.rs
  • crates/engine/src/types/game_state.rs
  • crates/engine/tests/integration/issue_7232_expend_auto_land_payment.rs
  • crates/engine/tests/integration/main.rs
💤 Files with no reviewable changes (1)
  • crates/engine/src/types/game_state.rs

📝 Walkthrough

Walkthrough

Casting-cost tracking now reads mana recorded on the spell object. Pool-snapshot tracking was removed from pending cast state and deferred payment paths. A new integration test verifies that auto-tapped lands count toward Expend.

Changes

Mana payment tracking

Layer / File(s) Summary
Recorded payment authority
crates/engine/src/game/casting_costs.rs
Cast finalization uses the spell object's recorded mana amount instead of subtracting mana-pool snapshots.
Deferred payment state
crates/engine/src/game/casting_costs.rs, crates/engine/src/types/game_state.rs
Pending cast state no longer stores pool_before. Deferred payment paths use recorded spell payment amounts.
Auto-tapped land validation
crates/engine/tests/integration/issue_7232_expend_auto_land_payment.rs, crates/engine/tests/integration/main.rs
The integration suite verifies Expend tracking for a spell paid with four auto-tapped lands and checks Bakersbane Duo's +1/+1 effect.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: bug

Suggested reviewers: lgray, jacobwoodson, andriypolanski

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: counting auto-tapped mana toward Expend.
Linked Issues check ✅ Passed The changes use recorded payment amounts, remove the faulty snapshot logic, and add regression coverage for issue #7232.
Out of Scope Changes check ✅ Passed All changes directly support the Expend fix and its regression test; no unrelated code changes are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/on-deck-expend-auto-payment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Generated for head 860630816352523affb9ec91ac8016a0d7f0eaa5.

Parse changes introduced by this PR

✓ No card-parse changes detected.

@matthewevans
matthewevans force-pushed the agent/on-deck-expend-auto-payment branch from 4549259 to 8606308 Compare August 11, 2026 21:24
@matthewevans
matthewevans marked this pull request as ready for review August 12, 2026 03:30
@matthewevans
matthewevans added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit 58107f7 Aug 12, 2026
15 checks passed
@matthewevans
matthewevans deleted the agent/on-deck-expend-auto-payment branch August 12, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expend never triggers: mana paid by tapping lands is counted as zero

1 participant