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

@@ -7,6 +7,7 @@ import json
import time
from typing import Dict, List, Tuple, Optional
from bot import database
from bot.utils import format_stat_bar
from data.npcs import NPCS, STATUS_EFFECTS
from data.items import ITEMS
@@ -173,7 +174,7 @@ async def player_attack(player_id: int) -> Tuple[str, bool, bool]:
'player_status_effects': json.dumps(player_effects)
})
message += f"\n{npc_def.emoji} {npc_def.name}: {new_npc_hp}/{combat['npc_max_hp']} HP"
message += "\n" + format_stat_bar(f"{npc_def.emoji} {npc_def.name}", "", new_npc_hp, combat['npc_max_hp'])
return (message, False, True)
@@ -250,8 +251,8 @@ async def npc_attack(player_id: int) -> Tuple[str, bool]:
'npc_status_effects': json.dumps(npc_effects)
})
message += f"\n❤️ Your HP: {new_player_hp}/{player['max_hp']}"
message += f"\n{npc_def.emoji} {npc_def.name}: {combat['npc_hp']}/{combat['npc_max_hp']} HP"
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'])
return (message, False)