Skip to content

Conversation

@ninekirin
Copy link
Contributor

@ninekirin ninekirin commented May 13, 2025

implements automatic continuous combat for stages in the same area

仿照 WpfGui 实现自动战斗列表功能

image

主要变更:

  • 战斗列表功能(见 203ca9b
    • 支持自动导航、突袭,基本上是照着 WpfGui 那边来实现的,对 View 的改动比较大,原有的 CopilotContent 拆分成了 CopilotContent + CopilotList + RegularCopilotList
    • CopilotView 页增加添加到战斗列表的选项
    • 追踪执行 copilot 任务的回调主要在 MaaMessage 中实现
      • (一个想法)MAACore 在 TaskChainCompleted 后的回调中有 taskid,未来可以对已启用的 task 和添加到 MAACore 中的 task 进行 mapping,更精确的判断任务状态,目前考虑到战斗列表是顺序执行所以没有实现
  • 原有的 copilots 列表并不是在程序启动后预载,而是列表页面加载时从 copilot 和 recording 目录读取,没有持久化设计,导致每次切换都会重新读取目录;我做了一些变更,将大部分变量移动到 ViewModel(见 203ca9b
    • 里面有些地方我不太会处理双向数据绑定(
  • 新增一个 MapHelper 用于处理 stage_name 和 navigate_name 之间的关联关系(见 dd321d9
  • 给部分 Models 增加参数(见 5c96b19
  • 增加了 downloads 目录的只读权限,解决 .fileImporter 读取不了沙盒外文件的问题(我不确定这么做是否合适,亦或是使用startAccessingSecurityScopedResource更合适一些)(见 3e22c3b
  • 给部分 Xcode 中不能预览的文件增加 EnvironmentObject(见 adc1745, 364a969, 369b676
  • Typo(见95dc024)

目前已知会影响战斗列表的问题:

  • Mac 下的跳过剧情有概率不工作,导致中途卡在跳过剧情页

我之前没怎么接触过 Swift,实现里难免有不太到位的地方,如有不当之处还请大佬不吝指正(

@ChestnutLUO
Copy link
Contributor

ChestnutLUO commented May 14, 2025

UX角度几个建议:
页面默认显示单个作战(原先的界面)。
copilotlist 那个切换代码不要用.fill symbol切换,做成symbol着色感觉会直观一点。.symbolRenderingMode().foregroundStyle()

ninekirin added 3 commits May 15, 2025 00:45
- fixed the newly downloaded copilot file can not be selected automatically after switching back from the copilot list after downloading
- added onSubmit to accepts keyboard Enter input for prtsCode

- 修复了在战斗列表页面下载作业自动切回来之后不会选中新下载的作业的问题
- 神秘代码的 TextField 绑定 onSubmit,接受键盘 Enter 输入
removed MAAUseCopilotList persistence and show RegularCopilotList by default on startup

移除了 MAAUseCopilotList 的持久化,应用启动默认展示 RegularCopilotList
@Ir1d
Copy link

Ir1d commented May 19, 2025

我在尝试 "矢量突破自动战斗循环第一层",但好像这个 pr 还不太支持矢量突破,想请教一下这个矢量突破的导航需要改哪一部分 code 呢?

@ChestnutLUO
Copy link
Contributor

我在尝试 "矢量突破自动战斗循环第一层",但好像这个 pr 还不太支持矢量突破,想请教一下这个矢量突破的导航需要改哪一部分 code 呢?

具体哪里不支持?
显示“不支持的关卡”的话你要重新编译一下maa core

@Ir1d
Copy link

Ir1d commented May 19, 2025

maa core 是昨天编译的 main 应该是够新的,我是从这个界面启动
image
然后设置列表
image

此时如果启动列表,log 会停在 “开始任务:copilot”,并不进入关卡;而如果不在战斗列表页而是默认 copilot view 页面点启动是可以进入关卡正常完成一轮行动的 🥺 我的操作哪里有问题吗?如果没有的话,如何进一步 debug 毕竟好?

@Ir1d
Copy link

Ir1d commented May 19, 2025

感谢!on a side note.. 我在这里

case .regular(let innerConfig):
let binding = Binding<RegularCopilotConfiguration> {
innerConfig
} set: { newValue in
viewModel.copilot = .regular(newValue)
}
VStack {
HStack {
Toggle("自动编队", isOn: binding.formation)
Toggle("信赖干员", isOn: binding.add_trust)
}
Button(action: addToCopilotList) {
Label("添加到战斗列表", systemImage: "plus.rectangle.on.rectangle")
}
.buttonStyle(.borderedProminent)
if viewModel.copilotListConfig.items.contains(where: { $0.filename == innerConfig.filename }) {
Text("已添加到战斗列表")
.foregroundColor(.green)
} else {
Text("未添加到战斗列表")
.foregroundColor(.red)
}
}
HStack {
Text("循环次数")
TextField("1", value: binding.loop_times, format: .number)
}
.frame(maxWidth: 130)
加进去之后是可以实现矢量突破自动战斗循环第一层的,只是不知道为啥战斗列表不支持

@ninekirin
Copy link
Contributor Author

感谢!on a side note.. 我在这里

case .regular(let innerConfig):
let binding = Binding<RegularCopilotConfiguration> {
innerConfig
} set: { newValue in
viewModel.copilot = .regular(newValue)
}
VStack {
HStack {
Toggle("自动编队", isOn: binding.formation)
Toggle("信赖干员", isOn: binding.add_trust)
}
Button(action: addToCopilotList) {
Label("添加到战斗列表", systemImage: "plus.rectangle.on.rectangle")
}
.buttonStyle(.borderedProminent)
if viewModel.copilotListConfig.items.contains(where: { $0.filename == innerConfig.filename }) {
Text("已添加到战斗列表")
.foregroundColor(.green)
} else {
Text("未添加到战斗列表")
.foregroundColor(.red)
}
}


HStack {
Text("循环次数")
TextField("1", value: binding.loop_times, format: .number)
}
.frame(maxWidth: 130)

加进去之后是可以实现矢量突破自动战斗循环第一层的,只是不知道为啥战斗列表不支持

因为战斗列表给 MAACore 传的参数里面有一条 need_navigate: true,因此开始前 MAA 会试图寻找名为 "VEC-01" 的关卡,尚未在画面中识别到这个关卡的话会一直寻找,看日志就可以发现状态卡在了 FullStageNavigation。因此战斗列表只支持日常战斗,不支持保全和矢量突破这种特殊模式~

还是等 hg 大佬重构常规自动战斗之后加入循环次数的支持吧~

@Ir1d
Copy link

Ir1d commented May 19, 2025

哦哦 原来如此 感谢! 🥺 没事我上一条那样改一下已经可以循环 vec-01 了(躺平

@ninekirin
Copy link
Contributor Author

我在自动战斗配置页增加了追加自定干员的调用(见 8e4c88a),和 WpfGui 那边对齐了(

image

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.

3 participants