feat.自动战斗新增支持费用增量字段,与击杀数是与的关系

This commit is contained in:
MistEO
2022-05-29 16:31:39 +08:00
parent 9fef421cc2
commit 4ce0b7e5e4
7 changed files with 40 additions and 7 deletions

View File

@@ -339,7 +339,6 @@ bool asst::BattleProcessTask::wait_condition(const BattleAction& action)
}
image = m_ctrler->get_image();
BattleImageAnalyzer analyzer(image);
analyzer.set_target(BattleImageAnalyzer::Target::Kills);
if (analyzer.analyze()) {
m_kills = analyzer.get_kills();
@@ -352,6 +351,29 @@ bool asst::BattleProcessTask::wait_condition(const BattleAction& action)
std::this_thread::yield();
}
if (action.cost_changes != 0) {
int cost_base = -1;
while (true) {
image = m_ctrler->get_image();
BattleImageAnalyzer analyzer(image);
analyzer.set_target(BattleImageAnalyzer::Target::Cost);
if (analyzer.analyze()) {
int cost = analyzer.get_cost();
if (cost_base == -1) {
cost_base = cost;
continue;
}
if (cost >= cost_base + action.cost_changes) {
break;
}
}
try_possible_skill(image);
std::this_thread::yield();
}
}
// 部署干员还有额外等待费用够或 CD 转好
if (action.type == BattleActionType::Deploy) {
const std::string& name = m_group_to_oper_mapping[action.group_name].name;