Page 1 of 1

coding question.

PostPosted: 14 Jun 2010, 15:17
by Greyswandir
hey guys, im new to the forums here, and new to Forge in general. I love mtg, and i am trying to take some java classes at the college and hoping one day to help out here

In regards to the card.txt file; If the keywords are already created, can i just add a card to card.txt or would i have to have done something in the cardfactory as well, or whatever else needs to be done?

example: Talon Sliver and Spitting Sliver.

Talon Sliver
1 W
Creature Sliver
All sliver creatures have first strike.
1/1

Spitting Sliver
4 B
Creature Sliver
All sliver creatures have first strike.
3/3
--------------------------
Talon Sliver is already in Forge. I add Spitting Sliver to the card.txt file, using Talon sliver as a template. I test Spitting sliver but its effects do not work( it receives "all sliver have" abilities from the other slivers, but does not give the other ones its.)They have identical abilities so im just confused as to if im missing something really small, or something else that is not in my control to solve without plugging in some actual java code in another file.

Thanks for your time and responses.

Re: coding question.

PostPosted: 14 Jun 2010, 15:48
by Hellfish
Hi, Greyswandir (My memory is not that great but I think I recognize that moniker) and welcome!

Many cards can be added with just entries in cards.txt, you can check out the big sticky thread in this forum to see if you can combine any the keywords that are in Forge already. Otherwise, yes, one has to add additional code to the proper cardfactory. In cards.txt, the keywords for each additional entry comes at the very end of a block. The text right after the type(unless that text is "no text", of course :)) is just the oracle text verbatim, for just cards that use specific additional code.

In this specific example, Talon Sliver currently works off of some specific code in GameActionUtil and StaticEffects. [I was going to write here that it could do with the spAllPump keyword but I realized that keywords restrictions doesn't cover subtypes :oops: ] but, as it looks to me, very little has to be changed.

Re: coding question.

PostPosted: 14 Jun 2010, 16:59
by Chris H.
Greyswandir wrote:hey guys, im new to the forums here, and new to Forge in general. I love mtg, and i am trying to take some java classes at the college and hoping one day to help out here

In regards to the card.txt file; If the keywords are already created, can i just add a card to card.txt
`
Glad to meet you. The general format for the info in cards.txt is:

1) Card Name
2) Mana Cost (or "no cost" if land)
3) Card Types
4) text string which is displayed in the text panel
5) Power/Toughness if creature
The keywords all come after the above info


As an example, here is a card (with no keywords) that was just added:

    Dwarven Demolition Team
    2 R
    Creature Dwarf
    no text
    1/1


Here is an example of a coule of cards with keywords:

    Karplusan Forest
    no cost
    Land
    no text
    tap: add 1
    paintap:1:R
    paintap:1:G

    Eternal Dragon
    5 W W
    Creature Dragon Spirit
    no text
    5/5
    Flying
    TypeCycling:Plains:2

    Kjeldoran War Cry
    1 W
    Instant
    no text
    spAllPump:YouCtrl:+X/+X:Creatures you control get +X/+X until end of turn, where X is 1 plus the number of cards named Kjeldoran War Cry in all graveyards.:Kjeldoran War Cry - Creatures get +X/+X until EOT
    SVar:X:Count$NamedInAllYards.Kjeldoran War Cry/Plus.1

Re: coding question.

PostPosted: 14 Jun 2010, 20:24
by Rob Cashwalker
In the case of the Slivers, those cards use additional code to grant the abilities, I believe in GameActionUtil.

There is an extensive list of keyworded abilities, (spPumpTgt) effects (When CARDNAME enters the battlefield, draw a card.) and properties. (Trample) Check out Chris' Keyword list post for details. We don't have everything covered there, but we're getting closer.

Re: coding question.

PostPosted: 14 Jun 2010, 21:53
by mtgrares
Most of the card code is in one of the CardFactory classes. State effects like Slivers and Glorious Anthem are implemented in GameActionUtil.checkStateEffects(). And the card's basic info must be put into cards.txt