From 39420a911fd2a111d52d7a0e764459a331839f18 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Mon, 16 May 2011 18:36:47 +0000 Subject: [PATCH] 3 fixes, first you are not allowed to mulligen the opponents hand. second persist was using the stack on its returning effect, this is incorrect as per MTG rules for persist, the card is supposed to go from the grave directly to inplay(grave -> temp -> inplay, in our case). third, tokens models don't have names, so i make it check now for a name size on the model before clearing and resetting in tranformer. --- projects/mtg/src/AllAbilities.cpp | 7 +++++-- projects/mtg/src/GameStateDuel.cpp | 6 +++--- projects/mtg/src/MTGRules.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 32cc20527..907cd4281 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2682,10 +2682,13 @@ int ATransformer::destroy() _target->addType(*it); } } - //n the case that we removed or added types to a card, so that it retains its original name when the effect is removed. + //in the case that we removed or added types to a card, so that it retains its original name when the effect is removed. + if(_target->model->data->name.size())//tokens don't have a model name. + { _target->name.clear(); _target->setName(_target->model->data->name.c_str()); - } + } + } return 1; } diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index 54a0b0abd..78c0e790f 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -474,12 +474,12 @@ void GameStateDuel::Update(float dt) { menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 25, game->players[1]->deckName.c_str()); - int cardsinhand = game->players[0]->game->hand->nb_cards; + int cardsinhand = game->currentPlayer->game->hand->nb_cards; //almosthumane - mulligan if ((game->turn < 1) && (cardsinhand != 0) && game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN - && game->players[0]->game->inPlay->nb_cards == 0 && game->players[0]->game->graveyard->nb_cards == 0 - && game->players[0]->game->exile->nb_cards == 0) //1st Play Check + && 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 //IF there was no play at the moment automatically mulligan { menu->Add(MENUITEM_MULLIGAN, "Mulligan"); diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index de5859570..053ca641d 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -1778,7 +1778,7 @@ int MTGPersistRule::receiveEvent(WEvent * event) Player * p = game->players[i]; if (e->to == p->game->graveyard) { - MTGCardInstance * copy = p->game->putInZone(e->card, p->game->graveyard, e->card->owner->game->stack); + MTGCardInstance * copy = p->game->putInZone(e->card, p->game->graveyard, e->card->owner->game->temp); if (!copy) { DebugTrace("MTGRULES: couldn't move card for persist");