Commit Graph

72 Commits

Author SHA1 Message Date
c1df1e0116 fix(07-13): prune deleted views and empty sourceless points
- deleteEnemy removes the deleted view from point.affectedBy and drops its point.damages entry so lazy refreshIndex never revisits a dead view (IN-01)
- deleteMapDamage removes the sourcelessDamage IPointInfo once both damages and affectedBy are empty, keeping markDirtyIndex
- add IN-01 regressions: dead-view witness (getDamageWithoutCheck not called) and the two arms of the sourceless empty-point cleanup
2026-09-17 17:23:01 +08:00
cff4291512 fix(07-13): #CR-02 mark removed indexes dirty and register empty view sets
removeEnemyAffecting collects removed coordinate indexes and markDirtyIndex each; refreshEnemyAndClearCache/refreshEnemy register enemyStore.set(view, set) before the empty-set return so later markEnemyDirty uses local refresh instead of refreshAll(). Adds a Chinese comment before each new it.
2026-09-17 16:56:33 +08:00
49aacb087a refactor: 调整录像命名 2026-09-16 21:51:19 +08:00
6c4d3709d3 test(06-18): migrate 5 existing perf files to performance.mark/measure
- measureCase sampling loop now pairs mark(startTag)/mark(endTag) with
  measure(measureName, startTag, endTag) and clears marks/measures per sample
- tag names derive from caseName+scale so they never collide across cases
- WARMUP_RUNS/SAMPLE_RUNS/median/min/p95/toFixed(3)/columns unchanged
2026-09-16 20:26:42 +08:00
b2626bd438 fix(07-09): keep hero attribute instance stable and clear generic variance
- HeroAttribute.loadState replaces its private base object; the HeroAttribute wrapper identity is preserved so equipment/combat references stay valid across load (#06-17-1/#06-17-2).

- Clone the incoming base attribute in the constructor so the shared HERO_DEFAULT_ATTRIBUTE is no longer mutated across CoreState instances.

- Use any for the hero position in combat handler/aura/enemy-view generics to clear the 45 new type errors introduced by HeroAttribute implementing ISaveableContent.
2026-09-16 19:35:54 +08:00
3c59f31e6f test(06-16): add enemy context buildup and hero attribute perf suites
- context.perf.ts: 3 cases (50/200/1000 enemies), fixed 10 global auras + 5 special codes, cached aura topology, one buildup per sample
- attribute.perf.ts: 3 cases (10/100/1000 modifiers over 10 attributes), 1000 recalc rounds per sample via markModifierDirty + getFinalAttribute
- warmup 3 + 20 samples, median/min/p95 via console.table, no assertions
2026-09-16 15:02:57 +08:00
37bf89bc94 test(06-16): add isolated perf channel and critical calculation perf
- vitest.perf.config.ts: include only *.perf.ts, mirror vite.config.ts aliases, 30s timeouts
- package.json: add test:perf script (test/test:ci untouched)
- damage.perf.ts: 3 cases (1000/10000/50000) warmup 3 + 20 samples, no assertions
2026-09-16 14:56:28 +08:00
650b96059d fix(07-01): #06-01-3 abandon the battle only when before returns false
- read the before result into proceed and abandon only on falsy, matching the
  ICombatScript.before contract in types.ts
- un-skip the correct-expectation case and correct the three existing cases that
  encoded the inverted semantics (explicit truthy beforeResult, complementary
  truthy-branch assertion, synced FakeScript comment)
2026-09-15 17:02:57 +08:00
24534fbca6 fix(07-01): #06-01-2 clear enemy-sourced map damage on delete
- register viewStore/damageStore reverse indexes when sourced damage is written
  and re-register them after a refreshIndex recompute (route A)
- deleteEnemy now finds and removes the enemy-sourced damage instead of leaving
  stale entries behind
- un-skip the correct-expectation case in mapDamage.test.ts (#06-01-2)
2026-09-15 17:00:44 +08:00
8225ef129c 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)
2026-09-15 16:55:36 +08:00
9e96df4c3b fix(07-01): #06-01-1 align critical info with the yielded next value
- move targetInfo assignment into the damage < referenceDamage branch so the
  reported critical info matches the yielded next value
- un-skip the correct-expectation case in damage.test.ts (#06-01-1)
2026-09-15 16:53:50 +08:00
65251f5f42 test(06-15): cover deleteAura via correct-expectation skip and register #06-15-1
- add pplies a global aura after addAura and stops applying it after deleteAura (it.skip, D-05)
- reuse in-file createContextFixture/createEnemy/FakeAura/FakeConverter, no new helpers
- register finding #06-15-1 in 06-TEST-FINDINGS.md (same root cause as #06-01-4)
- unskip-verified: addAura applies (atk 2 -> 5) but deleteAura + buildup stays 5, expected 2
2026-09-15 13:15:51 +08:00
ef95cc710f test(06-10): cover combined effects and cross-enemy nested auras
- G-06-01-A: four effect kinds together, assert stage order and final
  atk/def/hp/special on the computed enemy
- G-06-01-B: m1 -> A1 -> m2 -> A2 -> all enemies, assert per-enemy final
  atk plus A1 range boundary via special 21 ownership
2026-09-15 10:06:26 +08:00
fcba44c756 test(06-10): cover multi-source map damage stacking (G-06-01-C)
- add inline createTypedInfo/FakeTypedView/SemanticReducer helpers
- assert separated count and reduced damage/type/extra for sourced+sourced,
  sourceless+sourceless, and mixed multi-source combinations
2026-09-15 10:04:12 +08:00
cee843981f feat: 录像记录 & CoreState 存储接口 2026-09-14 18:09:45 +08:00
136a9845d6 test(06): fix lint and type errors in data-layer test files 2026-09-14 14:03:25 +08:00
a9b6e7290c test(06-01): stage 3 integration coverage for combat, damage and map damage
- add D-26 attribute-to-damage linkage and getCalculator coverage in damage.test.ts
- cover markEnemyDirty refresh and unregistered delete in mapDamage.test.ts
- cover off-map handler and standalone computed enemy in combat.test.ts
- register suspected buildup compounding bug as #06-01-4 it.skip with a findings entry
- complete the 06-COVERAGE-MAP.md code rows for 106/107/102/103/104/138/139/140/141
2026-09-14 12:58:46 +08:00
f536901733 test(06-01): stage 2 pipeline coverage for EnemyContext
- cover full buildup aura conversion and one/two-layer nested auras
- assert four-stage order specials -> base -> query -> final with forward-only visibility
- cover local requestRefresh, needTotallyRefresh full fallback, and warn codes 97/98/99/100/101/110
- fill the 06-COVERAGE-MAP.md rows for the stage 2 warning codes
2026-09-14 12:52:29 +08:00
2e4e6d739d test(06-01): stage 1 component-level EnemyContext coverage
- cover every public EnemyContext method (registry, converters, effect registrations, attachments, dirty, lifecycle)
- apply single fake auras over Full/Rect/Manhattan ranges and assert out-of-range enemies stay unchanged
- add shared 06-COVERAGE-MAP.md skeleton with the code -> module -> case header protocol
2026-09-14 12:49:29 +08:00
6c8f85a2be test(06-01): cover CombatFlow binding, script ordering and guards
- add combat.test.ts for same-state binding, foreign-state warn 138, script priority sort and duplicate warn 140, guard warns 139/141, awaited script/hook ordering with real timers, and battleComputed delegation
- extend the 06-TEST-FINDINGS.md sink with the #06-01-3 before-return semantics row
2026-09-14 08:51:13 +08:00
484da2db19 test(06-01): cover MapDamage and EnemyContext behavior
- add mapDamage.test.ts for sourceless add/delete, sourced conversion, reduction caching, warns 102/103/104 and the #06-01-2 deleteEnemy finding
- add context.test.ts for the enemy registry (register/lookup/unknown-null/delete/resize/scan) and effect-registry add/remove behavior
- extend the 06-TEST-FINDINGS.md sink with the #06-01-2 row
2026-09-14 08:50:05 +08:00
15f329b61d test(06-01): polyfill Map.getOrInsert in combat test harness
- keep the global Map stub uniform across combat test files so modules using
  getOrInsert/getOrInsertComputed load under Node
2026-09-14 08:49:55 +08:00
59b709e43e test(06-01): prove combat damage context/system via tracer
- add damage.test.ts covering DamageContext/DamageSystem results, handler identity, warns 106/107, cache invalidation, with(hero) and calculateCritical
- declare api-coverage in COVERAGE.md for the test-only phase
- open the shared 06-TEST-FINDINGS.md sink with schema and #06-01-1 finding
2026-09-14 08:45:34 +08:00
aa3c7296c7 chore: 将事件执行标记为 ignoreReplay 2026-09-13 20:52:42 +08:00
a66be585d1 feat(event): rework built-ins and centralize trigger collection
- rename deleteBlock -> removeBlock (dynamic tiles need dynamic:true),
  moveHeroStep -> stepHero; touchFront steps forward and lets the mover bump
- GameEventSystem.collectEvent owns point/tile source collection; moverImpl
  enter/leave/hit reuse it with OnEnter/OnLeave/OnTouch
- IBlockEventEnv gains required system field and nullable heroFloor
- MapLayer.removeBlock added and setBlock guarded by inMap; GameMap owns floorId
- IObjectMover.push accepts readonly steps
- update event/eventDispatch tests to the current implementation (fixtures
  supply system, hero location snapshots, renamed registrations)

Verified: data type gate 0 in-scope; vitest 19 files / 112 tests pass; prettier
and eslint clean on touched files.
2026-09-13 20:37:32 +08:00
a701aa6da9 refactor(anon-tokyo): import embedded workspace package everywhere
- rename all anon-tokyo imports to @motajs/anon-tokyo in data-common,
  data-system and data-state
- declare @motajs/anon-tokyo workspace dependency in data-common and
  data-system; refresh pnpm-lock.yaml
2026-09-13 19:17:21 +08:00
febdcdc967 refactor: align state system replay and path contracts 2026-09-11 22:36:09 +08:00
3134537d30 feat(03-02): implement approved event built-ins
- Add map, hero, touch, and temporary event controls
- Register exactly eight built-ins through top-level event assembly
- Cover awaited behavior and safe failure with explicit fixtures
2026-09-10 16:25:02 +08:00
7f19773477 chore(03): checkpoint data layer structure 2026-09-10 13:30:53 +08:00
26f7ad6b2e refactor(02-06): align pathfinding structure with user scope 2026-09-10 11:21:53 +08:00
a2aedb3969 refactor(02-04): restore authorized path contract
- Match path/types.ts to the user-authored baseline plus nullable returns
- Keep graph contracts implementation-owned and preserve the mover bridge
2026-09-10 09:35:21 +08:00
f1a9e626b6 test(02-02): add real 13x13 game maps to pathfinding performance tests
- 夹具 createPerformanceSystem 参数化起始位置与图块定义(合成矩阵默认值不变)
- 真实地图图块语义:数字 1 墙体,0/2/3/4/5/6 均为空地
- 新增六张 13x13 真实地图分段测量用例(20 轮 build/find/search,入口不足时固定种子抽选端点并记录)
2026-09-09 20:28:21 +08:00
2b483cdf2f test(02-02): switch performance timing to performance.measure and add multi-size map matrix
- 计时改用 performance.mark/measure(测量前后清理同名条目,避免累积)
- 新增 10/30/60/100/150 尺寸矩阵,完整流水线与分段测量均按尺寸逐行输出
- sanity 上限改为随节点数放宽的函数,两用例常驻通过
2026-09-09 20:14:26 +08:00
239ac0d790 refactor(02-02): precompute node costs and BFS from start position in graph build 2026-09-09 20:02:00 +08:00
e27015c4d2 fix(02-02): cost 守卫允许 Infinity,仅拦 NaN 与负数 2026-09-09 19:30:12 +08:00
3beef86ac0 test(02-02): merge segmented performance measurement into performance test
- Share one fixture (system + buildGraph) across both perf cases, no duplication
- Add multi-run segmented case emitting [pathfinding-segmented] graph_build/full_find/search_only
- Delete temporary performance.segmented.test.ts diagnostic
- Drop IDataCommon import orphaned by 622008f in graph.ts (eslint gate)
2026-09-09 19:21:16 +08:00
6f0f17fbf2 refactor(02-02): replace linear min-scan with binary heap priority queue in pathfinding search
- Add internal DistanceHeap (binary min-heap, lazy stale-entry skip) colocated in finder.ts
- search() extraction now pops the heap instead of scanning the full dist map
- Restore NaN-aware cost guard (!Number.isFinite || < 0) dropped in 622008f, fixes NaN warn-174 regression test
2026-09-09 19:15:25 +08:00
622008f67c refactor: 按审查意见调整寻路模块与开发规范 2026-09-09 19:05:57 +08:00
489e3de106 test(02-02): add full-pipeline pathfinding performance test and record review-fix round
- 新增 performance.test.ts:100x100 固定种子障碍图上计时完整 find 流水线
  (建图 + 最优路径发现),结构化输出 map/steps/elapsed
- 实测 map=100x100 steps=198 elapsed≈609ms(sanity 上限 5000ms)
- 02-02-SUMMARY 追加 Review Fixes (user audit round 1) 记录
2026-09-09 18:51:31 +08:00
d9ee80f77f refactor(02-02): apply user review directives on path module
- 移除 system.ts 中 'mover' in movable 运行时形状检查与 IMovableWithMover,
  依 types.ts 修正后的类型直接绑定 IObjectMover<IObjectMovable>
- path 内导出类型(IPathGraph*、IPathfindingGraphBuilder)归位 types.ts,
  graph.ts/finder.ts 改由 types 导入
- 移除类与接口声明上的 jsdoc、类实现侧与接口重复的 jsdoc、region 标记;
  实现注释改为仅描述可观察行为(去除 Dijkstra 等实现叙述)
- 私有方法置于调用者之前(resolveFloorId、getNodeCost、search、startMove)
- system.test.ts 对齐 useMover(mover) 新签名并同步测试描述
2026-09-09 18:47:40 +08:00
9a604422f8 fix: IObjectMovable 在寻路时无法实施移动的类型问题 2026-09-09 18:33:21 +08:00
cbcaec83dc refactor(02-02): comply with updated style rules, extract finder and drop temp function consts 2026-09-09 17:44:31 +08:00
e199d99d19 refactor(02-02): declare graph builder and test mover interfaces per updated class rule 2026-09-09 17:32:28 +08:00
53d019f62e feat(02-02): add minimal-loss pathfinding system with getPath, controller contract and fallback policy 2026-09-09 17:29:22 +08:00
0cd6ab6a2d feat(02-02): build pathfinding directed graph with injected pass predicate and authorized types fix 2026-09-09 17:17:48 +08:00
7a011b29c2 feat: 完成寻路系统接口设计 2026-09-09 16:40:56 +08:00
1d9b180d5f docs(test): describe individual test cases 2026-09-09 13:33:42 +08:00
4349e67669 docs(test): require test scope comments 2026-09-09 13:12:10 +08:00
33966fb4dd test(event): polyfill map insertion in fixtures 2026-09-09 13:06:27 +08:00
63d4d37ff3 fix(event): finalize event reference changes 2026-09-09 13:03:42 +08:00