Card scripting is cool. Instead of having to program cards using Java, which is usually very long and over 100 lines of code, card scripting is shockingly short. Probably 95% of all cards in Forge are scripted.
To look at a specific card’s scripting: first go to the forge folder, then res, then cardsfolder, and unzip “cardsfolder.zip”. Cards like Jace, the Mind Sculptor do not have any scripting and the text file only holds basic information about the card such as its name, cost, card types and starting loyalty.
Shock is always my favorite example.
Name:Shock
ManaCost:R
Types:Instant
Text:no text
A:SP$ DealDamage | Cost$ R | Tgt$ TgtCP | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to target creature or player.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/shock.jpg
SetInfo:8ED|Common|http://magiccards.info/scans/en/8e/222.jpg
SetInfo:7ED|Common|http://magiccards.info/scans/en/7e/219.jpg
SetInfo:STH|Common|http://magiccards.info/scans/en/sh/98.jpg
SetInfo:9ED|Common|http://magiccards.info/scans/en/9e/220.jpg
SetInfo:10E|Common|http://magiccards.info/scans/en/10e/232.jpg
SetInfo:6ED|Common|http://magiccards.info/scans/en/6e/206.jpg
SetInfo:M12|Common|http://magiccards.info/scans/en/m12/154.jpg
SetInfo:ONS|Common|http://magiccards.info/scans/en/on/227.jpg
Oracle:Shock deals 2 damage to target creature or player.
End
Obviously there is a fair about of information here such set information, where each card picture is located as well as its rarity.
A:SP$ DealDamage | Cost$ R | Tgt$ TgtCP | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to target creature or player.
This is the “scripting” part that creates the card Shock. The scripting restricts the targets to creatures or players, specifies the mana cost, and has some text to show the player.
My 2nd favorite example is Elvish Piper. He isn’t a powerhouse but he is a fun card to use.
Name:Elvish Piper
ManaCost:3 G
Types:Creature Elf Shaman
A:AB$ ChangeZone | Cost$ G T | Origin$ Hand | Destination$ Battlefield | ChangeType$ Creature | ChangeNum$ 1 | SpellDescription$ You may put a creature card from your hand onto the battlefield.
PT:1/1
SVar:Rarity:Rare
Elvish Piper’s activated ability is far more complicated than Shock’s. The cost is listed as “G T” which seems to mean “1 green mana” and “tap this card”. “Origin$ Hand” means that the creature card is taken from the player’s hand.
Name:Shivan Dragon
ManaCost:4 R R
Types:Creature Dragon
PT:5/5
K:Flying
A:AB$ Pump | Cost$ R | NumAtt$ +1 | SpellDescription$ CARDNAME gets +1/+0 until end of turn.
Shivan Dragon’s pump ability is a common effect, “R: Shivan Dragon getes +1/+0 until end of turn”. Any card with a similar ability can be scripted as well.
Name:Shivan Meteor
ManaCost:3 R R
Types:Sorcery
A:SP$ DealDamage | Cost$ 3 R R | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ 13 | SpellDescription$ CARDNAME deals 13 damage to target creature.
K:Suspend:2:1 R R
Shivan Meteor is fairly straightforward except that it also has suspend. Shivan Meteor regularly costs 3RR but can be suspended (and played) in 2 turns for 1RR. The scripting for suspend is simple since other parts of Forge handle the actual implementation.
Name:Akroma, Angel of Wrath
ManaCost:5 W W W
Types:Legendary Creature Angel
PT:6/6
K:Flying
K:Vigilance
K:First Strike
K:Trample
K:Haste
K:Protection from red
K:Protection from black
SVar:Rarity:Rare
Even though Akroma has a ton of text, all of the text is standard keywords. Cards with activated abilities require more scripting than Akroma.
Name:Day of Judgment
ManaCost:2 W W
Types:Sorcery
A:SP$ DestroyAll | Cost$ 2 W W | ValidCards$ Creature | SpellDescription$ Destroy all creatures.
Name:Wrath of God
ManaCost:2 W W
Types:Sorcery
A:SP$ DestroyAll | Cost$ 2 W W | ValidCards$ Creature | NoRegen$ True | SpellDescription$ Destroy all creatures. They can't be regenerated.
Obviously these two cards are almost clones of each other. Wrath of God is slightly more powerful because creatures can’t regenerate. Obviously Wizards of the Coast thought that Wrath of God was unbalanced and then created Day of Judgment. The Wrath of God scripting includes “NoRegen$ True” which is a minor point but very important. Since Wrath of God is scripted, its mirror Damnation is also scripted and has a different mana cost of 2BB.
Scripting is great and it allows non-programmers to add new cards. The scripting has gotten more complicated and is now a “little language” that does one thing well: create Magic cards.
Average blogger,
mtgrares
p.s.
Eons long ago while I playing Magic Online, I remember using my Elvish Piper to play Darksteel Colossus (11, 11/11, creature, indestructible, trample). Because they were expensive cards, I only had one copy of each card so I was very happy when I actually got to use them. :+)
Monday, January 2, 2012
Subscribe to:
Post Comments (Atom)
8 comments:
This is very enlightening information! Why, it's so simple I can add some cards on my own! And I finally understand why some cards are missing, and why they are so hard to implement.
Specifically, I would REALLY like to see Paradox Haze in Forge, since it's a card I enjoy the heck out of in real life. Since there already is a way to grant multiple turns to players in Forge, shouldn't granting extra phases be a similar process?
I have to say one of my favorite cards is Elvish Piper. Ever since I discovered Forge, I've been using her to play Eldrazi. I don't have the means to acquire these cards in real life, so I enjoy using them in Forge all the more.
small point, I know most elves look a bit girly but I'm prity sure Elvish Piper is a she.
I was thinking of the 8th edition Elvish Piper, which is a dude :)
Hello Forge developers :)
I just want to congratulate you for this fine game. It's amazing and really well done, I have so much fun with it. Also, I don't know if this is the proper place/section to talk about this topic and if not please forgive me; just to share the idea of allowing Sideboards in the deck construction and the possibility to use them in 2nd & 3rd game. I just think sideboarding is also a MTG skill that must be mastered. Keep on the good work guys!
Sebastian, from Argentina
The term card scripting is absolutely new to me and I can say that Java is again in action. If you are new to programming and willing to learn more about programming, I will recommend you to visit programming forum, the perfect way to learn more.
Thanks for such informative post. i was looking for it from last 2-3 months. You make my task easy, I’m so happy to have your blog. Thanks a lot, keep on like that. From now I’m a regular user of your blog.
As i visited this website for the first time, I found this blog quite interesting. Thanks..
Hi, this is impressive post. I wish to develop my own card games but I always wonder how the developer actually program the card effects. Since there are so many different cards.
I hope you can write some in depth tutorial about how it works?
If you don't mind I hope you could email me so I that I can get help from you easily instead of keep on posting comments here.
cadrick_loh@hotmail.com
Kindly looking forward for your replies :)
Post a Comment