Skip to content

Rulings and Testing

Pre-release
Pre-release
Compare
Choose a tag to compare
@bmbowdish bmbowdish released this 28 Feb 23:23
· 31 commits to master since this release
af65469

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.