mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
33 lines
985 B
C#
33 lines
985 B
C#
using Aki.Reflection.Patching;
|
|
using EFT;
|
|
using EFT.InventoryLogic;
|
|
using HarmonyLib;
|
|
using System;
|
|
using System.Reflection;
|
|
|
|
namespace Aki.Debugging.Patches.Stats
|
|
{
|
|
public class ArmorDamagePatch : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
return AccessTools.Method(typeof(Player), nameof(Player.ApplyDamageInfo));
|
|
}
|
|
|
|
[PatchPostfix]
|
|
private static void PatchPostfix(DamageInfo damageInfo)
|
|
{
|
|
if (!damageInfo.Player.iPlayer.IsYourPlayer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (damageInfo.Weapon is Weapon weapon && weapon.Chambers[0].ContainedItem is BulletClass bullet)
|
|
{
|
|
float newDamage = (float)Math.Round(bullet.Damage - damageInfo.Damage);
|
|
damageInfo.Player.iPlayer.Profile.EftStats.SessionCounters.AddFloat(newDamage, SessionCounterTypesAbstractClass.CauseArmorDamage);
|
|
}
|
|
}
|
|
}
|
|
}
|