0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:10:44 -05:00

Reworked ArmorDamageCounterPatch

This commit is contained in:
Kaeno 2024-03-22 20:25:38 +00:00
parent a77fc7f036
commit 3aa514a5e8

View File

@ -1,4 +1,5 @@
using Aki.Reflection.Patching; using Aki.Reflection.Patching;
using Comfort.Common;
using EFT; using EFT;
using EFT.InventoryLogic; using EFT.InventoryLogic;
using HarmonyLib; using HarmonyLib;
@ -22,10 +23,15 @@ namespace Aki.SinglePlayer.Patches.MainMenu
return; return;
} }
if (damageInfo.Weapon is Weapon weapon && weapon.Chambers[0].ContainedItem is BulletClass bullet) if (damageInfo.Weapon is Weapon)
{ {
float newDamage = (float)Math.Round(bullet.Damage - damageInfo.Damage); if (!Singleton<ItemFactory>.Instance.ItemTemplates.TryGetValue(damageInfo.SourceId, out var template))
damageInfo.Player.iPlayer.Profile.EftStats.SessionCounters.AddFloat(newDamage, SessionCounterTypesAbstractClass.CauseArmorDamage); {
return;
}
float absorbedDamage = (float)Math.Round((template as AmmoTemplate).Damage - damageInfo.Damage);
damageInfo.Player.iPlayer.Profile.EftStats.SessionCounters.AddFloat(absorbedDamage, SessionCounterTypesAbstractClass.CauseArmorDamage);
} }
} }
} }