Skip to main content

Module computer_util_mana

Module computer_util_mana 

Source

Structs§

AutoTapChoice
AutoTapPaymentTrace
ManaPaymentSources

Enums§

ManaPayCallback
Callback parameter for mana ability payment decisions. Used to dispatch both sacrifice chooser and confirm payment callbacks through a single unified interface to avoid multiple mutable borrows.

Functions§

auto_tap_lands
Auto-tap lands to produce the required mana. Mirrors harness AutoPay flow used by parity tests: collect currently playable mana abilities in battlefield order, choose the first legal source for the next unpaid shard, then repeat after each activation.
auto_tap_lands_allow_reserved_source_reuse
auto_tap_lands_allow_reserved_source_reuse_trace
auto_tap_lands_allow_reserved_source_reuse_trace_with_callbacks_and_reserved_sacrifices
auto_tap_lands_allow_reserved_source_reuse_with_callbacks
auto_tap_lands_allow_reserved_source_reuse_with_callbacks_and_reserved_sacrifices
auto_tap_lands_allow_reserved_source_reuse_with_chooser
auto_tap_lands_generic
Auto-tap untapped lands to produce needed additional generic mana. Used for paying commander tax on top of the regular cost.
auto_tap_lands_pay_incremental_with_callbacks_reserved_and_ctx
auto_tap_lands_trace
auto_tap_lands_trace_with_callbacks
auto_tap_lands_trace_with_callbacks_and_reserved_sacrifices
Same as auto_tap_lands_trace_with_callbacks but excludes the given permanents from the auto-payer’s mana-source pool. Used during spell casting so a permanent reserved for the spell’s additional sacrifice cost (Sac<1/X>) can’t also be picked for a Sac<1/CARDNAME> mana ability — see the seed-62 Eviscerator’s Insight divergence.
auto_tap_lands_trace_with_callbacks_reserved_and_ctx
Same as auto_tap_lands_trace_with_callbacks_and_reserved_sacrifices but propagates a ManaPaymentContext to the source-grouping pass so RestrictValid$ mana sources are filtered out when they don’t apply to the current payment (e.g. Flamebraider’s “Spend only on Elemental spells/ abilities” must not show up when paying an UnlessCost).
auto_tap_lands_with_callbacks
Auto-tap with unified callback for both sacrifice chooser and confirm payment. Used by parity tests to mirror Java’s RNG-driven decision paths.
auto_tap_lands_with_chooser
Auto-tap with an explicit sacrifice chooser callback for parity with Java’s choosePermanentsToSacrifice RNG path.
can_pay_mana_cost_with_reserved_sacrifices
can_pay_spell_mana_cost_for_action_space
collect_mana_payment_sources
next_auto_tap_choice
Determine the next mana source/ability auto-pay would use without mutating the game or pool. This lets callback-driven payment replay the exact same source choice as engine auto-pay, including multi-ability lands.
next_auto_tap_choice_with_reserved_sacrifices

Type Aliases§

ManaPayCallbackFn
Unified callback for mana payment decisions during auto-tap. Returns Some(card_id) on success, None to cancel.
SacrificeChooser
Optional callback for choosing which permanent to sacrifice during mana ability cost payment. When None, the engine picks the first target after sorting by (card_name, card_id) — a deterministic fallback. When Some, the callback is invoked with the sorted list of valid targets and should return the chosen card (mirrors Java’s choosePermanentsToSacrifice which uses the harness RNG).