- Fix for issue 650 (tidal Warrior effect doesn't end at end of turn)

- Fix PSP compilation
This commit is contained in:
wagic.the.homebrew
2011-05-07 04:10:47 +00:00
parent 062d5f9485
commit f96635541d
8 changed files with 50 additions and 2 deletions

View File

@@ -540,6 +540,7 @@ threaten.txt
throne_of_bone.txt
thunder-thrash_elder.txt
tidal_warrior_i646.txt
tidal_warrior_i650.txt
titanic_ultimatum.txt
tolsimir_wolfblood.txt
torture.txt

View File

@@ -0,0 +1,21 @@
#Testing Tidal Warrior's "target becomes island" ability,
# Make sure it only lasts until end of turn
#see http://code.google.com/p/wagic/issues/detail?id=650
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Forest, Tidal Warrior
[PLAYER2]
[DO]
Tidal Warrior
Forest
eot
eot
Forest
[ASSERT]
UNTAP
[PLAYER1]
inplay:Forest, Tidal Warrior
manapool:{G}
[PLAYER2]
[END]

View File

@@ -918,11 +918,14 @@ class MultiAbility: public ActivatedAbility
{
public:
vector<MTGAbility *> abilities;
//Maintains abilities created by this instance, for cleanup
vector<MTGAbility *> clones;
MultiAbility(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost);
int Add(MTGAbility * ability);
int resolve();
int addToGame();
int destroy();
const char * getMenuText();
MultiAbility * clone() const;
~MultiAbility();

View File

@@ -28,6 +28,11 @@ int ActionLayer::removeFromGame(ActionElement * e)
if (isWaitingForAnswer() == e)
setCurrentWaitingAction(NULL);
e->destroy();
i = getIndexOf(e); //the destroy event might have changed the contents of mObjects, so we get the index again
if (i == -1)
return 0; //Should not happen, it means we deleted thesame object twice?
mObjects.erase(mObjects.begin() + i);
mCount--;
return 1;

View File

@@ -2163,11 +2163,23 @@ int MultiAbility::addToGame()
MTGAbility * a = abilities[i]->clone();
a->target = target;
a->addToGame();
clones.push_back(a);
}
MTGAbility::addToGame();
return 1;
}
int MultiAbility::destroy()
{
for (size_t i = 0; i < clones.size(); ++i)
{
//I'd like to call game->removeObserver here instead of using forceDestroy, but I get a weird crash after that, need to investigate a bit
clones[i]->forceDestroy = 1;
}
clones.clear();
return ActivatedAbility::destroy();
}
const char * MultiAbility::getMenuText()
{
if (abilities.size())

View File

@@ -448,7 +448,7 @@ void StatsWrapper::updateStats(DeckDataWrapper *myDeck)
//but through a rule that is outside of the primitives. This block is a hack to address this
const int colors[] = {Constants::MTG_COLOR_GREEN, Constants::MTG_COLOR_BLUE, Constants::MTG_COLOR_RED, Constants::MTG_COLOR_BLACK, Constants::MTG_COLOR_WHITE};
const string lands[] = { "forest", "island", "mountain", "swamp", "plains" };
for (int i = 0; i < sizeof(colors)/sizeof(colors[0]); ++i)
for (unsigned int i = 0; i < sizeof(colors)/sizeof(colors[0]); ++i)
{
int colorId = colors[i];
string type = lands[i];

View File

@@ -491,6 +491,12 @@ int TestSuite::assertGame()
sprintf(result, "<span class=\"error\">==Mana problem. Was expecting %i but got %i for player %i==</span><br />",
endState.playerData[i].manapool->getConvertedCost(), p->getManaPool()->getConvertedCost(), i);
Log(result);
if ( endState.playerData[i].manapool->getConvertedCost() == p->getManaPool()->getConvertedCost())
{
sprintf(result, "<span class=\"error\">====(Apparently Mana Color issues since converted cost is the same)==</span><br />");
Log(result);
}
error++;
}

View File

@@ -264,7 +264,7 @@ bool WCFilterProducesColor::isMatch(MTGCard * c)
//Basic lands are not producing their mana through regular abilities anymore,
//but through a rule that is outside of the primitives. This block is a hack to address this
const string lands[] = { "dummy(colorless)", "forest", "island", "mountain", "swamp", "plains" };
if ((color < sizeof(lands)/sizeof(lands[0])) && c->data->hasType(lands[color].c_str()))
if ((color < (int)(sizeof(lands)/sizeof(lands[0]))) && c->data->hasType(lands[color].c_str()))
return true;
//Retrieve non basic Mana abilities