Refactored formatting for easier reading of the code
This commit is contained in:
@@ -910,7 +910,7 @@ public:
|
||||
WEventLife * e = dynamic_cast<WEventLife *> (event);
|
||||
if (!e) return 0;
|
||||
if (sourceUntapped && source->isTapped() == 1)
|
||||
return 0;
|
||||
return 0;
|
||||
if (!tc->canTarget(e->player)) return 0;
|
||||
if (fromTc && !fromTc->canTarget(e->player)) return 0;
|
||||
if (type == 1 && (e->amount > 0)) return 0;
|
||||
|
||||
@@ -1411,12 +1411,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
}
|
||||
|
||||
// figure out alternative cost effects
|
||||
string keyword;
|
||||
|
||||
|
||||
for (size_t i = 0; i < sizeof(kAlternateCostIds)/sizeof(kAlternateCostIds[0]); ++i)
|
||||
{
|
||||
if (s.find(kAlternateCostKeywords[i]) == 0)
|
||||
const string& keyword = kAlternateCostKeywords[i];
|
||||
if (s.find(keyword) == 0)
|
||||
{
|
||||
if (!(spell && spell->FullfilledAlternateCost(kAlternateCostIds[i])))
|
||||
{
|
||||
@@ -1424,7 +1422,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
SAFE_DELETE(tc);
|
||||
return NULL;
|
||||
}
|
||||
return parseMagicLine(s.substr(kAlternateCostKeywords[i].length()), id, spell, card);
|
||||
return parseMagicLine(s.substr(keyword.length()), id, spell, card);
|
||||
}
|
||||
}
|
||||
//if/ifnot COND then DO EFFECT.
|
||||
|
||||
@@ -1308,17 +1308,21 @@ PlayerTargetChooser::PlayerTargetChooser(GameObserver *observer, MTGCardInstance
|
||||
{
|
||||
}
|
||||
|
||||
bool PlayerTargetChooser::canTarget(Targetable * target,bool)
|
||||
bool PlayerTargetChooser::canTarget(Targetable * target, bool)
|
||||
{
|
||||
if (source && targetter && (targetter->controller() != targetter->controller()->opponent())
|
||||
&& (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD))
|
||||
&& targetter->controller() != target) return false;
|
||||
if (source && targetter && (targetter->controller() == targetter->controller())
|
||||
&& (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& targetter->controller()->opponent() == target) return false;
|
||||
if (source && targetter && (targetter->controller() == targetter->controller())
|
||||
&& (targetter->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD)) && targetter->controller()
|
||||
== target) return false;
|
||||
if (source && targetter)
|
||||
{
|
||||
if ((targetter->controller() != targetter->controller()->opponent())
|
||||
&& (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD))
|
||||
&& targetter->controller() != target)
|
||||
return false;
|
||||
if ((targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& targetter->controller()->opponent() == target)
|
||||
return false;
|
||||
if ((targetter->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& targetter->controller() == target)
|
||||
return false;
|
||||
}
|
||||
|
||||
Player * pTarget = dynamic_cast<Player *>(target);
|
||||
return (pTarget && (!p || p == pTarget));
|
||||
@@ -1346,15 +1350,21 @@ bool PlayerTargetChooser::equals(TargetChooser * tc)
|
||||
/*Damageable Target */
|
||||
bool DamageableTargetChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
if (source && targetter && (targetter->controller() != targetter->controller()->opponent())
|
||||
&& (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD))
|
||||
&& targetter->controller() != target) return false;
|
||||
if (source && targetter && (targetter->controller() == targetter->controller())
|
||||
&& (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& targetter->controller()->opponent() == target) return false;
|
||||
if (source && targetter && (targetter->controller() == targetter->controller())
|
||||
&& (targetter->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD)) && targetter->controller()
|
||||
== target) return false;
|
||||
// TODO: get rid of common code with PlayerTargetChooser
|
||||
if (source && targetter)
|
||||
{
|
||||
if ((targetter->controller() != targetter->controller()->opponent())
|
||||
&& (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD))
|
||||
&& targetter->controller() != target)
|
||||
return false;
|
||||
if ((targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& targetter->controller()->opponent() == target)
|
||||
return false;
|
||||
if ((targetter->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD))
|
||||
&& targetter->controller() == target)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dynamic_cast<Player *>(target))
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user