Decompiled source of OldHideousMassAttack v1.0.1

OldMassAttack.dll

Decompiled 2 years ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Configgy;
using HarmonyLib;
using OldMassAttack.Patches;
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("OldMassAttack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldMassAttack")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2f935b38-2155-48d1-82c9-b4df47cfc4b1")]
[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 OldMassAttack
{
	public enum Difficulty
	{
		Standard,
		Violent,
		Brutal
	}
	[BepInPlugin("D1g1tal.OldMassAttack", "OldMassAttack", "1.0.0")]
	public class MassPlugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("D1g1tal.OldMassAttack");

		[Configgable("", "Attack chance", 0, "The chance of the old blue homing attack happening")]
		public static float chance = 0.35f;

		[Configgable("", "Mod enabled", 0, null)]
		public static bool modenabled = true;

		[Configgable("", "Difficulty (and above)", 0, null)]
		public static Difficulty difficulty = Difficulty.Violent;

		[Configgable("", "Minimum player health for attack", 0, "The amount of health the player needs to have for the attack to be forced to happen, else it will be random chance")]
		public static int minHp = 45;

		private void Awake()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			ConfigBuilder val = new ConfigBuilder((string)null, (string)null);
			val.BuildAll();
			harmony.PatchAll(typeof(MassPatch));
		}
	}
}
namespace OldMassAttack.Patches
{
	[HarmonyPatch(typeof(Mass))]
	internal class MassPatch
	{
		[HarmonyPatch("ExplosiveAttack")]
		[HarmonyPrefix]
		private static void MassExpPatch(Mass __instance, int ___difficulty)
		{
			if (!MassPlugin.modenabled)
			{
				return;
			}
			int num = 0;
			switch (MassPlugin.difficulty)
			{
			case Difficulty.Standard:
				num = 2;
				break;
			case Difficulty.Violent:
				num = 3;
				break;
			case Difficulty.Brutal:
				num = 4;
				break;
			}
			if (num <= ___difficulty)
			{
				float value = Random.value;
				float chance = MassPlugin.chance;
				int hp = MonoSingleton<NewMovement>.Instance.hp;
				int minHp = MassPlugin.minHp;
				if (value <= chance || hp <= minHp)
				{
					__instance.HomingAttack();
				}
			}
			if (___difficulty >= num)
			{
			}
		}
	}
}