mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #595] [MERGED] fix(combat): render enemy avatars + wire portrait generation pipeline #4686
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#4686
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/595
Author: @Romuromylus
Created: 5/9/2026
Status: ✅ Merged
Merged: 5/9/2026
Merged by: @Romuromylus
Base:
main← Head:fix/combat-enemy-portraits📝 Commits (3)
df62683fix(combat): render enemy avatars + wire portrait generation pipelinef760068fix(combat): index-aligned fallback for enemyImagePrompts lookup934427ffix(combat): case-insensitive name match when stitching generated avatars📊 Changes
2 files changed (+169 additions, -29 deletions)
View changed files
📝
packages/client/src/components/game/GameCombatUI.tsx(+97 -28)📝
packages/client/src/components/game/GameSurface.tsx(+72 -1)📄 Description
Linked issue
Closes #594
Why this change
enemy.spriteas a URL when the LLM is instructed to emit an emoji or short visual description, and the per-enemy portrait pipeline the encounter prompt asks for is never wired to a generator.visuals.enemyImagePrompts(orenemy.description) into a generated image.What changed
packages/client/src/components/game/GameCombatUI.tsx): addedresolveSpriteKind()that classifiescombatant.spriteas URL / emoji glyph / unrenderable. Applied to all four sprite sites — active-player mini bar, action-menu indicator, desktop combatant card, mobile horizontal row. URL →<img>, emoji → glyph span, anything else → existing initials fallback.packages/client/src/components/game/GameSurface.tsx): in the combat-init.then(...)handler, after hydrating combatants and beforesetCombatEnemies, dedupe enemies by name (so identical-named enemies share one portrait), buildnpcsNeedingAvatarsfromvisuals.enemyImagePrompts[i].promptwhen present elseenemy.descriptionelse the enemy name, awaitrunGameAssetGeneration, and overwrite eachcombatant.spritewith the matchinggeneratedNpcAvatars[i].avatarUrl. Combat blocks here so portraits exist before the UI renders. Any failure (timeout, generation disabled, no image connection) falls through to the renderer's emoji/initials fallback with no retries. Capped at the server'snpcsNeedingAvatars.max(10)limit. Respects the existingchatMeta.enableSpriteGenerationgate.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
shouldGenerateBossVisualsbranch that fires after enemy avatars) still runs on boss encounters.isBossFight: false) still gets per-enemy portraits, which it didn't before.activePlayer.spriteis a realavatarUrl, so it routes through the new helper to the same<img>path).Docs and release impact
UI evidence (if applicable)
Reporter screenshot in #594 shows three enemies (Tideborn Alpha + two Tideborn Drones) rendering as broken-image icons with the name leaking through as alt text, while the player party (Sasuke Uchiha, Emilia, Barbara) shows real avatars on the same row. After this PR: enemies show generated portraits when sprite gen is on, or the LLM-suggested emoji / initials when off, never a broken
<img>.Summary by CodeRabbit
Release Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.