Validate battle save item stock ids

This commit is contained in:
2026-07-05 11:36:21 +09:00
parent 7ef6f05590
commit 08e669aca5
3 changed files with 16 additions and 5 deletions

View File

@@ -16,7 +16,8 @@ try {
mapWidth: 12,
mapHeight: 8,
validUnitIds: new Set(['liu-bei', 'guan-yu', 'rebel-1']),
validUsableIds: new Set(['roar', 'fireTactic', 'aid'])
validUsableIds: new Set(['roar', 'fireTactic', 'aid', 'bean', 'salve', 'wine']),
validItemIds: new Set(['bean', 'salve', 'wine'])
};
const validState = createValidBattleSaveState();
const patchUnit = (index, patch) => validState.units.map((unit, unitIndex) => (unitIndex === index ? { ...unit, ...patch } : unit));
@@ -51,6 +52,7 @@ try {
['unknown bond unit id', { bonds: [{ ...validState.bonds[0], unitIds: ['liu-bei', 'ghost-unit'] }] }],
['invalid item stock count', { itemStocks: { 'liu-bei': { bean: -1 } } }],
['unknown item stock unit id', { itemStocks: { 'ghost-unit': { bean: 1 } } }],
['unknown item stock item id', { itemStocks: { 'liu-bei': { phantomItem: 1 } } }],
['invalid buff turns', { battleBuffs: [{ ...validState.battleBuffs[0], turns: 0 }] }],
['unknown buff unit id', { battleBuffs: [{ ...validState.battleBuffs[0], unitId: 'ghost-unit' }] }],
['invalid status kind', { battleStatuses: [{ ...validState.battleStatuses[0], kind: 'poison' }] }],