- Minor refactor of "transforms" ability

- Updated changeling and transforms to only get creature types (as initially intended by the code), removed hardcoded list of "types to avoid"

The test suite passes
This commit is contained in:
wagic.the.homebrew
2011-05-06 03:52:35 +00:00
parent 1e2ed785eb
commit 12228b51a0
5 changed files with 194 additions and 217 deletions

View File

@@ -171,26 +171,29 @@ void MTGCardInstance::initMTGCI()
data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item
if (basicAbilities[(int)Constants::CHANGELING])
{//if the card is a changeling.
for (int i = Subtypes::LAST_TYPE + 1;; i++)
{//if the card is a changeling, it gains all creature subtypes
for (size_t i = 0; i <Subtypes::subtypesList->getValuesById().size(); ++i)
{
string s = Subtypes::subtypesList->find(i);
if (!hasSubtype(i))
if (hasSubtype(i))
continue;
if (!Subtypes::subtypesList->isSubtypeOfType(i,Subtypes::TYPE_CREATURE))
continue;
//Erwan 2011/5/6 String comparison is expensive. Any way to do this in a cleaner way?
//I think this is releated to the fact that "Pestilence Rats" is a type for some reason, maybe we don't need that anymore
//TODO Remove the following block if possible
{
if (s == "")
break;
string s = Subtypes::subtypesList->find(i);
if (s.find(" ") != string::npos)
continue;
if (s == "Nothing" || s == "Swamp" || s == "Plains" || s == "Mountain" || s == "Forest" ||
s == "Island" || s == "Shrine" || s == "Basic" || s == "Colony" || s == "Desert" ||
s == "Dismiss" || s == "Equipment" || s == "Everglades" || s == "Grasslands" || s == "Lair" ||
s == "Level" || s == "Levelup" || s == "Mine" || s == "Oasis" || s == "World" || s == "Aura"
|| s == "Land"|| s == "Legendary" || s == "Token" || s == "Planeswalker")
continue;
addType(i);
}
addType(i);
}
}
int colored = 0;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)