예제 #1
0
 def _get_corridor_candidate_dirs(self, direction):
     reverse = reverse_vector(direction)
     back_sides = {anticlockwise_45(reverse), clockwise_45(reverse)}
     candidate_dirs = set(self.level.get_passable_neighbors(self.creature.coord)) - {reverse}
     candidate_forward_dirs = candidate_dirs - back_sides
     candidate_orthogonal_dirs = candidate_dirs & set(Dir.Orthogonals)
     ignored_dirs = candidate_dirs & back_sides
     return candidate_forward_dirs, candidate_orthogonal_dirs, ignored_dirs
예제 #2
0
 def _get_side_passables(self, direction):
     if direction in Dir.Orthogonals:
         left = self._passable(anticlockwise(direction))
         right = self._passable(clockwise(direction))
     elif direction in Dir.Diagonals:
         left = self._passable(anticlockwise_45(direction))
         right = self._passable(clockwise_45(direction))
     else:
         raise Exception("Not a valid direction: {0}".format(direction))
     return WalkType(left, right)
예제 #3
0
 def _get_corridor_candidate_dirs(self, direction):
     reverse = reverse_vector(direction)
     back_sides = {anticlockwise_45(reverse), clockwise_45(reverse)}
     candidate_dirs = set(
         self.level.get_passable_neighbors(
             self.creature.coord)) - {reverse}
     candidate_forward_dirs = candidate_dirs - back_sides
     candidate_orthogonal_dirs = candidate_dirs & set(Dir.Orthogonals)
     ignored_dirs = candidate_dirs & back_sides
     return candidate_forward_dirs, candidate_orthogonal_dirs, ignored_dirs
예제 #4
0
 def _get_side_passables(self, direction):
     if direction in Dir.Orthogonals:
         left = self._passable(anticlockwise(direction))
         right = self._passable(clockwise(direction))
     elif direction in Dir.Diagonals:
         left = self._passable(anticlockwise_45(direction))
         right = self._passable(clockwise_45(direction))
     else:
         raise Exception("Not a valid direction: {0}".format(direction))
     return WalkType(left, right)
예제 #5
0
    def _get_neighbor_passables(self, direction):
        upper_left_dir = anticlockwise_45(direction)
        upper_right_dir = clockwise_45(direction)

        forward = self._passable(direction)
        left = self._passable(anticlockwise(direction))
        right = self._passable(clockwise(direction))
        up_left = self._passable(upper_left_dir)
        down_left = self._passable(anticlockwise(upper_left_dir))
        up_right = self._passable(upper_right_dir)
        down_right = self._passable(clockwise(upper_right_dir))
        return forward, up_left, up_right, left, right, down_left, down_right
예제 #6
0
    def _get_neighbor_passables(self, direction):
            upper_left_dir = anticlockwise_45(direction)
            upper_right_dir = clockwise_45(direction)

            forward = self._passable(direction)
            left = self._passable(anticlockwise(direction))
            right = self._passable(clockwise(direction))
            up_left = self._passable(upper_left_dir)
            down_left = self._passable(anticlockwise(upper_left_dir))
            up_right = self._passable(upper_right_dir)
            down_right = self._passable(clockwise(upper_right_dir))
            return forward, up_left, up_right, left, right, down_left, down_right