Don't spawn random entities on each level anymore
This commit is contained in:
parent
13e3628668
commit
01cdea6edc
|
@ -71,9 +71,6 @@ class Player(InventoryHolder, FightingEntity):
|
||||||
self.max_xp = self.level * 10
|
self.max_xp = self.level * 10
|
||||||
self.health = self.maxhealth
|
self.health = self.maxhealth
|
||||||
self.strength = self.strength + 1
|
self.strength = self.strength + 1
|
||||||
# TODO Remove it, that's only fun
|
|
||||||
self.map.spawn_random_entities(randint(3 * self.level,
|
|
||||||
10 * self.level))
|
|
||||||
|
|
||||||
def add_xp(self, xp: int) -> None:
|
def add_xp(self, xp: int) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -61,7 +61,6 @@ class Game:
|
||||||
self.player = Player()
|
self.player = Player()
|
||||||
self.map.add_entity(self.player)
|
self.map.add_entity(self.player)
|
||||||
self.player.move(self.map.start_y, self.map.start_x)
|
self.player.move(self.map.start_y, self.map.start_x)
|
||||||
self.map.spawn_random_entities(randint(3, 10))
|
|
||||||
self.inventory_menu.update_player(self.player)
|
self.inventory_menu.update_player(self.player)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -180,22 +180,6 @@ class Map:
|
||||||
return "\n".join("".join(tile.char(pack) for tile in line)
|
return "\n".join("".join(tile.char(pack) for tile in line)
|
||||||
for line in self.tiles)
|
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:
|
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
|
Sets the visible tiles to be the ones visible by an entity at point
|
||||||
|
|
Loading…
Reference in New Issue