//Returns true if a card with the given MTG ID exists bool AIHints::findSource(int sourceId) { for (int i = 0; i < mPlayer->game->inPlay->nb_cards; i++) { MTGCardInstance * c = mPlayer->game->inPlay->cards[i]; if (c->getMTGId() == sourceId) return true; } return false; }
MTGCardInstance * Rules::getCardByMTGId(GameObserver* g, int mtgid) { for (int i = 0; i < 2; i++) { Player * p = g->players[i]; MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard }; for (int j = 0; j < 4; j++) { MTGGameZone * zone = zones[j]; for (int k = 0; k < zone->nb_cards; k++) { MTGCardInstance * card = zone->cards[k]; if (!card) return NULL; if (card->getMTGId() == mtgid) return card; } } } return NULL; }