Mana Pool
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Mana Pool
by Incantus » 13 Jun 2009, 14:58
you guys are the ones working on this, but i strongly recommend not going down the path of doing these kinds of hacks to make things easier from a short term perspective. It may work now, but when you get to the point where the hack prevents a lot of other stuff it will be really difficult to fix. Just my 2 cents ( speaking from experience with Incantus)
Re: Mana Pool
by Rob Cashwalker » 13 Jun 2009, 17:52
I'd normally agree, however I just don't think we have the architecture to deal with it properly. I can't figure out a better way to deal with the architecture. The architecture for paying costs only works with cards right now.Incantus wrote:you guys are the ones working on this, but i strongly recommend not going down the path of doing these kinds of hacks to make things easier from a short term perspective. It may work now, but when you get to the point where the hack prevents a lot of other stuff it will be really difficult to fix. Just my 2 cents ( speaking from experience with Incantus)
Theoretically, this hack will get us by until Rares is really ready with v2. No, it's not an ideal solution, but I don't see how it will prevent anything else from working.
The Force will be with you, Always.
-
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
by Rob Cashwalker » 14 Jun 2009, 02:24
So, it works!
Start off in GameAction.java around line 531:
Still to do:
Keyword handler for existing "tap: add _" keyworded cards.
Figure out how to put the card in its own panel. Any takers?
Start off in GameAction.java around line 531:
- Code: Select all
for(int i = 0; i < 7; i++)
{
this.drawCard(Constant.Player.Computer);
this.drawCard(Constant.Player.Human);
}
Card mp = new Card();
mp.setName("Mana Pool");
mp.addType("Land");
mp.addIntrinsicKeyword("Indestructible");
mp.addIntrinsicKeyword("Shroud");
AllZone.Human_Play.add(mp);
AllZone.Stack.reset();//this works, it clears the stack of Upkeep effects like Bitterblossom
AllZone.InputControl.setInput(new Input_Mulligan());
}//newGame()
- 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);
- Code: Select all
for(int i = 0; i < check.size(); i++)
{
if(check.get(i).toString().startsWith(manaString) || check.get(i).toString().startsWith("ManaPool:"))
{
//gets G from "tap: add G"
letter = check.get(i).toString().charAt(manaString.length());
- Code: Select all
public static String getColor2(String color)
{
Map<String, String> m = new HashMap<String, String>();
m.put(Constant.Color.Green, "G");
m.put(Constant.Color.Red, "R");
m.put(Constant.Color.Blue, "U");
m.put(Constant.Color.Black, "B");
m.put(Constant.Color.White, "W");
m.put(Constant.Color.Colorless, "1");
Object o = m.get(color);
return o.toString();
}
- Code: Select all
if (cardName.equals("Seething Song"))
{
final SpellAbility spell = new Spell(card)
{
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:R");
mp.addExtrinsicKeyword("ManaPool:R");
mp.addExtrinsicKeyword("ManaPool:R");
mp.addExtrinsicKeyword("ManaPool:R");
mp.addExtrinsicKeyword("ManaPool:R");
}
public boolean canPlayAI()
{
return false;
}
};
spell.setStackDescription("Adds R R R R R to your mana pool");
card.clearSpellAbility();
card.addSpellAbility(spell);
return card;
}
- Code: Select all
Seething Song
2 R
Instant
Add R R R R R to your mana pool.
- mana_pool.jpg (4.85 KiB) Viewed 6145 times
Still to do:
Keyword handler for existing "tap: add _" keyworded cards.
Figure out how to put the card in its own panel. Any takers?
Last edited by Rob Cashwalker on 14 Jun 2009, 02:42, edited 2 times in total.
The Force will be with you, Always.
-
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
by DennisBergkamp » 14 Jun 2009, 02:34
Wow, awesome stuff Rob
I'll merge this in and try it out for myself as soon as I get the chance

I'll merge this in and try it out for myself as soon as I get the chance

-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by mtgrares » 15 Jun 2009, 19:30
Well with MTG Forge we have to hack more, lol. MTG Forge hasn't gone through a major rules rewrite like Incantus has.Incantus wrote:you guys are the ones working on this, but i strongly recommend not going down the path of doing these kinds of hacks to make things easier from a short term perspective.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: Mana Pool
by DennisBergkamp » 16 Jun 2009, 02:48
So Rob, I've added your code and it seems to be working just fine 
For kicks, I added Dark Ritual and was able to play Hypnotic Specter on turn 1

For kicks, I added Dark Ritual and was able to play Hypnotic Specter on turn 1

-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by Rob Cashwalker » 16 Jun 2009, 03:23
that's great! when I was testing, I forgot that Seething Song cost 2 R... I had it at R. So I played some 5 mana burn spell on turn 1!
The Force will be with you, Always.
-
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
by DennisBergkamp » 16 Jun 2009, 05:33
Wow, that's like a Red Lotus 
Not sure if I should add it, but I've also coded Sol Ring based on the same principle (this means the AI won't be able to use it, and you have to add the 2 mana to the manapool first, then cast a spell and draw the 2 mana from the manapool).
Anyway, very impressive stuff Rob
Even though it's all pretty hacky when making the mana pool a card, I'd say this is the very best that can be done for now.

Not sure if I should add it, but I've also coded Sol Ring based on the same principle (this means the AI won't be able to use it, and you have to add the 2 mana to the manapool first, then cast a spell and draw the 2 mana from the manapool).
Anyway, very impressive stuff Rob

-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by Mr.Chaos » 16 Jun 2009, 06:09
Mana pool? Mana sources that give more than 1 mana?
...
YYYYYYYYYYYYYYYEEEEEEEEESSSSSS!!!!!!!
Now then, time for the 3 big bad mana makers:
Gaea's Cradle (any creature deck that needs lots of mana)
Tolarian Academy (Memnarch is smiling now)
Serra's Sanctum (Sigil of the Empty Throne is begging for this one)
Ok, that's me getting ahead of things again but Dark Ritual, Seething Song and Sol Ring got me all fired up!
Way to go guys!
...
YYYYYYYYYYYYYYYEEEEEEEEESSSSSS!!!!!!!


Now then, time for the 3 big bad mana makers:
Gaea's Cradle (any creature deck that needs lots of mana)
Tolarian Academy (Memnarch is smiling now)
Serra's Sanctum (Sigil of the Empty Throne is begging for this one)
Ok, that's me getting ahead of things again but Dark Ritual, Seething Song and Sol Ring got me all fired up!
Way to go guys!
](./images/smilies/eusa_wall.gif)

- Mr.Chaos
- Tester
- Posts: 625
- Joined: 06 Sep 2008, 08:15
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by DennisBergkamp » 16 Jun 2009, 06:22
Those are all possible now (in fact, very easy
).
But, I think the current main issues are:
1. Having to manually select the color of mana to use from a list that is currently in the manapool (Especially with cards like Gaea's Cradle, it would be awesome if it would just use as much mana as needed with a single click, definitely if there's mana of only one color in the manapool).
2. The AI doesn't have a manapool.
3. Can't seem to specify what color mana from a "multi-mana" source to add to the manapool (for instance Savannah will just add W to the manapool).

But, I think the current main issues are:
1. Having to manually select the color of mana to use from a list that is currently in the manapool (Especially with cards like Gaea's Cradle, it would be awesome if it would just use as much mana as needed with a single click, definitely if there's mana of only one color in the manapool).
2. The AI doesn't have a manapool.
3. Can't seem to specify what color mana from a "multi-mana" source to add to the manapool (for instance Savannah will just add W to the manapool).
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by Mr.Chaos » 16 Jun 2009, 07:47
Easy eh? Ok, bring em on then.DennisBergkamp wrote:Those are all possible now (in fact, very easy).
But, I think the current main issues are:
1. Having to manually select the color of mana to use from a list that is currently in the manapool (Especially with cards like Gaea's Cradle, it would be awesome if it would just use as much mana as needed with a single click, definitely if there's mana of only one color in the manapool).
2. The AI doesn't have a manapool.
3. Can't seem to specify what color mana from a "multi-mana" source to add to the manapool (for instance Savannah will just add W to the manapool).

1 So, if I have a cradle and say, 20 creatures in play and tap the cradle, I have to manually select 20 green mana?
Not ideal but I will take it over not having the Cradle.

2 Well, that is not our problem is it.

3 If I understand this, it means that with a mana pool, we can no longer select the color for mana from dual mana sorces? That is a let down.
Still, if it is even half doable, implement them big bad mana making lands and let's see how quick we can crash the game using Mycoloth and Rhys the Redeemed.

Seriously: would using Gaea's Cradle and the like mean the game would slow down quicker?
I mean, just add the cradle and the academy to my Master-Memnarch deck. You have heaps of artifacts and creatures so both give piles of mana which you use to create and control more artifacts.
Would the slow down be actually worse than with saproling tokens? Because there are 2 multi mana sources at work, both based on a total of items in play, just like Rhys does with tokens and we all know that slows things down something serious!
](./images/smilies/eusa_wall.gif)

- Mr.Chaos
- Tester
- Posts: 625
- Joined: 06 Sep 2008, 08:15
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by Hellfish » 16 Jun 2009, 11:07
Awesomeness! Brings me *that* much closer to dusting off my old Shandalar UBControl deck for the forge 

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Mana Pool
by DennisBergkamp » 16 Jun 2009, 15:34
I mean, you still can just pay for the spell regularly like it's always been done in MTGForge (i.e. just play the spell, and tap the dual land / BoP / Darksteel Ingot /... for whatever color of mana). However, you don't have this flexibility with the manapool, and currently that's probably not even an issue, plus it's probably an easy fix.3 If I understand this, it means that with a mana pool, we can no longer select the color for mana from dual mana sorces? That is a let down.
I don't think slowdowns would be an issue. In the case of Rhys the Redeemed, we add more tokens based on tokens, these tokens added are card objects and have to be kept track of.
In the case of adding mana, all we're doing is adding keywords to the manapool.
Then again, tapping a Gaea's Cradle might cause a bit of a slowdown if there's a lot of creatures in play, since we would have to calculate how much mana to add (kind of like using Rhys' ability when there's an Essence Warden in play, the Essence Warden does definitely slow things down).
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by Mr.Chaos » 16 Jun 2009, 16:00
Ah, thanks for explaining that, Dennis.
I am looking forward to playtest those lands.
I am looking forward to playtest those lands.

](./images/smilies/eusa_wall.gif)

- Mr.Chaos
- Tester
- Posts: 625
- Joined: 06 Sep 2008, 08:15
- Has thanked: 0 time
- Been thanked: 0 time
Re: Mana Pool
by Rob Cashwalker » 16 Jun 2009, 20:32
I think what Dennis means about the single color from Savannah, is that if you tap the Savannah for mana before actually needing it, it will prompt you to select the color. That color is then added to the pool. You can't change it later. I sent Dennis my keyword handler to make "tap: add _" abilities work for BOTH adding to the pool and selection for mana cost payments. You don't HAVE to tap the land before playing the spell, but you can if you want.
As written so far, there is no mana burn... but of course it will empty. Maybe at some point an option can be added to play by old rules....
In the process of making this work Dennis actually fixed at least one of the "Pay Mana Cost: 0" bugs, where tap abilities with no cost would require clicking on a land even without being tapped for mana. In my first draft of the keyword handler, I tried to play the ability on my first turn land drop, and without any other land in play, I couldn't add the mana to the pool, since it wanted me to pay zero....
AI for the mana pool will probably be very selective.... Like Dark Ritual.. sure. But AI for single mana use, not likely. Ravnica bounce lands (producing WU for example) might be possible in the future, but would require some explicit coding, not in the generic keyword handler.
BTW, the code for adding 2 mana must include two instances of ManaPool:1 . No shortcuts.
Counting up creatures is quick, and looping through adding the keywords should be quick. Don't see any reason Gaea's Cradle would be a problem. Essence Warden is a problem because of state based effects.
AI for gaea's cradle is a possibility too. Basically any multi-mana generation can be decided based on if the computer has large spells that can be played.
As written so far, there is no mana burn... but of course it will empty. Maybe at some point an option can be added to play by old rules....
In the process of making this work Dennis actually fixed at least one of the "Pay Mana Cost: 0" bugs, where tap abilities with no cost would require clicking on a land even without being tapped for mana. In my first draft of the keyword handler, I tried to play the ability on my first turn land drop, and without any other land in play, I couldn't add the mana to the pool, since it wanted me to pay zero....
AI for the mana pool will probably be very selective.... Like Dark Ritual.. sure. But AI for single mana use, not likely. Ravnica bounce lands (producing WU for example) might be possible in the future, but would require some explicit coding, not in the generic keyword handler.
BTW, the code for adding 2 mana must include two instances of ManaPool:1 . No shortcuts.
Counting up creatures is quick, and looping through adding the keywords should be quick. Don't see any reason Gaea's Cradle would be a problem. Essence Warden is a problem because of state based effects.
AI for gaea's cradle is a possibility too. Basically any multi-mana generation can be decided based on if the computer has large spells that can be played.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Who is online
Users browsing this forum: No registered users and 38 guests