Fixed some primitives, added new primitives from MAT set, improved filter for multicolored cards, added new keywords for handling multicolored cards.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -45,6 +45,8 @@ class CardDescriptor: public MTGCardInstance
|
|||||||
int convertedManacost; // might fit better into MTGCardInstance?
|
int convertedManacost; // might fit better into MTGCardInstance?
|
||||||
int zposComparisonMode;
|
int zposComparisonMode;
|
||||||
int zposition;
|
int zposition;
|
||||||
|
int numofColorsComparisonMode;
|
||||||
|
int numofColors;
|
||||||
int hasKickerCost;
|
int hasKickerCost;
|
||||||
int hasConvokeCost;
|
int hasConvokeCost;
|
||||||
int hasFlashbackCost;
|
int hasFlashbackCost;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Subtypes.h"
|
#include "Subtypes.h"
|
||||||
#include "Counters.h"
|
#include "Counters.h"
|
||||||
#include "ExtraCost.h"
|
#include "ExtraCost.h"
|
||||||
|
#include "WParsedInt.h"
|
||||||
|
|
||||||
CardDescriptor::CardDescriptor()
|
CardDescriptor::CardDescriptor()
|
||||||
: MTGCardInstance(), mColorExclusions(0)
|
: MTGCardInstance(), mColorExclusions(0)
|
||||||
@@ -21,6 +22,8 @@ CardDescriptor::CardDescriptor()
|
|||||||
manacostComparisonMode = COMPARISON_NONE;
|
manacostComparisonMode = COMPARISON_NONE;
|
||||||
counterComparisonMode = COMPARISON_NONE;
|
counterComparisonMode = COMPARISON_NONE;
|
||||||
convertedManacost = -1;
|
convertedManacost = -1;
|
||||||
|
numofColorsComparisonMode = COMPARISON_NONE;
|
||||||
|
numofColors = -1;
|
||||||
zposComparisonMode = COMPARISON_NONE;
|
zposComparisonMode = COMPARISON_NONE;
|
||||||
zposition = -1;
|
zposition = -1;
|
||||||
hasKickerCost = 0;
|
hasKickerCost = 0;
|
||||||
@@ -199,6 +202,16 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
|
|||||||
} else if(!valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
|
} else if(!valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (numofColorsComparisonMode){
|
||||||
|
int totalcolor = 0;
|
||||||
|
WParsedInt* value = NEW WParsedInt("mycolnum", NULL, card);
|
||||||
|
if(value){
|
||||||
|
totalcolor = value->getValue();
|
||||||
|
SAFE_DELETE(value);
|
||||||
|
}
|
||||||
|
if(!valueInRange(numofColorsComparisonMode, totalcolor, numofColors))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
|
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
|
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
|
||||||
@@ -256,6 +269,16 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
|
|||||||
} else if(!valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
|
} else if(!valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (numofColorsComparisonMode){
|
||||||
|
int totalcolor = 0;
|
||||||
|
WParsedInt* value = NEW WParsedInt("mycolnum", NULL, card);
|
||||||
|
if(value){
|
||||||
|
totalcolor = value->getValue();
|
||||||
|
SAFE_DELETE(value);
|
||||||
|
}
|
||||||
|
if(!valueInRange(numofColorsComparisonMode, totalcolor, numofColors))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
|
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
|
||||||
match = NULL;
|
match = NULL;
|
||||||
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
|
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
|
||||||
|
|||||||
@@ -1749,6 +1749,12 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (attribute.find("numofcols") != string::npos)
|
||||||
|
{
|
||||||
|
//Number of color restrictions
|
||||||
|
cd.numofColors = comparisonCriterion;
|
||||||
|
cd.numofColorsComparisonMode = comparisonMode;
|
||||||
|
}
|
||||||
else if (attribute.find("power") != string::npos)
|
else if (attribute.find("power") != string::npos)
|
||||||
{
|
{
|
||||||
//Power restrictions
|
//Power restrictions
|
||||||
|
|||||||
@@ -917,6 +917,12 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (attribute.find("numofcols") != string::npos)
|
||||||
|
{
|
||||||
|
//Number of color restrictions
|
||||||
|
cd->numofColors = comparisonCriterion;
|
||||||
|
cd->numofColorsComparisonMode = comparisonMode;
|
||||||
|
}
|
||||||
else if (attribute.find("power") != string::npos)
|
else if (attribute.find("power") != string::npos)
|
||||||
{
|
{
|
||||||
//Power restrictions
|
//Power restrictions
|
||||||
|
|||||||
@@ -1565,6 +1565,22 @@ void WParsedInt::extendedParse(string s, Spell * spell, MTGCardInstance * card)
|
|||||||
}
|
}
|
||||||
intValue = hasdeadtype;
|
intValue = hasdeadtype;
|
||||||
}
|
}
|
||||||
|
else if(s.find("hasmansym") != string::npos){
|
||||||
|
string manatocheck = s.substr(9);
|
||||||
|
if(manatocheck == "c")
|
||||||
|
intValue = card->getManaCost()->getManaSymbolsHybridMerged(Constants::MTG_COLOR_ARTIFACT);
|
||||||
|
else if(manatocheck == "g")
|
||||||
|
intValue = card->getManaCost()->getManaSymbolsHybridMerged(Constants::MTG_COLOR_GREEN);
|
||||||
|
else if(manatocheck == "u")
|
||||||
|
intValue = card->getManaCost()->getManaSymbolsHybridMerged(Constants::MTG_COLOR_BLUE);
|
||||||
|
else if(manatocheck == "r")
|
||||||
|
intValue = card->getManaCost()->getManaSymbolsHybridMerged(Constants::MTG_COLOR_RED);
|
||||||
|
else if(manatocheck == "b")
|
||||||
|
intValue = card->getManaCost()->getManaSymbolsHybridMerged(Constants::MTG_COLOR_BLACK);
|
||||||
|
else if(manatocheck == "w")
|
||||||
|
intValue = card->getManaCost()->getManaSymbolsHybridMerged(Constants::MTG_COLOR_WHITE);
|
||||||
|
else intValue = 0;
|
||||||
|
}
|
||||||
else if(!intValue)//found nothing, try parsing a atoi
|
else if(!intValue)//found nothing, try parsing a atoi
|
||||||
{
|
{
|
||||||
intValue = atoi(s.c_str());
|
intValue = atoi(s.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user