Style formatting - no code changes here.

This commit is contained in:
wrenczes@gmail.com
2011-04-22 04:31:55 +00:00
parent b4e3608412
commit 7203ce9436
+441 -349
View File
@@ -40,411 +40,503 @@ using std::map;
#define PARSER_FOREACH 2 #define PARSER_FOREACH 2
#define PARSER_ASLONGAS 3 #define PARSER_ASLONGAS 3
class MTGAbility: public ActionElement{ class MTGAbility : public ActionElement
protected: {
char menuText[50]; protected:
char menuText[50];
GameObserver * game; GameObserver * game;
public: public:
enum { enum
NO_RESTRICTION = 0, {
PLAYER_TURN_ONLY = 1, NO_RESTRICTION = 0,
AS_SORCERY = 2, PLAYER_TURN_ONLY = 1,
MY_BEFORE_BEGIN = 3, AS_SORCERY = 2,
MY_UNTAP = 4, MY_BEFORE_BEGIN = 3,
MY_UPKEEP = 5, MY_UNTAP = 4,
MY_DRAW = 6, MY_UPKEEP = 5,
MY_FIRSTMAIN = 7, MY_DRAW = 6,
MY_COMBATBEGIN = 8, MY_FIRSTMAIN = 7,
MY_COMBATATTACKERS = 9, MY_COMBATBEGIN = 8,
MY_COMBATBLOCKERS = 10, MY_COMBATATTACKERS = 9,
MY_COMBATDAMAGE = 11, MY_COMBATBLOCKERS = 10,
MY_COMBATEND = 12, MY_COMBATDAMAGE = 11,
MY_SECONDMAIN = 13, MY_COMBATEND = 12,
MY_ENDOFTURN = 14, MY_SECONDMAIN = 13,
MY_EOT = 15, MY_ENDOFTURN = 14,
MY_CLEANUP = 16, MY_EOT = 15,
MY_AFTER_EOT = 17, MY_CLEANUP = 16,
MY_AFTER_EOT = 17,
OPPONENT_BEFORE_BEGIN = 23, OPPONENT_BEFORE_BEGIN = 23,
OPPONENT_UNTAP = 24, OPPONENT_UNTAP = 24,
OPPONENT_UPKEEP = 25, OPPONENT_UPKEEP = 25,
OPPONENT_DRAW = 26, OPPONENT_DRAW = 26,
OPPONENT_FIRSTMAIN = 27, OPPONENT_FIRSTMAIN = 27,
OPPONENT_COMBATBEGIN = 28, OPPONENT_COMBATBEGIN = 28,
OPPONENT_COMBATATTACKERS = 29, OPPONENT_COMBATATTACKERS = 29,
OPPONENT_COMBATBLOCKERS = 30, OPPONENT_COMBATBLOCKERS = 30,
OPPONENT_COMBATDAMAGE = 31, OPPONENT_COMBATDAMAGE = 31,
OPPONENT_COMBATEND = 32, OPPONENT_COMBATEND = 32,
OPPONENT_SECONDMAIN = 33, OPPONENT_SECONDMAIN = 33,
OPPONENT_ENDOFTURN = 34, OPPONENT_ENDOFTURN = 34,
OPPONENT_EOT = 35, OPPONENT_EOT = 35,
OPPONENT_CLEANUP = 36, OPPONENT_CLEANUP = 36,
OPPONENT_AFTER_EOT = 37, OPPONENT_AFTER_EOT = 37,
BEFORE_BEGIN = 43, BEFORE_BEGIN = 43,
UNTAP = 44, UNTAP = 44,
UPKEEP = 45, UPKEEP = 45,
DRAW = 46, DRAW = 46,
FIRSTMAIN = 47, FIRSTMAIN = 47,
COMBATBEGIN = 48, COMBATBEGIN = 48,
COMBATATTACKERS = 49, COMBATATTACKERS = 49,
COMBATBLOCKERS = 50, COMBATBLOCKERS = 50,
COMBATDAMAGE = 51, COMBATDAMAGE = 51,
COMBATEND = 52, COMBATEND = 52,
SECONDMAIN = 53, SECONDMAIN = 53,
ENDOFTURN = 54, ENDOFTURN = 54,
EOT = 55, EOT = 55,
CLEANUP = 56, CLEANUP = 56,
AFTER_EOT = 57, AFTER_EOT = 57,
OPPONENT_TURN_ONLY = 60, OPPONENT_TURN_ONLY = 60,
}; };
int parseCastRestrictions(MTGCardInstance * card,Player * player,string restrictions,string otherRestrictions);
int allowedToCast(MTGCardInstance * card,Player * player);
int allowedToAltCast(MTGCardInstance * card,Player * player);
int oneShot;
int forceDestroy;
ManaCost * cost;
ManaCost * alternative;
ManaCost * BuyBack;
ManaCost * FlashBack;
ManaCost * Retrace;
ManaCost * morph;
ManaCost * suspend;
Targetable * target; int parseCastRestrictions(MTGCardInstance* card, Player* player, string restrictions, string otherRestrictions);
int aType; int allowedToCast(MTGCardInstance* card, Player* player);
int naType; int allowedToAltCast(MTGCardInstance* card, Player* player);
int abilitygranted; int oneShot;
MTGCardInstance * source; int forceDestroy;
MTGAbility(int id, MTGCardInstance * card); ManaCost* cost;
MTGAbility(int id, MTGCardInstance * _source, Targetable * _target); ManaCost* alternative;
virtual int testDestroy(); ManaCost* BuyBack;
virtual ~MTGAbility(); ManaCost* FlashBack;
virtual void Render(){}; ManaCost* Retrace;
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL){return 0;}; ManaCost* morph;
virtual int reactToClick(MTGCardInstance * card){return 0;}; ManaCost* suspend;
virtual int receiveEvent(WEvent * event){return 0;};
virtual void Update(float dt){};
virtual int fireAbility();
virtual int stillInUse(MTGCardInstance * card);
virtual int resolve(){return 0;};
virtual MTGAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const;
virtual int addToGame();
virtual int removeFromGame();
/*Poor man's casting */ Targetable * target;
/* Todo replace that crap with dynamic casting */ int aType;
enum { int naType;
UNKNOWN = 0, int abilitygranted;
MANA_PRODUCER = 1, MTGCardInstance * source;
MTG_ATTACK_RULE = 2, MTGAbility(int id, MTGCardInstance * card);
DAMAGER = 3, MTGAbility(int id, MTGCardInstance * _source, Targetable * _target);
STANDARD_REGENERATE = 4, virtual int testDestroy();
PUT_INTO_PLAY = 5, virtual ~MTGAbility();
MOMIR = 6,
MTG_BLOCK_RULE = 7, virtual void Render()
ALTERNATIVE_COST = 8, {
BUYBACK_COST = 9, }
FLASHBACK_COST = 10,
RETRACE_COST = 11, virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL)
MTG_COMBATTRIGGERS_RULE = 12, {
STANDARD_PREVENT = 13, return 0;
STANDARD_EQUIP = 14, }
STANDARD_LEVELUP = 15,
FOREACH = 16, virtual int reactToClick(MTGCardInstance * card)
STANDARD_DRAW = 17, {
STANDARD_PUMP = 18, return 0;
STANDARD_BECOMES = 19, }
UPCOST = 20,
STANDARDABILITYGRANT = 21, virtual int receiveEvent(WEvent * event)
UNTAPPER = 22, {
TAPPER = 23, return 0;
LIFER = 24, }
CLONING = 25,
STANDARD_TEACH = 26, virtual void Update(float dt)
STANDARD_TOKENCREATOR = 27, {
MORPH_COST = 28, }
SUSPEND_COST = 29,
COUNTERS = 30, virtual int fireAbility();
virtual int stillInUse(MTGCardInstance * card);
virtual int resolve()
{
return 0;
}
virtual MTGAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const;
virtual int addToGame();
virtual int removeFromGame();
/*Poor man's casting */
/* Todo replace that crap with dynamic casting */
enum
{
UNKNOWN = 0,
MANA_PRODUCER = 1,
MTG_ATTACK_RULE = 2,
DAMAGER = 3,
STANDARD_REGENERATE = 4,
PUT_INTO_PLAY = 5,
MOMIR = 6,
MTG_BLOCK_RULE = 7,
ALTERNATIVE_COST = 8,
BUYBACK_COST = 9,
FLASHBACK_COST = 10,
RETRACE_COST = 11,
MTG_COMBATTRIGGERS_RULE = 12,
STANDARD_PREVENT = 13,
STANDARD_EQUIP = 14,
STANDARD_LEVELUP = 15,
FOREACH = 16,
STANDARD_DRAW = 17,
STANDARD_PUMP = 18,
STANDARD_BECOMES = 19,
UPCOST = 20,
STANDARDABILITYGRANT = 21,
UNTAPPER = 22,
TAPPER = 23,
LIFER = 24,
CLONING = 25,
STANDARD_TEACH = 26,
STANDARD_TOKENCREATOR = 27,
MORPH_COST = 28,
SUSPEND_COST = 29,
COUNTERS = 30,
}; };
}; };
class NestedAbility{ class NestedAbility
public: {
MTGAbility * ability; public:
NestedAbility(MTGAbility * _ability); MTGAbility* ability;
NestedAbility(MTGAbility* _ability);
}; };
class TriggeredAbility:public MTGAbility{ class TriggeredAbility : public MTGAbility
public: {
TriggeredAbility(int id, MTGCardInstance * card); public:
TriggeredAbility(int id, MTGCardInstance * _source, Targetable * _target); TriggeredAbility(int id, MTGCardInstance* card);
virtual void Update(float dt); TriggeredAbility(int id, MTGCardInstance* _source, Targetable* _target);
virtual void Render(){}; virtual void Update(float dt);
virtual int trigger(){return 0;};
virtual int triggerOnEvent(WEvent * e){return 0;}; virtual void Render()
int receiveEvent(WEvent * e); {
virtual int resolve() = 0; }
virtual TriggeredAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual int trigger()
{
return 0;
}
virtual int triggerOnEvent(WEvent * e)
{
return 0;
}
int receiveEvent(WEvent * e);
virtual int resolve() = 0;
virtual TriggeredAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const;
}; };
class ActivatedAbility:public MTGAbility{ class ActivatedAbility : public MTGAbility
public: {
enum { public:
NO_RESTRICTION = 0, enum
PLAYER_TURN_ONLY = 1, {
AS_SORCERY = 2, NO_RESTRICTION = 0,
MY_BEFORE_BEGIN = 3, PLAYER_TURN_ONLY = 1,
MY_UNTAP = 4, AS_SORCERY = 2,
MY_UPKEEP = 5, MY_BEFORE_BEGIN = 3,
MY_DRAW = 6, MY_UNTAP = 4,
MY_FIRSTMAIN = 7, MY_UPKEEP = 5,
MY_COMBATBEGIN = 8, MY_DRAW = 6,
MY_COMBATATTACKERS = 9, MY_FIRSTMAIN = 7,
MY_COMBATBLOCKERS = 10, MY_COMBATBEGIN = 8,
MY_COMBATDAMAGE = 11, MY_COMBATATTACKERS = 9,
MY_COMBATEND = 12, MY_COMBATBLOCKERS = 10,
MY_SECONDMAIN = 13, MY_COMBATDAMAGE = 11,
MY_ENDOFTURN = 14, MY_COMBATEND = 12,
MY_EOT = 15, MY_SECONDMAIN = 13,
MY_CLEANUP = 16, MY_ENDOFTURN = 14,
MY_AFTER_EOT = 17, MY_EOT = 15,
MY_CLEANUP = 16,
MY_AFTER_EOT = 17,
OPPONENT_BEFORE_BEGIN = 23, OPPONENT_BEFORE_BEGIN = 23,
OPPONENT_UNTAP = 24, OPPONENT_UNTAP = 24,
OPPONENT_UPKEEP = 25, OPPONENT_UPKEEP = 25,
OPPONENT_DRAW = 26, OPPONENT_DRAW = 26,
OPPONENT_FIRSTMAIN = 27, OPPONENT_FIRSTMAIN = 27,
OPPONENT_COMBATBEGIN = 28, OPPONENT_COMBATBEGIN = 28,
OPPONENT_COMBATATTACKERS = 29, OPPONENT_COMBATATTACKERS = 29,
OPPONENT_COMBATBLOCKERS = 30, OPPONENT_COMBATBLOCKERS = 30,
OPPONENT_COMBATDAMAGE = 31, OPPONENT_COMBATDAMAGE = 31,
OPPONENT_COMBATEND = 32, OPPONENT_COMBATEND = 32,
OPPONENT_SECONDMAIN = 33, OPPONENT_SECONDMAIN = 33,
OPPONENT_ENDOFTURN = 34, OPPONENT_ENDOFTURN = 34,
OPPONENT_EOT = 35, OPPONENT_EOT = 35,
OPPONENT_CLEANUP = 36, OPPONENT_CLEANUP = 36,
OPPONENT_AFTER_EOT = 37, OPPONENT_AFTER_EOT = 37,
BEFORE_BEGIN = 43, BEFORE_BEGIN = 43,
UNTAP = 44, UNTAP = 44,
UPKEEP = 45, UPKEEP = 45,
DRAW = 46, DRAW = 46,
FIRSTMAIN = 47, FIRSTMAIN = 47,
COMBATBEGIN = 48, COMBATBEGIN = 48,
COMBATATTACKERS = 49, COMBATATTACKERS = 49,
COMBATBLOCKERS = 50, COMBATBLOCKERS = 50,
COMBATDAMAGE = 51, COMBATDAMAGE = 51,
COMBATEND = 52, COMBATEND = 52,
SECONDMAIN = 53, SECONDMAIN = 53,
ENDOFTURN = 54, ENDOFTURN = 54,
EOT = 55, EOT = 55,
CLEANUP = 56, CLEANUP = 56,
AFTER_EOT = 57, AFTER_EOT = 57,
OPPONENT_TURN_ONLY = 69, OPPONENT_TURN_ONLY = 69,
}; };
ManaCost * abilityCost;
int restrictions; ManaCost* abilityCost;
int limitPerTurn; int restrictions;
int counters; int limitPerTurn;
int needsTapping; int counters;
string limit; int needsTapping;
MTGAbility * sideEffect; string limit;
MTGAbility * sa; MTGAbility* sideEffect;
string usesBeforeSideEffects; MTGAbility* sa;
int uses; string usesBeforeSideEffects;
ActivatedAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _restrictions = NO_RESTRICTION,string limit = "",MTGAbility * sideEffect = NULL,string usesBeforeSideEffects = ""); int uses;
virtual ~ActivatedAbility();
virtual void Update(float dt) ActivatedAbility(int id, MTGCardInstance* card, ManaCost* _cost = NULL, int _restrictions = NO_RESTRICTION, string limit = "", MTGAbility* sideEffect = NULL, string usesBeforeSideEffects = "");
{ virtual ~ActivatedAbility();
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_AFTER_EOT)
{ virtual void Update(float dt)
counters = 0; {
} if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_AFTER_EOT)
return MTGAbility::Update(dt); {
} counters = 0;
virtual int reactToClick(MTGCardInstance * card); }
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); return MTGAbility::Update(dt);
virtual int reactToTargetClick(Targetable * object); }
virtual int activateAbility(); virtual int reactToClick(MTGCardInstance * card);
virtual int resolve() = 0; virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
void activateSideEffect(); virtual int reactToTargetClick(Targetable * object);
virtual ActivatedAbility* clone() const = 0; virtual int activateAbility();
virtual ostream& toString(ostream& out) const; virtual int resolve() = 0;
void activateSideEffect();
virtual ActivatedAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const;
}; };
class TargetAbility:public ActivatedAbility, public NestedAbility{ class TargetAbility : public ActivatedAbility, public NestedAbility
public: {
TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0); public:
TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0); TargetAbility(int id, MTGCardInstance * card, TargetChooser * _tc,ManaCost * _cost = NULL, int _playerturnonly = 0);
virtual int reactToClick(MTGCardInstance * card); TargetAbility(int id, MTGCardInstance * card,ManaCost * _cost = NULL, int _playerturnonly = 0);
virtual int reactToTargetClick(Targetable * object); ~TargetAbility();
virtual TargetAbility* clone() const = 0;
virtual void Render(); virtual int reactToClick(MTGCardInstance * card);
virtual int resolve(); virtual int reactToTargetClick(Targetable * object);
virtual const char * getMenuText(); virtual TargetAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual void Render();
~TargetAbility(); virtual int resolve();
virtual const char * getMenuText();
virtual ostream& toString(ostream& out) const;
}; };
class InstantAbility:public MTGAbility{ class InstantAbility:public MTGAbility
public: {
int init; public:
virtual void Update(float dt); int init;
virtual int testDestroy(); virtual void Update(float dt);
InstantAbility(int _id, MTGCardInstance * source); virtual int testDestroy();
InstantAbility(int _id, MTGCardInstance * source,Targetable * _target); InstantAbility(int _id, MTGCardInstance * source);
virtual int resolve(){return 0;}; InstantAbility(int _id, MTGCardInstance * source,Targetable * _target);
virtual InstantAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual int resolve()
{
return 0;
}
virtual InstantAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const;
}; };
/* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */ /* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */
class ListMaintainerAbility:public MTGAbility{ class ListMaintainerAbility:public MTGAbility
public: {
map<MTGCardInstance *,bool> cards; public:
map<Player *,bool> players; map<MTGCardInstance *,bool> cards;
ListMaintainerAbility(int _id):MTGAbility(_id,NULL){}; map<Player *,bool> players;
ListMaintainerAbility(int _id, MTGCardInstance *_source):MTGAbility(_id, _source){}; ListMaintainerAbility(int _id)
ListMaintainerAbility(int _id, MTGCardInstance *_source,Damageable * _target):MTGAbility(_id, _source, _target){}; : MTGAbility(_id, NULL)
virtual void Update(float dt); {
void updateTargets(); }
virtual bool canTarget(MTGGameZone * zone);
virtual int canBeInList(MTGCardInstance * card) = 0; ListMaintainerAbility(int _id, MTGCardInstance *_source)
virtual int added(MTGCardInstance * card) = 0; : MTGAbility(_id, _source)
virtual int removed(MTGCardInstance * card) = 0; {
virtual int canBeInList(Player * p){return 0;}; }
virtual int added(Player * p){return 0;};
virtual int removed(Player * p){return 0;}; ListMaintainerAbility(int _id, MTGCardInstance *_source,Damageable * _target)
virtual int destroy(); : MTGAbility(_id, _source, _target)
virtual ListMaintainerAbility* clone() const = 0; {
virtual ostream& toString(ostream& out) const; }
virtual void Update(float dt);
void updateTargets();
virtual bool canTarget(MTGGameZone * zone);
virtual int canBeInList(MTGCardInstance * card) = 0;
virtual int added(MTGCardInstance * card) = 0;
virtual int removed(MTGCardInstance * card) = 0;
virtual int canBeInList(Player * p)
{
return 0;
}
virtual int added(Player * p)
{
return 0;
}
virtual int removed(Player * p)
{
return 0;
}
virtual int destroy();
virtual ListMaintainerAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const;
}; };
class TriggerAtPhase:public TriggeredAbility{ class TriggerAtPhase:public TriggeredAbility
public: {
int phaseId; public:
int who; int phaseId;
bool sourceUntapped; int who;
bool sourceTap; bool sourceUntapped;
bool lifelost; bool sourceTap;
int lifeamount; bool lifelost;
TriggerAtPhase(int id, MTGCardInstance * source, Targetable * target,int _phaseId, int who = 0,bool sourceUntapped = false,bool sourceTap = false,bool lifelost = false, int lifeamount = 0); int lifeamount;
virtual int trigger(); TriggerAtPhase(int id, MTGCardInstance * source, Targetable * target,int _phaseId, int who = 0,bool sourceUntapped = false,bool sourceTap = false,bool lifelost = false, int lifeamount = 0);
int resolve(){return 0;}; virtual int trigger();
virtual TriggerAtPhase* clone() const; int resolve(){return 0;};
virtual TriggerAtPhase* clone() const;
}; };
class TriggerNextPhase:public TriggerAtPhase{ class TriggerNextPhase : public TriggerAtPhase
public: {
int destroyActivated; public:
bool sourceUntapped; int destroyActivated;
bool sourceTap; bool sourceUntapped;
TriggerNextPhase(int id, MTGCardInstance * source, Targetable * target,int _phaseId, int who = 0,bool sourceUntapped = false,bool sourceTap = false); bool sourceTap;
virtual TriggerNextPhase* clone() const; TriggerNextPhase(int id, MTGCardInstance * source, Targetable * target,int _phaseId, int who = 0,bool sourceUntapped = false,bool sourceTap = false);
virtual int testDestroy(); virtual TriggerNextPhase* clone() const;
virtual int testDestroy();
}; };
class GenericTriggeredAbility:public TriggeredAbility, public NestedAbility{ class GenericTriggeredAbility : public TriggeredAbility, public NestedAbility
public: {
TriggeredAbility * t; public:
queue<Targetable *> targets; TriggeredAbility * t;
MTGAbility * destroyCondition; queue<Targetable *> targets;
GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a,MTGAbility * dc = NULL, Targetable * _target = NULL); MTGAbility * destroyCondition;
virtual int trigger(); GenericTriggeredAbility(int id, MTGCardInstance * _source, TriggeredAbility * _t, MTGAbility * a,MTGAbility * dc = NULL, Targetable * _target = NULL);
virtual int triggerOnEvent(WEvent * e); virtual int trigger();
virtual int resolve(); virtual int triggerOnEvent(WEvent * e);
virtual int testDestroy(); virtual int resolve();
virtual int testDestroy();
Targetable * getTriggerTarget(WEvent * e, MTGAbility * a); Targetable * getTriggerTarget(WEvent * e, MTGAbility * a);
void setTriggerTargets(Targetable * ta, MTGAbility * a); void setTriggerTargets(Targetable * ta, MTGAbility * a);
void Update(float dt); void Update(float dt);
virtual GenericTriggeredAbility* clone() const; virtual GenericTriggeredAbility* clone() const;
const char * getMenuText(); const char * getMenuText();
~GenericTriggeredAbility(); ~GenericTriggeredAbility();
}; };
/* Ability Factory */ /* Ability Factory */
class AbilityFactory{ class AbilityFactory
private: {
string storedString; private:
int countCards(TargetChooser * tc, Player * player = NULL, int option = 0); string storedString;
TriggeredAbility * parseTrigger(string s, string magicText, int id, Spell * spell, MTGCardInstance *card, Targetable * target); int countCards(TargetChooser * tc, Player * player = NULL, int option = 0);
MTGAbility * getAlternateCost( string s, int id, Spell *spell, MTGCardInstance *card ); TriggeredAbility * parseTrigger(string s, string magicText, int id, Spell * spell, MTGCardInstance *card, Targetable * target);
MTGAbility * getManaReduxAbility(string s, int id, Spell *spell, MTGCardInstance *card, MTGCardInstance *target); MTGAbility * getAlternateCost( string s, int id, Spell *spell, MTGCardInstance *card );
MTGAbility * getManaReduxAbility(string s, int id, Spell *spell, MTGCardInstance *card, MTGCardInstance *target);
public: public:
int parseRestriction(string s); int parseRestriction(string s);
Counter * parseCounter(string s, MTGCardInstance * target, Spell * spell = NULL); Counter * parseCounter(string s, MTGCardInstance * target, Spell * spell = NULL);
int parsePowerToughness(string s, int *power, int *toughness); int parsePowerToughness(string s, int *power, int *toughness);
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0,MTGGameZone * dest = NULL); 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,int oneShot = 0,int forceForever = 0, MTGGameZone * dest = NULL); MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,int oneShot = 0,int forceForever = 0, MTGGameZone * dest = NULL);
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = 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, MTGGameZone * dest = 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); static int computeX(Spell * spell, MTGCardInstance * card);
static int computeXX(Spell * spell, MTGCardInstance * card); static int computeXX(Spell * spell, MTGCardInstance * card);
static MTGAbility * getCoreAbility(MTGAbility * a); static MTGAbility * getCoreAbility(MTGAbility * a);
int destroyAllInPlay(TargetChooser * tc, int bury = 0); int destroyAllInPlay(TargetChooser * tc, int bury = 0);
int moveAll(TargetChooser * tc, string destinationZone); int moveAll(TargetChooser * tc, string destinationZone);
int damageAll(TargetChooser * tc, int damage); int damageAll(TargetChooser * tc, int damage);
int TapAll(TargetChooser * tc); int TapAll(TargetChooser * tc);
int UntapAll(TargetChooser * tc); int UntapAll(TargetChooser * tc);
void addAbilities(int _id, Spell * spell); void addAbilities(int _id, Spell * spell);
}; };
class ActivatedAbilityTP:public ActivatedAbility{ class ActivatedAbilityTP : public ActivatedAbility
{
public: public:
int who; int who;
ActivatedAbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, ManaCost * cost=NULL, int who = TargetChooser::UNSET); ActivatedAbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, ManaCost * cost=NULL, int who = TargetChooser::UNSET);
Targetable * getTarget(); Targetable * getTarget();
}; };
class InstantAbilityTP:public InstantAbility{ class InstantAbilityTP : public InstantAbility
{
public: public:
int who; int who;
InstantAbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, int who = TargetChooser::UNSET); InstantAbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, int who = TargetChooser::UNSET);
Targetable * getTarget(); Targetable * getTarget();
}; };
class AbilityTP:public MTGAbility{ class AbilityTP : public MTGAbility
{
public: public:
int who; int who;
AbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, int who = TargetChooser::UNSET); AbilityTP(int id, MTGCardInstance * card, Targetable * _target = NULL, int who = TargetChooser::UNSET);
Targetable * getTarget();
virtual ~AbilityTP(){}; Targetable * getTarget();
virtual ~AbilityTP()
{
}
}; };
class AManaProducer: public ActivatedAbilityTP{ class AManaProducer : public ActivatedAbilityTP
protected: {
protected:
Player * controller;
Player * controller; public:
string menutext;
public: ManaCost * output;
string menutext; int tap;
ManaCost * output; AManaProducer(int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
int tap; int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
AManaProducer(int id, MTGCardInstance * card, Targetable * t, ManaCost * _output, ManaCost * _cost = NULL, int who = TargetChooser::UNSET ); int resolve();
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL); int reactToClick(MTGCardInstance* _card);
int resolve(); const char * getMenuText();
int reactToClick(MTGCardInstance * _card); ~AManaProducer();
const char * getMenuText(); virtual AManaProducer * clone() const;
~AManaProducer();
virtual AManaProducer * clone() const;
}; };
#endif #endif