Apply visual HP bars to all combat displays

- Update combat_handlers.py to show visual enemy and player HP bars
- Update action_handlers.py combat encounters with progress bars
- Update combat.py attack results with visual HP displays
- Add UI_EXAMPLES.md with before/after comparisons
- All combat displays now use format_stat_bar() for consistency
This commit is contained in:
Joan
2025-10-19 00:32:05 +02:00
parent 861f3b8a36
commit 604ed653c1
3 changed files with 12 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ Combat-related action handlers.
"""
import logging
from . import database, keyboards
from .utils import format_stat_bar
from data.world_loader import game_world
logger = logging.getLogger(__name__)
@@ -158,8 +159,8 @@ async def handle_combat_back(query, user_id: int, player: dict):
keyboard = await keyboards.combat_keyboard(user_id)
message = f"⚔️ Combat with {npc_def.emoji} {npc_def.name}!\n"
message += f"{npc_def.emoji} Enemy HP: {combat_data['npc_hp']}/{combat_data['npc_max_hp']}\n"
message += f"❤️ Your HP: {player['hp']}/{player['max_hp']}\n\n"
message += format_stat_bar(f"{npc_def.emoji} Enemy HP", "", combat_data['npc_hp'], combat_data['npc_max_hp']) + "\n"
message += format_stat_bar("Your HP", "❤️", player['hp'], player['max_hp']) + "\n\n"
message += "🎯 Your turn!" if combat_data['turn'] == 'player' else "⏳ Enemy's turn..."
from .handlers import send_or_edit_with_image