def _move_to_tar(drone, tar_pos): order_ab_ids = [o.ability_id for o in drone.orders] if 1 not in order_ab_ids: return cmd_with_pos(ability_id=1, x=tar_pos[0], y=tar_pos[1], tags=[drone.tag], shift=False) else: return noop()
def _move_to_tar(drone, tar_pos): if len(drone.orders) > 0: if drone.orders[0].ability_id in [1, 16]: if self._dist(drone.orders[0].target_world_space_pos.x, drone.orders[0].target_world_space_pos.y, tar_pos[0], tar_pos[1]) < 1.0: return noop() return cmd_with_pos(ability_id=1, x=tar_pos[0], y=tar_pos[1], tags=[drone.tag], shift=False)
def _build_spinecrawler(drone): if len(drone.orders) > 0: if drone.orders[0].ability_id in [1166]: # Note: when fog covers the build pos, 1166 will not # be in orders, and instead it's move return noop() elif drone.orders[0].ability_id in [1, 16] and \ (drone.orders[0].target_world_space_pos.x, drone.orders[0].target_world_space_pos.y) in good_spine_pos: return noop() build_pos = good_spine_pos[np.random.randint( 0, len(good_spine_pos))] return cmd_with_pos(ability_id=1166, x=build_pos[0], y=build_pos[1], tags=[drone.tag], shift=False)
def _build_spinecrawler(drone): detect_range = 10 order_ab_ids = [o.ability_id for o in drone.orders] if 1166 not in order_ab_ids: random_r1 = np.random.random() random_r2 = np.random.random() build_pos = (random_r1*(drone.pos.x-detect_range/2)+ (1-random_r1)*(drone.pos.x+detect_range/2), random_r2*(drone.pos.y-detect_range/2)+ (1-random_r2)*(drone.pos.y+detect_range/2)) return cmd_with_pos(ability_id=1166, x=build_pos[0], y=build_pos[1], tags=[drone.tag], shift=False) else: return noop()