fix(battle): place random vehicles before fixed support slots

This commit is contained in:
N0VAN0M4LY committed 2026-11-28 14:42:31 +08:00
1 parent 44825ed6b5
commit 986ffb632d
1 file changed
+7 -4
@@ -63,13 +63,16 @@ export function selectExtraBattleSlots(input: ExtraBattleSlotsInput): readonly E
const room = MAX_BATTLE_CREW_SLOTS - input.slotVehicles.length;
if (input.declaration.multiSlot === false || room <= 0) return [];
const slots: ExtraBattleSlot[] = [];
const supportSlots: ExtraBattleSlot[] = [];
const supportPlane = supportPlaneSlot(input);
if (supportPlane) slots.push(supportPlane);
if (supportPlane) supportSlots.push(supportPlane);
const ucav = strikeUcavSlot(input);
if (ucav) slots.push(ucav);
if (ucav) supportSlots.push(ucav);
// Keep room for fixed support vehicles while displaying random vehicle groups first.
const slots: ExtraBattleSlot[] = [];
for (const group of input.rules.randomSpawnUnits[input.declaration.economicName]?.[input.country] ?? []) {
if (slots.length + supportSlots.length >= room) break;
const options = randomGroupOptions(group, input);
if (options.length === 0) continue;
const chosen = options[randomInt(options.length)]!;
@@ -82,7 +85,7 @@ export function selectExtraBattleSlots(input: ExtraBattleSlotsInput): readonly E
});
}
return slots.slice(0, room);
return [...slots, ...supportSlots].slice(0, room);
}
function supportPlaneSlot(input: ExtraBattleSlotsInput): ExtraBattleSlot | undefined {