From 4458a6e7808dcdfe5189a78861aab2903d751258 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Wed, 4 Aug 2021 15:24:21 +0200 Subject: [PATCH] Fix Mulligan when Human player is not the first one. --- .../mtg/bin/Res/sets/primitives/unsupported.txt | 6 ------ projects/mtg/src/GameStateDuel.cpp | 13 ++++--------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 2e59dcade..e4b2a8dfc 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -12413,12 +12413,6 @@ mana={W} type=Instant [/card] [card] -name=Vanish into Memory -text=Exile target creature. You draw cards equal to that creature's power. At the beginning of your next upkeep, return that card to the battlefield under its owner's control. If you do, discard cards equal to its toughness. -mana={2}{W}{U} -type=Instant -[/card] -[card] name=Varolz, the Scar-Striped text=Each creature card in your graveyard has scavenge. The scavenge cost is equal to its mana cost. (Exile a creature card from your graveyard and pay its mana cost: Put a number of +1/+1 counters equal to that card's power on target creature. Scavenge only as a sorcery.) -- Sacrifice another creature: Regenerate Varolz, the Scar-Striped. mana={1}{B}{G} diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index 4d8a5fcc4..388dd49f6 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -932,29 +932,24 @@ void GameStateDuel::Update(float dt) if (!menu) { menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), DUEL_MENU_GAME_MENU, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 25); - int cardsinhand = game->currentPlayer->game->hand->nb_cards; menu->Add(MENUITEM_CANCEL, "Cancel"); if(taskList->getState() != TaskList::TASKS_ACTIVE){ //almosthumane - mulligan - if ((game->turn < 1) && (cardsinhand != 0) && 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 - //IF there was no play at the moment automatically mulligan + if (((game->turn == 0 && game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN) || (game->turn == 1 && game->getCurrentGamePhase() < MTG_PHASE_DRAW)) + && game->currentPlayer->game->hand->nb_cards > 0 && 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) //Now you can mulligan even if you didn't start as first. { menu->Add(MENUITEM_MULLIGAN, "Mulligan"); } //END almosthumane - mulligan - if(game->getCurrentGamePhase() == MTG_PHASE_COMBATATTACKERS){ // During attack phase it shows a button to toggle all creatures to attack mode + if(game->getCurrentGamePhase() == MTG_PHASE_COMBATATTACKERS && game->currentlyActing() == (Player*)game->currentPlayer){ // During attack phase it shows a button to toggle all creatures to attack mode menu->Add(MENUITEM_TOGGLEATTACK_ALL_CREATURES, "Toggle Attack all Creatures"); } menu->Add(MENUITEM_MAIN_MENU, "Back to main menu"); #ifdef TESTSUITE menu->Add(MENUITEM_UNDO, "Undo"); -#endif -#ifdef TESTSUITE menu->Add(MENUITEM_LOAD, "Load"); #endif - if (mParent->players[1] == PLAYER_TYPE_CPU && (mParent->gameType == GAME_TYPE_COMMANDER || mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_DEMO)) { menu->Add(MENUITEM_SHOW_SCORE, "Show current score");