Balance cumulative campaign flow
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user