@log_debug
def get_target_in_direction(level, location, direction, attack_range=100):
    target = None
    target_location = location
    target_data = None

    if direction == 9:
        return TargetData('void',
                          None,
                          None,
                          None)

    off_sets = [(0, 0),
                (0, -1), (1, -1), (1, 0), (1, 1),
                (0, 1), (-1, 1), (-1, 0), (-1, -1)]

    while (target is None
           and distance_between(location, target_location) <= attack_range):
        target_location = tuple([x for x in
                                 map(sum,
                                     zip(target_location,
                                         off_sets[direction]))])

        if blocks_movement(level, target_location):
            target_data = TargetData('wall',
                                     target_location,
                                     None,
                                     target_data)
            target = target_data
        else:
            target = get_character(level, target_location)
            if target:
                target_data = TargetData('character',
                                         target_location,
                                         target,
                                         target_data)
                target = target_data
            else:
                target_data = TargetData('void',
                                         target_location,
                                         None,
                                         target_data)

    return target_data
Get target of the attack
dataset/ETHPy150Open tuturto/pyherc/src/pyherc/data/geometry.py/get_target_in_direction