import { useGameStore } from '../store' import { MISSIONS, missionById } from '../../game/data/secrets' import { sendMission, recallAll } from '../../game/engine/runtime/Systems/missions' import { combatPowerOf } from '../../game/engine/runtime/Systems/combat' import { useState } from 'react' import { describeRealm, MAJOR_ORDER } from '../../game/data/realms' import { FORMATIONS, FormationId } from '../../game/data/formations' import { WorldSim } from '../../game/engine/sim/WorldSim' export default function ExpeditionPanel() { const world = useGameStore((s) => s.world) const bump = useGameStore((s) => s.bump) const selectedMissionDef = useGameStore((s) => s.selectedMissionDef) const setMissionDef = useGameStore((s) => s.setMissionDef) const revision = useGameStore((s) => s.revision) void revision const [squad, setSquad] = useState([]) const [formation, setFormation] = useState('vanguard') if (!world) return null const w = world const s = w.state const active = s.missions.filter((m) => !m.done) const candidates = Object.values(s.members).filter( (c) => c.alive && w.ageOf(c) >= 16 && c.state !== 'expedition' ) const def = selectedMissionDef ? missionById(selectedMissionDef) : null const qiOf = (id: string): number | null => { try { return Math.round(new WorldSim(w).secretQiOf(id)) } catch { return null } } const toggle = (id: string) => { setSquad((old) => (old.includes(id) ? old.filter((x) => x !== id) : [...old, id])) } return (
探秘即遣队伍远行:越远越险,收获越丰。途中遇袭会结算战报——带足好手再上路。 (同期至多三支队伍在外)
择一行路
{MISSIONS.map((m) => { const sel = selectedMissionDef === m.id return (
{ setMissionDef(sel ? undefined : m.id) setSquad([]) }} >
{m.icon} {m.name}
{m.region} · 适合{describeRealm({ major: m.realmHint, minor: 0 })}
{m.minMembers}-{m.maxMembers}人 · {m.stages.length}段
{m.desc}
{qiOf(m.id) !== null && (
灵脉 {qiOf(m.id)}% (探索后-6,回复2/月;灵气越足所获越丰)
)}
) })}
{def && (
队伍人选({squad.length}/{def.maxMembers} 人,至少{def.minMembers}人)
{candidates.map((c) => (
toggle(c.id)} > {c.name}·{describeRealm(c.realm)}·战力{Math.round(combatPowerOf(w, c))}
))} {candidates.length === 0 && 无可派遣之人}
{(Object.keys(FORMATIONS) as FormationId[]).map((fid) => (
setFormation(fid)} title={FORMATIONS[fid].desc} > {FORMATIONS[fid].name}
))}
)}
{active.length > 0 && (
在外队伍
{active.map((m) => { const def2 = missionById(m.defId) const stage = def2.stages[m.stage] return (
{def2.icon} {def2.name} {m.memberIds.map((id) => s.members[id]?.name ?? '?').join('、')} 第{m.stage + 1}/{def2.stages.length}段 {stage ? ` · ${stage.title}` : ''}
启程 {m.startYear}年{m.startMonth}月 · 途中札记:
{m.log.slice(-3).map((l, i) => (
· {l}
))}
) })}
)}
) }