Clamp campaign bond levels

This commit is contained in:
2026-07-05 14:52:09 +09:00
parent 3d48ef3c80
commit 44b2c6064c
2 changed files with 8 additions and 7 deletions

View File

@@ -287,6 +287,7 @@ try {
bonds: [
{ id: 'broken-bond', title: 'Broken Bond', unitIds: { corrupted: true }, level: 3, exp: 12, battleExp: 2 },
{ id: 'self-bond', title: 'Self Bond', unitIds: ['liu-bei', 'liu-bei'], level: 2, exp: 12, battleExp: 2 },
{ id: 'zero-bond', title: 'Zero Bond', unitIds: ['liu-bei', 'guan-yu'], level: 0, exp: '999', battleExp: 2 },
{ id: 'oath-bond', title: 'Oath Bond', unitIds: ['liu-bei', 'guan-yu'], level: '2', exp: '999', battleExp: '5' },
9
],
@@ -320,11 +321,9 @@ try {
assert(Array.isArray(malformed.roster) && malformed.roster.length === 0, `Expected malformed roster to reset to an array: ${JSON.stringify(malformed)}`);
assert(
Array.isArray(malformed.bonds) &&
malformed.bonds.length === 1 &&
malformed.bonds[0].id === 'oath-bond' &&
malformed.bonds[0].level === 2 &&
malformed.bonds[0].exp === 99 &&
malformed.bonds[0].unitIds.length === 2,
malformed.bonds.length === 2 &&
malformed.bonds.some((bond) => bond.id === 'zero-bond' && bond.level === 1 && bond.exp === 99 && bond.unitIds.length === 2) &&
malformed.bonds.some((bond) => bond.id === 'oath-bond' && bond.level === 2 && bond.exp === 99 && bond.unitIds.length === 2),
`Expected malformed bond entries to be filtered while valid bonds normalize: ${JSON.stringify(malformed)}`
);
assert(
@@ -810,7 +809,7 @@ try {
}))
],
bonds: [
{ id: firstScenario.bonds[0].id, title: firstScenario.bonds[0].title, level: '2', exp: '22', battleExp: '4' },
{ id: firstScenario.bonds[0].id, title: firstScenario.bonds[0].title, level: '0', exp: '200', battleExp: '4' },
{ id: '', title: 'Broken Bond' },
...Array.from({ length: 120 }, (_, index) => ({
id: `history-bond-${index}`,
@@ -912,6 +911,8 @@ try {
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].level === 1 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.bonds[0].exp === 99 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.bonds[0].battleExp === 4 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.reserveTraining?.length === 1 &&
malformedHistory.battleHistory['first-battle-zhuo-commandery']?.reserveTraining?.[0].focusId === 'balanced',