Restricted use mana
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Restricted use mana
by ArsenalNut » 22 May 2012, 12:51
I wouldn't mind seeing how you approached the problem. Can you check it into a new branch?FabioFLX wrote:
So, you too noticed that the arrays in the ManaPool was redundant, and that the most of the problems about the mana restrictions came from the use of two different storages for the same information.
A simple "for" cycle for cards that have an Amount$ of produced mana greater that 1 should make the trick.
I had restrictions working without problems some days ago, but Saturday was my birthday and I had no time to work on the code since last friday. Should I discard my work or should it be usefull to post it anyway in some 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 FabioFLX » 22 May 2012, 15:20
ArsenalNut wrote:I wouldn't mind seeing how you approached the problem. Can you check it into a new branch?FabioFLX wrote:
So, you too noticed that the arrays in the ManaPool was redundant, and that the most of the problems about the mana restrictions came from the use of two different storages for the same information.
A simple "for" cycle for cards that have an Amount$ of produced mana greater that 1 should make the trick.
I had restrictions working without problems some days ago, but Saturday was my birthday and I had no time to work on the code since last friday. Should I discard my work or should it be usefull to post it anyway in some branch?

By the way, you know I have a working version with ugly-to-read code I can immediately upload.
Here it is: http://www.radiorock.org/flx/altro/file_linkati_altrove/forge.tar.bz2 . Releasing a patch from that kind of code is almost a pain!
The file contains just the src/mana/java/forge directory.
To use a restriction you can try adding "RestrictForType$ Artifact" to the mana ability parameters of a card.
Re: Restricted use mana
by Sloth » 22 May 2012, 16:35
Maybe i misunderstood what has happened, but i'm a little disappointed about the communication concerning this feature. Please correct me if i'm wrong.
@ArsenalNut: You should have made clear that you wanted to code this yourself. That would have saved FabioFLX some now unused work.
@FabioFLX: I hope you still want to contribute to this project. Better start with something small, non-debatable to get used to the SVN. See if someone feels responsible for/works on that part of the code. We have lots of uncovered/understaffed areas.
@ArsenalNut: You should have made clear that you wanted to code this yourself. That would have saved FabioFLX some now unused work.
@FabioFLX: I hope you still want to contribute to this project. Better start with something small, non-debatable to get used to the SVN. See if someone feels responsible for/works on that part of the code. We have lots of uncovered/understaffed areas.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Restricted use mana
by ArsenalNut » 22 May 2012, 17:10
You're right. I should have said I wanted to work it when FabioFLX first posted. I had been planning to rework the mana pool and add restrictions for some time.Sloth wrote:Maybe i misunderstood what has happened, but i'm a little disappointed about the communication concerning this feature. Please correct me if i'm wrong.
@ArsenalNut: You should have made clear that you wanted to code this yourself. That would have saved FabioFLX some now unused work.
@FabioFLX: I hope you still want to contribute to this project. Better start with something small, non-debatable to get used to the SVN. See if someone feels responsible for/works on that part of the code. We have lots of uncovered/understaffed areas.
@FabioFLX - Sorry, I should have communicated better and saved you some work.
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 FabioFLX » 22 May 2012, 18:19
Ohhh... Maybe it's I don't speak English as my main language, too.
No prob anyway, I'm here to contribute to Forge whatever the project may need
Well, so, which undercovered and/or understaffed areas need one to work in the most?
No prob anyway, I'm here to contribute to Forge whatever the project may need

Well, so, which undercovered and/or understaffed areas need one to work in the most?
Re: Restricted use mana
by Sloth » 22 May 2012, 19:46
A function that is long overdue for an update is getSpellCostChange. This function gets a spell/ability that should be played and returns its modified mana cost (by cards like Helm of Awakening).FabioFLX wrote:Ohhh... Maybe it's I don't speak English as my main language, too.
No prob anyway, I'm here to contribute to Forge whatever the project may need
Well, so, which undercovered and/or understaffed areas need one to work in the most?
Example of current script:
- Code: Select all
K:CostChange:All:Less:1:Spell:All:All:NoSpecial:Spells cost 1 less to cast.
First Draft:
- Code: Select all
S:Mode$ CostChange | Affected$ Card | Type$ Spell | Reduction$ 1
Some new cards that can be made possible: Not of This World, Spellwild Ouphe, Elderwood Scion, Dream Chisel, Locket of Yesterdays, Semblance Anvil, Exiled Doomsayer, Kaervek's Torch.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Restricted use mana
by ArsenalNut » 23 May 2012, 05:41
I think restricted use mana is ready for more widespread play testing. I have the following cards implemented
Altar of the Lost
Ancient Ziggurat
Cavern of Souls
Eldrazi Temple
Food Chain
Geosurge
Grand Architect
Metamorphosis
Mishra's Workshop
Myr Reservoir
Pillar of the Paruns
Primal Beyond
Rosheen Meanderer
Smokebraider
Soldevi Machinist
Somberwald Sage
Untaidake, the Cloud Keeper
Vedalken Engineer
It might be possible to do Ice Cauldron also. I could not do Adarkar Unicorn and Snowfall because I couldn't find an easy way to tell if the cost was a cumulative upkeep. I could not do Piracy either.
The pumping spells that were paid with certain mana needs more work before Boseiju, Who Shelters All and Hall of the Bandit Lord can be implemented.
Known issues
Restricted mana cannot be used to pay Multikicker and Suspend costs due to the way these are implemented in Forge. I tested Kicker, Evoke, Retrace, and Madness and restricted mana could be used for these alternative/additional costs. Mana restricted to casting creatures could not be used to pay Unearth either.
Here's a couple of changes to the behavior of mana sources and the mana pool that I noted. When paying a cost by selecting the mana source directly, the mana pool will use as much of the mana produced as it can to pay the cost. For instance if you click a Black Lotus to pay for a
spell, three green mana will be produced and all three will be used. When clicking the mana pool to pay, the mana color selected will always be subtracted one at time. Also there is no feedback when you try to pay a cost that does meet the mana restriction, the selection is just ignored.
Altar of the Lost
Ancient Ziggurat
Cavern of Souls
Eldrazi Temple
Food Chain
Geosurge
Grand Architect
Metamorphosis
Mishra's Workshop
Myr Reservoir
Pillar of the Paruns
Primal Beyond
Rosheen Meanderer
Smokebraider
Soldevi Machinist
Somberwald Sage
Untaidake, the Cloud Keeper
Vedalken Engineer
It might be possible to do Ice Cauldron also. I could not do Adarkar Unicorn and Snowfall because I couldn't find an easy way to tell if the cost was a cumulative upkeep. I could not do Piracy either.
The pumping spells that were paid with certain mana needs more work before Boseiju, Who Shelters All and Hall of the Bandit Lord can be implemented.
Known issues
Restricted mana cannot be used to pay Multikicker and Suspend costs due to the way these are implemented in Forge. I tested Kicker, Evoke, Retrace, and Madness and restricted mana could be used for these alternative/additional costs. Mana restricted to casting creatures could not be used to pay Unearth either.
Here's a couple of changes to the behavior of mana sources and the mana pool that I noted. When paying a cost by selecting the mana source directly, the mana pool will use as much of the mana produced as it can to pay the cost. For instance if you click a Black Lotus to pay for a


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 FabioFLX » 23 May 2012, 07:51
Ok, this is interesting.Sloth wrote:A function that is long overdue for an update is getSpellCostChange. This function gets a spell/ability that should be played and returns its modified mana cost (by cards like Helm of Awakening).FabioFLX wrote:Ohhh... Maybe it's I don't speak English as my main language, too.
No prob anyway, I'm here to contribute to Forge whatever the project may need
Well, so, which undercovered and/or understaffed areas need one to work in the most?
Example of current script:The plan is to convert this to be a static ability and use the modern scripting system.
- Code: Select all
K:CostChange:All:Less:1:Spell:All:All:NoSpecial:Spells cost 1 less to cast.
First Draft:If you agree to take a shot, I can set up a new class called StaticAbilityCostChange.java and hook it up. Both systems will work parallel. You can then convert the cards from the old system to the new system at your own pace.
- Code: Select all
S:Mode$ CostChange | Affected$ Card | Type$ Spell | Reduction$ 1
Some new cards that can be made possible: Not of This World, Spellwild Ouphe, Elderwood Scion, Dream Chisel, Locket of Yesterdays, Semblance Anvil, Exiled Doomsayer, Kaervek's Torch.
Should we open a new thread on the dev's corner to take this one clean, then?
So, when you're ready, set up that class please and I'll begin developing on it.
Cheers
Re: Restricted use mana
by ArsenalNut » 23 May 2012, 15:05
I merged the mana_restriction branch into the Trunk earlier today. The one thing I didn't test completely was the AI using mana from its mana pool. This doesn't happen very often in a the majority of games so it's hard to test. There was a quest that put a couple cards into play that added mana every turn and kept the mana pool from clearing. Can someone remind me what the two cards used in the quest are?
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 » 23 May 2012, 15:40
Upwelling and Eladamri's VineyardArsenalNut wrote:I merged the mana_restriction branch into the Trunk earlier today. The one thing I didn't test completely was the AI using mana from its mana pool. This doesn't happen very often in a the majority of games so it's hard to test. There was a quest that put a couple cards into play that added mana every turn and kept the mana pool from clearing. Can someone remind me what the two cards used in the quest are?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Restricted use mana
by timmermac » 24 May 2012, 14:41
Also, doesn't Omnath, Locus of Mana keep green mana in the pool permanently?friarsol wrote:Upwelling and Eladamri's VineyardArsenalNut wrote:I merged the mana_restriction branch into the Trunk earlier today. The one thing I didn't test completely was the AI using mana from its mana pool. This doesn't happen very often in a the majority of games so it's hard to test. There was a quest that put a couple cards into play that added mana every turn and kept the mana pool from clearing. Can someone remind me what the two cards used in the quest are?
"I just woke up, haven't had coffee, let alone a pee in 7 days, and I find out you stole my ass and made a ...mini-me! Carter, I should be irked currently, yes?" - Jack O'Neill
Re: Restricted use mana
by friarsol » 24 May 2012, 15:32
Yea but Arsenal was talking about two specific cards that a certain quest uses.timmermac wrote:Also, doesn't Omnath, Locus of Mana keep green mana in the pool permanently?
- 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 » 24 May 2012, 16:06
I was able to find a Game state file someone had posted when I was fixing bugs for the Any mana feature. The AI used the accumulated mana from Upwelling and Eladamri's Vineyard to cast several creatures so the mana pool changes appear to be working fine.friarsol wrote:Yea but Arsenal was talking about two specific cards that a certain quest uses.timmermac wrote:Also, doesn't Omnath, Locus of Mana keep green mana in the pool permanently?
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 Sloth » 03 Jul 2012, 20:55
I post it here even though i'm not sure it is related:
It seems the human player can no longer pay colorless hybrid mana (2/W) with off-color or colorless mana. I couldn't find any code that could possibly handle this. Does anyone know more about it?
It seems the human player can no longer pay colorless hybrid mana (2/W) with off-color or colorless mana. I couldn't find any code that could possibly handle this. Does anyone know more about it?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Restricted use mana
by ArsenalNut » 03 Jul 2012, 22:18
I think Max's ManaCost changes are the likely culprit. The changes were made at the same time I was working the restricted mana stuff. I haven't looked at his code changes in detail but I would start looking at the ManaCostShard class. I see a bunch of stuff in there with "OR_2_Colorless" in the name.Sloth wrote:I post it here even though i'm not sure it is related:
It seems the human player can no longer pay colorless hybrid mana (2/W) with off-color or colorless mana. I couldn't find any code that could possibly handle this. Does anyone know more about it?
So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Who is online
Users browsing this forum: No registered users and 17 guests