'use client'; import { useState } from 'react'; import type { Action, GameView } from '@/game/engine'; import { faction } from '@/game/catalog'; import { territory } from '@/game/board'; import { Button } from '@/components/ui/button'; import { LeaderInspector } from './leader-inspector'; export function MoritaniAssassinate({ game, act, busy, }: { game: GameView; act: (action: Action) => void; busy: boolean; }) { const [selected, setSelected] = useState(''); const offer = game.moritaniAssassinate; const decision = game.decision; if ( !offer?.pending || decision?.kind !== 'moritaniAssassinate' || decision.player !== game.me || decision.event !== offer.pending.event || offer.owner !== game.me ) return null; const pending = offer.pending; const card = pending.cards.find((candidate) => candidate.card === selected) ?? pending.cards[0]; const blocked = busy || !!game.response || !!game.truthtrance; const opponent = game.players.find((player) => player.id === pending.opponent); const factionName = opponent ? faction(opponent.faction).name : 'the opposing faction'; const selectedLeader = card && game.allLeaders.find((leader) => leader.id === card.card); return (

Assassinate Leaders

After losing this battle, you may reveal one Traitor Card for {factionName}, naming a different opposing leader. The physical card is revealed publicly; it is replaced automatically during Mentat Pause.

This advantage is available once against each faction. It cannot be canceled with Karama. A dead target remains a legal choice, but yields no spice.

{pending.blocked &&

{pending.blocked}

} {pending.cards.length > 0 ? ( <> {card && (

{card.name} · {card.dead ? '0 spice; target already dead' : `${card.bounty} spice bounty`}

Printed leader strength: {selectedLeader?.strength ?? 'unknown'}

)} ) : (

No eligible opposing-faction Traitor Card is available for this advantage.

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

Assassinate Leaders revealed cards

These physical Traitor Cards were revealed publicly. A replaced card is set aside face up; replacement happens during Mentat Pause.

{history.map((entry) => { const leader = game.allLeaders.find((candidate) => candidate.id === entry.card); const leaderName = leader?.name ?? entry.card; const factionName = faction(entry.faction).name; return (

{entry.stage === 'replaced' ? 'Set aside face up · replaced' : 'Revealed · awaiting replacement'}

{leaderName}

{factionName} · {territory(entry.territory).name} · {entry.bounty} spice bounty · Turn {entry.turn}

); })}
); }