There are two ways to add to implement a card in Forge. One, you code it in Java. Two, you encode it using regular text, these types of cards are referred to as "scripted cards". Forge uses the file "cards.txt" to hold most of the card text, the text for most activated abilities is hardcoded elsewhere in Java.
OK, enough boring explanation, let me show you some examples from "cards.txt".
Tribal Instant Elf
Destroy target non-Elf creature.
The card Eyeblight's Ending was implemented in Forge by only the above text, no other programming was necessary. In case you can't figure out what spDestroyTgt, it means "spell destroy target".
Counter target spell unless its controller pays 2.
This card is implemented by both scripting and Java. The scripting adds the cycling ability and elsewhere in the program Java is used to implement the counter spell.
spDamageTgtOpp:5:Burning Fields deals 5 damage to target opponent.:Burning Fields - deals 5 damage
spDamageTgtOpp:7:Searing Flesh deals 7 damage to target opponent.:Searing Flesh - deals 7 damage
Scripting makes it easy to add multiple cards that do the same thing, like the two cards above.
The reason that these cards have the line "no text" is because that line of text is used for static abilities and sorceries/instants.
Kiss of Death
4 B B
spDamageTgtOpp:4:Drawback$YouGainLife/4:Kiss of Death deals 4 damage to target opponent. You gain 4 life.:Kiss of Death - deals 4 damage; you gain 4 life.
Scripting can become complicated.
2 R R
spDamageTgtOpp:Count$NumTypeYouCtrl.Mountain:Drawback$DamageYou/X.HalfUp:Eternal Flame deals X damage to target opponent where X is the number of mountains you control. It deals half X damage, rounded up, to you.:Eternal Flame - deals X damage and half X damage to you.
And scripting can become very complicated. I'm very impressed that such a complex card can be added so easily. (Easier than coding it in Java and easy only if you know how the spDamageTgtOpp keyword works.)
Scripting is very powerful and useful because it can be used to add many similar types of spells. Scripting is much shorter than using Java itself. Scripting is sort of "condensed Java" and is an example of a domain specific language, commonly referred as DSL.
Since scripting is such a fun topic, I'll be talking more about it on Wednesday. (Yes, I said that I wasn't going to post two times a week and I may not post next Wednesday but this Wednesday I’m going to post something.)
And I feel like I haven't injected enough humor into this article so I'll close by saying that scripting is better than chocolate covered bacon, hm....bacon. (I'm also a big Simpson fan.)
I haven't done any of the real work when it comes to scripting. Yes, I did create very simple keywords like haste and trample but nothing complicated. All of the credit goes to Dennis, Rob, and the other guys at the forums.
For more info on Forge's scripting please consult the forums. (Thankfully we have a forum so you can ask questions.) Thanks to huggybaby for providing a forum for Forge and other Magic projects.
And in case you are wondering, all mana costs in Forge have extra spaces in them, “3 W W ” versus “3WW” because it makes the coding easier. (The extra spaces makes the parsing very easy.)