Coded the initiative ability from CLB set, added some condition to test if a card has been casted from exile or sideboard or commandzone.
This commit is contained in:
@@ -344,6 +344,51 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
if(!count)
|
||||
return 0;
|
||||
}
|
||||
check = restriction[i].find("exilecast");
|
||||
if(check != string::npos)
|
||||
{
|
||||
int count = 0;
|
||||
for(unsigned int k = 0; k < player->game->stack->cardsSeenThisTurn.size(); k++)
|
||||
{
|
||||
MTGCardInstance * stackCard = player->game->stack->cardsSeenThisTurn[k];
|
||||
if(stackCard->next && stackCard->next == card && (card->previousZone == card->controller()->game->exile||card->previousZone == card->controller()->opponent()->game->exile))
|
||||
count++;
|
||||
if(stackCard == card && (card->previousZone == card->controller()->game->exile||card->previousZone == card->controller()->opponent()->game->exile))
|
||||
count++;
|
||||
}
|
||||
if(!count)
|
||||
return 0;
|
||||
}
|
||||
check = restriction[i].find("sidecast");
|
||||
if(check != string::npos)
|
||||
{
|
||||
int count = 0;
|
||||
for(unsigned int k = 0; k < player->game->stack->cardsSeenThisTurn.size(); k++)
|
||||
{
|
||||
MTGCardInstance * stackCard = player->game->stack->cardsSeenThisTurn[k];
|
||||
if(stackCard->next && stackCard->next == card && (card->previousZone == card->controller()->game->sideboard||card->previousZone == card->controller()->opponent()->game->sideboard))
|
||||
count++;
|
||||
if(stackCard == card && (card->previousZone == card->controller()->game->sideboard||card->previousZone == card->controller()->opponent()->game->sideboard))
|
||||
count++;
|
||||
}
|
||||
if(!count)
|
||||
return 0;
|
||||
}
|
||||
check = restriction[i].find("commandzonecast");
|
||||
if(check != string::npos)
|
||||
{
|
||||
int count = 0;
|
||||
for(unsigned int k = 0; k < player->game->stack->cardsSeenThisTurn.size(); k++)
|
||||
{
|
||||
MTGCardInstance * stackCard = player->game->stack->cardsSeenThisTurn[k];
|
||||
if(stackCard->next && stackCard->next == card && (card->previousZone == card->controller()->game->commandzone||card->previousZone == card->controller()->opponent()->game->commandzone))
|
||||
count++;
|
||||
if(stackCard == card && (card->previousZone == card->controller()->game->commandzone||card->previousZone == card->controller()->opponent()->game->commandzone))
|
||||
count++;
|
||||
}
|
||||
if(!count)
|
||||
return 0;
|
||||
}
|
||||
check = restriction[i].find("rebound");
|
||||
if(check != string::npos)
|
||||
{
|
||||
@@ -1275,6 +1320,14 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "becomesmonarchfoeof", card))
|
||||
return NEW TrplayerMonarch(observer, id, card, tc, once, false, true);
|
||||
|
||||
//takes the initiative - controller of card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "takesinitiativeof", card))
|
||||
return NEW TrplayerInitiative(observer, id, card, tc, once, true, false);
|
||||
|
||||
//takes the initiative - opponent of card controller
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "takesinitiativefoeof", card))
|
||||
return NEW TrplayerInitiative(observer, id, card, tc, once, false, true);
|
||||
|
||||
//shuffled library - controller of card
|
||||
if (TargetChooser * tc = parseSimpleTC(s, "shuffledof", card))
|
||||
return NEW TrplayerShuffled(observer, id, card, tc, once, true, false);
|
||||
@@ -3912,6 +3965,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//takes the initiative
|
||||
vector<string> splitInitiative = parseBetween(s, "takesinitiative", " ", false);
|
||||
if (splitInitiative.size())
|
||||
{
|
||||
Targetable * t = spell ? spell->getNextTarget() : NULL;
|
||||
MTGAbility * a = NEW AAAlterInitiative(observer, id, card, t, NULL, who);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
//alter mutation counter on target card with trigger activation
|
||||
vector<string> splitMutated = parseBetween(s, "altermutationcounter:", " ", false);
|
||||
if (splitMutated.size())
|
||||
|
||||
Reference in New Issue
Block a user