coding question.
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
5 posts
• Page 1 of 1
coding question.
by Greyswandir » 14 Jun 2010, 15:17
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.
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.
- Greyswandir
- Posts: 1
- Joined: 14 Jun 2010, 12:51
- Has thanked: 0 time
- Been thanked: 0 time
Re: coding question.
by Hellfish » 14 Jun 2010, 15:48
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
] but, as it looks to me, very little has to be changed.
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

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

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: coding question.
by Chris H. » 14 Jun 2010, 16:59
`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
-
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: coding question.
by Rob Cashwalker » 14 Jun 2010, 20:24
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.
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.
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: coding question.
by mtgrares » 14 Jun 2010, 21:53
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
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: Bing [Bot] and 35 guests