Code for removing damaged filters

Sorry, Im quite new to python and I cant really seem to find the correct for this (the title), could someone help me out, id be very gratefull.

1 Like

this is how i did it

this part locates the places where my firewall units are

    all_locations = []
    for i in range(game_state.ARENA_SIZE):
        for j in range(math.floor(game_state.ARENA_SIZE / 2)):
            if (game_state.game_map.in_arena_bounds([i, j])):
                all_locations.append([i, j])

    allied_locations = []
    for location in all_locations:
        if game_state.contains_stationary_unit(location):
            allied_locations.append(location)
    return (allied_locations)

this part checks if a firewall unit has less than 60% of its max stability, you can change that % to whatever you like

    for ally in allied_locations:
        if (game_state.game_map[ally[0], ally[1]][0].stability / game_state.game_map[ally[0], ally[1]][0].max_stability)*100 < 60:
                game_state.attempt_remove(ally)

this isn’t actually only for filters, but rather for all firewall units. I hope this helps you

1 Like

Yeah this will help thanks man

1 Like