mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #514] [MERGED] fix(game-combat): mobile layout, encounter trigger race, refresh restore, persona name in combat #4653
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4653
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/514
Author: @Romuromylus
Created: 5/7/2026
Status: ✅ Merged
Merged: 5/7/2026
Merged by: @Romuromylus
Base:
main← Head:fix/game-combat-mobile-and-timing📝 Commits (8)
4b0b77bfix(game-combat): mobile combat layout, encounter trigger race, refresh restore6c4d39ffix(game-combat): address CodeRabbit review on PR #514a90f678fix(encounter): use chat-scoped persona for combat init / resolve / summary prompts632467afix(game-combat): self-heal "user" persona name in restored battlescf6584fMerge branch 'main' into fix/game-combat-mobile-and-timing2602550fix(game-combat): keepalive on unmount flush + scope narrationDone per messageb0aa58ffix(game-combat): apply quality-review must-fixes (narration guard, snapshot validation, persist logging)85dfac2Merge branch 'main' into fix/game-combat-mobile-and-timing📊 Changes
7 files changed (+1004 additions, -29 deletions)
View changed files
📝
packages/client/src/components/game/GameCombatUI.tsx(+719 -0)📝
packages/client/src/components/game/GameNarration.tsx(+11 -4)📝
packages/client/src/components/game/GameSurface.tsx(+227 -10)📝
packages/client/src/lib/api-client.ts(+2 -1)📝
packages/server/src/routes/encounter.routes.ts(+25 -13)📝
packages/shared/src/types/chat.ts(+2 -0)📝
packages/shared/src/types/game.ts(+18 -1)📄 Description
Linked issue
Closes #513
Why this change
Game Mode combat has four issues that surface during ordinary play; bundling them so the deployment ships them together rather than four round-trips of build + verify:
encounter.routes.ts buildPersonaContextonly consultedisActive === "true"and ignoredchat.personaId, so a user with a chat-scoped persona ended up named "User" in the encounter prompt and the LLM faithfully echoed that string.What changed
smbreakpoint (<640px) viamatchMedia("(max-width: 639px)"). The desktop tree is untouched. Mobile uses a compact enemy strip pinned top, a scene area in the middle for narration / impact effects, and a sticky bottom action sheet that always shows the active player and current phase content (action menu / skill / item / custom-action / target-select). Boss mechanics, dialogue cues, the live combat log, and full party HP move into slide-up drawers triggered from a row of toggle buttons. NewMobileCombatantChipsubcomponent renders the compact enemy chips. Tablet keyboard parity: the mobile custom-action textarea also submits on(meta|ctrl)+Enter, and a global Escape listener closes any open drawer.narrationDonewith the message ID it corresponds to.GameNarration.onNarrationCompletenow passes the active segment's source message ID alongside the boolean.GameSurfacekeeps anarrationDoneMsgIdRefso the three encounter gates (combat encounter, combat generation, QTE) only treatnarrationDone === trueas authoritative when it matches the currentlatestAssistantMsg.id— defeating the stale "done" from the previous turn that previously slipped past the gate.GameCombatStateSnapshot(party / enemies / itemEffects / mechanics / dialogueCues / startMessageId) is debounce-persisted to chat metadata while a fight is active and restored on mount before the existing tag-replay path runs. The restore guard is keyed byactiveChatIdso switching chats inside the same mountedGameSurfacestill gets a chance to restore. The persist effect's cleanup synchronously flushes the latest pending snapshot so a refresh inside the 800 ms debounce window cannot drop the most recent state. A sharedclearCombatSnapshot(chatId)helper is called from bothhandleCombatEndandhandleReturnToPreCombatTurn, so backing out of an encounter wipes the persisted snapshot the same way a normal combat end does.GameCombatUI'snarrationprop is also derived from the trigger message's stripped GM prose so the actual setup text becomes the first combat-log entry instead of the placeholder "Combat starts!".chat.personaId, fall back to the globally active persona, then fall back to "User" only when neither is set. The encounter init / resolve / summary prompt builders all read through the updatedbuildPersonaContext.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Verified on a Docker deployment of this branch:
<640pxviewport. The bottom action sheet stays visible, the enemy strip stays compact at the top, and Mechanics / Cues / Log / Party each open in a slide-up drawer. Desktop layout was unchanged at>=640px.[combat:]situation. The overlay now waits for the typewriter to finish revealing the pre-fight prose before opening, and no longer stalls afterward.Docs and release impact
UI evidence (if applicable)
Desktop UI should be unaffected :

Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.