Libraryeater and Canplayfromexile

extend canplayfromgraveyard with canplayfromexile
libraryeater for undead alchemist
This commit is contained in:
Anthony Calosa
2015-11-05 07:16:49 +08:00
parent 525453d677
commit 4f54e30e0e
8 changed files with 67 additions and 36 deletions
+28
View File
@@ -126,7 +126,35 @@ int Damage::resolve()
}
_target->doDamageTest = 1;
}
if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
if(source->has(Constants::LIBRARYEATER) && typeOfDamage == 1)
{
for (int j = damage; j > 0; j--)
{
if(((Player*)target)->game->library->nb_cards)
((Player*)target)->game->putInZone(((Player*)target)->game->library->cards[((Player*)target)->game->library->nb_cards - 1], ((Player*)target)->game->library, ((Player*)target)->game->graveyard);
}
damage = 0;
}
if(source->alias == 89092 && typeOfDamage == 1)//Szadek Lord of Secrets
{
for (int j = damage; j > 0; j--)
{
if(((Player*)target)->game->library->nb_cards)
((Player*)target)->game->putInZone(((Player*)target)->game->library->cards[((Player*)target)->game->library->nb_cards - 1], ((Player*)target)->game->library, ((Player*)target)->game->graveyard);
source->counters->addCounter(1, 1);
}
damage = 0;
}
if (!damage)
{
state = RESOLVED_NOK;
delete (e);
return 0;
}
}
int a = damage;
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (source->has(Constants::WITHER) || source->has(
+2 -1
View File
@@ -150,7 +150,8 @@ const char* Constants::MTGBasicAbilities[] = {
"oppgcreatureexiler",
"payzero",
"trinisphere",
"canplayfromexile"
"canplayfromexile",
"libraryeater"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+4 -4
View File
@@ -1132,7 +1132,7 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
MTGAlternativeCostRule(observer, _id)
{
aType = MTGAbility::CASTINGRAVEYARD_COST;
aType = MTGAbility::CASTINGRAVEEXILE_COST;
}
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
@@ -1140,9 +1140,9 @@ int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost
Player * player = game->currentlyActing();
ManaCost * cost = card->getManaCost();
if (!player->game->graveyard->hasCard(card))
if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card))
return 0;
if (!card->has(Constants::CANPLAYFROMGRAVEYARD))
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);
@@ -1155,7 +1155,7 @@ int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card)
ManaCost * cost = card->getManaCost();
card->paymenttype = MTGAbility::CASTINGRAVEYARD_COST;
card->paymenttype = MTGAbility::CASTINGRAVEEXILE_COST;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID_WITH_OTHERCOST);
}