Skip to main content

WrappedAbility

Struct WrappedAbility 

Source
pub struct WrappedAbility {
    pub wrapped: SpellAbility,
    pub trigger: Option<Trigger>,
    /* private fields */
}
Expand description

Minimal wrapped ability shim for trigger parity. Full Java parity (revalidation at resolve-time) will be implemented here.

Fields§

§wrapped: SpellAbility§trigger: Option<Trigger>

The trigger that created this wrapped ability. Used by get_stack_description and similar methods.

Implementations§

Source§

impl WrappedAbility

Source

pub fn new(wrapped: SpellAbility) -> Self

Source

pub fn with_trigger(wrapped: SpellAbility, trigger: Trigger) -> Self

Source

pub fn has_param(&self, key: &str) -> bool

Source

pub fn add_cost_to_hash_list(&mut self, cost_key: &str, value: String)

Source

pub fn reset_paid_hash(&mut self)

Source

pub fn has_triggering_object(&self, key: &str) -> bool

Source

pub fn reset_triggering_objects(&mut self)

Source

pub fn can_play(&self) -> bool

Source

pub fn copy(&self) -> Self

Source

pub fn yield_key(&self) -> String

Source

pub fn to_unsuppressed_string(&self) -> String

Source

pub fn has_s_var(&self, game: &GameState, key: &str) -> bool

Source

pub fn reset_once_resolved(&mut self)

Source

pub fn uses_targeting(&self) -> bool

Source

pub fn has_additional_ability(&self, key: &str) -> bool

Source

pub fn reset_targets(&mut self)

Source

pub fn resolve(&self) -> bool

Source

pub fn get_param(&self, key: &str) -> Option<&str>

Mirrors Java’s WrappedAbility.getParam(String). Delegates to sa.getParam(key).

Source

pub fn get_param_or_default<'a>( &'a self, key: &str, default: &'a str, ) -> &'a str

Mirrors Java’s WrappedAbility.getParamOrDefault(String, String). Delegates to sa.getParamOrDefault(key, defaultValue).

Source

pub fn set_paid_hash(&mut self, hash: HashMap<String, Vec<String>>)

Mirrors Java’s WrappedAbility.setPaidHash(...). Replaces the paid hash wholesale.

Source

pub fn get_paid_list(&self, key: &str, _intrinsic: bool) -> Vec<String>

Mirrors Java’s WrappedAbility.getPaidList(String, boolean). Returns the list of paid cost values for the given key. The _intrinsic flag is unused in Rust (Java uses it to pick column from a TreeBasedTable; Rust flattens into a single Vec).

Source

pub fn set_triggering_objects(&mut self, objects: HashMap<String, String>)

Mirrors Java’s WrappedAbility.setTriggeringObjects(Map). Replaces all triggering objects wholesale.

Source

pub fn set_triggering_object(&mut self, key: &str, value: String)

Mirrors Java’s WrappedAbility.setTriggeringObject(AbilityKey, Object). Sets a single triggering object by key.

Source

pub fn get_triggering_object(&self, key: &str) -> Option<&str>

Mirrors Java’s WrappedAbility.getTriggeringObject(AbilityKey). Delegates to sa.getTriggeringObject(key).

Source

pub fn get_stack_description(&self, game: &GameState) -> String

Mirrors Java’s WrappedAbility.getStackDescription(boolean).

Simplified version: returns the trigger description (with ABILITY replacement) plus important stack objects, if a trigger is available. Falls back to the inner SpellAbility’s stack_description.

Source

pub fn get_s_var(&self, game: &GameState, name: &str) -> Option<String>

Mirrors Java’s WrappedAbility.getSVar(String). Looks up an SVar on the source card.

Source

pub fn get_s_var_int(&self, game: &GameState, name: &str) -> Option<i32>

Mirrors Java’s WrappedAbility.getSVarInt(String). Returns the SVar parsed as an integer, or None if absent/unparseable.

Source

pub fn set_s_var(&self, game: &mut GameState, name: &str, value: &str)

Mirrors Java’s WrappedAbility.setSVar(String, String). Sets an SVar on the source card.

Source

pub fn get_additional_ability(&self, key: &str) -> Option<&str>

Mirrors Java’s WrappedAbility.getAdditionalAbility(String). In Java this returns a SpellAbility parsed from the named param; in Rust we return the raw param value which callers can parse.

Source

pub fn get_additional_ability_list(&self, name: &str) -> Vec<String>

Mirrors Java’s WrappedAbility.getAdditionalAbilityList(String). Returns the param value split by & (the Java list separator for additional ability lists in card scripts).

Source

pub fn set_additional_ability_list(&mut self, name: &str, list: Vec<String>)

Mirrors Java’s WrappedAbility.setAdditionalAbilityList(String, List). Stores the list as an &-joined param value.

Source

pub fn is_alternative_cost(&self, ac: AlternativeCost) -> bool

Mirrors Java’s WrappedAbility.isAlternativeCost(AlternativeCost). Checks whether this ability was cast using the given alternative cost.

Source

pub fn is_keyword(&self, kw: Keyword) -> bool

Mirrors Java’s WrappedAbility.isKeyword(Keyword). Checks whether this ability’s params contain a Keyword$ entry matching the given keyword.

Trait Implementations§

Source§

impl Clone for WrappedAbility

Source§

fn clone(&self) -> WrappedAbility

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 WrappedAbility

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