From cec4494ce6b0087765c4daf8556889d7cd4a4c9d Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 20 Aug 2016 00:21:58 +0800 Subject: [PATCH] fix can produce mana limited for land... --- .../mtg/bin/Res/missing_cards_by_sets/VIS.txt | 6 -- .../bin/Res/sets/primitives/borderline.txt | 12 ++++ projects/mtg/include/AllAbilities.h | 12 ++-- projects/mtg/include/CardDescriptor.h | 6 ++ projects/mtg/src/CardDescriptor.cpp | 36 ++++++++++ projects/mtg/src/TargetChooser.cpp | 67 +++++++++++++++++++ 6 files changed, 127 insertions(+), 12 deletions(-) diff --git a/projects/mtg/bin/Res/missing_cards_by_sets/VIS.txt b/projects/mtg/bin/Res/missing_cards_by_sets/VIS.txt index 92a7e58f2..6617eb80b 100644 --- a/projects/mtg/bin/Res/missing_cards_by_sets/VIS.txt +++ b/projects/mtg/bin/Res/missing_cards_by_sets/VIS.txt @@ -204,12 +204,6 @@ type=Enchantment subtype=Aura [/card] [card] -name=Squandered Resources -text=Sacrifice a land: Add to your mana pool one mana of any type the sacrificed land could produce. -mana={B}{G} -type=Enchantment -[/card] -[card] name=Talruum Piper text=All creatures with flying able to block Talruum Piper do so. mana={4}{R} diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index 754a903a5..e2cb7cc20 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -351,6 +351,18 @@ power=2 toughness=1 [/card] [card] +name=Squandered Resources +auto=this(variable{plandg}>0) {S(land[manag]|mybattlefield)}:Add{G} +auto=this(variable{plandu}>0) {S(land[manau]|mybattlefield)}:Add{U} +auto=this(variable{plandr}>0) {S(land[manar]|mybattlefield)}:Add{R} +auto=this(variable{plandb}>0) {S(land[manab]|mybattlefield)}:Add{B} +auto=this(variable{plandw}>0) {S(land[manaw]|mybattlefield)}:Add{W} +auto=this(variable{plandc}>0) {S(land[manac]|mybattlefield)}:Add{C} +text=Sacrifice a land: Add to your mana pool one mana of any type the sacrificed land could produce. +mana={B}{G} +type=Enchantment +[/card] +[card] name=Staggershock target=creature,player auto=damage:2 diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 2a8c55330..96e8a8201 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1080,17 +1080,17 @@ public: int count = 0; for (int i = 0; i < player->game->battlefield->nb_cards; i++) { - if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceC && (color == Constants::MTG_COLOR_ARTIFACT || color == Constants::MTG_COLOR_WASTE)) + if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceC && (color == Constants::MTG_COLOR_ARTIFACT || color == Constants::MTG_COLOR_WASTE)) count += 1; - if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceG && color == Constants::MTG_COLOR_GREEN) + if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceG && color == Constants::MTG_COLOR_GREEN) count += 1; - if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceU && color == Constants::MTG_COLOR_BLUE) + if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceU && color == Constants::MTG_COLOR_BLUE) count += 1; - if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceR && color == Constants::MTG_COLOR_RED) + if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceR && color == Constants::MTG_COLOR_RED) count += 1; - if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceB && color == Constants::MTG_COLOR_BLACK) + if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceB && color == Constants::MTG_COLOR_BLACK) count += 1; - if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceW && color == Constants::MTG_COLOR_WHITE) + if(((MTGCardInstance *)player->game->battlefield->cards[i])->isLand() && ((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceW && color == Constants::MTG_COLOR_WHITE) count += 1; } return count; diff --git a/projects/mtg/include/CardDescriptor.h b/projects/mtg/include/CardDescriptor.h index b4808d2bb..81f803beb 100644 --- a/projects/mtg/include/CardDescriptor.h +++ b/projects/mtg/include/CardDescriptor.h @@ -67,6 +67,12 @@ class CardDescriptor: public MTGCardInstance int CDdamager; int CDgeared; int CDblocked; + int CDcanProduceC; + int CDcanProduceG; + int CDcanProduceU; + int CDcanProduceR; + int CDcanProduceB; + int CDcanProduceW; }; #endif diff --git a/projects/mtg/src/CardDescriptor.cpp b/projects/mtg/src/CardDescriptor.cpp index 149e4cdee..b62b7499e 100644 --- a/projects/mtg/src/CardDescriptor.cpp +++ b/projects/mtg/src/CardDescriptor.cpp @@ -26,6 +26,12 @@ CardDescriptor::CardDescriptor() CDdamager = 0; CDgeared = 0; CDblocked = 0; + CDcanProduceC = 0; + CDcanProduceG = 0; + CDcanProduceU = 0; + CDcanProduceR = 0; + CDcanProduceB = 0; + CDcanProduceW = 0; } int CardDescriptor::init() @@ -239,6 +245,36 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) match = NULL; } } + + if ((CDcanProduceC == -1 && card->canproduceC == 1) || (CDcanProduceC == 1 && card->canproduceC == 0)) + { + match = NULL; + } + + if ((CDcanProduceG == -1 && card->canproduceG == 1) || (CDcanProduceG == 1 && card->canproduceG == 0)) + { + match = NULL; + } + + if ((CDcanProduceU == -1 && card->canproduceU == 1) || (CDcanProduceU == 1 && card->canproduceU == 0)) + { + match = NULL; + } + + if ((CDcanProduceR == -1 && card->canproduceR == 1) || (CDcanProduceR == 1 && card->canproduceR == 0)) + { + match = NULL; + } + + if ((CDcanProduceB == -1 && card->canproduceB == 1) || (CDcanProduceB == 1 && card->canproduceB == 0)) + { + match = NULL; + } + + if ((CDcanProduceW == -1 && card->canproduceW == 1) || (CDcanProduceW == 1 && card->canproduceW == 0)) + { + match = NULL; + } if ((isMultiColored == -1 && card->isMultiColored) || (isMultiColored == 1 && !card->isMultiColored)) { diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index e466a254a..8fb854b39 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -557,6 +557,73 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta cd->CDdamager = 1; } } + //can produce mana + else if (attribute.find("manac") != string::npos) + { + if (minus) + { + cd->CDcanProduceC = -1; + } + else + { + cd->CDcanProduceC = 1; + } + } + else if (attribute.find("manag") != string::npos) + { + if (minus) + { + cd->CDcanProduceG = -1; + } + else + { + cd->CDcanProduceG = 1; + } + } + else if (attribute.find("manau") != string::npos) + { + if (minus) + { + cd->CDcanProduceU = -1; + } + else + { + cd->CDcanProduceU = 1; + } + } + else if (attribute.find("manar") != string::npos) + { + if (minus) + { + cd->CDcanProduceR = -1; + } + else + { + cd->CDcanProduceR = 1; + } + } + else if (attribute.find("manab") != string::npos) + { + if (minus) + { + cd->CDcanProduceB = -1; + } + else + { + cd->CDcanProduceB = 1; + } + } + else if (attribute.find("manaw") != string::npos) + { + if (minus) + { + cd->CDcanProduceW = -1; + } + else + { + cd->CDcanProduceW = 1; + } + } else if (attribute.find("multicolor") != string::npos) { //card is multicolored?