Verify equipment reward resettlement

This commit is contained in:
2026-07-05 17:51:03 +09:00
parent 396f372746
commit 90dc9d0201

View File

@@ -118,8 +118,8 @@ try {
objectives: [], objectives: [],
units: alliedFirstBattleUnits, units: alliedFirstBattleUnits,
bonds: firstScenario.bonds.map((bond) => ({ ...bond, battleExp: 0 })), bonds: firstScenario.bonds.map((bond) => ({ ...bond, battleExp: 0 })),
itemRewards: ['Bean x2'], itemRewards: ['Bean x2', 'Iron Sword 1'],
campaignRewards: { supplies: ['Bean x2'], equipment: [], reputation: [], recruits: [], unlocks: [] }, campaignRewards: { supplies: ['Bean x2'], equipment: ['Iron Sword 1'], reputation: [], recruits: [], unlocks: [] },
completedCampDialogues: [], completedCampDialogues: [],
completedCampVisits: [], completedCampVisits: [],
createdAt: '2026-07-03T09:00:00.000Z' createdAt: '2026-07-03T09:00:00.000Z'
@@ -130,20 +130,23 @@ try {
assert( assert(
repeatedSettlement.gold === 100 && repeatedSettlement.gold === 100 &&
repeatedSettlement.inventory.Bean === 2 && repeatedSettlement.inventory.Bean === 2 &&
repeatedSettlement.inventory['Iron Sword'] === 1 &&
repeatedSettlement.battleHistory[firstScenario.id]?.rewardGold === 100, repeatedSettlement.battleHistory[firstScenario.id]?.rewardGold === 100,
`Expected repeated battle report settlement to avoid duplicate gold/items: ${JSON.stringify(repeatedSettlement)}` `Expected repeated battle report settlement to avoid duplicate gold/items: ${JSON.stringify(repeatedSettlement)}`
); );
setFirstBattleReport({ setFirstBattleReport({
...firstBattleReport, ...firstBattleReport,
rewardGold: 140, rewardGold: 140,
itemRewards: ['Bean x3', 'Wine'], itemRewards: ['Bean x3', 'Wine', 'Iron Armor 1'],
campaignRewards: { supplies: ['Bean x3', 'Wine'], equipment: [], reputation: [], recruits: [], unlocks: [] } campaignRewards: { supplies: ['Bean x3', 'Wine'], equipment: ['Iron Armor 1'], reputation: [], recruits: [], unlocks: [] }
}); });
const revisedSettlement = getCampaignState(); const revisedSettlement = getCampaignState();
assert( assert(
revisedSettlement.gold === 140 && revisedSettlement.gold === 140 &&
revisedSettlement.inventory.Bean === 3 && revisedSettlement.inventory.Bean === 3 &&
revisedSettlement.inventory.Wine === 1, revisedSettlement.inventory.Wine === 1 &&
revisedSettlement.inventory['Iron Sword'] === undefined &&
revisedSettlement.inventory['Iron Armor'] === 1,
`Expected revised battle report settlement to replace previous rewards instead of stacking: ${JSON.stringify(revisedSettlement)}` `Expected revised battle report settlement to replace previous rewards instead of stacking: ${JSON.stringify(revisedSettlement)}`
); );
applyCampVisitReward('repeat-visit', { gold: 10, itemRewards: ['Bean x2'] }); applyCampVisitReward('repeat-visit', { gold: 10, itemRewards: ['Bean x2'] });