Reverting r3496 to fix failing tests
This commit is contained in:
@@ -804,7 +804,6 @@ public:
|
|||||||
{
|
{
|
||||||
if(!source->isInPlay())
|
if(!source->isInPlay())
|
||||||
return 0;
|
return 0;
|
||||||
// TODO: C6246: Clarify e, is this independant of the "e" declared outside this scope?
|
|
||||||
WEvent * e = NEW WEventVampire(victems[w],victems[w],source);
|
WEvent * e = NEW WEventVampire(victems[w],victems[w],source);
|
||||||
game->receiveEvent(e);
|
game->receiveEvent(e);
|
||||||
victems[w] = NULL;
|
victems[w] = NULL;
|
||||||
@@ -4705,7 +4704,6 @@ public:
|
|||||||
{
|
{
|
||||||
if (value_before_modification)
|
if (value_before_modification)
|
||||||
{
|
{
|
||||||
// TODO: C6246: Clarify _target, is this independant of the "_target" declared as the member var of this class?
|
|
||||||
Damageable * _target = (Damageable *) target;
|
Damageable * _target = (Damageable *) target;
|
||||||
game->mLayers->stackLayer()->addDamage(source, _target, 2);
|
game->mLayers->stackLayer()->addDamage(source, _target, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ bool AIPlayer::tapLandsForMana(ManaCost * cost, MTGCardInstance * target)
|
|||||||
{
|
{
|
||||||
used[card] = true;
|
used[card] = true;
|
||||||
int doUse = 1;
|
int doUse = 1;
|
||||||
for (int colorsIdx = Constants::MTG_NB_COLORS - 1; colorsIdx >= 0; colorsIdx--)
|
for (int i = Constants::MTG_NB_COLORS - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (diff->getCost(colorsIdx) && amp->output->getCost(colorsIdx))
|
if (diff->getCost(i) && amp->output->getCost(i))
|
||||||
{
|
{
|
||||||
diff->remove(colorsIdx, 1);
|
diff->remove(i, 1);
|
||||||
doUse = 0;
|
doUse = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -513,8 +513,7 @@ int AIAction::getEfficiency()
|
|||||||
case MTGAbility::MANA_PRODUCER://only way to hit this condition is nested manaabilities, ai skips manaproducers by defualt when finding an ability to use.
|
case MTGAbility::MANA_PRODUCER://only way to hit this condition is nested manaabilities, ai skips manaproducers by defualt when finding an ability to use.
|
||||||
{
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
// TODO: C6246: Clarify a, is this independant of the "a" declared outside this scope?
|
MTGAbility * a = AbilityFactory::getCoreAbility(ability);
|
||||||
MTGAbility * a = AbilityFactory::getCoreAbility(ability);
|
|
||||||
|
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
//trying to encourage Ai to use his foreach manaproducers in first main
|
//trying to encourage Ai to use his foreach manaproducers in first main
|
||||||
|
|||||||
@@ -604,9 +604,9 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
for(int w = 0;w < z->nb_cards;w++)
|
for(int w = 0;w < z->nb_cards;w++)
|
||||||
{
|
{
|
||||||
int colored = 0;
|
int colored = 0;
|
||||||
for (int colorIdx = Constants::MTG_COLOR_GREEN; colorIdx <= Constants::MTG_COLOR_WHITE; ++colorIdx)
|
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
||||||
{
|
{
|
||||||
if (z->cards[w]->hasColor(colorIdx))
|
if (z->cards[w]->hasColor(i))
|
||||||
++colored;
|
++colored;
|
||||||
}
|
}
|
||||||
if(colored > 1)
|
if(colored > 1)
|
||||||
@@ -770,8 +770,7 @@ void GameObserver::Affinity()
|
|||||||
{
|
{
|
||||||
reduce = card->controller()->game->battlefield->countByType(type.c_str());
|
reduce = card->controller()->game->battlefield->countByType(type.c_str());
|
||||||
}
|
}
|
||||||
|
for(int i = 0; i < reduce;i++)
|
||||||
for(int reductionIdx = 0; reductionIdx < reduce; reductionIdx++)
|
|
||||||
{
|
{
|
||||||
if(card->getManaCost()->getCost(color) > 0)
|
if(card->getManaCost()->getCost(color) > 0)
|
||||||
card->getManaCost()->remove(color,1);
|
card->getManaCost()->remove(color,1);
|
||||||
|
|||||||
@@ -972,10 +972,9 @@ bool GameOptionAward::read(string input)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
tvals[i] = 0;
|
tvals[i] = 0;
|
||||||
i = 0;
|
|
||||||
|
|
||||||
string buf;
|
string buf;
|
||||||
for (size_t t = 0; t < input.size(); t++)
|
for (size_t t = 0, i = 0; t < input.size(); t++)
|
||||||
{
|
{
|
||||||
if (!isdigit(input[t]))
|
if (!isdigit(input[t]))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1512,7 +1512,7 @@ int GameStateDeckViewer::loadDeck(int deckid)
|
|||||||
{
|
{
|
||||||
MTGCard * current = myDeck->getCard(i, true);
|
MTGCard * current = myDeck->getCard(i, true);
|
||||||
int howmanyinDeck = myDeck->count(current);
|
int howmanyinDeck = myDeck->count(current);
|
||||||
for (int numCardsInCollection = myCollection->count(current); numCardsInCollection < howmanyinDeck; numCardsInCollection++)
|
for (int i = myCollection->count(current); i < howmanyinDeck; i++)
|
||||||
{
|
{
|
||||||
bPure = false;
|
bPure = false;
|
||||||
if (cheatmode)
|
if (cheatmode)
|
||||||
|
|||||||
@@ -561,6 +561,7 @@ void GameStateDuel::Render()
|
|||||||
{
|
{
|
||||||
case DUEL_STATE_END:
|
case DUEL_STATE_END:
|
||||||
{
|
{
|
||||||
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));
|
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));
|
||||||
credits->Render();
|
credits->Render();
|
||||||
#ifdef TESTSUITE
|
#ifdef TESTSUITE
|
||||||
|
|||||||
@@ -292,11 +292,11 @@ int GameStateMenu::nextDirectory(const char * root, const char * file)
|
|||||||
while (!found && (mDit = readdir(mDip)))
|
while (!found && (mDit = readdir(mDip)))
|
||||||
{
|
{
|
||||||
sprintf(mCurrentSetFileName, "%s/%s/%s", root, mDit->d_name, file);
|
sprintf(mCurrentSetFileName, "%s/%s/%s", root, mDit->d_name, file);
|
||||||
wagic::ifstream setFile(mCurrentSetFileName);
|
wagic::ifstream file(mCurrentSetFileName);
|
||||||
if (setFile)
|
if (file)
|
||||||
{
|
{
|
||||||
sprintf(mCurrentSetName, "%s", mDit->d_name);
|
sprintf(mCurrentSetName, "%s", mDit->d_name);
|
||||||
setFile.close();
|
file.close();
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -459,7 +459,6 @@ int GuiCombat::receiveEventPlus(WEvent* e)
|
|||||||
attackers.push_back(t);
|
attackers.push_back(t);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event, which event are you referring to?
|
|
||||||
else if (WEventCreatureBlocker* event = dynamic_cast<WEventCreatureBlocker*>(e))
|
else if (WEventCreatureBlocker* event = dynamic_cast<WEventCreatureBlocker*>(e))
|
||||||
{
|
{
|
||||||
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
|
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
|
||||||
@@ -478,7 +477,6 @@ int GuiCombat::receiveEventPlus(WEvent* e)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event, which event are you referring to?
|
|
||||||
else if (WEventCreatureBlockerRank* event = dynamic_cast<WEventCreatureBlockerRank*>(e))
|
else if (WEventCreatureBlockerRank* event = dynamic_cast<WEventCreatureBlockerRank*>(e))
|
||||||
{
|
{
|
||||||
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
|
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
|
||||||
@@ -545,7 +543,6 @@ int GuiCombat::receiveEventMinus(WEvent* e)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event, which event are you referring to?
|
|
||||||
else if (WEventCreatureBlocker* event = dynamic_cast<WEventCreatureBlocker*>(e))
|
else if (WEventCreatureBlocker* event = dynamic_cast<WEventCreatureBlocker*>(e))
|
||||||
{
|
{
|
||||||
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
|
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
|
||||||
@@ -560,7 +557,6 @@ int GuiCombat::receiveEventMinus(WEvent* e)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event->to->id, which event are you referring to?
|
|
||||||
else if (WEventPhaseChange* event = dynamic_cast<WEventPhaseChange*>(e))
|
else if (WEventPhaseChange* event = dynamic_cast<WEventPhaseChange*>(e))
|
||||||
{
|
{
|
||||||
if (Constants::MTG_PHASE_COMBATDAMAGE == event->to->id)
|
if (Constants::MTG_PHASE_COMBATDAMAGE == event->to->id)
|
||||||
@@ -568,7 +564,6 @@ int GuiCombat::receiveEventMinus(WEvent* e)
|
|||||||
else
|
else
|
||||||
cursor_pos = NONE;
|
cursor_pos = NONE;
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event->step, which event are you referring to?
|
|
||||||
else if (WEventCombatStepChange* event = dynamic_cast<WEventCombatStepChange*>(e))
|
else if (WEventCombatStepChange* event = dynamic_cast<WEventCombatStepChange*>(e))
|
||||||
switch (event->step)
|
switch (event->step)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -356,7 +356,6 @@ int GuiPlay::receiveEventPlus(WEvent * e)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event, which event are you referring to?
|
|
||||||
else if (WEventCreatureAttacker* event = dynamic_cast<WEventCreatureAttacker*>(e))
|
else if (WEventCreatureAttacker* event = dynamic_cast<WEventCreatureAttacker*>(e))
|
||||||
{
|
{
|
||||||
if (NULL != event->after)
|
if (NULL != event->after)
|
||||||
@@ -369,7 +368,6 @@ int GuiPlay::receiveEventPlus(WEvent * e)
|
|||||||
{
|
{
|
||||||
Replace();
|
Replace();
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event, which event are you referring to?
|
|
||||||
else if (WEventCardTap* event = dynamic_cast<WEventCardTap*>(e))
|
else if (WEventCardTap* event = dynamic_cast<WEventCardTap*>(e))
|
||||||
{
|
{
|
||||||
if (CardView* cv = dynamic_cast<CardView*>(event->card->view))
|
if (CardView* cv = dynamic_cast<CardView*>(event->card->view))
|
||||||
@@ -385,7 +383,6 @@ int GuiPlay::receiveEventPlus(WEvent * e)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// TODO: C6246: Clarify event, which event are you referring to?
|
|
||||||
else if (WEventPhaseChange *event = dynamic_cast<WEventPhaseChange*>(e))
|
else if (WEventPhaseChange *event = dynamic_cast<WEventPhaseChange*>(e))
|
||||||
{
|
{
|
||||||
if (Constants::MTG_PHASE_COMBATEND == event->to->id)
|
if (Constants::MTG_PHASE_COMBATEND == event->to->id)
|
||||||
|
|||||||
@@ -1618,11 +1618,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
size_t end = s.find("]", start);
|
size_t end = s.find("]", start);
|
||||||
string s1 = s.substr(start + 1, end - start - 1);
|
string s1 = s.substr(start + 1, end - start - 1);
|
||||||
int phase = Constants::MTG_PHASE_UPKEEP;
|
int phase = Constants::MTG_PHASE_UPKEEP;
|
||||||
for (int phaseIdx = 0; phaseIdx < Constants::NB_MTG_PHASES; phaseIdx++)
|
for (int i = 0; i < Constants::NB_MTG_PHASES; i++)
|
||||||
{
|
{
|
||||||
if (s1.find(Constants::MTGPhaseCodeNames[phaseIdx]) != string::npos)
|
if (s1.find(Constants::MTGPhaseCodeNames[i]) != string::npos)
|
||||||
{
|
{
|
||||||
phase = phaseIdx;
|
phase = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool opponentturn = true,myturn = true;
|
bool opponentturn = true,myturn = true;
|
||||||
@@ -1685,13 +1685,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
int once = 0;
|
int once = 0;
|
||||||
if (seperator != string::npos)
|
if (seperator != string::npos)
|
||||||
{
|
{
|
||||||
for (int phaseIdx = 0; phaseIdx < Constants::NB_MTG_PHASES; phaseIdx++)
|
for (int i = 0; i < Constants::NB_MTG_PHASES; i++)
|
||||||
{
|
{
|
||||||
if (s1.find("next") != string::npos)
|
if (s1.find("next") != string::npos)
|
||||||
once = 1;
|
once = 1;
|
||||||
if (s1.find(Constants::MTGPhaseCodeNames[phaseIdx]) != string::npos)
|
if (s1.find(Constants::MTGPhaseCodeNames[i]) != string::npos)
|
||||||
{
|
{
|
||||||
phase = phaseIdx;
|
phase = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s1 = s1.substr(0, seperator - 1);
|
s1 = s1.substr(0, seperator - 1);
|
||||||
@@ -2297,12 +2297,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Cast/Play Restrictions
|
//Cast/Play Restrictions
|
||||||
for (size_t castPlayIdx = 0; castPlayIdx < kMaxCastKeywordsCount; ++castPlayIdx)
|
for (size_t i = 0; i < kMaxCastKeywordsCount; ++i)
|
||||||
{
|
{
|
||||||
found = s.find(kMaxCastKeywords[castPlayIdx]);
|
found = s.find(kMaxCastKeywords[i]);
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
size_t header = kMaxCastKeywords[castPlayIdx].size();
|
size_t header = kMaxCastKeywords[i].size();
|
||||||
size_t end = s.find(")");
|
size_t end = s.find(")");
|
||||||
string targetsString = s.substr(found + header, end - found - header);
|
string targetsString = s.substr(found + header, end - found - header);
|
||||||
TargetChooserFactory tcf;
|
TargetChooserFactory tcf;
|
||||||
@@ -2329,7 +2329,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
return NEW AInstantCastRestrictionUEOT(id, card, t, castTargets, value, modifyExisting, kMaxCastZones[i], who);
|
return NEW AInstantCastRestrictionUEOT(id, card, t, castTargets, value, modifyExisting, kMaxCastZones[i], who);
|
||||||
}
|
}
|
||||||
return NEW ACastRestriction(id, card, t, castTargets, value, modifyExisting, kMaxCastZones[castPlayIdx], who);
|
return NEW ACastRestriction(id, card, t, castTargets, value, modifyExisting, kMaxCastZones[i], who);
|
||||||
//TODO NEW ACastRestrictionUntilEndOfTurn(id, card, t, value, modifyExisting, kMaxCastZones[i], who);
|
//TODO NEW ACastRestrictionUntilEndOfTurn(id, card, t, value, modifyExisting, kMaxCastZones[i], who);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2578,11 +2578,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
{
|
{
|
||||||
size_t real_end = transformsParamsString.find("))", found);
|
size_t real_end = transformsParamsString.find("))", found);
|
||||||
size_t end = transformsParamsString.find(",", found);
|
size_t end = transformsParamsString.find(",", found);
|
||||||
|
|
||||||
if (end == string::npos)
|
if (end == string::npos)
|
||||||
end = real_end;
|
end = real_end;
|
||||||
|
size_t stypesStartIndex = found + 12;
|
||||||
stypesStartIndex = found + 12;
|
|
||||||
extraTransforms.append(transformsParamsString.substr(stypesStartIndex, real_end - stypesStartIndex).c_str());
|
extraTransforms.append(transformsParamsString.substr(stypesStartIndex, real_end - stypesStartIndex).c_str());
|
||||||
transformsParamsString.erase(stypesStartIndex, real_end - stypesStartIndex);
|
transformsParamsString.erase(stypesStartIndex, real_end - stypesStartIndex);
|
||||||
}
|
}
|
||||||
@@ -2599,13 +2597,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
vector<string> newAbilitiesList;
|
vector<string> newAbilitiesList;
|
||||||
storedString.erase();
|
storedString.erase();
|
||||||
storedString.append(extraTransforms);
|
storedString.append(extraTransforms);
|
||||||
extraTransforms.erase();
|
extraTransforms.erase();
|
||||||
|
for (unsigned int i = 0 ; i < abilities.size() ; i++)
|
||||||
|
{
|
||||||
|
if(abilities[i].empty())
|
||||||
|
abilities.erase(abilities.begin()+i);
|
||||||
|
}
|
||||||
for(unsigned int j = 0;j < abilities.size();j++)
|
for(unsigned int j = 0;j < abilities.size();j++)
|
||||||
{
|
{
|
||||||
if (abilities[j].empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(abilities[j].find("setpower=") != string::npos)
|
if(abilities[j].find("setpower=") != string::npos)
|
||||||
{
|
{
|
||||||
newpowerfound = true;
|
newpowerfound = true;
|
||||||
@@ -3206,10 +3205,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int
|
|||||||
if (dryMode)
|
if (dryMode)
|
||||||
{
|
{
|
||||||
result = abilityEfficiency(a, card->controller(), mode, tc);
|
result = abilityEfficiency(a, card->controller(), mode, tc);
|
||||||
|
for (size_t i = 0; i < v.size(); ++i)
|
||||||
for (vector<MTGAbility *>::iterator it = v.begin(); it != v.end(); ++it )
|
SAFE_DELETE(v[i]);
|
||||||
SAFE_DELETE(*it);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3491,7 +3488,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
|
|||||||
MTGInPlay * inplay = game->players[i]->game->inPlay;
|
MTGInPlay * inplay = game->players[i]->game->inPlay;
|
||||||
for (int j = inplay->nb_cards - 1; j >= 0; j--)
|
for (int j = inplay->nb_cards - 1; j >= 0; j--)
|
||||||
{
|
{
|
||||||
// TODO: C6246: Clarify card, is this independant of the "card" declared outside this scope?
|
|
||||||
MTGCardInstance * card = inplay->cards[j];
|
MTGCardInstance * card = inplay->cards[j];
|
||||||
if (card->owner == player && card->hasType(Subtypes::TYPE_ARTIFACT))
|
if (card->owner == player && card->hasType(Subtypes::TYPE_ARTIFACT))
|
||||||
{
|
{
|
||||||
@@ -3648,14 +3644,14 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
|
|||||||
case 3410: //Seed of Innocence
|
case 3410: //Seed of Innocence
|
||||||
{
|
{
|
||||||
GameObserver * game = GameObserver::GetInstance();
|
GameObserver * game = GameObserver::GetInstance();
|
||||||
for (int playerIdx = 0; playerIdx < 2; playerIdx++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < game->players[playerIdx]->game->inPlay->nb_cards; j++)
|
for (int j = 0; j < game->players[i]->game->inPlay->nb_cards; j++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * current = game->players[playerIdx]->game->inPlay->cards[j];
|
MTGCardInstance * current = game->players[i]->game->inPlay->cards[j];
|
||||||
if (current->hasType("Artifact"))
|
if (current->hasType("Artifact"))
|
||||||
{
|
{
|
||||||
game->players[playerIdx]->game->putInGraveyard(current);
|
game->players[i]->game->putInGraveyard(current);
|
||||||
current->controller()->gainLife(current->getManaCost()->getConvertedCost());
|
current->controller()->gainLife(current->getManaCost()->getConvertedCost());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3812,6 +3808,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
|
|||||||
|
|
||||||
if (card->hasType(Subtypes::TYPE_INSTANT) || card->hasType(Subtypes::TYPE_SORCERY))
|
if (card->hasType(Subtypes::TYPE_INSTANT) || card->hasType(Subtypes::TYPE_SORCERY))
|
||||||
{
|
{
|
||||||
|
MTGPlayerCards * zones = card->controller()->game;
|
||||||
if (card->alternateCostPaid[ManaCost::MANA_PAID_WITH_BUYBACK] > 0)
|
if (card->alternateCostPaid[ManaCost::MANA_PAID_WITH_BUYBACK] > 0)
|
||||||
{
|
{
|
||||||
zones->putInZone(card, zones->stack, zones->hand);
|
zones->putInZone(card, zones->stack, zones->hand);
|
||||||
|
|||||||
@@ -426,10 +426,10 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
|||||||
if (card->has(Constants::STORM))
|
if (card->has(Constants::STORM))
|
||||||
{
|
{
|
||||||
int storm = player->game->stack->seenThisTurn("*", Constants::CAST_ALL) + player->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
|
int storm = player->game->stack->seenThisTurn("*", Constants::CAST_ALL) + player->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
|
||||||
ManaCost * stormSpellCost = player->getManaPool();
|
ManaCost * spellCost = player->getManaPool();
|
||||||
for (int i = storm; i > 1; i--)
|
for (int i = storm; i > 1; i--)
|
||||||
{
|
{
|
||||||
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, stormSpellCost, payResult, 1);
|
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, spellCost, payResult, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}//end of storm
|
}//end of storm
|
||||||
|
|||||||
@@ -140,14 +140,15 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
manaCost->addExtraCost(NEW MillCost(tc));
|
manaCost->addExtraCost(NEW MillCost(tc));
|
||||||
break;
|
break;
|
||||||
case 'n': //return unblocked attacker cost
|
case 'n': //return unblocked attacker cost
|
||||||
|
TargetChooserFactory tcf;
|
||||||
tc = tcf.createTargetChooser("creature|myBattlefield", c);
|
tc = tcf.createTargetChooser("creature|myBattlefield", c);
|
||||||
manaCost->addExtraCost(NEW Ninja(tc));
|
manaCost->addExtraCost(NEW Ninja(tc));
|
||||||
break;
|
break;
|
||||||
case 'p' :
|
case 'p' :
|
||||||
{
|
{
|
||||||
SAFE_DELETE(tc);
|
SAFE_DELETE(tc);
|
||||||
start = value.find("(");
|
size_t start = value.find("(");
|
||||||
end = value.rfind(")");
|
size_t end = value.rfind(")");
|
||||||
string manaType = value.substr(start + 1, end - start - 1);
|
string manaType = value.substr(start + 1, end - start - 1);
|
||||||
manaCost->addExtraCost(NEW LifeorManaCost(NULL,manaType));
|
manaCost->addExtraCost(NEW LifeorManaCost(NULL,manaType));
|
||||||
break;
|
break;
|
||||||
@@ -171,15 +172,15 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
separator2 = value.find(",", separator + 1);
|
separator2 = value.find(",", separator + 1);
|
||||||
}
|
}
|
||||||
SAFE_DELETE(tc);
|
SAFE_DELETE(tc);
|
||||||
size_t targetIndexStart = string::npos;
|
size_t target_start = string::npos;
|
||||||
if (separator2 != string::npos)
|
if (separator2 != string::npos)
|
||||||
{
|
{
|
||||||
targetIndexStart = value.find(",", separator2 + 1);
|
target_start = value.find(",", separator2 + 1);
|
||||||
}
|
}
|
||||||
size_t targetIndexEnd = counter_end;
|
size_t target_end = counter_end;
|
||||||
if (targetIndexStart != string::npos && targetIndexEnd != string::npos)
|
if (target_start != string::npos && target_end != string::npos)
|
||||||
{
|
{
|
||||||
string target = value.substr(targetIndexStart + 1, targetIndexEnd - 1 - targetIndexStart);
|
string target = value.substr(target_start + 1, target_end - 1 - target_start);
|
||||||
tc = tcf.createTargetChooser(target, c);
|
tc = tcf.createTargetChooser(target, c);
|
||||||
}
|
}
|
||||||
manaCost->addExtraCost(NEW CounterCost(counter, tc));
|
manaCost->addExtraCost(NEW CounterCost(counter, tc));
|
||||||
@@ -194,7 +195,6 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
// TODO: C6246: Clarify c, is this independant of the "c" declared outside this scope?
|
|
||||||
char c = value[i];
|
char c = value[i];
|
||||||
if (c >= '0' && c <= '9')
|
if (c >= '0' && c <= '9')
|
||||||
{
|
{
|
||||||
@@ -215,13 +215,13 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
}
|
}
|
||||||
if (values[0] > 0 || values[1] > 0)
|
if (values[0] > 0 || values[1] > 0)
|
||||||
manaCost->addHybrid(colors[0], values[0], colors[1], values[1]);
|
manaCost->addHybrid(colors[0], values[0], colors[1], values[1]);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
manaCost->add(Constants::MTG_COLOR_ARTIFACT, intvalue);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
manaCost->add(Constants::MTG_COLOR_ARTIFACT, intvalue);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s = s.substr(end + 1);
|
s = s.substr(end + 1);
|
||||||
|
|||||||
@@ -484,7 +484,6 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
else if (attribute.find("share!") != string::npos)
|
else if (attribute.find("share!") != string::npos)
|
||||||
{
|
{
|
||||||
size_t start = attribute.find("share!");
|
size_t start = attribute.find("share!");
|
||||||
// TODO: C6246: Clarify end, is this independant of the "end" declared outside this scope?
|
|
||||||
size_t end = attribute.rfind("!");
|
size_t end = attribute.rfind("!");
|
||||||
string CDtype = attribute.substr(start + 6,end - start);
|
string CDtype = attribute.substr(start + 6,end - start);
|
||||||
if( card && card->isSpell() && card->backupTargets[0]->typeAsTarget() == TARGET_STACKACTION)
|
if( card && card->isSpell() && card->backupTargets[0]->typeAsTarget() == TARGET_STACKACTION)
|
||||||
@@ -547,7 +546,6 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t start = attribute.find("{");
|
size_t start = attribute.find("{");
|
||||||
// TODO: C6246: Clarify end, is this independant of the "end" declared outside this scope?
|
|
||||||
size_t end = attribute.find("}");
|
size_t end = attribute.find("}");
|
||||||
string counterString = attribute.substr(start + 1, end - start - 1);
|
string counterString = attribute.substr(start + 1, end - start - 1);
|
||||||
AbilityFactory abf;
|
AbilityFactory abf;
|
||||||
|
|||||||
Reference in New Issue
Block a user