Monday, February 15, 2010

Hypnotic Specter

Hypnotic Specter (HP) is one of my favorite cards in Magic and one of the cards that make Magic so interesting. Part of me dislikes “interesting cards” because they tend to be very hard to program. I’m glad to say that Forge allows you to use (and feel the power of) HP without paying $2 per card ( cheapest price). I’m sure other cards have triggered abilities like HP, but HP was one of the first cards to be truly feared. Flip HP onto the battlefield with a first turn Dark Ritual to incite pure terror.

I would like to say that Forge easily handles HP and other cards like it but it doesn’t. Like so many things it is hardcoded, the combat code specifically checks for HP. (To programmers, hardcoding something is akin to using duck tape. It works, but it is messy.) While this isn’t very elegant, it works. (“It works” is probably my favorite excuse.)

A better solution would be to have a battle damage hook or event like
combatDamage(int nDamage, Card damageTo, Card damageFrom)
This would keep the card code together, instead of sticking some of the card code with the combat code. Currently Forge only has a few very basic events like when a card is added or removed from a zone or when a player’s life points changes. Adding a combat damage event to Forge doesn’t seem too difficult and maybe I could work on that.

And to be thorough it would be good to add abilities that trigger when they deal damage to a player or just deal damage (whether during or outside of combat).
combatDamage(int nDamage, String player, Card damageFrom)

damage(int nDamage, String player, Card damageFrom)
damage(int nDamage, Card damageTo, Card damageFrom)
I would like to say that I programmed HP but I didn’t. It was probably one of the forums guys like Dennis or Rob. Thanks.

1 comment:

Viagra Online said...

I never thought I would run into such an extraordinary blog, I read it to the letter and I took pleasure of every word writen there.