'use client'; import { useId } from 'react'; import type { Action, GameView } from '@/game/engine'; import { Button } from './ui/button'; import { CardInspector, CardRules } from './card-inspector'; type PreparationProps = { game: GameView; act: (action: Action) => void; busy: boolean; }; export function ResidualPoison({ game, act, busy }: PreparationProps) { const id = useId(); const poison = game.residualPoison; if (!poison) return null; const target = game.players.find((player) => player.id === poison.target); const reason = poison.blocked ?? (!target || !poison.event ? 'Use this card against your opponent before battle leaders are chosen.' : null); return (
Residual Poison: before choosing leaders

Play against your actual battle opponent. One available opposing leader is randomly sent to the Tanks, with no spice bounty, then Residual Poison is discarded. You do not choose the leader.

{reason && (

{reason}

)}
); } /** Neutral public timing controls must never depend on either player's hand. */ export function BattleLeaderOpportunity({ game, act, busy }: PreparationProps) { const id = useId(), battle = game.battle, stage = battle?.preLeader; if (!battle || !stage || stage.closed) return null; const combatants = [battle.attacker, battle.defender]; const mine = combatants.includes(game.me), ready = stage.ready.includes(game.me); const interrupted = !!( game.truthtrance || game.response || game.decision || game.phaseOpening ); return (

Before choosing battle leaders

Both combatants have an opportunity to use available preparations before either commits a leader. Continue when you are ready to choose leaders.

{mine && (!ready ? ( <> {interrupted && (

Resolve the current interaction before continuing.

)} ) : (

You are ready. Waiting for the other combatant.

))} {!mine && (

Waiting for the combatants to finish preparation.

)}
); }