Exemple #1
0
def tech_alignment(subformation, defense, arguments, optional_arguments):
    side_type = arguments[0]
    alignment = arguments[1]
    y = int(arguments[2])
    flip = True if arguments[3] == 'True' else False

    players_list = list(subformation.players.values())

    align_side = sutils.get_side(side_type, players_list,
                                 subformation.hash_mark)
    if flip:
        align_side = 'RT' if align_side == 'LT' else 'LT'

    offset = -1 if 'i' in alignment else 1
    offset = offset if align_side == 'RT' else offset * -1
    if alignment in ['0', '2', '4', '6', '8']:
        offset = 0
    # Get alignment player
    if alignment in ['0', '1']:
        align_player = sutils.get_center(players_list)
    elif alignment in ['2i', '2', '3']:
        align_player = sutils.get_lg(
            players_list) if align_side == 'LT' else sutils.get_rg(
                players_list)
    elif alignment in ['4i', '4', '5']:
        align_player = sutils.get_lt(
            players_list) if align_side == 'LT' else sutils.get_rt(
                players_list)
    elif alignment in ['6i', '6', '7']:
        align_player = sutils.get_first_attached(players_list, 'LT')\
            if align_side == 'LT' else sutils.get_first_attached(players_list, 'RT')
        ghost_distance_multiplier = 1
    elif alignment in ['8i', '8', '9']:
        align_player = sutils.get_second_attached(players_list, 'LT') \
            if align_side == 'LT' else sutils.get_second_attached(players_list, 'RT')
        ghost_distance_multiplier = 2

    if align_player:
        x = align_player.x + offset
    else:
        x = sutils.get_rt(players_list).x + GHOST_DISTANCE * ghost_distance_multiplier \
            if align_side == 'RT' else \
            sutils.get_lt(players_list).x - GHOST_DISTANCE * ghost_distance_multiplier

    if 'slide_in_if_covered' in optional_arguments:
        min_x, max_x = (x - 5, x + 1) if align_side == 'LT' else (x - 1, x + 5)
        if is_a_defender_between(defense, min_x, max_x, 1):
            x = x + 3 if align_side == 'LT' else x - 3

    return x, y
Exemple #2
0
def is_there_te(subformation, side_type, flip):
    side = su.get_side(side_type, list(subformation.players.values()),
                       subformation.hash_mark)
    if flip == 'True':
        side = 'RT' if side == 'LT' else 'LT'
    first_attached = su.get_first_attached(list(subformation.players.values()),
                                           side)
    return first_attached != None and first_attached.y == 1
Exemple #3
0
def over(subformation, defense, arguments, optional_arguments):
    side_type = arguments[0]
    over = arguments[1]
    y = int(arguments[2])
    offset = int(arguments[3])
    flip = True if arguments[4] == 'True' else False

    players_list = list(subformation.players.values())

    align_side = sutils.get_side(side_type, players_list,
                                 subformation.hash_mark)
    if flip:
        align_side = 'RT' if align_side == 'LT' else 'LT'

    player_direction_outside_accross = 'right_to_left' if align_side == 'RT' else 'left_to_right'
    receivers_outside_across = sutils.get_skill_ordered(
        players_list, player_direction_outside_accross)

    offset = offset if align_side == 'RT' else -offset

    player_defender_is_over = None
    if over == '#1':
        player_defender_is_over = receivers_outside_across[0]
    elif over == '#2':
        player_defender_is_over = receivers_outside_across[1]
    elif over == '#3':
        player_defender_is_over = receivers_outside_across[2]
    elif over == '#4':
        player_defender_is_over = receivers_outside_across[3]
    elif over == 'last_attached':
        player_defender_is_over = sutils.get_outside_most_attached_or_tackle(
            players_list, align_side)
    elif over == 'first_attached':
        player_defender_is_over = sutils.get_first_attached(
            players_list, align_side)
    elif over == 'los_between_2_1':
        player_defender_is_over = receivers_outside_across[
            1] if receivers_outside_across[
                1].y == 1 else receivers_outside_across[0]
    elif over == 'non_los_between_2_1':
        player_defender_is_over = receivers_outside_across[
            1] if receivers_outside_across[
                1].y != 1 else receivers_outside_across[0]
    elif over == 'los_between_3_2':
        player_defender_is_over = receivers_outside_across[
            2] if receivers_outside_across[
                2].y == 1 else receivers_outside_across[1]
    elif over == 'non_los_between_3_2':
        player_defender_is_over = receivers_outside_across[
            2] if receivers_outside_across[
                2].y != 1 else receivers_outside_across[1]

    x = player_defender_is_over.x + offset

    if 'back_off_if_occupied' in optional_arguments:
        min_x, max_x = (
            player_defender_is_over.x - 5, player_defender_is_over.x +
            1) if align_side == 'LT' else (player_defender_is_over.x - 1,
                                           player_defender_is_over.x + 5)
        if is_a_defender_between(defense, min_x, max_x, 3):
            y = 5

    if 'back_off_further_if_occupied' in optional_arguments:
        min_x, max_x = (
            player_defender_is_over.x - 5, player_defender_is_over.x +
            1) if align_side == 'LT' else (player_defender_is_over.x - 1,
                                           player_defender_is_over.x + 5)
        if is_a_defender_between(defense, min_x, max_x, 3):
            y = 7

    if 'back_off_wing' in optional_arguments and y < 2 and player_defender_is_over.y > 1:
        y = 2

    return x, y