-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
104 lines (80 loc) · 2.12 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package multiverse
import (
"time"
)
// ManaColor is a bitmask of possible Mana Colors.
type ManaColor byte
// BorderColor indicates the color of card borders within a Set.
type BorderColor byte
// Rarity of a card for a specific printing.
type Rarity byte
// MultiverseID is a unique ID for a single printing of a card.
type MultiverseID int32
// SetType indicates the various set types.
type SetType byte
// SuperType indicates the various SuperTypes.
type SuperType byte
// Type indicates the various Types.
type Type byte
// Printing represents a specific printing of a card, Cancel from M10 is different from Cancel from M11.
type Printing struct {
ID MultiverseID
Set *Set
Rarity Rarity
}
// Ruling is a ruling made by a judge that can clarify difficult situations that may arise.
type Ruling struct {
Date time.Time
Text string
}
// 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.
type Multiverse struct {
Sets []Set
Cards []Card
Modified time.Time
}
// Set is a Magic: The Gathering set, such as Innistrad or Zendikar.
type Set struct {
Name string
Code string
Released time.Time
Border BorderColor
Type SetType
Block string
Cards []MultiverseID
standardLegal bool
extendedLegal bool
}
// Card is a Magic: The Gathering card, such as Ætherling or Blightning.
type Card struct {
Name string
ascii string
metaphones []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
}
type usuallyNumeric struct {
Val float32
Original string
}
func (c *Card) Is(f Filter) bool {
ok, err := f.Ok(c)
return ok && err == nil
}
func (s SetType) isTournamentLegal() bool {
return s == SetTypes.Expansion || s == SetTypes.Core
}