Skip to content

Commit f38c41d

Browse files
authored
Merge pull request #33 from seansfkelley/gamechanger-and-legalities
Update formats/legalities, set type, game changer, Symbol.
2 parents c56f36d + 4be503b commit f38c41d

9 files changed

Lines changed: 97 additions & 11 deletions

File tree

Sources/ScryfallKit/Extensions/Card+helpers.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ extension Card {
3434
return legalities.penny ?? .notLegal
3535
case .commander:
3636
return legalities.commander ?? .notLegal
37+
case .future:
38+
return legalities.future ?? .notLegal
39+
case .timeless:
40+
return legalities.timeless ?? .notLegal
41+
case .gladiator:
42+
return legalities.gladiator ?? .notLegal
43+
case .oathbreaker:
44+
return legalities.oathbreaker ?? .notLegal
45+
case .standardbrawl:
46+
return legalities.standardbrawl ?? .notLegal
47+
case .alchemy:
48+
return legalities.alchemy ?? .notLegal
49+
case .paupercommander:
50+
return legalities.paupercommander ?? .notLegal
51+
case .duel:
52+
return legalities.duel ?? .notLegal
53+
case .oldschool:
54+
return legalities.oldschool ?? .notLegal
55+
case .premodern:
56+
return legalities.premodern ?? .notLegal
57+
case .predh:
58+
return legalities.predh ?? .notLegal
3759
}
3860
}
3961

Sources/ScryfallKit/Models/Card/Card+Face.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ extension Card {
2323
public var colorIndicator: [Card.Color]?
2424
/// An array of the colors in this card's mana cost
2525
public var colors: [Card.Color]?
26+
/// This face's defense, if any
27+
public var defense: String?
2628
/// This card's flavor text if any
2729
public var flavorText: String?
2830
/// An ID for this card face's art that remains consistent across reprints
@@ -61,6 +63,7 @@ extension Card {
6163
artist: String? = nil,
6264
colorIndicator: [Card.Color]? = nil,
6365
colors: [Card.Color]? = nil,
66+
defense: String? = nil,
6467
flavorText: String? = nil,
6568
illustrationId: UUID? = nil,
6669
imageUris: ImageUris? = nil,
@@ -79,6 +82,7 @@ extension Card {
7982
self.artist = artist
8083
self.colorIndicator = colorIndicator
8184
self.colors = colors
85+
self.defense = defense
8286
self.flavorText = flavorText
8387
self.illustrationId = illustrationId
8488
self.imageUris = imageUris

Sources/ScryfallKit/Models/Card/Card+Legalities.swift

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ extension Card {
1717
public let penny: Legality?
1818
public let commander: Legality?
1919
public let brawl: Legality?
20+
public let future: Legality?
21+
public let timeless: Legality?
22+
public let gladiator: Legality?
23+
public let oathbreaker: Legality?
24+
public let standardbrawl: Legality?
25+
public let alchemy: Legality?
26+
public let paupercommander: Legality?
27+
public let duel: Legality?
28+
public let oldschool: Legality?
29+
public let premodern: Legality?
30+
public let predh: Legality?
2031

2132
public init(
2233
standard: Legality?,
@@ -28,7 +39,18 @@ extension Card {
2839
vintage: Legality?,
2940
penny: Legality?,
3041
commander: Legality?,
31-
brawl: Legality?
42+
brawl: Legality?,
43+
future: Legality?,
44+
timeless: Legality?,
45+
gladiator: Legality?,
46+
oathbreaker: Legality?,
47+
standardbrawl: Legality?,
48+
alchemy: Legality?,
49+
paupercommander: Legality?,
50+
duel: Legality?,
51+
oldschool: Legality?,
52+
premodern: Legality?,
53+
predh: Legality?,
3254
) {
3355
self.standard = standard
3456
self.historic = historic
@@ -40,6 +62,17 @@ extension Card {
4062
self.penny = penny
4163
self.commander = commander
4264
self.brawl = brawl
65+
self.future = future
66+
self.timeless = timeless
67+
self.gladiator = gladiator
68+
self.oathbreaker = oathbreaker
69+
self.standardbrawl = standardbrawl
70+
self.alchemy = alchemy
71+
self.paupercommander = paupercommander
72+
self.duel = duel
73+
self.oldschool = oldschool
74+
self.premodern = premodern
75+
self.predh = predh
4376
}
4477
}
4578
}

Sources/ScryfallKit/Models/Card/Card+Symbol.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ extension Card {
2929
public var funny: Bool
3030
/// The colors that make up this symbol
3131
public var colors: [Color]
32+
/// True if the symbol is a hybrid mana symbol. Note that monocolor Phyrexian symbols aren’t considered hybrid.
33+
public var hybrid: Bool
34+
/// True if the symbol is a Phyrexian mana symbol, i.e. it can be paid with 2 life.
35+
public var phyrexian: Bool
3236
/// Alternate notations for this symbol that used on Wizards of the Coast's [Gatherer](https://gatherer.wizards.com/Pages/Default.aspx)
3337
public var gathererAlternates: [String]?
3438
/// A link to an SVG of this symbol
3539
public var svgUri: String?
40+
3641

3742
/// A computed ID for this symbol which is just the `symbol` property
3843
public var id: String { symbol }
@@ -47,6 +52,8 @@ extension Card {
4752
appearsInManaCosts: Bool,
4853
funny: Bool,
4954
colors: [Color],
55+
hybrid: Bool,
56+
phyrexian: Bool,
5057
gathererAlternates: [String]? = nil,
5158
svgUri: String? = nil
5259
) {
@@ -59,6 +66,8 @@ extension Card {
5966
self.appearsInManaCosts = appearsInManaCosts
6067
self.funny = funny
6168
self.colors = colors
69+
self.hybrid = hybrid
70+
self.phyrexian = phyrexian
6271
self.gathererAlternates = gathererAlternates
6372
self.svgUri = svgUri
6473
}

Sources/ScryfallKit/Models/Card/Card.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ public struct Card: Codable, Identifiable, Hashable, Sendable {
5959
public var colorIndicator: [Color]?
6060
/// An array of the colors in this card's mana cost
6161
public var colors: [Color]?
62+
/// This card's defense, if any
63+
public var defense: String?
6264
/// This card’s overall rank/popularity on EDHREC. Not all cards are ranked.
6365
public var edhrecRank: Int?
66+
/// True if this card is on the [Commander Game Changer list](https://mtg.wiki/page/Game_Changers).
67+
public var gameChanger: Bool?
6468
/// This card’s hand modifier, if it is Vanguard card. This value will contain a delta, such as -1.
6569
public var handModifier: String?
6670
/// An array of the keywords on this card (deathouch, first strike, etc)
@@ -206,7 +210,9 @@ public struct Card: Codable, Identifiable, Hashable, Sendable {
206210
colorIdentity: [Color],
207211
colorIndicator: [Color]? = nil,
208212
colors: [Color]? = nil,
213+
defense: String? = nil,
209214
edhrecRank: Int? = nil,
215+
gameChanger: Bool? = nil,
210216
handModifier: String? = nil,
211217
keywords: [String],
212218
layout: Layout,
@@ -284,7 +290,9 @@ public struct Card: Codable, Identifiable, Hashable, Sendable {
284290
self.colorIdentity = colorIdentity
285291
self.colorIndicator = colorIndicator
286292
self.colors = colors
293+
self.defense = defense
287294
self.edhrecRank = edhrecRank
295+
self.gameChanger = gameChanger
288296
self.handModifier = handModifier
289297
self.keywords = keywords
290298
self.layout = layout

Sources/ScryfallKit/Models/Catalog.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@ import Foundation
99
/// [Scryfall documentation](https://scryfall.com/docs/api/catalogs)
1010
public struct Catalog: Codable, Sendable {
1111
/// The catalog type. Each of these types represents a different `/catalogs` endpoint
12-
public enum `Type`: String, Codable, CaseIterable {
13-
case powers, toughnesses, loyalties, watermarks
12+
public enum `Type`: String, Codable, CaseIterable, Sendable {
1413
case cardNames = "card-names"
1514
case artistNames = "artist-names"
1615
case wordBank = "word-bank"
17-
case creatureTypes = "creature-types"
18-
case planeswalkerTypes = "planeswalker-types"
19-
case landTypes = "land-types"
16+
case supertypes
17+
case cardTypes = "card-types"
2018
case artifactTypes = "artifact-types"
19+
case battleTypes = "battle-types"
20+
case creatureTypes = "creature-types"
2121
case enchantmentTypes = "enchantment-types"
22+
case landTypes = "land-types"
23+
case planeswalkerTypes = "planeswalker-types"
2224
case spellTypes = "spell-types"
25+
case powers, toughnesses, loyalties
2326
case keywordAbilities = "keyword-abilities"
2427
case keywordActions = "keyword-actions"
2528
case abilityWords = "ability-words"
29+
case flavorWords = "flavor-words"
30+
case watermarks
2631
}
2732

2833
/// The number of items in the `data` array

Sources/ScryfallKit/Models/Enums.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66

77
/// Environments to play Magic: The Gathering in
88
public enum Game: String, Codable, CaseIterable, Sendable {
9-
case paper, mtgo, arena
9+
case paper, mtgo, arena, astral, sega
1010
}
1111

1212
/// Comparison strategies for determining what makes a card "unique"
@@ -20,7 +20,7 @@ public enum UniqueMode: String, Codable, CaseIterable, Sendable {
2020
///
2121
/// [Scryfall documentation](https://scryfall.com/docs/api/cards/search#sorting-cards)
2222
public enum SortMode: String, Codable, CaseIterable, Sendable {
23-
case name, set, released, rarity, color, usd, tix, eur, cmc, power, toughness, edhrec, artist
23+
case name, set, released, rarity, color, usd, tix, eur, cmc, power, toughness, edhrec, artist, spoiled
2424
}
2525

2626
/// Directions that Scryfall can order cards in
@@ -32,7 +32,9 @@ public enum SortDirection: String, Codable, CaseIterable, Sendable {
3232

3333
/// Formats for playing Magic: the Gathering
3434
public enum Format: String, CaseIterable, Sendable {
35-
case standard, historic, pioneer, modern, legacy, pauper, vintage, penny, commander, brawl
35+
case standard, future, historic, timeless, gladiator, pioneer, modern, legacy, pauper, vintage,
36+
penny, commander, oathbreaker, standardbrawl, brawl, alchemy, paupercommander, duel, oldschool,
37+
premodern, predh
3638
}
3739

3840
/// Currency types that Scryfall provides prices for

Sources/ScryfallKit/Models/MTGSet.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ public struct MTGSet: Codable, Identifiable, Hashable, Sendable {
3434
// While "masters" is in fact not inclusive, it's also a name that we can't control
3535
// swiftlint:disable:next inclusive_language
3636
case core, expansion, masters, masterpiece, spellbook, commander, planechase, archenemy,
37-
vanguard, funny, starter, box, promo, token, memorabilia, arsenal, alchemy, minigame, fromTheVault, premiumDeck, duelDeck, draftInnovation, treasureChest
37+
vanguard, funny, starter, box, promo, token, memorabilia, arsenal, alchemy, minigame,
38+
eternal, fromTheVault, premiumDeck, duelDeck, draftInnovation, treasureChest
3839
/// A layout that hasn't been added to ScryfallKit yet
3940
case unknown(String)
4041

4142
public static let allCases: [Kind] = [
4243
.core, .expansion, .masters, .masterpiece, .spellbook, .commander, .planechase, .archenemy,
43-
.vanguard, .funny, .starter, .box, .promo, .token, .memorabilia, .arsenal, .alchemy, .minigame, .fromTheVault, .premiumDeck, .duelDeck, .draftInnovation, .treasureChest
44+
.vanguard, .funny, .starter, .box, .promo, .token, .memorabilia, .arsenal, .alchemy, .minigame,
45+
.eternal, .fromTheVault, .premiumDeck, .duelDeck, .draftInnovation, .treasureChest
4446
]
4547

4648
public var rawValue: String {

Tests/ScryfallKitTests/CaseIterableTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ final class CaseIterableTests: XCTestCase {
131131
case .arsenal: MTGSet.Kind.allCases.contains(.arsenal)
132132
case .alchemy: MTGSet.Kind.allCases.contains(.alchemy)
133133
case .minigame: MTGSet.Kind.allCases.contains(.minigame)
134+
case .eternal: MTGSet.Kind.allCases.contains(.eternal)
134135
case .fromTheVault: MTGSet.Kind.allCases.contains(.fromTheVault)
135136
case .premiumDeck: MTGSet.Kind.allCases.contains(.premiumDeck)
136137
case .duelDeck: MTGSet.Kind.allCases.contains(.duelDeck)

0 commit comments

Comments
 (0)