diff --git a/scripts/verify-campaign-save-normalization.mjs b/scripts/verify-campaign-save-normalization.mjs index 12ac942..6036ca9 100644 --- a/scripts/verify-campaign-save-normalization.mjs +++ b/scripts/verify-campaign-save-normalization.mjs @@ -412,6 +412,9 @@ try { malformedHistory.battleHistory['first-battle-zhuo-commandery']?.objectives[0].status === undefined && malformedHistory.battleHistory['first-battle-zhuo-commandery']?.units.length === 1 && malformedHistory.battleHistory['first-battle-zhuo-commandery']?.units[0].level === 4 && + malformedHistory.battleHistory['first-battle-zhuo-commandery']?.units[0].equipment.weapon.itemId === 'training-sword' && + malformedHistory.battleHistory['first-battle-zhuo-commandery']?.units[0].equipment.armor.itemId === 'cloth-armor' && + malformedHistory.battleHistory['first-battle-zhuo-commandery']?.units[0].equipment.accessory.itemId === 'grain-pouch' && malformedHistory.battleHistory['first-battle-zhuo-commandery']?.bonds.length === 1 && malformedHistory.battleHistory['first-battle-zhuo-commandery']?.bonds[0].battleExp === 4 && malformedHistory.battleHistory['first-battle-zhuo-commandery']?.reserveTraining?.length === 1 && diff --git a/src/game/state/campaignState.ts b/src/game/state/campaignState.ts index 91901df..eed51f0 100644 --- a/src/game/state/campaignState.ts +++ b/src/game/state/campaignState.ts @@ -982,11 +982,11 @@ function normalizeCampaignUnitProgressSnapshot(value: unknown): CampaignUnitProg return { unitId: value.unitId, name: value.name, - level: normalizeNonNegativeInteger(value.level), + level: Math.max(1, normalizeNonNegativeInteger(value.level)), exp: normalizeNonNegativeInteger(value.exp), hp, - maxHp, - equipment: recordOrEmpty(value.equipment) as UnitData['equipment'] + maxHp: Math.max(1, maxHp), + equipment: normalizeEquipmentSet(value.equipment) }; }