Don't spawn random entities on each level anymore

This commit is contained in:
Yohann D'ANELLO
2021-01-10 21:57:51 +01:00
parent 13e3628668
commit 01cdea6edc
3 changed files with 0 additions and 20 deletions

View File

@ -180,22 +180,6 @@ class Map:
return "\n".join("".join(tile.char(pack) for tile in line)
for line in self.tiles)
def spawn_random_entities(self, count: int) -> None:
"""
Puts randomly {count} entities on the map, only on empty ground tiles.
"""
for _ignored in range(count):
y, x = 0, 0
while True:
y, x = randint(0, self.height - 1), randint(0, self.width - 1)
tile = self.tiles[y][x]
if tile.can_walk():
break
entity = choices(Entity.get_all_entity_classes(),
weights=Entity.get_weights(), k=1)[0]()
entity.move(y, x)
self.add_entity(entity)
def compute_visibility(self, y: int, x: int, max_range: int) -> None:
"""
Sets the visible tiles to be the ones visible by an entity at point