add support for repeater deplete cards.

Scalpelexis
Sphinx's Tutelage
Grindstone
normally I aim for much bigger card groups, but this was requested by one of the only 2 active members we have on the forum.
I'll have the card code for these cards ready when I code eldrich moon set.

to use, use it like any normal depelte except add
name
color
to the front, 
name deplete:4 targetsZone(player)
this will repeat this until the player depletes cards that dont have atleast 2 with the same name.
color deplete:2 target(player)
this will continue to deplete until the player depletes a set of cards that dont share a color with each other lands not included when checking colors.
enjoy.
This commit is contained in:
zethfoxster
2016-07-17 22:24:53 -04:00
parent 6acd897e16
commit 9e73dc9c00
3 changed files with 133 additions and 11 deletions

View File

@@ -1099,8 +1099,8 @@ AADamager * AADamager::clone() const
//AADepleter
AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int who, bool toexile) :
ActivatedAbilityTP(observer, _id, card, _target, _cost, who),nbcardsStr(nbcardsStr),toexile(toexile)
AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int who, bool toexile, bool colorrepeat, bool namerepeat) :
ActivatedAbilityTP(observer, _id, card, _target, _cost, who),nbcardsStr(nbcardsStr),toexile(toexile), colorrepeat(colorrepeat), namerepeat(namerepeat)
{
}
int AADepleter::resolve()
@@ -1110,16 +1110,124 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
{
WParsedInt numCards(nbcardsStr, NULL, source);
MTGLibrary * library = player->game->library;
for (int i = 0; i < numCards.getValue(); i++)
if (colorrepeat && library->nb_cards)
{
if (library->nb_cards)
bool repeating = false;
do
{
if(toexile)
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->exile);
else
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
repeating = false;
vector<MTGCardInstance*>found;
for (int i = 0; i < numCards.getValue(); i++)
{
if (library->nb_cards)
{
if(library->nb_cards > i)
found.push_back(library->cards[(library->nb_cards - 1) - i]);
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
if (cardFirst->isLand())
continue;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (cardFirst->hasColor(i))
{
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->isLand())
continue;
if (cardSecond->hasColor(i) && cardFirst != cardSecond)
{
repeating = true;
}
}
}
}
}
do
{
if (found.size())
{
MTGCardInstance * toMove = found.back();
if (toMove)
{
if (toexile)
player->game->putInZone(toMove, library, player->game->exile);
else
player->game->putInZone(toMove, library, player->game->graveyard);
found.pop_back();
}
}
} while (found.size());
} while (repeating);
}
else if (namerepeat && library->nb_cards)
{
bool repeating = false;
do
{
repeating = false;
vector<MTGCardInstance*>found;
for (int i = 0; i < numCards.getValue(); i++)
{
if (library->nb_cards)
{
if (library->nb_cards > i)
found.push_back(library->cards[(library->nb_cards - 1) - i]);
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->name == cardFirst->name && cardFirst != cardSecond)
{
repeating = true;
}
}
}
do
{
if (found.size())
{
MTGCardInstance * toMove = found.back();
if (toMove)
{
if (toexile)
player->game->putInZone(toMove, library, player->game->exile);
else
player->game->putInZone(toMove, library, player->game->graveyard);
found.pop_back();
}
}
} while (found.size());
} while (repeating);
}
else
{
for (int i = 0; i < numCards.getValue(); i++)
{
if (library->nb_cards)
{
if (toexile)
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->exile);
else
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
}
}
}
}
return 1;
}