From 763918e129635a7ee57ecae311c89bd15893bdd3 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 16 Aug 2016 15:42:22 +0800 Subject: [PATCH] added CD geared attribute --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 8 ++++---- projects/mtg/include/CardDescriptor.h | 1 + projects/mtg/src/CardDescriptor.cpp | 8 +++++++- projects/mtg/src/CardGui.cpp | 11 +++++++++++ projects/mtg/src/TargetChooser.cpp | 11 +++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 5b2a3b447..d7a06e5d0 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -20228,7 +20228,7 @@ type=Instant name=Conduit of Ruin alias=401847 auto=may moveto(myhand) target(creature[colorless;manacost>=7]|mylibrary) -auto=lord(creature|mycastingzone) conduited +auto=lord(creature|mycastingzone) conduited dontremove text=When you cast Conduit of Ruin, you may search your library for a colorless creature card with converted mana cost 7 or greater, reveal it, then shuffle your library and put that card on top of it. -- The first creature spell you cast each turn costs {2} less to cast. mana={6} type=Creature @@ -105454,8 +105454,8 @@ toughness=3 [/card] [card] name=Stone Haven Outfitter -auto=lord(creature[gear >=1]) +1/+1 -auto=@movedto(graveyard) from(creature[gear >=1|mybattlefield):draw:1 controller +auto=lord(creature[geared]|mybattlefield) 1/1 +auto=@movedto(graveyard) from(creature[geared]|mybattlefield):draw:1 controller text=Equipped creatures you control get +1/+1. -- Whenever an equipped creature you control dies, draw a card. mana={1}{W} type=Creature @@ -105554,7 +105554,7 @@ toughness=2 [card] name=Stoneforge Masterwork auto={2}:equip -auto=teach(mytgt) type:creature[share!types!]:Battlefield/type:creature[share!types!]:Battlefield nonstatic +auto=teach(creature) transforms((,newability[foreach(other creature[share!types!]|mybattlefield) 1/1])) text=Equipped creature gets +1/+1 for each other creature you control that shares a creature type with it. -- Equip {2} mana={1} type=Artifact diff --git a/projects/mtg/include/CardDescriptor.h b/projects/mtg/include/CardDescriptor.h index fbe58f4db..96db093cb 100644 --- a/projects/mtg/include/CardDescriptor.h +++ b/projects/mtg/include/CardDescriptor.h @@ -65,6 +65,7 @@ class CardDescriptor: public MTGCardInstance int CDopponentDamaged; int CDcontrollerDamaged; int CDdamager; + int CDgeared; }; #endif diff --git a/projects/mtg/src/CardDescriptor.cpp b/projects/mtg/src/CardDescriptor.cpp index 64951c818..4964d5ef5 100644 --- a/projects/mtg/src/CardDescriptor.cpp +++ b/projects/mtg/src/CardDescriptor.cpp @@ -24,6 +24,7 @@ CardDescriptor::CardDescriptor() CDopponentDamaged = 0; CDcontrollerDamaged = 0; CDdamager = 0; + CDgeared = 0; } int CardDescriptor::init() @@ -53,7 +54,7 @@ void CardDescriptor::setisMultiColored(int w) { isMultiColored = w; } - + void CardDescriptor::setNegativeSubtype(string value) { int id = MTGAllCards::findType(value); @@ -210,6 +211,11 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) { match = NULL; } + + if ((CDgeared == -1 && card->equipment > 0) || (CDgeared == 1 && card->equipment < 1)) + { + match = NULL; + } if ((isMultiColored == -1 && card->isMultiColored) || (isMultiColored == 1 && !card->isMultiColored)) { diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 2ee2a1fa8..c4a740c6c 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1361,6 +1361,17 @@ bool CardGui::FilterCard(MTGCard * _card,string filter) cd.unsecuresetfresh(1); } } + else if (attribute.find("geared") != string::npos) + { + if (minus) + { + cd.CDgeared = -1; + } + else + { + cd.CDgeared = 1; + } + } //creature is a level up creature else if (attribute.find("leveler") != string::npos) { diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index 9ad256d50..82f410eaf 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -444,6 +444,17 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta cd->unsecuresetfresh(1); } } + else if (attribute.find("geared") != string::npos) + { + if (minus) + { + cd->CDgeared = -1; + } + else + { + cd->CDgeared = 1; + } + } //creature is a level up creature else if (attribute.find("leveler") != string::npos) {