diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index f3d17d227..e63862e78 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -80,6 +80,8 @@ public: ManaPool * getManaPool(); void takeMulligan(); void serumMulligan(); + bool hasPossibleAttackers(); + bool noPossibleAttackers(); bool DeadLifeState(bool check = false); ManaCost * doesntEmpty; ManaCost * poolDoesntEmpty; diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index baffcd6e7..89e39d161 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -938,13 +938,12 @@ void GameObserver::gameStateBasedEffects() //Auto skip Phases int skipLevel = (currentPlayer->playMode == Player::MODE_TEST_SUITE || mLoading) ? Constants::ASKIP_NONE : options[Options::ASPHASES].number; - int nrCreatures = currentPlayer->game->inPlay->hasType("creature")?1:0; if (skipLevel == Constants::ASKIP_SAFE || skipLevel == Constants::ASKIP_FULL) { if ((opponent()->isAI() && !(isInterrupting)) && ((mCurrentGamePhase == MTG_PHASE_UNTAP) || (mCurrentGamePhase == MTG_PHASE_DRAW) || (mCurrentGamePhase == MTG_PHASE_COMBATBEGIN) - || ((mCurrentGamePhase == MTG_PHASE_COMBATATTACKERS) && (nrCreatures == 0)) + || ((mCurrentGamePhase == MTG_PHASE_COMBATATTACKERS) && (currentPlayer->noPossibleAttackers())) || mCurrentGamePhase == MTG_PHASE_COMBATEND || mCurrentGamePhase == MTG_PHASE_ENDOFTURN || ((mCurrentGamePhase == MTG_PHASE_CLEANUP) && (currentPlayer->game->hand->nb_cards < 8)))) userRequestNextGamePhase(); diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index c6716e3a3..77bbe2443 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -245,6 +245,24 @@ void Player::serumMulligan() //Draw hand no penalty } +bool Player::hasPossibleAttackers() +{ + MTGGameZone * z = game->inPlay; + int nbcards = z->nb_cards; + for (int j = 0; j < nbcards; ++j) + { + MTGCardInstance * c = z->cards[j]; + if (c->canAttack()) + return true; + } + return false; +} + +bool Player::noPossibleAttackers() +{ + return !hasPossibleAttackers(); +} + bool Player::DeadLifeState(bool check) { if ((life <= 0)||(poisonCount >= 10))