Restricted use mana
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Restricted use mana
by Max mtg » 16 May 2012, 14:09
I'm afraid we'll need both.friarsol wrote:Nope, storing the generating Ability is fine, and the source card should be able to be gleaned through that if it's really necessary. I don't have the code with me, what do we use the source card for? Undoing costs?ArsenalNut wrote:Is there any reason a mana object couldn't reference the source Mana ability either in addition to or instead of the source card?
When you pay mana obtained from Cavern of Souls it depends on the ability used to gain mana whether the spell can be countered or not.
Somberwald Sage puts restrictions on how the mana can be spent. (should we keep that restriction attached to Mana object?)
Myr Superion accepts only mana produced by creatures (mana in pool should know which card produced it, should not it?).
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Restricted use mana
by FabioFLX » 16 May 2012, 14:21
At the moment the version I'm working on allows playing cards like Somberwald Sage.Max mtg wrote:I'm afraid we'll need both.friarsol wrote:Nope, storing the generating Ability is fine, and the source card should be able to be gleaned through that if it's really necessary. I don't have the code with me, what do we use the source card for? Undoing costs?ArsenalNut wrote:Is there any reason a mana object couldn't reference the source Mana ability either in addition to or instead of the source card?
When you pay mana obtained from Cavern of Souls it depends on the ability used to gain mana whether the spell can be countered or not.
Somberwald Sage puts restrictions on how the mana can be spent. (should we keep that restriction attached to Mana object?)
Myr Superion accepts only mana produced by creatures (mana in pool should know which card produced it, should not it?).
Myr Superion is easly implementable, and at first sting Cavern of Souls sholud too.
Re: Restricted use mana
by friarsol » 16 May 2012, 14:32
Ahh, I always considered Myr Superion to be a Cost Restriction, not a Mana Restriction, but it's still a good point. We do need to know Source Card info on the Mana for payment purposes here. We could just go through the Ability to get the Card, but since there isn't any reason to add complexity by depth, especially since it already exists on the Object.Max mtg wrote:Myr Superion accepts only mana produced by creatures (mana in pool should know which card produced it, should not it?).
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Restricted use mana
by ArsenalNut » 16 May 2012, 15:50
Besides Boseiju, Who Shelters All, Cavern of Souls, and Hall of the Bandit Lord are there other mana sources that have a pump effect on spells paid with their mana?
So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Re: Restricted use mana
by friarsol » 16 May 2012, 16:00
Not that I know of or could find via searching.ArsenalNut wrote:Besides Boseiju, Who Shelters All, Cavern of Souls, and Hall of the Bandit Lord are there other mana sources that have a pump effect on spells paid with their mana?
Unrelated, Betrayers has a few cards that creates mana that doesn't drain right away:
http://magiccards.info/query?q=o%3Amana ... rd&s=cname
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Restricted use mana
by FabioFLX » 16 May 2012, 16:26
Men, can I give my contribute to this topic?
I've done a testing release of Forge that easly allows all of the cards you're listing to work.
If someone's interested I can put it on a svn branch.
I've done a testing release of Forge that easly allows all of the cards you're listing to work.
If someone's interested I can put it on a svn branch.
Re: Restricted use mana
by friarsol » 16 May 2012, 16:43
Weren't you working with Arsenal to put it in? I thought that was already happening?FabioFLX wrote:Men, can I give my contribute to this topic?
I've done a testing release of Forge that easly allows all of the cards you're listing to work.
If someone's interested I can put it on a svn branch.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Restricted use mana
by ArsenalNut » 16 May 2012, 17:24
If you post a patch in this thread or check it into a branch, I'll get things merged together.friarsol wrote:Weren't you working with Arsenal to put it in? I thought that was already happening?FabioFLX wrote:Men, can I give my contribute to this topic?
I've done a testing release of Forge that easly allows all of the cards you're listing to work.
If someone's interested I can put it on a svn branch.
So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Re: Restricted use mana
by Max mtg » 16 May 2012, 18:50
Someone is very interested.FabioFLX wrote:If someone's interested I can put it on a svn branch.
Why haven't you commited it already into that branch?
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Restricted use mana
by FabioFLX » 17 May 2012, 08:03
Because, as I told some post ago, I don't know how to "commit it into a branch", I only have used SVN to download but never to upload before...Max mtg wrote:Someone is very interested.FabioFLX wrote:If someone's interested I can put it on a svn branch.
Why haven't you commited it already into that branch?

Re: Restricted use mana
by FabioFLX » 17 May 2012, 09:44
Ok, I found sort of a bug in my code.
When you use a <i>restricted</i> mana while casting a card and then you cancel the casting, the mana returned to the pool loses it's own previsious restrictions and can be used for anything.
I think that ManaPool class should contain only a ListArray of Mana instead of arrays of Colors. This may be the best choice from here to the future, because this allows us to put any kind of mana restriction just and only into the Mana class.
What do you think about?
When you use a <i>restricted</i> mana while casting a card and then you cancel the casting, the mana returned to the pool loses it's own previsious restrictions and can be used for anything.
I think that ManaPool class should contain only a ListArray of Mana instead of arrays of Colors. This may be the best choice from here to the future, because this allows us to put any kind of mana restriction just and only into the Mana class.
What do you think about?
Re: Restricted use mana
by ArsenalNut » 17 May 2012, 14:01
I am confused. The ManaPool already keeps an ArrayList of Mana objects i.e. floatingMana. ManaPool is the only class that creates Mana objects and all of the methods in Manapool add and remove Mana objects without creating new ones. It's not clear to me how your objects are losing their restrictions.FabioFLX wrote:Ok, I found sort of a bug in my code.
When you use a <i>restricted</i> mana while casting a card and then you cancel the casting, the mana returned to the pool loses it's own previsious restrictions and can be used for anything.
I think that ManaPool class should contain only a ListArray of Mana instead of arrays of Colors. This may be the best choice from here to the future, because this allows us to put any kind of mana restriction just and only into the Mana class.
What do you think about?
It would really help if you could share out the code base you're using. Is there something preventing you from posting a patch or checking it into a branch?
So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Re: Restricted use mana
by Max mtg » 17 May 2012, 14:49
1. Make a backup of your working copy (just in case)FabioFLX wrote:Because, as I told some post ago, I don't know how to "commit it into a branch", I only have used SVN to download but never to upload before...
2. In the folder context menu find "Tortoise SVN" => "Switch". Use the repo-broswer to point at the right branch
3. Update and merge, resolve all conflicts if there are any.
4. Commit with your forum account (if they gave you the right to do so)
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Restricted use mana
by Max mtg » 17 May 2012, 14:52
I agree. Moreover, ManaCost (which tracks the payment) should hold the mana items spent to pay it - so that they could be released into manapool intact.FabioFLX wrote:I think that ManaPool class should contain only a ListArray of Mana instead of arrays of Colors. This may be the best choice from here to the future, because this allows us to put any kind of mana restriction just and only into the Mana class.
What do you think about?
Taking it even further we'll need a mechanism to rollback game state to an earlier moment (to be able to undo phyrexian mana paid by life or mana gained from abilities that cost sacrifices)
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Restricted use mana
by FabioFLX » 17 May 2012, 15:14
Sure, it's true.Max mtg wrote:I agree. Moreover, ManaCost (which tracks the payment) should hold the mana items spent to pay it - so that they could be released into manapool intact.FabioFLX wrote:I think that ManaPool class should contain only a ListArray of Mana instead of arrays of Colors. This may be the best choice from here to the future, because this allows us to put any kind of mana restriction just and only into the Mana class.
What do you think about?
Taking it even further we'll need a mechanism to rollback game state to an earlier moment (to be able to undo phyrexian mana paid by life or mana gained from abilities that cost sacrifices)
At the moment, I'm using a copy() method I added to the ManaPool class that, in my opinion, could simplify handling of rollbacks.
Who is online
Users browsing this forum: No registered users and 65 guests