Improved Kicker cards, now it's possible to target a specific card with kicker cost and handle any event connected to a kicker casting cost.
This commit is contained in:
@@ -20,6 +20,7 @@ CardDescriptor::CardDescriptor()
|
||||
convertedManacost = -1;
|
||||
zposComparisonMode = COMPARISON_NONE;
|
||||
zposition = -1;
|
||||
hasKickerCost = 0;
|
||||
compareName ="";
|
||||
nameComparisonMode = COMPARISON_NONE;
|
||||
colorComparisonMode = COMPARISON_NONE;
|
||||
@@ -50,6 +51,16 @@ int CardDescriptor::init()
|
||||
return result;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetKicked(int k)
|
||||
{
|
||||
kicked = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetHasKickerCost(int k)
|
||||
{
|
||||
hasKickerCost = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecureSetTapped(int i)
|
||||
{
|
||||
tapped = i;
|
||||
@@ -220,6 +231,15 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
||||
if (excludedSet.any())
|
||||
return NULL;
|
||||
|
||||
if ((kicked == -1 && card->kicked) || (kicked == 1 && !card->kicked))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((hasKickerCost == -1 && card->getManaCost()->getKicker()) || (hasKickerCost == 1 && !card->getManaCost()->getKicker()))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((tapped == -1 && card->isTapped()) || (tapped == 1 && !card->isTapped()))
|
||||
{
|
||||
|
||||
@@ -1484,8 +1484,32 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
{
|
||||
cd.unsecureSetTapped(1);
|
||||
}
|
||||
//Token
|
||||
}
|
||||
//Has been kicked
|
||||
else if (attribute.find("kicked") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd.unsecureSetKicked(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd.unsecureSetKicked(1);
|
||||
}
|
||||
}
|
||||
//Has kicker cost
|
||||
else if (attribute.find("haskicker") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd.unsecureSetHasKickerCost(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd.unsecureSetHasKickerCost(1);
|
||||
}
|
||||
}
|
||||
//Token
|
||||
else if (attribute.find("token") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
@@ -1496,8 +1520,8 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
{
|
||||
cd.isToken = 1;
|
||||
}
|
||||
//put in its zone this turn
|
||||
}
|
||||
//put in its zone this turn
|
||||
else if (attribute.find("fresh") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
|
||||
@@ -193,7 +193,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"adventure", //it can be adventure
|
||||
"mentor",
|
||||
"prowess",
|
||||
"nofizzle alternative" // No fizzle if paid with alternative cost (es. Zendikar Rising Modal Double Faced cards).
|
||||
"nofizzle alternative", //No fizzle if paid with alternative cost (es. Zendikar Rising Modal Double Faced cards).
|
||||
"hasotherkicker" //Kicker cost is expressed with "other" keyword (es. not mana kicker such as life and/or tap a creature)
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -483,10 +483,11 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
||||
|
||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||
int payResult = player->getManaPool()->pay(card->getManaCost());
|
||||
if (card->getManaCost()->getKicker() && (OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number || card->controller()->isAI()))
|
||||
if (card->getManaCost()->getKicker() && (card->kicked || OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number || card->controller()->isAI()))
|
||||
{
|
||||
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
|
||||
withKickerCost->add(withKickerCost->getKicker());
|
||||
card->kicked = 0;
|
||||
if (card->getManaCost()->getKicker()->isMulti)
|
||||
{
|
||||
while(previousManaPool->canAfford(withKickerCost))
|
||||
@@ -497,11 +498,14 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
||||
for(int i = 0;i < card->kicked;i++)
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
|
||||
}
|
||||
else if (previousManaPool->canAfford(withKickerCost))
|
||||
{
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||
card->kicked = 1;
|
||||
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
|
||||
}
|
||||
delete withKickerCost;
|
||||
}
|
||||
@@ -633,6 +637,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
if (!game->targetListIsSet(card))
|
||||
{
|
||||
card->kicked = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -649,6 +654,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
|
||||
withKickerCost->add(withKickerCost->getKicker());
|
||||
card->kicked = 0;
|
||||
if (card->getManaCost()->getKicker()->isMulti)
|
||||
{
|
||||
while(previousManaPool->canAfford(withKickerCost))
|
||||
@@ -659,11 +665,14 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
for(int i = 0;i < card->kicked;i++)
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
|
||||
}
|
||||
else if (previousManaPool->canAfford(withKickerCost))
|
||||
{
|
||||
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||
card->kicked = 1;
|
||||
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
|
||||
}
|
||||
delete withKickerCost;
|
||||
}
|
||||
@@ -722,7 +731,6 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||
copy->castX = copy->X;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -481,8 +481,32 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
{
|
||||
cd->unsecureSetTapped(1);
|
||||
}
|
||||
//Token
|
||||
}
|
||||
//Has been kicked
|
||||
else if (attribute.find("kicked") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->unsecureSetKicked(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->unsecureSetKicked(1);
|
||||
}
|
||||
}
|
||||
//Has kicker cost
|
||||
else if (attribute.find("haskicker") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->unsecureSetHasKickerCost(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->unsecureSetHasKickerCost(1);
|
||||
}
|
||||
}
|
||||
//Token
|
||||
else if (attribute.find("token") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
@@ -493,8 +517,8 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
{
|
||||
cd->isToken = 1;
|
||||
}
|
||||
//put in its zone this turn
|
||||
}
|
||||
//put in its zone this turn
|
||||
else if (attribute.find("fresh") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
|
||||
Reference in New Issue
Block a user