本文整理汇总了C++中Enemy::endTurn方法的典型用法代码示例。如果您正苦于以下问题:C++ Enemy::endTurn方法的具体用法?C++ Enemy::endTurn怎么用?C++ Enemy::endTurn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy::endTurn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
int seed = init_rand();
//int seed = init_rand(1314485160);
std::cout << "seed:" << seed << std::endl;
initScreen();
displayTitleScreen();
int world_width = worldScreenDims[WIDTH];
int world_height = worldScreenDims[HEIGHT];
int world_depth = 5;
world = new World(world_width, world_height, world_depth);
setWorld(world);//interface.h, just to keep a pointer to the world so It doesn't have to get passed with every message, prompt, etc. probably a better way to do this but i cba
player = world->generatePlayer();
enemies = world->generateEnemies(4,8);
world->generateItems(25,50);
std::stringstream intro_stream;
intro_stream << "You are " << player->getName() << ", an Adventurer in search of the Icon of Weedaula.";
message(intro_stream.str());
message("Bring the Icon back to the surface to win the game!");
message("Press '?' for help");
while (!isGameOver())
{
world->incrementTimeStep();
player->FOV(player->getMapLevel());
displayGameScreen();
updateScreen();
player->startTurn();
while (!player->isTurnFinished() && player->isTurn() && !isGameOver())
{
handleKeyPress();
}
player->endTurn();
enemies = world->getEnemyList();
for (unsigned int i = 0; i < enemies.size(); i++)
{
Enemy *en = enemies[i];
en->FOV(en->getMapLevel());
en->startTurn();
if (en->isTurn() && withinRange(en->getMapLevel(), player->getMapLevel(), player->getMapLevel()))
{
en->takeTurn();
}
en->endTurn();
}
}
if (isGameOver())
{
if (!player->isAlive())
{
displayGameOverScreen("You have been struck down");
}
}
}