1
1
import { ScryfallObject } from "../Object" ;
2
- import { ScryfallCardLayout } from "./values/CardLayout " ;
2
+ import { ScryfallLayout , ScryfallLayoutGroup } from "./values" ;
3
3
import { ScryfallCardFace } from "./CardFace" ;
4
4
import { ScryfallCardFields } from "./CardFields" ;
5
5
6
- type LayoutType < T extends ScryfallCardLayout > = Pick < ScryfallCardFields . Core . All , "layout" > & {
6
+ type Layout < T extends ScryfallLayout > = Pick < ScryfallCardFields . Core . All , "layout" > & {
7
7
layout : T | `${T } `;
8
8
} ;
9
9
10
+ /**
11
+ *
12
+ */
10
13
export namespace ScryfallCard {
14
+ /** The abstract root implementation of cards. */
11
15
export type AbstractCard = ScryfallObject . Object < ScryfallObject . ObjectType . Card > & ScryfallCardFields . Core . All ;
12
16
13
17
type SingleFace = AbstractCard &
18
+ Layout < ScryfallLayoutGroup . SingleFaceType > &
14
19
ScryfallCardFields . Gameplay . RootProperties &
15
20
ScryfallCardFields . Gameplay . CardSpecific &
16
21
ScryfallCardFields . Gameplay . CardFaceSpecific &
@@ -22,73 +27,96 @@ export namespace ScryfallCard {
22
27
ScryfallCardFields . Print . CardFaceSpecific ;
23
28
24
29
type MultiFace < T extends ScryfallCardFace . AbstractCardFace > = AbstractCard &
30
+ Layout < ScryfallLayoutGroup . MultiFaceType > &
25
31
ScryfallCardFields . Gameplay . RootProperties &
26
32
ScryfallCardFields . Gameplay . CardSpecific &
27
33
ScryfallCardFields . Gameplay . CardFaces < T > &
28
34
ScryfallCardFields . Print . RootProperties &
29
35
ScryfallCardFields . Print . CardSpecific ;
30
36
31
37
type SingleSidedSplit = MultiFace < ScryfallCardFace . Split > &
38
+ Layout < ScryfallLayoutGroup . SingleSidedSplitType > &
32
39
ScryfallCardFields . Gameplay . CardSideSpecific &
33
40
ScryfallCardFields . Print . CardSideSpecific &
34
41
ScryfallCardFields . Print . SingleSideOnly ;
35
42
36
- type DoubleSidedSplit = MultiFace < ScryfallCardFace . DoubleSided > ;
43
+ type DoubleSidedSplit = MultiFace < ScryfallCardFace . DoubleSided > & Layout < ScryfallLayoutGroup . DoubleSidedSplitType > ;
37
44
38
45
type AlwaysOversized = {
39
46
oversized : true ;
40
47
} ;
41
48
42
- export type Normal = LayoutType < ScryfallCardLayout . Normal > & SingleFace ;
49
+ /** A card with the Normal layout. */
50
+ export type Normal = Layout < ScryfallLayout . Normal > & SingleFace ;
43
51
44
- export type Split = LayoutType < ScryfallCardLayout . Split > & SingleSidedSplit ;
52
+ /** A card with the Meld layout. */
53
+ export type Meld = Layout < ScryfallLayout . Meld > & SingleFace ;
45
54
46
- export type Flip = LayoutType < ScryfallCardLayout . Flip > & SingleSidedSplit & ScryfallCardFields . Gameplay . CombatStats ;
55
+ /** A card with the Leveler layout. */
56
+ export type Leveler = Layout < ScryfallLayout . Leveler > & SingleFace ;
47
57
48
- export type Transform = LayoutType < ScryfallCardLayout . Transform > & DoubleSidedSplit ;
58
+ /** A card with the Class layout. */
59
+ export type Class = Layout < ScryfallLayout . Class > & SingleFace ;
49
60
50
- export type ModalDfc = LayoutType < ScryfallCardLayout . ModalDfc > & DoubleSidedSplit ;
61
+ /** A card with the Saga layout. */
62
+ export type Saga = Layout < ScryfallLayout . Saga > & SingleFace ;
51
63
52
- export type Meld = LayoutType < ScryfallCardLayout . Meld > & SingleFace ;
64
+ /** A card with the Mutate layout. */
65
+ export type Mutate = Layout < ScryfallLayout . Mutate > & SingleFace ;
53
66
54
- export type Leveler = LayoutType < ScryfallCardLayout . Leveler > & SingleFace ;
67
+ /** A card with the Prototype layout. */
68
+ export type Prototype = Layout < ScryfallLayout . Prototype > & SingleFace ;
55
69
56
- export type Class = LayoutType < ScryfallCardLayout . Class > & SingleFace ;
70
+ /** A card with the Battle layout. */
71
+ export type Battle = Layout < ScryfallLayout . Battle > & SingleFace ;
57
72
58
- export type Saga = LayoutType < ScryfallCardLayout . Saga > & SingleFace ;
73
+ /** A card with the Planar layout. */
74
+ export type Planar = Layout < ScryfallLayout . Planar > & SingleFace & AlwaysOversized ;
59
75
60
- export type Adventure = LayoutType < ScryfallCardLayout . Adventure > &
61
- SingleSidedSplit &
62
- ScryfallCardFields . Gameplay . CombatStats ;
76
+ /** A card with the Scheme layout. */
77
+ export type Scheme = Layout < ScryfallLayout . Scheme > & SingleFace & AlwaysOversized ;
63
78
64
- export type Mutate = LayoutType < ScryfallCardLayout . Mutate > & SingleFace ;
79
+ /** A card with the Vanguard layout. */
80
+ export type Vanguard = Layout < ScryfallLayout . Vanguard > &
81
+ SingleFace &
82
+ ScryfallCardFields . Gameplay . VanguardStats &
83
+ ScryfallCardFields . Gameplay . NoCombatStats ;
65
84
66
- export type Prototype = LayoutType < ScryfallCardLayout . Prototype > & SingleFace ;
85
+ /** A card with the Token layout. */
86
+ export type Token = Layout < ScryfallLayout . Token > & SingleFace ;
67
87
68
- export type Battle = LayoutType < ScryfallCardLayout . Battle > & SingleFace ;
88
+ /** A card with the Emblem layout. */
89
+ export type Emblem = Layout < ScryfallLayout . Emblem > & SingleFace ;
69
90
70
- export type Planar = LayoutType < ScryfallCardLayout . Planar > & SingleFace & AlwaysOversized ;
91
+ /** A card with the Augment layout. */
92
+ export type Augment = Layout < ScryfallLayout . Augment > & SingleFace ;
71
93
72
- export type Scheme = LayoutType < ScryfallCardLayout . Scheme > & SingleFace & AlwaysOversized ;
94
+ /** A card with the Host layout. */
95
+ export type Host = Layout < ScryfallLayout . Host > & SingleFace ;
73
96
74
- export type Vanguard = LayoutType < ScryfallCardLayout . Vanguard > &
75
- SingleFace &
76
- ScryfallCardFields . Gameplay . VanguardStats &
77
- ScryfallCardFields . Gameplay . NoCombatStats ;
97
+ /** A card with the Split layout. */
98
+ export type Split = Layout < ScryfallLayout . Split > & SingleSidedSplit ;
78
99
79
- export type Token = LayoutType < ScryfallCardLayout . Token > & SingleFace ;
100
+ /** A card with the Flip layout. */
101
+ export type Flip = Layout < ScryfallLayout . Flip > & SingleSidedSplit & ScryfallCardFields . Gameplay . CombatStats ;
80
102
81
- export type DoubleFacedToken = LayoutType < ScryfallCardLayout . DoubleFacedToken > & DoubleSidedSplit ;
103
+ /** A card with the Adventure layout. */
104
+ export type Adventure = Layout < ScryfallLayout . Adventure > & SingleSidedSplit & ScryfallCardFields . Gameplay . CombatStats ;
82
105
83
- export type Emblem = LayoutType < ScryfallCardLayout . Emblem > & SingleFace ;
106
+ /** A card with the Transform layout. */
107
+ export type Transform = Layout < ScryfallLayout . Transform > & DoubleSidedSplit ;
84
108
85
- export type Augment = LayoutType < ScryfallCardLayout . Augment > & SingleFace ;
109
+ /** A card with the ModalDfc layout. */
110
+ export type ModalDfc = Layout < ScryfallLayout . ModalDfc > & DoubleSidedSplit ;
86
111
87
- export type Host = LayoutType < ScryfallCardLayout . Host > & SingleFace ;
112
+ /** A card with the DoubleFacedToken layout. */
113
+ export type DoubleFacedToken = Layout < ScryfallLayout . DoubleFacedToken > & DoubleSidedSplit ;
88
114
89
- export type ArtSeries = LayoutType < ScryfallCardLayout . ArtSeries > & DoubleSidedSplit ;
115
+ /** A card with the ArtSeries layout. */
116
+ export type ArtSeries = Layout < ScryfallLayout . ArtSeries > & DoubleSidedSplit ;
90
117
91
- export type ReversibleCard = LayoutType < ScryfallCardLayout . ReversibleCard > &
118
+ /** A card with the ReversibleCard layout. */
119
+ export type ReversibleCard = Layout < ScryfallLayout . ReversibleCard > &
92
120
Omit < AbstractCard , "oracle_id" > &
93
121
ScryfallCardFields . Gameplay . RootProperties &
94
122
Omit < ScryfallCardFields . Gameplay . CardSpecific , "type_line" | "cmc" > &
@@ -98,26 +126,56 @@ export namespace ScryfallCard {
98
126
99
127
export type Any =
100
128
| Normal
101
- | Split
102
- | Flip
103
- | Transform
104
- | ModalDfc
105
129
| Meld
106
130
| Leveler
107
131
| Class
108
132
| Saga
109
- | Adventure
110
133
| Mutate
111
134
| Prototype
112
135
| Battle
113
136
| Planar
114
137
| Scheme
115
138
| Vanguard
116
139
| Token
117
- | DoubleFacedToken
118
140
| Emblem
119
141
| Augment
120
142
| Host
143
+ | Split
144
+ | Flip
145
+ | Adventure
146
+ | Transform
147
+ | ModalDfc
148
+ | DoubleFacedToken
121
149
| ArtSeries
122
150
| ReversibleCard ;
151
+
152
+ /**
153
+ * Any card with a single-faced layout. These all have a .
154
+ *
155
+ * Examples: {@link Normal}, {@link Mutate}, {@link Token}.
156
+ */
157
+ export type AnySingleFaced = Any & Layout < ScryfallLayoutGroup . SingleFaceType > ;
158
+
159
+ /**
160
+ * Any multi-faced layout, which is any that would have a `card_faces` field.
161
+ *
162
+ * @see {@link AnySingleSidedSplit } is in this group.
163
+ * @see {@link AnyDoubleSidedSplit } is in this group.
164
+ * @see {@link ReversibleCard } is in this group.
165
+ */
166
+ export type AnyMultiFaced = Any & Layout < ScryfallLayoutGroup . MultiFaceType > ;
167
+
168
+ /**
169
+ * Any single-sided split card. These all have `card_faces`, and the faces are both on the front.
170
+ *
171
+ * Examples: {@link Split}, {@link Flip}, {@link Adventure}.
172
+ */
173
+ export type AnySingleSidedSplit = Any & Layout < ScryfallLayoutGroup . SingleSidedSplitType > ;
174
+
175
+ /**
176
+ * Any double-sided split card. These all have `card_faces`, and the faces are on the obverse and reverse of the card.
177
+ *
178
+ * Examples: {@link Transform}, {@link ModalDfc}, {@link DoubleFacedToken}.
179
+ */
180
+ export type AnyDoubleSidedSplit = Any & Layout < ScryfallLayoutGroup . DoubleSidedSplitType > ;
123
181
}
0 commit comments