diff --git a/api/game_logic.py b/api/game_logic.py index 09d7ca0..ff95739 100644 --- a/api/game_logic.py +++ b/api/game_logic.py @@ -600,7 +600,7 @@ async def npc_attack(player_id: int, combat: dict, npc_def, reduce_armor_func) - actual_damage = max(1, npc_damage - armor_absorbed) new_player_hp = max(0, player['hp'] - actual_damage) - message += create_combat_message("enemy_attack", origin="enemy", npc_name=npc_def.name, damage=npc_damage, armor_absorbed=armor_absorbed) + message += f"{get_locale_string(npc_def.name)} attacks for {npc_damage} damage!" if armor_absorbed > 0: message += f" (Armor absorbed {armor_absorbed})" diff --git a/api/routers/combat.py b/api/routers/combat.py index 7d3dbbc..a996b35 100644 --- a/api/routers/combat.py +++ b/api/routers/combat.py @@ -283,7 +283,7 @@ async def combat_action( else: # Apply damage to NPC new_npc_hp = max(0, combat['npc_hp'] - damage) - result_message = create_combat_message("player_attack", origin="player", damage=damage) + result_message = f"You attack for {damage} damage! " # Apply weapon effects if weapon_effects and 'bleeding' in weapon_effects: @@ -304,7 +304,7 @@ async def combat_action( if new_npc_hp <= 0: # NPC defeated - result_message += "\n" + create_combat_message("victory", origin="neutral", npc_name=npc_def.name) + result_message += f"Victory! Defeated {get_locale_string(npc_def.name)}" combat_over = True player_won = True @@ -435,7 +435,7 @@ async def combat_action( # Failed to flee, NPC attacks npc_damage = random.randint(npc_def.damage_min, npc_def.damage_max) new_player_hp = max(0, player['hp'] - npc_damage) - result_message = create_combat_message("flee_fail", origin="enemy", npc_name=npc_def.name, damage=npc_damage) + result_message = f"Failed to flee! {get_locale_string(npc_def.name)} attacks for {npc_damage} damage!" if new_player_hp <= 0: result_message += "\nYou have been defeated!" diff --git a/pwa/src/components/game/Combat.tsx b/pwa/src/components/game/Combat.tsx index 7397e1d..ab8cc55 100644 --- a/pwa/src/components/game/Combat.tsx +++ b/pwa/src/components/game/Combat.tsx @@ -183,7 +183,7 @@ const Combat = ({ const timeStr = now.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }) // Parse message into structured parts - const messages = data.message.split('\\n').filter((m: string) => m.trim()) + const messages = data.message.split('\n').filter((m: string) => m.trim()) const playerMessages: any[] = [] const enemyMessages: any[] = [] diff --git a/pwa/src/components/game/CombatView.tsx b/pwa/src/components/game/CombatView.tsx index 77997b4..2b4b86d 100644 --- a/pwa/src/components/game/CombatView.tsx +++ b/pwa/src/components/game/CombatView.tsx @@ -99,8 +99,8 @@ function CombatView({ return (