Draft of new feature: canplayfromgraveyard
this will allow playing cards from graveyard examples: tbd
This commit is contained in:
@@ -273,6 +273,7 @@ MTGEventBonus * MTGEventBonus::clone() const
|
||||
{
|
||||
return NEW MTGEventBonus(*this);
|
||||
}
|
||||
|
||||
MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) :
|
||||
PermanentAbility(observer, _id)
|
||||
{
|
||||
@@ -1140,8 +1141,49 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
|
||||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
|
||||
MTGAlternativeCostRule(observer, _id)
|
||||
{
|
||||
aType = MTGAbility::PUT_INTO_PLAY;
|
||||
}
|
||||
|
||||
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
{
|
||||
Player * player = game->currentlyActing();
|
||||
ManaCost * cost = card->getManaCost();
|
||||
|
||||
if (!player->game->graveyard->hasCard(card))
|
||||
return 0;
|
||||
if (!card->has(Constants::CANPLAYFROMGRAVEYARD))
|
||||
return 0;
|
||||
|
||||
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
|
||||
}
|
||||
|
||||
int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
if (!isReactingToClick(card))
|
||||
return 0;
|
||||
|
||||
ManaCost * cost = card->getManaCost();
|
||||
|
||||
card->paymenttype = MTGAbility::PUT_INTO_PLAY;
|
||||
|
||||
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);
|
||||
}
|
||||
|
||||
ostream& MTGPlayFromGraveyardRule::toString(ostream& out) const
|
||||
{
|
||||
out << "MTGPlayFromGraveyardRule ::: (";
|
||||
return MTGAbility::toString(out) << ")";
|
||||
}
|
||||
|
||||
MTGPlayFromGraveyardRule * MTGPlayFromGraveyardRule::clone() const
|
||||
{
|
||||
return NEW MTGPlayFromGraveyardRule(*this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool MTGAttackRule::select(Target* t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user