pub struct StaticAbility {
pub base: Box<CardTraitBase>,
pub modes: Vec<StaticMode>,
pub ignore_effect_cards: Vec<CardId>,
pub ignore_effect_players: Vec<PlayerId>,
pub may_play_turn: i32,
pub svars: HashMap<String, String>,
pub ir: StaticAbilityIr,
}Expand description
A parsed static ability from an S$ line in a card script.
Params are stored exactly as they appear in the script so that new param types can be added without changing this struct.
Fields§
§base: Box<CardTraitBase>§modes: Vec<StaticMode>§ignore_effect_cards: Vec<CardId>§ignore_effect_players: Vec<PlayerId>§may_play_turn: i32§svars: HashMap<String, String>Mirrors CardTraitBase.sVars in Java. Populated by the card factory
with the host card’s SVar map so that $-expressions evaluated under
the ability resolve against the card’s SVars (not the ability’s
mapParams).
ir: StaticAbilityIrImplementations§
Source§impl StaticAbility
impl StaticAbility
pub fn check_mode(&self, mode: &StaticMode) -> bool
pub fn unknown_modes(&self) -> impl Iterator<Item = &str>
Sourcepub fn parsed_but_unimplemented_modes(
&self,
) -> impl Iterator<Item = &StaticMode>
pub fn parsed_but_unimplemented_modes( &self, ) -> impl Iterator<Item = &StaticMode>
Modes that parse with Java parity but do not yet have a Rust runtime
implementation. This keeps them distinct from Other, which means the
parser has not recognised the Java mode at all.
pub fn zones_check(&self, source_zone: ZoneType) -> bool
pub fn check_conditions(&self, source: &Card, game: &GameState) -> bool
pub fn check_conditions_full( &self, mode: &StaticMode, source: &Card, game: &GameState, ) -> bool
pub fn is_active_for(&self, mode: StaticMode, source_zone: ZoneType) -> bool
pub fn add_ignore_effect_players(&mut self, player: PlayerId)
pub fn clear_ignore_effects(&mut self)
pub fn inc_may_play_turn(&mut self)
pub fn reset_may_play_turn(&mut self)
pub fn copy(&self) -> Self
Trait Implementations§
Source§impl CardTrait for StaticAbility
impl CardTrait for StaticAbility
Source§fn base(&self) -> &CardTraitBase
fn base(&self) -> &CardTraitBase
Borrow the underlying
CardTraitBase. Implementors own a
CardTraitBase (directly or transitively) and return a reference.Source§fn resolve_source_player(&self, src_card: &Card) -> PlayerId
fn resolve_source_player(&self, src_card: &Card) -> PlayerId
Resolves the player whose perspective is used for
Valid$ expressions.
Default matches Java’s base behavior (source card’s controller).
Trigger overrides — mirrors this instanceof Trigger in Java
CardTraitBase.matchesValid(Object, String[], Card) at line 214.Source§fn matches_valid(
&self,
target: &MatchValidTarget<'_>,
valids: &[&str],
src_card: Option<&Card>,
) -> bool
fn matches_valid( &self, target: &MatchValidTarget<'_>, valids: &[&str], src_card: Option<&Card>, ) -> bool
Mirrors
matchesValid(Object, String[], Card).fn matches_compiled_valid( &self, target: &MatchValidTarget<'_>, selector: &CompiledSelector, src_card: Option<&Card>, ) -> bool
fn matches_valid_param( &self, param: &str, target: &MatchValidTarget<'_>, src_card: Option<&Card>, ) -> bool
Source§fn matches_valid_card(&self, expr: &str, card: &Card, source: &Card) -> bool
fn matches_valid_card(&self, expr: &str, card: &Card, source: &Card) -> bool
Ergonomic comma-separated-expression wrapper over
matches_valid for
card targets. Mirrors Java’s matchesValid(Object, String[], Card)
call pattern where valids is often a single comma-separated string
(e.g. "Creature.YouCtrl,Artifact").fn matches_compiled_valid_card( &self, selector: &CompiledSelector, card: &Card, source: &Card, ) -> bool
Source§fn matches_valid_player(
&self,
expr: &str,
player: PlayerId,
source: &Card,
) -> bool
fn matches_valid_player( &self, expr: &str, player: PlayerId, source: &Card, ) -> bool
Ergonomic comma-separated-expression wrapper over
matches_valid for
player targets.fn matches_compiled_valid_player( &self, selector: &CompiledSelector, player: PlayerId, source: &Card, ) -> bool
Source§impl CardTraitIrOwner for StaticAbility
impl CardTraitIrOwner for StaticAbility
type Ir = StaticAbilityIr
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 StaticAbility
impl Clone for StaticAbility
Source§fn clone(&self) -> StaticAbility
fn clone(&self) -> StaticAbility
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StaticAbility
impl Debug for StaticAbility
Source§impl<'de> Deserialize<'de> for StaticAbility
impl<'de> Deserialize<'de> for StaticAbility
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl HasSVars for StaticAbility
impl HasSVars for StaticAbility
fn get_svar(&self, name: &str) -> Option<&str>
fn set_svar(&mut self, name: String, value: String)
fn set_svars(&mut self, new_svars: HashMap<String, String>)
fn get_svars(&self) -> &HashMap<String, String>
fn remove_svar(&mut self, var: &str)
fn has_svar(&self, name: &str) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for StaticAbility
impl !UnwindSafe for StaticAbility
impl Freeze for StaticAbility
impl Send for StaticAbility
impl Sync for StaticAbility
impl Unpin for StaticAbility
impl UnsafeUnpin for StaticAbility
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.