cleanup: Remove "computeXX" functions and XX variables, these were always returning X/2 in all cases.

Test suite passes
This commit is contained in:
wagic.the.homebrew
2011-05-02 11:28:04 +00:00
parent 13dd07973e
commit 53f45a8b8e
10 changed files with 5 additions and 40 deletions
-8
View File
@@ -245,14 +245,6 @@ int Spell::computeX(MTGCardInstance * card)
return x;
}
int Spell::computeXX(MTGCardInstance * card)
{
ManaCost * c = cost->Diff(card->getManaCost());
int xx = c->getCost(Constants::MTG_NB_COLORS) / 2;
delete c;
return xx;
}
bool Spell::FullfilledAlternateCost(const int &costType)
{
bool hasFullfilledAlternateCost = false;
-1
View File
@@ -16,7 +16,6 @@ int GenericActivatedAbility::resolve()
{
ManaCost * diff = abilityCost->Diff(cost);
source->X = diff->hasX();
source->XX = source->X/2;
SAFE_DELETE(diff);
//SAFE_DELETE(abilityCost); this line has been reported as a bug. removing it doesn't seem to break anything, although I didn't get any error in the test suite by leaving it either, so... leaving it for now as a comment, in case.
ability->target = target; //may have been updated...
+4 -15
View File
@@ -1549,10 +1549,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
sabilities.append(tokenParameters[i]);
}
int value = 0;
if (spt.find("x/x") != string::npos)
if (spt.find("xx/xx") != string::npos)
value = card->X / 2;
else if (spt.find("x/x") != string::npos)
value = card->X;
else if (spt.find("xx/xx") != string::npos)
value = card->XX;
int power, toughness;
parsePowerToughness(spt, &power, &toughness);
@@ -2389,16 +2389,6 @@ int AbilityFactory::computeX(Spell * spell, MTGCardInstance * card)
return 0;
}
//Returns the "XX" cost that was paid for a spell
int AbilityFactory::computeXX(Spell * spell, MTGCardInstance * card)
{
if (spell)
return spell->computeXX(card);
if(card)
return card->XX;
return 0;
}
int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card, int id, MTGGameZone * dest)
{
@@ -3150,7 +3140,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
}
if (card->basicAbilities[(int)Constants::MOUNTAINHOME])
{
game->addObserver(NEW AStrongLandLinkCreature(_id, card, "moutain"));
game->addObserver(NEW AStrongLandLinkCreature(_id, card, "mountain"));
}
if (card->basicAbilities[(int)Constants::SWAMPHOME])
{
@@ -3641,7 +3631,6 @@ int TargetAbility::resolve()
{
ManaCost * diff = abilityCost->Diff(cost);
source->X = diff->hasX();
source->XX = source->X/2;
delete (diff);
ability->target = t;
//do nothing if the target controller responded by phasing out the target.
-1
View File
@@ -102,7 +102,6 @@ int MTGCardInstance::init()
CardPrimitive::init();
data = this;
X = 0;
XX = 0;
return 1;
}
-1
View File
@@ -467,7 +467,6 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
copy->view = card->view;
copy->isToken = card->isToken;
copy->X = card->X;
copy->XX = card->X/2;
//stupid bug with tokens...
if (card->model == card)
-4
View File
@@ -447,7 +447,6 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM))
{
copy->X = spell->computeX(copy);
copy->XX = spell->computeXX(copy);
}
}
@@ -573,7 +572,6 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM))
{
copy->X = spell->computeX(copy);
copy->XX = spell->computeXX(copy);
}
}
@@ -737,7 +735,6 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
else
{
copy->X = spell->computeX(copy);
copy->XX = copy->X/2;
}
}
@@ -1133,7 +1130,6 @@ int MTGMorphCostRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM))
{
copy->X = spell->computeX(copy);
copy->XX = copy->X/2;
}
return 1;
}