diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index d37aa73dd..5a8030db9 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -6,6 +6,7 @@ generic/becomes_transform_i559.txt generic/becomes_transform_i559_2.txt generic/bushido_1.txt generic/bushido_2.txt +generic/changeling_i501.txt generic/cycling.txt generic/cycling2.txt generic/deathtouch.txt diff --git a/projects/mtg/bin/Res/test/bugs/changeling_i501.txt b/projects/mtg/bin/Res/test/generic/changeling_i501.txt similarity index 100% rename from projects/mtg/bin/Res/test/bugs/changeling_i501.txt rename to projects/mtg/bin/Res/test/generic/changeling_i501.txt diff --git a/projects/mtg/include/Subtypes.h b/projects/mtg/include/Subtypes.h index 96e4f4b91..426e7d9eb 100644 --- a/projects/mtg/include/Subtypes.h +++ b/projects/mtg/include/Subtypes.h @@ -41,7 +41,6 @@ public: Subtypes(); int find(string subtype, bool forceAdd = true); string find(unsigned int id); - bool isSubtypeOfType(string subtype, string type); bool isSubtypeOfType(unsigned int subtype, unsigned int type); bool isSuperType(unsigned int type); bool isType(unsigned int type); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 698462046..32cc20527 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2426,18 +2426,12 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos) { - for (size_t i = 0; i getValuesById().size(); ++i) + const vector values = Subtypes::subtypesList->getValuesById(); + for (size_t i = 0; i isSubtypeOfType(i,Subtypes::TYPE_CREATURE)) continue; - //Erwan 2011/5/6 String comparison is expensive. Any way to do this in a cleaner way? - //this check is related to targetchooser instances of cards dynamically loaded subtypes. - //example(foreach(arbor elf)) adds this as a subtype for list ment. - //TODO find cheaper method - string s = Subtypes::subtypesList->find(i); - if (s.find(" ") != string::npos) - continue; types.push_back(i); } } diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index fe5ccca7d..48a1c1e85 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -173,23 +173,14 @@ void MTGCardInstance::initMTGCI() if (basicAbilities[(int)Constants::CHANGELING]) {//if the card is a changeling, it gains all creature subtypes - for (size_t i = 0; i getValuesById().size(); ++i) + const vector values = Subtypes::subtypesList->getValuesById(); + for (size_t i = 0; i < values.size(); ++i) { - if (hasSubtype(i)) - continue; - if (!Subtypes::subtypesList->isSubtypeOfType(i,Subtypes::TYPE_CREATURE)) continue; - //Erwan 2011/5/6 String comparison is expensive. Any way to do this in a cleaner way? - //this check is related to targetchooser instances of cards dynamically loaded subtypes. - //example(foreach(arbor elf)) adds this as a subtype for list ment. - //TODO find cheaper method - string s = Subtypes::subtypesList->find(i); - if (s.find(" ") != string::npos) - continue; - - addType(i); + //Don' want to send any event to the gameObserver inside of initMCGI, so calling the parent addType method instead of mine + CardPrimitive::addType(i); } } diff --git a/projects/mtg/src/Subtypes.cpp b/projects/mtg/src/Subtypes.cpp index de1045d3a..dfdd8b2c0 100644 --- a/projects/mtg/src/Subtypes.cpp +++ b/projects/mtg/src/Subtypes.cpp @@ -63,12 +63,6 @@ string Subtypes::find(unsigned int id) return valuesById[id - 1]; } -bool Subtypes::isSubtypeOfType(string subtype, string type) -{ - unsigned int subtypeInt = find(subtype); - unsigned int typeInt = find(type); - return isSubtypeOfType(subtypeInt, typeInt); -} bool Subtypes::isSubtypeOfType(unsigned int subtype, unsigned int type) { return (subtypesToType[subtype] == type);