diff --git a/src/MeoAssistant/BattlePerspectiveImageAnalyzer.cpp b/src/MeoAssistant/BattlePerspectiveImageAnalyzer.cpp index 79bdca48da..9c1238923d 100644 --- a/src/MeoAssistant/BattlePerspectiveImageAnalyzer.cpp +++ b/src/MeoAssistant/BattlePerspectiveImageAnalyzer.cpp @@ -55,8 +55,8 @@ bool asst::BattlePerspectiveImageAnalyzer::placed_analyze() int h = stats.at(i, cv::CC_STAT_HEIGHT); m_available_placed.emplace_back(Rect(x, y, w, h)); - int center_x = centroids.at(i, 0); - int center_y = centroids.at(i, 1); + int center_x = static_cast(centroids.at(i, 0)); + int center_y = static_cast(centroids.at(i, 1)); placed_centers.emplace_back(Point(center_x, center_y)); #ifdef ASST_DEBUG @@ -76,8 +76,8 @@ bool asst::BattlePerspectiveImageAnalyzer::placed_analyze() auto nearest_iter = std::min_element(placed_centers.cbegin(), placed_centers.cend(), [&home](const Point& lhs, const Point& rhs) -> bool { - int lhs_dist = std::pow((home.x - lhs.x), 2) + std::pow((home.y - lhs.y), 2); - int rhs_dist = std::pow((home.x - rhs.x), 2) + std::pow((home.y - rhs.y), 2); + double lhs_dist = std::pow((home.x - lhs.x), 2) + std::pow((home.y - lhs.y), 2); + double rhs_dist = std::pow((home.x - rhs.x), 2) + std::pow((home.y - rhs.y), 2); return lhs_dist < rhs_dist; }); if (nearest_iter == placed_centers.cend()) { diff --git a/src/MeoAssistant/BattleTask.cpp b/src/MeoAssistant/BattleTask.cpp index 720dcd39f5..9d5e8d26d5 100644 --- a/src/MeoAssistant/BattleTask.cpp +++ b/src/MeoAssistant/BattleTask.cpp @@ -33,11 +33,11 @@ bool asst::BattleTask::auto_battle() } static const std::array RoleOrder = { - Role::Medic, Role::Pioneer, Role::Sniper, Role::Warrior, Role::Support, + Role::Medic, Role::Caster, Role::Special, Role::Tank, @@ -84,13 +84,18 @@ bool asst::BattleTask::auto_battle() int dx = nearest_point.x - home_center.x; int dy = nearest_point.y - home_center.y; + if ((dx * 7) < (dy * 11)) { + dx = 0; + } + else { + dy = 0; + } + constexpr int coeff = 5; Point end_point; - switch (opt_oper.role) { case Role::Medic: case Role::Support: { - constexpr int coeff = 5; end_point.x = nearest_point.x - coeff * dx; end_point.y = nearest_point.y - coeff * dy; } @@ -104,7 +109,6 @@ bool asst::BattleTask::auto_battle() case Role::Drone: default: { - constexpr int coeff = 5; end_point.x = nearest_point.x + coeff * dx; end_point.y = nearest_point.y + coeff * dy; }