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:
@@ -443,6 +443,28 @@ void StatsWrapper::updateStats(DeckDataWrapper *myDeck)
|
|||||||
|
|
||||||
// Lets look for mana producing abilities
|
// 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;
|
vector<string> abilitiesVector;
|
||||||
string thisstring = current->data->magicText;
|
string thisstring = current->data->magicText;
|
||||||
abilitiesVector = split(thisstring, '\n');
|
abilitiesVector = split(thisstring, '\n');
|
||||||
|
|||||||
@@ -259,6 +259,15 @@ bool WCFilterProducesColor::isMatch(MTGCard * c)
|
|||||||
{
|
{
|
||||||
bool bMatch = false;
|
bool bMatch = false;
|
||||||
if (!c || !c->data) return 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;
|
string s = c->data->magicText;
|
||||||
size_t t = s.find("add");
|
size_t t = s.find("add");
|
||||||
while (t != string::npos)
|
while (t != string::npos)
|
||||||
|
|||||||
Reference in New Issue
Block a user