Reject overlapping live battle save units

This commit is contained in:
2026-07-05 13:33:25 +09:00
parent ad7e80b58f
commit 4931cb2cf7
2 changed files with 14 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ try {
['invalid unit exp threshold', { units: patchUnit(0, { exp: 100 }) }],
['invalid max-level unit exp threshold', { units: patchUnit(0, { level: 99, exp: 101 }) }],
['invalid unit hp', { units: patchUnit(0, { hp: 99, maxHp: 30 }) }],
['duplicate live unit tile', { units: patchUnit(1, { x: validState.units[0].x, y: validState.units[0].y }) }],
['invalid unit x', { units: patchUnit(0, { x: 12 }) }],
['invalid unit direction', { units: patchUnit(0, { direction: 'down' }) }],
['missing equipment slot', { units: patchUnit(0, { equipment: { weapon: createEquipmentSet().weapon, armor: createEquipmentSet().armor } }) }],
@@ -116,6 +117,11 @@ try {
'Expected save missing a current battle unit to be rejected.'
);
assert(
isValidBattleSaveState({ ...validState, units: patchUnit(1, { hp: 0, x: validState.units[0].x, y: validState.units[0].y }) }, options),
'Expected defeated units to tolerate overlapping saved coordinates.'
);
console.log('Verified battle save normalization and corrupted battle save rejection.');
} finally {
await server.close();