mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #553] [MERGED] fix(combat): use configured persona/character HP at combat init #4673
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#4673
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/553
Author: @Romuromylus
Created: 5/8/2026
Status: ✅ Merged
Merged: 5/8/2026
Merged by: @Romuromylus
Base:
main← Head:fix/combat-init-hp📝 Commits (2)
f19f45ffix(combat): use configured persona/character HP at combat initdf52b68fix(combat): guard HP context against malformed numeric values📊 Changes
1 file changed (+60 additions, -2 deletions)
View changed files
📝
packages/server/src/routes/encounter.routes.ts(+60 -2)📄 Description
Linked issue
Closes #551
Why this change
In Game Mode, when the GM emits
[state: combat]the client callsPOST /encounter/initto generate the combat blueprint. The init-prompt builders sent no HP information about the configured persona or party characters, so the AI had nothing to copy from and was forced to invent fresh HP/maxHp for every party combatant — and the explicit instruction "Ensure HP values are realistic for the setting" further encouraged invention. A persona configured with Max HP 1000 would routinely enter combat with some unrelated lower number; companions with character-card RPG stats got the same treatment.What changed
In
packages/server/src/routes/encounter.routes.ts:buildPersonaContextnow parsespersona.personaStatsand surfaces the configured stat bars (max only) andpersonaStats.rpgStats(Max HP + attributes) when enabled.buildCharacterContextnow surfaces each ally'sdata.extensions.rpgStats(Max HP + attributes) when enabled.buildInitPromptinstruction line was rewritten: if a combatant has a configured Max HP in the context, copy it intomaxHpand sethp = maxHpso combat starts at full health. Enemies and unstatted combatants still get AI-generated HP.Only
maxis exposed (not the runningvaluefield) so a depleted in-narrative HP value doesn't drag the player into a fresh fight at low/zero HP — combat entry is always full health, and the GM can apply damage tags afterwards if narration calls for it.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Tested on a Docker-deployed dev instance against the live
/encounter/initroute with a frontier model:personaStats.bars(HP bar set withmax = 1000) and a party that included a companion character card withextensions.rpgStats.enabled = true, hp.max = 100.[state: combat].100/1000(or unrelated values), party characters at0/100with KO icons.1000/1000, party characters at100/100, all at full health. Enemies still received sensible AI-generated HP.Edge cases not exercised in browser:
ifbranches simply skip the extra context, and the AI-invents path still applies as before. No regression expected.Docs and release impact
UI evidence (if applicable)
Server-side prompt fix; no UI changes.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.