Page 1 of 1

Programming New Cards

PostPosted: 07 Sep 2010, 01:49
by mastermindg
I'd like to put some time in here to program new cards for Forge. It's not completely selfish since I'll be working on my cards first :mrgreen: , but I wouldn't be opposed to working on other requests once I'm done with mine.

I've got the SVN pulled up in Eclipse. I've compiled the jar so I know everything works so far. How do I go about adding new cards? Where should I start?

Re: Programming New Cards

PostPosted: 07 Sep 2010, 03:14
by Rob Cashwalker
Depends on exactly what kind of card you're looking to create.

Are there any cards in Forge already that are related or kinda sorta do similar things to the cards you're looking for? If it's a creature, search through CardFactory_Creature for the example code.
Most triggered abilities, upkeep actions and static effects are handled in GameActionUtility.

If the ability/effect is somewhat common or is a particular mechanic which is applicable to many cards, (existing or future) then it would be beneficial to create a keyword parser, like the first half of CardFactory.

Re: Programming New Cards

PostPosted: 07 Sep 2010, 03:32
by DennisBergkamp
Yes, I think the best places to start looking are the CardFactories (CardFactory, CardFactory_Creatures, CardFactory_Sorceries, ... ) and of course cards.txt.

Re: Programming New Cards

PostPosted: 07 Sep 2010, 12:14
by Chris H.
Examine the cards.txt file first. Every card has a record with some important data for each of the cards that have been implemented. Card name, casting cost, power/toughness, etc.

You will notice that many of the card records include keywords and some of these keywords include additional data. Check this message for a list of our keywords: Keywords recognized by Forge.

Most of the card specific code can be found in the CardFactory files. There is card specific code located elsewhere. It helps to use your file system's "search by file's content" search system. This will help you to find what you are looking for. If you get lost you can always ask a question here and someone should be able to guide you.

Re: Programming New Cards

PostPosted: 07 Sep 2010, 13:22
by Rob Cashwalker
eclipse can also search through the files in the project.

Re: Programming New Cards

PostPosted: 07 Sep 2010, 13:55
by Chris H.
Rob Cashwalker wrote:eclipse can also search through the files in the project.
`
Thank you for that hint. I never looked into the Eclipse Search command before. This is an improvement over OS based searches.

Re: Programming New Cards

PostPosted: 07 Sep 2010, 14:57
by Rob Cashwalker
Yep. It has a few search functions.

There's the Ctrl-F find in the editor.

There's a File search, which you can specify *.java for example and it searches just those files. I use this all the time. The results show up on the bottom panel, or wherever the console view is attached.

There's also a Java search, which seems like it should do something similar, but I don't get the results I expect.

Re: Programming New Cards

PostPosted: 07 Sep 2010, 16:04
by silly freak
i use the java search indirectly quite often, through the "find references" function. just select a class or method name and press F3, and eclipse finds everywhere it is used