'use client'; import { useId, useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { CardInspector, CardRules } from './card-inspector'; import { DistransTransferAction } from './distrans-transfer-action'; export function Distrans({ game, act, busy, }: { game: GameView; act: (action: Action) => void; busy: boolean; }) { const id = useId(); const [target, setTarget] = useState(''); const [selection, setSelection] = useState(''); const distrans = game.distrans; if (!distrans) return null; const choice = distrans.choices.find((candidate) => candidate.recipient === target) ?? distrans.choices.find( (candidate) => !candidate.blocked && candidate.cards.length > 0, ) ?? distrans.choices[0]; const recipient = game.players.find( (player) => player.id === choice?.recipient, ); const given = choice?.cards.find((card) => card.id === selection) ?? choice?.cards[0]; const reason = distrans.blocked ?? choice?.blocked ?? (!choice ? 'No recipient is available.' : !given ? 'No other card is available to transfer to this player.' : null); return (
Distrans: transfer a card

Give one other card from your hand to another player with room, then discard Distrans. No spice is paid. The transfer happens immediately, without a recipient confirmation or Karama response.

Provisional bid timing: you may transfer between completed bid actions on a supported ordinary, Once Around, Silent or normal Black Market lot. A pending auction decision or other interaction may still limit the choices available.

{choice && ( <> {choice.cards.length > 0 && ( <> {given && (
)} )} )} {reason && (

{reason}

)} {!!choice?.unavailable.length && (

Your cards unavailable for this transfer

    {choice.unavailable.map(({ card, reason: blocked }) => (
  • {card.name}

    {blocked}

  • ))}
)}
); }