roomsPerLock = roomsPerLock * constraints.getMaxKeys() /
(constraints.getMaxKeys() + 1);
log("roomsPerLock is now "+roomsPerLock);
if (roomsPerLock == 0) {
throw new GenerationFailureException(
"Failed to place rooms. Have you forgotten to disable boss-locking?");
// If the boss room is locked, the final key is used
// only for the boss room. So if the final key is
// also used to cross the river, rooms cannot be
// placed.
}
}
}
// Place the boss and goal rooms:
placeBossGoalRooms(levels);
// Place switches and the locks that require it:
placeSwitches();
// Make the dungeon less tree-like:
graphify();
computeIntensity(levels);
// Place the keys within the dungeon:
placeKeys(levels);
if (levels.keyCount()-1 != constraints.getMaxKeys())
throw new RetryException();
checkAcceptable();
return;
} catch (RetryException e) {
if (++ attempt > MAX_RETRIES) {
throw new GenerationFailureException("Dungeon generator failed", e);
}
log("Retrying dungeon generation...");
}
}