pub struct ManaConversionMatrix { /* private fields */ }Expand description
Mana conversion/restriction matrix controlling what colors can pay for what.
Mirrors Java’s forge.game.mana.ManaConversionMatrix.
The conversion matrix ORs byte values to make mana more payable (additive). The restriction matrix ANDs byte values to make mana less payable (restrictive).
Implementations§
Source§impl ManaConversionMatrix
impl ManaConversionMatrix
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new matrix with identity conversion and no restrictions.
Mirrors Java’s constructor which calls restoreColorReplacements().
Sourcepub fn get_possible_color_uses(&self, color: u8) -> u8
pub fn get_possible_color_uses(&self, color: u8) -> u8
Get the effective color uses for a given color after applying conversion and restriction.
Mirrors Java’s ManaConversionMatrix.getPossibleColorUses().
Sourcepub fn adjust_color_replacement(
&mut self,
original: u8,
replacement: u8,
additive: bool,
)
pub fn adjust_color_replacement( &mut self, original: u8, replacement: u8, additive: bool, )
Adjust color replacement: additive ORs into conversion, restrictive ANDs into restriction.
Mirrors Java’s ManaConversionMatrix.adjustColorReplacement().
Sourcepub fn apply_card_matrix(&mut self, other: &ManaConversionMatrix)
pub fn apply_card_matrix(&mut self, other: &ManaConversionMatrix)
Merge another matrix into this one: OR conversion, AND restriction.
Mirrors Java’s ManaConversionMatrix.applyCardMatrix().
Sourcepub fn restore_color_replacements(&mut self)
pub fn restore_color_replacements(&mut self)
Reset to identity: each color pays only itself, no restrictions.
Mirrors Java’s ManaConversionMatrix.restoreColorReplacements().
Sourcepub fn is_snow_for_color(&self) -> bool
pub fn is_snow_for_color(&self) -> bool
Whether snow mana can substitute for colored mana.
Mirrors Java’s ManaConversionMatrix.isSnowForColor().
Sourcepub fn set_snow_for_color(&mut self, value: bool)
pub fn set_snow_for_color(&mut self, value: bool)
Set whether snow mana can substitute for colored mana.
Mirrors Java’s ManaConversionMatrix.setSnowForColor().
Trait Implementations§
Source§impl Clone for ManaConversionMatrix
impl Clone for ManaConversionMatrix
Source§fn clone(&self) -> ManaConversionMatrix
fn clone(&self) -> ManaConversionMatrix
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more