Decompiled source of InstantCarnage v1.1.0

mod dll/Instant Carnage.dll

Decompiled 14 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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("SHRAVAN'S EXTREME ONE PUNCH")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SHRAVAN'S EXTREME ONE PUNCH")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("70251743-3605-4e76-bf7e-cdf045c6a043")]
[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")]
[BepInPlugin("instant.carnage", "Instant Carnage", "1.1")]
public class Main : BaseUnityPlugin
{
	public static ConfigEntry<bool> InstantDeath;

	public static ConfigEntry<bool> RemoveLimbs;

	public static ConfigEntry<int> LimbCount;

	public static ConfigEntry<bool> Injury;

	public static ConfigEntry<bool> GodMode;

	private static bool ModEnabled = true;

	private string displayMessage = "";

	private float messageTimer = 0f;

	private void Awake()
	{
		InstantDeath = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "InstantDeath", false, "Kill enemy instantly");
		RemoveLimbs = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RemoveLimbs", true, "Enable limb dismemberment");
		LimbCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "LimbCount", 2, "Number of limbs to remove per hit");
		Injury = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Injury", true, "Apply injury");
		GodMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "GodMode", false, "Extreme mode: instant kill + all limbs removed");
		Harmony.CreateAndPatchAll(typeof(Main), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Instant Carnage Loaded \ud83d\udc80");
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)105))
		{
			ModEnabled = !ModEnabled;
			if (ModEnabled)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Carnage Mode: ON \ud83d\udc80");
				ShowMessage("CARNAGE MODE: ON \ud83d\udc80");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Carnage Mode: OFF");
				ShowMessage("CARNAGE MODE: OFF");
			}
		}
		if (messageTimer > 0f)
		{
			messageTimer -= Time.deltaTime;
		}
	}

	private void ShowMessage(string msg)
	{
		displayMessage = msg;
		messageTimer = 2.5f;
	}

	private void OnGUI()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		if (messageTimer > 0f)
		{
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.fontSize = 24;
			val.normal.textColor = Color.red;
			val.alignment = (TextAnchor)1;
			GUI.Label(new Rect((float)(Screen.width / 2 - 200), 50f, 400f, 40f), displayMessage, val);
		}
	}

	[HarmonyPatch(typeof(DFOGOCNBECG), "DIIMPIPKAFK")]
	[HarmonyPrefix]
	private static void NormalHit(DFOGOCNBECG __instance, DFOGOCNBECG ELPIOHCPOIJ)
	{
		if (__instance.EMDMDLNJFKP.id == Characters.star)
		{
			if (ELPIOHCPOIJ != null)
			{
				ApplyEffects(ELPIOHCPOIJ);
			}
		}
	}

	[HarmonyPatch(typeof(DFOGOCNBECG), "LKGOPCPNDNK")]
	[HarmonyPrefix]
	private static void ExtraHit(DFOGOCNBECG __instance, DFOGOCNBECG __0)
	{
		if (__instance.EMDMDLNJFKP.id == Characters.star)
		{
			if (__0 != null)
			{
				ApplyEffects(__0);
			}
		}
	}

	private static void ApplyEffects(DFOGOCNBECG target)
	{
		if (!ModEnabled)
		{
			return;
		}
		if (GodMode.Value)
		{
			target.HLGALFAGDGC = 0f;
			for (int i = 3; i <= 15; i++)
			{
				target.CMOPOKMFJMG(i, 999999f, 1f);
			}
			target.DMEDPMIPBAO = 1;
			return;
		}
		target.OKPAGLBJIOH = float.MaxValue;
		if (InstantDeath.Value)
		{
			target.HLGALFAGDGC = 0f;
		}
		if (RemoveLimbs.Value)
		{
			List<int> list = new List<int>();
			for (int j = 3; j <= 15; j++)
			{
				list.Add(j);
			}
			for (int k = 0; k < Mathf.Min(LimbCount.Value, list.Count); k++)
			{
				int index = Random.Range(0, list.Count);
				int num = list[index];
				target.CMOPOKMFJMG(num, 999999f, 1f);
				list.RemoveAt(index);
			}
		}
		if (Injury.Value)
		{
			target.PGJEOKAEPCL = Random.Range(1, 30);
			if (target.EMDMDLNJFKP.injuryTime < 2)
			{
				target.EMDMDLNJFKP.injuryTime = 2;
			}
		}
		target.DMEDPMIPBAO = 1;
	}
}