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
impl WrappedAbility
pub fn new(wrapped: SpellAbility) -> Self
pub fn with_trigger(wrapped: SpellAbility, trigger: Trigger) -> Self
pub fn has_param(&self, key: &str) -> bool
pub fn add_cost_to_hash_list(&mut self, cost_key: &str, value: String)
pub fn reset_paid_hash(&mut self)
pub fn has_triggering_object(&self, key: &str) -> bool
pub fn reset_triggering_objects(&mut self)
pub fn can_play(&self) -> bool
pub fn copy(&self) -> Self
pub fn yield_key(&self) -> String
pub fn to_unsuppressed_string(&self) -> String
pub fn has_s_var(&self, game: &GameState, key: &str) -> bool
pub fn reset_once_resolved(&mut self)
pub fn uses_targeting(&self) -> bool
pub fn has_additional_ability(&self, key: &str) -> bool
pub fn reset_targets(&mut self)
pub fn resolve(&self) -> bool
Sourcepub fn get_param(&self, key: &str) -> Option<&str>
pub fn get_param(&self, key: &str) -> Option<&str>
Mirrors Java’s WrappedAbility.getParam(String).
Delegates to sa.getParam(key).
Sourcepub fn get_param_or_default<'a>(
&'a self,
key: &str,
default: &'a str,
) -> &'a str
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).
Sourcepub fn set_paid_hash(&mut self, hash: HashMap<String, Vec<String>>)
pub fn set_paid_hash(&mut self, hash: HashMap<String, Vec<String>>)
Mirrors Java’s WrappedAbility.setPaidHash(...).
Replaces the paid hash wholesale.
Sourcepub fn get_paid_list(&self, key: &str, _intrinsic: bool) -> Vec<String>
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).
Sourcepub fn set_triggering_objects(&mut self, objects: HashMap<String, String>)
pub fn set_triggering_objects(&mut self, objects: HashMap<String, String>)
Mirrors Java’s WrappedAbility.setTriggeringObjects(Map).
Replaces all triggering objects wholesale.
Sourcepub fn set_triggering_object(&mut self, key: &str, value: String)
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.
Sourcepub fn get_triggering_object(&self, key: &str) -> Option<&str>
pub fn get_triggering_object(&self, key: &str) -> Option<&str>
Mirrors Java’s WrappedAbility.getTriggeringObject(AbilityKey).
Delegates to sa.getTriggeringObject(key).
Sourcepub fn get_stack_description(&self, game: &GameState) -> String
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.
Sourcepub fn get_s_var(&self, game: &GameState, name: &str) -> Option<String>
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.
Sourcepub fn get_s_var_int(&self, game: &GameState, name: &str) -> Option<i32>
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.
Sourcepub fn set_s_var(&self, game: &mut GameState, name: &str, value: &str)
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.
Sourcepub fn get_additional_ability(&self, key: &str) -> Option<&str>
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.
Sourcepub fn get_additional_ability_list(&self, name: &str) -> Vec<String>
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).
Sourcepub fn set_additional_ability_list(&mut self, name: &str, list: Vec<String>)
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.
Sourcepub fn is_alternative_cost(&self, ac: AlternativeCost) -> bool
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.
Sourcepub fn is_keyword(&self, kw: Keyword) -> bool
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
impl Clone for WrappedAbility
Source§fn clone(&self) -> WrappedAbility
fn clone(&self) -> WrappedAbility
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more