Skip to content

fix: matrix screening to skip high purity items#1703

Merged
MistEO merged 4 commits intov2from
fix/essence
Mar 29, 2026
Merged

fix: matrix screening to skip high purity items#1703
MistEO merged 4 commits intov2from
fix/essence

Conversation

@Joe-Bao
Copy link
Copy Markdown
Contributor

@Joe-Bao Joe-Bao commented Mar 29, 2026

close #1701

由 Sourcery 提供的摘要

在背包扫描和战后流程中强制执行精华阶级选择,这样在“仅完美 (flawless-only)”和“仅纯净 (pure-only)”的运行中,一旦遇到更高阶或不匹配阶级的物品,就会停止或跳过这些物品。

新功能:

  • 为精华过滤运行添加精华阶级模式,用于表示“仅完美”、“仅纯净”或同时支持这两种阶级。
  • 引入战后阶级门控逻辑,根据当前精华模式和检测到的物品阶级来分流管线流程。

错误修复:

  • 在“仅完美”模式下,一旦检测到纯净精华就停止背包扫描,避免继续处理本应被跳过的高阶物品。
  • 确保障后物品处理遵从“仅完美”和“仅纯净”的选择,当物品阶级与所选模式不匹配时会退出或跳过。

改进项:

  • 在精华过滤运行中跟踪阶级边界状态,并调整行迭代逻辑,以在达到边界后跳过不必要的扫描。
  • 扩展初始化、运行时状态、注册和管线/配置的连接,以支持感知精华阶级的行为,并在触及阶级边界时向用户发出通知。
Original summary in English

Summary by Sourcery

为本源过滤添加按阶层感知的处理逻辑,在遇到非预期的本源阶层时停止或跳过处理,包括战后流程。

New Features:

  • 引入 EssenceMode 配置,用于表示仅完美(flawless-only)、仅纯净(pure-only)或混合(mixed)的本源选择,并将其持久化到运行状态中。
  • 使用按本源阶层分流的专用动作来控制战后物品处理,根据 EssenceMode 路由到对应阶层的提示或继续执行后续处理。

Enhancements:

  • 在仅完美本源的库存扫描中检测阶层边界,一旦发现纯净本源物品即停止后续行处理,并显示边界提示。
  • 在运行状态中记录阶层边界状态,并在行迭代流程中根据该状态跳过边界之后的扫描。
  • 注册新的战后阶层门控自定义动作,并将其集成进本源过滤流水线中。
Original summary in English

Summary by Sourcery

Add tier-aware handling to essence filtering to stop or skip processing when encountering unintended essence tiers, including after-battle flows.

New Features:

  • Introduce an EssenceMode configuration to represent flawless-only, pure-only, or mixed essence selection and persist it in run state.
  • Gate after-battle item handling by essence tier with a dedicated action that routes to tier-specific notices or continues processing based on EssenceMode.

Enhancements:

  • Detect tier boundaries during flawless-only inventory scanning to stop further row processing once pure essence items are found and show a boundary notice.
  • Track tier-boundary state in the run state and adjust row iteration flow to skip remaining scanning when the boundary has been reached.
  • Register the new after-battle tier gate custom action and integrate it into the essence filter pipeline.

@Joe-Bao Joe-Bao marked this pull request as ready for review March 29, 2026 13:21
Copilot AI review requested due to automatic review settings March 29, 2026 13:21
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我发现了 1 个问题,并给出了一些整体性的反馈:

  • EssenceFilterInitAction.Run 中,当 FlawlessEssencePureEssence 都没有设置时,EssenceMode 会默认成 EssenceModePureOnly;建议从 EssenceTypes 派生出 EssenceMode,或者在两者都为 false 或被省略时回退到 EssenceModeBoth,以避免出现让人意外的行为。
  • EssenceFilterAfterBattleTierGateAction.Run 中,JSON 反序列化错误以及未预期的 tier 值实际上被忽略了;建议对 params.Tier 做校验,并在输入格式异常时记录日志或提前返回,以便更容易发现配置错误。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `EssenceFilterInitAction.Run`, `EssenceMode` defaults to `EssenceModePureOnly` when neither `FlawlessEssence` nor `PureEssence` is set; consider deriving `EssenceMode` from `EssenceTypes` or falling back to `EssenceModeBoth` to avoid surprising behavior when both options are false or omitted.
- In `EssenceFilterAfterBattleTierGateAction.Run`, JSON unmarshalling and unexpected `tier` values are effectively ignored; consider validating `params.Tier` and logging or short-circuiting on malformed input to make misconfigurations easier to detect.

## Individual Comments

### Comment 1
<location path="agent/go-service/essencefilter/state.go" line_range="52-54" />
<code_context>

 	// Essence types selected for this run (e.g. Flawless, Pure)
 	EssenceTypes []EssenceMeta
+	// EssenceMode derived from selection: flawless_only / pure_only / both
+	EssenceMode EssenceMode
+	// EncounteredTierBoundary is set when flawless-only mode encounters pure (inventory scan should stop)
+	EncounteredTierBoundary bool

</code_context>
<issue_to_address>
**suggestion (bug_risk):** EssenceMode is not reset in Reset, which can cause stale mode if Reset is reused outside Init

If `RunState.Reset()` is called on a reused state outside `EssenceFilterInit`, the previous run’s `EssenceMode` will be reused. To make `RunState` safer to use, `Reset` should initialize `EssenceMode` to a known default (e.g., `EssenceModeBoth`), with `Init` always overriding it as needed.

Suggested implementation:

```golang
	s.EssenceMode = EssenceModeBoth
	s.PhysicalItemCount = 0

```

This assumes:

1. `EssenceModeBoth` is the neutral/default mode constant already defined for `EssenceMode`.
2. The snippet shown (`s.PhysicalItemCount = 0`) is inside `func (s *RunState) Reset()`.

If `EssenceModeBoth` does not exist yet, you should define it in the `EssenceMode` enum/type definition (e.g., `const EssenceModeBoth EssenceMode = iota`) and ensure `EssenceFilterInit` keeps explicitly setting `EssenceMode` as appropriate for the run.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • In EssenceFilterInitAction.Run, EssenceMode defaults to EssenceModePureOnly when neither FlawlessEssence nor PureEssence is set; consider deriving EssenceMode from EssenceTypes or falling back to EssenceModeBoth to avoid surprising behavior when both options are false or omitted.
  • In EssenceFilterAfterBattleTierGateAction.Run, JSON unmarshalling and unexpected tier values are effectively ignored; consider validating params.Tier and logging or short-circuiting on malformed input to make misconfigurations easier to detect.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `EssenceFilterInitAction.Run`, `EssenceMode` defaults to `EssenceModePureOnly` when neither `FlawlessEssence` nor `PureEssence` is set; consider deriving `EssenceMode` from `EssenceTypes` or falling back to `EssenceModeBoth` to avoid surprising behavior when both options are false or omitted.
- In `EssenceFilterAfterBattleTierGateAction.Run`, JSON unmarshalling and unexpected `tier` values are effectively ignored; consider validating `params.Tier` and logging or short-circuiting on malformed input to make misconfigurations easier to detect.

## Individual Comments

### Comment 1
<location path="agent/go-service/essencefilter/state.go" line_range="52-54" />
<code_context>

 	// Essence types selected for this run (e.g. Flawless, Pure)
 	EssenceTypes []EssenceMeta
+	// EssenceMode derived from selection: flawless_only / pure_only / both
+	EssenceMode EssenceMode
+	// EncounteredTierBoundary is set when flawless-only mode encounters pure (inventory scan should stop)
+	EncounteredTierBoundary bool

</code_context>
<issue_to_address>
**suggestion (bug_risk):** EssenceMode is not reset in Reset, which can cause stale mode if Reset is reused outside Init

If `RunState.Reset()` is called on a reused state outside `EssenceFilterInit`, the previous run’s `EssenceMode` will be reused. To make `RunState` safer to use, `Reset` should initialize `EssenceMode` to a known default (e.g., `EssenceModeBoth`), with `Init` always overriding it as needed.

Suggested implementation:

```golang
	s.EssenceMode = EssenceModeBoth
	s.PhysicalItemCount = 0

```

This assumes:

1. `EssenceModeBoth` is the neutral/default mode constant already defined for `EssenceMode`.
2. The snippet shown (`s.PhysicalItemCount = 0`) is inside `func (s *RunState) Reset()`.

If `EssenceModeBoth` does not exist yet, you should define it in the `EssenceMode` enum/type definition (e.g., `const EssenceModeBoth EssenceMode = iota`) and ensure `EssenceFilterInit` keeps explicitly setting `EssenceMode` as appropriate for the run.
</issue_to_address>

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.

Comment on lines +52 to +54
// EssenceMode derived from selection: flawless_only / pure_only / both
EssenceMode EssenceMode
// EncounteredTierBoundary is set when flawless-only mode encounters pure (inventory scan should stop)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (bug_risk): EssenceMode 在 Reset 中没有被重置,如果在 Init 之外复用 Reset,可能会导致模式是过期的

如果在 EssenceFilterInit 之外,对一个被复用的状态调用 RunState.Reset(),之前那次执行的 EssenceMode 会被沿用。为了让 RunState 使用起来更安全,Reset 应该把 EssenceMode 初始化为一个已知的默认值(例如 EssenceModeBoth),并让 Init 在需要时总是覆盖它。

建议的实现:

	s.EssenceMode = EssenceModeBoth
	s.PhysicalItemCount = 0

这里假设:

  1. EssenceModeBoth 是已经为 EssenceMode 定义好的中性/默认模式常量。
  2. 展示的代码片段(s.PhysicalItemCount = 0)位于 func (s *RunState) Reset() 内部。

如果目前还不存在 EssenceModeBoth,你应该在 EssenceMode 的枚举/类型定义中把它定义出来(例如 const EssenceModeBoth EssenceMode = iota),并确保 EssenceFilterInit 继续显式设置本次运行所需的 EssenceMode

Original comment in English

suggestion (bug_risk): EssenceMode is not reset in Reset, which can cause stale mode if Reset is reused outside Init

If RunState.Reset() is called on a reused state outside EssenceFilterInit, the previous run’s EssenceMode will be reused. To make RunState safer to use, Reset should initialize EssenceMode to a known default (e.g., EssenceModeBoth), with Init always overriding it as needed.

Suggested implementation:

	s.EssenceMode = EssenceModeBoth
	s.PhysicalItemCount = 0

This assumes:

  1. EssenceModeBoth is the neutral/default mode constant already defined for EssenceMode.
  2. The snippet shown (s.PhysicalItemCount = 0) is inside func (s *RunState) Reset().

If EssenceModeBoth does not exist yet, you should define it in the EssenceMode enum/type definition (e.g., const EssenceModeBoth EssenceMode = iota) and ensure EssenceFilterInit keeps explicitly setting EssenceMode as appropriate for the run.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 针对 Issue #1701,修复“仅筛选无暇基质时,在无暇筛完后仍继续运行”的问题:当检测到基质层级分界(开始出现高纯)时,提前结束背包扫描;并在战后筛选流程中根据当前筛选模式对不同 tier 做跳过/退出处理。

Changes:

  • 新增 EssenceMode(无暇仅/高纯仅/两者)并在初始化时派生写入运行态。
  • 背包行收集阶段增加“无暇-only 遇到高纯即触发分界停止”逻辑,并在行遍历结束时根据分界状态提前结束流程。
  • 战后筛选管线新增 Tier Gate 节点与自定义 action,实现“无暇-only 遇到高纯退出 / 高纯-only 遇到无暇跳过”,并补齐多语言提示文案。

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
assets/resource/pipeline/EssenceFilter/EssenceFilterAfterBattleCheckItem.json 战后筛选增加 tier gate 与对应提示/退出/跳过节点
assets/resource/pipeline/EssenceFilter/EntryAndInit.json 增加背包扫描分界停止的提示节点
assets/locales/interface/zh_tw.json 增加分界停止/战后退出/战后跳过的提示文案
assets/locales/interface/zh_cn.json 同上(简中)
assets/locales/interface/ko_kr.json 同上(韩文)
assets/locales/interface/ja_jp.json 同上(日文)
assets/locales/interface/en_us.json 同上(英文)
agent/go-service/essencefilter/types.go 新增 EssenceMode 枚举用于描述本次筛选模式
agent/go-service/essencefilter/state.go RunState 增加 EssenceModeEncounteredTierBoundary 并在 Reset 中重置分界标记
agent/go-service/essencefilter/register.go 注册新的战后 TierGate 自定义 action
agent/go-service/essencefilter/actionsAfterBattle.go 实现 EssenceFilterAfterBattleTierGateAction 按模式决定跳过/退出/继续
agent/go-service/essencefilter/actions.go 初始化派生 EssenceMode;背包扫描行收集/行推进增加分界停止逻辑

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

@MistEO MistEO changed the title Fix: matrix screening to skip high purity items fix: matrix screening to skip high purity items Mar 29, 2026
@MistEO MistEO merged commit 95722dd into v2 Mar 29, 2026
18 checks passed
@MistEO MistEO deleted the fix/essence branch March 29, 2026 16:33
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