Expand description
SpellAbilityEffect — base trait and utility free functions for effects.
Mirrors Java’s SpellAbilityEffect.java.
In Java this is an abstract class with many protected static helpers;
in Rust we keep the trait for interface parity and provide the utility
methods as free functions that take (&GameState, &SpellAbility).
Enums§
- AtEot
Action AtEOT$ <action>— delayed-trigger action token. Mirrors Java’sSpellAbilityEffect.registerDelayedTriggerlocationarg.
Traits§
- Spell
Ability Effect - Base trait for all spell ability effect implementations.
Functions§
- add_
forget_ on_ moved_ trigger - Add a “forget on moved” trigger to a card — when the card changes zones,
it is removed from its host’s remembered list.
Mirrors Java’s
SpellAbilityEffect.addForgetOnMovedTrigger(SpellAbility, Card, String). - add_
self_ trigger_ at_ eot - check_
valid_ duration - Validate a
Duration$param against the host card’s current state. Mirrors Java’sSpellAbilityEffect.checkValidDuration(String, SpellAbility). - create_
effect - Create a temporary “effect” card in the command zone.
Mirrors Java’s
SpellAbilityEffect.createEffect(SpellAbility, Player, String, String). - exile_
effect_ command - Execute the “exile with” command — exile a card and track the exile source.
Mirrors Java’s
SpellAbilityEffect.exileEffectCommand(Game, SpellAbility, Card). - get_
defined_ cards_ or_ targeted - Get defined cards, falling back to targeted cards if no
Defined$param. - get_
defined_ cards_ or_ targeted_ param - Get defined cards with a custom param name, falling back to targeted.
- get_
defined_ players_ or_ targeted - Get defined players, falling back to targeted players if no
Defined$param. - get_
new_ chooser - Ask the activator’s controller to pick a replacement chooser when the original chooser has lost the game mid-effect (CR 800.4g).
- get_
stack_ description_ with_ subs - Render the stack description for a SpellAbility, including sub-ability text.
Mirrors Java
SpellAbilityEffect.getStackDescriptionWithSubs(Map, SpellAbility). - get_
target_ cards - Get target cards for a spell ability.
If the SA uses targeting, returns the chosen target card(s).
Otherwise, resolves the
Defined$parameter (defaulting to “Self”). - get_
target_ players - Get target players for a spell ability.
If the SA uses targeting, returns the chosen target player(s).
Otherwise, resolves the
Defined$parameter (defaulting to “You”). - handle_
exiled_ with - Track which card exiled another card, for “exile until” effects.
Mirrors Java’s
SpellAbilityEffect.handleExiledWith(SpellAbility, Card). - register_
at_ eot - Register a delayed trigger that fires at end of turn and performs
actiononrememberedcards. Mirrors JavaSpellAbilityEffect.registerDelayedTrigger(sa, location, iterable). - replace_
dying - Set up the “replace dying” replacement effect for cards that should be exiled instead of dying this turn.
- run
- Run/resolve a spell ability effect (the main entry point for effect dispatch).
Mirrors Java’s
SpellAbilityEffect.run(SpellAbility)which calls resolve(). - tokenize_
string - Tokenize a description string, replacing CARDNAME with the actual card name
and NICKNAME with a short version.
Mirrors Java’s
SpellAbilityEffect.tokenizeString(SpellAbility, String).