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:
@@ -98,6 +98,13 @@ class ThisAttacked:public ThisDescriptor{
|
|||||||
ThisAttacked(int attack);
|
ThisAttacked(int attack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ThisBlocked:public ThisDescriptor{
|
||||||
|
public:
|
||||||
|
virtual int match(MTGCardInstance * card);
|
||||||
|
|
||||||
|
ThisBlocked(int block);
|
||||||
|
};
|
||||||
|
|
||||||
class ThisNotBlocked:public ThisDescriptor{
|
class ThisNotBlocked:public ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
virtual int match(MTGCardInstance * card);
|
virtual int match(MTGCardInstance * card);
|
||||||
|
|||||||
@@ -1817,7 +1817,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
size_t realEnd = s.find(")", found);
|
||||||
end = s.find(",", found);
|
end = s.find(",", found);
|
||||||
string sname = s.substr(found + 6, end - found - 6);
|
string sname = s.substr(found + 6, end - found - 6);
|
||||||
size_t previous = end + 1;
|
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);
|
string stypes = s.substr(previous, end - previous);
|
||||||
previous = end + 1;
|
previous = end + 1;
|
||||||
end = s.find(",", previous);
|
end = s.find(",", previous);
|
||||||
|
if(end == string::npos)
|
||||||
|
end = realEnd;
|
||||||
string spt = s.substr(previous, end - previous);
|
string spt = s.substr(previous, end - previous);
|
||||||
int value = 0;
|
int value = 0;
|
||||||
int power, toughness;
|
int power, toughness;
|
||||||
|
|||||||
@@ -214,7 +214,19 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s)
|
|||||||
}
|
}
|
||||||
return NULL;
|
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
|
//whenever this creature attacks do effect
|
||||||
found = s.find("notblocked");
|
found = s.find("notblocked");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
@@ -444,6 +456,18 @@ int ThisAttacked::match(MTGCardInstance * card)
|
|||||||
return matchValue(card->didattacked);
|
return matchValue(card->didattacked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThisBlocked::ThisBlocked(int block)
|
||||||
|
{
|
||||||
|
|
||||||
|
comparisonCriterion = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ThisBlocked::match(MTGCardInstance * card)
|
||||||
|
{
|
||||||
|
|
||||||
|
return matchValue(card->didblocked);
|
||||||
|
}
|
||||||
|
|
||||||
ThisNotBlocked::ThisNotBlocked(int unblocked)
|
ThisNotBlocked::ThisNotBlocked(int unblocked)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user