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:
@@ -25061,6 +25061,14 @@ power=4
|
|||||||
toughness=3
|
toughness=3
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
|
name=Martial Coup
|
||||||
|
mana={X}{W}{W}
|
||||||
|
type=Sorcery
|
||||||
|
text=Put X 1/1 soldier creature tokens into play. If X is 5 or more, destroy all other creatures.
|
||||||
|
auto=this(X>=5) destroy all(creature)
|
||||||
|
auto=token(Soldier,creature soldier,1/1,white) *X
|
||||||
|
[/card]
|
||||||
|
[card]
|
||||||
name=Marton Stromgald
|
name=Marton Stromgald
|
||||||
auto=@each combatblockers:aslongas(Marton Stromgald[attacking]) foreach(other creature[attacking]) all(other creature[attacking]) 1/1 ueot
|
auto=@each combatblockers:aslongas(Marton Stromgald[attacking]) foreach(other creature[attacking]) all(other creature[attacking]) 1/1 ueot
|
||||||
auto=@each combatblockers:aslongas(Marton Stromgald[blocking]) foreach(other creature[blocking]) all(other creature[blocking]) 1/1 ueot
|
auto=@each combatblockers:aslongas(Marton Stromgald[blocking]) foreach(other creature[blocking]) all(other creature[blocking]) 1/1 ueot
|
||||||
|
|||||||
@@ -309,6 +309,8 @@ living_artifact_i169.txt
|
|||||||
living_lands.txt
|
living_lands.txt
|
||||||
lord_of_the_pit.txt
|
lord_of_the_pit.txt
|
||||||
lord_of_the_pit2.txt
|
lord_of_the_pit2.txt
|
||||||
|
martial_coup.txt
|
||||||
|
martial_coup2.txt
|
||||||
master_decoy.txt
|
master_decoy.txt
|
||||||
master_of_etherium.txt
|
master_of_etherium.txt
|
||||||
meekstone.txt
|
meekstone.txt
|
||||||
|
|||||||
Binary file not shown.
@@ -400,28 +400,13 @@ class GenericActivatedAbility:public ActivatedAbility, public NestedAbility{
|
|||||||
|
|
||||||
int resolve(){
|
int resolve(){
|
||||||
counters++;
|
counters++;
|
||||||
setAbilityCost(ability);
|
source->X = abilityCost->Diff(cost)->hasX();
|
||||||
SAFE_DELETE(abilityCost);
|
SAFE_DELETE(abilityCost);
|
||||||
ability->target = target; //may have been updated...
|
ability->target = target; //may have been updated...
|
||||||
if (ability) return ability->resolve();
|
if (ability) return ability->resolve();
|
||||||
return 0;
|
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(){
|
const char * getMenuText(){
|
||||||
if (ability) return ability->getMenuText();
|
if (ability) return ability->getMenuText();
|
||||||
return "Error";
|
return "Error";
|
||||||
@@ -1914,13 +1899,8 @@ public:
|
|||||||
int resolve(){
|
int resolve(){
|
||||||
//TODO check if ability is oneShot ?
|
//TODO check if ability is oneShot ?
|
||||||
int match;
|
int match;
|
||||||
if (!td->compareAbility){
|
match = td->match(source);
|
||||||
match = td->match(source);
|
if (match > 0){
|
||||||
}else{
|
|
||||||
match = td->match(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match){
|
|
||||||
addAbilityToGame();
|
addAbilityToGame();
|
||||||
}else{
|
}else{
|
||||||
removeAbilityFromGame();
|
removeAbilityFromGame();
|
||||||
@@ -1986,11 +1966,7 @@ class AThisForEach:public MTGAbility, public NestedAbility{
|
|||||||
int resolve(){
|
int resolve(){
|
||||||
//TODO check if ability is oneShot ?
|
//TODO check if ability is oneShot ?
|
||||||
int matches;
|
int matches;
|
||||||
if (!td->compareAbility){
|
matches = td->match(source);
|
||||||
matches = td->match(source);
|
|
||||||
}else{
|
|
||||||
matches = td->match(this);
|
|
||||||
}
|
|
||||||
if (matches > 0) {
|
if (matches > 0) {
|
||||||
if (abilities.size()){
|
if (abilities.size()){
|
||||||
removeAbilityFromGame();
|
removeAbilityFromGame();
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ class CardPrimitive {
|
|||||||
vector<string> ftdText;
|
vector<string> ftdText;
|
||||||
int init();
|
int init();
|
||||||
string lcname;
|
string lcname;
|
||||||
|
ManaCost manaCost;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ManaCost manaCost;
|
|
||||||
string text;
|
string text;
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
|||||||
public:
|
public:
|
||||||
MTGGameZone * currentZone;
|
MTGGameZone * currentZone;
|
||||||
Pos* view;
|
Pos* view;
|
||||||
|
int X;
|
||||||
int regenerateTokens;
|
int regenerateTokens;
|
||||||
int isToken;
|
int isToken;
|
||||||
int stillInUse();
|
int stillInUse();
|
||||||
|
|||||||
@@ -12,11 +12,9 @@
|
|||||||
|
|
||||||
class ThisDescriptor{
|
class ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
int compareAbility;
|
|
||||||
int comparisonMode;
|
int comparisonMode;
|
||||||
int comparisonCriterion;
|
int comparisonCriterion;
|
||||||
virtual int match(MTGCardInstance * card) = 0;
|
virtual int match(MTGCardInstance * card) = 0;
|
||||||
virtual int match(MTGAbility * ability) = 0;
|
|
||||||
int matchValue(int value);
|
int matchValue(int value);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,7 +27,7 @@ class ThisCounter:public ThisDescriptor{
|
|||||||
public:
|
public:
|
||||||
Counter * counter;
|
Counter * counter;
|
||||||
virtual int match(MTGCardInstance * card);
|
virtual int match(MTGCardInstance * card);
|
||||||
virtual int match(MTGAbility * ability) {return 0;};
|
|
||||||
ThisCounter(Counter * _counter);
|
ThisCounter(Counter * _counter);
|
||||||
ThisCounter(int power, int toughness, int nb, const char * name);
|
ThisCounter(int power, int toughness, int nb, const char * name);
|
||||||
~ThisCounter();
|
~ThisCounter();
|
||||||
@@ -38,28 +36,27 @@ class ThisCounter:public ThisDescriptor{
|
|||||||
class ThisCounterAny:public ThisDescriptor{
|
class ThisCounterAny:public ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
virtual int match(MTGCardInstance *card);
|
virtual int match(MTGCardInstance *card);
|
||||||
virtual int match(MTGAbility * ability) {return 0;};
|
|
||||||
ThisCounterAny(int nb);
|
ThisCounterAny(int nb);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThisPower:public ThisDescriptor{
|
class ThisPower:public ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
virtual int match(MTGCardInstance * card);
|
virtual int match(MTGCardInstance * card);
|
||||||
virtual int match(MTGAbility * ability) {return 0;};
|
|
||||||
ThisPower(int power);
|
ThisPower(int power);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThisToughness:public ThisDescriptor{
|
class ThisToughness:public ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
virtual int match(MTGCardInstance * card);
|
virtual int match(MTGCardInstance * card);
|
||||||
virtual int match(MTGAbility * ability) {return 0;};
|
|
||||||
ThisToughness(int toughness);
|
ThisToughness(int toughness);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThisX:public ThisDescriptor{
|
class ThisX:public ThisDescriptor{
|
||||||
public:
|
public:
|
||||||
virtual int match(MTGAbility * ability);
|
virtual int match(MTGCardInstance * card);
|
||||||
virtual int match(MTGCardInstance * card) {return 0;};
|
|
||||||
ThisX(int x);
|
ThisX(int x);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1971,6 +1971,7 @@ void TargetAbility::Render(){
|
|||||||
int TargetAbility::resolve(){
|
int TargetAbility::resolve(){
|
||||||
Targetable * t = tc->getNextTarget();
|
Targetable * t = tc->getNextTarget();
|
||||||
if (t && ability){
|
if (t && ability){
|
||||||
|
source->X = abilityCost->Diff(cost)->hasX();
|
||||||
ability->target = t;
|
ability->target = t;
|
||||||
if (ability->oneShot) return ability->resolve();
|
if (ability->oneShot) return ability->resolve();
|
||||||
MTGAbility * a = ability->clone();
|
MTGAbility * a = ability->clone();
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ int MTGCardInstance::init(){
|
|||||||
MTGCard::init();
|
MTGCard::init();
|
||||||
CardPrimitive::init();
|
CardPrimitive::init();
|
||||||
data = this;
|
data = this;
|
||||||
|
X = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
|
|||||||
copy->previous = card;
|
copy->previous = card;
|
||||||
copy->view = card->view;
|
copy->view = card->view;
|
||||||
copy->isToken = card->isToken;
|
copy->isToken = card->isToken;
|
||||||
|
copy->X = card->X;
|
||||||
|
|
||||||
//stupid bug with tokens...
|
//stupid bug with tokens...
|
||||||
if (card->model == card)
|
if (card->model == card)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){
|
|||||||
}else{
|
}else{
|
||||||
spell = game->mLayers->stackLayer()->addSpell(copy,NULL, spellCost, payResult);
|
spell = game->mLayers->stackLayer()->addSpell(copy,NULL, spellCost, payResult);
|
||||||
}
|
}
|
||||||
|
copy->X = spell->computeX(copy);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,13 +159,11 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThisCounter::ThisCounter(Counter * _counter){
|
ThisCounter::ThisCounter(Counter * _counter){
|
||||||
compareAbility = 0;
|
|
||||||
counter = _counter;
|
counter = _counter;
|
||||||
comparisonCriterion = counter->nb;
|
comparisonCriterion = counter->nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThisCounter::ThisCounter(int power, int toughness, int nb, const char * name){
|
ThisCounter::ThisCounter(int power, int toughness, int nb, const char * name){
|
||||||
compareAbility = 0;
|
|
||||||
counter = NEW Counter(NULL,name,power,toughness);
|
counter = NEW Counter(NULL,name,power,toughness);
|
||||||
comparisonCriterion = nb;
|
comparisonCriterion = nb;
|
||||||
}
|
}
|
||||||
@@ -197,7 +195,6 @@ ThisCounter::~ThisCounter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThisPower::ThisPower(int power){
|
ThisPower::ThisPower(int power){
|
||||||
compareAbility = 0;
|
|
||||||
comparisonCriterion = power;
|
comparisonCriterion = power;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +203,6 @@ int ThisPower::match(MTGCardInstance * card){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThisToughness::ThisToughness(int toughness){
|
ThisToughness::ThisToughness(int toughness){
|
||||||
compareAbility = 0;
|
|
||||||
comparisonCriterion = toughness;
|
comparisonCriterion = toughness;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +211,6 @@ int ThisToughness::match(MTGCardInstance * card){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThisCounterAny::ThisCounterAny(int nb){
|
ThisCounterAny::ThisCounterAny(int nb){
|
||||||
compareAbility = 0;
|
|
||||||
comparisonCriterion = nb;
|
comparisonCriterion = nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,9 +224,8 @@ int ThisCounterAny::match(MTGCardInstance * card){
|
|||||||
|
|
||||||
ThisX::ThisX(int x){
|
ThisX::ThisX(int x){
|
||||||
comparisonCriterion = x;
|
comparisonCriterion = x;
|
||||||
compareAbility = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ThisX::match(MTGAbility * ability){
|
int ThisX::match(MTGCardInstance * card){
|
||||||
return matchValue(ability->cost->hasX());
|
return matchValue(card->X);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user