Page 7 of 119

Re: Card Requests

PostPosted: 12 Mar 2010, 00:05
by slapshot5
Disclaimer: Untested with current source

Here is my old code for Ley Druid if someone wants to have a look and check in:

Code: Select all
//****************************START*****************
   if(cardName.equals("Ley Druid")) {
      final Ability_Tap ability = new Ability_Tap(card) {
         public boolean canPlayAI() {
            return false;
         }
         public void resolve() {
            if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
               getTargetCard().untap();  //untapping land
            }
         }
      };//Ability_Tap
      
      Input target = new Input() {
         public void showMessage() {
            AllZone.Display.showMessage("Select target tapped land to untap");
            ButtonUtil.enableOnlyCancel();
         }
         public void selectButtonCancel() {stop();}
         public void selectCard(Card c, PlayerZone zone) {
            if(c.isLand() && zone.is(Constant.Zone.Play) && c.isTapped()) {
               card.tap(); //tapping Ley Druid
               ability.setTargetCard(c);
               AllZone.Stack.add(ability);
               stop();
            }
         }//selectCard()
      };//Input
      
      card.addSpellAbility(ability);
      ability.setDescription("tap: Untap target land.");
      ability.setBeforePayMana(target);
   }//end Ley Druid
   //**************END****************END***********************
I haven't dug through the new source very much so there may be a few things that need tweaking. (And maybe this can be done with the scriptable stuff in cards.txt now...

Re: Card Requests

PostPosted: 12 Mar 2010, 00:09
by slapshot5
Disclaimer: Untested with current source

Old code for Clone (based off May 2008 source unfortunately...)

Code: Select all
//**************************START**********************
   if(cardName.equals("Clone")) {
      final SpellAbility spell = new Spell(card) {
         public boolean canPlayAI() {
            return false;
         }
         public void chooseTargetAI() {
            //setTargetCard(c);
         }//chooseTargetAI()
         public void resolve() {
            if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
               Card clone = new Card();
               Card source = getTargetCard();
               
               clone.setOwner(card.getController());
               clone.setController(card.getController());
               clone.setName( source.getName() );

               clone.setManaCost( source.getManaCost() );

               clone.setType( source.getType() );
               clone.setAttack( source.getAttack() );
               clone.setDefense( source.getDefense() );
               clone.setKeyword( source.getKeyword() );
               
               clone.setText( source.getSpellText() );

               PlayerZone play = AllZone.getZone(Constant.Zone.Play, clone.getController());
               play.add(clone);
            }
         }
      };//SpellAbility
      spell.setBeforePayMana(CardFactoryUtil.input_targetType(spell, "Creature"));
      card.clearSpellAbility();
      card.addSpellAbility(spell);
   }//end Clone
   //**************END****************END***********************
This is likely incomplete given all the updates since. For this it would probably be wise to implement a .clone() method for Card.java to cover Clone and Vesuvan Doppelganger et. al.

Re: Card Requests

PostPosted: 12 Mar 2010, 00:17
by slapshot5
Ivory Tower is on the Request List. I also implemented that against the May 2008 source:

In GameActionUtil.java:

Code: Select all
public static void upkeep_Ivory_Tower() {
     final String player = AllZone.Phase.getActivePlayer();
     PlayerZone playZone = AllZone.getZone(Constant.Zone.Play,player);
    
     CardList list = new CardList(playZone.getCards());
     list = list.getName("Ivory Tower");
    
     Ability ability;
    for(int i = 0; i < list.size(); i++) {
      ability = new Ability(list.get(i), "0") {
        public void resolve() {
        PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player);
        int numCards = hand.getCards().length;
         if( numCards > 4 ) {
            AllZone.GameAction.getPlayerLife(player).addLife(numCards-4);
         }
        }
      };//Ability
      ability.setStackDescription("Ivory Tower - " +player+ " gains 1 life for each card > 4");

      AllZone.Stack.add(ability);
    }//for
  }//upkeep_Ivory_Tower()
and add
Code: Select all
upkeep_Ivory_Tower();
to
Code: Select all
public static void executeUpkeepEffects()
also in GameActionUtil.java

-Dennis

Re: Card Requests

PostPosted: 12 Mar 2010, 00:25
by DennisBergkamp
Slapshot,

Thanks for posting these! I'll see if I can merge them.
By the way, is your name Dennis too? Even though that's not my real name, it's still a cool name :mrgreen:

Re: Card Requests

PostPosted: 12 Mar 2010, 00:26
by slapshot5
Yep.

Re: Card Requests

PostPosted: 12 Mar 2010, 01:07
by slapshot5
Request: Ali from Cairo

I've been using this card for a long time against the May 2008 source.

My implementation:

In checkStateEffects() in GameAction.java:

Code: Select all
if(AllZone.Computer_Life.getLife() <= 0) {
      if(isAliFromCairoInPlay(AllZone.Computer_Play)) {
         AllZone.Computer_Life.setLife(1);
      }
      else {
         Constant.Runtime.WinLose.addWin();
         stop = true;
      }
    }
    if(AllZone.Human_Life.getLife() <= 0) {
      if(isAliFromCairoInPlay(AllZone.Human_Play)) {
         AllZone.Human_Life.setLife(1);
      }
      else {
         Constant.Runtime.WinLose.addLose();
          stop = true;
      }
    }
with this helper function:

Code: Select all
private boolean isAliFromCairoInPlay(PlayerZone zone) {
   if( zone == null ) {
      return false;
   }
   else {
      CardList all = new CardList();
      all.addAll(zone.getCards());
      return all.containsName("Ali from Cairo");
   }
  }
This will need to be merged with the Poison Counters code in the current implementation.

That should be all that is necessary.

-Dennis

Re: Card Requests

PostPosted: 12 Mar 2010, 03:57
by slapshot5
Here is some old code I had for Reprisal (based off May 2008 source again...)

Code: Select all
//*************** START *********** START **************************
    if(cardName.equals("Reprisal")) {
      final SpellAbility spell = new Spell(card) {
        public void resolve() {
      if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
         AllZone.GameAction.destroy(getTargetCard());
      }
     }//resolve
      };//SpellAbility
     
      card.clearSpellAbility();
      card.addSpellAbility(spell);
     
      Input target = new Input() {
         public void showMessage() {
            AllZone.Display.showMessage("Select target Creature to destroy");
            ButtonUtil.enableOnlyCancel();
         }
         public void selectButtonCancel() {
            stop();
         }
         public void selectCard(Card c, PlayerZone zone) {
            if(zone.is(Constant.Zone.Play) && c.isCreature() && (c.getAttack() > 3)) {
               spell.setTargetCard(c);
               stopSetNext(new Input_PayManaCost(spell));
            }
         }
      };//input
   
   spell.setBeforePayMana(target);
    }//*************** END ************ END **************************
-Dennis

Re: Card Requests

PostPosted: 12 Mar 2010, 04:32
by slapshot5
Requesting:

Argothian Pixies
Chain Lightning
Chaos Orb - (could be fun to implement)
Mind Twist

EDIT - Also:
Twiddle

Re: Card Requests

PostPosted: 12 Mar 2010, 15:31
by ajcgr
Hi, and the allies? Halimar Excavator and others... thanks. :)

Re: Card Requests

PostPosted: 12 Mar 2010, 16:47
by slapshot5

Re: Card Requests

PostPosted: 12 Mar 2010, 17:52
by lm01
@slapshot5
@cgraham54

Thanks to point that, guess I was too sleepy when I added them :P
Upgrading requests

Btw, you do realize Chaos Orb is banned :P

Re: Card Requests

PostPosted: 12 Mar 2010, 19:00
by slapshot5
lm01 wrote:
Btw, you do realize Chaos Orb is banned :P
Yeah, but I'm a little old school I guess. I started playing in late 1994. At that time, it was in the world champion's sideboard and the runner up's deck.

Re: Card Requests

PostPosted: 12 Mar 2010, 19:04
by slapshot5
FWIW, Here's some old code I was using for Icy Manipulator:

Code: Select all
//*****************************START*******************************
   if(cardName.equals("Icy Manipulator")) {
      /* The Rules state that this can target a tapped card, but it won't do anything */
      
      final Ability_Tap ability = new Ability_Tap(card, "1") {
         public boolean canPlayAI() {
            return false;
         }
         public void chooseTargetAI() {
            //setTargetCard(c);
         }//chooseTargetAI()
         public void resolve() {
            if(AllZone.GameAction.isCardInPlay(getTargetCard())) {
               getTargetCard().tap();
            }
         }
      };//SpellAbility
      
      card.addSpellAbility(ability);
      ability.setDescription("1, tap: Tap target artifact, creature or land.");
      ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Artifact;Creature;Land"));
   }//end Icy Manipulator
   //****************END*******END***********************
It uses a custom, more flexible version of CardFactoryUtil.input_targetType():

Code: Select all
   //****************copied from input_targetType*****************
   //cardType is like "Creature", "Land", "Artifact", "Goblin", "Legendary", ";"-delimited
   //cardType can also be "All", which will allow any permanent to be selected
   public static Input input_targetType(final SpellAbility spell, final String cardTypeList) {
      Input target = new Input() {
         public void showMessage() {
            StringTokenizer st = new StringTokenizer(cardTypeList, ";");
            if(cardTypeList.equals("All")) {
               AllZone.Display.showMessage("Select target permanent");
            }
            else {
               String toDisplay = "";
               toDisplay += "Select target ";
               while( st.hasMoreTokens() ) {
                  toDisplay += st.nextToken();
                  if( st.hasMoreTokens() ) {
                     toDisplay += " or ";
                  }
               }
               AllZone.Display.showMessage( toDisplay );
            }
            ButtonUtil.enableOnlyCancel();
         }
         public void selectButtonCancel() {stop();}
         public void selectCard(Card card, PlayerZone zone) {
            boolean foundCardType = false;
            StringTokenizer st = new StringTokenizer(cardTypeList, ";");
            if( cardTypeList.equals("All") ) {
               foundCardType = true;
            } else {
               while( st.hasMoreTokens() ) {
                  if( card.getType().contains( st.nextToken() )) {
                     foundCardType = true;
                  }
               }
            }
            if( foundCardType && zone.is(Constant.Zone.Play)) {
               spell.setTargetCard(card);
               stopSetNext(new Input_PayManaCost(spell));
            }
         }
      };
      return target;
   }//input_targetType()
   //***************end copy******************
And I guess I never got around to implementing it for the AI...

-Dennis

Re: Card Requests

PostPosted: 12 Mar 2010, 20:04
by DennisBergkamp
Slapshot,

So far I've only added Ley Druid from your code (I'll add the rest sometime today - I'll hold off on Clone though, I can see some problems happening if it were to leave play... but maybe they can be fixed somehow?).

Hmm, I'm pretty sure Order of Leitbur is already in Forge.

Re: Card Requests

PostPosted: 13 Mar 2010, 01:55
by psillusionist
Given that X spells and effects are coming soon (according to that other thread), I'd like to request for:

Death Cloud
Decree of Justice
Demonfire
Channel
Fireball