pub struct SpellAbility {Show 68 fields
pub id: u32,
pub api: Option<ApiType>,
pub source: Option<CardId>,
pub original_host: Option<CardId>,
pub activating_player: PlayerId,
pub targeting_player: Option<PlayerId>,
pub ability_text: String,
pub record_type: AbilityRecordType,
pub ir: SpellAbilityIr,
pub target_restrictions: Option<TargetRestrictions>,
pub target_chosen: TargetChoices,
pub pay_costs: Option<Cost>,
pub sub_ability: Option<Box<SpellAbility>>,
pub wrapped_ability: Option<Box<SpellAbility>>,
pub is_spell: bool,
pub is_trigger: bool,
pub is_activated: bool,
pub intrinsic: bool,
pub trigger_source: Option<CardId>,
pub trigger_source_zone_timestamp: Option<u64>,
pub source_zone_timestamp: Option<u64>,
pub source_trigger_id: Option<u32>,
pub trigger_index: Option<usize>,
pub alt_cost: Option<AlternativeCost>,
pub alt_cost_index: u8,
pub evoke_keyword_count: u8,
pub kicked: bool,
pub buyback_paid: bool,
pub overloaded: bool,
pub is_copy: bool,
pub paid_life_amount: i32,
pub kick_count: u32,
pub replicate_count: u32,
pub optional_generic_cost_paid: bool,
pub trigger_remembered_amount: i32,
pub x_mana_cost_paid: u32,
pub discarded_cost_cards: Vec<CardId>,
pub optional_costs: Vec<OptionalCost>,
pub paid_hash: HashMap<String, Vec<String>>,
pub paying_mana: Vec<u16>,
pub paid_abilities: Vec<SpellAbility>,
pub mana_part: Option<AbilityManaPart>,
pub express_mana_choice: Option<u16>,
pub convoke_tapped: Vec<CardId>,
pub spliced_cards: Vec<CardId>,
pub announce_vars: HashMap<String, i32>,
pub sacrificed_as_emerge: Option<CardId>,
pub sacrificed_as_offering: Option<CardId>,
pub description: String,
pub stack_description: String,
pub is_mana_ability: bool,
pub is_land_ability: bool,
pub cast_face_down: bool,
pub trigger_objects: HashMap<AbilityKey, AbilityValue>,
pub trigger_spell_abilities: HashMap<AbilityKey, SpellAbility>,
pub additional_ability_lists: HashMap<String, Vec<SpellAbility>>,
pub replacing_objects: HashMap<AbilityKey, AbilityValue>,
pub trigger_remembered: Vec<AbilityValue>,
pub restriction: SpellAbilityRestriction,
pub condition: SpellAbilityCondition,
pub rollback_effects: Vec<String>,
pub optional_keyword_amounts: HashMap<String, i32>,
pub pips_to_reduce: Vec<String>,
pub may_choose_new_targets: bool,
pub last_state: HashMap<String, String>,
pub change_zone_table: Option<CardZoneTable>,
pub damage_map: Option<CardDamageMap>,
pub prevent_map: Option<CardDamageMap>,
}Expand description
A spell or ability with its own targeting, costs, and sub-ability chain.
Mirrors Java’s SpellAbility class — each node in the chain has its own
target_restrictions, target_chosen, sub_ability, api, etc.
Fields§
§id: u32§api: Option<ApiType>Effect API type (e.g. DealDamage, Destroy, Draw).
Mirrors Java’s ApiType api field.
source: Option<CardId>The card that hosts this ability. Mirrors Java’s hostCard.
original_host: Option<CardId>Java parity: original host card for granted/copied abilities.
Used by costs like Unattach<OriginalHost>.
activating_player: PlayerIdThe player who activated/cast this. Mirrors Java’s activatingPlayer.
targeting_player: Option<PlayerId>The player who chooses this ability’s targets. Mirrors Java’s
targetingPlayer field.
ability_text: StringThe raw ability text (pipe-delimited params).
record_type: AbilityRecordTypeJava parity: AB/SP/ST/DB record kind used to distinguish sub-abilities.
ir: SpellAbilityIrCompiled Forge script IR; resolution reads typed fields from here.
Skipped on serde: a deserialized SpellAbility must rebuild it from
ability_text before use or every typed param reads as absent.
target_restrictions: Option<TargetRestrictions>Targeting restrictions parsed from ValidTgts$.
None means this ability doesn’t use targeting.
Mirrors Java’s targetRestrictions field.
target_chosen: TargetChoicesThe chosen targets for this ability.
Mirrors Java’s targetChosen field.
pay_costs: Option<Cost>Parsed costs from Cost$ parameter.
Mirrors Java’s payCosts field.
sub_ability: Option<Box<SpellAbility>>Linked sub-ability chain. Mirrors Java’s subAbility field
(AbilitySub extends SpellAbility).
wrapped_ability: Option<Box<SpellAbility>>Java parity: payload carried by WrappedAbility.
is_spell: boolWhether this is a spell (not an ability).
is_trigger: boolWhether this is a triggered ability.
is_activated: boolWhether this is an activated ability.
intrinsic: boolJava parity: whether this ability is intrinsic to its host.
trigger_source: Option<CardId>Card that owns the trigger (for intervening-if recheck).
trigger_source_zone_timestamp: Option<u64>Zone timestamp of the trigger source when this triggered ability was created. Used to preserve object identity across zone changes (CR 400.7).
source_zone_timestamp: Option<u64>Zone timestamp of source when this SpellAbility instance was created.
Used for non-target references like Defined$ Self to preserve object identity.
source_trigger_id: Option<u32>Source trigger id (Java sourceTrigger), used for state-trigger dedupe.
trigger_index: Option<usize>Index into card.triggers for intervening-if recheck.
alt_cost: Option<AlternativeCost>Alternative cost used to cast this spell (Flashback, Spectacle, Evoke, Dash, etc.).
alt_cost_index: u8Index within the card’s list of same-kind alternative costs. Zero for all cases except multi-cost Evoke (intrinsic + granted by Ashling-style static AddKeyword): 0 = first payable Evoke, 1 = second, …
evoke_keyword_count: u8Number of Evoke keywords on the card at cast time (intrinsic + granted
from hand — e.g. Ashling, the Limitless’s AddKeyword$ Evoke:4).
Java parity: CardFactoryUtil attaches one Evoke “sacrifice when it
enters” trigger per Evoke keyword, so a card with two Evoke keywords
carries two sac triggers. Captured at cast because granted keywords from
zone-gated statics (AffectedZone$ Hand) are gone once the card moves
to the stack.
kicked: boolWhether the kicker cost was paid.
buyback_paid: boolWhether buyback was paid (spell returns to hand on resolve).
overloaded: boolWhether this spell is overloaded (targets all valid instead of one).
is_copy: boolWhether this spell is a copy (created by Storm, Replicate, etc.).
paid_life_amount: i32Java parity: life paid while activating or casting this ability.
kick_count: u32Number of times the kicker/multikicker cost was paid.
replicate_count: u32Number of times the replicate cost was paid.
optional_generic_cost_paid: boolWhether a generic optional additional cost was paid.
trigger_remembered_amount: i32Sum of integer values remembered on the trigger that spawned this ability (Java: TriggerRememberAmount / sa.getTriggerRemembered()).
x_mana_cost_paid: u32The value chosen for X in the mana cost (e.g. Fireball X=5 means 5 damage).
Mirrors Java’s SpellAbility.getXManaCostPaid().
discarded_cost_cards: Vec<CardId>Cards discarded as part of the cost payment.
Mirrors Java’s CostPayment.getPaidList("Discarded").
optional_costs: Vec<OptionalCost>Optional costs that have been paid for this spell.
Mirrors Java’s SpellAbility.optionalCosts.
paid_hash: HashMap<String, Vec<String>>Hash of costs paid, keyed by cost type with list of values.
Mirrors Java’s SpellAbility.paidHash.
paying_mana: Vec<u16>Java parity: mana atoms used to pay this spell or ability.
paid_abilities: Vec<SpellAbility>Java parity: paid abilities list.
mana_part: Option<AbilityManaPart>Mana-producing part of this ability (for mana abilities).
Mirrors Java’s SpellAbility.manaPart.
express_mana_choice: Option<u16>Express mana choice forced by callback/autopay for flexible mana abilities.
convoke_tapped: Vec<CardId>Cards tapped for convoke cost reduction.
Mirrors Java’s SpellAbility.tappedForConvoke.
spliced_cards: Vec<CardId>Cards spliced onto this spell.
Mirrors Java’s SpellAbility.splicedCards.
announce_vars: HashMap<String, i32>Announced variable values (e.g. X, number of targets).
Mirrors Java’s SpellAbility.announceVars.
sacrificed_as_emerge: Option<CardId>Card sacrificed as part of emerge cost.
Mirrors Java’s SpellAbility.sacrificedAsEmerge.
sacrificed_as_offering: Option<CardId>Card sacrificed as part of offering cost.
Mirrors Java’s SpellAbility.sacrificedAsOffering.
description: StringHuman-readable description of this ability.
Mirrors Java’s SpellAbility.description.
stack_description: StringDescription used when this ability is on the stack.
Mirrors Java’s SpellAbility.stackDescription.
is_mana_ability: boolWhether this is a mana ability (doesn’t use the stack).
Mirrors Java’s SpellAbility.isManaAbility.
is_land_ability: boolWhether this is a land ability (play land action).
Mirrors Java’s LandAbility subclass flag.
cast_face_down: boolRuntime-only face-down cast state used by morph/disguise-style spells.
trigger_objects: HashMap<AbilityKey, AbilityValue>Trigger objects map for tracking trigger context.
trigger_spell_abilities: HashMap<AbilityKey, SpellAbility>Java parity: non-scalar trigger objects that carry spell/ability context.
additional_ability_lists: HashMap<String, Vec<SpellAbility>>Java parity: additional ability lists used by mode/charm-style abilities.
replacing_objects: HashMap<AbilityKey, AbilityValue>Java parity: replacing-objects payload.
trigger_remembered: Vec<AbilityValue>Java parity: trigger remembered objects copied from the originating trigger.
restriction: SpellAbilityRestrictionActivation restriction for this ability.
condition: SpellAbilityConditionCondition that must be met for the effect to apply.
rollback_effects: Vec<String>Rollback effects tracked for undo support.
optional_keyword_amounts: HashMap<String, i32>Keyword amounts for optional keyword costs.
pips_to_reduce: Vec<String>Pips to reduce from cost.
may_choose_new_targets: boolJava parity: whether copied effects may choose new targets.
last_state: HashMap<String, String>Last known state for LKI tracking.
change_zone_table: Option<CardZoneTable>Java parity: batched zone-change table accumulated for ChangeZoneResolve.
damage_map: Option<CardDamageMap>Java parity: accumulated damage map for DamageResolve.
prevent_map: Option<CardDamageMap>Java parity: accumulated prevented-damage map for DamageResolve.
Implementations§
Source§impl SpellAbility
Typed accessors for common SpellAbility parameters.
These mirror the param keys used in Java Forge’s ability text format.
impl SpellAbility
Typed accessors for common SpellAbility parameters. These mirror the param keys used in Java Forge’s ability text format.
Sourcepub fn valid_card(&self) -> Option<&CompiledSelector>
pub fn valid_card(&self) -> Option<&CompiledSelector>
Get the compiled ValidCard$ filter.
Sourcepub fn valid_player(&self) -> Option<&CompiledSelector>
pub fn valid_player(&self) -> Option<&CompiledSelector>
Get the compiled ValidPlayer$ filter.
Sourcepub fn valid_target(&self) -> Option<&CompiledSelector>
pub fn valid_target(&self) -> Option<&CompiledSelector>
Get the compiled ValidTarget$ filter.
Sourcepub fn change_type(&self) -> Option<&str>
pub fn change_type(&self) -> Option<&str>
Get the ChangeType$ filter string (used by zone-change effects).
Sourcepub fn change_type_selector(&self) -> Option<&CompiledSelector>
pub fn change_type_selector(&self) -> Option<&CompiledSelector>
Get the compiled ChangeType$ filter.
Sourcepub fn defined(&self) -> Option<&str>
pub fn defined(&self) -> Option<&str>
Get the Defined$ card reference (e.g. “Self”, “Remembered”, “Targeted”).
Sourcepub fn defined_ref(&self) -> Option<&DefinedRef>
pub fn defined_ref(&self) -> Option<&DefinedRef>
Get the first parsed Defined$ card reference.
Sourcepub fn defined_player(&self) -> Option<&str>
pub fn defined_player(&self) -> Option<&str>
Get the DefinedPlayer$ player reference (e.g. “Player”, “You”, “Opponent”).
Sourcepub fn origin_zone(&self) -> Option<ZoneType>
pub fn origin_zone(&self) -> Option<ZoneType>
Get the Origin$ zone type.
Sourcepub fn origin_zones(&self) -> Vec<ZoneType>
pub fn origin_zones(&self) -> Vec<ZoneType>
Get the Origin$ zone list.
Sourcepub fn destination(&self) -> Option<&str>
pub fn destination(&self) -> Option<&str>
Get the Destination$ zone type string.
Sourcepub fn destination_zone(&self) -> Option<ZoneType>
pub fn destination_zone(&self) -> Option<ZoneType>
Get the Destination$ zone type.
Sourcepub fn library_position(&self) -> Option<&str>
pub fn library_position(&self) -> Option<&str>
Get the LibraryPosition$ string (e.g. “0”, “-1”, “Bottom”).
Sourcepub fn library_position_2(&self) -> Option<&str>
pub fn library_position_2(&self) -> Option<&str>
Get the LibraryPosition2$ string for secondary zone placement.
Sourcepub fn library_position_alternative(&self) -> Option<&str>
pub fn library_position_alternative(&self) -> Option<&str>
Get the LibraryPositionAlternative$ string for DestinationAlternative$.
Sourcepub fn produced_ir(&self) -> Option<&ProducedMana>
pub fn produced_ir(&self) -> Option<&ProducedMana>
Get the lowered Produced$ mana expression.
Sourcepub fn is_param_true(&self, key: &str) -> bool
pub fn is_param_true(&self, key: &str) -> bool
Check if a boolean param is set to “True” (case-insensitive).
This is a more discoverable alias for the existing param_is_true.
Get Hidden$ as boolean.
Sourcepub fn is_mandatory(&self) -> bool
pub fn is_mandatory(&self) -> bool
Get Mandatory$ as boolean.
Sourcepub fn is_shuffle(&self) -> bool
pub fn is_shuffle(&self) -> bool
Get Shuffle$ as boolean.
Sourcepub fn is_remember_changed(&self) -> bool
pub fn is_remember_changed(&self) -> bool
Get RememberChanged$ as boolean.
Sourcepub fn is_optional(&self) -> bool
pub fn is_optional(&self) -> bool
Get Optional$ as boolean.
Sourcepub fn is_gain_control(&self) -> bool
pub fn is_gain_control(&self) -> bool
Get GainControl$ as boolean.
Sourcepub fn is_forget_changed(&self) -> bool
pub fn is_forget_changed(&self) -> bool
Get ForgetChanged$ as boolean.
Sourcepub fn is_imprint(&self) -> bool
pub fn is_imprint(&self) -> bool
Get Imprint$ as boolean.
Sourcepub fn is_face_down(&self) -> bool
pub fn is_face_down(&self) -> bool
Get FaceDown$ as boolean.
Sourcepub fn is_exile_face_down(&self) -> bool
pub fn is_exile_face_down(&self) -> bool
Get ExileFaceDown$ as boolean.
Sourcepub fn is_transformed(&self) -> bool
pub fn is_transformed(&self) -> bool
Get Transformed$ as boolean.
Sourcepub fn is_at_random(&self) -> bool
pub fn is_at_random(&self) -> bool
Get AtRandom$ as boolean.
Sourcepub fn is_reveal(&self) -> bool
pub fn is_reveal(&self) -> bool
Get Reveal$ as boolean (default true for searches — NoReveal overrides).
Sourcepub fn change_num(&self) -> usize
pub fn change_num(&self) -> usize
Get ChangeNum$ as usize, defaulting to 1.
Sourcepub fn attached_to(&self) -> Option<&str>
pub fn attached_to(&self) -> Option<&str>
Get AttachedTo$ target definition.
Sourcepub fn destination_alternative(&self) -> Option<&str>
pub fn destination_alternative(&self) -> Option<&str>
Get DestinationAlternative$ zone.
Sourcepub fn select_prompt(&self) -> Option<&str>
pub fn select_prompt(&self) -> Option<&str>
Get SelectPrompt$ custom prompt text.
Sourcepub fn param_as_i32(&self, key: &str) -> Option<i32>
pub fn param_as_i32(&self, key: &str) -> Option<i32>
Get a numeric param by key, returning None if absent or non-numeric.
Sourcepub fn sub_ability_name(&self) -> Option<&str>
pub fn sub_ability_name(&self) -> Option<&str>
Get the SubAbility$ SVar name.
Sourcepub fn token_script(&self) -> Option<&str>
pub fn token_script(&self) -> Option<&str>
Get the TokenScript$ name.
Sourcepub fn token_owner(&self) -> Option<&str>
pub fn token_owner(&self) -> Option<&str>
Get the TokenOwner$ reference.
Sourcepub fn with_counters_type(&self) -> Option<&str>
pub fn with_counters_type(&self) -> Option<&str>
Get the WithCountersType$ string.
Sourcepub fn with_counters_type_enum(&self) -> Option<&CounterType>
pub fn with_counters_type_enum(&self) -> Option<&CounterType>
Get the typed WithCountersType$.
Source§impl SpellAbility
impl SpellAbility
Sourcepub fn uses_targeting(&self) -> bool
pub fn uses_targeting(&self) -> bool
Whether this ability uses targeting.
Mirrors Java’s usesTargeting(): return targetRestrictions != null.
Sourcepub fn param_is_true(&self, key: &str) -> bool
pub fn param_is_true(&self, key: &str) -> bool
Check if a parameter is set to “True” (case-insensitive).
Common pattern for boolean params like Ninjutsu$ True, Mega$ True, etc.
pub fn param_value(&self, key: &str) -> Option<&str>
Sourcepub fn get_targets(&self) -> &TargetChoices
pub fn get_targets(&self) -> &TargetChoices
Get the chosen targets. Mirrors Java’s getTargets().
Sourcepub fn get_targets_mut(&mut self) -> &mut TargetChoices
pub fn get_targets_mut(&mut self) -> &mut TargetChoices
Get the chosen targets mutably. Mirrors Java’s getTargets() for mutation.
Sourcepub fn get_sub_ability(&self) -> Option<&SpellAbility>
pub fn get_sub_ability(&self) -> Option<&SpellAbility>
Get the sub-ability. Mirrors Java’s getSubAbility().
Sourcepub fn get_sub_ability_mut(&mut self) -> Option<&mut SpellAbility>
pub fn get_sub_ability_mut(&mut self) -> Option<&mut SpellAbility>
Get the sub-ability mutably.
Sourcepub fn is_wrapper(&self) -> bool
pub fn is_wrapper(&self) -> bool
Mirrors Java’s SpellAbility.isWrapper().
Sourcepub fn get_wrapped_ability(&self) -> &SpellAbility
pub fn get_wrapped_ability(&self) -> &SpellAbility
Mirrors Java’s WrappedAbility.getWrappedAbility().
pub fn get_wrapped_ability_mut(&mut self) -> &mut SpellAbility
pub fn set_wrapped_ability(&mut self, wrapped: SpellAbility)
Sourcepub fn clear_targets(&mut self)
pub fn clear_targets(&mut self)
Clear the chosen targets. Mirrors Java’s clearTargets().
Sourcepub fn setup_targets(
&mut self,
game: &GameState,
agents: &mut [Box<dyn PlayerAgent>],
mana_pools: &[ManaPool],
) -> bool
pub fn setup_targets( &mut self, game: &GameState, agents: &mut [Box<dyn PlayerAgent>], mana_pools: &[ManaPool], ) -> bool
Walk the entire ability chain and choose targets for each node that
uses targeting. Mirrors Java’s SpellAbility.setupTargets() do/while loop.
Returns true if all targeting succeeded, false if any node couldn’t
find valid targets.
Sourcepub fn new_simple(
source: Option<CardId>,
player: PlayerId,
ability_text: &str,
) -> Self
pub fn new_simple( source: Option<CardId>, player: PlayerId, ability_text: &str, ) -> Self
Create a simple SpellAbility for tests and triggers.
Sourcepub fn new_empty(source: Option<CardId>, player: PlayerId) -> Self
pub fn new_empty(source: Option<CardId>, player: PlayerId) -> Self
Create a minimal empty SpellAbility stub.
Mirrors Java’s common SpellAbility.EmptySa usage.
Sourcepub fn new_land(source: Option<CardId>, player: PlayerId) -> Self
pub fn new_land(source: Option<CardId>, player: PlayerId) -> Self
Create a minimal land-play SpellAbility stub.
Sourcepub fn find_sub_ability_by_type(&self, api: ApiType) -> Option<&SpellAbility>
pub fn find_sub_ability_by_type(&self, api: ApiType) -> Option<&SpellAbility>
Walk the sub-ability chain looking for a specific API type.
Mirrors Java’s SpellAbility.findSubAbilityByType(ApiType).
Sourcepub fn can_this_produce(&self) -> bool
pub fn can_this_produce(&self) -> bool
Whether this ability can produce mana.
Mirrors Java’s SpellAbility.canThisProduce().
Sourcepub fn can_produce(&self, color: &str) -> bool
pub fn can_produce(&self, color: &str) -> bool
Whether this ability can produce a specific color.
Mirrors Java’s SpellAbility.canProduce(String).
Sourcepub fn amount_of_mana_generated(&self) -> i32
pub fn amount_of_mana_generated(&self) -> i32
Amount of mana generated by this ability.
Mirrors Java’s SpellAbility.amountOfManaGenerated().
Sourcepub fn total_amount_of_mana_generated(&self) -> i32
pub fn total_amount_of_mana_generated(&self) -> i32
Total amount of mana generated, counting Any/All as 1.
Mirrors Java’s SpellAbility.totalAmountOfManaGenerated().
Sourcepub fn allows_paying_with_shard(&self) -> bool
pub fn allows_paying_with_shard(&self) -> bool
Whether paying with shard mana is allowed.
Mirrors Java’s SpellAbility.allowsPayingWithShard().
Sourcepub fn cant_be_copied(&self) -> bool
pub fn cant_be_copied(&self) -> bool
Whether this ability cannot be copied.
Mirrors Java’s SpellAbility.cantBeCopied().
Sourcepub fn can_play(&self, game: &GameState) -> bool
pub fn can_play(&self, game: &GameState) -> bool
Whether this ability can be played (checks restrictions).
Mirrors Java’s SpellAbility.canPlay().
Sourcepub fn can_play_with_optional_cost(&self) -> bool
pub fn can_play_with_optional_cost(&self) -> bool
Whether this ability can be played with optional costs.
Mirrors Java’s SpellAbility.canPlayWithOptionalCost().
Sourcepub fn prompt_if_only_possible_ability(&self) -> bool
pub fn prompt_if_only_possible_ability(&self) -> bool
Whether to prompt even if this is the only possible ability.
Mirrors Java’s SpellAbility.promptIfOnlyPossibleAbility().
Sourcepub fn add_optional_cost(&mut self, cost: OptionalCost)
pub fn add_optional_cost(&mut self, cost: OptionalCost)
Add an optional cost to this ability.
Mirrors Java’s SpellAbility.addOptionalCost(OptionalCost).
Sourcepub fn cost_has_x(&self) -> bool
pub fn cost_has_x(&self) -> bool
Whether the mana cost contains X.
Mirrors Java’s SpellAbility.costHasX().
Sourcepub fn cost_has_mana_x(&self) -> bool
pub fn cost_has_mana_x(&self) -> bool
Whether the mana cost contains X (mana-specific check).
Mirrors Java’s SpellAbility.costHasManaX().
Sourcepub fn met_conditions(&self, game: &GameState) -> bool
pub fn met_conditions(&self, game: &GameState) -> bool
Whether conditions are met for this ability.
Mirrors Java’s SpellAbility.metConditions().
Sourcepub fn clear_mana_paid(&mut self)
pub fn clear_mana_paid(&mut self)
Clear mana paid tracking.
Mirrors Java’s SpellAbility.clearManaPaid().
Sourcepub fn apply_paying_mana_effects(&mut self)
pub fn apply_paying_mana_effects(&mut self)
Apply effects from paying mana (e.g. Sunburst).
Mirrors Java’s SpellAbility.applyPayingManaEffects().
Sourcepub fn run(&self)
pub fn run(&self)
Run this ability (no-op in Rust; Java resolves via resolveStack).
Mirrors Java’s SpellAbility.run().
Sourcepub fn add_cost_to_hash_list(&mut self, key: &str, value: &str)
pub fn add_cost_to_hash_list(&mut self, key: &str, value: &str)
Add a value to the paid cost hash.
Mirrors Java’s SpellAbility.addCostToHashList(String, String).
Sourcepub fn reset_paid_hash(&mut self)
pub fn reset_paid_hash(&mut self)
Reset the paid cost hash.
Mirrors Java’s SpellAbility.resetPaidHash().
Sourcepub fn has_triggering_object<K: TriggerKeyInput>(&self, key: K) -> bool
pub fn has_triggering_object<K: TriggerKeyInput>(&self, key: K) -> bool
Check if a triggering object is set.
Mirrors Java’s SpellAbility.hasTriggeringObject(String).
Sourcepub fn get_triggering_value(&self, key: AbilityKey) -> Option<&AbilityValue>
pub fn get_triggering_value(&self, key: AbilityKey) -> Option<&AbilityValue>
Get a triggering object value by key.
Sourcepub fn get_triggering_card(&self, key: AbilityKey) -> Option<CardId>
pub fn get_triggering_card(&self, key: AbilityKey) -> Option<CardId>
Get a triggering card by key.
Sourcepub fn get_triggering_player(&self, key: AbilityKey) -> Option<PlayerId>
pub fn get_triggering_player(&self, key: AbilityKey) -> Option<PlayerId>
Get a triggering player by key.
Sourcepub fn get_triggering_cards(&self, key: AbilityKey) -> Vec<CardId>
pub fn get_triggering_cards(&self, key: AbilityKey) -> Vec<CardId>
Get triggering cards by key.
Sourcepub fn get_triggering_players(&self, key: AbilityKey) -> Vec<PlayerId>
pub fn get_triggering_players(&self, key: AbilityKey) -> Vec<PlayerId>
Get triggering players by key.
Sourcepub fn get_triggering_object<K: TriggerKeyInput>(&self, key: K) -> Option<&str>
pub fn get_triggering_object<K: TriggerKeyInput>(&self, key: K) -> Option<&str>
Get a triggering object by key.
Mirrors Java’s SpellAbility.getTriggeringObject(String).
Sourcepub fn reset_triggering_objects(&mut self)
pub fn reset_triggering_objects(&mut self)
Clear all triggering objects.
Mirrors Java’s SpellAbility.resetTriggeringObjects().
Sourcepub fn reset_once_resolved(&mut self)
pub fn reset_once_resolved(&mut self)
Cleanup after resolution — reset targets, trigger objects, paid hash.
Mirrors Java’s SpellAbility.resetOnceResolved().
Sourcepub fn yield_key(&self) -> String
pub fn yield_key(&self) -> String
Generate a unique key for this ability.
Mirrors Java’s SpellAbility.yieldKey().
Sourcepub fn rebuilt_description(&self) -> String
pub fn rebuilt_description(&self) -> String
Build a description from params.
Mirrors Java’s SpellAbility.rebuiltDescription().
Sourcepub fn to_unsuppressed_string(&self) -> String
pub fn to_unsuppressed_string(&self) -> String
Full text without suppression.
Mirrors Java’s SpellAbility.toUnsuppressedString().
Sourcepub fn has_additional_ability<K: TriggerKeyInput>(&self, key: K) -> bool
pub fn has_additional_ability<K: TriggerKeyInput>(&self, key: K) -> bool
Check if an additional ability with the given key exists.
Mirrors Java’s SpellAbility.hasAdditionalAbility(String).
Sourcepub fn get_additional_ability<K: TriggerKeyInput>(
&self,
key: K,
) -> Option<&SpellAbility>
pub fn get_additional_ability<K: TriggerKeyInput>( &self, key: K, ) -> Option<&SpellAbility>
Get an additional ability by key.
Mirrors Java’s SpellAbility.getAdditionalAbility(String).
Sourcepub fn set_additional_ability<K: TriggerKeyInput>(
&mut self,
key: K,
ability: SpellAbility,
)
pub fn set_additional_ability<K: TriggerKeyInput>( &mut self, key: K, ability: SpellAbility, )
Set an additional ability by key.
Mirrors Java’s SpellAbility.setAdditionalAbility(String, SpellAbility).
Sourcepub fn append_sub_ability(&mut self, sub: SpellAbility)
pub fn append_sub_ability(&mut self, sub: SpellAbility)
Append a sub-ability to the end of the chain.
Mirrors Java’s SpellAbility.appendSubAbility(SpellAbility).
pub fn copy_for_player(&self, activ: PlayerId) -> Self
pub fn copy_with_host_lki(&self, host: Card, lki: bool) -> Self
pub fn copy_with_host_lki_keep_text_changes( &self, host: Card, lki: bool, keep_text_changes: bool, ) -> Self
pub fn copy_with_host_activating_lki( &self, host: Card, activ: PlayerId, lki: bool, ) -> Self
pub fn copy_with_host_activating_lki_keep_text_changes( &self, host: Card, activ: PlayerId, lki: bool, keep_text_changes: bool, ) -> Self
Sourcepub fn copy_with_no_mana_cost(&self) -> Self
pub fn copy_with_no_mana_cost(&self) -> Self
Clone with no mana cost.
Mirrors Java’s SpellAbility.copyWithNoManaCost().
Sourcepub fn copy_with_defined_cost(&self, cost: &str) -> Self
pub fn copy_with_defined_cost(&self, cost: &str) -> Self
Clone with a specific cost.
Mirrors Java’s SpellAbility.copyWithDefinedCost(String).
Sourcepub fn copy_with_mana_cost_replaced(&self, old: &str, new: &str) -> Self
pub fn copy_with_mana_cost_replaced(&self, old: &str, new: &str) -> Self
Clone with mana cost replacement.
Mirrors Java’s SpellAbility.copyWithManaCostReplaced(String, String).
Sourcepub fn can_target(&self, card: CardId, game: &GameState) -> bool
pub fn can_target(&self, card: CardId, game: &GameState) -> bool
Check if this ability can target a specific card.
Mirrors Java’s SpellAbility.canTarget(Card).
Sourcepub fn reset_targets(&mut self)
pub fn reset_targets(&mut self)
Reset targets (alias for clear_targets).
Mirrors Java’s SpellAbility.resetTargets().
Sourcepub fn add_divided_allocation(&mut self, card: CardId, amount: i32)
pub fn add_divided_allocation(&mut self, card: CardId, amount: i32)
Add divided allocation for a target.
Mirrors Java’s SpellAbility.addDividedAllocation(Card, int).
Sourcepub fn reset_first_target(&mut self)
pub fn reset_first_target(&mut self)
Reset only the first target in the chain.
Mirrors Java’s SpellAbility.resetFirstTarget().
Sourcepub fn can_add_more_target(&self, game: &GameState) -> bool
pub fn can_add_more_target(&self, game: &GameState) -> bool
Check if more targets can be added.
Mirrors Java’s SpellAbility.canAddMoreTarget().
Sourcepub fn find_targeted_cards(&self) -> Vec<CardId>
pub fn find_targeted_cards(&self) -> Vec<CardId>
Collect all targeted cards from the entire chain.
Mirrors Java’s SpellAbility.findTargetedCards().
Sourcepub fn find_targeted_players(&self) -> Vec<PlayerId>
pub fn find_targeted_players(&self) -> Vec<PlayerId>
Collect all targeted players from the entire chain.
Mirrors Java’s SpellAbility.findTargetedPlayers().
Sourcepub fn can_target_spell_ability(&self) -> bool
pub fn can_target_spell_ability(&self) -> bool
Whether this ability targets spells/abilities on the stack.
Mirrors Java’s SpellAbility.canTargetSpellAbility().
Sourcepub fn setup_new_targets(
&mut self,
game: &GameState,
agents: &mut [Box<dyn PlayerAgent>],
mana_pools: &[ManaPool],
) -> bool
pub fn setup_new_targets( &mut self, game: &GameState, agents: &mut [Box<dyn PlayerAgent>], mana_pools: &[ManaPool], ) -> bool
Setup new targets for a retargeting scenario.
Mirrors Java’s SpellAbility.setupNewTargets().
Sourcepub fn clear_pips_to_reduce(&mut self)
pub fn clear_pips_to_reduce(&mut self)
Clear pip reduction tracking.
Mirrors Java’s SpellAbility.clearPipsToReduce().
Sourcepub fn add_tapped_for_convoke(&mut self, card: CardId)
pub fn add_tapped_for_convoke(&mut self, card: CardId)
Add a card tapped for convoke.
Mirrors Java’s SpellAbility.addTappedForConvoke(Card).
Sourcepub fn clear_tapped_for_convoke(&mut self)
pub fn clear_tapped_for_convoke(&mut self)
Clear convoke tracking.
Mirrors Java’s SpellAbility.clearTappedForConvoke().
Sourcepub fn reset_sacrificed_as_emerge(&mut self)
pub fn reset_sacrificed_as_emerge(&mut self)
Reset the sacrificed-as-emerge card.
Mirrors Java’s SpellAbility.resetSacrificedAsEmerge().
Sourcepub fn reset_sacrificed_as_offering(&mut self)
pub fn reset_sacrificed_as_offering(&mut self)
Reset the sacrificed-as-offering card.
Mirrors Java’s SpellAbility.resetSacrificedAsOffering().
Sourcepub fn add_spliced_cards(&mut self, cards: Vec<CardId>)
pub fn add_spliced_cards(&mut self, cards: Vec<CardId>)
Add spliced cards to this spell.
Mirrors Java’s SpellAbility.addSplicedCards(List<Card>).
Sourcepub fn known_determine_defined(&self) -> bool
pub fn known_determine_defined(&self) -> bool
Whether Defined$ resolves to a deterministic set of objects.
Mirrors Java’s SpellAbility.knownDetermineDefined().
Sourcepub fn add_announce_var(&mut self, key: &str, value: i32)
pub fn add_announce_var(&mut self, key: &str, value: i32)
Add an announced variable value.
Mirrors Java’s SpellAbility.addAnnounceVar(String, int).
Sourcepub fn can_be_targeted_by(&self, _sa: &SpellAbility) -> bool
pub fn can_be_targeted_by(&self, _sa: &SpellAbility) -> bool
Check if this spell ability can be targeted by another SA.
Mirrors Java’s SpellAbility.canBeTargetedBy(SpellAbility).
Sourcepub fn has_property(&self, property: &str) -> bool
pub fn has_property(&self, property: &str) -> bool
Check if this ability has a specific property.
Mirrors Java’s SpellAbility.hasProperty(String).
Sourcepub fn tracks_mana_spent(&self) -> bool
pub fn tracks_mana_spent(&self) -> bool
Whether this ability tracks mana spent.
Mirrors Java’s SpellAbility.tracksManaSpent().
Sourcepub fn apply_text_change(&mut self, original: &str, replacement: &str)
pub fn apply_text_change(&mut self, original: &str, replacement: &str)
Apply text replacement.
Mirrors Java’s SpellAbility.changeText(String, String).
Sourcepub fn apply_text_change_intrinsic(&mut self, original: &str, replacement: &str)
pub fn apply_text_change_intrinsic(&mut self, original: &str, replacement: &str)
Apply intrinsic text replacement.
Mirrors Java’s SpellAbility.changeTextIntrinsic(String, String).
Sourcepub fn apply_text_changes(&mut self, pairs: &[(String, String)])
pub fn apply_text_changes(&mut self, pairs: &[(String, String)])
Apply a batch of text replacements to this ability and linked abilities.
Sourcepub fn apply_text_changes_intrinsic(
&mut self,
color_map: &HashMap<String, String>,
type_map: &HashMap<String, String>,
)
pub fn apply_text_changes_intrinsic( &mut self, color_map: &HashMap<String, String>, type_map: &HashMap<String, String>, )
Apply intrinsic text changes to this ability and linked abilities.
Sourcepub fn set_host_card(&mut self, card: Card)
pub fn set_host_card(&mut self, card: Card)
Java parity hook for SpellAbility.setHostCard(Card).
pub fn set_host_card_id(&mut self, card_id: CardId)
Sourcepub fn set_keyword(&mut self, keyword: KeywordInterface)
pub fn set_keyword(&mut self, keyword: KeywordInterface)
Java parity hook for SpellAbility.setKeyword(KeywordInterface).
Sourcepub fn set_card_state(&mut self, state: &CardState)
pub fn set_card_state(&mut self, state: &CardState)
Java parity hook for SpellAbility.setCardState(CardState).
Sourcepub fn set_intrinsic(&mut self, intrinsic: bool)
pub fn set_intrinsic(&mut self, intrinsic: bool)
Java parity hook for SpellAbility.setIntrinsic(boolean).
pub fn is_intrinsic(&self) -> bool
Sourcepub fn get_amount_life_paid(&self) -> i32
pub fn get_amount_life_paid(&self) -> i32
Mirrors Java’s SpellAbility.getAmountLifePaid().
Sourcepub fn set_amount_life_paid(&mut self, value: i32)
pub fn set_amount_life_paid(&mut self, value: i32)
Mirrors Java’s SpellAbility.setAmountLifePaid(int).
Sourcepub fn calculate_score_for_mana_ability(&self) -> i32
pub fn calculate_score_for_mana_ability(&self) -> i32
Calculate an AI score for this mana ability.
Mirrors Java’s SpellAbility.calculateScoreForManaAbility().
Sourcepub fn can_cast_timing(&self, game: &GameState) -> bool
pub fn can_cast_timing(&self, game: &GameState) -> bool
Check if this ability can be cast at the current timing.
Mirrors Java’s SpellAbility.canCastTiming(Game).
Sourcepub fn with_flash(&self, game: &GameState) -> bool
pub fn with_flash(&self, game: &GameState) -> bool
Check if this spell has flash.
Mirrors Java’s SpellAbility.withFlash(Game).
Sourcepub fn check_restrictions(&self, game: &GameState) -> bool
pub fn check_restrictions(&self, game: &GameState) -> bool
Check restrictions for this ability.
Mirrors Java’s SpellAbility.checkRestrictions(Game).
Sourcepub fn add_rollback_effect(&mut self, effect: String)
pub fn add_rollback_effect(&mut self, effect: String)
Add a rollback effect.
Mirrors Java’s SpellAbility.addRollbackEffect(String).
Sourcepub fn rollback(&mut self) -> bool
pub fn rollback(&mut self) -> bool
Rollback all tracked effects.
Mirrors Java’s SpellAbility.rollback().
Sourcepub fn has_optional_keyword_amount(&self, keyword: &str) -> bool
pub fn has_optional_keyword_amount(&self, keyword: &str) -> bool
Check if this ability has an optional keyword with a specific amount.
Mirrors Java’s SpellAbility.hasOptionalKeywordAmount(String).
Sourcepub fn clear_optional_keyword_amount(&mut self)
pub fn clear_optional_keyword_amount(&mut self)
Clear all optional keyword amounts.
Mirrors Java’s SpellAbility.clearOptionalKeywordAmount().
Sourcepub fn clear_last_state(&mut self)
pub fn clear_last_state(&mut self)
Clear last known state tracking.
Mirrors Java’s SpellAbility.clearLastState().
Sourcepub fn set_triggering_object<K: TriggerKeyInput, V: Into<AbilityValue>>(
&mut self,
key: K,
value: V,
)
pub fn set_triggering_object<K: TriggerKeyInput, V: Into<AbilityValue>>( &mut self, key: K, value: V, )
Set a triggering object in the map.
Mirrors Java’s SpellAbility.setTriggeringObject(AbilityKey, Object).
Sourcepub fn set_triggering_value<V: Into<AbilityValue>>(
&mut self,
key: AbilityKey,
value: V,
)
pub fn set_triggering_value<V: Into<AbilityValue>>( &mut self, key: AbilityKey, value: V, )
Typed trigger value setter.
Sourcepub fn set_triggering_spell_ability<K: TriggerKeyInput>(
&mut self,
key: K,
value: SpellAbility,
)
pub fn set_triggering_spell_ability<K: TriggerKeyInput>( &mut self, key: K, value: SpellAbility, )
Set a triggering spell ability in the map.
Mirrors Java’s SpellAbility.setTriggeringObject(AbilityKey, Object) for SpellAbility values.
Sourcepub fn get_triggering_spell_ability<K: TriggerKeyInput>(
&self,
key: K,
) -> Option<&SpellAbility>
pub fn get_triggering_spell_ability<K: TriggerKeyInput>( &self, key: K, ) -> Option<&SpellAbility>
Get a triggering spell ability from the map.
Sourcepub fn update_triggering_object<K: TriggerKeyInput, V: Into<AbilityValue>>(
&mut self,
key: K,
value: V,
)
pub fn update_triggering_object<K: TriggerKeyInput, V: Into<AbilityValue>>( &mut self, key: K, value: V, )
Update an existing triggering object.
Mirrors Java’s SpellAbility.updateTriggeringObject(String, Object).
Sourcepub fn update_target(&mut self, old: CardId, new: CardId)
pub fn update_target(&mut self, old: CardId, new: CardId)
Update a target in the chosen targets.
Mirrors Java’s SpellAbility.updateTarget(Card, Card).
Sourcepub fn targets_single_target(&self) -> bool
pub fn targets_single_target(&self) -> bool
Whether this targets a single target only.
Mirrors Java’s SpellAbility.targetsSingleTarget().
Sourcepub fn gets_var_operand(&self) -> Option<&str>
pub fn gets_var_operand(&self) -> Option<&str>
Get variable operand 1.
Mirrors Java’s SpellAbility.getSVar("Operand").
Sourcepub fn gets_var_operand2(&self) -> Option<&str>
pub fn gets_var_operand2(&self) -> Option<&str>
Get variable operand 2.
Mirrors Java’s SpellAbility.getSVar("Operand2").
Sourcepub fn sets_var_operand(&mut self, value: &str)
pub fn sets_var_operand(&mut self, value: &str)
Set variable operand 1.
Mirrors Java’s SpellAbility.setSVar("Operand", val).
Sourcepub fn sets_var_operand2(&mut self, value: &str)
pub fn sets_var_operand2(&mut self, value: &str)
Set variable operand 2.
Mirrors Java’s SpellAbility.setSVar("Operand2", val).
Sourcepub fn gets_var_to_check(&self) -> Option<&str>
pub fn gets_var_to_check(&self) -> Option<&str>
Get variable to check 1.
Mirrors Java’s SpellAbility.getSVar("VarToCheck").
Sourcepub fn gets_var_to_check2(&self) -> Option<&str>
pub fn gets_var_to_check2(&self) -> Option<&str>
Get variable to check 2.
Mirrors Java’s SpellAbility.getSVar("VarToCheck2").
Sourcepub fn sets_var_to_check(&mut self, value: &str)
pub fn sets_var_to_check(&mut self, value: &str)
Set variable to check 1.
Mirrors Java’s SpellAbility.setSVar("VarToCheck", val).
Sourcepub fn sets_var_to_check2(&mut self, value: &str)
pub fn sets_var_to_check2(&mut self, value: &str)
Set variable to check 2.
Mirrors Java’s SpellAbility.setSVar("VarToCheck2", val).
Sourcepub fn gets_var_operator(&self) -> Option<&str>
pub fn gets_var_operator(&self) -> Option<&str>
Get variable operator 1.
Mirrors Java’s SpellAbility.getSVar("Operator").
Sourcepub fn gets_var_operator2(&self) -> Option<&str>
pub fn gets_var_operator2(&self) -> Option<&str>
Get variable operator 2.
Mirrors Java’s SpellAbility.getSVar("Operator2").
Sourcepub fn sets_var_operator(&mut self, value: &str)
pub fn sets_var_operator(&mut self, value: &str)
Set variable operator 1.
Mirrors Java’s SpellAbility.setSVar("Operator", val).
Sourcepub fn sets_var_operator2(&mut self, value: &str)
pub fn sets_var_operator2(&mut self, value: &str)
Set variable operator 2.
Mirrors Java’s SpellAbility.setSVar("Operator2", val).
Trait Implementations§
Source§impl CardTraitIrOwner for SpellAbility
impl CardTraitIrOwner for SpellAbility
type Ir = SpellAbilityIr
fn ir(&self) -> &Self::Ir
fn card_trait_requirements(&self) -> &CardTraitRequirementsIr
fn meets_card_trait_requirements( &self, game: &GameState, source: &Card, svar_source: &dyn HasSVars, ) -> bool
Source§impl Clone for SpellAbility
impl Clone for SpellAbility
Source§fn clone(&self) -> SpellAbility
fn clone(&self) -> SpellAbility
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpellAbility
impl Debug for SpellAbility
Source§impl<'de> Deserialize<'de> for SpellAbility
impl<'de> Deserialize<'de> for SpellAbility
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SpellAbility
Mirrors Java’s SpellAbility.toString().
Walks the sub-ability chain, concatenating descriptions.
impl Display for SpellAbility
Mirrors Java’s SpellAbility.toString().
Walks the sub-ability chain, concatenating descriptions.