import { useGameStore } from '../store' import { Character } from '../../game/types/domain' import { describeRealm } from '../../game/data/realms' import { describeRoots } from '../../game/data/elements' const STATE_LABEL: Record = { idle: { label: '无事', cls: '' }, meditation: { label: '闭关', cls: 'good' }, expedition: { label: '出探', cls: 'warn' }, wounded: { label: '养伤', cls: 'bad' } } export function MemberCard({ c }: { c: Character }) { const world = useGameStore((s) => s.world) const setSelected = useGameStore((s) => s.setSelected) if (!world) return null const dead = !c.alive const isHead = world.state.family.headId === c.id const state = STATE_LABEL[c.state] return (
setSelected(c.id)}>
{world.state.family.surname}
{c.name} {isHead && 家主} {c.spouseHouse && 外亲}
{dead ? `殁于${c.deathYear}年 · ${c.deathCause ?? '寿终'}` : `${describeRealm(c.realm)} · ${world.ageOf(c)}岁 · 修为${Math.floor(c.realmProgress)}%`}
{describeRoots(c.roots)} {!dead && c.realmProgress >= 100 && 瓶颈 · 可冲击} {C_STATE[dead ? 'dead' : c.state] && ( {STATE_LABEL[c.state]?.label ?? ''} )}
{!dead && (
)}
) } const C_STATE: Record = { idle: '', meditation: 'good', expedition: 'warn', wounded: 'bad', dead: 'bad' }