Skip to main content

AbilityManaPart

Struct AbilityManaPart 

Source
pub struct AbilityManaPart { /* private fields */ }
Expand description

Mana-producing component of a spell ability. Mirrors Java’s AbilityManaPart — stores the produced mana string, restrictions on how it can be spent, and associated effects.

Implementations§

Source§

impl AbilityManaPart

Source

pub fn new(produced: &str, restrictions: &str) -> Self

Create a new mana part with the given production and restrictions. Mirrors Java’s AbilityManaPart(SpellAbility, String, String).

Source

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

Check if this ability can produce the given color of mana. Mirrors Java’s AbilityManaPart.canProduce(String). Returns true if the color string is found within orig_produced, or if orig_produced is “Any”.

Source

pub fn get_orig_produced(&self) -> &str

Get the original mana production string. Mirrors Java’s AbilityManaPart.getOrigProduced().

Source

pub fn can_this_produce(&self) -> bool

Whether this ability can produce any mana at all. Mirrors Java’s AbilityManaPart.canThisProduce().

Source

pub fn amount_of_mana_generated(&self) -> i32

Count the number of individual mana generated. Mirrors Java’s AbilityManaPart.amountOfManaGenerated(SpellAbility). Each space-separated token in orig_produced counts as one mana.

Source

pub fn total_amount_of_mana_generated(&self) -> i32

Total amount of mana generated, counting “All” and “Any” as 1 each. Mirrors Java’s AbilityManaPart.totalAmountOfManaGenerated(SpellAbility).

Source

pub fn mana_restrictions(&self) -> &str

Get the mana restrictions string.

Source

pub fn set_adds_keywords(&mut self, keywords: Option<String>)

Set keywords to add to spells cast with this mana.

Source

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

Get keywords added by this mana.

Source

pub fn set_triggers_when_spent(&mut self, trigger: Option<String>)

Set the trigger that fires when this mana is spent.

Source

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

Get the trigger that fires when this mana is spent.

Source

pub fn is_persistent_mana(&self) -> bool

Whether this mana persists between phases.

Source

pub fn set_persistent_mana(&mut self, val: bool)

Set whether this mana persists between phases.

Source

pub fn is_combat_mana(&self) -> bool

Whether this mana can only be spent during combat.

Source

pub fn set_combat_mana(&mut self, val: bool)

Set whether this mana can only be spent during combat.

Source

pub fn last_express_choice(&self) -> &str

Get last express choice for mana generation.

Source

pub fn set_last_express_choice(&mut self, choice: String)

Set last express choice for mana generation.

Source

pub fn clear_express_choice(&mut self)

Clear express choice for mana generation. Mirrors Java’s AbilityManaPart.clearExpressChoice().

Source

pub fn produce_mana(&self) -> &str

Produce mana into the mana pool. Mirrors Java’s AbilityManaPart.produceMana(String, Player, SpellAbility). Returns the produced mana string for the pool to consume.

Source

pub fn taps_for_mana(&self) -> bool

Whether this ability taps the source for mana. Mirrors Java’s AbilityManaPart.tapsForMana().

Source

pub fn cannot_counter_paid_with(&self) -> bool

Whether the mana produced cannot be countered when paid with. Mirrors Java’s AbilityManaPart.cannotCounterPaidWith().

Source

pub fn add_no_counter_effect(&mut self)

Add a no-counter effect to the mana restrictions. Mirrors Java’s AbilityManaPart.addNoCounterEffect().

Source

pub fn add_keywords(&mut self, keywords: &str)

Add keywords to spells cast with this mana. Mirrors Java’s AbilityManaPart.addKeywords().

Source

pub fn adds_counters(&self) -> bool

Whether this mana adds counters to the spell. Mirrors Java’s AbilityManaPart.addsCounters().

Source

pub fn create_etb_counters(&self) -> bool

Create ETB counters for the spell cast with this mana. Mirrors Java’s AbilityManaPart.createETBCounters().

Source

pub fn add_triggers_when_spent(&mut self, trigger: &str)

Add a trigger that fires when this mana is spent. Mirrors Java’s AbilityManaPart.addTriggersWhenSpent().

Source

pub fn meets_mana_restrictions(&self, restriction: &str) -> bool

Check if this mana meets the given mana restrictions. Mirrors Java’s AbilityManaPart.meetsManaRestrictions(SpellAbility).

Source

pub fn meets_mana_shard_restrictions(&self) -> bool

Check if this mana meets mana shard restrictions. Mirrors Java’s AbilityManaPart.meetsManaShardRestrictions().

Source

pub fn meets_spell_and_shard_restrictions(&self) -> bool

Check if this mana meets both spell and shard restrictions. Mirrors Java’s AbilityManaPart.meetsSpellAndShardRestrictions(SpellAbility).

Source

pub fn mana(&self) -> &str

Get the mana representation for pool tracking. Mirrors Java’s AbilityManaPart.mana().

Trait Implementations§

Source§

impl Clone for AbilityManaPart

Source§

fn clone(&self) -> AbilityManaPart

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 AbilityManaPart

Source§

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

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

impl<'de> Deserialize<'de> for AbilityManaPart

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 Serialize for AbilityManaPart

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, 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