Erwan
- Adding cycling. Check Akroma's vengeance in ONS for an example. Note that this uses autohand instead of auto, this is important! You can also use autograveyard.
- All "auto" activated abilities should work with autohand, so this is not only for cycling, but could be used for other abilities as well. For example autohand={3}:cycling can also be written autohand={3}{S}:Draw:1
This commit is contained in:
@@ -383,7 +383,8 @@ class GenericActivatedAbility:public ActivatedAbility{
|
||||
MTGAbility * ability;
|
||||
int limitPerTurn;
|
||||
int counters;
|
||||
GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0, int myTurnOnly = 0):ActivatedAbility(_id, card,_cost,myTurnOnly,_tap),ability(a),limitPerTurn(limit){
|
||||
MTGGameZone * activeZone;
|
||||
GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0, int myTurnOnly = 0, MTGGameZone * dest = NULL):ActivatedAbility(_id, card,_cost,myTurnOnly,_tap),ability(a),limitPerTurn(limit),activeZone(dest){
|
||||
counters = 0;
|
||||
target = ability->target;
|
||||
}
|
||||
@@ -424,6 +425,13 @@ class GenericActivatedAbility:public ActivatedAbility{
|
||||
}
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
if (!activeZone) return ActivatedAbility::testDestroy();
|
||||
if (activeZone->hasCard(source)) return 0;
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/* Generic TargetAbility */
|
||||
@@ -432,7 +440,8 @@ class GenericTargetAbility:public TargetAbility{
|
||||
public:
|
||||
int limitPerTurn;
|
||||
int counters;
|
||||
GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc,MTGAbility * a, ManaCost * _cost = NULL, int _tap=0, int limit = 0, int myTurnOnly = 0):TargetAbility(_id,_source, _tc,_cost,myTurnOnly,_tap),limitPerTurn(limit){
|
||||
MTGGameZone * activeZone;
|
||||
GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc,MTGAbility * a, ManaCost * _cost = NULL, int _tap=0, int limit = 0, int myTurnOnly = 0, MTGGameZone * dest = NULL):TargetAbility(_id,_source, _tc,_cost,myTurnOnly,_tap),limitPerTurn(limit), activeZone(dest){
|
||||
ability = a;
|
||||
counters = 0;
|
||||
}
|
||||
@@ -460,10 +469,41 @@ public:
|
||||
TargetAbility::Update(dt);
|
||||
}
|
||||
|
||||
int testDestroy(){
|
||||
if (!activeZone) return TargetAbility::testDestroy();
|
||||
if (activeZone->hasCard(source)) return 0;
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Cycling
|
||||
|
||||
class ACycle:public ActivatedAbility{
|
||||
public:
|
||||
ACycle(int _id, MTGCardInstance * card,Targetable * _target):ActivatedAbility(_id, card){
|
||||
target = _target;
|
||||
}
|
||||
|
||||
int resolve(){
|
||||
source->controller()->game->putInGraveyard(source);
|
||||
source->controller()->game->drawFromLibrary();
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText(){
|
||||
return "Cycling";
|
||||
}
|
||||
|
||||
ACycle * clone() const{
|
||||
ACycle * a = NEW ACycle(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//Drawer, allows to draw a card for a cost:
|
||||
|
||||
@@ -203,10 +203,10 @@ class AbilityFactory{
|
||||
int parsePowerToughness(string s, int *power, int *toughness);
|
||||
TriggeredAbility * parseTrigger(string s, int id, Spell * spell, MTGCardInstance *card, Targetable * target);
|
||||
public:
|
||||
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0);
|
||||
MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0);
|
||||
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0,MTGGameZone * dest = NULL);
|
||||
MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,MTGGameZone * dest = NULL);
|
||||
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL);
|
||||
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL);
|
||||
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL, MTGGameZone * dest = NULL);
|
||||
static int computeX(Spell * spell, MTGCardInstance * card);
|
||||
int destroyAllInPlay(TargetChooser * tc, int bury = 0);
|
||||
int moveAll(TargetChooser * tc, string destinationZone);
|
||||
|
||||
@@ -36,6 +36,7 @@ class MTGCard {
|
||||
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
map<int,int> basicAbilities;
|
||||
map<string,string> magicTexts;
|
||||
string magicText;
|
||||
int alias;
|
||||
string spellTargetType;
|
||||
@@ -71,6 +72,7 @@ class MTGCard {
|
||||
const char * getText();
|
||||
|
||||
void addMagicText(string value);
|
||||
void addMagicText(string value, string zone);
|
||||
|
||||
void setName(string value);
|
||||
const string getName() const;
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
#include "../include/Counters.h"
|
||||
#include "../include/WEvent.h"
|
||||
|
||||
class OtherAbilitiesEventReceiver:public MTGAbility{
|
||||
public:
|
||||
int testDestroy();
|
||||
int receiveEvent(WEvent * event);
|
||||
OtherAbilitiesEventReceiver(int _id);
|
||||
OtherAbilitiesEventReceiver * clone() const;
|
||||
};
|
||||
|
||||
class MTGPutInPlayRule:public MTGAbility{
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
|
||||
Reference in New Issue
Block a user