Dead Meat

When you have played Magic: The Gathering for some time you’ll notice that the box of spare cards is constantly growing. This box is the home for all those homeless cards that you got in booster packs (or from other sources) and that just doesn’t fit in one of your current decks. It might be because the theme doesn’t fit or because you lack some cards to make a certain mechanism tick.

But then, when the rain is pouring down outside and you have some time to spare, you can open up the box, sort your cards in nice piles and then build a couple of really fun casual game decks and play them against one another. Who knows, maybe you’ll even find some new favourites among your forgotten cards?

Here’s a deck from this weekends casual games.

Dead Meat
Creatures (19)
2  Tenacious Dead
2  Child of Night
2  Corpse Hauler
1  Gnawing Zombie
2  Gutter Skulk
2  Blood Bairn
1  Dead Reveler
1  Lifebane Zombie
1  Undead Minotaur
2  Accursed Spirit
1  Liliana’s Reaver
2  Sengir Vampire

Lands (24)
8  Forest
1  Radiant Fountain
15  Swamp

Other spells (17)
1  Caravan Vigil
1  Fog
2  Giant Growth
2  Prey Upon
2  Vile Rebirth
1  Altar’s Reap
1  Naturalize
1  Staff of the Death Magus
2  Trollhide
1  Launch Party
1  Midnight Recovery
1  Well of Lost Dreams
1  Creeping Renaissance

Note to self

Dear Future Self,
when your XIB-files starts to act really crazy you have probably forgot to uncheck the Use Auto Layout checkbox… again.
UseAutoLayout

Properties in a Category

One of the many things I like with Objective-C is the possibility to extend any class without having to write a proper extension class that inherits from the original. The technique is called categories and what you is that you specify one or more new methods to be a part of a given class.

Below is an example of how to extend a standard NSString object with a new custom method that checks if a certain string is a part of the NSString.

To use the above category you simply import the NSString+Contains.h in your source code after that you can use the new method on all NSString objects. Great! But what if you also want to add a property? The category mechanism does not support properties but where there is a will, there is a way.

By declaring a property and then add your own getter and setter methods you can use the C-method objc_setAssociatedObject to connect and retrieve data to an object. Let me show you; In the following example I’ll create a category that will let you store any Objective-C object in a property called customData in a NSString object.

In many cases the best solution is to create a new class that extends another class to accomplish this, but for some situations this proves to be a highly efficient solution.

Jace vs. Vraska

One of my favourite Magic the Gathering products is by far the duel decks. In each duel deck pack you get two decks designed according to a special theme (e.g. Knights vs. Dragons) or around two planeswalkers (e.g. Koth vs. Venser). The decks are fun and full of flavour and best of all they are designed to be played against one another.

Ever since it was announced I have been looking forward to when the next duel decks would come out and this morning it was finally possible to pre-order Jace vs. Vraska at my local store. Hopefully I will be able to pick up the decks this friday to be able to test them with the kids during the weekend.

Another fun thing about the duel decks is that the deck designer always writes a feature article about the process. Jace vs. Vraska is designed by Sam Stoddard and you can read about his work on the link below.

Playing with Jace & Vraska

This is the code your are looking for

Since it’s obviously impossible for me to remember the best way of getting a random number in Objective-C I’m writing it down here, once and for all. This is a post to my future self.

- “John, this is the code you are looking for!”

Default Rotation

When creating an app that should start in landscape mode (mostly games) you should (read must!) support both landscape-left and landscape-right. This is actually a rather simple task, but one thing that has bugged me is that by default the app starts in landscape-left mode (home key to the left). I think it’s way better to start in landscape-right mode, not just because it feels better, most iPad cases (like the Smart Cover and Smart Case) is also designed to be used in landscape-right mode.

But how do you change the default direction? It turned out to be quite simple, you just switch the order of the value-strings for the UISupportedInterfaceOrientations key in the project-info.plist file.

New deck: Allies

Edit: Added sideboard

Our latest Magic the Gathering decks finally arrived today. Hopefully we can find some time this evening to take them out on a test run. On the paper I’m quiet satisfied with my Allies deck, but I still need to figure out a decent sideboard. I’ll get back to that later.

The goal for Allies is to cast at least one ally creature per round, either to pump up other allies or to make other abilities trigger. The Volt Charge will be used to clear the path for the attackers while pumping up the creatures even more. The Door of Destinies is actually a little bit on the expensive side but other than that it fits perfectly in this deck.

The sideboard consists of some protection spells (Cloudshift, Gods Willing and Boros Charm), a few spells to land some extra damage (Mighty Leap and Boros Charm) and some spells to deal with annoying creatures (Pacifism and Coordinated Barrage). The Cloudshift also adds some extra fun since it can be used to double the effect of an Ally entering the battlefield.

Allies
Creatures (25)
4  Hada Freeblade
4  Akoum Battlesinger
2  Highland Berserker
4  Kazandu Blademaster
2  Ondu Cleric
2  Kabira Evangel
2  Makindi Shieldmate
2  Talus Paladin
2  Kazuul Warlord
1  Murasa Pyromancer

Other spells (11)
2  Lightning Bolt
4  Volt Charge
1  Door of Destinies
4  Join the Ranks

Lands (24)
4  Clifftop Retreat
8  Mountain
12  Plains

Sideboard (15)
3  Cloudshift
2  Coordinated Barrage
3  Gods Willing
2  Boros Charm
3  Mighty Leap
2  Pacifism

Small code, Big smile

Sometimes the smallest piece of code can make you happy. Here is a small Objective-C snippet to create a correct CGRect from two CGPoints.