diff --git a/projects/mtg/src/DeckStats.cpp b/projects/mtg/src/DeckStats.cpp index 8829fa595..b38e622aa 100644 --- a/projects/mtg/src/DeckStats.cpp +++ b/projects/mtg/src/DeckStats.cpp @@ -443,6 +443,28 @@ void StatsWrapper::updateStats(DeckDataWrapper *myDeck) // Lets look for mana producing abilities + //http://code.google.com/p/wagic/issues/detail?id=650 + //Basic lands are not producing their mana through regular abilities anymore, + //but through a rule that is outside of the primitives. This block is a hack to address this + const int colors[] = {Constants::MTG_COLOR_GREEN, Constants::MTG_COLOR_BLUE, Constants::MTG_COLOR_RED, Constants::MTG_COLOR_BLACK, Constants::MTG_COLOR_WHITE}; + const string lands[] = { "forest", "island", "mountain", "swamp", "plains" }; + for (int i = 0; i < sizeof(colors)/sizeof(colors[0]); ++i) + { + int colorId = colors[i]; + string type = lands[i]; + if (current->data->hasType(type.c_str())) + { + if (current->data->hasType("Basic")) + { + this->countBasicLandsPerColor[colorId] += currentCount; + } + else + { + this->countLandsPerColor[colorId] += currentCount; + } + } + } + vector abilitiesVector; string thisstring = current->data->magicText; abilitiesVector = split(thisstring, '\n'); diff --git a/projects/mtg/src/WFilter.cpp b/projects/mtg/src/WFilter.cpp index a7f61ad42..81ff7a11a 100644 --- a/projects/mtg/src/WFilter.cpp +++ b/projects/mtg/src/WFilter.cpp @@ -259,6 +259,15 @@ bool WCFilterProducesColor::isMatch(MTGCard * c) { bool bMatch = false; if (!c || !c->data) return false; + + //http://code.google.com/p/wagic/issues/detail?id=650 + //Basic lands are not producing their mana through regular abilities anymore, + //but through a rule that is outside of the primitives. This block is a hack to address this + const string lands[] = { "dummy(colorless)", "forest", "island", "mountain", "swamp", "plains" }; + if ((color < sizeof(lands)/sizeof(lands[0])) && c->data->hasType(lands[color].c_str())) + return true; + + //Retrieve non basic Mana abilities string s = c->data->magicText; size_t t = s.find("add"); while (t != string::npos)