Page 1 of 1

Fix for Crib Swap

PostPosted: 12 Jan 2009, 09:09
by jpb
I've seen a number of people complain about this one. The fix is to make the token's owner and controller the player who controlled the creature which was removed from the game by Crib Swap. Before it was always making whoever cast Crib Swap the Owner and Controller of the token, but putting it into play in the correct zone. To fix this replace the current Crib Swap card with the following in CardFactory.java.

Code: Select all
    //*************** START *********** START **************************
    if(cardName.equals("Crib Swap"))
    {
      SpellAbility spell = new Spell(card)
      {
        public void resolve()
        {
          if(AllZone.GameAction.isCardInPlay(getTargetCard()))
          {
            String player = getTargetCard().getController();
            makeToken(player);

            //remove card from play
            PlayerZone zone = AllZone.getZone(getTargetCard());
            zone.remove(getTargetCard());
          }
        }//resolve()
        public boolean canPlayAI()
        {
          CardList creature = new CardList(AllZone.Human_Play.getCards());
          creature = creature.getType("Creature");
          return creature.size() != 0 && (AllZone.Phase.getTurn() > 4);
        }
        public void chooseTargetAI()
        {
          CardList play = new CardList(AllZone.Human_Play.getCards());
          Card target = CardFactoryUtil.AI_getBestCreature(play);
          setTargetCard(target);
        }
        void makeToken(String player)
        {
          Card c = new Card();

          c.setName("Token");

          c.setOwner(player);
          c.setController(player);

          c.setManaCost("");
          c.setToken(true);

          c.addType("Creature");
          c.addType("Shapeshifter");
          c.setAttack(1);
          c.setDefense(1);

          PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
          play.add(c);
        }//makeToken()

      };
      spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));

      card.clearSpellAbility();
      card.addSpellAbility(spell);
    }//*************** END ************ END **************************