Page 5 of 6

Re: Mana Pool

PostPosted: 16 Jun 2009, 20:57
by DennisBergkamp
Actually, I can't tap Savannah to add G to the manapool (it will always just add W). This is because in shouldTapManaPool(card), we're only adding the ability once. Right now it's not really a big deal, because we can easily just use the dual lands directly to pay for stuff.

And yes, you're right, this is how I coded Sol Ring, just through adding "ManaPool:1" twice.

I already coded Gaea's Cradle to see if it works as expected (and it does!). Man, what a powerful card, I'll add Priest of Titania as well :D

Re: Mana Pool

PostPosted: 17 Jun 2009, 01:15
by DennisBergkamp
By the way, I think I'll remove the "Land" type from the Mana Pool. Just wasn't fair when the AI got to use Land Tax twice in a row when he shouldn't have :mrgreen:

Re: Mana Pool

PostPosted: 17 Jun 2009, 03:51
by Rob Cashwalker
I wonder why the keyword handler wasn't able to load up both abilities? What did it do to Birds of Paradise?

Without the Land type, then it won't go into the Land panel unless you've hacked that part like the Mox.... And if you can do that much, then I'd rather see if you can get it into it's own panel on the left side somewhere.

Re: Mana Pool

PostPosted: 17 Jun 2009, 04:13
by DennisBergkamp
Ah, that would be cool, I haven't thought of putting it in its own panel somewhere out of play.
For now, I put it as the very first item on the land panel.
Layout looks like this (and I like it :) ) :
Mana Pool | Stackable lands | Non-stackable Non-Basic Lands | Moxen

Same thing with Birds of Paradise, it will just add W (since that's the last ability).

Re: Mana Pool

PostPosted: 17 Jun 2009, 05:59
by Mr.Chaos
What? Gaea's Cradle AND Priest of Titania?
I know my birthday is approaching but now you're just spoiling me.
Thanks anyway! =D>

My experimental elf deck that uses Chameleon Colossus will be just wicked now!
I mean think about it, a cradle, some elves and maybe 1 or 2 priests and an Elvish Herder...
Activate the colossus say, oh, 5 times... OUCH!!
(mind you, 5 is a conservative number. It could well go up to 10 with a decent amount of elf tokens in play.)

It's 8 a.m. here and I am in my happy place. Drooling. :wink:

Re: Mana Pool

PostPosted: 17 Jun 2009, 12:08
by Rob Cashwalker
Dennis - I may have forgotten to remove the card.ClearSpellAbility() from the keyword handler. That might do the trick.
Edit - it's not in my copy of the code...

I know that we have two mana-only PTPumps on a single creature. I wonder why it doesn't work for these, maybe because they're tap abilities?

It's the same basic logic of all prior keyword handlers, each instance it finds should relate to a new ability. Unless the input engine isn't displaying all the abilities.

Re: Mana Pool

PostPosted: 17 Jun 2009, 19:02
by DennisBergkamp
:lol: @ Mr Chaos.

Rob, it's not in my code either. Maybe the original ability keeps getting replaced or something?

Re: Mana Pool

PostPosted: 18 Jun 2009, 04:55
by Rob Cashwalker
Dennis -

After staring at it while drink-- er, debugging, it became painfully obvious why it didn't loop through the keywords.... There's no loop! The PTPump stuff uses a while loop, and I forgot that part. I had started typing out my code next to the devour keyword, and used it as a model, instead of the PTPump code, which was designed for multiple abilities....

I'll have to look back at it and put the loop in. It needs to start with an if block, and then the while, in order to deal with putting the original "tap: add _" keywords back in.

Re: Mana Pool

PostPosted: 18 Jun 2009, 07:20
by DennisBergkamp
Ok. Yes, exactly, there's no loop :) Should be easy enough to add in....

By the way, would there be a simple way to auto allocate mana from the manapool if there's currently only one single color of mana in it ?
For instance, tap Gaea's Cradle for 11 green and with a single click on the manapool pay for a Darksteel Colossus (or possibly even with 11 clicks, but to bypass the select green mana from the list would be an awesome thing).

Re: Mana Pool

PostPosted: 18 Jun 2009, 14:10
by Rob Cashwalker
If there was a simple way, then it would have to be based on this section of code from Input_PayManaCostUtil:
Code: Select all
    if(manaCost.isNeeded(color))//this line changed
    {
      if (card.getName() == "Mana Pool")
         card.removeExtrinsicKeyword("ManaPool:" +getColor2(color));
      else
         card.tap();
     
      manaCost.subtractMana(color);
It would have to have some checks in there, that if the Mana Pool is full of mana, then inside the if block for card.getName == "Mana Pool", loop until manaCost.isPaid. The manaCost.subtractMana(color) would need to become part of each if statement.
It would require that the user click on the mana pool once, to get into this routine, which is better, I think. It would be even better if there was a way to ask the user if they wanted to use all mana in the pool.

Re: Mana Pool

PostPosted: 20 Jun 2009, 03:16
by Rob Cashwalker
Dennis -

The TapManaPool keyword handler doesn't have the while loop you said should be easy to put in. Do you want me to post the code or would you still figure it out?

Re: Mana Pool

PostPosted: 20 Jun 2009, 03:34
by DennisBergkamp
Either way, but I prefer you post it since I'd like to start on creature enchantments soon (there's a million and one bugs to fix :cry: I think I'll try my luck on some of those first).

Re: Mana Pool

PostPosted: 21 Jun 2009, 15:55
by Rob Cashwalker
Code: Select all
    if (shouldTapManaPool(card) != -1)
    {
       ArrayList<String> putKeywordsBack = new ArrayList<String>();
       
       int n = shouldTapManaPool(card);
       while (n != -1)
       {
          String parse = card.getKeyword().get(n).toString();
          putKeywordsBack.add(parse);
          card.removeIntrinsicKeyword(parse);
         
          String k[] = parse.split("add ");
          final String color = k[1];
         
          final Ability_Tap ability = new Ability_Tap(card, "0")
          {
              private static final long serialVersionUID = -113811381138L;
             
              public void resolve()
              {
                 CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
                 list = list.getName("Mana Pool");
                 Card mp = list.getCard(0);
                 mp.addExtrinsicKeyword("ManaPool:"+color);
              }
              public boolean canPlayAI()
              {
                 return false;
              }
           };
           
           ability.setDescription("Add "+color+" to your mana pool");
           ability.setStackDescription("Adds "+color+" to your mana pool");
           card.addSpellAbility(ability);
           
           n = shouldTapManaPool(card);
       }
       for (int i = 0; i < putKeywordsBack.size(); i++)
          card.addIntrinsicKeyword(putKeywordsBack.get(i));
    }

Re: Mana Pool

PostPosted: 21 Jun 2009, 18:50
by DennisBergkamp
Sweet, I'll add it + test =D>

Re: Mana Pool

PostPosted: 22 Jun 2009, 02:50
by Rob Cashwalker
The only trouble I'm having with it is the ability descriptions are tacked onto the card text, so it says
Code: Select all
tap: add G, tap: add W

Add G to your mana pool
Add W to your mana pool
But if the ability description is blank, the pop-up input for which ability to use doesn't work.