diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index fd8438bf5..dfb2a1727 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2420,7 +2420,7 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t //this subkeyword adds a color without removing the existing colors. addNewColors = (sabilities.find("newcolors") != string::npos); - remove = (stypes.find("removesubtypes") != string::npos); + remove = (stypes.find("removealltypes") != string::npos); removeCreatureSubtypes = (stypes.find("removecreaturesubtypes") != string::npos); removeTypes = (stypes.find("removetypes") != string::npos); @@ -2432,8 +2432,9 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t continue; //Erwan 2011/5/6 String comparison is expensive. Any way to do this in a cleaner way? - //I think this is releated to the fact that "Pestilence Rats" is a type for some reason, maybe we don't need that anymore - //TODO Remove the following block if possible + //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; @@ -2502,27 +2503,29 @@ int ATransformer::addToGame() _target->removeType(*it); } } - for (it = types.begin(); it != types.end(); it++) + else { - if(removeCreatureSubtypes) + for (it = types.begin(); it != types.end(); it++) { - _target->removeType(*it); - } - else if(_target->hasSubtype(*it)) - { - //we generally don't want to give a creature type creature again - //all it does is create a sloppy mess of the subtype line on alternative quads - //also creates instances where a card gained a type from an ability like this one - //then loses the type through another ability, when this effect is destroyed the creature regains - //the type, which is wrong. - dontremove.push_back(*it); - } - else - { - _target->addType(*it); + if(removeCreatureSubtypes) + { + _target->removeType(*it); + } + else if(_target->hasSubtype(*it)) + { + //we generally don't want to give a creature type creature again + //all it does is create a sloppy mess of the subtype line on alternative quads + //also creates instances where a card gained a type from an ability like this one + //then loses the type through another ability, when this effect is destroyed the creature regains + //the type, which is wrong. + dontremove.push_back(*it); + } + else + { + _target->addType(*it); + } } } - for (it = colors.begin(); it != colors.end(); it++) { _target->setColor(*it); @@ -2663,7 +2666,6 @@ int ATransformer::destroy() { for (it = oldtypes.begin(); it != oldtypes.end(); it++) { - if (!_target->hasSubtype(*it)) _target->addType(*it); } } diff --git a/projects/mtg/src/CardPrimitive.cpp b/projects/mtg/src/CardPrimitive.cpp index 106baec54..c32e12bb0 100644 --- a/projects/mtg/src/CardPrimitive.cpp +++ b/projects/mtg/src/CardPrimitive.cpp @@ -272,10 +272,6 @@ void CardPrimitive::setName(const string& value) name = value; lcname = value; std::transform(lcname.begin(), lcname.end(), lcname.begin(), ::tolower); - //This is a bug fix for plague rats and the "foreach ability" - //Right now we add names as types, so that they get recognized - if (value.length() && lcname.at(value.length() - 1) == 's') - Subtypes::subtypesList->find(lcname); } const string& CardPrimitive::getName() const diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 9f5ad71f5..fe5ccca7d 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -182,14 +182,12 @@ void MTGCardInstance::initMTGCI() continue; //Erwan 2011/5/6 String comparison is expensive. Any way to do this in a cleaner way? - //I think this is releated to the fact that "Pestilence Rats" is a type for some reason, maybe we don't need that anymore - //TODO Remove the following block if possible - { + //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); }