Skip to main content

ReplacementEvent

Enum ReplacementEvent 

Source
pub enum ReplacementEvent {
Show 40 variants Draw { player: PlayerId, extra_draws: i32, is_first_in_draw_step: bool, }, DamageToCard { target: CardId, amount: i32, source: Option<CardId>, is_combat: bool, }, DamageToPlayer { target: PlayerId, amount: i32, source: Option<CardId>, is_combat: bool, }, Destroy { target: CardId, }, Moved { card: CardId, origin: ZoneType, destination: ZoneType, is_discard: bool, counter_map: Option<Vec<CounterMapValue>>, counter_cause: Option<Box<SpellAbility>>, counter_is_effect: bool, after_replacement_static_abilities: Vec<(CardId, Vec<String>)>, }, GainLife { player: PlayerId, amount: i32, }, CreateToken { player: PlayerId, count: i32, is_effect: bool, }, AddCounter { target: GameEntity, source: Option<PlayerId>, counter_type: CounterType, count: i32, counter_map: Vec<CounterMapValue>, after_replacement_static_abilities: Vec<(CardId, Vec<String>)>, cause: Option<Box<SpellAbility>>, is_effect: bool, }, GameLoss { player: PlayerId, reason: GameLossReason, }, GameWin { player: PlayerId, }, Counter { card: CardId, }, ProduceMana { source: CardId, activator: PlayerId, mana: String, }, Tap { card: CardId, }, Untap { card: CardId, player: Option<PlayerId>, }, LifeReduced { player: PlayerId, amount: i32, is_damage: bool, }, RemoveCounter { target: CardId, counter_type: CounterType, count: i32, }, DealtDamage { target: CardId, amount: i32, source: Option<CardId>, }, DrawCards { player: PlayerId, count: i32, }, Mill { player: PlayerId, count: i32, }, PayLife { player: PlayerId, amount: i32, }, Scry { player: PlayerId, count: i32, }, Attached { card: CardId, target: CardId, }, BeginPhase { player: PlayerId, phase: PhaseType, }, BeginTurn { player: PlayerId, }, Explore { card: CardId, }, DeclareBlocker { player: PlayerId, }, AssignDealDamage { card: CardId, }, Transform { card: CardId, }, TurnFaceUp { card: CardId, }, CopySpell { player: PlayerId, count: i32, }, Proliferate { player: PlayerId, count: i32, }, Cascade { player: PlayerId, }, Learn { player: PlayerId, }, LoseMana { player: PlayerId, }, RollDice { player: PlayerId, sides: i32, number: i32, ignore: i32, ignore_chosen: HashMap<PlayerId, i32>, dice_pt_exchanges: HashSet<CardId>, }, RollPlanarDice { player: PlayerId, }, PlanarDiceResult { player: PlayerId, }, Planeswalk { player: PlayerId, }, SetInMotion { player: PlayerId, }, AssembleContraption { player: PlayerId, },
}
Expand description

A game event that may be subject to one or more replacement effects.

Each variant carries the mutable parameters of the event so that a replacement effect can modify them (e.g. reduce damage to 0, redirect a zone move, etc.).

Mirrors the runParams map passed to ReplacementHandler.run() in Java, but typed for safety.

Variants§

§

Draw

A card is being drawn by a player. extra_draws is incremented by replacements (e.g. Alhammarret’s Archive DrawTwo). is_first_in_draw_step is true for the first draw in the draw step (not extra draws).

Fields

§player: PlayerId
§extra_draws: i32
§is_first_in_draw_step: bool
§

DamageToCard

Damage is being dealt to a permanent.

Fields

§target: CardId
§amount: i32
§source: Option<CardId>

The card dealing the damage, if known.

§is_combat: bool

Whether this is combat damage.

§

DamageToPlayer

Damage is being dealt to a player.

Fields

§target: PlayerId
§amount: i32
§source: Option<CardId>

The card dealing the damage, if known.

§is_combat: bool

Whether this is combat damage.

§

Destroy

A permanent is being destroyed (lethal damage or destroy effect).

Fields

§target: CardId
§

Moved

A card is moving between zones.

Fields

§card: CardId
§origin: ZoneType
§destination: ZoneType
§is_discard: bool

True when this move originates from a discard action. Mirrors Java’s AbilityKey.Discard in replacement params.

§counter_cause: Option<Box<SpellAbility>>
§counter_is_effect: bool
§after_replacement_static_abilities: Vec<(CardId, Vec<String>)>
§

GainLife

A player is gaining life.

Fields

§player: PlayerId
§amount: i32
§

CreateToken

Token(s) are being created. is_effect is true when created by a spell/ability effect, false for game rules.

Fields

§player: PlayerId
§count: i32
§is_effect: bool
§

AddCounter

Counter(s) are being added to a permanent. is_effect is true when placed by a spell/ability, false for ETB keywords/game rules.

Fields

§target: GameEntity
§counter_type: CounterType
§count: i32
§counter_map: Vec<CounterMapValue>
§after_replacement_static_abilities: Vec<(CardId, Vec<String>)>
§is_effect: bool
§

GameLoss

A player is losing the game.

Fields

§player: PlayerId
§

GameWin

A player is winning the game.

Fields

§player: PlayerId
§

Counter

A spell is being countered.

Fields

§card: CardId
§

ProduceMana

Mana is being produced (for doublers like Mirari’s Wake, Nyxbloom Ancient). mana is the produced mana string (e.g. “G” or “U U”) that may be modified.

Fields

§source: CardId
§activator: PlayerId
§mana: String
§

Tap

A permanent is being tapped.

Fields

§card: CardId
§

Untap

A permanent is being untapped.

Fields

§card: CardId
§

LifeReduced

Life is being reduced (distinct from damage).

Fields

§player: PlayerId
§amount: i32
§is_damage: bool
§

RemoveCounter

Counter(s) are being removed from a permanent.

Fields

§target: CardId
§counter_type: CounterType
§count: i32
§

DealtDamage

Damage has been dealt (post-damage).

Fields

§target: CardId
§amount: i32
§source: Option<CardId>
§

DrawCards

Multiple cards are being drawn.

Fields

§player: PlayerId
§count: i32
§

Mill

Cards are being milled.

Fields

§player: PlayerId
§count: i32
§

PayLife

Life is being paid as a cost.

Fields

§player: PlayerId
§amount: i32
§

Scry

A player is scrying.

Fields

§player: PlayerId
§count: i32
§

Attached

An aura/equipment is being attached.

Fields

§card: CardId
§target: CardId
§

BeginPhase

A phase is beginning.

Fields

§player: PlayerId
§

BeginTurn

A turn is beginning.

Fields

§player: PlayerId
§

Explore

A creature is exploring.

Fields

§card: CardId
§

DeclareBlocker

Blockers are being declared.

Fields

§player: PlayerId
§

AssignDealDamage

Damage is being assigned before dealing.

Fields

§card: CardId
§

Transform

A DFC is transforming.

Fields

§card: CardId
§

TurnFaceUp

A face-down card is turning face up.

Fields

§card: CardId
§

CopySpell

A spell is being copied.

Fields

§player: PlayerId
§count: i32
§

Proliferate

A player is proliferating.

Fields

§player: PlayerId
§count: i32
§

Cascade

Cascade is triggering.

Fields

§player: PlayerId
§

Learn

A player is learning.

Fields

§player: PlayerId
§

LoseMana

Mana is being lost.

Fields

§player: PlayerId
§

RollDice

Dice are being rolled.

Fields

§player: PlayerId
§sides: i32
§number: i32
§ignore: i32
§ignore_chosen: HashMap<PlayerId, i32>
§dice_pt_exchanges: HashSet<CardId>
§

RollPlanarDice

The planar die is being rolled.

Fields

§player: PlayerId
§

PlanarDiceResult

A planar dice result is being applied.

Fields

§player: PlayerId
§

Planeswalk

A player is planeswalking.

Fields

§player: PlayerId
§

SetInMotion

A scheme is being set in motion.

Fields

§player: PlayerId
§

AssembleContraption

A contraption is being assembled.

Fields

§player: PlayerId

Trait Implementations§

Source§

impl Clone for ReplacementEvent

Source§

fn clone(&self) -> ReplacementEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReplacementEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V