Skip to main content

SpellAbility

Struct SpellAbility 

Source
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: PlayerId

The 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: String

The raw ability text (pipe-delimited params).

§record_type: AbilityRecordType

Java parity: AB/SP/ST/DB record kind used to distinguish sub-abilities.

§ir: SpellAbilityIr

Compiled 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: TargetChoices

The 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: bool

Whether this is a spell (not an ability).

§is_trigger: bool

Whether this is a triggered ability.

§is_activated: bool

Whether this is an activated ability.

§intrinsic: bool

Java 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: u8

Index 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: u8

Number 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: bool

Whether the kicker cost was paid.

§buyback_paid: bool

Whether buyback was paid (spell returns to hand on resolve).

§overloaded: bool

Whether this spell is overloaded (targets all valid instead of one).

§is_copy: bool

Whether this spell is a copy (created by Storm, Replicate, etc.).

§paid_life_amount: i32

Java parity: life paid while activating or casting this ability.

§kick_count: u32

Number of times the kicker/multikicker cost was paid.

§replicate_count: u32

Number of times the replicate cost was paid.

§optional_generic_cost_paid: bool

Whether a generic optional additional cost was paid.

§trigger_remembered_amount: i32

Sum of integer values remembered on the trigger that spawned this ability (Java: TriggerRememberAmount / sa.getTriggerRemembered()).

§x_mana_cost_paid: u32

The 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: String

Human-readable description of this ability. Mirrors Java’s SpellAbility.description.

§stack_description: String

Description used when this ability is on the stack. Mirrors Java’s SpellAbility.stackDescription.

§is_mana_ability: bool

Whether this is a mana ability (doesn’t use the stack). Mirrors Java’s SpellAbility.isManaAbility.

§is_land_ability: bool

Whether this is a land ability (play land action). Mirrors Java’s LandAbility subclass flag.

§cast_face_down: bool

Runtime-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: SpellAbilityRestriction

Activation restriction for this ability.

§condition: SpellAbilityCondition

Condition 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: bool

Java 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.

Source

pub fn valid_card(&self) -> Option<&CompiledSelector>

Get the compiled ValidCard$ filter.

Source

pub fn valid_player(&self) -> Option<&CompiledSelector>

Get the compiled ValidPlayer$ filter.

Source

pub fn valid_target(&self) -> Option<&CompiledSelector>

Get the compiled ValidTarget$ filter.

Source

pub fn change_type(&self) -> Option<&str>

Get the ChangeType$ filter string (used by zone-change effects).

Source

pub fn change_type_selector(&self) -> Option<&CompiledSelector>

Get the compiled ChangeType$ filter.

Source

pub fn defined(&self) -> Option<&str>

Get the Defined$ card reference (e.g. “Self”, “Remembered”, “Targeted”).

Source

pub fn defined_ref(&self) -> Option<&DefinedRef>

Get the first parsed Defined$ card reference.

Source

pub fn defined_player(&self) -> Option<&str>

Get the DefinedPlayer$ player reference (e.g. “Player”, “You”, “Opponent”).

Source

pub fn origin(&self) -> Option<&str>

Get the Origin$ zone type string.

Source

pub fn origin_zone(&self) -> Option<ZoneType>

Get the Origin$ zone type.

Source

pub fn origin_zones(&self) -> Vec<ZoneType>

Get the Origin$ zone list.

Source

pub fn destination(&self) -> Option<&str>

Get the Destination$ zone type string.

Source

pub fn destination_zone(&self) -> Option<ZoneType>

Get the Destination$ zone type.

Source

pub fn library_position(&self) -> Option<&str>

Get the LibraryPosition$ string (e.g. “0”, “-1”, “Bottom”).

Source

pub fn library_position_2(&self) -> Option<&str>

Get the LibraryPosition2$ string for secondary zone placement.

Source

pub fn library_position_alternative(&self) -> Option<&str>

Get the LibraryPositionAlternative$ string for DestinationAlternative$.

Source

pub fn produced_ir(&self) -> Option<&ProducedMana>

Get the lowered Produced$ mana expression.

Source

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.

Source

pub fn is_hidden(&self) -> bool

Get Hidden$ as boolean.

Source

pub fn is_mandatory(&self) -> bool

Get Mandatory$ as boolean.

Source

pub fn is_tapped(&self) -> bool

Get Tapped$ as boolean.

Source

pub fn is_shuffle(&self) -> bool

Get Shuffle$ as boolean.

Source

pub fn is_remember_changed(&self) -> bool

Get RememberChanged$ as boolean.

Source

pub fn is_optional(&self) -> bool

Get Optional$ as boolean.

Source

pub fn is_gain_control(&self) -> bool

Get GainControl$ as boolean.

Source

pub fn is_forget_changed(&self) -> bool

Get ForgetChanged$ as boolean.

Source

pub fn is_imprint(&self) -> bool

Get Imprint$ as boolean.

Source

pub fn is_face_down(&self) -> bool

Get FaceDown$ as boolean.

Source

pub fn is_exile_face_down(&self) -> bool

Get ExileFaceDown$ as boolean.

Source

pub fn is_transformed(&self) -> bool

Get Transformed$ as boolean.

Source

pub fn is_at_random(&self) -> bool

Get AtRandom$ as boolean.

Source

pub fn is_reveal(&self) -> bool

Get Reveal$ as boolean (default true for searches — NoReveal overrides).

Source

pub fn change_num(&self) -> usize

Get ChangeNum$ as usize, defaulting to 1.

Source

pub fn chooser(&self) -> Option<&str>

Get Chooser$ player reference.

Source

pub fn attached_to(&self) -> Option<&str>

Get AttachedTo$ target definition.

Source

pub fn destination_alternative(&self) -> Option<&str>

Get DestinationAlternative$ zone.

Source

pub fn select_prompt(&self) -> Option<&str>

Get SelectPrompt$ custom prompt text.

Source

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

Get a numeric param by key, returning None if absent or non-numeric.

Source

pub fn sub_ability_name(&self) -> Option<&str>

Get the SubAbility$ SVar name.

Source

pub fn token_script(&self) -> Option<&str>

Get the TokenScript$ name.

Source

pub fn token_owner(&self) -> Option<&str>

Get the TokenOwner$ reference.

Source

pub fn with_counters_type(&self) -> Option<&str>

Get the WithCountersType$ string.

Source

pub fn with_counters_type_enum(&self) -> Option<&CounterType>

Get the typed WithCountersType$.

Source§

impl SpellAbility

Source

pub fn uses_targeting(&self) -> bool

Whether this ability uses targeting. Mirrors Java’s usesTargeting(): return targetRestrictions != null.

Source

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.

Source

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

Source

pub fn get_targets(&self) -> &TargetChoices

Get the chosen targets. Mirrors Java’s getTargets().

Source

pub fn get_targets_mut(&mut self) -> &mut TargetChoices

Get the chosen targets mutably. Mirrors Java’s getTargets() for mutation.

Source

pub fn get_sub_ability(&self) -> Option<&SpellAbility>

Get the sub-ability. Mirrors Java’s getSubAbility().

Source

pub fn get_sub_ability_mut(&mut self) -> Option<&mut SpellAbility>

Get the sub-ability mutably.

Source

pub fn is_wrapper(&self) -> bool

Mirrors Java’s SpellAbility.isWrapper().

Source

pub fn get_wrapped_ability(&self) -> &SpellAbility

Mirrors Java’s WrappedAbility.getWrappedAbility().

Source

pub fn get_wrapped_ability_mut(&mut self) -> &mut SpellAbility

Source

pub fn set_wrapped_ability(&mut self, wrapped: SpellAbility)

Source

pub fn clear_targets(&mut self)

Clear the chosen targets. Mirrors Java’s clearTargets().

Source

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.

Source

pub fn new_simple( source: Option<CardId>, player: PlayerId, ability_text: &str, ) -> Self

Create a simple SpellAbility for tests and triggers.

Source

pub fn new_empty(source: Option<CardId>, player: PlayerId) -> Self

Create a minimal empty SpellAbility stub. Mirrors Java’s common SpellAbility.EmptySa usage.

Source

pub fn new_land(source: Option<CardId>, player: PlayerId) -> Self

Create a minimal land-play SpellAbility stub.

Source

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).

Source

pub fn can_this_produce(&self) -> bool

Whether this ability can produce mana. Mirrors Java’s SpellAbility.canThisProduce().

Source

pub fn can_produce(&self, color: &str) -> bool

Whether this ability can produce a specific color. Mirrors Java’s SpellAbility.canProduce(String).

Source

pub fn amount_of_mana_generated(&self) -> i32

Amount of mana generated by this ability. Mirrors Java’s SpellAbility.amountOfManaGenerated().

Source

pub fn total_amount_of_mana_generated(&self) -> i32

Total amount of mana generated, counting Any/All as 1. Mirrors Java’s SpellAbility.totalAmountOfManaGenerated().

Source

pub fn allows_paying_with_shard(&self) -> bool

Whether paying with shard mana is allowed. Mirrors Java’s SpellAbility.allowsPayingWithShard().

Source

pub fn cant_be_copied(&self) -> bool

Whether this ability cannot be copied. Mirrors Java’s SpellAbility.cantBeCopied().

Source

pub fn can_play(&self, game: &GameState) -> bool

Whether this ability can be played (checks restrictions). Mirrors Java’s SpellAbility.canPlay().

Source

pub fn can_play_with_optional_cost(&self) -> bool

Whether this ability can be played with optional costs. Mirrors Java’s SpellAbility.canPlayWithOptionalCost().

Source

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().

Source

pub fn add_optional_cost(&mut self, cost: OptionalCost)

Add an optional cost to this ability. Mirrors Java’s SpellAbility.addOptionalCost(OptionalCost).

Source

pub fn cost_has_x(&self) -> bool

Whether the mana cost contains X. Mirrors Java’s SpellAbility.costHasX().

Source

pub fn cost_has_mana_x(&self) -> bool

Whether the mana cost contains X (mana-specific check). Mirrors Java’s SpellAbility.costHasManaX().

Source

pub fn met_conditions(&self, game: &GameState) -> bool

Whether conditions are met for this ability. Mirrors Java’s SpellAbility.metConditions().

Source

pub fn clear_mana_paid(&mut self)

Clear mana paid tracking. Mirrors Java’s SpellAbility.clearManaPaid().

Source

pub fn apply_paying_mana_effects(&mut self)

Apply effects from paying mana (e.g. Sunburst). Mirrors Java’s SpellAbility.applyPayingManaEffects().

Source

pub fn run(&self)

Run this ability (no-op in Rust; Java resolves via resolveStack). Mirrors Java’s SpellAbility.run().

Source

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).

Source

pub fn reset_paid_hash(&mut self)

Reset the paid cost hash. Mirrors Java’s SpellAbility.resetPaidHash().

Source

pub fn has_triggering_object<K: TriggerKeyInput>(&self, key: K) -> bool

Check if a triggering object is set. Mirrors Java’s SpellAbility.hasTriggeringObject(String).

Source

pub fn get_triggering_value(&self, key: AbilityKey) -> Option<&AbilityValue>

Get a triggering object value by key.

Source

pub fn get_triggering_card(&self, key: AbilityKey) -> Option<CardId>

Get a triggering card by key.

Source

pub fn get_triggering_player(&self, key: AbilityKey) -> Option<PlayerId>

Get a triggering player by key.

Source

pub fn get_triggering_cards(&self, key: AbilityKey) -> Vec<CardId>

Get triggering cards by key.

Source

pub fn get_triggering_players(&self, key: AbilityKey) -> Vec<PlayerId>

Get triggering players by key.

Source

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

Get a triggering object by key. Mirrors Java’s SpellAbility.getTriggeringObject(String).

Source

pub fn reset_triggering_objects(&mut self)

Clear all triggering objects. Mirrors Java’s SpellAbility.resetTriggeringObjects().

Source

pub fn reset_once_resolved(&mut self)

Cleanup after resolution — reset targets, trigger objects, paid hash. Mirrors Java’s SpellAbility.resetOnceResolved().

Source

pub fn yield_key(&self) -> String

Generate a unique key for this ability. Mirrors Java’s SpellAbility.yieldKey().

Source

pub fn rebuilt_description(&self) -> String

Build a description from params. Mirrors Java’s SpellAbility.rebuiltDescription().

Source

pub fn to_unsuppressed_string(&self) -> String

Full text without suppression. Mirrors Java’s SpellAbility.toUnsuppressedString().

Source

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).

Source

pub fn get_additional_ability<K: TriggerKeyInput>( &self, key: K, ) -> Option<&SpellAbility>

Get an additional ability by key. Mirrors Java’s SpellAbility.getAdditionalAbility(String).

Source

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).

Source

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).

Source

pub fn copy(&self) -> Self

Clone this spell ability. Mirrors Java’s SpellAbility.copy().

Source

pub fn copy_for_player(&self, activ: PlayerId) -> Self

Source

pub fn copy_with_host_lki(&self, host: Card, lki: bool) -> Self

Source

pub fn copy_with_host_lki_keep_text_changes( &self, host: Card, lki: bool, keep_text_changes: bool, ) -> Self

Source

pub fn copy_with_host_activating_lki( &self, host: Card, activ: PlayerId, lki: bool, ) -> Self

Source

pub fn copy_with_host_activating_lki_keep_text_changes( &self, host: Card, activ: PlayerId, lki: bool, keep_text_changes: bool, ) -> Self

Source

pub fn copy_with_no_mana_cost(&self) -> Self

Clone with no mana cost. Mirrors Java’s SpellAbility.copyWithNoManaCost().

Source

pub fn copy_with_defined_cost(&self, cost: &str) -> Self

Clone with a specific cost. Mirrors Java’s SpellAbility.copyWithDefinedCost(String).

Source

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).

Source

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).

Source

pub fn reset_targets(&mut self)

Reset targets (alias for clear_targets). Mirrors Java’s SpellAbility.resetTargets().

Source

pub fn add_divided_allocation(&mut self, card: CardId, amount: i32)

Add divided allocation for a target. Mirrors Java’s SpellAbility.addDividedAllocation(Card, int).

Source

pub fn reset_first_target(&mut self)

Reset only the first target in the chain. Mirrors Java’s SpellAbility.resetFirstTarget().

Source

pub fn can_add_more_target(&self, game: &GameState) -> bool

Check if more targets can be added. Mirrors Java’s SpellAbility.canAddMoreTarget().

Source

pub fn find_targeted_cards(&self) -> Vec<CardId>

Collect all targeted cards from the entire chain. Mirrors Java’s SpellAbility.findTargetedCards().

Source

pub fn find_targeted_players(&self) -> Vec<PlayerId>

Collect all targeted players from the entire chain. Mirrors Java’s SpellAbility.findTargetedPlayers().

Source

pub fn can_target_spell_ability(&self) -> bool

Whether this ability targets spells/abilities on the stack. Mirrors Java’s SpellAbility.canTargetSpellAbility().

Source

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().

Source

pub fn clear_pips_to_reduce(&mut self)

Clear pip reduction tracking. Mirrors Java’s SpellAbility.clearPipsToReduce().

Source

pub fn add_tapped_for_convoke(&mut self, card: CardId)

Add a card tapped for convoke. Mirrors Java’s SpellAbility.addTappedForConvoke(Card).

Source

pub fn clear_tapped_for_convoke(&mut self)

Clear convoke tracking. Mirrors Java’s SpellAbility.clearTappedForConvoke().

Source

pub fn reset_sacrificed_as_emerge(&mut self)

Reset the sacrificed-as-emerge card. Mirrors Java’s SpellAbility.resetSacrificedAsEmerge().

Source

pub fn reset_sacrificed_as_offering(&mut self)

Reset the sacrificed-as-offering card. Mirrors Java’s SpellAbility.resetSacrificedAsOffering().

Source

pub fn add_spliced_cards(&mut self, cards: Vec<CardId>)

Add spliced cards to this spell. Mirrors Java’s SpellAbility.addSplicedCards(List<Card>).

Source

pub fn known_determine_defined(&self) -> bool

Whether Defined$ resolves to a deterministic set of objects. Mirrors Java’s SpellAbility.knownDetermineDefined().

Source

pub fn undo(&mut self) -> bool

Undo this ability. Mirrors Java’s SpellAbility.undo().

Source

pub fn add_announce_var(&mut self, key: &str, value: i32)

Add an announced variable value. Mirrors Java’s SpellAbility.addAnnounceVar(String, int).

Source

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).

Source

pub fn has_property(&self, property: &str) -> bool

Check if this ability has a specific property. Mirrors Java’s SpellAbility.hasProperty(String).

Source

pub fn is_last_chapter(&self, game: &GameState) -> bool

Source

pub fn tracks_mana_spent(&self) -> bool

Whether this ability tracks mana spent. Mirrors Java’s SpellAbility.tracksManaSpent().

Source

pub fn apply_text_change(&mut self, original: &str, replacement: &str)

Apply text replacement. Mirrors Java’s SpellAbility.changeText(String, String).

Source

pub fn apply_text_change_intrinsic(&mut self, original: &str, replacement: &str)

Apply intrinsic text replacement. Mirrors Java’s SpellAbility.changeTextIntrinsic(String, String).

Source

pub fn apply_text_changes(&mut self, pairs: &[(String, String)])

Apply a batch of text replacements to this ability and linked abilities.

Source

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.

Source

pub fn set_host_card(&mut self, card: Card)

Java parity hook for SpellAbility.setHostCard(Card).

Source

pub fn set_host_card_id(&mut self, card_id: CardId)

Source

pub fn set_keyword(&mut self, keyword: KeywordInterface)

Java parity hook for SpellAbility.setKeyword(KeywordInterface).

Source

pub fn set_card_state(&mut self, state: &CardState)

Java parity hook for SpellAbility.setCardState(CardState).

Source

pub fn set_intrinsic(&mut self, intrinsic: bool)

Java parity hook for SpellAbility.setIntrinsic(boolean).

Source

pub fn is_intrinsic(&self) -> bool

Source

pub fn get_amount_life_paid(&self) -> i32

Mirrors Java’s SpellAbility.getAmountLifePaid().

Source

pub fn set_amount_life_paid(&mut self, value: i32)

Mirrors Java’s SpellAbility.setAmountLifePaid(int).

Source

pub fn calculate_score_for_mana_ability(&self) -> i32

Calculate an AI score for this mana ability. Mirrors Java’s SpellAbility.calculateScoreForManaAbility().

Source

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).

Source

pub fn with_flash(&self, game: &GameState) -> bool

Check if this spell has flash. Mirrors Java’s SpellAbility.withFlash(Game).

Source

pub fn check_restrictions(&self, game: &GameState) -> bool

Check restrictions for this ability. Mirrors Java’s SpellAbility.checkRestrictions(Game).

Source

pub fn add_rollback_effect(&mut self, effect: String)

Add a rollback effect. Mirrors Java’s SpellAbility.addRollbackEffect(String).

Source

pub fn rollback(&mut self) -> bool

Rollback all tracked effects. Mirrors Java’s SpellAbility.rollback().

Source

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).

Source

pub fn clear_optional_keyword_amount(&mut self)

Clear all optional keyword amounts. Mirrors Java’s SpellAbility.clearOptionalKeywordAmount().

Source

pub fn clear_last_state(&mut self)

Clear last known state tracking. Mirrors Java’s SpellAbility.clearLastState().

Source

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).

Source

pub fn set_triggering_value<V: Into<AbilityValue>>( &mut self, key: AbilityKey, value: V, )

Typed trigger value setter.

Source

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.

Source

pub fn get_triggering_spell_ability<K: TriggerKeyInput>( &self, key: K, ) -> Option<&SpellAbility>

Get a triggering spell ability from the map.

Source

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).

Source

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

Update a target in the chosen targets. Mirrors Java’s SpellAbility.updateTarget(Card, Card).

Source

pub fn targets_single_target(&self) -> bool

Whether this targets a single target only. Mirrors Java’s SpellAbility.targetsSingleTarget().

Source

pub fn gets_var_operand(&self) -> Option<&str>

Get variable operand 1. Mirrors Java’s SpellAbility.getSVar("Operand").

Source

pub fn gets_var_operand2(&self) -> Option<&str>

Get variable operand 2. Mirrors Java’s SpellAbility.getSVar("Operand2").

Source

pub fn sets_var_operand(&mut self, value: &str)

Set variable operand 1. Mirrors Java’s SpellAbility.setSVar("Operand", val).

Source

pub fn sets_var_operand2(&mut self, value: &str)

Set variable operand 2. Mirrors Java’s SpellAbility.setSVar("Operand2", val).

Source

pub fn gets_var_to_check(&self) -> Option<&str>

Get variable to check 1. Mirrors Java’s SpellAbility.getSVar("VarToCheck").

Source

pub fn gets_var_to_check2(&self) -> Option<&str>

Get variable to check 2. Mirrors Java’s SpellAbility.getSVar("VarToCheck2").

Source

pub fn sets_var_to_check(&mut self, value: &str)

Set variable to check 1. Mirrors Java’s SpellAbility.setSVar("VarToCheck", val).

Source

pub fn sets_var_to_check2(&mut self, value: &str)

Set variable to check 2. Mirrors Java’s SpellAbility.setSVar("VarToCheck2", val).

Source

pub fn gets_var_operator(&self) -> Option<&str>

Get variable operator 1. Mirrors Java’s SpellAbility.getSVar("Operator").

Source

pub fn gets_var_operator2(&self) -> Option<&str>

Get variable operator 2. Mirrors Java’s SpellAbility.getSVar("Operator2").

Source

pub fn sets_var_operator(&mut self, value: &str)

Set variable operator 1. Mirrors Java’s SpellAbility.setSVar("Operator", val).

Source

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

Source§

impl Clone for SpellAbility

Source§

fn clone(&self) -> SpellAbility

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 SpellAbility

Source§

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

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

impl<'de> Deserialize<'de> for SpellAbility

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 Display for SpellAbility

Mirrors Java’s SpellAbility.toString(). Walks the sub-ability chain, concatenating descriptions.

Source§

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

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

impl From<SpellAbility> for AbilityValue

Source§

fn from(value: SpellAbility) -> Self

Converts to this type from the input type.
Source§

impl ISpellAbility for SpellAbility

Source§

fn is_spell(&self) -> bool

Whether this is a spell (cast from hand/zone, uses the stack).
Source§

fn is_ability(&self) -> bool

Whether this is an activated ability.
Source§

fn is_trigger(&self) -> bool

Whether this is a triggered ability.
Source§

impl Serialize for SpellAbility

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

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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