fix: 关闭同类型宝藏限制后同步扫描结果到 profiles.json - #194
Closed
yuelu-lan wants to merge 1 commit into
Closed
Conversation
…is disabled When same_type_treasure_limit_enabled is False, the _apply_same_type_treasure_limit() function returned early without populating _same_type_best_levels, causing the engine's sync loop to receive None levels. This left _weapon_essence_levels empty, so _on_scan_complete found 0 weapons and never called _sync_to_treasure_matrix(), meaning profiles.json was never updated. Now also updates _same_type_best_levels (with _level_cmp comparison to keep the highest) and _same_type_treasure_counts when limit is disabled. Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
jiubook
added a commit
to jiubook/EER-Ai
that referenced
this pull request
Aug 7, 2026
修复 issue Logical-Byte#195:关闭「同类型宝藏数量上限」后,扫描结果不再同步到 profiles.json。 根因:限制关闭时 _apply_same_type_treasure_limit 提前返回,只把匹配武器 加入 _updated_this_scan,但未写入 _same_type_best_levels,引擎同步循环 读到 None 等级,导致扫描后不落盘。原 PR Logical-Byte#194 的「全量写入」方案会为每把 匹配武器写入同一份数据,违背单武器分配语义,故改为复用按武器分配逻辑: - _apply_same_type_treasure_limit 限制关闭时改走 _apply_weapon_group_limit (每把武器上限 1 枚),套用用户设置的非降级原则过滤与留大弃小 - 留大弃小仅应用留大(更优替换并同步落盘),不应用弃小:认领耗尽或非降级 过滤后无可用武器时,通过新增的 exhausted_policy="keep" 保留原判定结果 (不标记养成材料、不落盘),修复日志先报「养成材料」再改口「保留」的矛盾 - keep_best 关闭时无等级比较,按武器优先级首枚锁定 前端设置页同步调整: - 非降级原则过滤、留大弃小、等级比较方式解除对「数量上限」总开关的禁用 依赖(等级比较方式仍依赖留大弃小开关),使关闭限制时用户可预设这些规则 - 更新相关提示文案,说明关闭限制后的分配与落盘行为 新增 7 个测试用例覆盖:单武器认领、多武器按优先级分配、留大升级与更差 保留、首枚锁定、认领耗尽保留、非降级过滤拦截/通过。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复内容
关闭「同类型宝藏限制」功能(
same_type_treasure_limit_enabled设为false)后,扫描基质不会更新profiles.json中的宝藏基质配置。关联 Issue: #195
根因
_apply_same_type_treasure_limit()在限制关闭时直接返回,只将武器 ID 加入_updated_this_scan,但未同步等级数据到_same_type_best_levels。引擎的同步循环读取到None等级,导致_weapon_essence_levels为空,_on_scan_complete发现 0 把武器后不会调用_sync_to_treasure_matrix(),最终profiles.json未更新。修改
_same_type_best_levels[weapon_id],使用_level_cmp对比保留最高等级_same_type_treasure_counts[weapon_id]测试
新增两个测试用例验证:
_same_type_best_levels和_same_type_treasure_counts正确更新