mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
fix: 修复肉鸽中干员 山 2 技能反复释放的问题
This commit is contained in:
@@ -211,6 +211,7 @@ std::vector<asst::battle::copilot::Action> asst::CopilotConfig::parse_actions(co
|
||||
action.direction = string_to_direction(action_info.get("direction", "Right"));
|
||||
|
||||
action.modify_usage = static_cast<battle::SkillUsage>(action_info.get("skill_usage", 0));
|
||||
action.modify_times = action_info.get("skill_times", 1);
|
||||
action.pre_delay = action_info.get("pre_delay", 0);
|
||||
auto post_delay_opt = action_info.find<int>("post_delay");
|
||||
// 历史遗留字段,兼容一下
|
||||
|
||||
@@ -78,8 +78,10 @@ bool asst::RoguelikeRecruitConfig::parse(const json::value& json)
|
||||
info.alternate_skill = oper_info.get("alternate_skill", info.alternate_skill);
|
||||
info.skill_usage =
|
||||
static_cast<battle::SkillUsage>(oper_info.get("skill_usage", static_cast<int>(info.skill_usage)));
|
||||
info.skill_times = oper_info.get("skill_times", info.skill_times);
|
||||
info.alternate_skill_usage = static_cast<battle::SkillUsage>(
|
||||
oper_info.get("alternate_skill_usage", static_cast<int>(info.alternate_skill_usage)));
|
||||
info.alternate_skill_times = oper_info.get("alternate_skill_times", info.alternate_skill_times);
|
||||
info.is_key = oper_info.get("is_key", info.is_key);
|
||||
info.is_start = oper_info.get("is_start", info.is_start);
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace asst
|
||||
int skill = 0;
|
||||
int alternate_skill = 0;
|
||||
battle::SkillUsage skill_usage = battle::SkillUsage::Possibly;
|
||||
int skill_times = 1;
|
||||
battle::SkillUsage alternate_skill_usage = battle::SkillUsage::Possibly;
|
||||
int alternate_skill_times = 1;
|
||||
};
|
||||
|
||||
class RoguelikeRecruitConfig final : public SingletonHolder<RoguelikeRecruitConfig>, public AbstractConfig
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace asst
|
||||
static inline const std::string RoguelikeUseNonfriendSupport = "RoguelikeUseNonfriendSupport";
|
||||
static inline const std::string RoguelikeTraderNoLongerBuy = "RoguelikeNoLongerBuy";
|
||||
static inline const std::string RoguelikeSkillUsagePrefix = "RoguelikeSkillUsage-";
|
||||
static inline const std::string RoguelikeSkillTimesPrefix = "RoguelikeSkillTimes-";
|
||||
static inline const std::string RoguelikeTeamFullWithoutRookie = "RoguelikeTeamFullWithoutRookie";
|
||||
static inline const std::string RoguelikeTheme = "RoguelikeTheme";
|
||||
static inline const std::string RoguelikeRecruitmentStartsComplete = "RoguelikeRecruitmentStartsComplete";
|
||||
|
||||
@@ -37,7 +37,7 @@ void asst::BattleHelper::clear()
|
||||
m_side_tile_info.clear();
|
||||
m_normal_tile_info.clear();
|
||||
m_skill_usage.clear();
|
||||
m_skill_need_use_count.clear();
|
||||
m_skill_times.clear();
|
||||
m_skill_error_count.clear();
|
||||
m_camera_count = 0;
|
||||
m_camera_shift = { 0., 0. };
|
||||
@@ -445,8 +445,7 @@ bool asst::BattleHelper::use_all_ready_skill(const cv::Mat& reusable)
|
||||
for (const auto& [name, loc] : m_battlefield_opers) {
|
||||
auto& usage = m_skill_usage[name];
|
||||
auto& retry = m_skill_error_count[name];
|
||||
auto& times = m_skill_need_use_count[name];
|
||||
|
||||
auto& times = m_skill_times[name];
|
||||
if (usage != SkillUsage::Possibly && usage != SkillUsage::Times) {
|
||||
continue;
|
||||
}
|
||||
@@ -466,9 +465,10 @@ bool asst::BattleHelper::use_all_ready_skill(const cv::Mat& reusable)
|
||||
}
|
||||
used = true;
|
||||
retry = 0;
|
||||
times--;
|
||||
if (usage == SkillUsage::Times && times == 0) {
|
||||
usage = SkillUsage::TimesUsed;
|
||||
|
||||
if (usage == SkillUsage::Times) {
|
||||
times--;
|
||||
if (times == 0) usage = SkillUsage::TimesUsed;
|
||||
}
|
||||
image = m_inst_helper.ctrler()->get_image();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace asst
|
||||
std::unordered_map<Point, TilePack::TileInfo> m_side_tile_info;
|
||||
std::unordered_map<Point, TilePack::TileInfo> m_normal_tile_info;
|
||||
std::unordered_map<std::string, battle::SkillUsage> m_skill_usage;
|
||||
std::unordered_map<std::string, int> m_skill_need_use_count;
|
||||
std::unordered_map<std::string, int> m_skill_times;
|
||||
std::unordered_map<std::string, int> m_skill_error_count;
|
||||
int m_camera_count = 0;
|
||||
std::pair<double, double> m_camera_shift = { 0., 0. };
|
||||
|
||||
@@ -134,7 +134,7 @@ bool asst::BattleProcessTask::to_group()
|
||||
continue;
|
||||
}
|
||||
m_skill_usage.emplace(oper_name, iter->skill_usage);
|
||||
m_skill_need_use_count.emplace(oper_name, iter->skill_times);
|
||||
m_skill_times.emplace(oper_name, iter->skill_times);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -187,7 +187,7 @@ bool asst::BattleProcessTask::do_action(const battle::copilot::Action& action, s
|
||||
case ActionType::SkillUsage:
|
||||
m_skill_usage[action.name] = action.modify_usage;
|
||||
if (action.modify_usage == SkillUsage::Times)
|
||||
m_skill_need_use_count[action.name] = action.modify_times;
|
||||
m_skill_times[action.name] = action.modify_times;
|
||||
ret = true;
|
||||
break;
|
||||
|
||||
|
||||
@@ -368,6 +368,8 @@ bool asst::RoguelikeBattleTaskPlugin::do_best_deploy()
|
||||
auto skill_usage_opt = status()->get_number(Status::RoguelikeSkillUsagePrefix + deploy_plan.oper_name);
|
||||
m_skill_usage[deploy_plan.oper_name] =
|
||||
skill_usage_opt ? static_cast<SkillUsage>(*skill_usage_opt) : SkillUsage::Possibly;
|
||||
auto skill_times_opt = status()->get_number(Status::RoguelikeSkillTimesPrefix + deploy_plan.oper_name);
|
||||
m_skill_times[deploy_plan.oper_name] = skill_times_opt ? static_cast<int>(*skill_times_opt) : 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -469,6 +471,8 @@ bool asst::RoguelikeBattleTaskPlugin::do_once()
|
||||
auto skill_usage_opt = status()->get_number(Status::RoguelikeSkillUsagePrefix + best_oper.name);
|
||||
m_skill_usage[best_oper.name] =
|
||||
skill_usage_opt ? static_cast<SkillUsage>(*skill_usage_opt) : SkillUsage::Possibly;
|
||||
auto skill_times_opt = status()->get_number(Status::RoguelikeSkillTimesPrefix + best_oper.name);
|
||||
m_skill_times[best_oper.name] = skill_times_opt ? static_cast<int>(*skill_times_opt) : 1;
|
||||
|
||||
if (urgent_home_opt) {
|
||||
m_urgent_home_index.pop_front();
|
||||
|
||||
@@ -69,6 +69,7 @@ bool asst::RoguelikeSkillSelectionTaskPlugin::_run()
|
||||
has_rookie = true;
|
||||
}
|
||||
status()->set_number(Status::RoguelikeSkillUsagePrefix + name, static_cast<int>(oper_info.skill_usage));
|
||||
status()->set_number(Status::RoguelikeSkillTimesPrefix + name, static_cast<int>(oper_info.skill_times));
|
||||
}
|
||||
|
||||
if (!status()->get_str(Status::RoguelikeCharOverview)) {
|
||||
|
||||
Reference in New Issue
Block a user