1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-28 10:57:40 +08:00
parent bb4100fca4
commit a9febe7678
28 changed files with 1342 additions and 89 deletions

View File

@@ -210,3 +210,23 @@ npm.cmd run build
- 没有人手逐个点击整局游戏所有 function 的视觉回放,本轮重点是自动化测试、服务端测试、内容校验与 smoke 门禁。
因此,本审计可以说明“当前 function 系统的自动化测试层状况”,但不等于“所有视觉演出与在线模型联动都已人工验证完毕”。
## 8. 执行回填2026-04-28修复聊天任务领取入口
- 问题现象:
- NPC 聊天中的待领取任务,点击“查看任务”进入详情后,再点“领取任务”没有把面板切到正式已接任务状态,表现上像“无法领取”。
- 根因:
- `npcChatQuestOfferUi.acceptPendingOffer()` 会异步把 `npc_quest_accept` 发到服务端。
- 但 [`src/components/rpg-runtime-panels/RpgAdventurePanel.tsx`](../../src/components/rpg-runtime-panels/RpgAdventurePanel.tsx) 里“待领取任务详情弹层”的 `onAcceptPendingNpcQuestOffer` 只返回了 `questId`,没有把它写入共享的 `pendingAcceptedQuestId`
- 结果是本来负责等待 quest 真正进入 `quests` 后再统一收口面板状态的 `useEffect` 根本不会触发。
- 修复:
-`onAcceptPendingNpcQuestOffer` 中补写 `setPendingAcceptedQuestId(acceptedQuestId)`,让待领取任务详情弹层复用普通 `npc_quest_accept` 已有的异步收口链。
- 新增 [`src/components/rpg-runtime-panels/RpgAdventurePanel.questOffer.test.tsx`](../../src/components/rpg-runtime-panels/RpgAdventurePanel.questOffer.test.tsx),覆盖“查看任务 -> 领取任务 -> 服务端异步写回 quest log -> 面板切到正式任务状态”的回归路径。
- 本次回归验证:
- `src/components/rpg-runtime-panels/RpgAdventurePanel.questOffer.test.tsx`
- `src/components/rpg-runtime-panels/RpgAdventurePanel.test.tsx`
- `src/hooks/rpg-runtime-story/npcEncounterActions.test.ts`
- `src/hooks/rpg-runtime-story/choiceActions.test.ts`
- `src/hooks/rpg-runtime-story/runtimeStoryCoordinator.test.ts`
- `src/hooks/rpg-runtime-story/sessionActions.test.ts`
-`57` 条测试通过。

View File

@@ -0,0 +1,48 @@
# RPG 复活后继续冒险链路修复记录 2026-04-28
## 问题现象
RPG 运行态里,角色在战斗死亡并复活后,面板会显示一个“继续前进”入口。
此前这一步只有 `story_continue_adventure` 控制项,没有同步挂出复活后首场景应该展示的 `deferredOptions`。因此玩家点击继续后,系统会把它当作一次普通剧情续推入口,而不是单纯展示“复活后的下一批可选动作”。
在带有场景章节主 NPC 的自定义世界里,这会让玩家看起来像是“刚复活就直接和对面主 NPC 聊天”,造成复活后第一拍体验被主 NPC 对话链抢走。
## 根因结论
根因不在 NPC 聊天函数本身,而在死亡复活链没有沿用 `story_continue_adventure -> deferredOptions` 的延迟展示协议。
- 战后胜利链已经使用 `story_continue_adventure + deferredOptions`
- 死亡复活链此前只保留了 `story_continue_adventure`
- 结果是“继续前进”点击后无法走纯展示分支,只能落回普通续推
## 本次修复
本次在 `src/hooks/rpg-runtime-story/postBattleFlow.ts` 与复活调用链中补齐:
- `buildDeathStory(...)` 现在支持在复活文案上同步挂出 `deferredOptions`
- 这些 `deferredOptions` 复用 `buildFallbackStoryForState(...)` 产出的复活后可用入口
- 点击“继续前进”时只揭示这些入口,不再额外触发一次普通剧情推演
## 当前行为规则
角色死亡复活后:
1. 先显示“你在战斗中倒下,随后重新醒来”
2. 面板只展示一个 `story_continue_adventure`
3. 点击后展示复活后首场景已有的后续动作
4. 不应直接自动推进到主 NPC 聊天执行态
## 回归覆盖
已补两条测试:
- `src/hooks/rpg-runtime-story/choiceActions.test.ts`
- 覆盖本地战斗失败后的复活链
- `src/hooks/rpg-runtime-story/storyChoiceRuntime.test.ts`
- 覆盖服务端战斗失败后的复活链
两条测试都要求复活文案返回:
- `story_continue_adventure`
- 非空 `deferredOptions`