'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.

{decision?.lowEcaz &&

{ecaz} was at Low population when this battle opened, so its Homeworld penalty gives the opponent this choice.

} {!game.advanced &&

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.

{options.map((option) =>
{option.blocked &&

{option.blocked}

}
)}
; } /** Public owner labels belong above the existing native plan/power editor. */ export function EcazOccupyBattleSummary({ game }: { game: GameView }) { const occupy = game.battle?.ecazOccupy; const profile = occupy?.profile; if (!occupy || !profile) return null; const lead = game.players.find((player) => player.id === profile.planOwner)?.name ?? profile.planOwner; const forceOwner = game.players.find((player) => player.id === profile.forceOwner)?.name ?? profile.forceOwner; const other = game.players.find((player) => player.id === (profile.lead === profile.ecaz ? profile.ally : profile.ecaz))?.name ?? 'The other ally'; return

{lead} forms the plan, chooses their leaders and cards, and pays any spice support.

{profile.canceled ?

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.

} {!game.advanced && !profile.canceled && profile.ecazForces.normal % 2 !== 0 &&

Provisional Basic rounding: {profile.fixedEcazDial} Ecaz counters contribute and are lost on an ordinary win; the remainder survive.

} {game.response?.kind === 'ecazOccupy' &&

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.

}
; } /** Render next to the native total wheel/support input, not a second plan editor. */ export function EcazOccupyDialExplanation({ game, dial, support }: { game: GameView; dial: number; support: number; }) { const control = ecazOccupyPlanControl(game, dial, support); if (!control) return null; const forceOwner = game.players.find((player) => player.id === control.profile.forceOwner)?.name ?? control.profile.forceOwner; return

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 && {control.blocked}}
; }