mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
feat: 将方向改为静态成员函数
This commit is contained in:
@@ -38,6 +38,10 @@ namespace asst
|
||||
{
|
||||
return "[ " + std::to_string(x) + ", " + std::to_string(y) + " ]";
|
||||
}
|
||||
static constexpr Point RightDirection() { return Point(1, 0); }
|
||||
static constexpr Point DownDirection() { return Point(0, 1); }
|
||||
static constexpr Point LeftDirection() { return Point(-1, 0); }
|
||||
static constexpr Point UpDirection() { return Point(0, -1); }
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
};
|
||||
|
||||
@@ -727,17 +727,12 @@ std::pair<asst::Point, int> asst::RoguelikeBattleTaskPlugin::calc_best_direction
|
||||
left_attack_range.emplace_back(-x, -y);
|
||||
up_attack_range.emplace_back(y, -x);
|
||||
}
|
||||
|
||||
static const constexpr Point RightDirection(1, 0);
|
||||
static const constexpr Point DownDirection(0, 1);
|
||||
static const constexpr Point LeftDirection(-1, 0);
|
||||
static const constexpr Point UpDirection(0, -1);
|
||||
std::vector<std::pair<const Point&, std::vector<Point>>> DirectionAttackRangeMap;
|
||||
DirectionAttackRangeMap.reserve(4);
|
||||
DirectionAttackRangeMap.emplace_back(RightDirection, std::move(right_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(DownDirection, std::move(down_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(LeftDirection, std::move(left_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(UpDirection, std::move(up_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(Point::RightDirection(), std::move(right_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(Point::DownDirection(), std::move(down_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(Point::LeftDirection(), std::move(left_attack_range));
|
||||
DirectionAttackRangeMap.emplace_back(Point::UpDirection(), std::move(up_attack_range));
|
||||
|
||||
int max_score = 0;
|
||||
Point opt_direction;
|
||||
|
||||
Reference in New Issue
Block a user