Counterspells

In this topic, I will post some different counterspells I coded. I made a bunch, but they're on different computers, so I'll probably post them one at a time.
I know these can't be used by the AI, but you can always use them against the computer.
The first card I'll post is Mystic Snake.
In my version of MTG Forge, there's an issue with "Flash" creature cards, so I get a copy of Mystic Snake in my graveyard whenever I play this spell. This might have been fixed in the newest version though.
Anyway, I had some trouble with this card at first, but now I fixed it so that one could play it at any time, even if there's no other spells on the stack.
In cards.txt:
I know these can't be used by the AI, but you can always use them against the computer.
The first card I'll post is Mystic Snake.
In my version of MTG Forge, there's an issue with "Flash" creature cards, so I get a copy of Mystic Snake in my graveyard whenever I play this spell. This might have been fixed in the newest version though.
Anyway, I had some trouble with this card at first, but now I fixed it so that one could play it at any time, even if there's no other spells on the stack.
In cards.txt:
- Code: Select all
Mystic Snake
1 G U U
Creature Snake
You may play Mystic Snake any time you could play an instant. When Mystic Snake comes into play, counter target spell.
2/2
Flash
- Code: Select all
//*************** START *********** START **************************
if(cardName.equals("Mystic Snake"))
{
final SpellAbility ability = new Ability(card, "0")
{
public void resolve()
{
if(AllZone.Stack.size() > 0) {
SpellAbility sa = AllZone.Stack.peek();
if (sa.isSpell()) {
sa = AllZone.Stack.pop();
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
}
}
}//resolve()
};//SpellAbility
Command intoPlay = new Command()
{
public void execute()
{
if(AllZone.Stack.size() > 0) {
ability.setStackDescription("Mystic Snake counters " +AllZone.Stack.peek().getSourceCard().getName());
AllZone.Stack.add(ability);
}
}
};
card.setComesIntoPlay(intoPlay);
}//*************** END ************ END **************************