Skip to main content

StackEntry

Struct StackEntry 

Source
pub struct StackEntry {
    pub id: u32,
    pub spell_ability: SpellAbility,
    pub is_pending_cast: bool,
    pub is_creature_spell: bool,
    pub is_permanent_spell: bool,
    pub cast_from_zone: Option<ZoneType>,
    pub optional_trigger_decider: Option<PlayerId>,
    pub optional_trigger_description: Option<String>,
    pub optional_trigger_source_name: Option<String>,
}
Expand description

An entry on the game stack (spell or ability waiting to resolve). Mirrors Java’s SpellAbilityStackInstance which wraps a SpellAbility.

Fields§

§id: u32§spell_ability: SpellAbility

The spell ability with its full sub-ability chain and targets.

§is_pending_cast: bool

True while a spell has been announced and moved to the stack, but its modes/targets/costs/payment have not finished yet. Pending entries are visible for casting prompts but must never resolve or receive priority.

§is_creature_spell: bool

Whether this is a creature spell (goes to battlefield on resolve).

§is_permanent_spell: bool

Whether this is a non-creature permanent spell.

§cast_from_zone: Option<ZoneType>

The zone the spell was cast from (for Flashback exile-on-resolve).

§optional_trigger_decider: Option<PlayerId>

If this is an optional trigger, the player who decides whether to accept or decline. Mirrors Java’s WrappedAbility decider field.

§optional_trigger_description: Option<String>

Description text shown to the deciding player for optional triggers.

§optional_trigger_source_name: Option<String>

Source card name for optional trigger prompts.

Implementations§

Source§

impl StackEntry

Extension methods on StackEntry mirroring Java’s SpellAbilityStackInstance. These are implemented directly on StackEntry so callers can use them without needing a separate wrapper.

Source

pub fn get_spell_ability(&self) -> &SpellAbility

Get the underlying spell ability. Mirrors Java’s SpellAbilityStackInstance.getSpellAbility().

Source

pub fn get_source_card(&self) -> Option<CardId>

Get the source card of this stack instance. Mirrors Java’s SpellAbilityStackInstance.getSourceCard().

Source

pub fn is_spell_instance(&self) -> bool

Whether this stack instance is a spell. Mirrors Java’s SpellAbilityStackInstance.isSpell().

Source

pub fn is_ability_instance(&self) -> bool

Whether this stack instance is an activated ability. Mirrors Java’s SpellAbilityStackInstance.isAbility().

Source

pub fn is_trigger_instance(&self) -> bool

Whether this stack instance is a triggered ability. Mirrors Java’s SpellAbilityStackInstance.isTrigger().

Source

pub fn is_optional_trigger(&self) -> bool

Whether this is an optional trigger (player may decline). Mirrors Java’s SpellAbilityStackInstance.isOptionalTrigger().

Source

pub fn get_stack_description(&self) -> String

Get the stack description for display. Mirrors Java’s SpellAbilityStackInstance.getStackDescription().

Source

pub fn get_activating_player(&self) -> PlayerId

Get the player who activated/cast this spell or ability. Mirrors Java’s SpellAbilityStackInstance.getActivatingPlayer().

Source

pub fn get_target_choices(&self) -> &TargetChoices

Get the target choices for the underlying spell ability. Mirrors Java’s SpellAbilityStackInstance.getTargetChoices().

Source§

impl StackEntry

Source

pub fn next_id() -> u64

Get the next unique ID for a stack entry. Mirrors Java’s SpellAbilityStackInstance.nextId().

Source

pub fn update_target(&mut self, old: CardId, new: CardId)

Update a target card in this stack entry’s spell ability. Mirrors Java’s SpellAbilityStackInstance.updateTarget(Card, Card).

Source

pub fn set_triggering_object<K: TriggerKeyInput>(&mut self, key: K, value: &str)

Set a triggering object on this stack entry’s spell ability. Mirrors Java’s SpellAbilityStackInstance.setTriggeringObject(String, Object).

Source

pub fn update_triggering_object<K: TriggerKeyInput>( &mut self, key: K, value: &str, )

Update a triggering object in this stack entry’s spell ability. Mirrors Java’s SpellAbilityStackInstance.updateTriggeringObject(String, Object).

Trait Implementations§

Source§

impl Clone for StackEntry

Source§

fn clone(&self) -> StackEntry

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 StackEntry

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StackEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StackEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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