It is currently 20 Apr 2024, 02:04
   
Text Size

Boomerang

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Boomerang

Postby DennisBergkamp » 28 Sep 2008, 20:00

Classic blue card: Boomerang.
In cards.txt:

Code: Select all
Boomerang
U U
Instant
Return target permanent to its owner's hand.
In CardFactory.java:

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 **************************
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Return to Forge

Who is online

Users browsing this forum: No registered users and 159 guests


Who is online

In total there are 159 users online :: 0 registered, 0 hidden and 159 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 159 guests

Login Form