'use client'; import { useId } from 'react'; import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'; import { Eye, X } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogDescription, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { HELP } from '@/game/reference'; import { LeaderPortrait } from './leader-portrait'; /** Supply only identity information this viewer is entitled to inspect. */ export type LeaderDisplayIdentity = Readonly< { id?: string; name: string; factionName: string } & ( | { cheapHero: true; strength: 0 } | { cheapHero?: false; strength: number | string } ) >; export type LeaderInspectorProps = { identity: LeaderDisplayIdentity; kind?: 'leader' | 'traitor' | 'faceDancer'; }; /** An original geometric medallion, not a portrait or a printed component reproduction. */ function IdentityMedallion({ traitor }: { traitor: boolean }) { const gradient = `${useId()}-seal`; return ( ); } /** Read-only: no game, catalog lookup, deck, session or action callback is accepted. */ export function LeaderInspector({ identity, kind = 'leader', }: LeaderInspectorProps) { const traitor = kind === 'traitor'; const faceDancer = kind === 'faceDancer'; const label = faceDancer ? 'Face Dancer' : kind; const cheapHero = identity.cheapHero === true; const description = faceDancer ? cheapHero ? 'This Face Dancer identity matches either Cheap Hero or Cheap Heroine used as the winning battle leader, regardless of the hero card’s name or the player’s faction.' : 'This Face Dancer identity matches the named winning leader. Tleilaxu can reveal an unrevealed match after that battle and its rewards are settled.' : traitor ? cheapHero ? 'This traitor identity matches either Cheap Hero or Cheap Heroine used as a battle leader, regardless of the hero card’s name or the player’s faction.' : 'This traitor card identifies the named leader. Holding it does not add that leader to your available battle leaders.' : cheapHero ? 'A Cheap Hero or Heroine can stand in for a leader in a battle plan. Its leader strength is zero.' : 'This identity shows the leader’s faction and strength. Battle powers can change the strength used in a battle.'; return ( } aria-label={`Inspect ${label}: ${identity.name}`} >
{label} inspection } >

{identity.factionName}

} /> {identity.name}
Leader strength
{identity.strength}

{faceDancer ? 'Face Dancer identity' : traitor ? 'Traitor identity' : 'Leader identity'}{' '} · gameplay guide

{description} {identity.id === 'choam-auditor' && (

Advanced CHOAM has this additional strength-2 leader and its matching traitor identity. It remains separate from the five ordinary leaders.

After using the Auditor in battle, CHOAM may inspect two random opposing hand cards if it survived, or one if it died. Exclude cards used in that battle. The opponent may pay CHOAM one spice per card actually available to cancel the entire inspection; partial cancellation is unavailable. Karama can prevent the audit.

The Auditor may use CHOAM’s one normal leader revival without waiting for all other leaders to enter the Tanks. It cannot be captured by Harkonnen, acquired as a Tleilaxu foreign ghola, or receive a leader skill. CHOAM may revive it with its own Ghola card.

)} {faceDancer ? ( <>

Inspection does not reveal a Face Dancer or replace forces. Use the table’s Face Dancer decision after another faction’s winning battle, losses, card choices and rewards have been resolved.

Return the winner’s surviving forces to reserves. Tleilaxu may replace up to that many with their own forces from reserves or the board. Send the winning leader to the tanks without another leader bounty; an already dead leader does not die again.

Kwisatz Haderach does not protect the accompanying leader from Face Dancing. Karama cannot cancel this reveal or the replacement forces.

Keep a revealed Face Dancer face up until all three have been used, then shuffle them back into the unused deck and draw three new identities. During Mentat Pause, one unrevealed Face Dancer may instead be exchanged once per turn; that exchange has a Karama response.

{cheapHero && (

Either hero can be the winning identity for Face Dancing. Its leader strength is zero; the hero treachery card and this Face Dancer identity remain separate components.

)} ) : traitor ? ( <>

Inspection is not a traitor call and does not reveal this identity to other players. After the battle plans are revealed, use the table’s traitor decision to make a legal call.

Keep the identity after revealing it; it can match again in later battles. A matching identity alone does not bypass battle protections such as Kwisatz Haderach.

{!cheapHero && (

Keeping your own leader as a traitor can prevent another player from holding that traitor.

)} {cheapHero && (

This is the expansion traitor identity, separate from the hero treachery cards. It can match any Cheap Hero or Heroine used as a battle leader. The hero has zero leader strength and grants no leader bounty.

)} ) : ( <>

{HELP.leader}

Inspection does not choose or commit a leader. Close this view to review the available leaders in your battle plan.

{cheapHero && (

The hero treachery card is discarded after use. The separate Cheap Hero traitor identity can match either hero.

)} )} {identity.strength === 'X' && (

X marks variable strength. Use the faction’s battle rule to determine its value against the opposing leader.

)}
); }