Skip to content

Feat: 刷理智添加使用备选关卡 - #84

Open
iispig1919 wants to merge 2 commits into
MaaAssistantArknights:masterfrom
iispig1919:feature/alternate-stage
Open

Feat: 刷理智添加使用备选关卡#84
iispig1919 wants to merge 2 commits into
MaaAssistantArknights:masterfrom
iispig1919:feature/alternate-stage

Conversation

@iispig1919

@iispig1919 iispig1919 commented Mar 19, 2026

Copy link
Copy Markdown
  • 再刷理智的设置里添加使用备选关卡的可选项
  • 添加了CoreParams结构体,仅向 MAA Core发送必要的字段
  • 添加了isStageOpenToday(),包含已知资源关卡的开放日期
  • 添加了FightSettingsView 的关卡规划用户界面:支持添加/删除关卡、显示开放状态指示器
  • 添加了LegacyConfigurations 迁移逻辑,为新字段添加默认值
    *用AI跑的,做得烂的话就close吧,希望能添加此功能

由 Sourcery 提供的总结

为战斗任务新增可选的多关卡规划功能,包含界面支持和按日期感知的关卡选择;精简发送给 MAA Core 的参数;并将现有配置迁移到新格式。

新功能:

  • 允许为理智刷图配置多个后备关卡,并自动选择今天开放的第一个关卡
  • 在战斗设置中新增关卡规划界面,用于管理多个关卡,包括新增/删除控件与开放状态指示

增强优化:

  • 为战斗任务引入专用的 CoreParams 负载,以限制发送到 MAA Core 服务的字段
  • 为每个关卡新增开放日元数据及辅助逻辑,用于判断关卡今天是否开放
  • 扩展旧版配置迁移逻辑,以合理的默认值初始化新的关卡规划字段
Original summary in English

Summary by Sourcery

Add optional multi-stage planning for fight tasks with UI support and date-aware stage selection, refine the parameters sent to MAA Core, and migrate existing configurations to the new format.

New Features:

  • Allow configuring multiple fallback stages for sanity farming and automatically select the first stage that is open today
  • Add a stage planning UI in fight settings to manage multiple stages, including add/remove controls and open-status indicators

Enhancements:

  • Introduce a dedicated CoreParams payload for fight tasks to limit fields sent to the MAA Core service
  • Add per-stage open-day metadata and helper logic to determine whether a stage is open today
  • Extend legacy configuration migration to initialize the new stage planning fields with sensible defaults

- Add useOptionalStage toggle and stagePlan list to FightConfiguration
- Add CoreParams struct to send only required fields to MAA Core
- Add isStageOpenToday() with known resource stage open days (CE-6/AP-5/CA-5/SK-5 and chip stages)
- Update FightSettingsView with stage plan UI: add/remove stages, open status indicator
- Update LegacyConfigurations migration with default values for new fields

Made-with: Cursor

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出一些高层次的反馈:

  • 在对 config.stagePlanForEach 时,你使用了 enumerated() 进行迭代,同时又使用 remove(at:) 修改数组,这在 SwiftUI 中很容易导致索引/绑定不匹配;建议改为遍历 config.stagePlan.indices(或者使用可标识的包装类型),这样在删除行时可以保持索引稳定。
  • 在可选关卡行的 UI 中,每一行都会多次调用 FightConfiguration.isStageOpenToday(stageName)(用于图片、颜色和帮助文案);可以在 HStack 中把结果缓存在一个局部变量里,从而简化代码并避免重复计算。
给 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- Inside the `ForEach` over `config.stagePlan`, you’re iterating with `enumerated()` and also mutating the array with `remove(at:)`, which can easily lead to index/binding mismatches in SwiftUI; consider iterating over `config.stagePlan.indices` (or an identifiable wrapper) to keep indices stable when removing rows.
- In the optional-stage row UI, `FightConfiguration.isStageOpenToday(stageName)` is called multiple times per row (for image, color, and help text); caching the result in a local variable in the `HStack` would simplify the code and avoid redundant work.

Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,请考虑分享给更多人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • Inside the ForEach over config.stagePlan, you’re iterating with enumerated() and also mutating the array with remove(at:), which can easily lead to index/binding mismatches in SwiftUI; consider iterating over config.stagePlan.indices (or an identifiable wrapper) to keep indices stable when removing rows.
  • In the optional-stage row UI, FightConfiguration.isStageOpenToday(stageName) is called multiple times per row (for image, color, and help text); caching the result in a local variable in the HStack would simplify the code and avoid redundant work.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Inside the `ForEach` over `config.stagePlan`, you’re iterating with `enumerated()` and also mutating the array with `remove(at:)`, which can easily lead to index/binding mismatches in SwiftUI; consider iterating over `config.stagePlan.indices` (or an identifiable wrapper) to keep indices stable when removing rows.
- In the optional-stage row UI, `FightConfiguration.isStageOpenToday(stageName)` is called multiple times per row (for image, color, and help text); caching the result in a local variable in the `HStack` would simplify the code and avoid redundant work.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant