Fixed all primitives with Fuse cost (now we use a special kicker cost for them), fixed all primitives with double kicker cost (now we use other and kicker cost togheter), added a new ability "hasnokicker" for primitives which have kicker for other purpose (e.g. Fuse cards), fixed an issue on cost name for both kicker and retrace cost, improved green highlight management for cards which can play in exile and graveyard (such as retrace cards, flashback cards, and so on), improved kicker cost management.

This commit is contained in:
Vittorio Alfieri
2021-02-16 16:08:08 +01:00
parent ed330fa70c
commit 6c9c770f2d
7 changed files with 179 additions and 166 deletions
+2 -2
View File
@@ -265,9 +265,9 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
if (excludedSet.any())
return NULL;
if ((hasKickerCost == -1 && (card->getManaCost()->getKicker() || card->basicAbilities[Constants::HASOTHERKICKER])) || (hasKickerCost == 1 && (!card->getManaCost()->getKicker() && !card->basicAbilities[Constants::HASOTHERKICKER])))
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;
match = NULL; //Some kicker costs are not a real kicker (e.g. Fuse cost).
}
if ((hasFlashbackCost == -1 && card->getManaCost()->getFlashback()) || (hasFlashbackCost == 1 && !card->getManaCost()->getFlashback()))
+3 -3
View File
@@ -256,9 +256,9 @@ void CardGui::Render()
{
if(game)
{
if((card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))||
((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback()) && game->isInGrave(card)) ||
(card->has(Constants::FORETELL) && card->foretellTurn > -1 && game->turn > card->foretellTurn && game->isInExile(card)))
if(card->has(Constants::PAYZERO) ||
((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback() || card->getManaCost()->getRetrace()) && game->isInGrave(card)) ||
(((card->has(Constants::FORETELL) && card->foretellTurn > -1 && game->turn > card->foretellTurn) || card->has(Constants::CANPLAYFROMEXILE)) && game->isInExile(card)))
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
else
fakeborder->SetColor(ARGB((int)(actA),15,15,15));
+3 -2
View File
@@ -194,7 +194,7 @@ const char* Constants::MTGBasicAbilities[] = {
"mentor",
"prowess",
"nofizzle alternative", //No fizzle if card has been paid with alternative cost.
"hasotherkicker", //Kicker cost is expressed with "other" keyword (eg. not mana kicker such as life and/or tap a creature),
"hasotherkicker", //Kicker cost is expressed with "other" keyword (eg. not mana kicker such as life and/or tap a creature)
"partner", //Has partner ability
"canbecommander", //Can be a commander (eg. some planeswalkers can)
"iscommander", //It's the current commander
@@ -209,7 +209,8 @@ const char* Constants::MTGBasicAbilities[] = {
"anytypeofmanaability", //It allows to spend mana as it were of any color to activate abilities.
"boast", //It has boast ability
"twoboast", //It has boast twice ability (e.g. Birgi, God of Storytelling)
"replacescry" //It has scry replacement ability
"replacescry", //It has scry replacement ability
"hasnokicker" //Kicker cost is not a real kicker cost (eg. cards with Fuse cost)
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+13 -9
View File
@@ -526,7 +526,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
while(previousManaPool->canAfford(withKickerCost,card->has(Constants::ANYTYPEOFMANA)))
{
withKickerCost->add(withKickerCost->getKicker());
card->kicked += 1;
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked += 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
}
for(int i = 0;i < card->kicked;i++)
player->getManaPool()->pay(card->getManaCost()->getKicker());
@@ -537,7 +537,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
{
player->getManaPool()->pay(card->getManaCost()->getKicker());
payResult = ManaCost::MANA_PAID_WITH_KICKER;
card->kicked = 1;
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
}
delete withKickerCost;
@@ -595,7 +595,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM))
{
copy->X = spell->computeX(copy);
if(card->setX > -1 && (card->getReducedManaCost()->getConvertedCost() > 0 || card->getIncreasedManaCost()->getConvertedCost() > 0)) //Try to Apply the correct X value due to cost reduction/increasement.
if(card->setX > -1) //Try to Apply the correct X value due to cost reduction/increasement and or a kicker payment.
copy->X = card->setX;
copy->castX = copy->X;
}
@@ -638,6 +638,8 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if(card->model->data->getManaCost()->getKicker() && card->model->data->getManaCost()->getKicker()->alternativeName.size())
alternativeName = card->model->data->getManaCost()->getKicker()->alternativeName;
else
alternativeName = "";
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::ASFLASH) || (card->StackIsEmptyandSorcerySpeed()))
{
@@ -675,7 +677,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
{
if (!game->targetListIsSet(card))
{
card->kicked = 1;
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
return 0;
}
}
@@ -698,7 +700,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
while(previousManaPool->canAfford(withKickerCost,card->has(Constants::ANYTYPEOFMANA)))
{
withKickerCost->add(withKickerCost->getKicker());
card->kicked += 1;
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked += 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
}
for(int i = 0;i < card->kicked;i++)
player->getManaPool()->pay(card->getManaCost()->getKicker());
@@ -709,7 +711,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
{
player->getManaPool()->pay(card->getManaCost()->getKicker());
payResult = ManaCost::MANA_PAID_WITH_KICKER;
card->kicked = 1;
if(!card->basicAbilities[Constants::HASNOKICKER]) card->kicked = 1; //Some kicker costs are not a real kicker (e.g. Fuse cost).
card->alternateCostPaid[ManaCost::MANA_PAID_WITH_KICKER] = 1;
}
delete withKickerCost;
@@ -1027,19 +1029,19 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
SAFE_DELETE(previousManaPool);
card->alternateCostPaid[alternateCostType] = 1;
if(card->has(Constants::HASOTHERKICKER)) //Fix for cards which have kicker cost implemented with other cost.
card->kicked = 1;
if (card->isLand())
{
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->temp);
Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, alternateCostType);
copy->alternateCostPaid[alternateCostType] = 1;
spell->resolve();
SAFE_DELETE(spell);
}
else
{
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->stack);
copy->alternateCostPaid[alternateCostType] = 1;
game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, alternateCostType, 0);
game->targetChooser = NULL;
if(alternateCostType == ManaCost::MANA_PAID_WITH_BESTOW)
@@ -1271,6 +1273,8 @@ int MTGRetraceRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
if(card->model->data->getManaCost()->getRetrace() && card->model->data->getManaCost()->getRetrace()->alternativeName.size())
alternativeName = card->model->data->getManaCost()->getRetrace()->alternativeName;
else
alternativeName = "";
return MTGAlternativeCostRule::isReactingToClick( card, mana, retraceCost);
}