Skip to content

Commit

Permalink
fix.修复一个肉鸽选择技能时越界崩溃的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed May 31, 2022
1 parent d19bdcf commit 108b94a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions resource/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@
"^1$",
""
],
[
"^中$",
""
],
[
"姜哦",
"嵯峨"
Expand Down
7 changes: 6 additions & 1 deletion src/MeoAssistant/RoguelikeSkillSelectionTaskPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ bool asst::RoguelikeSkillSelectionTaskPlugin::verify(AsstMsg msg, const json::va

bool asst::RoguelikeSkillSelectionTaskPlugin::_run()
{
LogTraceFunction;

auto image = m_ctrler->get_image();
RoguelikeSkillSelectionImageAnalyzer analyzer(image);

Expand All @@ -35,6 +37,9 @@ bool asst::RoguelikeSkillSelectionTaskPlugin::_run()
const auto& rg_src = Resrc.roguelike_recruit();
for (const auto& [name, skill_vec] : analyzer.get_result()) {
Log.info(__FUNCTION__, name, " skill size:", skill_vec.size());
if (name.empty()) {
continue;
}
const auto& oper_info = rg_src.get_oper_info(name);
int index = 0;
BattleSkillUsage usage = BattleSkillUsage::Possibly;
Expand All @@ -47,7 +52,7 @@ bool asst::RoguelikeSkillSelectionTaskPlugin::_run()
usage = oper_info.alternate_skill_usage;
}

if (index) {
if (index >= 0) {
Log.info(__FUNCTION__, name, " select skill:", index + 1);
m_ctrler->click(skill_vec.at(index));
}
Expand Down

0 comments on commit 108b94a

Please sign in to comment.