Fix issue 650 (Deck Editor doesn't count basic land types as mana producers anymore, Filters can't find basic mana ability producers anymore)

This commit is contained in:
wagic.the.homebrew
2011-05-07 02:42:49 +00:00
parent b26bfb09bd
commit 062d5f9485
2 changed files with 31 additions and 0 deletions

View File

@@ -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<string> abilitiesVector;
string thisstring = current->data->magicText;
abilitiesVector = split(thisstring, '\n');

View File

@@ -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)