Overload and PayZero are affected by cost increaser

This commit is contained in:
Anthony Calosa
2016-06-05 13:15:30 +08:00
parent cd83cfdc87
commit 5196424fbe
2 changed files with 33 additions and 35 deletions

View File

@@ -1305,25 +1305,15 @@ int GenericPaidAbility::resolve()
{
must = true;
//cost increase - reduce + trinisphere effect ability todo...
if(((MTGCardInstance *)target)->getIncreasedManaCost()->getConvertedCost())
optionalCost->add(((MTGCardInstance *)target)->getIncreasedManaCost());
if(((MTGCardInstance *)target)->getReducedManaCost()->getConvertedCost())
optionalCost->remove(((MTGCardInstance *)target)->getReducedManaCost());
//trinisphere effect must be hardcoded...here..
/*if(((MTGCardInstance *)target)->has(Constants::TRINISPHERE))
optionalCost = ((MTGCardInstance *)target)->computeNewCost(((MTGCardInstance *)target),optionalCost,optionalCost);
if(optionalCost->extraCosts)
{
if(optionalCost->getConvertedCost() == 2)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 1);
else if(optionalCost->getConvertedCost() == 1)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 2);
else if(optionalCost->getConvertedCost() < 1)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 3);
}*/
for(unsigned int i = 0; i < optionalCost->extraCosts->costs.size();i++)
optionalCost->extraCosts->costs[i]->setSource(((MTGCardInstance *)target));
}
}
if(asAlternate && nomenu && optionalCost->getConvertedCost() < 1)
{
nomenuAbility->resolve();
}
else
{
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName);

View File

@@ -1216,10 +1216,12 @@ int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 0;
Player * player = game->currentlyActing();
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
ManaCost * newCost = card->computeNewCost(card,cost,cost);
if(newCost->extraCosts)
for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
{
newCost->extraCosts->costs[i]->setSource(card);
}
if(card->isLand())
return 0;
@@ -1234,7 +1236,7 @@ int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
else
CustomName = "Zero Cast From Anywhere";
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
return MTGAlternativeCostRule::isReactingToClick(card, mana, newCost);
}
int MTGPayZeroRule::reactToClick(MTGCardInstance * card)
@@ -1243,14 +1245,16 @@ int MTGPayZeroRule::reactToClick(MTGCardInstance * card)
return 0;
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
ManaCost * newCost = card->computeNewCost(card,cost,cost);
if(newCost->extraCosts)
for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
{
newCost->extraCosts->costs[i]->setSource(card);
}
card->paymenttype = MTGAbility::PAYZERO_COST;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);
return MTGAlternativeCostRule::reactToClick(card, newCost, ManaCost::MANA_PAID);
}
ostream& MTGPayZeroRule::toString(ostream& out) const
@@ -1276,10 +1280,12 @@ int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 0;
Player * player = game->currentlyActing();
ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative());
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
ManaCost * newCost = card->computeNewCost(card,cost,cost);
if(newCost->extraCosts)
for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
{
newCost->extraCosts->costs[i]->setSource(card);
}
if (card->isLand())
return 0;
@@ -1288,7 +1294,7 @@ int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card))||(!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
return 0;
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
return MTGAlternativeCostRule::isReactingToClick(card, mana, newCost);
}
int MTGOverloadRule::reactToClick(MTGCardInstance * card)
@@ -1297,14 +1303,16 @@ int MTGOverloadRule::reactToClick(MTGCardInstance * card)
return 0;
ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative());
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
ManaCost * newCost = card->computeNewCost(card,cost,cost);
if(newCost->extraCosts)
for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
{
newCost->extraCosts->costs[i]->setSource(card);
}
card->paymenttype = MTGAbility::OVERLOAD_COST;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID_WITH_OVERLOAD, true);
return MTGAlternativeCostRule::reactToClick(card, newCost, ManaCost::MANA_PAID_WITH_OVERLOAD, true);
}
ostream& MTGOverloadRule::toString(ostream& out) const