Commit Graph

133 Commits

Author SHA1 Message Date
e9e9939bd8 refactor: 删除 data-state 中的 legacy 文件夹 2026-09-17 19:37:30 +08:00
a2a8e6ec35 refactor: ReplaySystem.route -> ReplaySystem.array,修复 disabled 标记在 setReplayArray 中清零可能导致意外记录的问题 2026-09-17 19:18:30 +08:00
219ac4991d fix: Flag 系统语义问题 2026-09-17 19:01:46 +08:00
13234b762a fix(07-13): clear existing dynamic tiles before loading
- add private clearDynamics() that snapshots the managed dynamic tiles and drops each via the deleteDynamic semantics (syncStaticEvent + removeTile + onDeleteDynamic), without awaiting the hook
- call it as the first line of loadState so all three compression tiers and the missing-dynamicBlocks case start from a clean slate (#06-17-8)
- add regressions: mapLayer hook/instance witness and the three-tier repeated-load non-accumulation case
2026-09-17 17:27:09 +08:00
3e68880e82 fix(07-12): compareEquip 在克隆属性上按对象定位删除目标(Q4 仅修 (i))
- 原属性索引为负或克隆槽位越界时不删除任何修饰器
- 删除目标改为克隆属性同槽位的自身对象,不再跨对象拼接索引
- 回归构造 rebuildModifiers 重建后的负索引路径,含触发机制断言
2026-09-17 16:06:53 +08:00
d8fb6f088c fix(07-12): loadState 用 disable/revert 包裹重新装备(WR-06)
- HeroEquipment.loadState 在重新装备循环外包一层录像禁用窗口,try/finally 保证恢复
- 录像桩补禁用计数语义,读档期间写入的指令被丢弃
- 回归覆盖:读档不产生录像指令、禁用与恢复配对平衡、读档后 equip/unequip 记录仍保留
2026-09-17 16:01:32 +08:00
ab18aa3ec7 fix(07-12): deleteModifierByIndex 委托 deleteModifier(WR-05)
- 按索引取出修饰器后委托 deleteModifier,删除簿记收敛为一份实现
- 返回被删修饰器;索引越界或为负返回 null 且不删除任何修饰器
- 回归覆盖:迭代器产出、索引解析、final 重算、重新挂载、存盘开关清理、越界
2026-09-17 15:56:50 +08:00
762bf2e95c docs(07-12): 记录装备加成事实源契约(WR-04 设计如此,零行为变更)
- types.ts 的 IEquipmentStateSave / IEquipmentState 补充契约注释
- 装备自身数值与百分比加成是事实源,存档持久化这两个表并由其重建装备修饰器
- 跨读档不保留旧修饰器引用属预期;运行时改加成须经装备自身而非改其修饰器
2026-09-17 15:56:26 +08:00
b99d040b11 test(07-12): 对齐空存档 nextUid 重置契约(IN-02,测试专用)
- saveLoad.test.ts 的码 58 用例改写为「空存档 → 随后 add 发号 0 且不产生码 58」
- 用例内注释登记码 58 分支只剩非空畸形数组可达,生产实现保持原样
- equipStore.ts 零改动(生产修复基线 ba60ef9)
2026-09-17 15:54:02 +08:00
ba60ef99eb fix: equipStore 的 nextUid 在空存档下报错 2026-09-17 14:56:56 +08:00
78f6796915 fix(07-11): #06-17-6 preserve follower instances across loadState
- HeroFollowersController 新增 restoreFollowers 保留式恢复入口
- 同索引同图块数字原地 loadState 并保留实例;否则替换槽位并按既有语义触发增删钩子
- 存档中不存在的末尾跟随者按存档为准删除
- HeroState.loadState 改用 restoreFollowers,不再 removeAllFollowers 全量重建(保持同步)
- IHeroFollowersController 补声明与 jsDoc;新增同实例/替换/删除/补齐回归用例
2026-09-17 13:53:46 +08:00
9964326210 fix(07-11): #06-17-5 preserve flag field instances across loadState
- FlagSystem.loadState 按 key 复用现有 FlagCommonField 并用 fromStructured 原地写值
- 存档中不存在的字段一律删除(以存档为准)
- IFlagSystem.loadState jsDoc 补写同引用与删除语义
- 新增同实例保真、getOrInsert 复用、结构化值恢复、删除多余字段回归用例
- flag/saveLoad.test.ts 的「重建字段对象」断言按 Q1=A 裁决改为同实例保真
2026-09-17 13:50:09 +08:00
153f4a490a fix(07-11): #06-17-4 preserve equipment instances across loadState
- HeroEquipsStore.loadState 按 uid 复用现有 EquipmentState 原地读档
- 同 uid 但装备图块数字不同时才替换该实例
- 存档中不存在的装备实例一律删除(以存档为准)
- IHeroEquipsStore.loadState jsDoc 补写同引用与删除语义
- 新增同实例保真、删除多余实例、num 不同替换三条回归用例
2026-09-17 13:47:20 +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
1f0af69004 fix(07-09): #06-17-1 load hero attribute in place and keep equipment bonuses
- IHeroStateSave.attribute becomes IHeroAttributeSave<THero>; top-level modifiers removed
- HeroState.attribute is readonly and loadState delegates to attribute.loadState (never reassigns)
- delete attachAttribute from IHeroState and HeroState, and its only test case
- thin-delegate registerModifier/createModifier/createAndInsertModifier to the attribute registry
- loadEquipEffect mounts equipment modifiers with save=false so equipment bonuses only return via re-equip
- add #06-17-1 regressions: same attribute instance, bonuses kept, no double-count when type is registered
2026-09-16 18:43:33 +08:00
6a60476531 feat(07-09): make HeroAttribute own its save state in place
- add IHeroAttributeSave<THero> and have IHeroAttribute extend ISaveableContent
- move the modifier factory registry into HeroAttribute with registerModifier/createModifier/createAndInsertModifier
- implement in-place saveState/loadState (values deep copy, save-enabled modifier enumeration, registry-driven rebuild)
- carry registry entries into clone() output
- introduce IHeroModifierOwner so modifier owner typing stays assignable for generic attributes
- add attribute.test.ts same-reference save/load regressions across all compressions
2026-09-16 18:37: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
620382cc5f fix(07-05): #06-06-1 warn code 128 for an out-of-map dynamic transfer
- transferToDynamic 越界分支由 131 改为 128,对齐两个 transferToStatic* 兄弟分支
- 取消 mapLayer.test.ts 的码 128 用例 skip
2026-09-15 20:45:01 +08:00
3b1b9f1d5c fix(07-05): #06-09-3 restore the dynamic tile num on load
- loadState 先 this.set(save.num),再恢复存档事件
- 取消 saveLoad.test.ts 的 num 恢复用例 skip
2026-09-15 20:43:20 +08:00
2d2855c394 chore(07-04): #06-05-3 annotate the retained 147 skip and close windows 25/26
- D-06: equipment.test.ts code-147 case stays it.skip with a Chinese note that 147 is a reserved code, currently unreachable by design; no production code touched
- WINDOWS.md ids 25/26 marked fixed (open_count 13 -> 11); no new ledger entries
2026-09-15 20:34:03 +08:00
2452711edb fix(07-04): #06-05-2 prefer the first empty named slot
- getCouldEquipSlot tests empty === -1 so the first empty named slot wins instead of always replacing the first match
- un-skip the named-slot empty-preference case; canEquipTo string branch untouched
2026-09-15 20:30:32 +08:00
04943416a5 fix(07-04): #06-05-1 refresh final attributes without modifiers
- recalculateAttribute writes the base value into finalAttribute when no modifier is attached
- un-skip the base-only-change case; catchCalculateProgress is intentionally left untouched
2026-09-15 20:29:27 +08:00
02786047d2 fix(07-04): #06-09-2 deep copy the equipment save snapshot
- saveState returns new Map(this.equips) and [...this.slots] so the snapshot is decoupled from the live state
- un-skip the independent-snapshot and container round-trip cases
2026-09-15 20:27:57 +08:00
e7f341095d fix(07-04): #06-09-1 restore equipment modifiers from split save tables
- loadNoCompression reads value entries from state.value instead of state.percentage
- loadDiff seeds this.value/this.percentage from the item.equip base definition before applying save diffs
- un-skip the four correct-expectation EquipmentState round-trip cases (Low/High percentage, NoCompression value, compressed unchanged value)
2026-09-15 20:26:45 +08:00
b70ccbd5f6 fix(07-02): #06-03-1 resolve the reuse mapping in enemy creation
- createEnemy/createEnemyById now resolve prefabs through internalGetPrefab,
  matching getPrefab/deletePrefab/modifyPrefabAttribute behaviour
- add a Chinese invariant comment above createEnemyById covering all
  code/id prefab entry points
- un-skip the two correct-expectation reuse mapping cases in manager.test.ts
  (assertions unchanged) and sync their Chinese comments
2026-09-15 17:16:44 +08:00
8a7cda95ae test(06-13): tier map tile save/load across all compressions (G-06-09-B)
- StaticTile covered-event round trip looped over NoCompression/LowCompression/HighCompression
- DynamicTile covered-event round trip looped over the three tiers, keeping the tile num assertion
- Existing #06-09-3 it.skip unchanged
2026-09-15 11:24:08 +08:00
6d7e57ab34 test(06-13): tier hero save/load classes across all compressions (G-06-09-B)
- EquipmentState percentage round trip per tier (NoCompression green; Low/High correct-expectation it.skip anchored #06-09-1)
- HeroItems constant/consumable tables and HeroState attributes/location loop over the three compression tiers
- HeroState container covers HeroLocation/HeroRendering across tiers; HeroEquipment container expectation it.skip anchored #06-09-2
- Existing #06-09-1/#06-09-2 skips unchanged
2026-09-15 11:22:52 +08:00
e2c163899d test(06-12): register blocked four-facing prefab reuse expectation (G-06-03-A)
- add correct-expectation it.skip for four facing codes reusing one prefab
- append 06-12 coverage-gap section to 06-COVERAGE-MAP.md
2026-09-15 10:43:03 +08:00
309f1b1850 test(06-11): cover static-dynamic-move-static full chain (G-06-06-A)
- mapLayer.test.ts: both keepEvent branches verified after a real-timer move,
  with exact event maps, dirty flags, block write-back and dynamic index updates
- 06-COVERAGE-MAP.md: append the 06-11 gap-fill section (create-or-append)
2026-09-15 10:27:59 +08:00
41da613f0b test(06-11): cover coexisting map layers of different z-index (G-06-06-C)
- gameMap.test.ts: three layers at z-index 1/5/9 keep independent block data and
  are judged separately by z-index during compareWith (missing ref marks dirty)
2026-09-15 10:25:17 +08:00
436386ea67 test(06-11): cover multi-slot equipment merge and createMap content generation
- equipment.test.ts: G-06-05-A asserts combined atk/def for weapon+armor and keeps the other slot's modifier after unequip
- mapState.test.ts: G-06-06-B writes/reads block, point event, event layer binding and dirty flag on a createMap floor
2026-09-15 10:23:16 +08:00
c08f3f8484 fix(replay): enable recording guard; update tests for replay refactor 2026-09-14 20:14:01 +08:00
17d7c8f46a refactor: refactor replay system record. 2026-09-14 19:55:20 +08:00
2ff422a682 test(06): restore suite green after replaySystem wiring change 2026-09-14 19:16:32 +08:00
c707c87add test(06-09): cover map, replay and flag save/load round trips
- add map/saveLoad.test.ts: StaticTile/DynamicTile/MapLayer/GameMap/MapState round trips, codes 55/122/124
- add replay/saveLoad.test.ts: ReplayArray and ReplaySystem same-instance round trips
- add flag/saveLoad.test.ts: FlagSystem round trip and separated snapshot
2026-09-14 18:57:51 +08:00
3e29548bfa test(06-09): cover enemy and hero save/load round trips
- add enemy/saveLoad.test.ts: Enemy/special/EnemyManager same-instance round trips across 3 compressions, codes 119/120
- add hero/saveLoad.test.ts: modifier/location/rendering/equipment/equipStore/items/follower/state round trips, codes 58/59
- add 06-SAVE-EXCLUSIONS.md: per-class excluded fields and rationale (D-42)
2026-09-14 18:57:42 +08:00
cee843981f feat: 录像记录 & CoreState 存储接口 2026-09-14 18:09:45 +08:00
2cb9bba3ce test(06-08): cover FlagSystem, FaceManager handlers and RoleFaceBinder (stage 2)
- add system.test.ts covering the full FlagSystem public surface and warn code 111
- add faceManager.test.ts covering FaceManager registry plus Dir4/Dir8 handlers
- add face.test.ts covering RoleFaceBinder malloc/bind/query and error codes 43/44
2026-09-14 16:56:17 +08:00
235eb1a5c9 test(06-06): cover DynamicTileMover async lifecycle (stage 3)
- mover.test.ts: successful step and layer reindex, cumulative/diagonal movement, warn 126 on an unexpected move code, lifecycle hook order, concurrent start rejection, initial face direction
2026-09-14 16:28:30 +08:00
b971e145e9 test(06-06): cover map registration, layers and dynamic conversion (stage 2)
- mapState.test.ts: createMap/getMap, raw validation codes 60/61/62/63/64, activation, areas, compareWith
- gameMap.test.ts: layer lifecycle, aliases 84, background, event layer 131, dirty, resizeLayer, compareWith
- mapLayer.test.ts: matrix, getMapData 80/81, putMapData 8/9, setMapRef 123, dynamic conversion 127/128/129/130, point events, dirty/compareWith, async doors 46
- eventView extension plus stage 1 files already committed
2026-09-14 16:26:10 +08:00
4cffe90794 test(06-06): cover map tile units and event view (stage 1)
- tile.test.ts: MapTileBase num/raw/set, default-event restore, per-tile event view, pointEvent linkage, setFaceDirection binder mapping
- staticTile.test.ts: num/raw/set/raw-miss/shouldSave/toDynamic
- dynamicTile.test.ts: create warn 143, num/raw/set, setPos, face direction, toStatic/toStaticIfSafe, step, delete
- eventView.test.ts: extend per-priority dirty tracking and duplicate priority warn 136
2026-09-14 16:19:09 +08:00
351111487a test(06-05): cover HeroMover async movement and HeroRendering (stage 3)
- add mover.test.ts: config round-trip, Step/CannotMove/Hit, out-of-bound, terrain bypass, enter/leave order, code 144
- add rendering.test.ts: default alpha, setAlpha hook, hook unload
2026-09-14 15:55:08 +08:00
6d5081abcb test(06-05): cover hero assembly and item/equipment pipeline (stage 2)
- add location/state tests: locator, floor/pos hooks, subsystem assembly, code 116, changeFloor hook order
- add equipment/equipStore/items tests: equip/unequip/replace, compareEquip, instance sorting, item routing, code 146
- add follower tests: add/remove hooks, neighbour links, sync/async gather, code 142
- record suspected bugs #06-05-2/#06-05-3 (named-slot empty check, unreachable code 147) as it.skip
2026-09-14 15:52:32 +08:00
c1781b8102 test(06-05): cover HeroAttribute and hero modifier formulas (stage 1)
- add attribute.test.ts: base/final, priority sort, delete, save flag, clone, codes 108/109
- add modifier.test.ts: value/percentage formulas, default priorities, setValue recompute
- record suspected bug #06-05-1 (no-modifier final value stale) as it.skip
2026-09-14 15:43:59 +08:00
7012aa49fc test(06-03): cover EnemyManager registry, prefab, reuse and dirty (stage 3)
- registry/attribute defaults incl. error 53 for non-serializable values
- prefab add/get/create/delete/change and reuse mapping reads
- modifyPrefabAttribute callback and index rebuild
- comparer lifecycle: warn 117 on repeat compareWith, warn 118 without comparer
- skip #06-03-1 (createEnemy does not resolve reuse mapping) per D-05
2026-09-14 14:39:41 +08:00
ff752713b9 test(06-03): cover Enemy special CRUD and clone/copyFrom (stage 2)
- enemy.test.ts: addSpecial/get/has/iterate, duplicate warn 96, delete by object/code, clone/copyFrom independence
- special.test.ts: clone value independence and deepEqualsTo code/value rules, NonePropertySpecial clone
2026-09-14 14:35:24 +08:00
965868c219 test(06-03): add Enemy attribute and special unit tests (stage 1)
- enemy.test.ts: attribute get/set/add independence and cloneAttributes deep copy
- special.test.ts: CommonSerializableSpecial value/name/description and NonePropertySpecial units
- fixtures inline, legacy and save/load excluded per D-30/D-32
2026-09-14 14:32:40 +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