CardUtil.getCardTypes and related functions
 Posted: 13 May 2011, 16:29
Posted: 13 May 2011, 16:29I just pulled down r.8605 and have an error listed trying to resolve CardUtil.getCardTypes().
Well isn't this interesting... the reason I was opening the code was to find a place to insert the Mistform Ultimus list Wizards posted yesterday. So that whenever we would prompt for a creature type, it could be selected from a list instead of free-form.
I had been planning to throw it into the Constants object, but CardUtil could work too. I think those is__Type functions could be more elegant and faster, if the types were defined in arrays, and the function iterated through the type lists returning true as soon as it matched.
Since CardUtil will be updated soon, I hope, here's my revision to the isCreatureType method:
			Well isn't this interesting... the reason I was opening the code was to find a place to insert the Mistform Ultimus list Wizards posted yesterday. So that whenever we would prompt for a creature type, it could be selected from a list instead of free-form.
I had been planning to throw it into the Constants object, but CardUtil could work too. I think those is__Type functions could be more elegant and faster, if the types were defined in arrays, and the function iterated through the type lists returning true as soon as it matched.
Since CardUtil will be updated soon, I hope, here's my revision to the isCreatureType method:
- Code: Select all
- public static String creatureTypes[] = {"Advisor", "Ally", "Angel", "Anteater", "Antelope",
 "Ape", "Archer", "Archon", "Artificer", "Assassin",
 "Assembly-Worker", "Atog", "Aurochs", "Avatar",
 "Badger", "Barbarian", "Basilisk", "Bat", "Bear",
 "Beast", "Beeble", "Berserker", "Bird", "Blinkmoth",
 "Boar", "Bringer", "Brushwagg", "Camarid", "Camel",
 "Caribou", "Carrier", "Cat", "Centaur", "Cephalid",
 "Chimera", "Citizen", "Cleric", "Cockatrice", "Construct",
 "Coward", "Crab", "Crocodile", "Cyclops", "Dauthi",
 "Demon", "Deserter", "Devil", "Djinn", "Dragon", "Drake",
 "Dreadnought", "Drone", "Druid", "Dryad", "Dwarf",
 "Efreet", "Elder", "Eldrazi", "Elemental", "Elephant",
 "Elf", "Elk", "Eye",
 "Faerie", "Ferret", "Fish", "Flagbearer", "Fox", "Frog",
 "Fungus",
 "Gargoyle", "Germ", "Giant", "Gnome", "Goat", "Goblin",
 "Golem", "Gorgon", "Graveborn", "Gremlin", "Griffin",
 "Hag", "Harpy", "Hellion", "Hippo", "Hippogriff",
 "Homarid", "Homunculus", "Horror", "Horse", "Hound",
 "Human", "Hydra", "Hyena",
 "Illusion", "Imp", "Incarnation", "Insect",
 "Jellyfish", "Juggernaut",
 "Kavu", "Kirin", "Kithkin", "Knight", "Kobold", "Kor",
 "Kraken",
 "Lammasu", "Leech", "Leviathan", "Lhurgoyf", "Licid",
 "Lizard",
 "Manticore", "Masticore", "Mercenary", "Merfolk",
 "Metathran", "Minion", "Minotaur", "Monger", "Mongoose",
 "Monk", "Moonfolk", "Mutant", "Myr", "Mystic",
 "Nautilus", "Nephilim", "Nightmare", "Nightstalker", "Ninja",
 "Noggle", "Nomad",
 "Octopus", "Ogre", "Ooze", "Orb", "Orc", "Orgg", "Ouphe",
 "Ox", "Oyster",
 "Pegasus", "Pentavite", "Pest", "Phelddagrif", "Phoenix",
 "Pincher", "Pirate", "Plant", "Praetor", "Prism",
 "Rabbit", "Rat", "Rebel", "Reflection", "Rhino", "Rigger",
 "Rogue",
 "Salamander", "Samurai", "Sand", "Saproling", "Satyr",
 "Scarecrow", "Scorpion", "Scout", "Serf", "Serpent", "Shade",
 "Shaman", "Shapeshifter", "Sheep", "Siren", "Skeleton",
 "Slith", "Sliver", "Slug", "Snake", "Soldier", "Soltari",
 "Spawn", "Specter", "Spellshaper", "Sphinx", "Spider",
 "Spike", "Spirit", "Splinter", "Sponge", "Squid", "Squirrel",
 "Starfish", "Surrakar", "Survivor",
 "Tetravite", "Thalakos", "Thopter", "Thrull", "Treefolk",
 "Triskelavite", "Troll", "Turtle",
 "Unicorn",
 "Vampire", "Vedalken", "Viashino", "Volver",
 "Wall", "Warrior", "Weird", "Whale", "Wizard", "Wolf",
 "Wolverine", "Wombat", "Worm", "Wraith", "Wurm",
 "Yeti",
 "Zombie", "Zubera"};
 // Check if a Type is a Creature Type (by excluding all other types)
 public static boolean isACreatureType(String cardType) {
 //return (!isACardType(cardType) && !isASuperType(cardType) && !isALandType(cardType)
 // && !cardType.equals("Arcane") && !cardType.equals("Trap")
 // && !cardType.equals("Aura") && !cardType.equals("Shrine")
 // && !cardType.equals("Equipment") && !cardType.equals("Fortification"));
 for (int i=0; i<creatureTypes.length; i++)
 if (creatureTypes[i].equals(cardType))
 return true;
 
 return false;
 }
