Page 1 of 1

Fix for control magic

PostPosted: 15 Jan 2009, 07:09
by jpb
Almost_Clever reported that Control Magic was buggy. The bug was that the card control magic targets would keep it's controller and just change zones. Here is the fix. Replace the current Control Magic card in CardFactory with the following.

Code: Select all
    //*************** START *********** START **************************
    if(cardName.equals("Control Magic"))
    {
      final SpellAbility spell = new Spell(card)
      {
        public boolean canPlayAI()
        {
          CardList c = CardFactoryUtil.AI_getHumanCreature();
          CardListUtil.sortAttack(c);
          CardListUtil.sortFlying(c);

          if(c.isEmpty())
            return false;

          if(2 <= c.get(0).getAttack() && c.get(0).getKeyword().contains("Flying"))
          {
            setTargetCard(c.get(0));
            return true;
          }

          CardListUtil.sortAttack(c);
          if(4 <= c.get(0).getAttack())
          {
            setTargetCard(c.get(0));
            return true;
          }

          return false;
        }//canPlayAI()
        public void resolve()
        {
          Card c = getTargetCard();
          if(AllZone.GameAction.isCardInPlay(c))
          {
           //set summoning sickness
            if(c.getKeyword().contains("Haste")){
              c.setSickness(false);
            }
            else{
              c.setSickness(true);
            }
            
            ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTrigger(false);
            ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTrigger(false);

            PlayerZone from = AllZone.getZone(c);
            from.remove(c);
           
            c.setController(card.getController());

            PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController());
            to.add(c);

            ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTrigger(true);
            ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTrigger(true);
          }
        }//resolve()
      };//SpellAbility
      card.clearSpellAbility();
      card.addSpellAbility(spell);

      spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
    }//*************** END ************ END **************************

Re: Fix for control magic

PostPosted: 15 Jan 2009, 20:03
by mtgrares
Thanks for the bug fixes.