Skip to main content

Module spellability

Module spellability 

Source

Re-exports§

pub use ability_mana_part::AbilityManaPart;
pub use alternative_cost::AlternativeCost;
pub use alternative_cost::MORPH_GENERIC_COST;
pub use alternative_cost::MORPH_PT;
pub use optional_cost::OptionalCost;
pub use optional_cost_value::OptionalCostValue;
pub use runtime_types::AbilityDuration;
pub use runtime_types::ReplaceDyingCondition;
pub use runtime_types::SpellAbilityMode;
pub use runtime_types::TriggerCondition;
pub use spell_ability_condition::SpellAbilityCondition;
pub use spell_ability_predicates::has_sub_ability_api;
pub use spell_ability_predicates::is_api;
pub use spell_ability_predicates::is_valid;
pub use spell_ability_restriction::SpellAbilityRestriction;
pub use spell_ability_variables::SpellAbilityVariables;
pub use target_choices::TargetChoices;
pub use target_restrictions::TargetKind;
pub use target_restrictions::TargetRestrictions;
pub use valid_sa::matches_valid_sa;
pub use crate::ability::ability_factory::build_spell_ability;
pub use crate::ability::ability_factory::build_spell_ability_for_card_cast;
pub use crate::ability::ability_factory::build_spell_ability_from_host_card;
pub use crate::zone::magic_stack::MagicStack;
pub use crate::zone::magic_stack::StackEntry;

Modules§

ability
Ability – helper functions for in-play abilities. Mirrors Java’s Ability.java (base class for abilities on permanents). In Rust the subclass is flattened into SpellAbility.
ability_activated
AbilityActivated – helper functions for activated abilities. Mirrors Java’s AbilityActivated.java. In Rust the subclass is flattened: SpellAbility.is_activated == true.
ability_mana_part
Mana-producing part of an ability.
ability_static
AbilityStatic – helper functions for static abilities (e.g. morph face-up). Mirrors Java’s AbilityStatic.java. Static abilities are special actions that don’t use the stack (like turning a morph face-up).
ability_sub
AbilitySub – helper functions for sub-abilities in the chain. Mirrors Java’s AbilitySub.java. Sub-abilities are chained via SpellAbility.sub_ability and resolve sequentially after their parent.
alternative_cost
Alternative casting costs for spells and abilities.
land_ability
LandAbility – helper functions for land play abilities. Mirrors Java’s LandAbility.java. Playing a land is a special action, not a spell – it doesn’t use the stack.
optional_cost
Optional additional costs for spells.
optional_cost_value
OptionalCostValue — pairs an optional cost type with a description.
params
Typed accessor helpers for SpellAbility parameters.
runtime_types
spell
Spell – helper functions for cast spells. Mirrors Java’s Spell.java (subclass of SpellAbility for spells cast from hand/zone). In Rust the subclass is flattened: SpellAbility.is_spell == true marks a spell.
spell_ability_condition
Condition checks for spell abilities.
spell_ability_predicates
Predicate functions for filtering spell abilities.
spell_ability_restriction
Activation restrictions for spell abilities.
spell_ability_stack_instance
SpellAbilityStackInstance – stack entry for spells/abilities. Mirrors Java’s SpellAbilityStackInstance.java. The core struct is StackEntry in crate::zone::magic_stack. This module re-exports it and provides additional query methods that mirror the Java API.
spell_ability_variables
Activation/condition variables for spell abilities.
spell_permanent
SpellPermanent – factory for permanent spells. Mirrors Java’s SpellPermanent.java. Creates SpellAbility instances configured as permanent spells (creatures and non-creatures) that resolve by moving to the battlefield.
target_choices
Target choices for spell abilities.
target_restrictions
Target restrictions for spell abilities.
trait_spell_ability
ISpellAbility trait – marker trait for spell abilities. Mirrors Java’s ISpellAbility.java.
valid_sa

Structs§

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

Traits§

TriggerKeyInput

Functions§

choose_targets_by_kind
has_split_second_on_stack
Check whether any spell on the stack has split second. Split second prevents players from casting spells or activating abilities (except mana abilities) while it’s on the stack. Single source of truth — used by spell, ability, and ability_activated modules.