'use client'; import { useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { nexusEmperorRevivalAction } from '@/game/nexus-emperor-secret-ally-options'; import { Button } from '@/components/ui/button'; export function NexusEmperorSecretAlly({ game, act, busy, }: { game: GameView; act: (action: Action) => void; busy: boolean; }) { const [selectedElite, setSelectedElite] = useState(null); const offer = game.nexusEmperorSecretAlly; const owner = game.players.find((player) => player.id === game.me); const emperorSeated = game.players.some((player) => player.faction === 'emperor'); const eligible = offer?.revival && game.nexusCards?.card === 'emperor' && !!owner && !owner.ally && !emperorSeated && game.status === 'playing' && game.phase === 4 && !game.response && !game.decision && !game.truthtrance && !game.phaseOpening && !game.automaticContinuationPending && game.nexusCards.waiting.length === 0 && !game.nexusTraitors?.pending; if (!eligible) return null; const options = offer.revival.eliteOptions; const elite = options.length === 1 ? options[0] : selectedElite !== null && options.includes(selectedElite) ? selectedElite : null; const action = elite === null ? null : nexusEmperorRevivalAction(game, elite); const blocked = busy || !action; return (

Emperor Secret Ally

Spend the Emperor Nexus card to revive 3 additional forces for free, beyond your ordinary revival quota. The elite cap still applies.

{offer.revival.blocked &&

{offer.revival.blocked}

} {options.length > 1 && ( )}
); }