This is a Rust crate to model Mana costs from Magic the Gathering cards. It can parse text representations of mana (e.g. {5}{U}{U/B}), sort mana costs and calculate mana values.
The types of mana supported by this library are:
- Generic mana
- Colorless mana
- Colored mana (including phyrexian)
- Hybrid mana (including generic, colorless and phyrexian)
- Snow mana
When sorting mana symbols in mana costs, this library uses an algorithm proposed by /u/Mean-Government1436 in a post on /r/custommagic. The developers of Magic the Gathering, Wizards of the Coast, have not given any official algorithm for sorting of mana symbols.
This crate has optional support to generate random mana symbols, using the cargo feature rand.
Graphical images used in this library, including mana symbols, is copyright Wizards of the Coast, LLC. This library is not produced by or endorsed by Wizards of the Coast.