feat: 增加肉鸽刷开局模式下只凹精二选项 (#7705)

feat: 增加肉鸽刷开局模式下只凹精二选项
This commit is contained in:
Sherkey
2024-01-08 00:26:32 +08:00
committed by GitHub
15 changed files with 62 additions and 13 deletions

View File

@@ -214,7 +214,7 @@ AsstTaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const cha
// 1 - 刷源石锭,第一层投资完就退出
// 2 - 【即将弃用】两者兼顾,投资过后再退出,没有投资就继续往后打
// 3 - 开发中...
// 4 - 烧热水,到达第三层后直接退出
// 4 - 刷开局,到达第三层后直接退出
"starts_count": int, // 开始探索 次数,可选,默认 INT_MAX。达到后自动停止任务
"investment_enabled": bool, // 是否投资源石锭,默认开
"investments_count": int,
@@ -224,6 +224,8 @@ AsstTaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const cha
"squad": string, // 开局分队,可选,例如 "突击战术分队" 等,默认 "指挥分队"
"roles": string, // 开局职业组,可选,例如 "先手必胜" 等,默认 "取长补短"
"core_char": string, // 开局干员名,可选,仅支持单个干员中!文!名!。默认识别练度自动选择
"start_with_elite_two": bool // 是否在刷开局模式下凹开局干员精二直升,可选,默认 false
"only_start_with_elite_two": bool // 是否只凹开局干员精二直升且不进行作战,可选,默认 falsestart_with_elite_two为true时有效
"use_support": bool, // 开局干员是否为助战干员,可选,默认 false
"use_nonfriend_support": bool, // 是否可以是非好友助战干员,可选,默认 falseuse_support为true时有效
"refresh_trader_with_dice": bool // 是否用骰子刷新商店购买特殊商品,目前支持水月肉鸽的指路鳞,可选,默认 false

View File

@@ -95,6 +95,7 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
m_roguelike_config_ptr->set_difficulty(0);
// 是否凹指定干员开局直升
m_roguelike_config_ptr->set_start_with_elite_two(params.get("start_with_elite_two", false));
m_roguelike_config_ptr->set_only_start_with_elite_two(params.get("only_start_with_elite_two", false));
// 设置层数选点策略,相关逻辑在 RoguelikeStrategyChangeTaskPlugin
{

View File

@@ -12,7 +12,7 @@ namespace asst
Investment = 1, // 1 - 刷源石锭,第一层投资完就退出,不期而遇采用保守策略
// 2 - 【已移除】两者兼顾,投资过后再退出,没有投资就继续往后打
// 3 - 尝试通关激进策略TODO
Collectible = 4, // 4 - 刷开局藏品,以获得热水壶或者演讲稿开局,不期而遇采用保守策略
Collectible = 4, // 4 - 刷开局,以获得热水壶或者演讲稿开局或只凹直升,不期而遇采用保守策略
};
class RoguelikeTheme
@@ -53,12 +53,15 @@ namespace asst
int get_difficulty() { return m_difficulty; }
void set_start_with_elite_two(bool start_with_elite_two) { m_start_with_elite_two = start_with_elite_two; }
bool get_start_with_elite_two() { return m_start_with_elite_two; }
void set_only_start_with_elite_two(bool only_start_with_elite_two) { m_only_start_with_elite_two = only_start_with_elite_two; }
bool get_only_start_with_elite_two() { return m_only_start_with_elite_two; }
private:
std::string m_theme; // 肉鸽主题
RoguelikeMode m_mode = RoguelikeMode::Exp;
int m_difficulty = 0;
bool m_start_with_elite_two = false;
bool m_only_start_with_elite_two = false;
/* 以下为每次重置 */
public:

View File

@@ -37,7 +37,9 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::_run()
// 当前难度
int difficulty = m_config->get_difficulty();
if (m_config->get_theme() != RoguelikeTheme::Phantom && mode == RoguelikeMode::Collectible) {
// 是否只凹直升
bool only_start_with_elite_two = m_config->get_only_start_with_elite_two();
if (m_config->get_theme() != RoguelikeTheme::Phantom && mode == RoguelikeMode::Collectible && !only_start_with_elite_two) {
if (difficulty == INT_MAX) {
ProcessTask(*this, { m_config->get_theme() + "@Roguelike@ChooseDifficulty_Hardest" }).run();
}

View File

@@ -429,6 +429,7 @@ bool asst::RoguelikeRecruitTaskPlugin::recruit_appointed_char(const std::string&
int i = 0;
// 是否凹直升
bool start_with_elite_two = m_config->get_start_with_elite_two();
bool only_start_with_elite_two = m_config->get_only_start_with_elite_two();
// 当前肉鸽难度
int difficulty = m_config->get_difficulty();
@@ -453,14 +454,16 @@ bool asst::RoguelikeRecruitTaskPlugin::recruit_appointed_char(const std::string&
Log.info(__FUNCTION__, "| Oper list:", oper_names);
if (it != chars.cend()) {
// 需要凹直升且当前为max难度时
if (start_with_elite_two && difficulty == INT_MAX) {
// 需要凹直升且当前为max难度或者只凹直升
if (start_with_elite_two && (difficulty == INT_MAX || only_start_with_elite_two)) {
if (it->elite == 2) {
m_task_ptr->set_enable(false);
}
else {
// 重置难度并放弃
m_config->set_difficulty(0);
// 非只凹直升时重置难度并放弃
if (!only_start_with_elite_two) {
m_config->set_difficulty(0);
}
ProcessTask(*this, { m_config->get_theme() + "@Roguelike@ExitThenAbandon" })
.set_times_limit("Roguelike@Abandon", 0)
.run();

View File

@@ -103,6 +103,7 @@ namespace MaaWpfGui.Constants
public const string RoguelikeRoles = "Roguelike.Roles";
public const string RoguelikeCoreChar = "Roguelike.CoreChar";
public const string RoguelikeStartWithEliteTwo = "Roguelike.RoguelikeStartWithEliteTwo";
public const string RoguelikeOnlyStartWithEliteTwo = "Roguelike.RoguelikeOnlyStartWithEliteTwo";
public const string RoguelikeUseSupportUnit = "Roguelike.RoguelikeUseSupportUnit";
public const string RoguelikeEnableNonfriendSupport = "Roguelike.RoguelikeEnableNonfriendSupport";
public const string RoguelikeDelayAbortUntilCombatComplete = "Roguelike.RoguelikeDelayAbortUntilCombatComplete";

View File

@@ -1972,13 +1972,14 @@ namespace MaaWpfGui.Main
/// <param name="roles"><paramref name="roles"/> TODO.</param>
/// <param name="coreChar"><paramref name="coreChar"/> TODO.</param>
/// <param name="startWithEliteTwo">是否凹开局直升</param>
/// <param name="onlyStartWithEliteTwo">是否只凹开局直升,不进行作战</param>
/// <param name="useSupport">是否core_char使用好友助战</param>
/// <param name="enableNonFriendSupport">是否允许使用非好友助战</param>
/// <param name="theme">肉鸽名字。["Phantom", "Mizuki", "Sami"]</param>
/// <param name="refreshTraderWithDice">是否用骰子刷新商店购买特殊商品,目前支持水月肉鸽的指路鳞</param>
/// <returns>是否成功。</returns>
public bool AsstAppendRoguelike(int mode, int starts, bool investmentEnabled, bool investmentEnterSecondFloor, int invests, bool stopWhenFull,
string squad, string roles, string coreChar, bool startWithEliteTwo, bool useSupport, bool enableNonFriendSupport, string theme, bool refreshTraderWithDice)
string squad, string roles, string coreChar, bool startWithEliteTwo, bool onlyStartWithEliteTwo, bool useSupport, bool enableNonFriendSupport, string theme, bool refreshTraderWithDice)
{
var taskParams = new JObject
{
@@ -2011,7 +2012,8 @@ namespace MaaWpfGui.Main
taskParams["core_char"] = coreChar;
}
taskParams["start_with_elite_two"] = startWithEliteTwo;
taskParams["start_with_elite_two"] = mode == 4 && theme != "Phantom" && startWithEliteTwo;
taskParams["only_start_with_elite_two"] = mode == 4 && theme != "Phantom" && startWithEliteTwo && onlyStartWithEliteTwo;
taskParams["use_support"] = useSupport;
taskParams["use_nonfriend_support"] = enableNonFriendSupport;
taskParams["refresh_trader_with_dice"] = theme == "Mizuki" && refreshTraderWithDice;

View File

@@ -108,6 +108,7 @@
<system:String x:Key="StartingCoreChar">Starting Operator (CN name only)</system:String>
<system:String x:Key="StartingCoreCharTip">Only supports the CN name of a single operator, default if not filled.</system:String>
<system:String x:Key="RoguelikeStartWithEliteTwo">Repeat for「Starting Operator」Elite 2</system:String>
<system:String x:Key="RoguelikeOnlyStartWithEliteTwo">Only Repeat for「Starting Operator」Elite 2, No Battle</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">Select 「Starting Operator」 from support unit list</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">Enable non-friend support</system:String>
<system:String x:Key="RoguelikeDelayAbortUntilCombatComplete">Stops after clearing the combat</system:String>

View File

@@ -108,6 +108,7 @@
<system:String x:Key="StartingCoreChar">最初のオペレーター(一人だけ、中国名のみを入力可能)</system:String>
<system:String x:Key="StartingCoreCharTip">一人のオペレーターの中国名のみをサポートします。入力されていない場合はデフォルトになります。</system:String>
<system:String x:Key="RoguelikeStartWithEliteTwo">「最初のオペレーター」直接昇進</system:String>
<system:String x:Key="RoguelikeOnlyStartWithEliteTwo">指定オペレーターの昇進招集までリセマラし、戦闘を行わない</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">「最初のオペレーター」をサポートから選択</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">フレンド以外のサポートの使用を許可</system:String>
<system:String x:Key="RoguelikeDelayAbortUntilCombatComplete">戦闘クリアで止まる</system:String>

View File

@@ -108,6 +108,7 @@
<system:String x:Key="StartingCoreChar">시작 오퍼레이터 (1명)</system:String>
<system:String x:Key="StartingCoreCharTip">단일 오퍼레이터의 중국어 이름만 지원하며, 입력하지 않으면 기본값이 선택됩니다.</system:String>
<system:String x:Key="RoguelikeStartWithEliteTwo">시초 에 간부 가 직진 하다</system:String>
<system:String x:Key="RoguelikeOnlyStartWithEliteTwo">오로지 시초 오퍼레이터의 직진만을 요구하고 전투를 진행하지 않음</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">시작 오퍼레이터로 지원 유닛 사용</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">친구가 아니어도 지원 유닛 사용</system:String>
<system:String x:Key="RoguelikeDelayAbortUntilCombatComplete">전투 클리어 후 정지</system:String>

View File

@@ -102,12 +102,13 @@
<system:String x:Key="InfrastThresholdTip">若启用自定义换班,该字段仅针对 autofill 和使用干员编组的房间有效</system:String>
<system:String x:Key="RoguelikeStrategyExp">刷等级,尽可能稳定地打更多层数</system:String>
<system:String x:Key="RoguelikeStrategyGold">刷源石锭,到达第二层后直接退出</system:String>
<system:String x:Key="RoguelikeLastReward">烧热水,到达第三层后直接退出</system:String>
<system:String x:Key="RoguelikeLastReward">刷开局,刷取热水壶或精二干员开局</system:String>
<system:String x:Key="StartingSquad">开局分队</system:String>
<system:String x:Key="StartingRoles">开局职业组</system:String>
<system:String x:Key="StartingCoreChar">开局干员 (单个)</system:String>
<system:String x:Key="StartingCoreCharTip">仅支持单个干员中文名,不填写则默认选择。</system:String>
<system:String x:Key="RoguelikeStartWithEliteTwo">凹「开局干员」直升精二</system:String>
<system:String x:Key="RoguelikeOnlyStartWithEliteTwo">只凹「开局干员」直升精二,不进行作战</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">「开局干员」使用助战</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">可以使用非好友助战</system:String>
<system:String x:Key="RoguelikeDelayAbortUntilCombatComplete">在战斗结束前延迟「停止」动作</system:String>

View File

@@ -102,12 +102,13 @@
<system:String x:Key="InfrastThresholdTip">若啟用自定義換班,該欄位僅針對 autofill 和 幹員編組 的房間有效</system:String>
<system:String x:Key="RoguelikeStrategyExp">刷等級,盡可能穩定地打更多層數</system:String>
<system:String x:Key="RoguelikeStrategyGold">刷源石錠,到達第二層後直接退出</system:String>
<system:String x:Key="RoguelikeLastReward">燒熱水,到達第三層後直接退出</system:String>
<system:String x:Key="RoguelikeLastReward">刷開局,刷取熱水壺或精二幹員開局</system:String>
<system:String x:Key="StartingSquad">開局分隊</system:String>
<system:String x:Key="StartingRoles">開局職業組</system:String>
<system:String x:Key="StartingCoreChar">開局幹員(單個)</system:String>
<system:String x:Key="StartingCoreCharTip">僅支持單個幹員中文名,不填寫則預設選擇。</system:String>
<system:String x:Key="RoguelikeStartWithEliteTwo">凹「開局幹員」直升精二</system:String>
<system:String x:Key="RoguelikeOnlyStartWithEliteTwo">只凹「開局幹員」直升精二,不進行作戰</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">「開局幹員」使用助戰</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">可以使用非好友助戰</system:String>
<system:String x:Key="RoguelikeDelayAbortUntilCombatComplete">中止行為等待至當前戰鬥結束後</system:String>

View File

@@ -1908,7 +1908,7 @@ namespace MaaWpfGui.ViewModels.UI
private string _roguelikeStartWithEliteTwo = ConfigurationHelper.GetValue(ConfigurationKeys.RoguelikeStartWithEliteTwo, false.ToString());
/// <summary>
/// Gets or sets a value indicating whether use support unit.
/// Gets or sets a value indicating whether core char need start with elite two.
/// </summary>
public bool RoguelikeStartWithEliteTwo
{
@@ -1920,11 +1920,31 @@ namespace MaaWpfGui.ViewModels.UI
RoguelikeUseSupportUnit = false;
}
if (!value && RoguelikeOnlyStartWithEliteTwo)
{
RoguelikeOnlyStartWithEliteTwo = false;
}
SetAndNotify(ref _roguelikeStartWithEliteTwo, value.ToString());
ConfigurationHelper.SetValue(ConfigurationKeys.RoguelikeStartWithEliteTwo, value.ToString());
}
}
private string _roguelikeOnlyStartWithEliteTwo = ConfigurationHelper.GetValue(ConfigurationKeys.RoguelikeOnlyStartWithEliteTwo, false.ToString());
/// <summary>
/// Gets or sets a value indicating whether only need with elite two's core char.
/// </summary>
public bool RoguelikeOnlyStartWithEliteTwo
{
get => bool.Parse(_roguelikeOnlyStartWithEliteTwo);
set
{
SetAndNotify(ref _roguelikeOnlyStartWithEliteTwo, value.ToString());
ConfigurationHelper.SetValue(ConfigurationKeys.RoguelikeOnlyStartWithEliteTwo, value.ToString());
}
}
private string _roguelikeUseSupportUnit = ConfigurationHelper.GetValue(ConfigurationKeys.RoguelikeUseSupportUnit, false.ToString());
/// <summary>

View File

@@ -1350,7 +1350,7 @@ namespace MaaWpfGui.ViewModels.UI
mode, Instances.SettingsViewModel.RoguelikeStartsCount,
Instances.SettingsViewModel.RoguelikeInvestmentEnabled, Instances.SettingsViewModel.RoguelikeInvestmentEnterSecondFloor, Instances.SettingsViewModel.RoguelikeInvestsCount, Instances.SettingsViewModel.RoguelikeStopWhenInvestmentFull,
Instances.SettingsViewModel.RoguelikeSquad, Instances.SettingsViewModel.RoguelikeRoles, Instances.SettingsViewModel.RoguelikeCoreChar,
Instances.SettingsViewModel.RoguelikeStartWithEliteTwo, Instances.SettingsViewModel.RoguelikeUseSupportUnit,
Instances.SettingsViewModel.RoguelikeStartWithEliteTwo, Instances.SettingsViewModel.RoguelikeOnlyStartWithEliteTwo, Instances.SettingsViewModel.RoguelikeUseSupportUnit,
Instances.SettingsViewModel.RoguelikeEnableNonfriendSupport, Instances.SettingsViewModel.RoguelikeTheme, Instances.SettingsViewModel.RoguelikeRefreshTraderWithDice);
}

View File

@@ -132,6 +132,16 @@
Text="{DynamicResource RoguelikeStartWithEliteTwo}"
TextWrapping="Wrap" />
</CheckBox>
<CheckBox
Margin="0,10"
IsChecked="{Binding RoguelikeOnlyStartWithEliteTwo}"
IsEnabled="{Binding RoguelikeStartWithEliteTwo}"
Visibility="{c:Binding 'RoguelikeMode == &quot;4&quot; and RoguelikeTheme != &quot;Phantom&quot;'}">
<TextBlock
Block.TextAlignment="Left"
Text="{DynamicResource RoguelikeOnlyStartWithEliteTwo}"
TextWrapping="Wrap" />
</CheckBox>
<CheckBox Margin="0,10" IsChecked="{Binding RoguelikeUseSupportUnit}">
<TextBlock
Block.TextAlignment="Left"