'use client'; import type { Action, GameView } from '@/game/engine'; import { territory } from '@/game/board'; import { useState } from 'react'; import { Button } from './ui/button'; import { CardInspector } from './card-inspector'; function playerName(game: GameView, id: string) { return game.players.find((player) => player.id === id)?.name ?? id; } export function MentatQuestion({ game, act, busy, }: { game: GameView; act: (action: Action) => void; busy: boolean; }) { const [weapon, setWeapon] = useState(''); const pending = game.mentat?.pending; const decision = game.decision; if ( !pending || decision?.kind !== 'mentatQuestion' || decision.player !== game.me || decision.event !== pending.event || pending.player !== game.me || (pending.stage !== 'name' && pending.stage !== 'reveal') ) return null; const owner = playerName(game, pending.owner); const target = playerName(game, pending.target); if (pending.stage === 'name') return (

Ask the Mentat question

Name one specific weapon. {target} will privately show that card if it is held, or choose another card from their hand.

{pending.blocked &&

{pending.blocked}

} {pending.weapons.length > 0 && ( )}
); const namedCards = pending.cards.filter((card) => card.name === pending.weapon); const hasNamedCard = namedCards.length > 0; return (

Mentat card shown privately

{owner} named {pending.weapon}.{' '} {hasNamedCard ? 'Show the named card privately.' : 'Choose one card from your hand to show privately.'}{' '} The card stays in your hand.

{pending.blocked &&

{pending.blocked}

}
{pending.cards.map((card) => (

{card.name}

))}
); } export function MentatHistory({ game }: { game: GameView }) { const history = game.mentat?.history ?? []; if (!history.length) return null; return (

Your Mentat observations

These private observations were true when each question resolved. Later hand changes can make an observation stale.

{history.map((entry) => (

{entry.card.name}

Turn {entry.turn} · {territory(entry.territory).name} · {playerName(game, entry.owner)}{' '} asked {playerName(game, entry.target)} for {entry.weapon}.

))}
); }