Overload Cards
the alias is for the Overload Check and Alternate Cost Restriction... ???Bestow???
This commit is contained in:
@@ -303,6 +303,12 @@ bool Spell::FullfilledAlternateCost(const int &costType)
|
||||
case ManaCost::MANA_PAID_WITH_SUSPEND:
|
||||
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_SUSPEND);
|
||||
break;
|
||||
case ManaCost::MANA_PAID_WITH_OVERLOAD:
|
||||
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_OVERLOAD);
|
||||
break;
|
||||
case ManaCost::MANA_PAID_WITH_BESTOW:
|
||||
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_BESTOW);
|
||||
break;
|
||||
}
|
||||
|
||||
return hasFullfilledAlternateCost;
|
||||
|
||||
@@ -39,7 +39,9 @@ const string kAlternateCostKeywords[] =
|
||||
"flashback",
|
||||
"retrace",
|
||||
"facedown",
|
||||
"suspended"
|
||||
"suspended",
|
||||
"overload",
|
||||
"bestow"
|
||||
};
|
||||
const int kAlternateCostIds[] =
|
||||
{
|
||||
@@ -51,7 +53,9 @@ const int kAlternateCostIds[] =
|
||||
ManaCost::MANA_PAID_WITH_FLASHBACK,
|
||||
ManaCost::MANA_PAID_WITH_RETRACE,
|
||||
ManaCost::MANA_PAID_WITH_MORPH,
|
||||
ManaCost::MANA_PAID_WITH_SUSPEND
|
||||
ManaCost::MANA_PAID_WITH_SUSPEND,
|
||||
ManaCost::MANA_PAID_WITH_OVERLOAD,
|
||||
ManaCost::MANA_PAID_WITH_BESTOW
|
||||
};
|
||||
|
||||
//Used for "dynamic ability" parsing
|
||||
@@ -1162,6 +1166,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
observer->addObserver(NEW MTGPayZeroRule(observer, -1));
|
||||
return NULL;
|
||||
}
|
||||
found = s.find("overloadrule");
|
||||
if(found != string::npos)
|
||||
{
|
||||
observer->addObserver(NEW MTGOverloadRule(observer, -1));
|
||||
return NULL;
|
||||
}
|
||||
//this rule handles attacking ability during attacker phase
|
||||
found = s.find("attackrule");
|
||||
if(found != string::npos)
|
||||
|
||||
@@ -546,7 +546,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
|
||||
copy->kicked = card->kicked;
|
||||
copy->storedCard = card->storedCard;
|
||||
copy->storedSourceCard = card->storedSourceCard;
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++)
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_BESTOW +1; i++)
|
||||
copy->alternateCostPaid[i] = card->alternateCostPaid[i];
|
||||
|
||||
//stupid bug with tokens...
|
||||
|
||||
@@ -632,6 +632,8 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
|
||||
return 0;
|
||||
if ((game->currentlyActing()->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (game->currentlyActing()->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
|
||||
return 0;
|
||||
if (card->alias == 110000)
|
||||
return 0;//overload has its own rule
|
||||
return isReactingToClick( card, mana, alternateCost );
|
||||
}
|
||||
|
||||
@@ -693,12 +695,17 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card)
|
||||
return reactToClick(card, alternateCost, ManaCost::MANA_PAID_WITH_ALTERNATIVE);
|
||||
}
|
||||
|
||||
int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType){
|
||||
int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType, bool overload){
|
||||
|
||||
Player * player = game->currentlyActing();
|
||||
ManaPool * playerMana = player->getManaPool();
|
||||
//this handles extra cost payments at the moment a card is played.
|
||||
|
||||
if(overload)
|
||||
card->spellTargetType = "";
|
||||
else if(card->model->data->spellTargetType.size())
|
||||
card->spellTargetType = card->model->data->spellTargetType;
|
||||
|
||||
assert(alternateCost);
|
||||
if (alternateCost->isExtraPaymentSet() )
|
||||
{
|
||||
@@ -1210,6 +1217,60 @@ MTGPayZeroRule * MTGPayZeroRule::clone() const
|
||||
return NEW MTGPayZeroRule(*this);
|
||||
}
|
||||
|
||||
MTGOverloadRule::MTGOverloadRule(GameObserver* observer, int _id) :
|
||||
MTGAlternativeCostRule(observer, _id)
|
||||
{
|
||||
aType = MTGAbility::OVERLOAD_COST;
|
||||
}
|
||||
|
||||
int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
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());
|
||||
|
||||
if (card->isLand())
|
||||
return 0;
|
||||
if (card->alias != 110000)
|
||||
return 0;
|
||||
if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card))
|
||||
return 0;
|
||||
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);
|
||||
}
|
||||
|
||||
int MTGOverloadRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
if (!isReactingToClick(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());
|
||||
|
||||
card->paymenttype = MTGAbility::OVERLOAD_COST;
|
||||
|
||||
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID_WITH_OVERLOAD, true);
|
||||
}
|
||||
|
||||
ostream& MTGOverloadRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGOverloadRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
MTGOverloadRule * MTGOverloadRule::clone() const
|
||||
{
|
||||
return NEW MTGOverloadRule(*this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool MTGAttackRule::select(Target* t)
|
||||
|
||||
Reference in New Issue
Block a user