'use client'; import { useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { faction } from '@/game/catalog'; import { leaderStrengthLabel } from '@/game/cards'; import { CHEAP_HERO_TRAITOR } from '@/game/traitors'; import { LeaderInspector, type LeaderDisplayIdentity } from './leader-inspector'; import { Button } from './ui/button'; function identity(game: GameView, id: string): LeaderDisplayIdentity | null { if (id === CHEAP_HERO_TRAITOR) return { name: 'Cheap Hero / Heroine', factionName: 'Any faction', strength: 0, cheapHero: true }; const leader = game.allLeaders.find((l) => l.id === id); return leader ? { id: leader.id, name: leader.name, factionName: faction(leader.faction).name, strength: leaderStrengthLabel(leader) } : null; } function Card({ game, id, faceDancer = false }: { game: GameView; id: string; faceDancer?: boolean }) { const card = identity(game, id); return card ?
Card identity unavailable.
; } export function RihaniHistory({ game }: { game: GameView }) { const history = game.rihani?.history; const faceDancer = game.players.find(p => p.id === game.me)?.faction === 'tleilaxu'; if (!history?.length) return null; returnA peek records the deck at that moment. Later draws can change who holds those cards.
{[...history].reverse().map((r) =>Turn {r.turn}
{r.peeked.length > 0 && <>Normal inspection — returned to the shuffled deck
{r.peeked.map((id) =>Separate skilled draw
{r.drawn.map((id) =>Kept {identity(game, r.kept)?.name}; revealed and returned {identity(game, r.given!)?.name}.
}You may draw two {cardName} Cards. Once drawn, you must keep one new card by publicly revealing and returning one {oldCard} card you already hold.
The other drawn card returns secretly. Your normal inspection, when available, has already returned its cards to the shuffled deck.
Keep one newly drawn card and reveal one {oldCard} card from your old hand. The revealed card and the other new card return to the shuffled deck.