Expand description
Replacement effect dispatcher.
Mirrors the Java Forge ReplacementHandler.java in
forge/game/replacement/.
The entry point is apply_replacements, which accepts a mutable
ReplacementEvent and iterates through the five CR 616 layers
(CantHappen → Control → Copy → Transform → Other), applying the first
matching effect in each layer.
Structs§
- Counter
MapValue - Replacement
Handler - Struct-based replacement handler with loop prevention and optional agent access.
- Replacement
Runtime
Enums§
- Replacement
Event - A game event that may be subject to one or more replacement effects.
Functions§
- apply_
moved_ replacement - Apply Moved replacement effects (Rest in Peace, Leyline of the Void) for a card being moved to the Graveyard. Uses agents for proper RNG consumption when multiple effects apply. Returns the final destination zone.
- apply_
replacements - Apply all applicable replacement effects to a game event.
- apply_
replacements_ with_ agents - apply_
replacements_ with_ agents_ and_ runtime - cant_
happen_ check - Check if any
CantHappen-layer replacement effect would prevent this event. - parse_
replacement - Parse a raw
R$replacement-effect line. Re-export ofreplacement_effect::parse_replacement_effectfor scan parity. - run_
replace_ damage - Apply replacement effects specifically for damage events.
- visit
- Walk all battlefield cards and collect
(card_id, effect_index)pairs for replacement effects matching the given event type and optional layer. - would_
extra_ turn_ be_ skipped - Check if any
BeginTurnreplacement effect in theOtherlayer would skip an extra turn for the given player. - would_
phase_ be_ skipped - Check if any
BeginPhasereplacement effect in theControllayer would skip the given phase for the given player.