just moving parserestrictions under the parsecastrestrictions...so they are together rather then an entire page apart :) no code change, it just bugged me :P

This commit is contained in:
omegablast2002@yahoo.com
2011-09-25 13:51:33 +00:00
parent 3a2264febb
commit e117cf82c9

View File

@@ -298,6 +298,38 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card,Player * player
return 1;
}
int AbilityFactory::parseRestriction(string s)
{
if (s.find("myturnonly") != string::npos)
return ActivatedAbility::PLAYER_TURN_ONLY;
if (s.find("opponentturnonly") != string::npos)
return ActivatedAbility::OPPONENT_TURN_ONLY;
if (s.find("assorcery") != string::npos)
return ActivatedAbility::AS_SORCERY;
string types[] = { "my", "opponent", "" };
int starts[] = { ActivatedAbility::MY_BEFORE_BEGIN, ActivatedAbility::OPPONENT_BEFORE_BEGIN, ActivatedAbility::BEFORE_BEGIN };
for (int j = 0; j < 3; ++j)
{
size_t found = s.find(types[j]);
if (found != string::npos)
{
for (int i = 0; i < Constants::NB_MTG_PHASES; i++)
{
string toFind = types[j];
toFind.append(Constants::MTGPhaseCodeNames[i]).append("only");
found = s.find(toFind);
if (found != string::npos)
{
return starts[j] + i;
}
}
}
}
return ActivatedAbility::NO_RESTRICTION;
}
int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option)
{
int result = 0;
@@ -683,38 +715,6 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string magicText, int
return NULL;
}
int AbilityFactory::parseRestriction(string s)
{
if (s.find("myturnonly") != string::npos)
return ActivatedAbility::PLAYER_TURN_ONLY;
if (s.find("opponentturnonly") != string::npos)
return ActivatedAbility::OPPONENT_TURN_ONLY;
if (s.find("assorcery") != string::npos)
return ActivatedAbility::AS_SORCERY;
string types[] = { "my", "opponent", "" };
int starts[] = { ActivatedAbility::MY_BEFORE_BEGIN, ActivatedAbility::OPPONENT_BEFORE_BEGIN, ActivatedAbility::BEFORE_BEGIN };
for (int j = 0; j < 3; ++j)
{
size_t found = s.find(types[j]);
if (found != string::npos)
{
for (int i = 0; i < Constants::NB_MTG_PHASES; i++)
{
string toFind = types[j];
toFind.append(Constants::MTGPhaseCodeNames[i]).append("only");
found = s.find(toFind);
if (found != string::npos)
{
return starts[j] + i;
}
}
}
}
return ActivatedAbility::NO_RESTRICTION;
}
// When abilities encapsulate each other, gets the deepest one (it is the one likely to have the most relevant information)
MTGAbility * AbilityFactory::getCoreAbility(MTGAbility * a)
{