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
+5 -15
View File
@@ -1305,25 +1305,15 @@ int GenericPaidAbility::resolve()
{ {
must = true; must = true;
//cost increase - reduce + trinisphere effect ability todo... //cost increase - reduce + trinisphere effect ability todo...
if(((MTGCardInstance *)target)->getIncreasedManaCost()->getConvertedCost()) optionalCost = ((MTGCardInstance *)target)->computeNewCost(((MTGCardInstance *)target),optionalCost,optionalCost);
optionalCost->add(((MTGCardInstance *)target)->getIncreasedManaCost()); if(optionalCost->extraCosts)
if(((MTGCardInstance *)target)->getReducedManaCost()->getConvertedCost())
optionalCost->remove(((MTGCardInstance *)target)->getReducedManaCost());
//trinisphere effect must be hardcoded...here..
/*if(((MTGCardInstance *)target)->has(Constants::TRINISPHERE))
{ {
if(optionalCost->getConvertedCost() == 2) for(unsigned int i = 0; i < optionalCost->extraCosts->costs.size();i++)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 1); optionalCost->extraCosts->costs[i]->setSource(((MTGCardInstance *)target));
else if(optionalCost->getConvertedCost() == 1) }
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 2);
else if(optionalCost->getConvertedCost() < 1)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 3);
}*/
} }
if(asAlternate && nomenu && optionalCost->getConvertedCost() < 1) if(asAlternate && nomenu && optionalCost->getConvertedCost() < 1)
{
nomenuAbility->resolve(); nomenuAbility->resolve();
}
else else
{ {
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName); MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName);
+28 -20
View File
@@ -1216,10 +1216,12 @@ int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 0; return 0;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL)); ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
if(card->getIncreasedManaCost()->getConvertedCost()) ManaCost * newCost = card->computeNewCost(card,cost,cost);
cost->add(card->getIncreasedManaCost()); if(newCost->extraCosts)
if(card->getReducedManaCost()->getConvertedCost()) for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
cost->remove(card->getReducedManaCost()); {
newCost->extraCosts->costs[i]->setSource(card);
}
if(card->isLand()) if(card->isLand())
return 0; return 0;
@@ -1234,7 +1236,7 @@ int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
else else
CustomName = "Zero Cast From Anywhere"; CustomName = "Zero Cast From Anywhere";
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost); return MTGAlternativeCostRule::isReactingToClick(card, mana, newCost);
} }
int MTGPayZeroRule::reactToClick(MTGCardInstance * card) int MTGPayZeroRule::reactToClick(MTGCardInstance * card)
@@ -1243,14 +1245,16 @@ int MTGPayZeroRule::reactToClick(MTGCardInstance * card)
return 0; return 0;
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL)); ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
if(card->getIncreasedManaCost()->getConvertedCost()) ManaCost * newCost = card->computeNewCost(card,cost,cost);
cost->add(card->getIncreasedManaCost()); if(newCost->extraCosts)
if(card->getReducedManaCost()->getConvertedCost()) for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
cost->remove(card->getReducedManaCost()); {
newCost->extraCosts->costs[i]->setSource(card);
}
card->paymenttype = MTGAbility::PAYZERO_COST; 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 ostream& MTGPayZeroRule::toString(ostream& out) const
@@ -1276,10 +1280,12 @@ int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
return 0; return 0;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative()); ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative());
if(card->getIncreasedManaCost()->getConvertedCost()) ManaCost * newCost = card->computeNewCost(card,cost,cost);
cost->add(card->getIncreasedManaCost()); if(newCost->extraCosts)
if(card->getReducedManaCost()->getConvertedCost()) for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
cost->remove(card->getReducedManaCost()); {
newCost->extraCosts->costs[i]->setSource(card);
}
if (card->isLand()) if (card->isLand())
return 0; 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))) if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card))||(!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
return 0; return 0;
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost); return MTGAlternativeCostRule::isReactingToClick(card, mana, newCost);
} }
int MTGOverloadRule::reactToClick(MTGCardInstance * card) int MTGOverloadRule::reactToClick(MTGCardInstance * card)
@@ -1297,14 +1303,16 @@ int MTGOverloadRule::reactToClick(MTGCardInstance * card)
return 0; return 0;
ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative()); ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative());
if(card->getIncreasedManaCost()->getConvertedCost()) ManaCost * newCost = card->computeNewCost(card,cost,cost);
cost->add(card->getIncreasedManaCost()); if(newCost->extraCosts)
if(card->getReducedManaCost()->getConvertedCost()) for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
cost->remove(card->getReducedManaCost()); {
newCost->extraCosts->costs[i]->setSource(card);
}
card->paymenttype = MTGAbility::OVERLOAD_COST; 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 ostream& MTGOverloadRule::toString(ostream& out) const