Decompiled source of RemoveMentalistEnemy v1.1.0

com.github.zehsteam.RemoveMentalistEnemy.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using com.github.zehsteam.RemoveMentalistEnemy.Extensions;
using com.github.zehsteam.RemoveMentalistEnemy.Helpers;
using com.github.zehsteam.RemoveMentalistEnemy.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zehs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 Zehs")]
[assembly: AssemblyDescription("Removes the Mentalist (Floater/Alien) enemy.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+b0134f52c8599c69a46df83f88e55c1bc02f7ee4")]
[assembly: AssemblyProduct("RemoveMentalistEnemy")]
[assembly: AssemblyTitle("com.github.zehsteam.RemoveMentalistEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace com.github.zehsteam.RemoveMentalistEnemy
{
	[BepInPlugin("com.github.zehsteam.RemoveMentalistEnemy", "RemoveMentalistEnemy", "1.1.0")]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.zehsteam.RemoveMentalistEnemy");

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			Instance = this;
			Logger = Logger.CreateLogSource("com.github.zehsteam.RemoveMentalistEnemy");
			Logger.LogInfo((object)"RemoveMentalistEnemy has awoken!");
			_harmony.PatchAll(typeof(EnemyDirectorPatch));
			_harmony.PatchAll(typeof(LevelGeneratorPatch));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.RemoveMentalistEnemy";

		public const string PLUGIN_NAME = "RemoveMentalistEnemy";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace com.github.zehsteam.RemoveMentalistEnemy.Patches
{
	[HarmonyPatch(typeof(EnemyDirector))]
	internal static class EnemyDirectorPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			EnemyHelper.RemoveMentalistEnemyFromList(ref EnemyDirector.instance.enemiesDifficulty1);
			EnemyHelper.RemoveMentalistEnemyFromList(ref EnemyDirector.instance.enemiesDifficulty2);
			EnemyHelper.RemoveMentalistEnemyFromList(ref EnemyDirector.instance.enemiesDifficulty3);
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	internal static class LevelGeneratorPatch
	{
		[HarmonyPatch("EnemySpawn")]
		[HarmonyPrefix]
		private static bool EnemySpawnPatch(ref EnemySetup enemySetup)
		{
			if (enemySetup.IsMentalistEnemy())
			{
				Plugin.Logger.LogInfo((object)"Prevented mentalist enemy from spawning.");
				return false;
			}
			return true;
		}
	}
}
namespace com.github.zehsteam.RemoveMentalistEnemy.Helpers
{
	internal static class EnemyHelper
	{
		public static void RemoveMentalistEnemyFromList(ref List<EnemySetup> list)
		{
			list = list.Where((EnemySetup enemySetup) => !enemySetup.IsMentalistEnemy()).ToList();
		}
	}
}
namespace com.github.zehsteam.RemoveMentalistEnemy.Extensions
{
	internal static class EnemySetupExtensions
	{
		public static bool IsMentalistEnemy(this EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			return ((Object)enemySetup).name == "Enemy - Floater";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}