'use client'; import { useId } from 'react'; import { gameTerritories, type MobileBoard } from '@/game/board'; import { forceCountCounterError, parseForceCountFact, type ForceCountFact, type ForceCountPlayer } from '@/game/truthtrance-force-count'; import { Input } from './ui/input'; type CounterPlayer = Pick; export function forceCountInputError(value: ForceCountFact, game: MobileBoard, player: CounterPlayer): string | null { try { parseForceCountFact(value, gameTerritories(game).flatMap(t => t.sectors.map(sector => ({ territory: t.id, sector })))); return forceCountCounterError(player, value.counter); } catch (error) { return error instanceof Error ? error.message : 'Choose a valid physical force count.'; } } export function ForceCountFields({ value, game, player, onChange }: { value: ForceCountFact; game: MobileBoard; player: CounterPlayer; onChange: (value: ForceCountFact) => void; }) { const id = useId(); const territories = gameTerritories(game); const zone = value.zone; const selected = zone.kind === 'location' ? territories.find(t => t.id === zone.territory) : null; const error = forceCountInputError(value, game, player); return <> {value.zone.kind === 'location' && <> }

Each physical counter counts once, including advisors. The total includes elites; the normal count excludes them. Concealed No-Field markers and their hidden values do not count. Reserves includes counters on native Homeworlds. This asks about current custody, not combat strength or a promise to keep forces there.

{!!forceCountCounterError(player, 'elite') &&

This table does not track this faction’s starred counters separately. Choose all physical force counters.

} {error && } ; }