Boomerang
by mtgrares
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Boomerang
by DennisBergkamp » 28 Sep 2008, 20:00
Classic blue card: Boomerang.
In cards.txt:
In cards.txt:
- Code: Select all
Boomerang
U U
Instant
Return target permanent to its owner's hand.
- Code: Select all
//*************** START *********** START **************************
if(cardName.equals("Boomerang"))
{
final SpellAbility spell = new Spell(card)
{
public boolean canPlayAI()
{
CardList human = CardFactoryUtil.AI_getHumanCreature();
return 3 < AllZone.Phase.getTurn() && 0 < human.size();
}
public void chooseTargetAI()
{
CardList human = CardFactoryUtil.AI_getHumanCreature();
setTargetCard(CardFactoryUtil.AI_getBestCreature(human));
}
public void resolve()
{
if(AllZone.GameAction.isCardInPlay(getTargetCard()))
{
if(getTargetCard().isToken())
AllZone.getZone(getTargetCard()).remove(getTargetCard());
else
{
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, getTargetCard().getOwner());
AllZone.GameAction.moveTo(hand, getTargetCard());
}
String targetManaCost = getTargetCard().getManaCost();
targetManaCost = targetManaCost.trim();
}//if
}//resolve()
};//SpellAbility
Input target = new Input()
{
public void showMessage()
{
AllZone.Display.showMessage("Select target permanent for " +spell.getSourceCard());
ButtonUtil.enableOnlyCancel();
}
public void selectButtonCancel() {stop();}
public void selectCard(Card card, PlayerZone zone)
{
if(zone.is(Constant.Zone.Play))
{
spell.setTargetCard(card);
stopSetNext(new Input_PayManaCost(spell));
}
}
};//Input
spell.setBeforePayMana(target);
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 159 guests