It is currently 07 Jul 2021, 08:11
   
Text Size

Armadillo Cloak

Post MTG Forge Related Programming Questions Here

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

Armadillo Cloak

Postby mtgrares » 28 Sep 2009, 20:40

Someone sent me this code for Armadillo Cloak and I didn't want to lose it. I pointed these forums out to him but I'm not sure if he is going to register or not. The code looks ok but there might be small problems with it.

Code: Select all
//*************** START *********** START **************************
if(cardName.equals("Armadillo Cloak"))
{
  final SpellAbility spell = new Spell(card)
  {

   private static final long serialVersionUID = 4227124619270545652L;
   public boolean canPlayAI()
    {
      CardList list = new CardList(AllZone.Computer_Play.getCards());
      list = list.getType("Creature");

      if(list.isEmpty())
       return false;

      //else
      CardListUtil.sortAttack(list);
      CardListUtil.sortFlying(list);

      setTargetCard(list.get(0));
      return true;
    }//canPlayAI()
    public void resolve()
    {
      PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
      play.add(card);
     
      Card c = getTargetCard();
     
      if(AllZone.GameAction.isCardInPlay(c)  && CardFactoryUtil.canTarget(card, c) )
      {
         card.enchantCard(c);
         System.out.println("Enchanted: " +getTargetCard());
      }
    }//resolve()
  };//SpellAbility
  card.clearSpellAbility();
  card.addSpellAbility(spell);
 
  Command onEnchant = new Command()
  {   

   public void execute()
      {
         if (card.isEnchanting())
         {
            Card crd = card.getEnchanting().get(0);
            crd.addExtrinsicKeyword("Trample");
            crd.addExtrinsicKeyword("Lifelink");
            crd.addSemiPermanentAttackBoost(2);
            crd.addSemiPermanentDefenseBoost(2);
         } 
      }//execute()
  };//Command
 

  Command onUnEnchant = new Command()
  {   
   

      public void execute()
      {
         if (card.isEnchanting())
         {
            Card crd = card.getEnchanting().get(0);
            crd.removeExtrinsicKeyword("Trample");

            crd.removeExtrinsicKeyword("Lifelink");
   
            crd.addSemiPermanentAttackBoost(-2);               
            crd.addSemiPermanentDefenseBoost(-2);
         }
      
      }//execute()
   };//Command
   
   Command onLeavesPlay = new Command()
   {
   
   public void execute()
      {
         if (card.isEnchanting())
         {
            Card crd = card.getEnchanting().get(0);
            card.unEnchantCard(crd);
         }
      }
   };
 
  card.setEnchant(onEnchant);
  card.setUnEnchant(onUnEnchant);
  card.setLeavesPlay(onLeavesPlay);
 
  spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
}//*************** END ************ END **************************
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Armadillo Cloak

Postby DennisBergkamp » 28 Sep 2009, 20:47

Looks fine to me (he did register and posted it also in the main thread). I'll add this to the next version (which has almost 2000 cards now!)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Armadillo Cloak

Postby silly freak » 28 Sep 2009, 21:04

wow, that sounds awesome! do you have the vanilla & easy zendikars already there? that would maybe do the trick...
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Armadillo Cloak

Postby mtgrares » 28 Sep 2009, 21:11

Oops, I didn't see the main thread. Disregard.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Armadillo Cloak

Postby Chris H. » 28 Sep 2009, 21:25

silly freak wrote:wow, that sounds awesome! do you have the vanilla & easy zendikars already there? that would maybe do the trick...
We are very close to the 2000 mark. I am working on a few more (simple ???) keywords but I have no idea how long it will take me. :)
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Armadillo Cloak

Postby DennisBergkamp » 28 Sep 2009, 21:56

wow, that sounds awesome! do you have the vanilla & easy zendikars already there? that would maybe do the trick...
I have them in my local version, which I will release in a few days (still fixing some bugs, and testing some random things). According to my deck editor it has 1985 cards now. It also includes all your IO updates :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 9 guests


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 10 minutes)
Most users ever online was 1922 on 07 Jun 2021, 06:01

Users browsing this forum: No registered users and 9 guests

Login Form