'use client';
import type { Action, GameView } from '@/game/engine';
import { ecazOccupyLeadOptions, ecazOccupyPlanControl } from '@/game/ecaz-occupy-options';
import { Button } from './ui/button';
export function EcazOccupyLeadChoice({ game, act, busy }: {
game: GameView;
act: (action: Action) => void;
busy: boolean;
}) {
const options = ecazOccupyLeadOptions(game);
const occupy = game.battle?.ecazOccupy;
if (!occupy || !options.length) return null;
const decision = game.decision?.kind === 'ecazBattleLead' ? game.decision : null;
const chooser = game.players.find((player) => player.id === decision?.player)?.name ?? decision?.player ?? 'The current chooser';
const ecaz = game.players.find((player) => player.id === occupy.ecaz)?.name ?? 'Ecaz';
const ally = game.players.find((player) => player.id === occupy.ally)?.name ?? 'Ecaz’s ally';
return
{chooser} chooses who forms the plan. The lead uses their own leaders,
Treachery cards and spice. With Occupy active, {ally} supplies the variable
dialed army regardless of who leads; Ecaz’s contribution is mandatory and free.
{ecaz} was at Low population when this battle opened, so its Homeworld penalty gives the opponent this choice.
Basic prototype: Ecaz’s half-force contribution and winning losses round up;
survivors round down. The main printed rule is used provisionally because
its odd-force FAQ example conflicts.
Karama may cancel Occupy after this choice, before battle powers and plans.
The chosen lead then dials only their own army; the other ally contributes zero.
{option.blocked} {lead} forms the plan, chooses their leaders and cards, and pays any spice support.
Occupy canceled: {forceOwner} dials their own army. {other} contributes zero;
there is no fixed Ecaz strength. Co-occupancy permission is unchanged.
The variable dial uses {forceOwner}’s army, including its native force properties.
The total dial must include {profile.fixedEcazDial} fixed Ecaz strength at full strength,
with no spice cost, plus the chosen variable army strength.
Provisional Basic rounding: {profile.fixedEcazDial} Ecaz
counters contribute and are lost on an ordinary win; the remainder survive.
Allow this power to keep the combined army, or use an eligible Karama below.
Cancellation keeps {lead} as lead and replaces the variable army with {lead}’s own forces before planning.
Total dial {dial} = fixed Ecaz {control.fixedEcazDial} + {forceOwner}’s variable strength{' '} {control.variableDial ?? '—'}. Spice support applies only to the variable army. Your personal spice: {control.personalSpice}. Current legal support budget: {control.supportMaximum}.
{control.blocked && }