Balance cumulative campaign flow

This commit is contained in:
2026-06-28 08:11:08 +09:00
parent fcc2e28e05
commit 87a25ffbc1
5 changed files with 479 additions and 87 deletions

View File

@@ -223,6 +223,12 @@ export type CampaignReserveTrainingFocusDefinition = {
export const defaultCampaignReserveTrainingFocusId: CampaignReserveTrainingFocusId = 'balanced';
const campaignInventoryCaps: Record<string, number> = {
['\uCF69']: 120,
['\uC0C1\uCC98\uC57D']: 80,
['\uD0C1\uC8FC']: 80
};
export const campaignReserveTrainingFocusDefinitions: CampaignReserveTrainingFocusDefinition[] = [
{
id: 'balanced',
@@ -770,7 +776,9 @@ function createBattleSettlement(report: FirstBattleReport, reserveTraining: Camp
function applyRewardDelta(inventory: Record<string, number>, rewards: string[], direction: 1 | -1) {
return rewards.reduce<Record<string, number>>((nextInventory, reward) => {
const { label, amount } = parseRewardLabel(reward);
nextInventory[label] = Math.max(0, (nextInventory[label] ?? 0) + amount * direction);
const nextAmount = Math.max(0, (nextInventory[label] ?? 0) + amount * direction);
const cap = direction === 1 ? campaignInventoryCaps[label] : undefined;
nextInventory[label] = cap ? Math.min(nextAmount, cap) : nextAmount;
if (nextInventory[label] === 0) {
delete nextInventory[label];
}