diff --git a/ui/main_window.py b/ui/main_window.py index 8813b65..c355dab 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -1191,25 +1191,15 @@ class MainWindow(QMainWindow): self.hud.on_damage_taken(Decimal(str(damage))) # Calculate armor decay based on actual damage absorbed - # Formula: Decay (PEC) = damage_absorbed * 0.05 * (1 - durability/100000) - # Approximate: ~0.05 PEC per damage point for non-L armor - # For simplicity: 0.0005 PED per damage point (0.05 PEC = 0.0005 PED) - if self._selected_armor_stats and 'decay' in self._selected_armor_stats: - # Use decay per hit from armor stats if available - armor_decay_pec = Decimal(str(self._selected_armor_stats.get('decay', 0))) - # Approximate: decay scales with damage - # Most armor has ~0.05 PEC decay per damage point - decay_per_damage = Decimal('0.0005') # 0.05 PEC = 0.0005 PED - cost_ped = Decimal(str(damage)) * decay_per_damage - if cost_ped > 0: - logger.debug(f"[HUD] update_armor_cost({cost_ped:.4f}) based on damage {damage}") - self.hud.update_armor_cost(cost_ped) - else: - # Fallback to simple calculation - cost_per_hit = self._session_costs.get('cost_per_hit', Decimal('0')) - if cost_per_hit > 0: - logger.debug(f"[HUD] update_armor_cost({cost_per_hit}) [fallback]") - self.hud.update_armor_cost(cost_per_hit) + # EU Formula: Decay (PEC) = damage_absorbed * 0.05 * (1 - durability/100000) + # For (L) armor at full TT: ~0.05 PEC per damage point + # For adjusted armor: decay varies by piece + # Based on user feedback: ~0.00025 PED per damage (0.025 PEC) + decay_per_damage = Decimal('0.00025') # ~0.025 PEC per damage + cost_ped = Decimal(str(damage)) * decay_per_damage + if cost_ped > 0: + logger.debug(f"[HUD] update_armor_cost({cost_ped:.4f}) based on damage {damage}") + self.hud.update_armor_cost(cost_ped) except Exception as e: logger.error(f"[ERROR] Error in on_damage_taken: {e}") import traceback