import { useGameStore } from '../store' import { npcById } from '../../game/data/npcs' import { giftNpc, makePeace, marryNpcFamily } from '../../game/engine/systems/diplomacy' import { useMemo } from 'react' import { MAJOR_NAMES } from '../../game/data/realms' const REL_TYPE = (r: number) => r >= 80 ? ['死生之交', 'good'] : r >= 50 ? ['通好之势', 'good'] : r >= 25 ? ['友善', 'warn'] : r >= 10 ? ['温和', 'warn'] : r > -10 ? ['中立', ''] : r > -30 ? ['嫌隙', ''] : r > -50 ? ['敌对', 'bad'] : ['仇雠', 'bad'] export default function DiplomacyPanel() { const world = useGameStore((s) => s.world) const bump = useGameStore((s) => s.bump) const revision = useGameStore((s) => s.revision) void revision if (!world) return null const w = world const npcs = Object.values(w.state.npcFamilies) const sorted = useMemo(() => npcs, [npcs]) return (
外交之道:送礼结好、联姻通好;仇恨过深的老对家会遣队劫掠。家族声望同样影响诸家态度。
{sorted.map((npc) => { const def = npcById(npc.id) const [relLabel, relCls] = REL_TYPE(npc.relation) const married = npc.allied return (
{npc.name}
{def.style} · {npc.region}
= 0 ? '#2e5a2e' : '#6e2f2f' }}>
= 0 ? '#5a8a44' : '#8a4444' }} />
关系{npc.relation} · {relLabel} · 势力{npc.power}
{MAJOR_NAMES[def.leaderRealm]}宗主
{npc.relation < -30 && ( )}
) })}
示好请用灵石铺路;寻衅会立刻恶化关系,且可能招致劫掠或围庄。
) }