diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index b614f9ce1..78dc62bd8 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -130,9 +130,8 @@ public: int abilitygranted; MTGCardInstance * source; - int parseCastRestrictions(MTGCardInstance* card, Player* player, string restrictions, string otherRestrictions); - int allowedToCast(MTGCardInstance* card, Player* player); - int allowedToAltCast(MTGCardInstance* card, Player* player); + static int allowedToCast(MTGCardInstance* card, Player* player); + static int allowedToAltCast(MTGCardInstance* card, Player* player); MTGAbility(int id, MTGCardInstance * card); MTGAbility(int id, MTGCardInstance * _source, Targetable * _target); MTGAbility(const MTGAbility& copyFromMe); @@ -453,8 +452,8 @@ private: TargetChooser * parseSimpleTC(const std::string& s, const std::string& starter, MTGCardInstance *card, bool forceNoTarget = true); public: - int parseRestriction(string s); - int parseCastRestrictions(MTGCardInstance * card = NULL,Player * player= NULL,string restrictions= "",string otherRestrictions= ""); + static int parseRestriction(string s); + static int parseCastRestrictions(MTGCardInstance * card, Player * player, string restrictions); Counter * parseCounter(string s, MTGCardInstance * target, Spell * spell = NULL); int parsePowerToughness(string s, int *power, int *toughness); int getAbilities(vector * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0, MTGGameZone * dest = NULL); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 984fcfe13..5901aa2ba 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -59,34 +59,24 @@ const int kDynamicWhoIds[] = { AADynamic::DYNAMIC_ABILITY_WHO_TOSOURCE, AADynamic::DYNAMIC_ABILITY_WHO_SOURCECONTROLLER, AADynamic::DYNAMIC_ABILITY_WHO_SOURCEOPPONENT }; - -int MTGAbility::parseCastRestrictions(MTGCardInstance * card,Player * player,string restrictions,string otherRestrictions) -{ - AbilityFactory af; - return af.parseCastRestrictions(card,player,restrictions,otherRestrictions); -} - int MTGAbility::allowedToCast(MTGCardInstance * card,Player * player) { - return parseCastRestrictions(card,player,card->getRestrictions(),""); + return AbilityFactory::parseCastRestrictions(card,player,card->getRestrictions()); } int MTGAbility::allowedToAltCast(MTGCardInstance * card,Player * player) { - return parseCastRestrictions(card,player,"",card->getOtherRestrictions()); + return AbilityFactory::parseCastRestrictions(card,player,card->getOtherRestrictions()); } -int AbilityFactory::parseCastRestrictions(MTGCardInstance * card,Player * player,string restrictions,string otherRestrictions) +int AbilityFactory::parseCastRestrictions(MTGCardInstance * card,Player * player,string restrictions) { - restrictions.append(otherRestrictions); - //we can do this becuase the function calls send them seperately, so one will always be empty vector restriction = split(restrictions, ','); - AbilityFactory af; GameObserver * game = game->GetInstance(); int cPhase = game->getCurrentGamePhase(); for(unsigned int i = 0;i < restriction.size();i++) { - int checkPhaseBased = af.parseRestriction(restriction[i]); + int checkPhaseBased = parseRestriction(restriction[i]); switch (checkPhaseBased) { case MTGAbility::PLAYER_TURN_ONLY: