Skip to main content

Module effects

Module effects 

Source
Expand description

Effect resolution system.

Each effect type lives in its own file, mirroring the Java Forge ability/effects/ package (204 files). Effects are dispatched by API type string extracted from the ability text.

Re-exports§

pub use effect_context::EffectContext;
pub use effect_resolver::resolve_effect;
pub use effect_resolver::resolve_effect_chain;
pub use effect_resolver::resolve_effect_chain_with_parent;
pub use effect_resolver::IMPLEMENTED_API_TYPES;
pub use crate::mana::mana_atom_from_produced;
pub use crate::svar::evaluate_svar;
pub use crate::svar::resolve_count_svar;
pub use crate::svar::resolve_count_svar_for_sa;
pub use crate::svar::resolve_numeric_svar;
pub use crate::svar::resolve_numeric_value;
pub use helpers::*;
pub use zone_triggers::*;

Modules§

abandon_effect
Abandon — leave a game in a multiplayer match. Ported from Java’s AbandonEffect: sets player as lost.
activate_ability_effect
add_phase_effect
add_turn_effect
advance_crank_effect
AdvanceCrank — advance a crank counter (Unfinity). Ported from Java’s AdvanceCrankEffect: advances the player’s CRANK! counter to the next sprocket and cranks contraptions on that sprocket.
airbend_effect
Airbend — exile target cards, their owner may cast them for {2}. Mirrors Java AirbendEffect: exiles each card and creates a per-card Effect in the Command zone that grants MayPlay with an alternate mana cost of {2}, so the owner may cast the exiled card from exile.
alter_attribute_effect
AlterAttribute — change a creature’s attribute (Plotted, Suspected, etc.). Ported from Java’s AlterAttributeEffect: toggles various card attributes like Plotted, Harnessed, Solved, Suspected, Saddled, Commander.
amass_effect
Amass effect — create or grow an Army token.
animate_all_effect
animate_effect
ascend_effect
Ascend effect — gain the City’s Blessing if you control 10+ permanents.
assemble_contraption_effect
AssembleContraption — assemble contraptions from the contraption deck (Unstable). Ported from Java’s AssembleContraptionEffect: moves top card of contraption deck to battlefield, assigns a sprocket.
assign_group_effect
AssignGroup — assign creatures to groups (Conspiracy draft). Ported from Java’s AssignGroupEffect: assigns defined objects to groups chosen by the player, then resolves sub-abilities for each group.
attach_effect
balance_effect
become_monarch_effect
becomes_blocked_effect
BecomesBlocked — mark attacking creatures as blocked. Ported from Java’s BecomesBlockedEffect: marks attacker as blocked in combat and fires AttackerBlocked triggers.
bid_life_effect
BidLife effect — players bid life, highest bidder wins.
blank_line_effect
BlankLine — no-op formatting effect used in card scripts.
blight_effect
block_effect
Block effect — force a creature to block a specific attacker.
bond_effect
Bond effect — partner/bond mechanic for pairing creatures.
branch_effect
camouflage_effect
Camouflage — old-school combat concealment. Ported from Java’s CamouflageEffect: the attacking player divides their creatures into face-down piles, then combat blockers are randomly assigned. In digital: we randomize the blocker assignments since the physical “face-down piles” mechanic can’t be faithfully reproduced.
cast_from_effect
Shared “cast from effect” pipeline.
change_combatants_effect
ChangeCombatants effect — modify combat participants.
change_speed_effect
ChangeSpeed — modifies a player’s speed. Ported from Java’s ChangeSpeedEffect.
change_targets_effect
ChangeTargets effect — redirect a spell or ability’s targets.
change_text_effect
ChangeText effect — modify text on a card (color words, land types, etc.)
change_x_effect
ChangeX effect — modify the X value of a spell or ability.
change_zone_all_effect
change_zone_effect
ChangeZone effect — moves cards between zones.
change_zone_resolve_effect
ChangeZoneResolve effect — resolves accumulated zone changes.
chaos_ensues_effect
ChaosEnsues — trigger chaos ability in Planechase. Ported from Java’s ChaosEnsuesEffect: fires the ChaosEnsues trigger which causes all Planechase chaos abilities to trigger.
charm_effect
choose_card_effect
choose_card_name_effect
ChooseCardName effect — name a card.
choose_color_effect
choose_direction_effect
choose_even_odd_effect
choose_generic_effect
ChooseGeneric effect — generic modal choice.
choose_number_effect
choose_player_effect
choose_sector_effect
ChooseSector — choose a sector (Unfinity attraction board). Ported from Java’s ChooseSectorEffect: stores chosen sector on host card.
choose_source_effect
choose_type_effect
claim_the_prize_effect
ClaimThePrize — Unfinity prize mechanic. Ported from Java’s ClaimThePrizeEffect: fires ClaimPrize trigger for each defined attraction.
clash_effect
Clash effect — each player reveals top card, higher CMC wins.
class_level_up_effect
ClassLevelUp effect — increase a Class enchantment’s level.
clean_up_effect
CleanUpEffect — cleanup/reset effect.
cleanup_effect
cloak_effect
Cloak effect — like Manifest but with Ward {2}.
clone_effect
combat_helpers
Combat-side helpers shared by effect resolvers.
condition
SpellAbility condition gating.
connive_effect
control_exchange_effect
ControlExchange effect — swap control of two permanents.
control_exchange_variant_effect
ControlExchangeVariant effect — variant of control exchange.
control_gain_effect
control_gain_variant_effect
control_player_effect
ControlPlayer effect — take control of another player’s turn (Mindslaver).
control_spell_effect
ControlSpell effect — gain control of a spell on the stack.
copy_permanent_effect
copy_spell_ability_effect
cost_payment
Cost-payment helpers used by effect resolution.
counter_effect
counters_move_effect
CountersMove effect — move counters between permanents.
counters_multiply_effect
CountersMultiply effect — double (or multiply) counters on a permanent.
counters_note_effect
CountersNote effect — note the number of counters on a permanent.
counters_proliferate_effect
counters_put_all_effect
counters_put_effect
counters_put_or_remove_effect
counters_remove_all_effect
CountersRemoveAll effect — remove all counters of a type from permanents.
counters_remove_effect
damage_all_effect
damage_base_effect
DamageBaseEffect — abstract base for damage effects.
damage_deal_effect
damage_each_effect
damage_prevent_effect
DamagePrevent effect — prevent the next N damage to a target.
damage_resolve_effect
DamageResolve — resolve accumulated damage from a damage map. Ported from Java’s DamageResolveEffect.
day_time_effect
DayTime effect — switch between Day and Night.
debuff_effect
Debuff — reduce stats permanently (digital-only).
delayed_trigger_effect
destroy_all_effect
destroy_effect
detached_card_effect
DetachedCardEffect — card effect data structure.
detain_effect
dig_effect
dig_multiple_effect
dig_until_effect
discard_effect
discover_effect
Discover effect — exile from library until a nonland card with CMC ≤ N.
draft_effect
Draft — draft a card from a spellbook (Conspiracy/Arena). Ported from Java’s DraftEffect: picks cards from a spellbook list, presents 3 random options, player chooses one, it goes to hand.
drain_mana_effect
draw_effect
earthbend_effect
Earthbend — turn a land into a 0/0 creature with haste and +1/+1 counters. Ported from Java’s EarthbendEffect: adds creature type, haste, and counters to target land, plus sets up a delayed trigger to return it when it dies.
effect_context
EffectContext — bundle of subsystem refs threaded through effect resolution.
effect_effect
EffectEffect — mirrors Java forge.game.ability.effects.EffectEffect.
effect_resolver
Effect resolution driver — dispatch on ApiType and walk sub-ability chains.
encode_effect
end_combat_phase_effect
end_turn_effect
endure_effect
Endure — creature endures: either put +1/+1 counters on it, or create a Spirit token with power/toughness equal to the endure amount. Ported from Java’s EndureEffect.
explore_effect
fight_effect
flip_coin_effect
flip_onto_battlefield_effect
FlipOntoBattlefield effect — Chaos Orb style flipping.
fog_effect
game_draw_effect
game_loss_effect
game_win_effect
goad_effect
haunt_effect
Haunt effect — exile card haunting a creature.
heist_effect
Heist effect — exile cards from opponent’s library, may cast them.
helpers
Helper functions for effect resolution — re-export shim.
immediate_trigger_effect
ImmediateTrigger effect — fire a trigger immediately without waiting.
incubate_effect
Incubate effect — create Incubator artifact token with +1/+1 counters.
intensify_effect
Intensify — increase effect power (escalating).
internal_radiation_effect
InternalRadiation effect — process radiation counter damage.
investigate_effect
Investigate effect — create Clue artifact tokens.
learn_effect
Learn effect — reveal a Lesson from outside the game, or discard to draw.
life_exchange_effect
life_exchange_variant_effect
LifeExchangeVariant effect — variant life total exchange.
life_gain_effect
life_lose_effect
life_set_effect
look_at_effect
lose_perpetual_effect
LosePerpetual — remove perpetual effects (digital-only, Alchemy). Ported from Java’s LosePerpetualEffect: removes a perpetual trait change identified by the triggering trigger’s timestamp.
make_card_effect
MakeCard — conjure a card with specific properties (digital-only, Arena). Ported from Java’s MakeCardEffect: creates a real card (not a token) from a named card, spellbook, or choices, and places it in a zone.
mana_effect
mana_reflected_effect
manifest_base_effect
ManifestBaseEffect — abstract base for manifest variants.
manifest_dread_effect
ManifestDread effect — look at top 2 cards, manifest one, other goes to graveyard.
manifest_effect
Manifest effect — put cards onto the battlefield face-down as 2/2 creatures.
meld_effect
Meld effect — exile two named cards, return melded as one creature.
mill_effect
move_counter_effect
multiple_piles_effect
MultiplePiles — Fact or Fiction style pile splitting. Ported from Java’s MultiplePilesEffect: separates cards into N piles, optionally remembers a randomly chosen pile.
must_block_effect
mutate_effect
Mutate — mutate onto a creature (Ikoria). Ported from Java’s MutateEffect: merges the host card with a target creature, choosing which goes on top, combining abilities.
name_card_effect
open_attraction_effect
OpenAttraction — open an attraction from the attraction deck (Unfinity). Ported from Java’s OpenAttractionEffect: moves top card of attraction deck to battlefield.
ownership_gain_effect
GainOwnership — change ownership of a card (rare silver-bordered). Ported from Java’s OwnershipGainEffect: changes the owner of target cards to the defined player.
peek_and_reveal_effect
permanent_creature_effect
PermanentCreature — move host card to battlefield as a creature permanent. Ported from Java’s PermanentCreatureEffect.
permanent_effect
PermanentEffect — move spell to battlefield.
permanent_noncreature_effect
PermanentNoncreature — move host card to battlefield as a noncreature permanent. Ported from Java’s PermanentNoncreatureEffect.
phases_effect
planeswalk_effect
Planeswalk — move to a new plane (Planechase). Ported from Java’s PlaneswalkEffect: leaves current plane, moves to new one. Planechase format support — fires trigger for plane change.
play_effect
play_land_variant_effect
PlayLandVariant effect — variant play land.
plot_effect
poison_effect
power_exchange_effect
prevent_damage_effect
protect_all_effect
protect_effect
pump_all_effect
pump_effect
radiation_effect
Radiation — give radiation counters (Fallout).
rearrange_top_of_library_effect
regenerate_effect
regeneration_effect
Regeneration — set up a regeneration shield (older mechanic).
remove_from_combat_effect
remove_from_game_effect
RemoveFromGame — exile (old terminology).
remove_from_match_effect
RemoveFromMatch — remove cards from the entire match (Conspiracy). Ported from Java’s RemoveFromMatchEffect: permanently removes cards from all game zones, ceasing to exist.
reorder_zone_effect
ReorderZone effect — let a player reorder cards in a zone.
repeat_each_effect
repeat_effect
Repeat effect — execute a sub-ability loop.
replace_counter_effect
ReplaceCounter effect — replace counter placement with another effect.
replace_damage_effect
ReplaceDamage effect — replace damage with another effect.
replace_effect
Replace effect — generic replacement effect registration.
replace_mana_effect
ReplaceMana effect — replace mana production with different mana.
replace_split_damage_effect
ReplaceSplitDamage effect — replace split damage assignment.
replace_token_effect
ReplaceToken effect — replace token creation with another effect.
restart_game_effect
RestartGame — restart the game (Karn Liberated ultimate). Ported from Java’s RestartGameEffect: resets all game state, moves all cards back to libraries, resets life totals, clears counters, and restarts.
reveal_effect
reveal_hand_effect
reverse_turn_order_effect
ring_tempts_you_effect
RingTempts effect — The Ring tempts you (Lord of the Rings mechanic).
roll_dice_effect
roll_planar_dice_effect
RollPlanarDice — roll the planar die (Planechase). Ported from Java’s RollPlanarDiceEffect: rolls the planar die which can result in Planeswalk, Chaos, or blank.
run_chaos_effect
RunChaos — run the chaos ability of the current plane card. Ported from Java’s RunChaosEffect: finds ChaosEnsues triggers on target plane cards and fires them.
sacrifice_all_effect
sacrifice_effect
scry_effect
seek_effect
Seek effect — randomly find cards matching criteria from library.
set_in_motion_effect
SetInMotion — set a scheme in motion (Archenemy). Ported from Java’s SetInMotionEffect: activates the top scheme card from the scheme deck.
set_state_effect
shuffle_effect
skip_phase_effect
skip_turn_effect
store_s_var_effect
StoreSVar effect — store a value in an SVar for later use.
subgame_effect
Subgame — play a subgame (Shahrazad). Ported from Java’s SubgameEffect: creates a full sub-game with each player’s library, plays it to completion, then returns cards and applies results. This is an enormously complex operation — we implement the core structure but the actual sub-game execution requires the full game loop.
surveil_effect
switch_block_effect
SwitchBlock effect — change blockers during combat.
take_initiative_effect
tap_all_effect
tap_effect
tap_or_untap_all_effect
tap_or_untap_effect
targeting_triggers
BecomesTarget / BecomesTargetOnce trigger emission.
text_box_exchange_effect
TextBoxExchange effect — swap text boxes of two cards.
time_travel_effect
token_effect
token_effect_base
TokenEffectBase — shared token creation machinery.
trait_animate_effect
AnimateEffectBase — abstract base for animate effects.
two_piles_effect
unattach_effect
Unattach effect — remove equipment or aura from a permanent.
unlock_door_effect
UnlockDoor — unlock a door on a Room card. Ported from Java’s UnlockDoorEffect: unlocks one side of a Room enchantment, activating its abilities.
untap_all_effect
untap_effect
venture_effect
Venture effect — venture into the dungeon.
villainous_choice_effect
VillainousChoice effect — opponent chooses which punishment to receive.
vote_effect
Vote effect — Council’s Dilemma and Will of the Council voting.
zone_exchange_effect
ZoneExchange effect — swap a card between two zones.
zone_triggers
Zone trigger emission helpers.