本文整理汇总了C++中Pokemon::levelUpTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Pokemon::levelUpTo方法的具体用法?C++ Pokemon::levelUpTo怎么用?C++ Pokemon::levelUpTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pokemon
的用法示例。
在下文中一共展示了Pokemon::levelUpTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateLevel
//.........这里部分代码省略.........
std::uniform_int_distribution<int> yDistribution { 0, (height - 1) };
auto finishRoomX = xDistribution(engine);
auto finishRoomY = yDistribution(engine);
if (floorIndex <= 0)
{
dungeon->setStartRoom(dungeon->getRoom(finishRoomX, finishRoomY, floorIndex));
}
if (floorIndex > 0)
{
while (startRoomX == finishRoomX && startRoomY == finishRoomY)
{
finishRoomX = xDistribution(engine);
finishRoomY = yDistribution(engine);
}
dungeon->getRoom(finishRoomX, finishRoomY, floorIndex - 1)->setRoom(Direction::DOWN, dungeon->getRoom(finishRoomX, finishRoomY, floorIndex));
dungeon->getRoom(finishRoomX, finishRoomY, floorIndex)->setRoom(Direction::UP, dungeon->getRoom(finishRoomX, finishRoomY, floorIndex - 1));
}
if (floorIndex < (MAX_DUNGEON_LEVEL - 1))
{
int nPokemon = static_cast<int>((dungeon->getWidth() * dungeon->getHeight()) * POKEMON_PER_ROOM);
Pokemon* pokemon = nullptr;
for (auto counter = 0; counter < nPokemon; ++counter)
{
pokemon = pokemonGenerator_->getRandomPokemon();
if (pokemon != nullptr)
{
pokemon->levelUpTo(floorIndex + 1);
pokemon->setCurrentRoom(dungeon->getRoom(xDistribution(engine), yDistribution(engine), floorIndex));
}
}
auto nItems =static_cast<int>((dungeon->getWidth() * dungeon->getHeight()) * ITEMS_PER_ROOM);
for (auto counter = 0; counter < nItems; ++counter)
{
dungeon->getRoom(xDistribution(engine), yDistribution(engine), floorIndex)->addItem(itemGenerator_->getRandomItem());
}
auto nTraps = static_cast<int>((dungeon->getWidth() * dungeon->getHeight()) * TRAPS_PER_ROOM);
Room* trapRoom;
std::map<Direction, Trap*>* traps = nullptr;
std::map<Direction, Room*> rooms;
std::vector<Direction> directions;
Direction randomDirection;
bool setTrap;
for (auto counter = 0; counter < nTraps; ++counter)
{
setTrap = false;
do
{
trapRoom = dungeon->getRoom(xDistribution(engine), yDistribution(engine), floorIndex);
traps = trapRoom->getTraps();
rooms = trapRoom->getAccessableRooms();
if (traps->size() < rooms.size())
{