It is currently 30 Oct 2025, 14:53
   
Text Size

X mana cost for creature abilities

Post MTG Forge Related Programming Questions Here

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

X mana cost for creature abilities

Postby 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

Postby 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?
User avatar
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

Postby 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.
The Force will be with you, Always.
User avatar
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

Postby 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

Postby 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.
User avatar
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

Postby 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:
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.
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

Postby 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.
User avatar
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

Postby gofishus » 16 Oct 2010, 15:27

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.
gofishus
 
Posts: 34
Joined: 09 Oct 2010, 04:57
Has thanked: 0 time
Been thanked: 0 time

Re: X mana cost for creature abilities

Postby 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.
The Force will be with you, Always.
User avatar
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

Postby 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. :D
User avatar
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

Postby friarsol » 17 Oct 2010, 18:13

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

Postby friarsol » 17 Oct 2010, 21:39

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. :D
Chris, where is this wiki page you guys wrote up?
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

Postby Chris H. » 17 Oct 2010, 21:45

User avatar
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

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

Postby 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. :D

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.
User avatar
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

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 21 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 21 users online :: 0 registered, 0 hidden and 21 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 21 guests

Login Form