本文整理汇总了C++中Spell::resolve方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::resolve方法的具体用法?C++ Spell::resolve怎么用?C++ Spell::resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spell
的用法示例。
在下文中一共展示了Spell::resolve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initGame
void Rules::initGame(GameObserver *g)
{
DebugTrace("RULES Init Game\n");
//Set the current player/phase
if (g->currentPlayer->playMode!= Player::MODE_TEST_SUITE && g->mRules->gamemode!= GAME_TYPE_STORY)
{
if(OptionWhosFirst::WHO_R == options[Options::FIRSTPLAYER].number)
initState.player = g->getRandomGenerator()->random() % 2;
if(OptionWhosFirst::WHO_O == options[Options::FIRSTPLAYER].number)
initState.player = 1;
}
g->currentPlayer = g->players[initState.player];
g->currentActionPlayer = g->currentPlayer;
g->currentPlayerId = initState.player;
g->phaseRing->goToPhase(0, g->currentPlayer, false);
g->phaseRing->goToPhase(initState.phase, g->currentPlayer);
g->currentGamePhase = initState.phase;
for (int i = 0; i < 2; i++)
{
Player * p = g->players[i];
p->life = initState.playerData[i].player->life;
p->poisonCount = initState.playerData[i].player->poisonCount;
p->damageCount = initState.playerData[i].player->damageCount;
p->preventable = initState.playerData[i].player->preventable;
if (initState.playerData[i].player->mAvatarName.size())
{
p->mAvatarName = initState.playerData[i].player->mAvatarName;
}
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * loadedPlayerZones[] = { initState.playerData[i].player->game->graveyard,
initState.playerData[i].player->game->library,
initState.playerData[i].player->game->hand,
initState.playerData[i].player->game->inPlay };
for (int j = 0; j < 4; j++)
{
MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{
MTGCardInstance * card = getCardByMTGId(g, loadedPlayerZones[j]->cards[k]->getId());
if (card && zone != p->game->library)
{
if (zone == p->game->inPlay)
{
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
Spell * spell = NEW Spell(g, copy);
spell->resolve();
delete spell;
}
else
{
if (!p->game->library->hasCard(card))
{
LOG ("RULES ERROR, CARD NOT FOUND IN LIBRARY\n");
}
p->game->putInZone(card, p->game->library, zone);
}
}
else
{
if (!card)
{
LOG ("RULES ERROR, card is NULL\n");
}
}
}
}
}
addExtraRules(g);
postUpdateInitDone = false;
DebugTrace("RULES Init Game Done !\n");
}
示例2: initGame
void TestSuiteGame::initGame()
{
DebugTrace("TESTSUITE Init Game");
observer->phaseRing->goToPhase(initState.phase, observer->players[0], false);
observer->setCurrentGamePhase(initState.phase);
observer->resetStartupGame();
for (int i = 0; i < 2; i++)
{
AIPlayerBaka * p = (AIPlayerBaka *) (observer->players[i]);
p->forceBestAbilityUse = forceAbility;
p->life = initState.players[i]->life;
p->poisonCount = initState.players[i]->poisonCount;
stringstream stream;
stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
p->getRandomGenerator()->loadRandValues(stream.str());
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,
initState.players[i]->game->library,
initState.players[i]->game->hand,
initState.players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
{
MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{
MTGCardInstance * card = Rules::getCardByMTGId(observer, loadedPlayerZones[j]->cards[k]->getId());
if (card && zone != p->game->library)
{
if (zone == p->game->inPlay)
{
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
Spell * spell = NEW Spell(observer, copy);
spell->resolve();
if (!summoningSickness && (size_t)p->game->inPlay->nb_cards > k) p->game->inPlay->cards[k]->summoningSickness = 0;
delete spell;
}
else
{
if (!p->game->library->hasCard(card))
{
LOG ("TESTUITE ERROR, CARD NOT FOUND IN LIBRARY\n");
}
p->game->putInZone(card, p->game->library, zone);
}
}
else
{
if (!card)
{
LOG ("TESTUITE ERROR, card is NULL\n");
}
}
}
zone->cardsSeenThisTurn.clear(); //don't consider those cards as having moved in this area during this turn
}
p->game->stack->cardsSeenThisTurn.clear(); //don't consider those cards as having moved in this area during this turn
}
DebugTrace("TESTUITE Init Game Done !");
}