| 207 | } |
| 208 | |
| 209 | void RoomPortal::doUpkeep() |
| 210 | { |
| 211 | // Call the super class Room::doUpkeep() function to do any generic upkeep common to all rooms. |
| 212 | Room::doUpkeep(); |
| 213 | |
| 214 | if(mSpawnCreatureCountdown > 0) |
| 215 | { |
| 216 | --mSpawnCreatureCountdown; |
| 217 | return; |
| 218 | } |
| 219 | mSpawnCreatureCountdown = Random::Uint(ConfigManager::getSingleton().getRoomConfigUInt32("PortalCooldownSpawnMin"), |
| 220 | ConfigManager::getSingleton().getRoomConfigUInt32("PortalCooldownSpawnMax")); |
| 221 | |
| 222 | if (mCoveredTiles.empty()) |
| 223 | return; |
| 224 | |
| 225 | // Rogue seat cannot spawn creatures through normal portal (they won't spawn |
| 226 | // anyway since there is no spawning list for rogue seat but no need to compute |
| 227 | // everything in this case) |
| 228 | if(getSeat()->isRogueSeat()) |
| 229 | return; |
| 230 | |
| 231 | if(getSeat()->getPlayer() == nullptr) |
| 232 | return; |
| 233 | |
| 234 | if(getSeat()->getPlayer()->getHasLost()) |
| 235 | return; |
| 236 | |
| 237 | // Randomly choose to spawn a creature. |
| 238 | const double maxCreatures = getSeat()->getNumCreaturesFightersMax(); |
| 239 | // Count how many creatures are controlled by this seat |
| 240 | double numCreatures = getSeat()->getNumCreaturesFighters(); |
| 241 | if(numCreatures >= maxCreatures) |
| 242 | return; |
| 243 | |
| 244 | spawnCreature(); |
| 245 | } |
| 246 | |
| 247 | void RoomPortal::spawnCreature() |
| 248 | { |
nothing calls this directly
no test coverage detected