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

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