Update this(X) so that it works with spells as well as activated abilities. Also fixed a bug were this(X) did not work with targeting.
Adds Martial Coup
This commit is contained in:
@@ -400,28 +400,13 @@ class GenericActivatedAbility:public ActivatedAbility, public NestedAbility{
|
||||
|
||||
int resolve(){
|
||||
counters++;
|
||||
setAbilityCost(ability);
|
||||
source->X = abilityCost->Diff(cost)->hasX();
|
||||
SAFE_DELETE(abilityCost);
|
||||
ability->target = target; //may have been updated...
|
||||
if (ability) return ability->resolve();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void setAbilityCost(MTGAbility * _ability){
|
||||
SAFE_DELETE(_ability->cost);
|
||||
_ability->cost = abilityCost->Diff(cost);
|
||||
|
||||
NestedAbility * na = dynamic_cast<NestedAbility *>(_ability);
|
||||
if (na) setAbilityCost(na->ability);
|
||||
|
||||
MultiAbility * ma = dynamic_cast<MultiAbility *>(_ability);
|
||||
if (ma) {
|
||||
for (size_t i = 0; i < ma->abilities.size(); i++) {
|
||||
setAbilityCost(ma->abilities[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
const char * getMenuText(){
|
||||
if (ability) return ability->getMenuText();
|
||||
return "Error";
|
||||
@@ -1914,13 +1899,8 @@ public:
|
||||
int resolve(){
|
||||
//TODO check if ability is oneShot ?
|
||||
int match;
|
||||
if (!td->compareAbility){
|
||||
match = td->match(source);
|
||||
}else{
|
||||
match = td->match(this);
|
||||
}
|
||||
|
||||
if (match){
|
||||
match = td->match(source);
|
||||
if (match > 0){
|
||||
addAbilityToGame();
|
||||
}else{
|
||||
removeAbilityFromGame();
|
||||
@@ -1986,11 +1966,7 @@ class AThisForEach:public MTGAbility, public NestedAbility{
|
||||
int resolve(){
|
||||
//TODO check if ability is oneShot ?
|
||||
int matches;
|
||||
if (!td->compareAbility){
|
||||
matches = td->match(source);
|
||||
}else{
|
||||
matches = td->match(this);
|
||||
}
|
||||
matches = td->match(source);
|
||||
if (matches > 0) {
|
||||
if (abilities.size()){
|
||||
removeAbilityFromGame();
|
||||
|
||||
@@ -15,9 +15,9 @@ class CardPrimitive {
|
||||
vector<string> ftdText;
|
||||
int init();
|
||||
string lcname;
|
||||
ManaCost manaCost;
|
||||
|
||||
public:
|
||||
ManaCost manaCost;
|
||||
string text;
|
||||
string name;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
public:
|
||||
MTGGameZone * currentZone;
|
||||
Pos* view;
|
||||
int X;
|
||||
int regenerateTokens;
|
||||
int isToken;
|
||||
int stillInUse();
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
@@ -29,7 +27,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();
|
||||
@@ -38,28 +36,27 @@ 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;};
|
||||
virtual int match(MTGCardInstance * card);
|
||||
ThisX(int x);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user