Beispiel #1
0
 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'
Beispiel #2
0
    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
Beispiel #3
0
 def look_around_myself(self, obj):
     obj.points = list()
     if any(obj.my_position is position
            for position in self.guard_positions):
         pass
     elif obj.is_empty:
         team = f.get_team_drones(obj=obj)
         for position in self.guard_positions:
             if not any(drone.my_position is position for drone in team):
                 obj.points = f.get_points_info(obj=obj, points=[position])
         if not obj.points and not obj.near(obj.mothership):
             obj.points = f.get_points_info(obj=obj,
                                            points=[obj.mothership.coord])
     else:
         obj.points = f.get_points_info(obj=obj,
                                        points=[obj.mothership.coord])
Beispiel #4
0
    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'