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

View File

@@ -127,7 +127,6 @@ public:
ManaCost * cost;
int payResult;
int computeX(MTGCardInstance * card);
int computeXX(MTGCardInstance * card);
Spell(MTGCardInstance* _source);
Spell(int id, MTGCardInstance* _source, TargetChooser *_tc, ManaCost * _cost, int payResult);
~Spell();

View File

@@ -36,12 +36,6 @@ public:
if (card) return card->X;
return 1; //this should only hapen when the ai calls the ability. This is to give it an idea of the "direction" of X (positive/negative)
}
int computeXX(Spell * spell, MTGCardInstance * card)
{
if (spell) return spell->computeXX(card);
if (card) return card->XX;
return 1; //this should only hapen when the ai calls the ability. This is to give it an idea of the "direction" of X (positive/negative)
}
WParsedInt(int value = 0)
{
intValue = value;
@@ -82,7 +76,7 @@ public:
}
else if (s == "xx" || s == "XX")
{
intValue = computeXX(spell, card);
intValue = computeX(spell, card) / 2;
if(intValue < 0)
intValue = 0;
}

View File

@@ -484,7 +484,6 @@ public:
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL,Targetable * target = 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 computeXX(Spell * spell, MTGCardInstance * card);
static MTGAbility * getCoreAbility(MTGAbility * a);
int destroyAllInPlay(TargetChooser * tc, int bury = 0);
int moveAll(TargetChooser * tc, string destinationZone);

View File

@@ -48,7 +48,6 @@ public:
MTGGameZone * currentZone;
Pos* view;
int X;
int XX;
int alternateCostPaid[ManaCost::MANA_PAID_WITH_RETRACE + 1];
int paymenttype;
int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */

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;

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...

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.

View File

@@ -102,7 +102,6 @@ int MTGCardInstance::init()
CardPrimitive::init();
data = this;
X = 0;
XX = 0;
return 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)

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;
}