diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 8f5d90ea2..751dfaba4 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -374,6 +374,14 @@ private: { intValue = target->controller()->opponent()->life; } + else if (s == "pdrewcount") + { + intValue = target->controller()->drawCounter; + } + else if (s == "odrewcount") + { + intValue = target->controller()->opponent()->drawCounter; + } else if (s == "p" || s == "power") { intValue = target->getPower(); diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index 63f02f4f4..a3928cc75 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -41,6 +41,7 @@ public: int offerInterruptOnPhase; int skippingTurn; int extraTurn; + int drawCounter; vectorcurses; Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL); virtual ~Player(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 74feb77f0..9e4c456c4 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1506,6 +1506,13 @@ AADrawer::AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targ game->mLayers->stackLayer()->resolve(); for(int i = numCards.getValue(); i > 0;i--) { + player->drawCounter += 1; + if ((game->turn < 1) && game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN + && game->currentPlayer->game->inPlay->nb_cards == 0 && game->currentPlayer->game->graveyard->nb_cards == 0 + && game->currentPlayer->game->exile->nb_cards == 0 && game->currentlyActing() == (Player*)game->currentPlayer) //1st Play Check + { + game->currentPlayer->drawCounter = 0;//Reset drawCounter for pre-game draw + } WEvent * e = NEW WEventcardDraw(player, 1); game->receiveEvent(e); } diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index bd32a6176..194600b1b 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -203,6 +203,7 @@ void GameObserver::nextGamePhase() { cleanupPhase(); currentPlayer->damageCount = 0; + currentPlayer->drawCounter = 0; currentPlayer->opponent()->damageCount = 0; //added to clear odcount currentPlayer->preventable = 0; mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn; @@ -227,6 +228,7 @@ void GameObserver::nextGamePhase() currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]); } mLayers->actionLayer()->Update(0); + currentPlayer->drawCounter = 0; currentPlayer->lifeLostThisTurn = 0; currentPlayer->opponent()->lifeLostThisTurn = 0; currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty); diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index d32b18a07..58cdfdf3b 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -32,6 +32,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck * playMode = MODE_HUMAN; skippingTurn = 0; extraTurn = 0; + drawCounter = 0; doesntEmpty = NEW ManaCost(); poolDoesntEmpty = NEW ManaCost(); if (deck != NULL)