pub struct SpellAbilityRestriction {
pub variables: SpellAbilityVariables,
}Expand description
Activation restrictions for a spell ability.
Mirrors Java’s SpellAbilityRestriction — wraps SpellAbilityVariables
and checks game state conditions to determine if activation is legal.
Fields§
§variables: SpellAbilityVariablesImplementations§
Source§impl SpellAbilityRestriction
impl SpellAbilityRestriction
Sourcepub fn set_restrictions(&mut self, params: &Params)
pub fn set_restrictions(&mut self, params: &Params)
Parse activation restrictions from ability params.
Mirrors Java’s SpellAbilityRestriction.setRestrictions(SpellAbility).
pub fn set_restrictions_parsed(&mut self, params: &ParsedParams<'_>)
Sourcepub fn can_play(
&self,
game: &GameState,
card_id: CardId,
player: PlayerId,
) -> bool
pub fn can_play( &self, game: &GameState, card_id: CardId, player: PlayerId, ) -> bool
Check if this spell ability can be played given the current game state.
Mirrors Java’s SpellAbilityRestriction.canPlay(Card, SpellAbility).
pub fn can_play_with_sa( &self, game: &GameState, card_id: CardId, player: PlayerId, sa: Option<&SpellAbility>, ) -> bool
Sourcepub fn check_zone_restrictions(&self, game: &GameState, card_id: CardId) -> bool
pub fn check_zone_restrictions(&self, game: &GameState, card_id: CardId) -> bool
Check zone restrictions only.
Mirrors Java’s SpellAbilityRestriction.checkZoneRestrictions(Card, SpellAbility).
Sourcepub fn check_timing_restrictions(
&self,
game: &GameState,
player: PlayerId,
) -> bool
pub fn check_timing_restrictions( &self, game: &GameState, player: PlayerId, ) -> bool
Check timing restrictions (phase, sorcery speed, etc.).
Mirrors Java’s SpellAbilityRestriction.checkTimingRestrictions(Card, SpellAbility).
Sourcepub fn check_activator_restrictions(
&self,
game: &GameState,
player: PlayerId,
) -> bool
pub fn check_activator_restrictions( &self, game: &GameState, player: PlayerId, ) -> bool
Check activator restrictions.
Mirrors Java’s SpellAbilityRestriction.checkActivatorRestrictions(Card, SpellAbility).
Sourcepub fn can_player_activate_host(
&self,
game: &GameState,
card_id: CardId,
player: PlayerId,
) -> bool
pub fn can_player_activate_host( &self, game: &GameState, card_id: CardId, player: PlayerId, ) -> bool
Whether player may activate an ability hosted by card_id.
Mirrors the common Java valid-player cases used by Activator$.
Sourcepub fn check_other_restrictions(
&self,
game: &GameState,
player: PlayerId,
) -> bool
pub fn check_other_restrictions( &self, game: &GameState, player: PlayerId, ) -> bool
Check other restrictions (threshold, metalcraft, etc.).
Mirrors Java’s SpellAbilityRestriction.checkOtherRestrictions(Card, SpellAbility).
Trait Implementations§
Source§impl Clone for SpellAbilityRestriction
impl Clone for SpellAbilityRestriction
Source§fn clone(&self) -> SpellAbilityRestriction
fn clone(&self) -> SpellAbilityRestriction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more