From cf3adef12a706fdbebedc9ff344fda76df57edc7 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 16 Apr 2023 23:44:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=8A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=AD=90=E5=BC=B9=E6=97=B6=E9=97=B4=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Task/Miscellaneous/BattleProcessTask.cpp | 28 ++++--------------- .../Task/Miscellaneous/BattleProcessTask.h | 2 +- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp b/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp index 0af5e0d2fc..415e978702 100644 --- a/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp +++ b/src/MaaCore/Task/Miscellaneous/BattleProcessTask.cpp @@ -173,7 +173,7 @@ bool asst::BattleProcessTask::do_action(const battle::copilot::Action& action, s break; case ActionType::BulletTime: - ret = enter_bullet_time_for_next_action(action_index + 1, location, name); + ret = enter_bullet_time(name, location); if (ret) m_in_bullet_time = true; break; @@ -337,32 +337,14 @@ bool asst::BattleProcessTask::wait_condition(const Action& action) return true; } -bool asst::BattleProcessTask::enter_bullet_time_for_next_action(size_t next_index, const Point& location, - const std::string& name) +bool asst::BattleProcessTask::enter_bullet_time(const std::string& name, const Point& location) { LogTraceFunction; - if (next_index > get_combat_data().actions.size()) { - Log.error("Bullet time does not have the next step!"); - return false; - } - const auto& next_action = get_combat_data().actions.at(next_index); - - bool ret = false; - switch (next_action.type) { - case ActionType::Deploy: + bool ret = location.empty() ? click_oper_on_battlefield(name) : click_oper_on_battlefield(location); + if (!ret) { ret = click_oper_on_deployment(name); - break; - - case ActionType::UseSkill: - case ActionType::Retreat: - ret = location.empty() ? click_oper_on_battlefield(name) : click_oper_on_battlefield(location); - break; - - default: - Log.error("Bullet time 's next step is not deploy, skill or retreat!"); - return false; - } + }; return ret; } diff --git a/src/MaaCore/Task/Miscellaneous/BattleProcessTask.h b/src/MaaCore/Task/Miscellaneous/BattleProcessTask.h index 72af4fae18..0768bf5fd3 100644 --- a/src/MaaCore/Task/Miscellaneous/BattleProcessTask.h +++ b/src/MaaCore/Task/Miscellaneous/BattleProcessTask.h @@ -32,7 +32,7 @@ namespace asst const std::string& get_name_from_group(const std::string& action_name); void notify_action(const battle::copilot::Action& action); bool wait_condition(const battle::copilot::Action& action); - bool enter_bullet_time_for_next_action(size_t next_index, const Point& location, const std::string& name); + bool enter_bullet_time(const std::string& name, const Point& location); void sleep_and_do_strategy(unsigned millisecond); battle::copilot::CombatData m_combat_data;