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:
@@ -173,4 +173,12 @@ class ThisX:public ThisDescriptor{
|
|||||||
ThisX * clone() const;
|
ThisX * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ThisVariable:public ThisDescriptor{
|
||||||
|
public:
|
||||||
|
string vWord;
|
||||||
|
virtual int match(MTGCardInstance * card);
|
||||||
|
ThisVariable(int comp,string vWord = "");
|
||||||
|
ThisVariable * clone() const;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -331,6 +331,20 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(GameObserver* obser
|
|||||||
}
|
}
|
||||||
return NULL;
|
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);
|
vector<string>splitTargetComparison = parseBetween(s,"cantargetcard(",")",false);
|
||||||
if (splitTargetComparison.size())
|
if (splitTargetComparison.size())
|
||||||
{
|
{
|
||||||
@@ -679,3 +693,24 @@ ThisX * ThisX::clone() const
|
|||||||
{
|
{
|
||||||
return NEW ThisX(*this);
|
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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user