Production: 1 Mega per 4 staffed factories. Choices stay hidden until everyone has confirmed.
+ {#if store.autoMegaOverLimit}
+ Auto Megas paused: production exceeds your hand limit. Choose this round.
+ {/if}
{#each Object.entries(store.megaEligible) as [resource, groups] (resource)}
{@const mega = MEGA_CARDS[resource as keyof typeof MEGA_CARDS]}
{@const taking = store.megaTake[resource] ?? 0}
@@ -370,7 +373,7 @@
disabled={!store.canEditSettings}
>
-
+
diff --git a/packages/viewer/src/lib/store.svelte.ts b/packages/viewer/src/lib/store.svelte.ts
index 4fec841..d47c87b 100644
--- a/packages/viewer/src/lib/store.svelte.ts
+++ b/packages/viewer/src/lib/store.svelte.ts
@@ -24,6 +24,7 @@ import {
operators as availableOperators,
populationCost,
populationMax,
+ productionExceedsHandCapacity,
rankings,
replay as replayEngine,
robotMax,
@@ -280,9 +281,14 @@ export class ViewerStore {
private automaticMegaRound = "";
+ get autoMegaOverLimit(): boolean {
+ return this.autoMega === "maximum" && !!this.me && productionExceedsHandCapacity(this.me);
+ }
+
submitAutomaticMega(): void {
if (
this.editingChoice ||
+ this.autoMegaOverLimit ||
!this.canEditSettings ||
!this.myMega ||
!["maximum", "singles"].includes(this.autoMega)
diff --git a/packages/viewer/src/localization/da.json b/packages/viewer/src/localization/da.json
index c950bab..aadb2e9 100644
--- a/packages/viewer/src/localization/da.json
+++ b/packages/viewer/src/localization/da.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} bekræfter sit produktionsvalg",
"Automatic production choice": "Automatisk produktionsvalg",
"Ask each round": "Spørg hver runde",
- "Always take maximum Megas": "Tag altid flest mulige Mega",
"Always take singles": "Tag altid enkeltkort",
"Automatically submits each round, including this round if you haven't chosen yet.": "Bekræfter automatisk hver runde, også denne, hvis du ikke har valgt endnu.",
"Megas: ask each round": "Mega: spørg hver runde",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} tabt (ingen byttepenge).",
"These cards can buy {p0}. Buy fewer anyway?": "Disse kort kan købe {p0}. Køb færre alligevel?",
"Buy {p0} anyway · ◈ {p1}": "Køb {p0} alligevel · ◈ {p1}",
- "Undo my move": "Fortryd mit træk"
+ "Undo my move": "Fortryd mit træk",
+ "Maximum Megas (ask if over limit)": "Flest mulige Megaer (spørg ved håndgrænsen)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatiske Megaer sat på pause: Produktionen overskrider din håndgrænse. Vælg for denne runde."
}
diff --git a/packages/viewer/src/localization/de.json b/packages/viewer/src/localization/de.json
index 85b146a..5ae3c74 100644
--- a/packages/viewer/src/localization/de.json
+++ b/packages/viewer/src/localization/de.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} bestätigt die Produktionsentscheidung",
"Automatic production choice": "Automatische Produktionswahl",
"Ask each round": "Jede Runde fragen",
- "Always take maximum Megas": "Immer die meisten Megas nehmen",
"Always take singles": "Immer Einzelkarten nehmen",
"Automatically submits each round, including this round if you haven't chosen yet.": "Bestätigt automatisch jede Runde, auch diese, falls du noch nicht gewählt hast.",
"Megas: ask each round": "Megas: jede Runde fragen",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} verloren (kein Wechselgeld).",
"These cards can buy {p0}. Buy fewer anyway?": "Diese Karten reichen für {p0}. Trotzdem weniger kaufen?",
"Buy {p0} anyway · ◈ {p1}": "{p0} trotzdem kaufen · ◈ {p1}",
- "Undo my move": "Zug zurücknehmen"
+ "Undo my move": "Zug zurücknehmen",
+ "Maximum Megas (ask if over limit)": "Maximale Megas (bei Handlimit nachfragen)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Auto-Megas pausiert: Die Produktion überschreitet dein Handlimit. Wähle für diese Runde."
}
diff --git a/packages/viewer/src/localization/el.json b/packages/viewer/src/localization/el.json
index 29519fc..3545c95 100644
--- a/packages/viewer/src/localization/el.json
+++ b/packages/viewer/src/localization/el.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} κλειδώνει την επιλογή παραγωγής",
"Automatic production choice": "Αυτόματη επιλογή παραγωγής",
"Ask each round": "Ερώτηση κάθε γύρο",
- "Always take maximum Megas": "Πάντα ο μέγιστος αριθμός Mega",
"Always take singles": "Πάντα μονές κάρτες",
"Automatically submits each round, including this round if you haven't chosen yet.": "Υποβάλλει αυτόματα κάθε γύρο, συμπεριλαμβανομένου αυτού αν δεν έχεις επιλέξει ακόμα.",
"Megas: ask each round": "Mega: ερώτηση κάθε γύρο",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} χάνονται (χωρίς ρέστα).",
"These cards can buy {p0}. Buy fewer anyway?": "Αυτές οι κάρτες μπορούν να αγοράσουν {p0}. Αγορά λιγότερων ούτως ή άλλως;",
"Buy {p0} anyway · ◈ {p1}": "Αγορά {p0} ούτως ή άλλως · ◈ {p1}",
- "Undo my move": "Αναίρεση κίνησης"
+ "Undo my move": "Αναίρεση κίνησης",
+ "Maximum Megas (ask if over limit)": "Μέγιστα Mega (ερώτηση αν ξεπεραστεί το όριο)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Τα αυτόματα Mega τέθηκαν σε παύση: η παραγωγή υπερβαίνει το όριο καρτών σας. Επιλέξτε για αυτόν τον γύρο."
}
diff --git a/packages/viewer/src/localization/en.json b/packages/viewer/src/localization/en.json
index 6b19385..3b5db5d 100644
--- a/packages/viewer/src/localization/en.json
+++ b/packages/viewer/src/localization/en.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} locks in their production choice",
"Automatic production choice": "Automatic production choice",
"Ask each round": "Ask each round",
- "Always take maximum Megas": "Always take maximum Megas",
"Always take singles": "Always take singles",
"Automatically submits each round, including this round if you haven't chosen yet.": "Automatically submits each round, including this round if you haven't chosen yet.",
"Megas: ask each round": "Megas: ask each round",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} lost (no change).",
"These cards can buy {p0}. Buy fewer anyway?": "These cards can buy {p0}. Buy fewer anyway?",
"Buy {p0} anyway · ◈ {p1}": "Buy {p0} anyway · ◈ {p1}",
- "Undo my move": "Undo my move"
+ "Undo my move": "Undo my move",
+ "Maximum Megas (ask if over limit)": "Maximum Megas (ask if over limit)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Auto Megas paused: production exceeds your hand limit. Choose this round."
}
diff --git a/packages/viewer/src/localization/fa.json b/packages/viewer/src/localization/fa.json
index 88f8cc8..44e7088 100644
--- a/packages/viewer/src/localization/fa.json
+++ b/packages/viewer/src/localization/fa.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} انتخاب تولید خود را ثبت میکند",
"Automatic production choice": "انتخاب خودکار تولید",
"Ask each round": "در هر دور بپرس",
- "Always take maximum Megas": "همیشه بیشترین مگا را بگیر",
"Always take singles": "همیشه کارتهای تکی بگیر",
"Automatically submits each round, including this round if you haven't chosen yet.": "در هر دور خودکار تأیید میکند؛ اگر هنوز انتخاب نکردهاید، این دور را هم شامل میشود.",
"Megas: ask each round": "مگا: در هر دور بپرس",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} از دست میرود (بدون باقیمانده).",
"These cards can buy {p0}. Buy fewer anyway?": "این کارتها برای خرید {p0} کافیاند. باز هم کمتر بخرید؟",
"Buy {p0} anyway · ◈ {p1}": "به هر حال {p0} بخرید · ◈ {p1}",
- "Undo my move": "بازگرداندن حرکت"
+ "Undo my move": "بازگرداندن حرکت",
+ "Maximum Megas (ask if over limit)": "بیشترین مگا (پرسش در صورت عبور از حد دست)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "انتخاب خودکار مگا متوقف شد: تولید از حد کارتهای دست شما بیشتر است. برای این دور انتخاب کنید."
}
diff --git a/packages/viewer/src/localization/fr.json b/packages/viewer/src/localization/fr.json
index 0b7ae53..4c6365f 100644
--- a/packages/viewer/src/localization/fr.json
+++ b/packages/viewer/src/localization/fr.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} confirme son choix de production",
"Automatic production choice": "Choix automatique de production",
"Ask each round": "Demander à chaque manche",
- "Always take maximum Megas": "Toujours prendre le maximum de Mégas",
"Always take singles": "Toujours prendre des cartes simples",
"Automatically submits each round, including this round if you haven't chosen yet.": "Valide automatiquement à chaque manche, y compris celle-ci si vous n’avez pas encore choisi.",
"Megas: ask each round": "Mégas : demander à chaque manche",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} perdus (pas de monnaie).",
"These cards can buy {p0}. Buy fewer anyway?": "Ces cartes peuvent acheter {p0}. En acheter moins quand même ?",
"Buy {p0} anyway · ◈ {p1}": "Acheter {p0} quand même · ◈ {p1}",
- "Undo my move": "Annuler mon coup"
+ "Undo my move": "Annuler mon coup",
+ "Maximum Megas (ask if over limit)": "Maximum de Megas (demander si limite dépassée)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Megas automatiques en pause : la production dépasse votre limite de main. Choisissez pour ce tour."
}
diff --git a/packages/viewer/src/localization/hi.json b/packages/viewer/src/localization/hi.json
index 92f4042..5fc2f72 100644
--- a/packages/viewer/src/localization/hi.json
+++ b/packages/viewer/src/localization/hi.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} अपना उत्पादन विकल्प तय करता है",
"Automatic production choice": "स्वचालित उत्पादन विकल्प",
"Ask each round": "हर दौर में पूछें",
- "Always take maximum Megas": "हमेशा अधिकतम मेगा लें",
"Always take singles": "हमेशा सामान्य कार्ड लें",
"Automatically submits each round, including this round if you haven't chosen yet.": "हर दौर में अपने आप जमा करता है, इस दौर में भी यदि आपने अभी तक नहीं चुना है।",
"Megas: ask each round": "मेगा: हर दौर में पूछें",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} खोए (बाकी नहीं मिलता)।",
"These cards can buy {p0}. Buy fewer anyway?": "इन कार्डों से {p0} खरीद सकते हैं। फिर भी कम खरीदें?",
"Buy {p0} anyway · ◈ {p1}": "फिर भी {p0} खरीदें · ◈ {p1}",
- "Undo my move": "अपनी चाल वापस लें"
+ "Undo my move": "अपनी चाल वापस लें",
+ "Maximum Megas (ask if over limit)": "अधिकतम मेगा (सीमा पार होने पर पूछें)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "स्वचालित मेगा चयन रुका है: उत्पादन से हाथ में कार्ड की सीमा पार हो जाएगी। इस दौर के लिए चुनें।"
}
diff --git a/packages/viewer/src/localization/it.json b/packages/viewer/src/localization/it.json
index 1990a40..1248902 100644
--- a/packages/viewer/src/localization/it.json
+++ b/packages/viewer/src/localization/it.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} conferma la propria scelta di produzione",
"Automatic production choice": "Scelta automatica della produzione",
"Ask each round": "Chiedi a ogni round",
- "Always take maximum Megas": "Prendi sempre il massimo di Mega",
"Always take singles": "Prendi sempre carte singole",
"Automatically submits each round, including this round if you haven't chosen yet.": "Conferma automaticamente ogni round, incluso questo se non hai ancora scelto.",
"Megas: ask each round": "Mega: chiedi a ogni round",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} persi (nessun resto).",
"These cards can buy {p0}. Buy fewer anyway?": "Queste carte possono comprare {p0}. Comprarne comunque meno?",
"Buy {p0} anyway · ◈ {p1}": "Compra comunque {p0} · ◈ {p1}",
- "Undo my move": "Annulla la mossa"
+ "Undo my move": "Annulla la mossa",
+ "Maximum Megas (ask if over limit)": "Massimo di Mega (chiedi oltre il limite)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Mega automatiche in pausa: la produzione supera il limite della mano. Scegli per questo turno."
}
diff --git a/packages/viewer/src/localization/ko.json b/packages/viewer/src/localization/ko.json
index b70f0b6..be2f85a 100644
--- a/packages/viewer/src/localization/ko.json
+++ b/packages/viewer/src/localization/ko.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} 님이 생산 선택을 확정합니다",
"Automatic production choice": "자동 생산 선택",
"Ask each round": "매 라운드 묻기",
- "Always take maximum Megas": "항상 메가 최대 수량 선택",
"Always take singles": "항상 일반 카드 선택",
"Automatically submits each round, including this round if you haven't chosen yet.": "아직 선택하지 않았다면 이번 라운드를 포함하여 매 라운드 자동으로 확정합니다.",
"Megas: ask each round": "메가: 매 라운드 묻기",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} 손실 (거스름돈 없음).",
"These cards can buy {p0}. Buy fewer anyway?": "이 카드로 {p0} 구매 가능. 그래도 더 적게 구매할까요?",
"Buy {p0} anyway · ◈ {p1}": "그래도 {p0} 구매 · ◈ {p1}",
- "Undo my move": "내 수 되돌리기"
+ "Undo my move": "내 수 되돌리기",
+ "Maximum Megas (ask if over limit)": "최대 메가 (한도 초과 시 확인)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "메가 자동 선택 일시 중지: 생산량이 손패 한도를 초과합니다. 이번 라운드의 생산 방식을 선택하세요."
}
diff --git a/packages/viewer/src/localization/nl.json b/packages/viewer/src/localization/nl.json
index 47303aa..4e0d3ef 100644
--- a/packages/viewer/src/localization/nl.json
+++ b/packages/viewer/src/localization/nl.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} bevestigt de productiekeuze",
"Automatic production choice": "Automatische productiekeuze",
"Ask each round": "Elke ronde vragen",
- "Always take maximum Megas": "Altijd het maximale aantal Mega’s nemen",
"Always take singles": "Altijd losse kaarten nemen",
"Automatically submits each round, including this round if you haven't chosen yet.": "Bevestigt automatisch elke ronde, ook deze als je nog niet hebt gekozen.",
"Megas: ask each round": "Mega’s: elke ronde vragen",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} verloren (geen wisselgeld).",
"These cards can buy {p0}. Buy fewer anyway?": "Deze kaarten kunnen {p0} kopen. Toch minder kopen?",
"Buy {p0} anyway · ◈ {p1}": "Koop toch {p0} · ◈ {p1}",
- "Undo my move": "Zet ongedaan maken"
+ "Undo my move": "Zet ongedaan maken",
+ "Maximum Megas (ask if over limit)": "Maximale Mega’s (vragen bij overschrijding)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatische Mega’s gepauzeerd: de productie overschrijdt je handlimiet. Kies voor deze ronde."
}
diff --git a/packages/viewer/src/localization/pl.json b/packages/viewer/src/localization/pl.json
index ee1f8fe..c67661c 100644
--- a/packages/viewer/src/localization/pl.json
+++ b/packages/viewer/src/localization/pl.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} zatwierdza wybór produkcji",
"Automatic production choice": "Automatyczny wybór produkcji",
"Ask each round": "Pytaj w każdej rundzie",
- "Always take maximum Megas": "Zawsze bierz maksymalną liczbę Mega",
"Always take singles": "Zawsze bierz pojedyncze karty",
"Automatically submits each round, including this round if you haven't chosen yet.": "Zatwierdza automatycznie w każdej rundzie, również bieżącej, jeśli jeszcze nie wybrano.",
"Megas: ask each round": "Mega: pytaj w każdej rundzie",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} stracone (bez reszty).",
"These cards can buy {p0}. Buy fewer anyway?": "Te karty wystarczą na {p0}. Mimo to kupić mniej?",
"Buy {p0} anyway · ◈ {p1}": "Kup {p0} mimo to · ◈ {p1}",
- "Undo my move": "Cofnij ruch"
+ "Undo my move": "Cofnij ruch",
+ "Maximum Megas (ask if over limit)": "Maksimum Mega (zapytaj po przekroczeniu limitu)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Automatyczny wybór Mega wstrzymany: produkcja przekracza limit kart w ręce. Wybierz w tej rundzie."
}
diff --git a/packages/viewer/src/localization/pt-BR.json b/packages/viewer/src/localization/pt-BR.json
index 13b3539..98a8ffd 100644
--- a/packages/viewer/src/localization/pt-BR.json
+++ b/packages/viewer/src/localization/pt-BR.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} confirma sua escolha de produção",
"Automatic production choice": "Escolha automática de produção",
"Ask each round": "Perguntar a cada rodada",
- "Always take maximum Megas": "Sempre pegar o máximo de Megas",
"Always take singles": "Sempre pegar cartas simples",
"Automatically submits each round, including this round if you haven't chosen yet.": "Confirma automaticamente a cada rodada, incluindo esta se você ainda não escolheu.",
"Megas: ask each round": "Megas: perguntar a cada rodada",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} perdidos (sem troco).",
"These cards can buy {p0}. Buy fewer anyway?": "Estas cartas podem comprar {p0}. Comprar menos mesmo assim?",
"Buy {p0} anyway · ◈ {p1}": "Comprar {p0} mesmo assim · ◈ {p1}",
- "Undo my move": "Desfazer jogada"
+ "Undo my move": "Desfazer jogada",
+ "Maximum Megas (ask if over limit)": "Máximo de Megas (perguntar se exceder o limite)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Megas automáticas pausadas: a produção excede seu limite de mão. Escolha nesta rodada."
}
diff --git a/packages/viewer/src/localization/ro.json b/packages/viewer/src/localization/ro.json
index ed75f1b..0b64125 100644
--- a/packages/viewer/src/localization/ro.json
+++ b/packages/viewer/src/localization/ro.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} confirmă alegerea producției",
"Automatic production choice": "Alegere automată a producției",
"Ask each round": "Întreabă în fiecare rundă",
- "Always take maximum Megas": "Ia întotdeauna numărul maxim de Mega",
"Always take singles": "Ia întotdeauna cărți simple",
"Automatically submits each round, including this round if you haven't chosen yet.": "Confirmă automat în fiecare rundă, inclusiv aceasta dacă nu ai ales încă.",
"Megas: ask each round": "Mega: întreabă în fiecare rundă",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} pierdute (fără rest).",
"These cards can buy {p0}. Buy fewer anyway?": "Aceste cărți pot cumpăra {p0}. Cumperi totuși mai puțin?",
"Buy {p0} anyway · ◈ {p1}": "Cumpără totuși {p0} · ◈ {p1}",
- "Undo my move": "Anulează mutarea"
+ "Undo my move": "Anulează mutarea",
+ "Maximum Megas (ask if over limit)": "Maximum de Mega (întreabă dacă depășești limita)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Alegerea automată a cărților Mega este oprită: producția depășește limita mâinii. Alege pentru această rundă."
}
diff --git a/packages/viewer/src/localization/ru.json b/packages/viewer/src/localization/ru.json
index b54ac1f..ecb4bdb 100644
--- a/packages/viewer/src/localization/ru.json
+++ b/packages/viewer/src/localization/ru.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} подтверждает выбор производства",
"Automatic production choice": "Автоматический выбор производства",
"Ask each round": "Спрашивать каждый раунд",
- "Always take maximum Megas": "Всегда брать максимум Мега",
"Always take singles": "Всегда брать обычные карты",
"Automatically submits each round, including this round if you haven't chosen yet.": "Подтверждает автоматически каждый раунд, включая текущий, если вы ещё не выбрали.",
"Megas: ask each round": "Мега: спрашивать каждый раунд",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "◈ {p0} потеряно (без сдачи).",
"These cards can buy {p0}. Buy fewer anyway?": "Этих карт хватит на {p0}. Всё равно купить меньше?",
"Buy {p0} anyway · ◈ {p1}": "Всё равно купить {p0} · ◈ {p1}",
- "Undo my move": "Отменить ход"
+ "Undo my move": "Отменить ход",
+ "Maximum Megas (ask if over limit)": "Максимум Мега (спросить при превышении лимита)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Автовыбор Мега приостановлен: производство превышает лимит карт в руке. Сделайте выбор на этот раунд."
}
diff --git a/packages/viewer/src/localization/vi.json b/packages/viewer/src/localization/vi.json
index 6238bff..83b1c0f 100644
--- a/packages/viewer/src/localization/vi.json
+++ b/packages/viewer/src/localization/vi.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} chốt lựa chọn sản xuất",
"Automatic production choice": "Tự động chọn sản xuất",
"Ask each round": "Hỏi mỗi vòng",
- "Always take maximum Megas": "Luôn lấy số Mega tối đa",
"Always take singles": "Luôn lấy thẻ thường",
"Automatically submits each round, including this round if you haven't chosen yet.": "Tự động xác nhận mỗi vòng, kể cả vòng này nếu bạn chưa chọn.",
"Megas: ask each round": "Mega: hỏi mỗi vòng",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "Mất ◈ {p0} (không trả lại tiền thừa).",
"These cards can buy {p0}. Buy fewer anyway?": "Các thẻ này có thể mua {p0}. Vẫn mua ít hơn?",
"Buy {p0} anyway · ◈ {p1}": "Vẫn mua {p0} · ◈ {p1}",
- "Undo my move": "Hoàn tác nước đi"
+ "Undo my move": "Hoàn tác nước đi",
+ "Maximum Megas (ask if over limit)": "Tối đa Mega (hỏi nếu vượt giới hạn)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "Tạm dừng tự chọn Mega: sản xuất vượt giới hạn bài trên tay. Hãy chọn cho vòng này."
}
diff --git a/packages/viewer/src/localization/zh-TW.json b/packages/viewer/src/localization/zh-TW.json
index 65a5321..4209773 100644
--- a/packages/viewer/src/localization/zh-TW.json
+++ b/packages/viewer/src/localization/zh-TW.json
@@ -1185,7 +1185,6 @@
"{p0} locks in their production choice": "{p0} 確認了生產選擇",
"Automatic production choice": "自動選擇生產方式",
"Ask each round": "每回合詢問",
- "Always take maximum Megas": "一律選擇最多 Mega 卡",
"Always take singles": "一律選擇普通卡",
"Automatically submits each round, including this round if you haven't chosen yet.": "每回合自動確認,若本回合尚未選擇,也會自動確認。",
"Megas: ask each round": "Mega:每回合詢問",
@@ -1213,5 +1212,7 @@
"◈ {p0} lost (no change).": "損失 ◈ {p0}(不找零)。",
"These cards can buy {p0}. Buy fewer anyway?": "這些卡牌可購買 {p0}。仍要買更少嗎?",
"Buy {p0} anyway · ◈ {p1}": "仍然購買 {p0} · ◈ {p1}",
- "Undo my move": "撤回我的行動"
+ "Undo my move": "撤回我的行動",
+ "Maximum Megas (ask if over limit)": "最多 Mega(超過手牌上限時詢問)",
+ "Auto Megas paused: production exceeds your hand limit. Choose this round.": "已暫停自動選擇 Mega:本輪產出將超過手牌上限。請選擇本輪的生產方式。"
}
diff --git a/tests/mega-automation-browser.mjs b/tests/mega-automation-browser.mjs
new file mode 100644
index 0000000..657d1ee
--- /dev/null
+++ b/tests/mega-automation-browser.mjs
@@ -0,0 +1,114 @@
+import assert from "node:assert/strict";
+import { chromium } from "playwright";
+import { previewServer } from "./tutorial-preview.mjs";
+import { initGame } from "../packages/engine/dist/index.js";
+import { stripSecret } from "../packages/engine/dist/wrapper.js";
+
+function production(overLimit = true) {
+ const state = initGame(3, {}, "mega-limit");
+ state.phase = "mega";
+ state.players[0].hand = overLimit
+ ? [
+ { t: "water", v: 30, m: true },
+ { t: "titanium", v: 44, m: true },
+ ]
+ : Array.from({ length: 6 }, () => ({ t: "ore", v: 3 }));
+ state.players[0].pendingMega = [6, 7, 8, 9].map((v) => ({ t: "water", v }));
+ state.players[0].megaGroups = { water: 1 };
+ return stripSecret(state, 0);
+}
+
+async function launch(page, state, autoMega, locale) {
+ await page.evaluate(
+ ({ state, autoMega, locale }) => {
+ window.emitter = outpost.launch("#app");
+ window.sentMoves = [];
+ emitter.on("move", (move) => sentMoves.push(move));
+ emitter.emit("preferences", { locale, sound: false });
+ emitter.emit("player", { index: 0 });
+ emitter.emit("settings", { autoMega });
+ emitter.emit("state", state);
+ },
+ { state, autoMega, locale }
+ );
+}
+
+const server = previewServer();
+await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+const browser = await chromium.launch({ executablePath: process.env.OUTPOST_CHROMIUM_EXECUTABLE });
+try {
+ for (const width of [390, 1400]) {
+ for (const locale of ["en", "fr"]) {
+ const page = await browser.newPage({ viewport: { width, height: 950 } });
+ const errors = [];
+ page.on("pageerror", (error) => errors.push(error.message));
+ await page.setContent('');
+ await page.addStyleTag({ path: "packages/viewer/dist/outpost-viewer.css" });
+ await page.addScriptTag({ url: `http://127.0.0.1:${server.address().port}/bundle.js` });
+ const warning = page.locator(".mega-flow .warn");
+ const confirm = page.locator(".mega-flow .confirm");
+
+ await launch(page, production(), "maximum", locale);
+ await warning
+ .filter({ hasText: locale === "en" ? "Auto Megas paused" : "Megas automatiques en pause" })
+ .waitFor();
+ await page.waitForTimeout(200);
+ assert.deepEqual(await page.evaluate(() => sentMoves), [], "overflow does not submit automatically");
+ assert.equal(await page.locator(".mega-setting select").inputValue(), "maximum");
+ assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false);
+ await confirm.click();
+ assert.deepEqual(
+ await page.evaluate(() => sentMoves),
+ [{ action: "mega", take: {} }],
+ "singles remain a manual choice"
+ );
+ const next = production(false);
+ next.round++;
+ next.log.push({ type: "move", player: 0, move: { action: "mega", take: {} } });
+ await page.evaluate((state) => {
+ emitter.emit("move:result", { move: { action: "mega", take: {} }, ok: true });
+ emitter.emit("state", state);
+ }, next);
+ await page.waitForFunction(() => sentMoves.length === 2);
+ assert.deepEqual(
+ await page.evaluate(() => sentMoves[1]),
+ { action: "mega", take: { water: 1 } },
+ "automation resumes next round at the limit"
+ );
+
+ await launch(page, production(), "maximum", locale);
+ await warning.waitFor();
+ await page.locator(".mega-stepper button").last().click();
+ await confirm.click();
+ assert.deepEqual(
+ await page.evaluate(() => sentMoves),
+ [{ action: "mega", take: { water: 1 } }],
+ "manual Megas are still allowed"
+ );
+
+ await launch(page, production(), "maximum", locale);
+ await warning.waitFor();
+ await page.evaluate(() => emitter.emit("settings", { autoMega: "singles" }));
+ await page.waitForFunction(() => sentMoves.length === 1);
+ assert.deepEqual(
+ await page.evaluate(() => sentMoves),
+ [{ action: "mega", take: {} }],
+ "singles automation still works when over limit"
+ );
+
+ await launch(page, production(false), "ask", locale);
+ await confirm.waitFor();
+ await page.waitForTimeout(200);
+ assert.deepEqual(await page.evaluate(() => sentMoves), [], "manual preference is respected");
+ assert.equal(await warning.count(), 0);
+ assert.deepEqual(errors, []);
+ await page.close();
+ }
+ }
+ console.log(
+ "Mega automation: overflow pause, manual choices, settings changes, and next-round resumption passed on mobile/desktop in English/French."
+ );
+} finally {
+ await browser.close();
+ await new Promise((resolve) => server.close(resolve));
+}