diff --git a/resource/battle/WD-EX8-raid.json b/resource/battle/WD-EX8-raid.json new file mode 100644 index 0000000000..24567bd6fb --- /dev/null +++ b/resource/battle/WD-EX8-raid.json @@ -0,0 +1,200 @@ +{ + "minimum_required": "v4.0", + "desc": { + "title": "《AI 都比我打得好 - 第二集》", + "details": "作业抄自 https://www.bilibili.com/video/BV12r4y1W7s4?p=18" + }, + "stage_name": "如帝国之影", + "opers": [ + { + "name": "棘刺", + "skill_usage": 1 + } + ], + "actions": [ + { + "name": "银灰", + "location": [ + 6, + 5 + ], + "direction": "上" + }, + { + "type": "二倍速" + }, + { + "name": "推进之王", + "location": [ + 5, + 5 + ], + "direction": "左" + }, + { + "type": "二倍速" + }, + { + "name": "史尔特尔", + "location": [ + 11, + 4 + ], + "direction": "上" + }, + { + "type": "技能", + "name": "银灰" + }, + { + "type": "二倍速" + }, + { + "name": "棘刺", + "location": [ + 2, + 7 + ], + "direction": "上" + }, + { + "name": "塞雷娅", + "location": [ + 7, + 5 + ], + "direction": "右" + }, + { + "name": "艾雅法拉", + "location": [ + 3, + 2 + ], + "direction": "右" + }, + { + "pre_delay": 5000, + "name": "艾雅法拉", + "type": "技能" + }, + { + "name": "史尔特尔", + "type": "技能" + }, + { + "kills": 33, + "type": "撤退", + "name": "艾雅法拉" + }, + { + "type": "撤退", + "name": "史尔特尔" + }, + { + "type": "撤退", + "name": "推进之王" + }, + { + "kills": 36, + "name": "澄闪", + "location": [ + 2, + 6 + ], + "direction": "右" + }, + { + "name": "史尔特尔", + "location": [ + 8, + 5 + ], + "direction": "左" + }, + { + "name": "艾雅法拉", + "location": [ + 10, + 6 + ], + "direction": "左" + }, + { + "type": "撤退", + "name": "塞雷娅" + }, + { + "name": "银灰", + "type": "技能" + }, + { + "pre_delay": 7000, + "name": "史尔特尔", + "type": "技能" + }, + { + "name": "艾雅法拉", + "type": "技能" + }, + { + "name": "澄闪", + "type": "技能" + }, + { + "name": "塞雷娅", + "location": [ + 7, + 7 + ], + "direction": "右" + }, + { + "name": "史尔特尔", + "location": [ + 6, + 3 + ], + "direction": "下" + }, + { + "type": "技能", + "name": "史尔特尔" + }, + { + "kills": 40, + "name": "艾雅法拉", + "location": [ + 5, + 4 + ], + "direction": "右" + }, + { + "name": "推进之王", + "location": [ + 7, + 3 + ], + "direction": "上" + }, + { + "pre_delay": 6000, + "name": "艾雅法拉", + "type": "技能" + }, + { + "name": "银灰", + "location": [ + 5, + 7 + ], + "direction": "上" + }, + { + "pre_delay": 8000, + "type": "技能", + "name": "银灰" + } + ] +} diff --git a/resource/tasks.json b/resource/tasks.json index 63c327e332..77ce8aed86 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -3486,6 +3486,7 @@ 210, 118 ], + "cache": false, "action": "ClickSelf", "rearDelay": 500, "rectMove": [ diff --git a/src/MeoAssistant/BattleProcessTask.cpp b/src/MeoAssistant/BattleProcessTask.cpp index e20b1b7dde..365249b052 100644 --- a/src/MeoAssistant/BattleProcessTask.cpp +++ b/src/MeoAssistant/BattleProcessTask.cpp @@ -398,7 +398,10 @@ bool asst::BattleProcessTask::use_skill(const BattleAction& action) Point pos = iter->second.pos; m_ctrler->click(pos); - return ProcessTask(*this, { "BattleSkillReadyOnClick" }).set_retry_times(10000).run(); + return ProcessTask(*this, { "BattleSkillReadyOnClick" }) + .set_task_delay(0) + .set_retry_times(10000) + .run(); } void asst::BattleProcessTask::try_possible_skill(const cv::Mat& image) diff --git a/src/MeoAssistant/ProcessTask.cpp b/src/MeoAssistant/ProcessTask.cpp index ee9d7dbe9f..2d99b673e3 100644 --- a/src/MeoAssistant/ProcessTask.cpp +++ b/src/MeoAssistant/ProcessTask.cpp @@ -18,6 +18,7 @@ asst::ProcessTask::ProcessTask(const AbstractTask& abs, std::vector : AbstractTask(abs), m_raw_tasks_name(std::move(tasks_name)) { + m_task_delay = Resrc.cfg().get_options().task_delay; m_basic_info_cache = json::value(); } @@ -25,6 +26,7 @@ asst::ProcessTask::ProcessTask(AbstractTask&& abs, std::vector task : AbstractTask(std::move(abs)), m_raw_tasks_name(std::move(tasks_name)) { + m_task_delay = Resrc.cfg().get_options().task_delay; m_basic_info_cache = json::value(); } @@ -42,8 +44,7 @@ bool asst::ProcessTask::run() if (need_exit()) { return false; } - int delay = Resrc.cfg().get_options().task_delay; - sleep(delay); + sleep(m_task_delay); if (!on_run_fails()) { return false; @@ -53,6 +54,12 @@ bool asst::ProcessTask::run() return false; } +ProcessTask& asst::ProcessTask::set_task_delay(int delay) noexcept +{ + m_task_delay = delay; + return *this; +} + asst::ProcessTask& asst::ProcessTask::set_tasks(std::vector tasks_name) noexcept { m_raw_tasks_name = std::move(tasks_name); @@ -75,7 +82,6 @@ bool ProcessTask::_run() { LogTraceFunction; - auto& task_delay = Resrc.cfg().get_options().task_delay; while (!m_cur_tasks_name.empty()) { if (need_exit()) { return false; @@ -132,7 +138,7 @@ bool ProcessTask::_run() if (exec_times >= max_times) { Log.info("exec times exceeds the limit", info.to_string()); m_cur_tasks_name = cur_task_ptr->exceeded_next; - sleep(task_delay); + sleep(m_task_delay); continue; } @@ -210,7 +216,7 @@ bool ProcessTask::_run() return true; } m_cur_tasks_name = cur_task_ptr->next; - sleep(task_delay); + sleep(m_task_delay); } return true; diff --git a/src/MeoAssistant/ProcessTask.h b/src/MeoAssistant/ProcessTask.h index 9c761c085e..62829c0811 100644 --- a/src/MeoAssistant/ProcessTask.h +++ b/src/MeoAssistant/ProcessTask.h @@ -17,6 +17,7 @@ namespace asst virtual bool run() override; + ProcessTask& set_task_delay(int delay) noexcept; ProcessTask& set_tasks(std::vector tasks_name) noexcept; ProcessTask& set_times_limit(std::string name, int limit); ProcessTask& set_rear_delay(std::string name, int delay); @@ -32,5 +33,6 @@ namespace asst std::unordered_map m_rear_delay; std::unordered_map m_times_limit; std::unordered_map m_exec_times; + int m_task_delay = 0; }; } diff --git a/src/Python/sample.py b/src/Python/sample.py index 6117b6c117..7f31b0dbb8 100644 --- a/src/Python/sample.py +++ b/src/Python/sample.py @@ -24,7 +24,7 @@ if __name__ == "__main__": asst = Asst() # 请自行配置 adb 环境变量,或修改为 adb 可执行程序的路径 - if asst.connect('adb', '127.0.0.1:5555'): + if asst.connect('adb.exe', '127.0.0.1:5555'): print('连接成功') else: print('连接失败') diff --git a/src/Python/timed_start/timed_sample.py b/src/Python/timed_start/timed_sample.py index 2e7c42adc3..11a9b4bfeb 100644 --- a/src/Python/timed_start/timed_sample.py +++ b/src/Python/timed_start/timed_sample.py @@ -138,7 +138,7 @@ if __name__ == "__main__": print('version', asst.get_version()) # 请自行配置 adb 环境变量,或修改为 adb 可执行程序的路径 - if asst.connect('adb', '127.0.0.1:' + port): + if asst.connect('adb.exe', '127.0.0.1:' + port): print('连接成功') else: print('连接失败') diff --git a/tools/TestCaller/main.cpp b/tools/TestCaller/main.cpp index b317c0b853..ae4c387d5b 100644 --- a/tools/TestCaller/main.cpp +++ b/tools/TestCaller/main.cpp @@ -10,7 +10,7 @@ std::string get_cur_dir() return std::filesystem::current_path().u8string(); } -int main(int argc, char** argv) +int main(/*int argc, char** argv*/) { // 若使用 VS,请先设置 TestCaller 属性-调试-工作目录为 $(TargetDir) AsstLoadResource(get_cur_dir().c_str()); @@ -94,8 +94,7 @@ int main(int argc, char** argv) AsstAppendTask(ptr, "Copilot", R"( { - "stage_name": "千层蛋糕", - "filename": "./GA-EX8-raid.json" + "stage_name": "如帝国之影" } )"); diff --git a/tools/build_release.bat b/tools/build_release.bat index 0de8399902..0e93a7cb4b 100644 --- a/tools/build_release.bat +++ b/tools/build_release.bat @@ -1,3 +1,3 @@ MSBuild.exe ..\MeoAssistantArknights.sln /p:Configuration=Release /p:Platform=x64 /t:Rebuild - +call .\update_resource_rel.bat pause