Wednesday, July 15, 2009

Can This Creature Block?

Just answering the question, "Can this creature block that one?" can be complicated. I created a method called CombatUtil.canBlock(Card a, Card b) which returns true if Card a can block Card b. At first this method was simple because it only checked for fear and flying but this method grew longer as MTG Forge added more cards.

As players we know which creatures can block just by glancing at the board but we forget all of the small nuances such as mountainwalk and fear. The canBlock() method is about 100 lines long and has to check for every possible card that could affect combat.

Specific cards like Amrou Seekers, Skirk Shaman, Goldmeadow Dodger, Juggernaut, and Sunweb each have their own specific code that checks to see if they are in play because they modify which creatures can block them. Juggernaut cannot be blocked by walls and Amrou Seekers can only be blocked by white or artifact creatures.

Other keyword abilities that canBlock() supports is reach, shadow, unblockable, "This creature cannot block", protection from a specific color, and "This creature can block only creatures with flying."

Combat also has another useful method called canDestroyAttacker(Card attacker, Card defending) which return true if the defending card can destroy the attacker card. This method is used by the AI when attacking or blocking. This method takes into account flanking, protection from a specific color, Doran the Siege Tower, first strike, double strike, and deathtouch.

CombatUtil.canBlock() is very important because this enables the user interface to only accept legal blockers. The method canDestroyAttacker() is essential to the combat AI because it lets the AI concentrate on the task of finding the best answer when attacking or blocking.

p.s.
When the comprehensive rules were updated last week Wizards quietly slipped in the new keyword "intimidate" which seems to replace fear in the new set after Magic 2010. Both Amrou Seekers and Skirk Shaman have the same ability as intimidate. The word "evergreen" just means that it is a permanent keyword that will be supported like flying.

702.11
This is intimidate, an evergreen keyword that doesn't quite exist yet. A creature with intimidate can't be blocked except by artifact creatures and/or creatures that share a color with it. It's coming soon, so rather than renumber everything in a few months, it was added in early. (It essentially takes the place of fear, which will remain in place but won't appear on new cards.)

p.p.s.
Make sure to check out the new core set Magic 2010.

Visual Spoiler - official Wizards version with large card pictures
Visual Spoiler - one webpage with all of the card pictures

3 comments:

Marek14 said...

You're a bit wrong about intimidate - it's not the same ability Amrou Seekers or Skirk Shaman have. The way it's written, if you change the color of a creature with intimidate, it will also change what can block it, which is not true for Seekers and Shaman.

rising fruition said...

@Marek14: I agree with you that those abilities are different from intimidate. Unless Wizards changes the card text in Oracle, that is.

For a long time, I haven't liked the term fear for the fear ability. It was more accurate that the creature incited fear, not that it had fear.
I like the intimidate keyword much better. Plus, it's more flexible. Which, of course, means it isn't exactly the same as fear. I'm OK with that.

Forge said...

I just meant that the card text would be the same, I didn't mean that in every situation they were the same.

Hopefully intimidate will give a few other colors some much needed evasion. I don't know which colors will use intimidate.