using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DurableHearths")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DurableHearths")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ebe2c66d-f5c6-44d2-a1d1-e3269415b25c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DurableHearths;
[BepInPlugin("com.kurophantom.durablehearths", "DurableHearths", "1.0.0")]
public class Main : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("com.kurophantom.durablehearths");
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"DurableHearths has loaded!");
harmony.PatchAll();
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)283))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"F2 was pressed! DurableHearths is Loaded! ");
}
}
}
[HarmonyPatch(typeof(WearNTear), "Damage")]
public static class HearthDamagePatch
{
private static bool Prefix(WearNTear __instance, HitData hit)
{
if (((Object)__instance).name.Contains("hearth"))
{
if (hit.m_damage.m_damage == 0f)
{
return false;
}
if (hit.m_toolTier >= 1 && hit.m_damage.m_pierce > 0f)
{
return true;
}
return false;
}
return true;
}
}