feat: complete legacy unique item battle parity

This commit is contained in:
2026-07-25 06:47:56 +00:00
parent 35935c9eca
commit 0d7ede3d93
45 changed files with 1143 additions and 174 deletions
+11
View File
@@ -10,6 +10,7 @@ import {
projectItemSlots,
serializeItemInventory,
} from '../src/items/inventory.js';
import { listEquippedItemKeys } from '../src/items/utils.js';
const makeGeneral = (): General => ({
id: 7,
@@ -58,6 +59,16 @@ describe('GeneralItemInventory', () => {
expect(Object.keys(inventory.instances)).toHaveLength(3);
});
it('reads legacy slots without mutating a frozen world snapshot', () => {
const general = makeGeneral();
general.role.items.item = 'che_치료_환약';
const frozen = Object.freeze(general);
expect(listEquippedItemKeys(frozen)).toEqual(['che_치료_환약']);
expect(getEquippedItemInstance(frozen, 'item')?.itemKey).toBe('che_치료_환약');
expect(frozen.itemInventory).toBeUndefined();
});
it('keeps consumable charges in the equipped item instance', () => {
const general = makeGeneral();
equipNewItem(general, 'item', 'che_치료_환약', { charges: 3 });