Draft of new feature: canplayfromgraveyard
this will allow playing cards from graveyard examples: tbd
This commit is contained in:
@@ -16,6 +16,7 @@ auto=flashbackrule
|
||||
auto=retracerule
|
||||
auto=suspendrule
|
||||
auto=morphrule
|
||||
auto=playfromgraveyardrule
|
||||
auto=attackrule
|
||||
auto=blockrule
|
||||
auto=combattriggerrule
|
||||
|
||||
@@ -218,7 +218,8 @@ class Constants
|
||||
soulbond = 100,
|
||||
LURE = 101,
|
||||
NOLEGEND = 102,
|
||||
NB_BASIC_ABILITIES = 103,
|
||||
CANPLAYFROMGRAVEYARD = 103,
|
||||
NB_BASIC_ABILITIES = 104,
|
||||
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
MTGEventBonus(GameObserver* observer, int _id);
|
||||
virtual MTGEventBonus * clone() const;
|
||||
};
|
||||
|
||||
class MTGPutInPlayRule: public PermanentAbility
|
||||
{
|
||||
public:
|
||||
@@ -172,6 +173,21 @@ public:
|
||||
virtual MTGMorphCostRule * clone() const;
|
||||
};
|
||||
|
||||
class MTGPlayFromGraveyardRule: public MTGAlternativeCostRule
|
||||
{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGPlayFromGraveyardRule(GameObserver* observer, int _id);
|
||||
const string getMenuText()
|
||||
{
|
||||
return "cast card from graveyard";
|
||||
}
|
||||
virtual MTGPlayFromGraveyardRule * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class MTGSuspendRule: public MTGAlternativeCostRule
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1039,6 +1039,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
observer->addObserver(NEW MTGMorphCostRule(observer, -1));
|
||||
return NULL;
|
||||
}
|
||||
found = s.find("playfromgraveyardrule");
|
||||
if(found != string::npos)
|
||||
{
|
||||
observer->addObserver(NEW MTGPlayFromGraveyardRule(observer, -1));
|
||||
return NULL;
|
||||
}
|
||||
//this rule handles attacking ability during attacker phase
|
||||
found = s.find("attackrule");
|
||||
if(found != string::npos)
|
||||
|
||||
@@ -131,7 +131,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"poisondamager",//deals damage to players as poison counters.
|
||||
"soulbond",
|
||||
"lure",
|
||||
"nolegend"
|
||||
"nolegend",
|
||||
"canplayfromgraveyard"
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -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