fixed Issue 819, changed the parsing of and(()) to and!()!, i no longer share the storedstring of transformer, so you can ability$!transforms(( now....

This commit is contained in:
omegablast2002@yahoo.com
2012-03-26 13:51:44 +00:00
parent c5128b35e0
commit 30b379e1da
5 changed files with 12 additions and 9 deletions
+1
View File
@@ -445,6 +445,7 @@ class AbilityFactory
{ {
private: private:
string storedString; string storedString;
string storedAbilityString;
string storedAndAbility; string storedAndAbility;
int countCards(TargetChooser * tc, Player * player = NULL, int option = 0); int countCards(TargetChooser * tc, Player * player = NULL, int option = 0);
TriggeredAbility * parseTrigger(string s, string magicText, int id, Spell * spell, MTGCardInstance *card, Targetable * target); TriggeredAbility * parseTrigger(string s, string magicText, int id, Spell * spell, MTGCardInstance *card, Targetable * target);
+2 -1
View File
@@ -217,8 +217,9 @@ class Constants
NOACTIVATEDTAP = 96, NOACTIVATEDTAP = 96,
NOMANA = 97, NOMANA = 97,
ONLYMANA = 98, ONLYMANA = 98,
POISONDAMAGER = 99,
NB_BASIC_ABILITIES = 99, NB_BASIC_ABILITIES = 100,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
+1 -1
View File
@@ -146,7 +146,7 @@ int Damage::resolve()
if(_target->toughness <= 0 && _target->has(Constants::INDESTRUCTIBLE)) if(_target->toughness <= 0 && _target->has(Constants::INDESTRUCTIBLE))
_target->controller()->game->putInGraveyard(_target); _target->controller()->game->putInGraveyard(_target);
} }
else if (target->type_as_damageable == DAMAGEABLE_PLAYER && source->has(Constants::INFECT)) else if (target->type_as_damageable == DAMAGEABLE_PLAYER && (source->has(Constants::INFECT)||source->has(Constants::POISONDAMAGER)))
{ {
// Poison on player // Poison on player
Player * _target = (Player *) target; Player * _target = (Player *) target;
+6 -6
View File
@@ -1014,18 +1014,18 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{ {
size_t real_end = s.find("!$", found); size_t real_end = s.find("!$", found);
size_t sIndex = found + 9; size_t sIndex = found + 9;
storedString.append(s.substr(sIndex, real_end - sIndex).c_str()); storedAbilityString.append(s.substr(sIndex, real_end - sIndex).c_str());
s.erase(sIndex, real_end - sIndex); s.erase(sIndex, real_end - sIndex);
} }
found = s.find("and(("); found = s.find("and!(");
if (found != string::npos && found + 6 != ')' && storedAndAbility.empty()) if (found != string::npos && found + 6 != ')' && storedAndAbility.empty())
{ {
vector<string> splitAnd = parseBetween(s, "and((", " ))",false); vector<string> splitAnd = parseBetween(s, "and!(", ")!",false);
if(splitAnd.size()) if(splitAnd.size())
{ {
storedAndAbility.append(splitAnd[1]); storedAndAbility.append(splitAnd[1]);
size_t real_end = s.find("))", found); size_t real_end = s.find(")!", found);
size_t sIndex = found + 5; size_t sIndex = found + 5;
s.erase(sIndex, real_end - sIndex); s.erase(sIndex, real_end - sIndex);
} }
@@ -1779,9 +1779,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
//ability creator the target has to do the ability. //ability creator the target has to do the ability.
if(s.find("ability$") != string::npos) if(s.find("ability$") != string::npos)
{ {
if (storedString.size()) if (storedAbilityString.size())
{ {
ATargetedAbilityCreator * abl = NEW ATargetedAbilityCreator(observer, id, card,target, NULL,newName, storedString, who); ATargetedAbilityCreator * abl = NEW ATargetedAbilityCreator(observer, id, card,target, NULL,newName, storedAbilityString, who);
abl->oneShot = 1; abl->oneShot = 1;
storedString.clear(); storedString.clear();
return abl; return abl;
+2 -1
View File
@@ -127,7 +127,8 @@ const char* Constants::MTGBasicAbilities[] = {
"noactivatedability", "noactivatedability",
"notapability", "notapability",
"nomanaability", "nomanaability",
"onlymanaability" "onlymanaability",
"poisondamager"//deals damage to players as poison counters.
}; };
map<string,int> Constants::MTGBasicAbilitiesMap; map<string,int> Constants::MTGBasicAbilitiesMap;