It is currently 24 Apr 2024, 11:51
   
Text Size

Black Lotus

Post MTG Forge Related Programming Questions Here

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

Black Lotus

Postby Rob Cashwalker » 22 Jun 2009, 04:25

Code: Select all
    if (cardName.equals("Black Lotus"))
    {
       final SpellAbility ability = new Ability_Tap(card)
       {
         private static final long serialVersionUID = 8394047173115959008L;

         public boolean canPlayAI(){return false;}
          
          public void resolve()
          {
             if (card.getController().equals(Constant.Player.Human))
             {
                    CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
                    list = list.getName("Mana Pool");
                    Card mp = list.getCard(0);

                    String color = new String();
                    String warn = new String();
                    int n = 0;
                    int nn;
                    while (n < 3) {
                       color =  (String)JOptionPane.showInputDialog(null, warn+"Enter a Mana character: [W,U,B,R,G]", "Pick mana color", JOptionPane.QUESTION_MESSAGE);               
                       color = color.trim().substring(0,1).toUpperCase();
                       if (!"WUBRG".contains(color))
                       {
                          n++;
                          nn = 3 - n;
                          warn = "Bad input -"+color+". "+nn+" more tries.\n";
                       }                          
                       else
                          break;
                    }
                             
                    //System.out.println("ManaPool:"+color+":");
                for (int i = 0; i < 3; i++)
                   mp.addExtrinsicKeyword("ManaPool:"+color);
                   
                AllZone.GameAction.sacrifice(card);
             }
          }
       };
       
       ability.setStackDescription("Adds 3 mana of any one color to your mana pool");
       card.addSpellAbility(ability);
    }
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Black Lotus

Postby DennisBergkamp » 22 Jun 2009, 05:32

Sweet, now all we have to do is add Timewalk :mrgreen:
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby zerker2000 » 22 Jun 2009, 10:56

Rob Cashwalker wrote:
Code: Select all
                    String color = new String();
                    String warn = new String();
                    int n = 0;
                    int nn;
                    while (n < 3) {
                       color =  (String)JOptionPane.showInputDialog(null, warn+"Enter a Mana character: [W,U,B,R,G]", "Pick mana color", JOptionPane.QUESTION_MESSAGE);               
                       color = color.trim().substring(0,1).toUpperCase();
                       if (!"WUBRG".contains(color))
                       {
                          n++;
                          nn = 3 - n;
                          warn = "Bad input -"+color+". "+nn+" more tries.\n";
                       }                          
                       else
                          break;
                    }
Huh? "<nn> more tries"??? Wouldn't it be easier to use the familiar old
Code: Select all
AllZone.Display.getChoice("Choose mana color",Constant.Color.Colors[]);
, i.e. replace above "type in letter of mana color" mess with
Code: Select all
               String Colorname =  AllZone.Display.getChoice("Choose color",Constant.Color.Colors[]);
               String color=Input_PayManaCostUtil.getColor(Colorname);
Also, the many instances of
Code: Select all
                    CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
                    list = list.getName("Mana Pool");
                    Card mp = list.getCard(0);
are getting annoying, I think we should put that in as a constant somewhere(e.g. "AllZone.Human_Play.Mana_Pool") instead of copying it for every card that uses it :P
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby Rob Cashwalker » 22 Jun 2009, 11:46

zerker2000 wrote:Huh? "<nn> more tries"??? Wouldn't it be easier to use the familiar old
Code: Select all
AllZone.Display.getChoice("Choose mana color",Constant.Color.Colors[]);
, i.e. replace above "type in letter of mana color" mess with
Code: Select all
               String Colorname =  AllZone.Display.getChoice("Choose color",Constant.Color.Colors[]);
               String color=Input_PayManaCostUtil.getColor(Colorname);
OK, sure that makes sense. I wasn't sure how to display a multi-choice that would easily translate to the single character needed for the Mana Pool.
Also, the many instances of
Code: Select all
                    CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
                    list = list.getName("Mana Pool");
                    Card mp = list.getCard(0);
are getting annoying, I think we should put that in as a constant somewhere(e.g. "AllZone.Human_Play.Mana_Pool") instead of copying it for every card that uses it :P
Probably. Though, I don't think so, because when AllZone is created, the card hasn't been created yet. But we could create a reference to it for all of CardFactory.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Black Lotus

Postby zerker2000 » 22 Jun 2009, 12:30

Hmm... shouldn't GameAction.mp work?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby Rob Cashwalker » 22 Jun 2009, 13:48

What's GameAction.mp?
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Black Lotus

Postby zerker2000 » 22 Jun 2009, 15:40

Ooh I think I just found the skullclamp bug: It's supposed to be skullclamp's controller, not from the card it's equipping... I see why it was done so though. Anyways, as I was saying, I think GameAction.Newgame makes the manapool, which means either the card ID created with it should be used, or we should make something along the lines of :
Code: Select all
public class ManaPool extends Card
{
  \\<"Manapool:" stuff>
  intrinsicKeyword.add("Shroud")
  intrinsicKeyword.add("Indestructible")
}
and put a universal one in Constant.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby DennisBergkamp » 22 Jun 2009, 16:51

Ooh I think I just found the skullclamp bug: It's supposed to be skullclamp's controller, not from the card it's equipping... I see why it was done so though. Anyways, as I was saying, I think GameAction.Newgame makes the manapool, which means either the card ID created with it should be used, or we should make something along the lines of :
Yes, I've actually changed it to the card's owner instead of its controller in my version (this seems to cover the cases of Control Magic etc.).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby zerker2000 » 22 Jun 2009, 17:48

Not really: then I control magic something and clamp it, and compy gets the cards :(
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby DennisBergkamp » 22 Jun 2009, 18:34

Yikes, you're right :lol:

I'll have to look at the code again to see if I can just have the controller of the Skullclamp get the cards.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby Rob Cashwalker » 22 Jun 2009, 18:38

hey guys.. stay on topic....

and put a universal one in Constant.
But it has to be "in play" under the players control in order for the Input_PayManaCostUtil to access it.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Black Lotus

Postby zerker2000 » 22 Jun 2009, 23:46

Rob Cashwalker wrote:hey guys.. stay on topic...
Sorry :oops:
and put a universal one in Constant.
But it has to be "in play" under the players control in order for the Input_PayManaCostUtil to access it.
Yes, so In GameAction.newGame have e.g.
Code: Select all
AllZone.Human_Play.add(AllZone.manaPool);
instead of
Code: Select all
    Card mp = new Card();
    mp.setName("Mana Pool");
    //mp.addType("Land");
    mp.addIntrinsicKeyword("Indestructible");
    mp.addIntrinsicKeyword("Shroud");
    AllZone.Human_Play.add(mp);
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Black Lotus

Postby Rob Cashwalker » 23 Jun 2009, 01:09

I guess it makes sense.... But I'd still say you should try it yourself first, and see if it works out.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Black Lotus

Postby mtgrares » 23 Jun 2009, 18:28

I think Black Lotus is everyone's favorite card. Thanks Rob.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 58 guests


Who is online

In total there are 58 users online :: 0 registered, 0 hidden and 58 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 58 guests

Login Form