Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BorderColors = struct { White, Black, Silver BorderColor }{1, 2, 3}
The borders that cards have.
var Formats = struct { Standard, Extended, Modern, Vintage, Legacy, Un *Format List []*Format }{ &Format{standardSetLegal, "standard"}, &Format{extendedSetLegal, "extended"}, &Format{modernSetLegal, "modern"}, &Format{vintageSetLegal, "vintage"}, &Format{legacySetLegal, "legacy"}, &Format{unSet, "un"}, nil, }
The deck formats we know about. (Standard, Extended, Modern, etc.)
var ManaColors = struct { Colorless, White, Blue, Black, Red, Green ManaColor }{0, 1, 2, 4, 8, 16}
The colors of mana that exist in the Multiverse.
var Rarities = struct { Common, Uncommon, Rare, Mythic, Basic, Special Rarity }{1, 2, 3, 4, 5, 6}
Rarities of cards.
var SetTypes = struct { Core, Expansion, Reprint, Box, Un, FromTheVault, PremiumDeck, DuelDeck, Starter, Commander, Planechase, Archenemy SetType }{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
Set types.
var Sorts = struct { Name, Cmc Comparison }{ nameSort, cmcSort, }
Sorts are built-in sorts available for use.
var SuperTypes = struct { Basic, Elite, Legendary, Ongoing, Snow, World SuperType }{32, 16, 8, 4, 2, 1}
SuperType values.
var Types = struct { Artifact, Creature, Enchantment, Instant, Land, Planeswalker, Sorcery, Tribal Type }{128, 64, 32, 16, 8, 4, 2, 1}
Type values.
Functions ¶
This section is empty.
Types ¶
type BorderColor ¶
type BorderColor byte
BorderColor indicates the color of card borders within a Set.
type Card ¶
type Card struct { Name string Cmc float32 Cost string Colors ManaColor Supertypes SuperType Types Type Subtypes []string Text string Flavor string Artist string Number string Power, Toughness usuallyNumeric Loyalty int Rulings []Ruling Printings []Printing `json:"-"` Restricted, Banned []*Format // contains filtered or unexported fields }
Card is a Magic: The Gathering card, such as Ætherling or Blightning.
type CardList ¶
type CardList []*Card
func (*CardList) Sort ¶
func (c *CardList) Sort(f Comparison)
Sort the results based on the given comparison.
type Comparison ¶
Comparison takes two cards and determines which is less than the other. See: sort.Interface.Less.
func (Comparison) Asc ¶
func (c Comparison) Asc(a, b *Card) bool
Asc is a generated method that allows explicit specification that a sort will be ascending. It will follow the same sorting method as the base function.
func (Comparison) Desc ¶
func (c Comparison) Desc(a, b *Card) bool
Desc is a generated method that allows a sort to be reversed without needing to write a wrapper.
type Cond ¶
type Cond map[string]interface{}
Cond provides a way to search for non-builtin properties without resorting to a custom type.
type Format ¶
Format represents a sanctioned Magic the Gathering format.
func (*Format) MarshalJSON ¶
JsonEncode allows a Format to be saveed using the encoding/json package.
func (*Format) UnmarshalJSON ¶
JsonDecode allows a Format to be restored using the encoding/json package.
type Func ¶
Func is a generic type that allows a client to pass in any function that makes a boolean decision based on a card.
type ManaColor ¶
type ManaColor byte
ManaColor is a bitmask of possible Mana Colors.
type ManaType ¶
ManaType represents a single circle within a manacost. The MSB represents Phyrexian mana,
type Multiverse ¶
Multiverse is an entire Magic: The Gathering multiverse. It contains the available cards, sets, formats, and legality information, as well as ways to interpret, manipulate, and filter that data.
func Read ¶
func Read(r io.Reader) (m Multiverse, err error)
Read the multiverse from the provided reader.
func (Multiverse) FuzzyNameSearch ¶
func (m Multiverse) FuzzyNameSearch(searchPhrase string, count int) CardList
FuzzyNameSearch searches for a card with a similar name to the searchPhrase, and returns count or less of the most likely results.
func (Multiverse) Loaded ¶
func (m Multiverse) Loaded() bool
func (Multiverse) Search ¶
func (m Multiverse) Search(f Filter) (CardList, error)
Search for cards that match the given conditions.
func (Multiverse) Write ¶
func (m Multiverse) Write(w io.Writer) error
Write the multiverse to the provided writer.
func (Multiverse) WriteCompressLevel ¶
func (m Multiverse) WriteCompressLevel(w io.Writer, compressionLevel int) error
WriteCompressLevel writes the multiverse to the provided writer with the given level of compression.
type MultiverseID ¶
type MultiverseID int32
MultiverseID is a unique ID for a single printing of a card.
type Or ¶
type Or []Filter
Or allows us to search for multiple conditions that at least one of must be true. Performs short-circuit evaluation.
type Printing ¶
type Printing struct { ID MultiverseID Set *Set Rarity Rarity }
Printing represents a specific printing of a card, Cancel from M10 is different from Cancel from M11.
type Ruling ¶
Ruling is a ruling made by a judge that can clarify difficult situations that may arise.
type Set ¶
type Set struct { Name string Code string Released time.Time Border BorderColor Type SetType Block string Cards []MultiverseID // contains filtered or unexported fields }
Set is a Magic: The Gathering set, such as Innistrad or Zendikar.