From c93b57aec4ea7eb562aa5495379d350c3319fa74 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Wed, 11 Feb 2026 09:52:11 +0000 Subject: [PATCH] fix: count weapon cost when target evades/dodges your attack - Check evade type for 'target Evaded' or 'target Dodged' - Count weapon cost on those events (you fired but missed) - Armor decay still only counted on actual damage taken - Fixes: weapon cost now accurate for all shots including misses --- ui/main_window.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/main_window.py b/ui/main_window.py index c355dab..b28e01d 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -1206,9 +1206,22 @@ class MainWindow(QMainWindow): logger.error(traceback.format_exc()) def on_evade(event): - """Handle evade.""" + """Handle evade - count weapon cost when target dodges your attack.""" evade_type = event.data.get('type', 'Evade') self.log_info("Evade", evade_type) + + # If target evaded/dodged YOUR attack, you still pay weapon cost + target_evaded = 'target Evaded' in evade_type or 'target Dodged' in evade_type + if target_evaded: + try: + from decimal import Decimal + if self._session_costs: + cost_per_shot = self._session_costs.get('cost_per_shot', Decimal('0')) + if cost_per_shot > 0: + logger.debug(f"[HUD] update_weapon_cost({cost_per_shot}) [target evaded]") + self.hud.update_weapon_cost(cost_per_shot) + except Exception as e: + logger.error(f"[ERROR] Error tracking weapon cost on evade: {e}") # Subscribe to all event types self.log_watcher.subscribe('loot', on_loot)