本文整理汇总了Python中ai.AI.move_monsters方法的典型用法代码示例。如果您正苦于以下问题:Python AI.move_monsters方法的具体用法?Python AI.move_monsters怎么用?Python AI.move_monsters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ai.AI
的用法示例。
在下文中一共展示了AI.move_monsters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from ai import AI [as 别名]
# 或者: from ai.AI import move_monsters [as 别名]
#.........这里部分代码省略.........
def die(self):
self.events["game_ended"].emit()
def generate_level(self):
self._level_count += 1
min_rooms = 5
size = 20, 20
# generate the tile types
tiletypes, rooms = self._level_generator.generate(size, min_rooms)
level = Level(self.player, tiletypes, self._level_count)
# generate the objects
objects = self._object_generator.generate(min_rooms, self._level_count)
self._object_generator.place_objects(objects, level)
# generate monsters
species = self._species_generator.generate_level(self._level_count)
beings = [Being(self.controller, s) for s in species]
self._species_generator.place_beings(beings, level)
# set the player on a up staircase
tile = level.staircases_up[0]
level.add_being(tile, self.player)
self.levels.append(level)
self._current_level = level
# housekeeping
# FIXME this will need to move to change_level
for being in [b for b in level.beings]:
being.new_level(level._size)
self.turn_done(move_monsters=False)
for being in [t.being for t in level.values() if t.being and self.player.vision.can_see(t)]:
being.has_been_seen = True
return level
def turn_done(self, move_monsters=True):
if self.player.is_dead:
return
level = self._current_level
# housekeeping
level._set_torch_map()
level.set_fov(self.player)
# ai
if move_monsters:
monsters = [b for b in level.beings if b is not self.player]
self.ai.move_monsters(level, self.player, monsters)
self.events["turn_finished"].emit(self._turn_num, self.player.can_move)
for being in level.beings:
being.new_turn()
# FIXME add custom logger class for this
# logger.turn_number = self._turn_num
self._turn_num += 1
if not self.player.can_move:
self.turn_done()