'use client'; import { useId, useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { Button } from './ui/button'; import { CardInspector, CardRules } from './card-inspector'; export function RicheseSpecialKarama({ game, act, busy, }: { game: GameView; act: (action: Action) => void; busy: boolean; }) { const id = useId(); const [activation, setActivation] = useState(''); const [selection, setSelection] = useState(''); const purchase = game.richeseSpecialKarama; if (!purchase) return null; const me = game.players.find(player => player.id === game.me); const karama = purchase.karamas.find((card) => card.id === activation) ?? purchase.karamas[0]; const acquired = purchase.cards.find((card) => card.id === selection) ?? purchase.cards[0]; const payee = purchase.payee ? (game.players.find((player) => player.id === purchase.payee)?.name ?? 'Emperor') : 'the Spice Bank'; const reason = purchase.blocked ?? (!karama ? 'You need an available Karama card.' : !acquired ? 'No cache card is available for this purchase.' : null); return (
Richese special Karama: buy from your cache

Spend a Karama and 3 of your spice to secretly choose a cache card for your hand. This uses your once-per-game special power. Payment goes to{' '} {payee}.

The special purchase cannot be canceled by Karama. Emperor income has its separate response. The remaining Richese card effects are still being implemented; inspect a card before choosing it.

{me && me.hand?.length === me.handLimit && (

Provisional full-hand exchange: spending the held Karama frees the slot for one cache card in this action, leaving the final hand at its limit. The acquisition/discard timing is not an adjudicated publisher ruling. The final cache card may be acquired under the resolved exhausted-cache rule.

)} {purchase.karamas.length > 0 && ( <> {karama && } )} {purchase.cards.length > 0 && ( <> {acquired && (
)} )} {reason && (

{reason}

)}
); }