Filter campaign history roster references

This commit is contained in:
2026-07-05 12:12:37 +09:00
parent 3e7a7c2478
commit cbce49b298
2 changed files with 31 additions and 4 deletions

View File

@@ -444,6 +444,7 @@ try {
step: 'fourth-camp',
activeSaveSlot: 1,
gold: 320,
roster: alliedFirstBattleUnits,
firstBattleReport: {
battleId: 'first-battle-zhuo-commandery',
battleTitle: ' ',
@@ -607,6 +608,8 @@ try {
updatedAt: '2026-07-04T01:00:00.000Z',
step: 'fifth-camp',
latestBattleId: 'missing-history-entry',
roster: alliedFirstBattleUnits,
bonds: firstScenario.bonds,
battleHistory: {
'wrong-history-key': {
battleId: 'first-battle-zhuo-commandery',
@@ -655,7 +658,7 @@ try {
}))
],
bonds: [
{ id: 'oath-bond', title: 'Oath Bond', level: '2', exp: '22', battleExp: '4' },
{ id: firstScenario.bonds[0].id, title: firstScenario.bonds[0].title, level: '2', exp: '22', battleExp: '4' },
{ id: '', title: 'Broken Bond' },
...Array.from({ length: 120 }, (_, index) => ({
id: `history-bond-${index}`,
@@ -745,14 +748,14 @@ try {
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.objectives[0].rewardGold === 80 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.objectives[0].targetTile?.x === 4 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.objectives[0].status === undefined &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.units.length === 96 &&
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 === 96 &&
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 === 96 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.reserveTraining?.length === 1 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.reserveTraining?.[0].focusId === 'balanced',
`Expected nested battle history progress arrays to filter invalid entries and normalize numbers: ${JSON.stringify(malformedHistory)}`
);