fix(hud): improved kill tracking with Shrapnel heuristic

- Non-Shrapnel loot = definite kill
- Shrapnel: every 2 Shrapnel = 1 kill (since mobs drop 1-2 Shrapnel)
- This handles mobs that drop only Shrapnel
- Reset Shrapnel counter on session start
This commit is contained in:
LemonNexus 2026-02-08 23:47:37 +00:00
parent 647728a1d4
commit ff7b304c78
1 changed files with 16 additions and 2 deletions

View File

@ -890,6 +890,9 @@ class MainWindow(QMainWindow):
self.set_session_state(SessionState.RUNNING)
self.current_session_id = project_id
# Reset shrapnel counter for kill tracking
self._shrapnel_count = 0
# Emit signal
self.session_started.emit(project_id)
@ -958,10 +961,21 @@ class MainWindow(QMainWindow):
if item_name == 'Universal Ammo':
return
# Count kills (excluding Shrapnel which is from every mob)
# Real loot items indicate a kill
# Kill tracking heuristic:
# - Non-Shrapnel loot = definite kill
# - Shrapnel: count as kill every 2 Shrapnel (since mobs drop 1-2 Shrapnel)
if item_name != 'Shrapnel':
self.hud.update_stats({'kills_add': 1})
else:
# Track Shrapnel count for this session
if not hasattr(self, '_shrapnel_count'):
self._shrapnel_count = 0
self._shrapnel_count += quantity
# Every 2 Shrapnel = 1 kill (approximate)
kills_from_shrapnel = self._shrapnel_count // 2
if kills_from_shrapnel > 0:
self.hud.update_stats({'kills_add': kills_from_shrapnel})
self._shrapnel_count -= kills_from_shrapnel * 2
# Queue database write for main thread (SQLite thread safety)
if self._current_db_session_id: