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:
parent
48bd83dade
commit
c93b57aec4
|
|
@ -1206,10 +1206,23 @@ class MainWindow(QMainWindow):
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
def on_evade(event):
|
def on_evade(event):
|
||||||
"""Handle evade."""
|
"""Handle evade - count weapon cost when target dodges your attack."""
|
||||||
evade_type = event.data.get('type', 'Evade')
|
evade_type = event.data.get('type', 'Evade')
|
||||||
self.log_info("Evade", evade_type)
|
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
|
# Subscribe to all event types
|
||||||
self.log_watcher.subscribe('loot', on_loot)
|
self.log_watcher.subscribe('loot', on_loot)
|
||||||
self.log_watcher.subscribe('global', on_global)
|
self.log_watcher.subscribe('global', on_global)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue