Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/generators/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,13 @@ def add_special_rooms(self, dead_ends: list) -> None:

def place_super_secret_room(self) -> None:
"""
Places a super secret room on the flor.
Places a super secret room on the floor.
The super secret room should be as close as possible to the boss room
but should not be adjacent to the boss room.
There should only have one adjacent room.
It should only have one adjacent room.
"""
floor = self._floor
distance_to_boss = 25
distance_to_boss = my_globals.MAX_SUPER_SECRET_ROOM_DISTANCE_SQUARED
candidate = None
boss_room = floor.get_boss_room()
for room in floor.get_rooms():
Expand Down
3 changes: 3 additions & 0 deletions src/utils/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class Color(Enum):
FLOOR_WIDTH: int = 9
FLOOR_HEIGHT: int = 8
MAX_ROOMS: int = 15
# The super secret room is only placed closer than this to the boss room
# (squared distance, 25 means a distance below 5 rooms)
MAX_SUPER_SECRET_ROOM_DISTANCE_SQUARED: int = 25
# Distance between start and boss room
X_OFFSET = (FLOOR_WIDTH * ROOM_WIDTH) / 2
Y_OFFSET = 0
Expand Down
8 changes: 3 additions & 5 deletions src/utils/util_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import os
import random
import math
from typing import Tuple

import utils.globals as my_globals
Expand Down Expand Up @@ -37,14 +36,13 @@ def get_picture_for_room_type(room_type: RoomType):
def calculate_room_amount(stage_id: int, rng: random.Random) -> int:
"""
Calculates the room amount.
The generator may place a few more rooms than this,
because it adds all neighbours of a room in one step.
@param stage_id: id for the floor
@param rng: random number generator to use
:return: room amount
"""
return min(
my_globals.MAX_ROOMS,
int(rng.randint(0, 1) + 5 + math.floor(stage_id * 10) / 3.0),
)
return min(my_globals.MAX_ROOMS, rng.randint(0, 1) + 5 + stage_id * 10 // 3)


def place_room(rng: random.Random) -> bool:
Expand Down
Loading
Loading