Added X to the filters for this() and thisforeach(), for use with {X} costed activated abilities, although it should theoretically work with spells as well if necessary.
This commit is contained in:
@@ -400,6 +400,9 @@ class GenericActivatedAbility:public ActivatedAbility, public NestedAbility{
|
||||
|
||||
int resolve(){
|
||||
counters++;
|
||||
SAFE_DELETE(ability->cost);
|
||||
ability->cost = abilityCost->Diff(cost);
|
||||
SAFE_DELETE(abilityCost);
|
||||
ability->target = target; //may have been updated...
|
||||
if (ability) return ability->resolve();
|
||||
return 0;
|
||||
@@ -1896,7 +1899,14 @@ public:
|
||||
|
||||
int resolve(){
|
||||
//TODO check if ability is oneShot ?
|
||||
if (td->match(source) > 0){
|
||||
int match;
|
||||
if (!td->compareAbility){
|
||||
match = td->match(source);
|
||||
}else{
|
||||
match = td->match(this);
|
||||
}
|
||||
|
||||
if (match){
|
||||
addAbilityToGame();
|
||||
}else{
|
||||
removeAbilityFromGame();
|
||||
@@ -1961,7 +1971,12 @@ class AThisForEach:public MTGAbility, public NestedAbility{
|
||||
|
||||
int resolve(){
|
||||
//TODO check if ability is oneShot ?
|
||||
int matches = td->match(source);
|
||||
int matches;
|
||||
if (!td->compareAbility){
|
||||
matches = td->match(source);
|
||||
}else{
|
||||
matches = td->match(this);
|
||||
}
|
||||
if (matches > 0) {
|
||||
if (abilities.size()){
|
||||
removeAbilityFromGame();
|
||||
|
||||
@@ -12,12 +12,12 @@ using namespace std;
|
||||
|
||||
class CardPrimitive {
|
||||
protected:
|
||||
ManaCost manaCost;
|
||||
vector<string> ftdText;
|
||||
int init();
|
||||
string lcname;
|
||||
|
||||
public:
|
||||
ManaCost manaCost;
|
||||
string text;
|
||||
string name;
|
||||
|
||||
|
||||
@@ -158,9 +158,11 @@ class ActivatedAbility:public MTGAbility{
|
||||
CLEANUP = 56,
|
||||
AFTER_EOT = 57,
|
||||
};
|
||||
ManaCost * abilityCost;
|
||||
int restrictions;
|
||||
int needsTapping;
|
||||
ActivatedAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _restrictions = NO_RESTRICTION,int tap = 1);
|
||||
virtual ~ActivatedAbility();
|
||||
virtual int reactToClick(MTGCardInstance * card);
|
||||
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
virtual int reactToTargetClick(Targetable * object);
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
|
||||
class ThisDescriptor{
|
||||
public:
|
||||
int compareAbility;
|
||||
int comparisonMode;
|
||||
int comparisonCriterion;
|
||||
virtual int match(MTGCardInstance * card) = 0;
|
||||
virtual int match(MTGAbility * ability) = 0;
|
||||
int matchValue(int value);
|
||||
};
|
||||
|
||||
@@ -27,6 +29,7 @@ class ThisCounter:public ThisDescriptor{
|
||||
public:
|
||||
Counter * counter;
|
||||
virtual int match(MTGCardInstance * card);
|
||||
virtual int match(MTGAbility * ability) {return 0;};
|
||||
ThisCounter(Counter * _counter);
|
||||
ThisCounter(int power, int toughness, int nb, const char * name);
|
||||
~ThisCounter();
|
||||
@@ -35,19 +38,29 @@ class ThisCounter:public ThisDescriptor{
|
||||
class ThisCounterAny:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance *card);
|
||||
virtual int match(MTGAbility * ability) {return 0;};
|
||||
ThisCounterAny(int nb);
|
||||
};
|
||||
|
||||
class ThisPower:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
virtual int match(MTGAbility * ability) {return 0;};
|
||||
ThisPower(int power);
|
||||
};
|
||||
|
||||
class ThisToughness:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
virtual int match(MTGAbility * ability) {return 0;};
|
||||
ThisToughness(int toughness);
|
||||
};
|
||||
|
||||
class ThisX:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGAbility * ability);
|
||||
virtual int match(MTGCardInstance * card) {return 0;};
|
||||
ThisX(int x);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user