added this( keyword variable{ word variable } ) support

auto=this(variable{lifetotal} <10) 1/1
auto=this(variable{opponentpoisoncount} >1) infect

basically allows you to compare against a word variable.
This commit is contained in:
omegablast2002@yahoo.com
2012-01-31 19:17:51 +00:00
parent e6775c0c1a
commit 81c90f0440
2 changed files with 43 additions and 0 deletions

View File

@@ -173,4 +173,12 @@ class ThisX:public ThisDescriptor{
ThisX * clone() const;
};
class ThisVariable:public ThisDescriptor{
public:
string vWord;
virtual int match(MTGCardInstance * card);
ThisVariable(int comp,string vWord = "");
ThisVariable * clone() const;
};
#endif

View File

@@ -331,6 +331,20 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(GameObserver* obser
}
return NULL;
}
//this Variable
vector<string>splitVComparison = parseBetween(s,"variable{","}",false);
if (splitVComparison.size())
{
ThisVariable * td = NEW ThisVariable(criterion,splitVComparison[1]);
if (td)
{
td->comparisonMode = mode;
return td;
}
return NULL;
}
vector<string>splitTargetComparison = parseBetween(s,"cantargetcard(",")",false);
if (splitTargetComparison.size())
{
@@ -679,3 +693,24 @@ ThisX * ThisX::clone() const
{
return NEW ThisX(*this);
}
//
ThisVariable::ThisVariable(int comp,string _vWord)
{
vWord = _vWord;
comparisonCriterion = comp;
}
int ThisVariable::match(MTGCardInstance * card)
{
int result = 0;
WParsedInt * res = NEW WParsedInt(vWord,NULL,card);
result = res->getValue();
SAFE_DELETE(res);
return matchValue(result);
}
ThisVariable * ThisVariable::clone() const
{
return NEW ThisVariable(*this);
}