fixed a parsing error with tokengen, no actually my fault :P there was never a check if the end was the real end or not.

2nd, added this(blocking) in hopes to fix mogg flunkies and similar creatures.
This commit is contained in:
omegablast2002@yahoo.com
2011-04-14 17:06:44 +00:00
parent 115ad75c2f
commit 9d52e4547e
3 changed files with 35 additions and 2 deletions

View File

@@ -98,6 +98,13 @@ class ThisAttacked:public ThisDescriptor{
ThisAttacked(int attack);
};
class ThisBlocked:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisBlocked(int block);
};
class ThisNotBlocked:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);

View File

@@ -1817,7 +1817,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return tok;
}
}
size_t realEnd = s.find(")", found);
end = s.find(",", found);
string sname = s.substr(found + 6, end - found - 6);
size_t previous = end + 1;
@@ -1825,6 +1825,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
string stypes = s.substr(previous, end - previous);
previous = end + 1;
end = s.find(",", previous);
if(end == string::npos)
end = realEnd;
string spt = s.substr(previous, end - previous);
int value = 0;
int power, toughness;

View File

@@ -214,7 +214,19 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s)
}
return NULL;
}
//whenever this creature blocks do effect
found = s.find("blocking");
if (found != string::npos)
{
ThisBlocked * td = NEW ThisBlocked(criterion);
if (td)
{
td->comparisonMode = mode;
return td;
}
return NULL;
}
//whenever this creature attacks do effect
found = s.find("notblocked");
if (found != string::npos)
@@ -444,6 +456,18 @@ int ThisAttacked::match(MTGCardInstance * card)
return matchValue(card->didattacked);
}
ThisBlocked::ThisBlocked(int block)
{
comparisonCriterion = block;
}
int ThisBlocked::match(MTGCardInstance * card)
{
return matchValue(card->didblocked);
}
ThisNotBlocked::ThisNotBlocked(int unblocked)
{