'use client'; import { useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { TERROR_DEFINITIONS } from '@/game/moritani-terror'; import { grummanCollectionCanAct, grummanCollectionChoice, } from '@/game/grumman-collection-options'; import { Button } from './ui/button'; type Props = { game: GameView; act: (action: Action) => void; busy: boolean }; export function GrummanCollection({ game, act, busy }: Props) { if ( !game.grummanCollection || game.grummanCollection.player !== game.me || game.decision?.kind !== 'grummanCollection' || game.decision.player !== game.me ) return null; return ( ); } function CollectionChoice({ game, act, busy }: Props) { const offer = game.grummanCollection!; const initialMode = offer.blocked && !offer.removeBlocked ? 'remove' : 'add'; const [mode, setMode] = useState<'add' | 'remove'>(initialMode); const [token, setToken] = useState( (initialMode === 'remove' ? offer.removable : offer.tokens)[0]?.id ?? '', ); const [destination, setDestination] = useState(offer.destinations[0]?.id ?? ''); const [useCunning, setUseCunning] = useState(false); const canAct = grummanCollectionCanAct(game); const tokens = mode === 'remove' ? offer.removable : offer.tokens; const destinations = useCunning && offer.cunning ? offer.cunning.destinations : offer.destinations; const choice = grummanCollectionChoice(game, token, mode === 'add' ? destination : '', mode, useCunning); const disabled = busy || !canAct; return (

Add one available Terror token or return one unrevealed placed token to hidden supply to collect 4 spice. Only one completed operation pays this Collection; your separate Mentat placement remains unchanged.

{mode === 'add' && <> {offer.cunning && } {offer.cunning &&

Cunning requires an ordinary eligible supply addition at a stronghold already holding Terror. It spends the Nexus card, not your Mentat placement, and never permits relocation, Homeworlds or the Hidden Mobile Stronghold.

} } {mode === 'remove' &&

The token stays unrevealed and becomes reusable in hidden supply. Hidden supply identities rotate; other placed tokens remain where they are.

} {choice.blocked &&

{choice.blocked}

}
); }