diff --git a/projects/mtg/include/ThisDescriptor.h b/projects/mtg/include/ThisDescriptor.h index 19125ad1e..12b5412b9 100644 --- a/projects/mtg/include/ThisDescriptor.h +++ b/projects/mtg/include/ThisDescriptor.h @@ -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 diff --git a/projects/mtg/src/ThisDescriptor.cpp b/projects/mtg/src/ThisDescriptor.cpp index d5ea153d1..f2767cb51 100644 --- a/projects/mtg/src/ThisDescriptor.cpp +++ b/projects/mtg/src/ThisDescriptor.cpp @@ -331,6 +331,20 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(GameObserver* obser } return NULL; } + + //this Variable + vectorsplitVComparison = parseBetween(s,"variable{","}",false); + if (splitVComparison.size()) + { + ThisVariable * td = NEW ThisVariable(criterion,splitVComparison[1]); + if (td) + { + td->comparisonMode = mode; + return td; + } + return NULL; + } + vectorsplitTargetComparison = 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); +} \ No newline at end of file