It is currently 27 Apr 2024, 21:11
   
Text Size

Mana Pool

Post MTG Forge Related Programming Questions Here

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

Re: Mana Pool

Postby mtgrares » 09 Jun 2009, 17:57

I'll try to help. :D Parts of my code refernce old and forgotten code, just look at Input_Draw which tries to get dredge working. (Dredge sort of works but Input_Draw has to be called all of the time when a card is drawn instead of GameAction.drawCard(). The code for dredge could probably be put into GameAction.drawCard() if someone is feeling ambitious.)

About Meloku, I guess I was trying to get it to work exactly right (as printed on the card) but I do sometimes leave in old code accidentally or leave in old code that is commented out in case I want it later. Feel free to ask me questions though. I'll try to answer them as well as I can remember. (Meloku was programmed a LONG time ago, :lol:)
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Mana Pool

Postby Rob Cashwalker » 09 Jun 2009, 22:00

mtgrares wrote:I'll try to help. :D Parts of my code refernce old and forgotten code, just look at Input_Draw which tries to get dredge working. (Dredge sort of works but Input_Draw has to be called all of the time when a card is drawn instead of GameAction.drawCard(). The code for dredge could probably be put into GameAction.drawCard() if someone is feeling ambitious.)

About Meloku, I guess I was trying to get it to work exactly right (as printed on the card) but I do sometimes leave in old code accidentally or leave in old code that is commented out in case I want it later. Feel free to ask me questions though. I'll try to answer them as well as I can remember. (Meloku was programmed a LONG time ago, :lol:)
I think you're missing the point a bit. The problem isn't Meloku, the problem is "Where the F should I put the mana subtraction loop?" OR "If it's in the right place, why does it bomb?"
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 Almost_Clever » 10 Jun 2009, 21:54

zerker2000 wrote:Also, since mana burn is at end of phase, the code for my "mana tokens" would have to be tweaked a little, since as is they die at end of turn.
Well, it looks like with 2010 changes to the rules, the mana pool clears at the end of each step instead of each phase and mana burn no longer happens, the mana just goes away (I can hear Kramer from Seinfeld saying "they just write it off!").
A woman came up to me and said / "I'd like to poison your mind / With wrong ideas that appeal to you / Though I am not unkind."
User avatar
Almost_Clever
Tester
 
Posts: 345
Joined: 15 Jan 2009, 01:46
Has thanked: 0 time
Been thanked: 0 time

Re: Mana Pool

Postby Rob Cashwalker » 11 Jun 2009, 00:13

Yeah, first I need to get the pool working in general... then I can worry about finding all the spots where it needs to be cleared. At least I don't have to do the burn part. But the other rules changes are going to wreak havoc... unless we ignore half of them....
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 zerker2000 » 11 Jun 2009, 16:53

What no more mana burn??? Also, I don't understand what you mean by 2010 changes, it's still 2009 :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: Mana Pool

Postby mtgrares » 11 Jun 2009, 18:44

Rob Cashwalker wrote:I think you're missing the point a bit. The problem isn't Meloku, the problem is "Where the F should I put the mana subtraction loop?" OR "If it's in the right place, why does it bomb?"
My best guess is to add ManaPool (or whatever is is called) to AllZone and make is public final static and then update Input_PayManaCost and Input_PayManaCost_Ability to use the mana pool.

I'm not sure what is the best way to clear the mana pool after each phase and step. One way would be to put the mana clearing code in constructor of each of the "phase Inputs", like Input_Main, Input_CombatDamage, etc..

All mouse input is handled through the Input class and that will have to be modified to accept clicking on the mana pool.

I hope that answers your question, if not, I'll keep trying. :)
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Mana Pool

Postby Rob Cashwalker » 12 Jun 2009, 03:34

I'm starting to think about the "mana token" idea.... It's making more sense as I attempt to figure out how to get the mana out of the pool on demand. It's a simple enough change to make to the Input_PayManaCostUtil functions to interpret a token land with a series of keywords added and removed as mana is added and removed from it. Then between steps it's also easy enough to clear the keywords from it.... The trick might be some way to start the game with the token in play, because actually creating and destroying the token might cause undesired triggered effects. It would also make it easy to access, always being the first "land" to the left of the panel.

Then no extra class objects need to be created.
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 » 12 Jun 2009, 04:17

Actually, it's not so difficult to create a card to start in play!
ManaPoolToken.jpg
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 zerker2000 » 12 Jun 2009, 06:43

Rob Cashwalker wrote:I'm starting to think about the "mana token" idea.... It's making more sense as I attempt to figure out how to get the mana out of the pool on demand. It's a simple enough change to make to the Input_PayManaCostUtil functions to interpret a token land with a series of keywords added and removed as mana is added and removed from it.
Erm slightly bad idea, I remember I got some sort of interface problems when I had a bunch of mana abilities on one card.
actually creating and destroying the token might cause undesired triggered effects. It would also make it easy to access, always being the first "land" to the left of the panel.
I would think it wouldn't be hard to create a special "ManaToken.Destroy" (and of course something like "Gui.newManaToken" ... I have no idea how/ where this could be put in) method that bypasses all checks, after all it's not like the token should actually be anywhere but in play(pardon "on battlefield" >:\). Also, I would think that the mana pool would (optimally) be a separate(third under lands) UI area where you have "card pictures" of mana tokens on which you click to sacrifice them(while paying costs).

Then no extra class objects need to be created.
Erm unless there are seperate classes for Creatures, Enchantments, Lands, etc. (which I don't think is the case), my suggestion shouldn't require any either.
Rob Cashwalker wrote:Actually, it's not so difficult to create a card to start in play!<image of Land token>
Hmm, I don't think mana tokens should have any type besides "Mana", otherwise there might be problems (e.g. Armageddon) :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: Mana Pool

Postby Rob Cashwalker » 12 Jun 2009, 16:30

zerker2000 wrote:Erm slightly bad idea, I remember I got some sort of interface problems when I had a bunch of mana abilities on one card.
Can you be more specific? Birds of paradise has 5 abilities.... The only thing that should need modifying is the Extrinsic keyword code to allow multiple mana pool keywords like this:
Code: Select all
manapool:R
manapool:R
manapool:R
Unless the input pop-up screen has some limits, or filters multiples....
after all it's not like the token should actually be anywhere but in play(pardon "on battlefield" Also, I would think that the mana pool would (optimally) be a separate(third under lands) UI area where you have "card pictures" of mana tokens on which you click to sacrifice them(while paying costs).
...
Hmm, I don't think mana tokens should have any type besides "Mana", otherwise there might be problems (e.g. Armageddon) :P
I realize this is an issue. My next step is to dig around to figure out how MTGForge knows where to put any given card object. Once I know that, then I can put it in its own panel off the battlefield. My goal in the screenshot was to figure out how to create a card on the fly (without it being part of an ability) and if the PlayerZone.add(card) method figured out how to treat it without any other intervention. Somewhere in the code it sees the type "Land" and puts it in the land row.

Edit - Come to think of it, I could just give it "Indestructible, Pro-W, Pro-U, Pro-B, Pro-R, Pro-G, Pro-A"....
Erm unless there are seperate classes for Creatures, Enchantments, Lands, etc. (which I don't think is the case), my suggestion shouldn't require any either.
Right. I'm simply pointing out that by reusing the card object in a hacky sort of way, I don't have to figure out how to derive input from some new object, or modify both forms of PayManaCost (as rares was suggesting) - they're all handled by Input_PayManaCostUtil, where it looks for cards that contain keywords that begin with "tap: add _".... I can simply modify this bit of code to also look for "manapool:_" (mana character is in the same position, so even less changes) and let it do the rest basically as is... and then check if the card selected is the mana pool card, and not tap it.

The only other part is back to making spells and abilities that add extrinsic keywords to the mana pool card.... For the most part, a generic keyword handler can be written to deal with all cards that have "tap: add_". Then, the card can be activated during play, then when specifically paying costs, it's still selectable.
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 mtgrares » 12 Jun 2009, 17:19

The problem is that if you put the mana pool into a special card how can you click on a specific mana color? Maybe you could create 6 special cards (WUBRG and colorless) that show you how much mana you have in each category. Just a guess.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Mana Pool

Postby Rob Cashwalker » 12 Jun 2009, 17:55

mtgrares wrote:The problem is that if you put the mana pool into a special card how can you click on a specific mana color? Maybe you could create 6 special cards (WUBRG and colorless) that show you how much mana you have in each category. Just a guess.
When you're selecting mana as it is now, how do you select a given color from Birds of Paradise? Same thing.
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 mtgrares » 12 Jun 2009, 18:05

Hm...well the problem is when you are trying to add mana to the mana pool and you aren't paying a card's cost. (When you are paying a card's cost you don't have to choose the color of the mana since.) When you click on Birds of Paradise I guess the code could ask you which mana color to add to the mana pool.

Adding the mana pool seems simple but there might be landmines ahead.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Mana Pool

Postby Rob Cashwalker » 12 Jun 2009, 18:19

mtgrares wrote:Hm...well the problem is when you are trying to add mana to the mana pool and you aren't paying a card's cost. (When you are paying a card's cost you don't have to choose the color of the mana since.) When you click on Birds of Paradise I guess the code could ask you which mana color to add to the mana pool.

Adding the mana pool seems simple but there might be landmines ahead.
I don't doubt there are land mines. And Birds of paradise might be a big exception to a generic keyword handler....
The mana pool is more useful to handle quantities of mana generated by single effects. If you just want to tap a card to get a single mana, you might as well wait until actually paying the costs. But if you want to play Seething Song, you need the pool. The only other exception would be a land that makes 2 mana at a time, like the filter lands from Shadowmoor, or the bounce lands from Ravnica. But those are corner cases.
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 zerker2000 » 13 Jun 2009, 05:28

Rob Cashwalker wrote:Edit - Come to think of it, I could just give it "Indestructible, Pro-W, Pro-U, Pro-B, Pro-R, Pro-G, Pro-A"....
Why not just indestructible/shroud, I don't think there are any cards that remove all lands from the game.
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

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 104 guests


Who is online

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

Login Form