def look_around_myself(self, obj): obj.points = list() if obj.health < 75 or f.get_danger_info( obj=obj, point=obj.coord) or obj.is_full: obj.my_role = 'guard_base' else: enemies = f.get_enemy_drones(obj=obj) enemies = f.points_on_feald(objects=enemies) gains = f.get_elirium_source(obj=obj) if obj.mothership.is_empty: gains = f.positions_near(obj=obj, positions=gains, distance=f.DRONE_RADIUS) else: gains = f.safe_positions(obj=obj, positions=gains, danger=enemies, lvl=1, dis=500) gains = f.get_elirium_sources_info(obj=obj, elirium_sources=gains) if gains: obj.points = f.get_elirium_sources_future_info(obj=obj, sources=gains) else: obj.my_role = 'guard_base'
def look_around_myself(self, obj, **kwargs): bases = f.get_enemy_bases(obj=obj) if f.available_points_for_attack(obj=obj, obj_type='base', points=bases): pass elif self.check_safe_alirium(obj=obj): obj.my_role = 'collector' else: positions = list() team = [drone.my_position for drone in f.get_team_drones(obj=obj)] radiuses = (200, 300, 400, 500, f.MOTHERSHIP_ATTACK_DISTANCE - 50) enemies = f.points_on_feald(objects=f.get_enemy_drones(obj=obj)) for radius in radiuses: for base in bases: positions.extend( f.positions_around_base(obj=obj, center=base, point_count=21, dist=radius)) positions = f.safe_positions(obj=obj, positions=positions, danger=enemies) positions = f.positions_near(obj=obj, positions=positions, distance=f.DRONE_RADIUS) positions = f.in_front_of_no_one(positions=positions, targets=bases, check_points=team, check_type='drone') if positions: obj.points = f.get_points_info(obj=obj, points=positions) else: obj.my_role = 'sabotage'
def look_around_myself(self, obj, **kwargs): enemy_drones = f.get_enemy_drones(obj=obj) if f.available_points_for_attack(obj=obj, obj_type='drone', points=enemy_drones): pass elif self.check_safe_alirium(obj=obj): obj.my_role = 'collector' else: bases_info = self.bases_info(obj=obj, enemy_drones=enemy_drones) team_drones = f.get_team_drones(obj=obj) team_positions = [drone.my_position for drone in team_drones] for base in bases_info: defenders = base[3] defenders.sort(key=lambda row: row[1], reverse=False) for defender in defenders: d = f.DRONE_ATTACK_DISTANCE - 50 danger = [ drone for drone in enemy_drones if drone != defender[0] ] danger = f.points_on_feald(objects=danger) positions = f.positions_for_attack(obj=obj, targets=[defender[0]], dis=d, point_count=31) positions.extend( f.positions_for_attack(obj=obj, targets=[defender[0]], dis=d - 100, point_count=31)) positions.extend( f.positions_for_attack(obj=obj, targets=[defender[0]], dis=d - 100, point_count=31)) positions = f.safe_positions(obj=obj, positions=positions, danger=danger) positions = f.no_team_behind(obj=obj, positions=positions, targets=[defender[0].coord], target_type='drone') positions = f.in_front_of_no_one( positions=positions, targets=[defender[0].coord], check_points=team_positions, check_type='drone') positions = f.positions_near(obj=obj, positions=positions, distance=f.DRONE_RADIUS * 2) if positions: obj.points = f.get_points_info(obj=obj, points=positions) break else: continue break
def look_around_myself(self, obj, **kwargs): obj.points = list() enemy_drones = f.get_enemy_drones(obj=obj) enemy_positions_on_field = f.points_on_feald(objects=enemy_drones, near_base=False) if f.available_points_for_attack(obj=obj, obj_type='drone', points=enemy_positions_on_field): pass elif self.check_safe_alirium(obj=obj): obj.my_role = 'collector' elif enemy_positions_on_field: team_drones = f.get_team_drones(obj=obj) team_positions = [drone.my_position for drone in team_drones] enemy_positions_on_base = f.points_on_feald(objects=enemy_drones, near_base=True) positions = f.positions_for_attack( obj=obj, targets=enemy_positions_on_field, dis=f.DRONE_ATTACK_DISTANCE - 50, point_count=21) positions = f.safe_positions(obj=obj, positions=positions, danger=enemy_positions_on_base) positions = f.positions_near(obj=obj, positions=positions, distance=f.DRONE_RADIUS * 2) positions = f.no_team_behind(obj=obj, positions=positions, targets=enemy_positions_on_field, target_type='drone') positions = f.in_front_of_no_one(positions=positions, targets=enemy_positions_on_field, check_points=team_positions, check_type='drone') if positions: obj.points = f.get_points_info(obj=obj, points=positions) else: obj.my_role = 'destruction' else: obj.my_role = 'destruction'
def look_around_myself(self, obj): obj.targets = list() enemies = f.get_enemy_drones(obj=obj) bases = f.get_enemy_bases(obj=obj) if self.danger_info(obj=obj): obj.my_role = 'guard_base' elif obj.my_role == 'guard_base': targets = f.points_on_feald(objects=enemies, near_base=False) targets = f.available_points_for_attack(obj=obj, obj_type='drone', points=targets) if targets: obj.targets = f.get_points_info(obj=obj, points=targets) else: obj.my_role = 'infantry' elif obj.my_role == 'infantry': targets = f.points_on_feald(objects=enemies, near_base=False) targets = f.available_points_for_attack(obj=obj, obj_type='drone', points=targets) if targets: obj.targets = f.get_points_info(obj=obj, points=targets) elif obj.my_role == 'besiegement': targets = f.points_on_feald(objects=enemies) targets = f.available_points_for_attack(obj=obj, obj_type='drone', points=targets, dist_change=1) if targets: obj.targets = f.get_points_info(obj=obj, points=targets) else: targets = f.available_points_for_attack(obj=obj, obj_type='base', points=bases, dist_change=1) if targets: obj.targets = f.get_points_info(obj=obj, points=targets)
def check_safe_alirium(self, obj): enemies = f.get_enemy_drones(obj=obj) enemies = f.points_on_feald(objects=enemies) gains = f.get_elirium_source(obj=obj) gains = f.safe_positions(obj=obj, positions=gains, danger=enemies, lvl=1, dis=500) gains = f.positions_near(obj=obj, positions=gains, distance=f.DRONE_RADIUS) if gains: return True else: return False
def look_around_myself(self, obj, **kwargs): enemy_bases = f.get_enemy_bases(obj=obj) if f.available_points_for_attack(obj=obj, obj_type='base', points=enemy_bases, dist_change=-400): pass elif self.check_safe_alirium(obj=obj): obj.my_role = 'collector' else: positions = list() enemy_drones = f.get_enemy_drones(obj=obj) for base in enemy_bases: positions_around_base = f.positions_around_base(obj=obj, center=base, point_count=7, dist=100) defenders = [ drone for drone in enemy_drones if drone.team == base.team ] defenders = f.points_on_feald(objects=defenders) for position in positions_around_base: for defender in defenders: if base.near(defender): break elif f.point_on_shot_line(point_start=position, point_end=defender, point_find=base, obj_type='base') is False: break elif f.point_on_shot_line(point_start=obj.my_position, point_end=base, point_find=defender, obj_type='space') is True: break else: positions.append(position) positions = f.positions_near(obj=obj, positions=positions, distance=f.DRONE_RADIUS * 2) if positions: obj.points = f.get_points_info(obj=obj, points=positions) else: obj.my_role = 'base_attack'