EphemeralMatchStats class, function InternalRecordWeaponDamage (string 440):
Code:
Damage = ((TargetPawn.Health > 0) ? Damage : TargetPawn.Health + Damage);
If you hurt ZED and it still alive it writes DamageDealt correctly, but if you overkill it, the things getting messed up.
TargetPawn.Health can easily went down below 0 far far away because:
1. If you headshot it, there happening additional damage calculation involving Extra Head Damage value that being taken through whole TakeDamage function once again.
2. If you headshot it with shotgun, it takes 7 pellets on account even when only one hits. This decreases HP of ZED's corpse even further below 0.
For example off-perk impact with RPG-7 (150 + 750) against Clot (100 HP, ~ -750 when overkilled) only shows around 50 points of DamageDealt
-850 + 900 = 50, the numbers are approximative.
You can try to fix it by calculating DamageDealt value as a difference between ZED's Max health and current health. No need to take "overkill" damage on account. Logically you can't do more damage to ZED then it has health:
Code:
Damage = ((TargetPawn.Health > 0) ? Damage : (TargetPawn.MaxHealth - TargetPawn.Health));