UI/UX: Improve visual clarity and consistency

- Align status bars with label padding (HP, Stamina, XP)
- Add clear combat turn indicators (YOUR TURN / ENEMY TURN)
- Display HP/Stamina bars in inventory menu and usage
- Add consistent separators between sections
- Improve feedback for item usage with visible stat changes

Files modified:
- bot/utils.py: Added label_width parameter to format_stat_bar()
- bot/combat.py: Turn headers and separators
- bot/inventory_handlers.py: HP/Stamina display
- bot/action_handlers.py: Separator placement fix

See docs/development/UI_UX_IMPROVEMENTS.md for details
This commit is contained in:
Joan
2025-10-20 12:44:16 +02:00
parent d243ec571f
commit dfea27f9cb
5 changed files with 273 additions and 28 deletions

View File

@@ -128,7 +128,8 @@ async def player_attack(player_id: int) -> Tuple[str, bool, bool]:
actual_damage = int(actual_damage * 1.5)
new_npc_hp = max(0, combat['npc_hp'] - actual_damage)
message = f"⚔️ You attack the {npc_def.name} for {actual_damage} damage!"
message = "━━━ YOUR TURN ━━━\n"
message += f"⚔️ You attack the {npc_def.name} for {actual_damage} damage!"
if is_crit:
message += " 💥 CRITICAL HIT!"
@@ -174,11 +175,13 @@ async def player_attack(player_id: int) -> Tuple[str, bool, bool]:
'player_status_effects': json.dumps(player_effects)
})
message += "\n" + format_stat_bar(f"{npc_def.emoji} {npc_def.name}", "", new_npc_hp, combat['npc_max_hp'])
message += "\n━━━━━━━━━━━━━━━━━━━━\n"
message += format_stat_bar(f"{npc_def.emoji} {npc_def.name}", "", new_npc_hp, combat['npc_max_hp'])
return (message, False, True)
async def npc_attack(player_id: int) -> Tuple[str, bool]:
"""
NPC attacks the player.
@@ -214,7 +217,8 @@ async def npc_attack(player_id: int) -> Tuple[str, bool]:
new_player_hp = max(0, player['hp'] - damage)
await database.update_player(player_id, {'hp': new_player_hp})
message = f"💥 The {npc_def.name} attacks you for {damage} damage!"
message = "━━━ ENEMY TURN ━━━\n"
message += f"💥 The {npc_def.name} attacks you for {damage} damage!"
# Check for status effect infliction
player_effects = json.loads(combat['player_status_effects'])
@@ -251,8 +255,9 @@ async def npc_attack(player_id: int) -> Tuple[str, bool]:
'npc_status_effects': json.dumps(npc_effects)
})
message += "\n" + format_stat_bar("Your HP", "❤️", new_player_hp, player['max_hp'])
message += "\n" + format_stat_bar(f"{npc_def.emoji} {npc_def.name}", "", combat['npc_hp'], combat['npc_max_hp'])
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'])
return (message, False)