using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using GodMode;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "FusionGodMode", "7.0.0", "Natino", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("Natino's Invincibility")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Natino's Invincibility")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e32a3c10-51ab-4117-b2f0-b74e6f5f86db")]
[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 GodMode;
public class Main : MelonMod
{
public static bool isInvincible = true;
public override void OnInitializeMelon()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Page val = Page.Root.CreatePage("Invincibility", Color.green, 0, true);
val.CreateBool("God Mode", Color.green, isInvincible, (Action<bool>)delegate(bool value)
{
isInvincible = value;
});
}
public override void OnUpdate()
{
if (!isInvincible || (Object)(object)Player.RigManager == (Object)null)
{
return;
}
try
{
Il2CppArrayBase<Component> componentsInChildren = ((Component)Player.RigManager).GetComponentsInChildren<Component>(true);
foreach (Component item in componentsInChildren)
{
if ((Object)(object)item == (Object)null)
{
continue;
}
Type type = ((object)item).GetType();
if (type.Name.Contains("Vitals") || type.Name.Contains("Health"))
{
PropertyInfo propertyInfo = type.GetProperty("_currentHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetProperty("currentHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetProperty("Health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
PropertyInfo propertyInfo2 = type.GetProperty("maxHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetProperty("MaxHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (propertyInfo != null && propertyInfo2 != null && propertyInfo.CanWrite && propertyInfo2.CanRead)
{
object value = propertyInfo2.GetValue(item);
propertyInfo.SetValue(item, value);
}
}
}
}
catch
{
}
}
}
[HarmonyPatch]
public class ExactVitalsPatch
{
public static MethodBase TargetMethod()
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if (!assembly.GetName().Name.Contains("Marrow"))
{
continue;
}
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (!type.Name.EndsWith("Vitals") && !type.Name.EndsWith("Health"))
{
continue;
}
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.Name.Equals("TakeDamage", StringComparison.OrdinalIgnoreCase) || methodInfo.Name.Equals("ReceiveDamage", StringComparison.OrdinalIgnoreCase) || methodInfo.Name.Equals("Hurt", StringComparison.OrdinalIgnoreCase))
{
return methodInfo;
}
}
}
}
return null;
}
[HarmonyPrefix]
public static bool Prefix(object __instance)
{
if (!Main.isInvincible)
{
return true;
}
if (__instance != null && (Object)(object)Player.RigManager != (Object)null)
{
Component val = (Component)((__instance is Component) ? __instance : null);
if ((Object)(object)val != (Object)null && (Object)(object)val.transform.root == (Object)(object)((Component)Player.RigManager).transform.root)
{
return false;
}
}
return true;
}
}