X mana cost for creature abilities
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
16 posts
• Page 1 of 2 • 1, 2
X mana cost for creature abilities
by gofishus » 15 Oct 2010, 03:51
Having trouble implementing Arashi, the Sky Asunder because for it's ability, there's two methods that need to be called before the ability is activated: one to target a creature and one to set an X mana cost for the ability. Trouble is, when I test this, only one of the methods get executed... for example it only asks me to target a creature, the asking for X method never shows up. I called ability.setBeforePayMana() for both methods... can a more knowledgeable developer help me out here? thanks.
- gofishus
- Posts: 34
- Joined: 09 Oct 2010, 04:57
- Has thanked: 0 time
- Been thanked: 0 time
Re: X mana cost for creature abilities
by Sloth » 15 Oct 2010, 11:01
Are you commiting under the name xitongzou? Did you find the answer or was the fix for Arashi, Sky Asunder something else, gofishus?
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: X mana cost for creature abilities
by Rob Cashwalker » 15 Oct 2010, 13:25
There can only be one BeforePayMana - the last one applied over-writes the previous.
Try to use Ability_Cost and the Target class in order to properly handle costs and targeting in the proper order.
Try to use Ability_Cost and the Target class in order to properly handle costs and targeting in the proper order.
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: X mana cost for creature abilities
by gofishus » 15 Oct 2010, 13:36
Thanks, I'll look into that. Yes that's my committer name, but that fix was for something else.
- gofishus
- Posts: 34
- Joined: 09 Oct 2010, 04:57
- Has thanked: 0 time
- Been thanked: 0 time
Re: X mana cost for creature abilities
by Sloth » 16 Oct 2010, 10:27
Don't bother too much with the first activated ability of Arashi, the Sky Asunder. It can be done with AB$DealDamage (i think). The Channel ability is tricky though.
Some things I noted in your submitted cards gofishus:
- The wording is not up to date. Please use the actual Oracle wording. Even your creature types are outdated (example: Thalakos Drifters is no longer a Townsfolk).
- Some of the cards are not well usable by the AI. So don't forget to add "SVar:RemAIDeck:True", so they won't appear in random decks.
- Make sure that cards you want to hardcode are not keywordable. (example: Thalakos Drifters again). The effort is wasted.
Some things I noted in your submitted cards gofishus:
- The wording is not up to date. Please use the actual Oracle wording. Even your creature types are outdated (example: Thalakos Drifters is no longer a Townsfolk).
- Some of the cards are not well usable by the AI. So don't forget to add "SVar:RemAIDeck:True", so they won't appear in random decks.
- Make sure that cards you want to hardcode are not keywordable. (example: Thalakos Drifters again). The effort is wasted.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: X mana cost for creature abilities
by friarsol » 16 Oct 2010, 13:38
I have an idea for doing the Channel ability. I had been thinking about it for a while, and it's mostly based around the parameter mapping of the new AbilityFactory code. But it should be flexible enough to work for lots of things besides Channel.
Basically it would look like this:
I might take a crack at it this week.
Basically it would look like this:
- Code: Select all
A:AB$DealDamageAll|Cost$X G G Discard<1/CARDNAME>|ValidType$Creature.withFlying|NumDmg$X|ActivatingZone$Hand|SpellDescription$Arashi deals X damage to each creature with flying.
I might take a crack at it this week.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: X mana cost for creature abilities
by Sloth » 16 Oct 2010, 15:01
The ability factory structure has proven itself to be invaluable. Thanks for this masterpiece Sol and Rob!
Reinforce, Cycling and Forecast can also be implemented if Channel works like this.
With ActivatingZone$Graveyard Retrace (and maybe Flashback and Unearth) are possible too.
Reinforce, Cycling and Forecast can also be implemented if Channel works like this.
With ActivatingZone$Graveyard Retrace (and maybe Flashback and Unearth) are possible too.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: X mana cost for creature abilities
by gofishus » 16 Oct 2010, 15:27
Yes I will update, but I noticed the Forge keyword thread is not up to date/comprehensive? It would be nice to have an API-like thread where keywords are shown and examples on how to use them are there too. (the way the current thread does it is clunky, linking to other threads, and lots of keyword examples not shown) A wiki would be better in my opinion.Sloth wrote:Don't bother too much with the first activated ability of Arashi, the Sky Asunder. It can be done with AB$DealDamage (i think). The Channel ability is tricky though.
Some things I noted in your submitted cards gofishus:
- The wording is not up to date. Please use the actual Oracle wording. Even your creature types are outdated (example: Thalakos Drifters is no longer a Townsfolk).
- Some of the cards are not well usable by the AI. So don't forget to add "SVar:RemAIDeck:True", so they won't appear in random decks.
- Make sure that cards you want to hardcode are not keywordable. (example: Thalakos Drifters again). The effort is wasted.
- gofishus
- Posts: 34
- Joined: 09 Oct 2010, 04:57
- Has thanked: 0 time
- Been thanked: 0 time
Re: X mana cost for creature abilities
by Rob Cashwalker » 16 Oct 2010, 18:14
The Ability factory stuff isn't final yet.. we're still testing it.
I don't think Arashi can be done with DealDamage. It may not take the isValid style of targeting restrictions. It also doesn't deal with "All" yet.
I don't think Arashi can be done with DealDamage. It may not take the isValid style of targeting restrictions. It also doesn't deal with "All" yet.
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: X mana cost for creature abilities
by Chris H. » 16 Oct 2010, 19:15
`gofishus wrote:Yes I will update, but I noticed the Forge keyword thread is not up to date/comprehensive? It would be nice to have an API-like thread where keywords are shown and examples on how to use them are there too. (the way the current thread does it is clunky, linking to other threads, and lots of keyword examples not shown) A wiki would be better in my opinion.
The forge keyword topic started when we only had a few dozen really simple keywords. Things were much simpler back then.
Forge has a wiki page. I and Silly Freak added some basic info but the two of us were not able to keep it up. It would be nice if someone with both wiki and java skills were to step forward to do this work.
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: X mana cost for creature abilities
by friarsol » 17 Oct 2010, 18:13
Right this can't quite be done yet. I was going to try to get the Activating Zone stuff working on something that would already exist, and be a simpler test case.Rob Cashwalker wrote:I don't think Arashi can be done with DealDamage. It may not take the isValid style of targeting restrictions. It also doesn't deal with "All" yet.
DealDamageAll probably should be a separate function than just DealDamage since the AI would be handled completely differently, and obviously the resolve handling is different. I think any of those related functions can live in the same class for organization purposes.
But I agree with Sloth, the base work for AbilityFactory is working great so far and makes the sub-classes extremely simple and easy to write, since any complex parsing is already handled.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: X mana cost for creature abilities
by friarsol » 17 Oct 2010, 21:39
Chris, where is this wiki page you guys wrote up?Chris H. wrote:Forge has a wiki page. I and Silly Freak added some basic info but the two of us were not able to keep it up. It would be nice if someone with both wiki and java skills were to step forward to do this work.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: X mana cost for creature abilities
by Chris H. » 17 Oct 2010, 21:45
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: X mana cost for creature abilities
by friarsol » 19 Oct 2010, 04:59
Alright. I updated the main page, and a fair amount of info into an API section. It's not completed yet, and I didn't pull all of the keywords in yet. I'll add some more tomorrow so it can be full fleshed. Maybe for some of the more complex abilities, we can get someone who wrote it, or is familiar to flesh out the doc portion for it. We may want to split up the API page into different pages, but we can figure that out as we go along.Chris H. wrote:http://www.slightlymagic.net/wiki/MTG_Forge
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: X mana cost for creature abilities
by Chris H. » 19 Oct 2010, 12:47
`friarsol wrote:Alright. I updated the main page, and a fair amount of info into an API section. It's not completed yet, and I didn't pull all of the keywords in yet. I'll add some more tomorrow so it can be full fleshed. Maybe for some of the more complex abilities, we can get someone who wrote it, or is familiar to flesh out the doc portion for it. We may want to split up the API page into different pages, but we can figure that out as we go along.
Thank you Sol, it looks better now.
I think that Huggybaby created the Forge wiki. The CCGH wiki has a link to the forge wiki. At first, the forge wiki was an empty wiki page. I pasted several paragraphs that I borrowed from one of Rares doc files.
Silly Freak created a couple of wiki pages with some programming info and the link at the bottom of the page will transfer people to his work.
-

Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
16 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 21 guests