pub struct AttackRestriction {
pub attacker: CardId,
pub types: HashSet<AttackRestrictionType>,
pub cant_attack: bool,
pub cant_attack_defenders: Vec<DefenderId>,
}Expand description
Per-creature attack restriction state.
Mirrors Java’s AttackRestriction.java.
Fields§
§attacker: CardId§types: HashSet<AttackRestrictionType>§cant_attack: bool§cant_attack_defenders: Vec<DefenderId>Implementations§
Source§impl AttackRestriction
impl AttackRestriction
pub fn new( attacker: CardId, cards: &[Card], possible_defenders: &[DefenderId], game: &GameState, ) -> Self
Sourcepub fn can_attack(&self, defender: DefenderId) -> bool
pub fn can_attack(&self, defender: DefenderId) -> bool
Can this creature attack the given defender?
Sourcepub fn can_attack_with(
&self,
defender: DefenderId,
attackers: &[(CardId, DefenderId)],
cards: &[Card],
) -> bool
pub fn can_attack_with( &self, defender: DefenderId, attackers: &[(CardId, DefenderId)], cards: &[Card], ) -> bool
Can this creature attack the given defender with the given set of attackers? Checks both per-defender and per-attacker-set violations.
Sourcepub fn get_violations(
&self,
attackers: &[(CardId, DefenderId)],
cards: &[Card],
) -> HashSet<AttackRestrictionType>
pub fn get_violations( &self, attackers: &[(CardId, DefenderId)], cards: &[Card], ) -> HashSet<AttackRestrictionType>
Get restriction type violations for the given set of attackers.
pub fn get_types(&self) -> &HashSet<AttackRestrictionType>
Trait Implementations§
Source§impl Clone for AttackRestriction
impl Clone for AttackRestriction
Source§fn clone(&self) -> AttackRestriction
fn clone(&self) -> AttackRestriction
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 moreAuto Trait Implementations§
impl Freeze for AttackRestriction
impl RefUnwindSafe for AttackRestriction
impl Send for AttackRestriction
impl Sync for AttackRestriction
impl Unpin for AttackRestriction
impl UnsafeUnpin for AttackRestriction
impl UnwindSafe for AttackRestriction
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
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.