1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 14:09:25 +08:00

add: keep 1 level white flagship when auto retire

This commit is contained in:
0O0o0oOoO00
2026-03-20 22:50:36 +08:00
parent 289652382a
commit b777b9656d
15 changed files with 77 additions and 0 deletions

View File

@@ -361,6 +361,10 @@ void Cracker::disable_skip_enter_battle() {
restore_combat_delay_active();
}
void Cracker::set_white_flagship_keep_count(int ships) {
m_keep_white_flagship_number.store(ships);
}
void Cracker::enable_auto_retire() {
ENABLE(AUTO_RETIRE);
}
@@ -1750,6 +1754,13 @@ Lua::Table Cracker::filter_ship(sol::this_state& l, Lua::VariadicArgs& args) {
}
});
int white_flagship_to_keep = 0;
int keep_white_flagship_number = m_keep_white_flagship_number.load();
auto is_white_flagship = [](int configId) {
return configId == 107041 || configId == 106021 || configId == 107011 || configId == 206011;
};
auto filter = [&](sol::this_state, Lua::Object value) {
Lua::Table ship = value;
@@ -1787,6 +1798,19 @@ Lua::Table Cracker::filter_ship(sol::this_state& l, Lua::VariadicArgs& args) {
return false;
}
}
if (keep_white_flagship_number != 0) {
if (is_white_flagship(configId)) {
int level = ship["level"];
if (level == 1) {
if (white_flagship_to_keep < keep_white_flagship_number) {
white_flagship_to_keep++;
return false;
}
}
}
}
return true;
};
@@ -1938,6 +1962,7 @@ Cracker::Config Cracker::get_config() {
.exercise_more_power_rate = static_cast<int>(m_exercise_more_power_rate.load() * 100),
.better_global_speedup_rate = static_cast<int>(m_better_global_speedup_rate.load()),
.chapter_auto_clear_step_interval = m_mover.interval.load(),
.white_flagship_keep_count = m_keep_white_flagship_number.load(),
};
return config;
}
@@ -1964,6 +1989,7 @@ void Cracker::apply_config(Config& config) {
}
if(IS_CONFIG_ENABLED(AUTO_RETIRE)) {
set_white_flagship_keep_count(config.white_flagship_keep_count);
enable_auto_retire();
} else {
disable_auto_retire();