'use client'; import { useState } from 'react'; import type { GameView } from '@/game/engine'; import { choamPowerKey, choamPowerPlays, CHOAM_POWER_NAMES, type ChoamPowerEffect, type ChoamPowerPlay, } from '@/game/choam-power-options'; import { CardInspector } from './card-inspector'; export function useChoamPower(game: GameView, effect: ChoamPowerEffect) { const [selected, select] = useState(''); const plays = choamPowerPlays(game, effect); const play = plays.find((candidate) => choamPowerKey(candidate) === selected) ?? plays.find((candidate) => !candidate.blocked) ?? plays[0]; return { plays, play, select }; } export function ChoamPowerCost({ plays, play, select, busy, }: { plays: ChoamPowerPlay[]; play?: ChoamPowerPlay; select: (key: string) => void; busy: boolean; }) { if (!play) return null; return (
{plays.length > 1 && ( )}

Use {play.card.name} for{' '} {CHOAM_POWER_NAMES[play.effect]}. {play.source === 'nexus' && ' This spends CHOAM Nexus Cunning once. Karama can prevent the effect and leave this Treachery Card in hand; the Nexus stays spent.'}

{play.blocked &&

{play.blocked}

}
); }