From 730ddd2b503978119c21be1fec600ad3fc9dee1d Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 10 Aug 2021 23:36:23 -0500 Subject: [PATCH] Changes to Random modes and improved filters Improved search restriction by type, allow you to search for "enchantment creature" or "legendary artifact", the engine no longer excludes or prevents searching two "types". --- projects/mtg/src/Rules.cpp | 23 ++++++++++++----------- projects/mtg/src/WGui.cpp | 3 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/projects/mtg/src/Rules.cpp b/projects/mtg/src/Rules.cpp index 5c362841b..f7f0e95e7 100644 --- a/projects/mtg/src/Rules.cpp +++ b/projects/mtg/src/Rules.cpp @@ -368,12 +368,12 @@ Player * Rules::loadPlayerRandomThree(GameObserver* observer, int isAI) string lands[] = { "", "forest", "island", "mountain", "swamp", "plains", "" }; MTGDeck * tempDeck = NEW MTGDeck(MTGCollection()); - tempDeck->addRandomCards(4, 0, 0, -1, lands[color1].c_str()); - tempDeck->addRandomCards(4, 0, 0, -1, lands[color2].c_str()); - tempDeck->addRandomCards(4, 0, 0, -1, lands[color3].c_str()); - tempDeck->addRandomCards(4, 0, 0, 'R', lands[color1].c_str()); - tempDeck->addRandomCards(4, 0, 0, 'R', lands[color2].c_str()); - tempDeck->addRandomCards(4, 0, 0, 'R', lands[color3].c_str()); + tempDeck->addRandomCards(5, 0, 0, -1, lands[color1].c_str()); + tempDeck->addRandomCards(5, 0, 0, -1, lands[color2].c_str()); + tempDeck->addRandomCards(5, 0, 0, -1, lands[color3].c_str()); + tempDeck->addRandomCards(3, 0, 0, 'R', lands[color1].c_str()); + tempDeck->addRandomCards(3, 0, 0, 'R', lands[color2].c_str()); + tempDeck->addRandomCards(3, 0, 0, 'R', lands[color3].c_str()); tempDeck->addRandomCards(1, 0, 0, 'U', "land"); tempDeck->addRandomCards(1, 0, 0, 'R', "land"); tempDeck->addRandomCards(18, 0, 0, -1, "creature", colors, nbcolors); @@ -401,9 +401,9 @@ Player * Rules::loadPlayerRandomFive(GameObserver* observer, int isAI) { MTGDeck * tempDeck = NEW MTGDeck(MTGCollection()); - tempDeck->addRandomCards(20, 0, 0, -1, "land"); + tempDeck->addRandomCards(24, 0, 0, -1, "land"); tempDeck->addRandomCards(10, 0, 0, -1, "legendary"); - tempDeck->addRandomCards(30, 0, 0, -1, ""); + tempDeck->addRandomCards(26, 0, 0, -1, ""); string deckFile = "random"; string deckFileSmall = "random"; @@ -465,12 +465,13 @@ Player * Rules::loadPlayerHorde(GameObserver* observer, int isAI) MTGDeck * tempDeck = NEW MTGDeck(MTGCollection()); tempDeck->addRandomCards(14, 0, 0, -1, lands[tribeColor[0]].c_str()); - tempDeck->addRandomCards(5, 0, 0, 'R', lands[tribeColor[0]].c_str()); - tempDeck->addRandomCards(5, 0, 0, -1, "land"); - tempDeck->addRandomCards(21, 0, 0, -1, randomTribe); + tempDeck->addRandomCards(6, 0, 0, 'R', lands[tribeColor[0]].c_str()); + tempDeck->addRandomCards(4, 0, 0, -1, "land"); + tempDeck->addRandomCards(20, 0, 0, -1, randomTribe); tempDeck->addRandomCards(5, 0, 0, -1, "enchantment", tribeColor, nbColors); tempDeck->addRandomCards(5, 0, 0, -1, "instant", tribeColor, nbColors); tempDeck->addRandomCards(5, 0, 0, -1, "sorcery", tribeColor, nbColors); + tempDeck->addRandomCards(1, 0, 0, -1, "artifact", tribeColor, nbColors); string deckFile = "random"; string deckFileSmall = "random"; diff --git a/projects/mtg/src/WGui.cpp b/projects/mtg/src/WGui.cpp index dce74fe21..2249d311c 100644 --- a/projects/mtg/src/WGui.cpp +++ b/projects/mtg/src/WGui.cpp @@ -1967,6 +1967,7 @@ bool WGuiFilters::isAvailable(int type) if (!wgfi || wgfi->mState != WGuiFilterItem::STATE_FINISHED) continue; switch (type) { + case WGuiFilterItem::FILTER_TYPE: case WGuiFilterItem::FILTER_SUBTYPE: case WGuiFilterItem::FILTER_BASIC: return true; @@ -2166,7 +2167,7 @@ void WGuiFilterItem::updateValue() } else if (filterType == FILTER_TOUGH) { - for (int i = 0; i < 17; i++) + for (int i = 0; i < 18; i++) { sprintf(buf_code, "tgh:%i;", i); sprintf(buf_name, "%i toughness", i);