Page 1 of 2
X mana cost for creature abilities

Posted:
15 Oct 2010, 03:51
by gofishus
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.
Re: X mana cost for creature abilities

Posted:
15 Oct 2010, 11:01
by Sloth
Are you commiting under the name xitongzou? Did you find the answer or was the fix for Arashi, Sky Asunder something else, gofishus?
Re: X mana cost for creature abilities

Posted:
15 Oct 2010, 13:25
by Rob Cashwalker
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.
Re: X mana cost for creature abilities

Posted:
15 Oct 2010, 13:36
by gofishus
Thanks, I'll look into that. Yes that's my committer name, but that fix was for something else.
Re: X mana cost for creature abilities

Posted:
16 Oct 2010, 10:27
by Sloth
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.
Re: X mana cost for creature abilities

Posted:
16 Oct 2010, 13:38
by friarsol
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:
- 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.
Activating Zone will be a member variable of SpellAbility, and if it is not set, will default to Play/Battlefield. When super.canPlay() is called, instead of checking if the card is in play, it will check if it's in ActivatingZone.
I might take a crack at it this week.
Re: X mana cost for creature abilities

Posted:
16 Oct 2010, 15:01
by Sloth
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.
Re: X mana cost for creature abilities

Posted:
16 Oct 2010, 15:27
by gofishus
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.
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.
Re: X mana cost for creature abilities

Posted:
16 Oct 2010, 18:14
by Rob Cashwalker
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.
Re: X mana cost for creature abilities

Posted:
16 Oct 2010, 19:15
by Chris H.
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.

Re: X mana cost for creature abilities

Posted:
17 Oct 2010, 18:13
by friarsol
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.
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.
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.
Re: X mana cost for creature abilities

Posted:
17 Oct 2010, 21:39
by friarsol
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.

Chris, where is this wiki page you guys wrote up?
Re: X mana cost for creature abilities

Posted:
17 Oct 2010, 21:45
by Chris H.
Re: X mana cost for creature abilities

Posted:
19 Oct 2010, 04:59
by friarsol
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.
Re: X mana cost for creature abilities

Posted:
19 Oct 2010, 12:47
by Chris H.
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.