mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 01:59:33 +08:00
perf: 迁移肉鸽难度
This commit is contained in:
@@ -48,7 +48,6 @@ namespace asst
|
||||
static inline const std::string RoguelikeUseSupport = "RoguelikeUseSupport";
|
||||
static inline const std::string RoguelikeUseNonfriendSupport = "RoguelikeUseNonfriendSupport";
|
||||
static inline const std::string RoguelikeTeamFullWithoutRookie = "RoguelikeTeamFullWithoutRookie";
|
||||
static inline const std::string RoguelikeDifficulty = "RoguelikeDifficulty";
|
||||
static inline const std::string RoguelikeFoldartalOverview = "RoguelikeFoldartalOverview";
|
||||
static inline const std::string RoguelikeFoldartalFloor = "RoguelikeFoldartalFloor";
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
// 是否凹指定干员开局直升
|
||||
bool start_with_elite_two = params.get("start_with_elite_two", false);
|
||||
|
||||
status()->set_properties(Status::RoguelikeDifficulty, "0");
|
||||
m_roguelike_config_ptr->set_difficulty(0);
|
||||
status()->set_properties(Status::RoguelikeStartWithEliteTwo, std::to_string(start_with_elite_two));
|
||||
|
||||
// 设置层数选点策略,相关逻辑在 RoguelikeStrategyChangeTaskPlugin
|
||||
|
||||
@@ -27,6 +27,9 @@ namespace asst
|
||||
std::string get_theme() { return m_theme; }
|
||||
void set_mode(RoguelikeMode mode) { m_mode = mode; }
|
||||
RoguelikeMode get_mode() { return m_mode; }
|
||||
void set_difficulty(int difficulty) { m_difficulty = difficulty; }
|
||||
int get_difficulty() { return m_difficulty; }
|
||||
|
||||
void set_recruitment_count(int count) { m_recruitment_count = count; }
|
||||
int get_recruitment_count() { return m_recruitment_count; }
|
||||
void set_recruitment_starts_complete(bool complete) { m_recruitment_starts_complete = complete; }
|
||||
@@ -40,6 +43,9 @@ namespace asst
|
||||
// 肉鸽主题
|
||||
std::string m_theme;
|
||||
RoguelikeMode m_mode = RoguelikeMode::Exp;
|
||||
int m_difficulty = 0;
|
||||
|
||||
/* 每次重置 */
|
||||
// 肉鸽招募次数
|
||||
int m_recruitment_count = 0;
|
||||
// 开局干员是否已经招募
|
||||
|
||||
@@ -36,9 +36,9 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::_run()
|
||||
// todo:以后可以根据传入的难度值选择难度?
|
||||
|
||||
// 当前难度
|
||||
std::string difficulty = status()->get_properties(Status::RoguelikeDifficulty).value();
|
||||
int difficulty = m_config->get_difficulty();
|
||||
if (m_config->get_theme() != "Phantom" && mode == RoguelikeMode::Collectible) {
|
||||
if (difficulty == "max") {
|
||||
if (difficulty == INT_MAX) {
|
||||
ProcessTask(*this, { m_config->get_theme() + "@Roguelike@ChooseDifficulty_Hardest" }).run();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -61,7 +61,7 @@ bool asst::RoguelikeLastRewardTaskPlugin::_run()
|
||||
status()->get_properties(Status::RoguelikeStartWithEliteTwo).value() == std::to_string(true);
|
||||
if (m_config->get_theme() != "Phantom" && mode == RoguelikeMode::Collectible) {
|
||||
if (m_is_next_hardest) {
|
||||
status()->set_properties(Status::RoguelikeDifficulty, "max");
|
||||
m_config->set_difficulty(INT_MAX);
|
||||
// 获得热水壶和演讲时停止肉鸽(凹直升则继续),获得其他奖励时重开
|
||||
std::string last_reward_stop_or_continue =
|
||||
start_with_elite_two ? "Roguelike@LastReward_default" : "Roguelike@LastReward_stop";
|
||||
@@ -72,7 +72,7 @@ bool asst::RoguelikeLastRewardTaskPlugin::_run()
|
||||
Task.set_task_base("Roguelike@LastRewardRand", "Roguelike@LastReward_restart");
|
||||
}
|
||||
else {
|
||||
status()->set_properties(Status::RoguelikeDifficulty, "0");
|
||||
m_config->set_difficulty(0);
|
||||
// 重置开局奖励 next,获得任意奖励均继续
|
||||
Task.set_task_base("Roguelike@LastReward", "Roguelike@LastReward_default");
|
||||
Task.set_task_base("Roguelike@LastReward2", "Roguelike@LastReward_default");
|
||||
|
||||
@@ -435,7 +435,7 @@ bool asst::RoguelikeRecruitTaskPlugin::recruit_appointed_char(const std::string&
|
||||
// 是否凹直升
|
||||
std::string start_with_elite_two = status()->get_properties(Status::RoguelikeStartWithEliteTwo).value();
|
||||
// 当前肉鸽难度
|
||||
std::string difficulty = status()->get_properties(Status::RoguelikeDifficulty).value();
|
||||
int difficulty = m_config->get_difficulty();
|
||||
|
||||
for (; i != SwipeTimes; ++i) {
|
||||
if (need_exit()) {
|
||||
@@ -459,13 +459,13 @@ bool asst::RoguelikeRecruitTaskPlugin::recruit_appointed_char(const std::string&
|
||||
|
||||
if (it != chars.cend()) {
|
||||
// 需要凹直升且当前为max难度时
|
||||
if (start_with_elite_two == "1" && difficulty == "max") {
|
||||
if (start_with_elite_two == "1" && difficulty == INT_MAX) {
|
||||
if (it->elite == 2) {
|
||||
m_task_ptr->set_enable(false);
|
||||
}
|
||||
else {
|
||||
// 重置难度并放弃
|
||||
status()->set_properties(Status::RoguelikeDifficulty, "0");
|
||||
m_config->set_difficulty(0);
|
||||
ProcessTask(*this, { m_config->get_theme() + "@Roguelike@ExitThenAbandon" })
|
||||
.set_times_limit("Roguelike@Abandon", 0)
|
||||
.run();
|
||||
|
||||
Reference in New Issue
Block a user