refactored the typemin: cast restriction, there was a reported bug with it and while debugging it screamed refactor.
so i converted it from string comparisons and counting the battlefield..into targetchoosers with declarable operator. simplified the code from the mess it was before into something alot easier to card code with. example before: mytypemin:less type(land),opponenttypemin:* type(land) becomes type(land|mybattlefield)~lessthan~type(land|opponentbattlefield) the new syntax is: type(targetchooser)~operator~number type(targetchooser)~operator~type(targetchooser) the operator are: morethan lessthan equalto
This commit is contained in:
@@ -832,6 +832,28 @@ bool TargetChooser::validTargetsExist()
|
||||
return false;
|
||||
}
|
||||
|
||||
int TargetChooser::countValidTargets()
|
||||
{
|
||||
int result = 0;
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Player *p = GameObserver::GetInstance()->players[i];
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
MTGGameZone * z = zones[k];
|
||||
if (targetsZone(z))
|
||||
{
|
||||
for (int j = 0; j < z->nb_cards; j++)
|
||||
{
|
||||
if (canTarget(z->cards[j])) result++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool TargetChooser::equals(TargetChooser * tc)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user