Skip to content

Releases: bmbowdish/Swiftfall

getCards in Set

30 Jul 17:43
6ba0779
Compare
Choose a tag to compare

You can now retrieve an array of CardLists which contain all of the cards in a set.

Set.getCards() -> [CardList?] (an array of CardLists which each contain a portion of a set)

Ex.

import Swiftfall
do {
    let set = try Swiftfall.getSet(code: "PRM")
    let cards = set.getCards()
} catch {
    print(error)
}

Additionally in implementing this feature we made some changes so that we can implement things like the search feature or just giving Swiftfall a URL you'd like to make a request from. These things have other issues, but were much closer to getting them done.

camelCase

02 Jul 19:44
da7fc3c
Compare
Choose a tag to compare

camelCase is now supported throughout the library.

variables like "represent_mana" and now "representMana"

Fix Prices

02 Jul 17:20
f5dd752
Compare
Choose a tag to compare

Removed Missing Properties

02 Jul 16:51
Compare
Choose a tag to compare

Bug Fixes:
Remove missing properties that were deprecated.

You can find what was deprecated in the Scryfall API here:
https://scryfall.com/blog/deprecation-notice-shifted-fields-202

Thanks to @naknut for notifying me of the deprecation and making the changes.

Basic Bug and Documentation Fixes

07 Mar 04:24
76cdc74
Compare
Choose a tag to compare
Pre-release
  • parsing is even cleaner
  • printing works more consistently
  • fractional mana costs fix
  • documentation is more accurate

Throwing, Parsing, and Naming

06 Mar 20:57
651190c
Compare
Choose a tag to compare
Pre-release
  • Card.CardFace is now Card.Face
  • All get*() now return throws -> *
  • parse* now is parseResource
  • ResultType handles whether a call failed or succeeded.
  • print() now works on all types
    • simplePrint() doesn't exist
do {
    let card = try Swiftfall.getRandomCard()
    print(card) 
} catch {
    ... 
}

Fixed Getter

04 Mar 22:06
73dad4d
Compare
Choose a tag to compare
Fixed Getter Pre-release
Pre-release

Getters don't exist anymore.

Double-Faced Cards

04 Mar 08:00
cb6d554
Compare
Choose a tag to compare
Double-Faced Cards Pre-release
Pre-release

Double-Sided cards now work properly.

Double-Sided Cards

Ex.

import Swiftfall
let card = Swiftfall.getCard(exact:"Jace, Vryn's Prodigy")
card?.simplePrint()

Out.

Name: Jace, Vryn's Prodigy
Cost: {1}{U}
Type Line: Legendary Creature — Human Wizard
Oracle Text:
{T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn's Prodigy, then return him to the battlefield transformed under his owner's control.
Power: 0
Toughness: 2
Name: Jace, Telepath Unbound
Cost: 
Type Line: Legendary Planeswalker — Jace
Oracle Text:
+1: Up to one target creature gets -2/-0 until your next turn.
−3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.
−9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard."
Loyalty: 5

OR

Ex.

import Swiftfall
let card = Swiftfall.getCard(exact:"Jace, Vryn's Prodigy")
let faces = card?.getCardFaces()
let front = faces![0]
let back = faces![1]
front.simplePrint()
back.simplePrint()

Out.

Name: Jace, Vryn's Prodigy
Cost: {1}{U}
Type Line: Legendary Creature — Human Wizard
Oracle Text:
{T}: Draw a card, then discard a card. If there are five or more cards in your graveyard, exile Jace, Vryn's Prodigy, then return him to the battlefield transformed under his owner's control.
Power: 0
Toughness: 2
Name: Jace, Telepath Unbound
Cost: 
Type Line: Legendary Planeswalker — Jace
Oracle Text:
+1: Up to one target creature gets -2/-0 until your next turn.
−3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.
−9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard."
Loyalty: 5

Rulings and Testing

28 Feb 23:23
af65469
Compare
Choose a tag to compare
Rulings and Testing Pre-release
Pre-release

Testing

Testing now uses Asserts in the way that most reasonable people would expect them to.
I am not very familiar with testing so that means they may not be perfect.
If you have any problems with the testing feel free to leave an issue.

Ex.

func testRandomCard(){
    let card = Swiftfall.getRandomCard()
    XCTAssertTrue(card != nil)
}

xcode handles this testing for us and creates a really easy to understand message for passing or failing.

Rulings

Magic has rulings to explain higher concepts of certain magic cards.
Swiftfall now supports rulings.
The current only way to get a ruling is to search by code and card id.

Types

RulingList

Data Structures

data:[Ruling?] (A list of Rulings)

Functions

getData() -> [Ruling?] (A List of Rulings)
getData(index:Int) -> Ruling? (A Ruling by Index)
simplePrint() (Prints out the rulings simply)

How To Use It

Ex.

let rulings = Swiftfall.getRulingList(code: "ima", number: 65)
rulings?.simplePrint()

Out.

Source: wotc
Comments: Mana Drain can target a spell that can’t be countered. When Mana Drain resolves, that spell won’t be countered, but you’ll still add mana to your mana pool at the beginning of your next main phase.

Source: wotc
Comments: If the target spell is an illegal target when Mana Drain tries to resolve, it will be countered and none of its effects will happen. You won’t get any mana.

Source: wotc
Comments: Mana Drain’s delayed triggered ability will usually trigger at the beginning of your precombat main phase. However, if you cast Mana Drain during your precombat main phase or during your combat phase, its delayed triggered ability will trigger at the beginning of that turn’s postcombat main phase.

Ruling

Data Structures

source: String
published_at: String
comment: String

Functions

getSource() -> String (Get the source of the ruling)
getPublishedAt() -> String (Where was the ruling published)
getComment() -> String (What is the ruling)

How to Use It

To access a ruling, first you need a list of rulings.
Ex.A.

let rulings = Swiftfall.getRulingList(code: "ima", number: 65)

Then you call getData(index:Int)

let ruling = rulings.getData(index:1)
ruling.simplePrint()

Out.

Source: wotc
Comments: If the target spell is an illegal target when Mana Drain tries to resolve, it will be countered and none of its effects will happen. You won’t get any mana.

Planeswalkers and Documentation

28 Feb 04:20
7ccbf9a
Compare
Choose a tag to compare
Pre-release
  • Commenting Functions
  • Planeswalkers work now

How to get Planeswalker Loyalty

let card = Swiftfall.getCard(exact:"Jace Beleren")
print((card?.getLoyalty())!)

out:
3