UI/UX: Fix alignment with right-aligned stat bars + optimize combat display

BREAKING: Changed format_stat_bar() to right-aligned format
- Bars now left-aligned, emoji+label on right
- Works with Telegram's proportional font (spaces don't work)
- Format: {bar} {percentage}% ({current}/{max}) {emoji} {label}

Combat improvements:
- Show BOTH HP bars on every turn (player + enemy)
- Eliminates redundant enemy HP display
- Better tactical awareness with complete state info

Files modified:
- bot/utils.py: Right-aligned format_stat_bar()
- bot/combat.py: Both HP bars on player/enemy turns
- bot/action_handlers.py: Fixed emoji handling
- bot/combat_handlers.py: Updated combat status display
- docs/development/UI_UX_IMPROVEMENTS.md: Complete documentation

Example output:
██████████ 100% (100/100) ❤️ Your HP
███░░░░░░░ 30% (15/50) 🐕 Feral Dog
This commit is contained in:
Joan
2025-10-20 12:58:41 +02:00
parent dfea27f9cb
commit c78c902b82
5 changed files with 179 additions and 155 deletions

View File

@@ -175,8 +175,10 @@ async def player_attack(player_id: int) -> Tuple[str, bool, bool]:
'player_status_effects': json.dumps(player_effects)
})
# Show both health bars after player's turn
message += "\n━━━━━━━━━━━━━━━━━━━━\n"
message += format_stat_bar(f"{npc_def.emoji} {npc_def.name}", "", new_npc_hp, combat['npc_max_hp'])
message += format_stat_bar("Your HP", "❤️", player['hp'], player['max_hp']) + "\n"
message += format_stat_bar(npc_def.name, npc_def.emoji, new_npc_hp, combat['npc_max_hp'])
return (message, False, True)
@@ -255,9 +257,10 @@ async def npc_attack(player_id: int) -> Tuple[str, bool]:
'npc_status_effects': json.dumps(npc_effects)
})
# Show both health bars after enemy's turn
message += "\n━━━━━━━━━━━━━━━━━━━━\n"
message += format_stat_bar("Your HP", "❤️", new_player_hp, player['max_hp']) + "\n"
message += format_stat_bar(f"{npc_def.emoji} {npc_def.name}", "", combat['npc_hp'], combat['npc_max_hp'])
message += format_stat_bar(npc_def.name, npc_def.emoji, combat['npc_hp'], combat['npc_max_hp'])
return (message, False)