Skip to main content

SpellAbilityEffect

Trait SpellAbilityEffect 

Source
pub trait SpellAbilityEffect {
    // Required method
    fn resolve(ctx: &mut EffectContext<'_>, sa: &SpellAbility);

    // Provided methods
    fn get_stack_description(sa: &SpellAbility) -> String { ... }
    fn build_spell_ability(_sa: &mut SpellAbility) { ... }
    fn tokenize_string(
        game: &GameState,
        sa: &SpellAbility,
        desc: &str,
    ) -> String { ... }
    fn add_forget_on_moved_trigger(
        game: &mut GameState,
        host_id: CardId,
        remembered_card_id: CardId,
    ) { ... }
    fn create_effect(
        game: &mut GameState,
        sa: &SpellAbility,
        name: &str,
        image: &str,
    ) -> CardId { ... }
    fn run(ctx: &mut EffectContext<'_>, sa: &SpellAbility) { ... }
    fn handle_exiled_with(
        game: &mut GameState,
        sa: &SpellAbility,
        exiled_card_id: CardId,
    ) { ... }
    fn exile_effect_command(
        game: &mut GameState,
        trigger_handler: &mut TriggerHandler,
        sa: &SpellAbility,
        card_id: CardId,
    ) { ... }
    fn get_stack_description_with_subs(
        game: &GameState,
        sa: &SpellAbility,
    ) -> String { ... }
    fn get_new_chooser(
        game: &GameState,
        agents: &mut [Box<dyn PlayerAgent>],
        sa: &SpellAbility,
        loser: PlayerId,
    ) -> Option<PlayerId> { ... }
}
Expand description

Base trait for all spell ability effect implementations.

Mirrors Java’s abstract SpellAbilityEffect class. Each effect type provides a resolve implementation that performs the actual game-state mutation. Every effect is a stateless unit struct, so all methods are associated functions (no self). The trait is therefore not object-safe — runtime dispatch through dyn SpellAbilityEffect is intentionally unsupported; dispatch happens via the effect_dispatch! macro at compile time.

Required Methods§

Source

fn resolve(ctx: &mut EffectContext<'_>, sa: &SpellAbility)

Resolve this effect for the given spell ability.

Provided Methods§

Source

fn get_stack_description(sa: &SpellAbility) -> String

Return the stack description for this effect. Defaults to the spell ability’s own description.

Source

fn build_spell_ability(_sa: &mut SpellAbility)

Build/configure the spell ability after construction. Default is a no-op; some effects override this to add parameters.

Source

fn tokenize_string(game: &GameState, sa: &SpellAbility, desc: &str) -> String

Tokenize a description string, replacing CARDNAME with the card’s name. Mirrors Java’s SpellAbilityEffect.tokenizeString(SpellAbility, String).

Source

fn add_forget_on_moved_trigger( game: &mut GameState, host_id: CardId, remembered_card_id: CardId, )

Add a “forget on moved” trigger for remembered cards. Mirrors Java’s SpellAbilityEffect.addForgetOnMovedTrigger(SpellAbility, Card, String).

Source

fn create_effect( game: &mut GameState, sa: &SpellAbility, name: &str, image: &str, ) -> CardId

Create a temporary effect card in the command zone. Mirrors Java’s SpellAbilityEffect.createEffect(SpellAbility, Player, String, String).

Source

fn run(ctx: &mut EffectContext<'_>, sa: &SpellAbility)

Run the effect (resolve entry point). Mirrors Java’s SpellAbilityEffect.run(SpellAbility).

Source

fn handle_exiled_with( game: &mut GameState, sa: &SpellAbility, exiled_card_id: CardId, )

Track which card exiled another card, for “exile until” effects. Mirrors Java’s SpellAbilityEffect.handleExiledWith(SpellAbility, Card).

Source

fn exile_effect_command( game: &mut GameState, trigger_handler: &mut TriggerHandler, sa: &SpellAbility, card_id: CardId, )

Execute the exile-with command. Mirrors Java’s SpellAbilityEffect.exileEffectCommand(Game, SpellAbility, Card).

Source

fn get_stack_description_with_subs( game: &GameState, sa: &SpellAbility, ) -> String

Full stack-description with sub-ability concatenation. Mirrors Java SpellAbilityEffect.getStackDescriptionWithSubs(Map, SpellAbility).

Source

fn get_new_chooser( game: &GameState, agents: &mut [Box<dyn PlayerAgent>], sa: &SpellAbility, loser: PlayerId, ) -> Option<PlayerId>

Resolve a replacement chooser when the original lost the game (CR 800.4g). Mirrors Java SpellAbilityEffect.getNewChooser(SpellAbility, Player).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SpellAbilityEffect for AbandonEffect

Source§

impl SpellAbilityEffect for ActivateAbilityEffect

Source§

impl SpellAbilityEffect for AddPhaseEffect

Source§

impl SpellAbilityEffect for AddTurnEffect

Source§

impl SpellAbilityEffect for AdvanceCrankEffect

Source§

impl SpellAbilityEffect for AirbendEffect

Source§

impl SpellAbilityEffect for AlterAttributeEffect

Source§

impl SpellAbilityEffect for AmassEffect

Source§

impl SpellAbilityEffect for AnimateAllEffect

Source§

impl SpellAbilityEffect for AnimateEffect

Source§

impl SpellAbilityEffect for AscendEffect

Source§

impl SpellAbilityEffect for AssembleContraptionEffect

Source§

impl SpellAbilityEffect for AssignGroupEffect

Source§

impl SpellAbilityEffect for AttachEffect

Source§

impl SpellAbilityEffect for BalanceEffect

Source§

impl SpellAbilityEffect for BecomeMonarchEffect

Source§

impl SpellAbilityEffect for BecomesBlockedEffect

Source§

impl SpellAbilityEffect for BidLifeEffect

Source§

impl SpellAbilityEffect for BlankLineEffect

Source§

impl SpellAbilityEffect for BlightEffect

Source§

impl SpellAbilityEffect for BlockEffect

Source§

impl SpellAbilityEffect for BondEffect

Source§

impl SpellAbilityEffect for BranchEffect

Source§

impl SpellAbilityEffect for CamouflageEffect

Source§

impl SpellAbilityEffect for ChangeCombatantsEffect

Source§

impl SpellAbilityEffect for ChangeSpeedEffect

Source§

impl SpellAbilityEffect for ChangeTargetsEffect

Source§

impl SpellAbilityEffect for ChangeTextEffect

Source§

impl SpellAbilityEffect for ChangeXEffect

Source§

impl SpellAbilityEffect for ChangeZoneAllEffect

Source§

impl SpellAbilityEffect for ChangeZoneEffect

Source§

impl SpellAbilityEffect for ChangeZoneResolveEffect

Source§

impl SpellAbilityEffect for ChaosEnsuesEffect

Source§

impl SpellAbilityEffect for CharmEffect

Source§

impl SpellAbilityEffect for ChooseCardEffect

Source§

impl SpellAbilityEffect for ChooseCardNameEffect

Source§

impl SpellAbilityEffect for ChooseColorEffect

Source§

impl SpellAbilityEffect for ChooseDirectionEffect

Source§

impl SpellAbilityEffect for ChooseEvenOddEffect

Source§

impl SpellAbilityEffect for ChooseGenericEffect

Source§

impl SpellAbilityEffect for ChooseNumberEffect

Source§

impl SpellAbilityEffect for ChoosePlayerEffect

Source§

impl SpellAbilityEffect for ChooseSectorEffect

Source§

impl SpellAbilityEffect for ChooseSourceEffect

Source§

impl SpellAbilityEffect for ChooseTypeEffect

Source§

impl SpellAbilityEffect for ClaimThePrizeEffect

Source§

impl SpellAbilityEffect for ClashEffect

Source§

impl SpellAbilityEffect for ClassLevelUpEffect

Source§

impl SpellAbilityEffect for CleanUpEffect

Source§

impl SpellAbilityEffect for CleanupEffect

Source§

impl SpellAbilityEffect for CloakEffect

Source§

impl SpellAbilityEffect for CloneEffect

Source§

impl SpellAbilityEffect for ConniveEffect

Source§

impl SpellAbilityEffect for ControlExchangeEffect

Source§

impl SpellAbilityEffect for ControlExchangeVariantEffect

Source§

impl SpellAbilityEffect for ControlGainEffect

Source§

impl SpellAbilityEffect for ControlGainVariantEffect

Source§

impl SpellAbilityEffect for ControlPlayerEffect

Source§

impl SpellAbilityEffect for ControlSpellEffect

Source§

impl SpellAbilityEffect for CopyPermanentEffect

Source§

impl SpellAbilityEffect for CopySpellAbilityEffect

Source§

impl SpellAbilityEffect for CounterEffect

Source§

impl SpellAbilityEffect for CountersMoveEffect

Source§

impl SpellAbilityEffect for CountersMultiplyEffect

Source§

impl SpellAbilityEffect for CountersNoteEffect

Source§

impl SpellAbilityEffect for CountersProliferateEffect

Source§

impl SpellAbilityEffect for CountersPutAllEffect

Source§

impl SpellAbilityEffect for CountersPutEffect

Source§

impl SpellAbilityEffect for CountersPutOrRemoveEffect

Source§

impl SpellAbilityEffect for CountersRemoveAllEffect

Source§

impl SpellAbilityEffect for CountersRemoveEffect

Source§

impl SpellAbilityEffect for DamageAllEffect

Source§

impl SpellAbilityEffect for DamageDealEffect

Source§

impl SpellAbilityEffect for DamageEachEffect

Source§

impl SpellAbilityEffect for DamagePreventEffect

Source§

impl SpellAbilityEffect for DamageResolveEffect

Source§

impl SpellAbilityEffect for DayTimeEffect

Source§

impl SpellAbilityEffect for DebuffEffect

Source§

impl SpellAbilityEffect for DelayedTriggerEffect

Source§

impl SpellAbilityEffect for DestroyAllEffect

Source§

impl SpellAbilityEffect for DestroyEffect

Source§

impl SpellAbilityEffect for DetainEffect

Source§

impl SpellAbilityEffect for DigEffect

Source§

impl SpellAbilityEffect for DigMultipleEffect

Source§

impl SpellAbilityEffect for DigUntilEffect

Source§

impl SpellAbilityEffect for DiscardEffect

Source§

impl SpellAbilityEffect for DiscoverEffect

Source§

impl SpellAbilityEffect for DraftEffect

Source§

impl SpellAbilityEffect for DrainManaEffect

Source§

impl SpellAbilityEffect for DrawEffect

Source§

impl SpellAbilityEffect for EarthbendEffect

Source§

impl SpellAbilityEffect for EffectEffect

Source§

impl SpellAbilityEffect for EncodeEffect

Source§

impl SpellAbilityEffect for EndCombatPhaseEffect

Source§

impl SpellAbilityEffect for EndTurnEffect

Source§

impl SpellAbilityEffect for EndureEffect

Source§

impl SpellAbilityEffect for ExploreEffect

Source§

impl SpellAbilityEffect for FightEffect

Source§

impl SpellAbilityEffect for FlipCoinEffect

Source§

impl SpellAbilityEffect for FlipOntoBattlefieldEffect

Source§

impl SpellAbilityEffect for FogEffect

Source§

impl SpellAbilityEffect for GameDrawEffect

Source§

impl SpellAbilityEffect for GameLossEffect

Source§

impl SpellAbilityEffect for GameWinEffect

Source§

impl SpellAbilityEffect for GoadEffect

Source§

impl SpellAbilityEffect for HauntEffect

Source§

impl SpellAbilityEffect for HeistEffect

Source§

impl SpellAbilityEffect for ImmediateTriggerEffect

Source§

impl SpellAbilityEffect for IncubateEffect

Source§

impl SpellAbilityEffect for IntensifyEffect

Source§

impl SpellAbilityEffect for InternalRadiationEffect

Source§

impl SpellAbilityEffect for InvestigateEffect

Source§

impl SpellAbilityEffect for LearnEffect

Source§

impl SpellAbilityEffect for LifeExchangeEffect

Source§

impl SpellAbilityEffect for LifeExchangeVariantEffect

Source§

impl SpellAbilityEffect for LifeGainEffect

Source§

impl SpellAbilityEffect for LifeLoseEffect

Source§

impl SpellAbilityEffect for LifeSetEffect

Source§

impl SpellAbilityEffect for LookAtEffect

Source§

impl SpellAbilityEffect for LosePerpetualEffect

Source§

impl SpellAbilityEffect for MakeCardEffect

Source§

impl SpellAbilityEffect for ManaEffect

Source§

impl SpellAbilityEffect for ManaReflectedEffect

Source§

impl SpellAbilityEffect for ManifestDreadEffect

Source§

impl SpellAbilityEffect for ManifestEffect

Source§

impl SpellAbilityEffect for MeldEffect

Source§

impl SpellAbilityEffect for MillEffect

Source§

impl SpellAbilityEffect for MoveCounterEffect

Source§

impl SpellAbilityEffect for MultiplePilesEffect

Source§

impl SpellAbilityEffect for MustBlockEffect

Source§

impl SpellAbilityEffect for MutateEffect

Source§

impl SpellAbilityEffect for NameCardEffect

Source§

impl SpellAbilityEffect for OpenAttractionEffect

Source§

impl SpellAbilityEffect for OwnershipGainEffect

Source§

impl SpellAbilityEffect for PeekAndRevealEffect

Source§

impl SpellAbilityEffect for PermanentCreatureEffect

Source§

impl SpellAbilityEffect for PermanentEffect

Source§

impl SpellAbilityEffect for PermanentNoncreatureEffect

Source§

impl SpellAbilityEffect for PhasesEffect

Source§

impl SpellAbilityEffect for PlaneswalkEffect

Source§

impl SpellAbilityEffect for PlayEffect

Source§

impl SpellAbilityEffect for PlayLandVariantEffect

Source§

impl SpellAbilityEffect for PlotEffect

Source§

impl SpellAbilityEffect for PoisonEffect

Source§

impl SpellAbilityEffect for PowerExchangeEffect

Source§

impl SpellAbilityEffect for PreventDamageEffect

Source§

impl SpellAbilityEffect for ProtectAllEffect

Source§

impl SpellAbilityEffect for ProtectEffect

Source§

impl SpellAbilityEffect for PumpAllEffect

Source§

impl SpellAbilityEffect for PumpEffect

Source§

impl SpellAbilityEffect for RadiationEffect

Source§

impl SpellAbilityEffect for RearrangeTopOfLibraryEffect

Source§

impl SpellAbilityEffect for RegenerateEffect

Source§

impl SpellAbilityEffect for RegenerationEffect

Source§

impl SpellAbilityEffect for RemoveFromCombatEffect

Source§

impl SpellAbilityEffect for RemoveFromGameEffect

Source§

impl SpellAbilityEffect for RemoveFromMatchEffect

Source§

impl SpellAbilityEffect for ReorderZoneEffect

Source§

impl SpellAbilityEffect for RepeatEachEffect

Source§

impl SpellAbilityEffect for RepeatEffect

Source§

impl SpellAbilityEffect for ReplaceCounterEffect

Source§

impl SpellAbilityEffect for ReplaceDamageEffect

Source§

impl SpellAbilityEffect for ReplaceEffect

Source§

impl SpellAbilityEffect for ReplaceManaEffect

Source§

impl SpellAbilityEffect for ReplaceSplitDamageEffect

Source§

impl SpellAbilityEffect for ReplaceTokenEffect

Source§

impl SpellAbilityEffect for RestartGameEffect

Source§

impl SpellAbilityEffect for RevealEffect

Source§

impl SpellAbilityEffect for RevealHandEffect

Source§

impl SpellAbilityEffect for ReverseTurnOrderEffect

Source§

impl SpellAbilityEffect for RingTemptsYouEffect

Source§

impl SpellAbilityEffect for RollDiceEffect

Source§

impl SpellAbilityEffect for RollPlanarDiceEffect

Source§

impl SpellAbilityEffect for RunChaosEffect

Source§

impl SpellAbilityEffect for SacrificeAllEffect

Source§

impl SpellAbilityEffect for SacrificeEffect

Source§

impl SpellAbilityEffect for ScryEffect

Source§

impl SpellAbilityEffect for SeekEffect

Source§

impl SpellAbilityEffect for SetInMotionEffect

Source§

impl SpellAbilityEffect for SetStateEffect

Source§

impl SpellAbilityEffect for ShuffleEffect

Source§

impl SpellAbilityEffect for SkipPhaseEffect

Source§

impl SpellAbilityEffect for SkipTurnEffect

Source§

impl SpellAbilityEffect for StoreSVarEffect

Source§

impl SpellAbilityEffect for SubgameEffect

Source§

impl SpellAbilityEffect for SurveilEffect

Source§

impl SpellAbilityEffect for SwitchBlockEffect

Source§

impl SpellAbilityEffect for TakeInitiativeEffect

Source§

impl SpellAbilityEffect for TapAllEffect

Source§

impl SpellAbilityEffect for TapEffect

Source§

impl SpellAbilityEffect for TapOrUntapAllEffect

Source§

impl SpellAbilityEffect for TapOrUntapEffect

Source§

impl SpellAbilityEffect for TextBoxExchangeEffect

Source§

impl SpellAbilityEffect for TimeTravelEffect

Source§

impl SpellAbilityEffect for TokenEffect

Source§

impl SpellAbilityEffect for TwoPilesEffect

Source§

impl SpellAbilityEffect for UnattachEffect

Source§

impl SpellAbilityEffect for UnlockDoorEffect

Source§

impl SpellAbilityEffect for UntapAllEffect

Source§

impl SpellAbilityEffect for UntapEffect

Source§

impl SpellAbilityEffect for VentureEffect

Source§

impl SpellAbilityEffect for VillainousChoiceEffect

Source§

impl SpellAbilityEffect for VoteEffect

Source§

impl SpellAbilityEffect for ZoneExchangeEffect