Map-Pools: Overpass, Vertigo und Cache für Competitive, Map-Auswahl im Admin, Veto-Ablauf passend zur Map-Anzahl

This commit is contained in:
mregosar committed 2026-10-29 21:03:29 +01:00
1 parent e3834bb071
commit 2d65634d6e
13 files changed
+459 -45

No files matched your search

+29
View File
@@ -54,6 +54,35 @@ export function validateFlow(flow, mapCount, format) {
return errors;
}
/**
* Erzeugt einen Veto-Ablauf für eine beliebige Anzahl Maps. Bans und Picks wechseln sich zwischen den Teams ab:
* erst bis zu zwei Bans, dann die Picks (die Seite wählt jeweils das andere Team), dann die restlichen Bans.
* Die letzte Map ist die Entscheidungsmap, ihre Seite wählt das Team, das nicht zuletzt dran war.
* Liefert null, wenn es für das Format zu wenige Maps gibt.
*/
export function generateFlow(mapCount, format) {
const bestOf = BEST_OF[format];
if (!bestOf || mapCount < Math.max(bestOf, 2)) return null;
const picks = bestOf - 1;
const bans = mapCount - bestOf;
const before = Math.min(2, bans);
const steps = [];
let actor = 'X';
const next = () => {
const current = actor;
actor = actor === 'X' ? 'Y' : 'X';
return current;
};
for (let i = 0; i < before; i += 1) steps.push(`ban:${next()}`);
for (let i = 0; i < picks; i += 1) {
const picker = next();
steps.push(`pick:${picker}`, `side:${picker === 'X' ? 'Y' : 'X'}`);
}
for (let i = before; i < bans; i += 1) steps.push(`ban:${next()}`);
steps.push('decider', `side:${actor}`);
return steps;
}
function teamFor(actor, firstTeam) {
const second = firstTeam === 'A' ? 'B' : 'A';
return actor === 'X' ? firstTeam : second;