It is currently 14 Sep 2025, 15:17
   
Text Size

Restricted use mana

Post MTG Forge Related Programming Questions Here

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

Re: Restricted use mana

Postby Max mtg » 16 May 2012, 14:09

friarsol wrote:
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?
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?
I'm afraid we'll need both.

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

Postby FabioFLX » 16 May 2012, 14:21

Max mtg wrote:
friarsol wrote:
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?
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?
I'm afraid we'll need both.

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?).
At the moment the version I'm working on allows playing cards like Somberwald Sage.
Myr Superion is easly implementable, and at first sting Cavern of Souls sholud too.
User avatar
FabioFLX
 
Posts: 78
Joined: 27 Sep 2011, 13:08
Has thanked: 4 times
Been thanked: 7 times

Re: Restricted use mana

Postby friarsol » 16 May 2012, 14:32

Max mtg wrote:Myr Superion accepts only mana produced by creatures (mana in pool should know which card produced it, should not it?).
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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Restricted use mana

Postby 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
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Restricted use mana

Postby friarsol » 16 May 2012, 16:00

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?
Not that I know of or could find via searching.

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

Postby 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.
User avatar
FabioFLX
 
Posts: 78
Joined: 27 Sep 2011, 13:08
Has thanked: 4 times
Been thanked: 7 times

Re: Restricted use mana

Postby friarsol » 16 May 2012, 16:43

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.
Weren't you working with Arsenal to put it in? I thought that was already happening?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Restricted use mana

Postby ArsenalNut » 16 May 2012, 17:24

friarsol wrote:
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.
Weren't you working with Arsenal to put it in? I thought that was already happening?
If you post a patch in this thread or check it into a branch, I'll get things merged together.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Restricted use mana

Postby Max mtg » 16 May 2012, 18:50

FabioFLX wrote:If someone's interested I can put it on a svn branch.
Someone is very interested.
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

Postby FabioFLX » 17 May 2012, 08:03

Max mtg wrote:
FabioFLX wrote:If someone's interested I can put it on a svn branch.
Someone is very interested.
Why haven't you commited it already into that branch?
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... :oops:
User avatar
FabioFLX
 
Posts: 78
Joined: 27 Sep 2011, 13:08
Has thanked: 4 times
Been thanked: 7 times

Re: Restricted use mana

Postby 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?
User avatar
FabioFLX
 
Posts: 78
Joined: 27 Sep 2011, 13:08
Has thanked: 4 times
Been thanked: 7 times

Re: Restricted use mana

Postby ArsenalNut » 17 May 2012, 14:01

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

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
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Restricted use mana

Postby Max mtg » 17 May 2012, 14:49

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... :oops:
1. Make a backup of your working copy (just in case)
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

Postby Max mtg » 17 May 2012, 14:52

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

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

Postby FabioFLX » 17 May 2012, 15:14

Max mtg wrote:
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?
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.

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)
Sure, it's true.
At the moment, I'm using a copy() method I added to the ManaPool class that, in my opinion, could simplify handling of rollbacks.
User avatar
FabioFLX
 
Posts: 78
Joined: 27 Sep 2011, 13:08
Has thanked: 4 times
Been thanked: 7 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 34 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 34 users online :: 0 registered, 0 hidden and 34 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 34 guests

Login Form