refactored lifestate check

This commit is contained in:
Anthony Calosa
2015-09-03 20:11:47 +08:00
parent 886eaa4002
commit 42d0480f77
4 changed files with 55 additions and 61 deletions

View File

@@ -727,34 +727,7 @@ void GameObserver::gameStateBasedEffects()
///////////////////////////////////////////////////////////
//life checks/poison checks also checks cant win or lose.//
///////////////////////////////////////////////////////////
if (players[i]->life <= 0 || players[i]->poisonCount >= 10)
{
int cantlosers = 0;
MTGGameZone * z = players[i]->game->inPlay;
int nbcards = z->nb_cards;
for (int j = 0; j < nbcards; ++j)
{
MTGCardInstance * c = z->cards[j];
if (c->has(Constants::CANTLOSE) || (c->has(Constants::CANTLIFELOSE) && players[i]->poisonCount < 10))
{
cantlosers++;
}
}
MTGGameZone * k = players[i]->opponent()->game->inPlay;
int onbcards = k->nb_cards;
for (int m = 0; m < onbcards; ++m)
{
MTGCardInstance * e = k->cards[m];
if (e->has(Constants::CANTWIN))
{
cantlosers++;
}
}
if (cantlosers < 1)
{
setLoser(players[i]);
}
}
players[i]->DeadLifeState();//refactored
}
//////////////////////////////////////////////////////
//-------------card based states effects------------//