import { Box, Text } from '@anthropic/ink' import type { Creature, SpeciesId } from '../types' import { getCreatureName } from '../core/creature' interface BattleConfigPanelProps { party: (Creature | null)[] cursorIndex: number onSubmit: (opponentSpeciesId: SpeciesId, opponentLevel: number) => void onCancel: () => void } const OPTIONS = [ { label: '随机遇战(等级自动匹配)', color: 'warning' as const }, { label: '指定对手', color: 'inactive' as const }, ] export function BattleConfigPanel({ party, cursorIndex }: BattleConfigPanelProps) { return ( {/* Party display */} 队伍 {party.map((creature, i) => { if (!creature) return ( [空] ) const hpPercent = 100 const hpBar = '█'.repeat(Math.floor(hpPercent / 10)) const hpEmpty = '░'.repeat(10 - Math.floor(hpPercent / 10)) const isLead = i === 0 return ( {isLead ? ' ▸ ' : ' '} {getCreatureName(creature)} Lv.{creature.level} {hpBar} {hpEmpty} {hpPercent}% ) })} {/* Options */} 选择对手 {OPTIONS.map((opt, i) => ( {i === cursorIndex ? ' ▶ ' : ' '} {opt.label} ))} [↑↓] 选择 · [Enter] 确认 · [ESC] 取消 ) }