It is currently 25 Aug 2025, 14:15
   
Text Size

Card Requests

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

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 00:05

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...
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 00:09

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.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 00:17

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby DennisBergkamp » 12 Mar 2010, 00:25

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:
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 00:26

Yep.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 01:07

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 03:57

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 04:32

Requesting:

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

EDIT - Also:
Twiddle
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby ajcgr » 12 Mar 2010, 15:31

Hi, and the allies? Halimar Excavator and others... thanks. :)
User avatar
ajcgr
 
Posts: 43
Joined: 12 Mar 2010, 15:23
Has thanked: 3 times
Been thanked: 0 time

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 16:47

slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby lm01 » 12 Mar 2010, 17:52

@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
---
If you want to request cards refer to: Card Requests
If you want to see cards already requested refer to: Card List
lm01
 
Posts: 74
Joined: 21 Feb 2010, 21:24
Has thanked: 1 time
Been thanked: 0 time

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 19:00

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.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby slapshot5 » 12 Mar 2010, 19:04

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Requests

Postby DennisBergkamp » 12 Mar 2010, 20:04

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.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Card Requests

Postby psillusionist » 13 Mar 2010, 01:55

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
psillusionist
 
Posts: 70
Joined: 20 Jan 2010, 00:15
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to Forge

Who is online

Users browsing this forum: No registered users and 59 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 59 users online :: 0 registered, 0 hidden and 59 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 59 guests

Login Form