Added some new primitives from MOM set, fixed some primitives, added new keyword "hasconvoke" to target spells which have convoke cost.

This commit is contained in:
Vittorio Alfieri
2023-05-19 20:43:26 +02:00
parent 3bd3933c66
commit 0e0b3a78fe
7 changed files with 450 additions and 4 deletions
+22
View File
@@ -3,6 +3,7 @@
#include "CardDescriptor.h"
#include "Subtypes.h"
#include "Counters.h"
#include "ExtraCost.h"
CardDescriptor::CardDescriptor()
: MTGCardInstance(), mColorExclusions(0)
@@ -23,6 +24,7 @@ CardDescriptor::CardDescriptor()
zposComparisonMode = COMPARISON_NONE;
zposition = -1;
hasKickerCost = 0;
hasConvokeCost = 0;
hasFlashbackCost = 0;
hasBackSide = 0;
hasPartner = 0;
@@ -69,6 +71,11 @@ void CardDescriptor::unsecureSetHasKickerCost(int k)
hasKickerCost = k;
}
void CardDescriptor::unsecureSetHasConvokeCost(int k)
{
hasConvokeCost = k;
}
void CardDescriptor::unsecureSetHasFlashbackCost(int k)
{
hasFlashbackCost = k;
@@ -296,6 +303,21 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
if (excludedSet.any())
return NULL;
if (hasConvokeCost != 0){
bool hasConvoke = false;
ManaCost * extra = card->getManaCost()->getAlternative();
if(extra && extra->extraCosts){
for(unsigned int i = 0; i < extra->extraCosts->costs.size() && !hasConvoke; i++){
if(dynamic_cast<Convoke*> (extra->extraCosts->costs[i]))
hasConvoke = true;
}
}
if ((hasConvokeCost == -1 && hasConvoke) || (hasConvokeCost == 1 && !hasConvoke))
{
match = NULL;
}
}
if ((hasKickerCost == -1 && ((card->getManaCost()->getKicker() && !card->basicAbilities[Constants::HASNOKICKER]) || (!card->getManaCost()->getKicker() && card->basicAbilities[Constants::HASOTHERKICKER]))) || (hasKickerCost == 1 && !((card->getManaCost()->getKicker() && !card->basicAbilities[Constants::HASNOKICKER]) || (!card->getManaCost()->getKicker() && card->basicAbilities[Constants::HASOTHERKICKER]))))
{
match = NULL; //Some kicker costs are not a real kicker (e.g. Fuse cost).
+13 -1
View File
@@ -1520,7 +1520,19 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
cd.unsecureSetHasKickerCost(1);
}
}
//Has kicker cost
//Has convoke cost
else if (attribute.find("hasconvoke") != string::npos)
{
if (minus)
{
cd.unsecureSetHasConvokeCost(-1);
}
else
{
cd.unsecureSetHasConvokeCost(1);
}
}
//Has flashback cost
else if (attribute.find("hasflashback") != string::npos)
{
if (minus)
+12
View File
@@ -615,6 +615,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
cd->unsecureSetHasKickerCost(1);
}
}
//Has convoke cost
else if (attribute.find("hasconvoke") != string::npos)
{
if (minus)
{
cd->unsecureSetHasConvokeCost(-1);
}
else
{
cd->unsecureSetHasConvokeCost(1);
}
}
//Has flashback cost
else if (attribute.find("hasflashback") != string::npos)
{