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
This commit is contained in:
LemonNexus 2026-02-11 09:52:11 +00:00
parent 48bd83dade
commit c93b57aec4
1 changed files with 14 additions and 1 deletions

View File

@ -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)