This repository was archived by the owner on Sep 20, 2026. It is now read-only.
feat(combat-insights): show realized periodic impact - #211
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the PostCombatImpact / Combat Insights pipeline to compute and display realized periodic-effect impact (Burn/Poison actual HP damage, Burn shield consumption, Regen realized healing) by replaying ordered CombatSim events with a versioned attribution model (periodic-impact-v6), then rendering the realized totals as a compact secondary line under the existing Burn/Poison/Regen rows.
Changes:
- Add a runtime periodic-effect attribution pass (
PeriodicEffectAttribution) and attach its results onto existing CombatImpact groups (CombatImpactProjector), including new model types inCombatImpactModels. - Update tooltip rendering to support a stacked “authoritative total + secondary realized impact” metric block and switch cloned TMP text overflow to
Overflowto avoid ellipsis truncation. - Add extensive unit tests plus a deterministic corpus runner + evidence snapshot infrastructure under
tests/PeriodicEffectAttribution.Corpus/.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/PostCombatImpact.Tests/PostCombatImpact.Tests.csproj | Links the new attribution model into the PostCombatImpact test project. |
| tests/PostCombatImpact.Tests/PeriodicEffectAttributionTests.cs | Adds focused goldens covering Burn/Poison/Regen pool booking, death-frame rules, ownership epochs, and formatter output. |
| tests/PeriodicEffectAttribution.Corpus/Program.cs | Adds an executable corpus runner that inventories/validates attribution and emits deterministic report + evidence snapshots. |
| tests/PeriodicEffectAttribution.Corpus/PeriodicEffectAttribution.Corpus.csproj | New exe project for the corpus runner. |
| tests/PeriodicEffectAttribution.Corpus/evidence/README.md | Documents how to regenerate deterministic evidence snapshots. |
| tests/PeriodicEffectAttribution.Corpus/CorpusInventory.cs | Implements the corpus inventory, reconciliation gates, and attribution/terminal diagnostics collection. |
| tests/PeriodicEffectAttribution.Corpus/ContractlessRunArtifact.cs | Adds a contractless bundle model for reading older/newer run bundle shapes. |
| src/BazaarPlusPlus/Patches/PostCombatImpact/NativePostCombatImpactTooltipView.cs | Renders periodic realized impact as a ruby-like secondary line and adjusts TMP overflow behavior. |
| src/BazaarPlusPlus/Game/PostCombatImpact/Data/PeriodicEffectAttribution.cs | Implements the periodic-impact-v6 attribution model (pool reconstruction + ownership allocation). |
| src/BazaarPlusPlus/Game/PostCombatImpact/Data/CombatImpactProjector.cs | Attaches periodic impacts into the aggregated combat impact report. |
| src/BazaarPlusPlus/Game/PostCombatImpact/Data/CombatImpactModels.cs | Adds periodic-impact model types (kind/proof/key/impact) and a nullable field on groups. |
| src/BazaarPlusPlus/Game/PostCombatImpact/Data/CombatImpactMetricFormatter.cs | Formats the secondary realized-impact string for tooltip rendering. |
| docs/drafts/2026-08-04-periodic-effect-attribution-goal.md | Adds/updates the goal ledger documenting the model contract, evidence, and iteration history. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+28
to
+36
| var corpusPath = | ||
| args.Length >= 1 ? args[0] : Environment.GetEnvironmentVariable(corpusEnvironmentVariable); | ||
| if (string.IsNullOrWhiteSpace(corpusPath)) | ||
| { | ||
| Console.WriteLine( | ||
| $"Periodic-effect corpus acceptance skipped; pass a path or set {corpusEnvironmentVariable}." | ||
| ); | ||
| return; | ||
| } |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Context
Combat Impact 过去只能展示 Burn、Poison、Regen 的施加次数/总量,无法回答这些持续效果最终实际造成了多少生命伤害、消耗了多少护盾,或真正恢复了多少生命。
本 PR 引入一套可回放、可对账的周期效果归因模型:从有序战斗事件中重建生命、护盾与效果来源三本账,将实际影响附加到原有 Burn / Poison / Regen 行,并把生产战斗语料、诊断结果与模型版本一并落盘,方便后续规则变化时继续迭代,而不是从零分析。
改动重点
periodic-impact-v6归因模型,统计:CardStats.RegenAdded;静态RegenApplyAmount只代表能力,不再被当作实际贡献。...;高度、底部留白和双行指标块按实际内容自适应。协作过程
sequenceDiagram participant U as 用户 participant C as Codex participant O as Claude Opus participant F as Claude Fable U->>C: Burn / Poison / Regen 同行展示实际影响 C->>C: 建立生命、护盾、来源三本账 U-->>C: 修正新版 Burn / Shield / Poison 规则 C->>O: Red-team 归因与终局边界 O-->>C: 指出来源缺失与致死事件对称性问题 C->>C: 用生产回放迭代 v1-v5 U->>C: 要求分析落盘并继续闭环 Regen C->>F: Review Regen 剩余缺口 F-->>C: 指出出生基础值的观察不对称 C->>C: v6 移除静态能力误归因并固定 evidence U->>C: 多轮真实游戏视觉验收 C->>C: 收敛 Overflow、ruby 排版与自适应高度方案讨论
ADR-001:以 typed adjustment 为权威事实
ADR-002:覆盖率不等于精确率
ADR-003:出生 Regen 基础值不参与来源归因
RegenApplyAmount补齐;按场上候选平分;作为稳定出生 baseline 单独排除。RegenAdded作为贡献;稳定出生 baseline 独立核对并从来源覆盖率分母中排除。ADR-004:实际影响附着在已有行
最终方案
flowchart LR A[CombatSim 有序事件] --> B[Typed health / shield ledger] A --> C[Status apply 与 CardStats 来源候选] B --> D[致死截断与 Burn 原子组] C --> E[来源约束与权重] D --> F[周期效果实际金额] E --> G[Exact / Constrained / Proportional / Unknown] F --> H[PeriodicImpact] G --> H H --> I[附着到原 Burn / Poison / Regen group] I --> J[自适应 ruby-like secondary line] K[固定生产 bundle 清单] --> L[Corpus runner] L --> M[守恒诊断与覆盖率] M --> N[v5 / v6 evidence snapshots]验证情况
./run.sh format-check:通过,检查 1,162 个文件。dotnet test tests/PostCombatImpact.Tests/PostCombatImpact.Tests.csproj --no-restore --verbosity minimal:149/149 通过。./run.sh test:完整测试套件通过。./run.sh build --fast:通过,0 warnings / 0 errors,并替换本地 Debug mod DLL。固定生产语料:100 个 bundles、1,110 场战斗、339,649 帧、53,068 个 adjustments;7 个 unresolved actions,0 missing stat identities,0 invalid payloads。
v6 可归因金额覆盖率:
v6 evidence 与完整 report 连续两次运行字节一致:
9ca232d60e5a30ae218400619092af71aeb1e8ab915473e5b5a71fa6e3ee0997eb129d33bdb2a566c9bc87a8f8ce5c77d0bbda7ae5ace585f94808a3bcc3c012用户已在真实游戏中多轮验收中英文、长短 tooltip、同行实际影响和自适应 padding;Codex 未自动启动游戏。
已知局限 / 后续工作