Wednesday, May 21, 2008

New Version - Details

Zip Version – Java jar for all operating systems, also includes the Windows executable in case you don’t want to run the installer

-The Java source code is included
-In order to keep your decks, save the file “all-decks2”)
-I forgot to make the Windows installer. I'll do it soon.

Thanks (again) to Rob Cashwalker for the 250 new creatures. They were added by the miracle of “cards.txt.” This file has a simple format but it allows new creatures to be easily defined. The creatures are simple and don’t have any activated abilities. Cards.txt supports about 10 keywords, like flying, vigilance, haste, and mana abilities. (Technically a mana ability is an activated ability, but you understand what I’m saying.) Currently cards.txt doesn’t support instants/sorceries yet. The file just holds the text that the spell displays, but none of the functionality. CardFactory makes all of the cards and adds their effects.

With this influx of creatures, I had to balance a few things out. The “generate deck” option for constructed will have at least 10 non-creature spells while sealed will at least 6. (The land counts for the generated decks are 26 for constructed and 18 for sealed, the lands are evenly divided between the two colors.)

I also balanced out the code that generated the booster packs for sealed and draft. They have a 60/40 percent ratio of creatures and non-creatures. I don’t know if this ratio is similar to real life booster packs. The colors for each booster pack were also smoothed out. Every time a card is chosen for a booster pack, a subset of 5 cards is generated, one for each color. Then one card is chosen from the subset. This ensures that each color has a fair chance.

The colors distribution should be very consistent compared to real life. To read how the booster packs are created, look at the Java object ReadBoosterPack. It uses the files “common.txt”, “uncommon.txt”, and “rare.txt” to generate a pack.

This is an example of cards.txt. The “no text” line is used for spells and creatures that have static abilities like Castle Raptors (as long as Castle Raptors is untapped, it gets +0/+2). The static ability is then implemented by GameActionUtil.executeCardStateEffects(). Birds of Paradise looks weird but each “keyword” goes on a separate line.

Alpha Myr
Artifact Creature Myr
no text

Rorix Bladewing
3 R R R
Legendary Creature Dragon
no text

Mox Emerald
no text
tap: add G

Birds of Paradise
Creature Bird
no text
tap: add W
tap: add B
tap: add U
tap: add R
tap: add G

No comments: