using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using COTL_Invincble.Patches;
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("COTL Invincible")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("COTL Invincible")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f0d4411b-528c-4309-bdaf-632617419f6e")]
[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 COTL_Invincble
{
[BepInPlugin("Rakibei.COTLInvincible", "Rakibei Invincible Mod", "1.0.0")]
public class UntouchableMod : BaseUnityPlugin
{
private const string modGUID = "Rakibei.COTLInvincible";
private const string modName = "Rakibei Invincible Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Rakibei.COTLInvincible");
private static UntouchableMod Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Rakibei.COTLInvincible");
mls.LogInfo((object)"Invincible has loaded");
harmony.PatchAll(typeof(UntouchableMod));
harmony.PatchAll(typeof(PlayerControllerPatch));
}
}
}
namespace COTL_Invincble.Patches
{
[HarmonyPatch(typeof(PlayerController))]
internal class PlayerControllerPatch
{
public static bool keyPressed;
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerController), "Update")]
private static void infInvinciblePatch(PlayerController __instance)
{
if (Input.GetKeyDown((KeyCode)105))
{
keyPressed = !keyPressed;
if (keyPressed)
{
NotificationCentre.Instance.PlayGenericNotification("Invincibility Enabled", (Flair)0);
}
else
{
NotificationCentre.Instance.PlayGenericNotification("Invincibility Disabled", (Flair)0);
}
}
if (keyPressed)
{
__instance.MakeInvincible(0.2f);
}
}
}
}