added drawCounter. Returns the number of cards drawn this turn (excludes pre-game draw).

pdrewcount - player draw count
odrewcount - opponent draw count
This commit is contained in:
anthonycalosa@gmail.com
2013-05-18 15:31:12 +00:00
parent ba5debad05
commit cf74c3480e
5 changed files with 19 additions and 0 deletions

View File

@@ -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();

View File

@@ -41,6 +41,7 @@ public:
int offerInterruptOnPhase;
int skippingTurn;
int extraTurn;
int drawCounter;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
virtual ~Player();

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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)