'use client'; import type { Action } from '@/game/engine'; import { Button } from './ui/button'; /** The same public opportunity is shown regardless of the Emperor's spice. */ export type EmperorExtortionPriorityView = { event: string; recipient: string; canContinue: boolean; }; export type EmperorExtortionPriorityProps = { game: { emperorExtortionPriority: EmperorExtortionPriorityView | null; players: readonly { id: string; name: string }[]; }; act: (action: Action) => void; busy: boolean; }; /** The payer's normal Extortion choice remains pending until the Emperor * completes this optional alliance opportunity. */ export function EmperorExtortionPriority({ game, act, busy }: EmperorExtortionPriorityProps) { const priority = game.emperorExtortionPriority; if (!priority) return null; const event = priority.event; const recipient = game.players.find(player => player.id === priority.recipient)?.name ?? 'the ally'; const canAct = () => !busy && game.emperorExtortionPriority === priority && priority.event === event && typeof event === 'string' && event.length > 0 && priority.canContinue; return

Emperor alliance opportunity

Before {recipient} makes the Extortion choice, the Emperor may share spice with their ally. The existing gift control shows any available amount.

{priority.canContinue ? :

Waiting for the Emperor to continue.

}
; }