It is currently 16 Apr 2021, 03:30
   
Text Size

Boomerang

Moderators: timmermac, friarsol, Blacksmith, KrazyTheFox, Agetian, 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 25 guests


Who is online

In total there are 25 users online :: 0 registered, 0 hidden and 25 guests (based on users active over the past 10 minutes)
Most users ever online was 1371 on 09 Feb 2020, 16:22

Users browsing this forum: No registered users and 25 guests

Login Form