It is currently 24 Apr 2024, 04:41
   
Text Size

Mana Pool

Post MTG Forge Related Programming Questions Here

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

Re: Mana Pool

Postby DennisBergkamp » 16 Jun 2009, 20:57

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

Re: Mana Pool

Postby DennisBergkamp » 17 Jun 2009, 01:15

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

Re: Mana Pool

Postby Rob Cashwalker » 17 Jun 2009, 03:51

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.
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: Mana Pool

Postby DennisBergkamp » 17 Jun 2009, 04:13

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

Re: Mana Pool

Postby Mr.Chaos » 17 Jun 2009, 05:59

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:
](*,) = coder at work, according to a coder.It does explain some of the bugs. :wink:
Mr.Chaos
Tester
 
Posts: 625
Joined: 06 Sep 2008, 08:15
Has thanked: 0 time
Been thanked: 0 time

Re: Mana Pool

Postby Rob Cashwalker » 17 Jun 2009, 12:08

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.
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: Mana Pool

Postby DennisBergkamp » 17 Jun 2009, 19:02

:lol: @ Mr Chaos.

Rob, it's not in my code either. Maybe the original ability keeps getting replaced or something?
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Mana Pool

Postby Rob Cashwalker » 18 Jun 2009, 04:55

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.
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: Mana Pool

Postby DennisBergkamp » 18 Jun 2009, 07:20

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

Re: Mana Pool

Postby Rob Cashwalker » 18 Jun 2009, 14:10

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.
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: Mana Pool

Postby Rob Cashwalker » 20 Jun 2009, 03:16

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?
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: Mana Pool

Postby DennisBergkamp » 20 Jun 2009, 03:34

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

Re: Mana Pool

Postby Rob Cashwalker » 21 Jun 2009, 15:55

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));
    }
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: Mana Pool

Postby DennisBergkamp » 21 Jun 2009, 18:50

Sweet, I'll add it + test =D>
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Mana Pool

Postby Rob Cashwalker » 22 Jun 2009, 02:50

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.
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

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 44 guests


Who is online

In total there are 44 users online :: 0 registered, 0 hidden and 44 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 44 guests

Login Form