From f11cc41df82a3b65fdafc3fe069ca9a3098fe72b Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sun, 4 Sep 2016 13:14:19 +0800 Subject: [PATCH] revised "colorless" attribute in targetchooser also fix worldly tutor --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 4 ++-- projects/mtg/include/CardDescriptor.h | 1 + projects/mtg/src/CardDescriptor.cpp | 12 ++++++++++++ projects/mtg/src/GameObserver.cpp | 4 ++-- projects/mtg/src/TargetChooser.cpp | 8 ++++++-- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index a068b0f12..a0dffa8c4 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -96357,7 +96357,7 @@ type=Sorcery [/card] [card] name=Scouting Trek -auto=moveTo(ownerlibrary) notatarget(land[basic]|mylibrary) +auto=name(put on top) notatarget(land[basic]|mylibrary) moveTo(ownerexile) and!(moveto(ownerlibrary))! text=Search your library for any number of basic land cards. Reveal those cards, then shuffle your library and put them on top of it. mana={1}{G} type=Sorcery @@ -130286,7 +130286,7 @@ type=Instant [/card] [card] name=Worldly Tutor -auto=moveTo(ownerlibrary) notatarget(creature|mylibrary) +auto=Reveal:type:*:mylibrary revealzone(mylibrary) revealtype(creature|mylibrary) optionone name(choose card) target(creature|reveal) transforms((,newability[all(other *|reveal) moveto(mylibrary) and!(shuffle)!],newability[moveto(mylibrary)])) optiononeend revealend text=Search your library for a creature card and reveal that card. Shuffle your library, then put the revealed card back on top of it. mana={G} type=Instant diff --git a/projects/mtg/include/CardDescriptor.h b/projects/mtg/include/CardDescriptor.h index a9e9ac453..23adcfe5c 100644 --- a/projects/mtg/include/CardDescriptor.h +++ b/projects/mtg/include/CardDescriptor.h @@ -74,6 +74,7 @@ class CardDescriptor: public MTGCardInstance int CDcanProduceR; int CDcanProduceB; int CDcanProduceW; + int CDnocolor; }; #endif diff --git a/projects/mtg/src/CardDescriptor.cpp b/projects/mtg/src/CardDescriptor.cpp index 032f721bc..938d33628 100644 --- a/projects/mtg/src/CardDescriptor.cpp +++ b/projects/mtg/src/CardDescriptor.cpp @@ -32,6 +32,7 @@ CardDescriptor::CardDescriptor() CDcanProduceR = 0; CDcanProduceB = 0; CDcanProduceW = 0; + CDnocolor = 0; } int CardDescriptor::init() @@ -285,6 +286,17 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) { match = NULL; } + + if ((CDnocolor == -1 && card->getColor() == 0)) + { + match = NULL; + } + else if(CDnocolor == 1) + { + if(!card->has(Constants::DEVOID)) + if(card->getColor()>0) + match = NULL; + } if ((isMultiColored == -1 && card->isMultiColored) || (isMultiColored == 1 && !card->isMultiColored)) { diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 9fe6187b6..884e332db 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -641,8 +641,8 @@ void GameObserver::gameStateBasedEffects() if (players[d]->snowManaW < 0) players[d]->snowManaW = 0; - MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile }; - for (int k = 0; k < 5; k++) + MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile, players[d]->game->stack }; + for (int k = 0; k < 6; k++) { MTGGameZone * zone = dzones[k]; if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index a57a36f17..b65f876b0 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -790,11 +790,15 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta if (attribute.find("colorless") != string::npos) { attributefound = 1; - for (int cid = 1; cid < Constants::NB_Colors; cid++) + /*for (int cid = 1; cid < Constants::NB_Colors; cid++) { cd->SetExclusionColor(cid); } - cd->mode = CardDescriptor::CD_OR; + cd->mode = CardDescriptor::CD_OR;*/ + if (minus) + cd->CDnocolor = -1; + else + cd->CDnocolor = 1; } if (attribute.find("chosencolor") != string::npos)