fix(07-01): #06-01-4 reset enemy views before a full buildup

- reset every EnemyView before a full buildup so repeated builds start from
  the base enemy instead of compounding on the previous result
- un-skip the correct-expectation cases in damage.test.ts (#06-01-4) and
  context.test.ts (#06-15-1)
This commit is contained in:
unanmed 2026-09-15 16:55:36 +08:00
parent 9e96df4c3b
commit 8225ef129c
3 changed files with 8 additions and 4 deletions

View File

@ -621,8 +621,8 @@ describe('EnemyContext single aura ranges', () => {
).toBe(5);
});
// 疑似 bugdeleteAura 后再次全量构建应回到基础 atk详见 06-TEST-FINDINGS.md #06-15-1修复后取消 skip
it.skip('applies a global aura after addAura and stops applying it after deleteAura', () => {
// 验证 deleteAura 后再次全量构建会回到基础 atk
it('applies a global aura after addAura and stops applying it after deleteAura', () => {
const fixture = createContextFixture();
fixture.context.bindHero(fixture.hero);
fixture.context.registerAuraConverter(new FakeConverter([]));

View File

@ -693,6 +693,10 @@ export class EnemyContext<TEnemy, THero> implements IEnemyContext<
this.dirtyEnemy.clear();
this.needTotallyRefresh.clear();
this.requestedCommonContext.clear();
// 全量重建前必须先把各视图退回原始怪物,否则重复构建会在上一轮数值上继续累加
for (const view of this.enemyViewMap.values()) {
view.reset();
}
const hasAura = this.auraConverter.size > 0;
const hasSpecialQuery = this.specialQueryEffects.size > 0;
if (hasAura || hasSpecialQuery) {

View File

@ -673,8 +673,8 @@ describe('DamageSystem attribute linkage', () => {
expect(system.getDamageInfo(newView)).toBeNull();
});
// 疑似 bug重复全量构建应从原始怪物重算而非在原计算值上累加,详见 06-TEST-FINDINGS.md #06-01-4修复后取消 skip
it.skip('recomputes a repeat buildup from the base enemy without compounding', () => {
// 验证重复全量构建从原始怪物重算而非在原计算值上累加
it('recomputes a repeat buildup from the base enemy without compounding', () => {
const context = createEnemyContext({
shouldConvert: special => special.code === 20,
convert: () => ({