@log_debug
    def _combat(self, model, action_factory, rng):
        """
        Attack enemies
        """
        character = self.character
        player = model.player
        c_location = character.location
        p_location = player.location

        distance = ((c_location[0] - p_location[0]) ** 2 +
                    (c_location[1] - p_location[1]) ** 2) ** 0.5

        if distance == 1:
            direction = find_direction(c_location,
                                       p_location)
            attack(character,
                   direction,
                   rng)
        else:
            path, connections, updated = a_star(c_location,
                                                p_location,
                                                character.level)
            next_tile = path[1]

            direction = find_direction(character.location,
                                       next_tile)

            if is_move_legal(character,
                             direction,
                             'walk',
                             action_factory):
                move(character, direction, action_factory)
            else:
                character.tick = character.tick + 10
dataset/ETHPy150Open tuturto/pyherc/src/herculeum/ai/skeleton.py/SkeletonWarriorAI._combat/original