Decompiled source of DeathcatcherSchizophrenia v1.2.0

DcSchizo.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 FraudTweaks.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("DcSchizo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DcSchizo")]
[assembly: AssemblyTitle("DcSchizo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 FraudTweaks.Patches
{
	public class CoroutineRunner : MonoBehaviour
	{
		private static CoroutineRunner _instance;

		public static CoroutineRunner Instance
		{
			get
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject();
					_instance = val.AddComponent<CoroutineRunner>();
					Object.DontDestroyOnLoad((Object)(object)val);
				}
				return _instance;
			}
		}

		public Coroutine RunCoroutine(IEnumerator coroutine)
		{
			return ((MonoBehaviour)this).StartCoroutine(coroutine);
		}
	}
}
namespace DcSchizo
{
	[BepInPlugin("DcSchizo", "DcSchizo", "1.0.0")]
	public class DcSchizo : BaseUnityPlugin
	{
		public static List<object> ActiveList = new List<object>();

		public static Dictionary<GameObject, object> DcInfo = new Dictionary<GameObject, object>();

		public static Dictionary<object, GameObject[]> DcWave = new Dictionary<object, GameObject[]>();

		public static Dictionary<GameObject, List<GameObject>> DcDead = new Dictionary<GameObject, List<GameObject>>();

		public static Dictionary<GameObject, GameObject> DcLinkedEnemy = new Dictionary<GameObject, GameObject>();

		public static List<GameObject> PickedEnemies = new List<GameObject>();

		public static List<GameObject> EnabledEnemies = new List<GameObject>();

		private static bool Loaded = false;

		public static bool Hard = false;

		public static bool DebugMode = false;

		private PluginConfigurator config;

		public static GameObject Clicky = null;

		public static AssetBundle Clickyy = null;

		public static DcSchizo Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			config = PluginConfigurator.Create("DcSchizo", "DcSchizo");
			BoolField val = new BoolField(config.rootPanel, "Debug", "SchizoDeathCatcherDebug", false);
			BoolField val2 = new BoolField(config.rootPanel, "HardMode Softlock", "SchizoDeathCatcherSoftlock", false);
			BoolField val3 = new BoolField(config.rootPanel, "HardMode", "SchizoDeathCatcherHardMode", false);
			val.defaultValue = false;
			val2.defaultValue = false;
			val3.defaultValue = false;
			DebugMode = val.value;
			val2.value = false;
			Hard = val3.value;
			val.onValueChange += new BoolValueChangeEventDelegate(UpdateDebug);
			val2.onValueChange += new BoolValueChangeEventDelegate(UpdateSoftlock);
			val3.onValueChange += new BoolValueChangeEventDelegate(UpdateHard);
			SceneManager.sceneLoaded += delegate
			{
				if (!Loaded)
				{
					Patch();
					Loaded = true;
					ActiveList.Clear();
					ActiveList.Capacity = 0;
					DcWave.Clear();
					DcInfo.Clear();
					DcDead.Clear();
					PickedEnemies.Clear();
					PickedEnemies.Capacity = 0;
					string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DcClick");
					if (Object.op_Implicit((Object)(object)Clickyy))
					{
						Clickyy.Unload(true);
					}
					Clickyy = AssetBundle.LoadFromFile(text);
					Clicky = Clickyy.LoadAsset<GameObject>("Assets/New Folder/ClickySound.prefab");
					Clicky.AddComponent<PlayOnAwakeTracker>();
					Clicky.AddComponent<RemoveOnTime>().time = 1f;
					RandomPitch val4 = Clicky.AddComponent<RandomPitch>();
					val4.aud = Clicky.GetComponent<AudioSource>();
					val4.playOnEnable = true;
					val4.pitchVariation = 0.1f;
					val4.defaultPitch = 1f;
					val4.oneTime = true;
				}
			};
			Logger.LogInfo((object)"DcSchizo v1.0.0 has loaded!");
		}

		private static void UpdateDebug(BoolValueChangeEvent isDebug)
		{
			DebugMode = isDebug.value;
		}

		private static void UpdateSoftlock(BoolValueChangeEvent Softlock)
		{
			if (!Softlock.value)
			{
				return;
			}
			Softlock.value = false;
			foreach (GameObject key in DcInfo.Keys)
			{
				key.GetComponent<EnemyIdentifier>().Unbless(false);
				key.GetComponent<EnemyIdentifier>().InstaKill();
			}
		}

		private static void UpdateHard(BoolValueChangeEvent isHard)
		{
			Hard = isHard.value;
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("DcSchizo");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(Assembly.GetExecutingAssembly());
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "DcSchizo";

		public const string PLUGIN_NAME = "DcSchizo";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace DcSchizo.Patches
{
	public class DcFunction : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <ForEndOfFrame>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject obj;

			private int <i>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ForEndOfFrame>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (DcSchizo.DcLinkedEnemy.ContainsValue(obj))
					{
						<i>5__1 = 0;
						while (<i>5__1 < DcSchizo.DcLinkedEnemy.Count)
						{
							if ((Object)(object)DcSchizo.DcLinkedEnemy.Values.ElementAt(<i>5__1) == (Object)(object)obj)
							{
								if (!DcSchizo.EnabledEnemies.Contains(DcSchizo.DcLinkedEnemy.Values.ElementAt(<i>5__1)))
								{
									obj.SetActive(false);
									DcSchizo.DcLinkedEnemy.Keys.ElementAt(<i>5__1).SetActive(true);
								}
								break;
							}
							<i>5__1++;
						}
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<ForEndOfFrame>d__0))]
		public static IEnumerator ForEndOfFrame(GameObject obj)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ForEndOfFrame>d__0(0)
			{
				obj = obj
			};
		}

		public void OnEnable()
		{
			CoroutineRunner.Instance.RunCoroutine(ForEndOfFrame(((Component)this).gameObject));
		}
	}
	public class EnemyFunction
	{
		public static bool FindTrigger(GameObject[] objects)
		{
			object[] array = FindEnemy(objects, parent: false, parent2: false);
			if (!array.Any())
			{
				return true;
			}
			foreach (GameObject val in objects)
			{
				ActivateNextWave[] componentsInChildren = val.GetComponentsInChildren<ActivateNextWave>(true);
				ActivateArena[] componentsInChildren2 = val.GetComponentsInChildren<ActivateArena>(true);
				if (componentsInChildren.Any())
				{
					ActivateNextWave[] array2 = componentsInChildren;
					foreach (ActivateNextWave val2 in array2)
					{
						GameObject[] array3 = (GameObject[])FindEnemy(val2.nextEnemies, parent: false, parent2: false);
						if (!((array?.Any() ?? false) & (array3?.Any() ?? false)))
						{
							continue;
						}
						GameObject[] array4 = array3;
						foreach (GameObject val3 in array4)
						{
							if (array.Contains(val3))
							{
								if (DcSchizo.DebugMode)
								{
									DcSchizo.Logger.LogInfo((object)((Object)val3).name);
								}
								return true;
							}
						}
					}
				}
				if (!componentsInChildren2.Any())
				{
					continue;
				}
				ActivateArena[] array5 = componentsInChildren2;
				foreach (ActivateArena val4 in array5)
				{
					GameObject[] array6 = (GameObject[])FindEnemy(val4.enemies, parent: false, parent2: false);
					if (!((array?.Any() ?? false) & (array6?.Any() ?? false)))
					{
						continue;
					}
					GameObject[] array7 = array6;
					foreach (GameObject val5 in array7)
					{
						if (array.Contains(val5))
						{
							if (DcSchizo.DebugMode)
							{
								DcSchizo.Logger.LogInfo((object)((Object)val5).name);
							}
							return true;
						}
					}
				}
			}
			return false;
		}

		public static object[] FindEnemy(GameObject[] objects, bool parent = true, bool parent2 = true)
		{
			try
			{
				List<GameObject> list = new List<GameObject>();
				for (int i = 0; i < objects.Length; i++)
				{
					EnemyIdentifier val = objects[i].GetComponentInChildren<EnemyIdentifier>(true);
					if (parent & ((Object)(object)objects[i].transform.parent != (Object)null && (Object)(object)val == (Object)null))
					{
						val = ((Component)objects[i].transform.parent).GetComponentInChildren<EnemyIdentifier>(true);
					}
					if (parent2 & ((Object)(object)val == (Object)null))
					{
						val = objects[i].GetComponentInParent<EnemyIdentifier>(true);
					}
					if ((Object)(object)val != (Object)null)
					{
						list.Add(((Component)val).gameObject);
					}
				}
				return list.ToArray();
			}
			catch
			{
				DcSchizo.Logger.LogWarning((object)"Mod is tweaking about something i cant be bothered to fix");
				return new object[1] { false };
			}
		}

		public static object SchizoArena(GameObject[] objects, object __instance)
		{
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			if (DcSchizo.DebugMode)
			{
				DcSchizo.Logger.LogInfo(__instance);
			}
			foreach (GameObject val in objects)
			{
				if (DcSchizo.DebugMode)
				{
					DcSchizo.Logger.LogInfo((object)val);
				}
			}
			if (DcSchizo.ActiveList.Contains(__instance))
			{
				return false;
			}
			DcSchizo.ActiveList.Add(__instance);
			if (objects.Length == 0)
			{
				return false;
			}
			GameObject[] array = (GameObject[])FindEnemy(objects);
			if (!array.Any())
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)array[0]))
			{
				return false;
			}
			int num = new Random().Next(0, array.Length - 1);
			GameObject val2 = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.deathCatcher, array[num].transform.parent);
			val2.transform.position = array[num].transform.position;
			val2.transform.rotation = array[num].transform.rotation;
			BossHealthBar val3 = array[num].GetComponentInChildren<BossHealthBar>(true);
			if (((Object)(object)val3 == (Object)null) & ((Object)(object)array[num].transform.parent != (Object)null))
			{
				val3 = ((Component)array[num].transform.parent).GetComponentInChildren<BossHealthBar>(true);
			}
			if ((Object)(object)val3 == (Object)null)
			{
				val3 = array[num].GetComponentInParent<BossHealthBar>(true);
			}
			if ((Object)(object)val3 != (Object)null)
			{
				BossHealthBar val4 = val2.AddComponent<BossHealthBar>();
				val4.bossName = val3.bossName;
				val4.source = (IEnemyHealthDetails)(object)val2.GetComponent<EnemyIdentifier>();
				List<HealthLayer> list = new List<HealthLayer>();
				HealthLayer[] healthLayers = val3.healthLayers;
				foreach (HealthLayer val5 in healthLayers)
				{
					HealthLayer val6 = new HealthLayer();
					val6.health = val2.GetComponent<EnemyIdentifier>().health / (float)val3.healthLayers.Length;
					list.Add(val6);
				}
				val4.healthLayers = list.ToArray();
			}
			array[num].AddComponent<DcFunction>();
			DcSchizo.DcLinkedEnemy.Add(val2, array[num]);
			array[num].SetActive(false);
			array[num] = val2;
			val2.SetActive(false);
			return val2;
		}
	}
	[HarmonyPatch(typeof(ActivateArena))]
	public class Schizo1
	{
		[HarmonyPatch("SpawnEnemy")]
		[HarmonyPrefix]
		private static void SchizoArena(ActivateArena __instance)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			if (DcSchizo.DcLinkedEnemy.Any())
			{
				foreach (GameObject value2 in DcSchizo.DcLinkedEnemy.Values)
				{
					if (!((Object)(object)value2 == (Object)null))
					{
						value2.SetActive(false);
					}
				}
			}
			if (!DcSchizo.ActiveList.Contains(__instance))
			{
				object obj = EnemyFunction.SchizoArena(__instance.enemies, __instance);
				if (!(obj is bool) && obj != null)
				{
					DcSchizo.DcInfo.Add((GameObject)obj, __instance);
					GameObject[] value = (GameObject[])EnemyFunction.FindEnemy(__instance.enemies);
					DcSchizo.DcWave.Add(__instance, value);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ActivateNextWave))]
	public class Schizo2
	{
		[HarmonyPatch("SpawnEnemy")]
		[HarmonyPrefix]
		private static void SchizoArena2(ActivateNextWave __instance)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			if (DcSchizo.DcInfo.ContainsValue(__instance) || DcSchizo.ActiveList.Contains(__instance))
			{
				return;
			}
			object obj = EnemyFunction.SchizoArena(__instance.nextEnemies, __instance);
			if (obj is bool || obj == null)
			{
				return;
			}
			DcSchizo.DcInfo.Add((GameObject)obj, __instance);
			GameObject[] array = (GameObject[])EnemyFunction.FindEnemy(__instance.nextEnemies);
			GameObject[] array2 = array;
			foreach (GameObject item in array2)
			{
				if (!DcSchizo.PickedEnemies.Contains(item))
				{
					DcSchizo.PickedEnemies.Add(item);
				}
			}
			DcSchizo.DcWave.Add(__instance, array);
		}
	}
	[HarmonyPatch(typeof(ActivateNextWaveHP))]
	public class Schizo4
	{
		[HarmonyPatch("SpawnEnemy")]
		[HarmonyPrefix]
		private static void SchizoArena4(ActivateNextWaveHP __instance)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			if (DcSchizo.DcInfo.ContainsValue(__instance) || DcSchizo.ActiveList.Contains(__instance))
			{
				return;
			}
			object obj = EnemyFunction.SchizoArena(__instance.nextEnemies, __instance);
			if (obj is bool || obj == null)
			{
				return;
			}
			DcSchizo.DcInfo.Add((GameObject)obj, __instance);
			GameObject[] array = (GameObject[])EnemyFunction.FindEnemy(__instance.nextEnemies);
			GameObject[] array2 = array;
			foreach (GameObject item in array2)
			{
				if (!DcSchizo.PickedEnemies.Contains(item))
				{
					DcSchizo.PickedEnemies.Add(item);
				}
			}
			DcSchizo.DcWave.Add(__instance, array);
		}
	}
	[HarmonyPatch(typeof(UltrakillEvent))]
	public class Schizo3
	{
		public static void RemoveAt<T>(ref T[] arr, int index)
		{
			for (int i = index; i < arr.Length - 1; i++)
			{
				arr[i] = arr[i + 1];
			}
			Array.Resize(ref arr, arr.Length - 1);
		}

		[HarmonyPatch("Invoke")]
		[HarmonyPostfix]
		private static void SchizoArena3(UltrakillEvent __instance)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			if (EnemyFunction.FindTrigger(__instance.toActivateObjects))
			{
				return;
			}
			object[] array = EnemyFunction.FindEnemy(__instance.toActivateObjects);
			if (false)
			{
				return;
			}
			GameObject[] array2 = (GameObject[])array;
			foreach (GameObject item in array2)
			{
				if (DcSchizo.PickedEnemies.Contains(item))
				{
					return;
				}
				DcSchizo.PickedEnemies.Add(item);
			}
			if (!DcSchizo.DcInfo.ContainsValue(__instance) && !DcSchizo.ActiveList.Contains(__instance))
			{
				object obj = EnemyFunction.SchizoArena(__instance.toActivateObjects, __instance);
				if (!(obj is bool) && obj != null)
				{
					DcSchizo.DcInfo.Add((GameObject)obj, __instance);
					DcSchizo.DcWave.Add(__instance, (GameObject[])array);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Deathcatcher))]
	public class HardMode
	{
		[CompilerGenerated]
		private sealed class <InstakillWait>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyIdentifier obj;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InstakillWait>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					DcSchizo.EnabledEnemies.Remove(((Component)obj).gameObject);
					obj.InstaKill();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<InstakillWait>d__0))]
		public static IEnumerator InstakillWait(EnemyIdentifier obj)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InstakillWait>d__0(0)
			{
				obj = obj
			};
		}

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void Hard(Deathcatcher __instance, ref EnemyIdentifier ___eid)
		{
			if (DcSchizo.Hard && DcSchizo.DcInfo.ContainsKey(((Component)__instance).gameObject))
			{
				___eid.Bless(false);
				__instance.killPuppetsOnDeath = false;
			}
		}

		[HarmonyPatch("Death")]
		[HarmonyPrefix]
		private static bool PreventDeath(Deathcatcher __instance, ref EnemyIdentifier ___eid, ref CapsuleCollider ___col, ref GoreZone ___affectedGoreZone)
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			if (___eid.blessed)
			{
				return false;
			}
			BossHealthBar component = ((Component)__instance).gameObject.GetComponent<BossHealthBar>();
			if ((Object)(object)component != (Object)null && component.healthLayers.Length != 0)
			{
				EnemyIdentifier obj = ___eid;
				obj.health -= component.healthLayers.Last().health;
				component.healthLayers = component.healthLayers[..^1];
				if (component.healthLayers.Length != 0)
				{
					GoreZone val = (GoreZone)(Object.op_Implicit((Object)(object)___affectedGoreZone) ? ((object)___affectedGoreZone) : ((object)GoreZone.ResolveGoreZone(((Component)__instance).transform)));
					GameObject val2 = null;
					Bloodsplatter val3 = default(Bloodsplatter);
					for (int i = 0; i < 3; i++)
					{
						val2 = MonoSingleton<BloodsplatterManager>.Instance.GetGore((GoreType)0, ___eid, false);
						if (!Object.op_Implicit((Object)(object)val2))
						{
							break;
						}
						Transform transform = val2.transform;
						Bounds bounds = ((Collider)___col).bounds;
						transform.position = ((Bounds)(ref bounds)).center;
						val2.transform.SetParent(val.goreZone, true);
						val2.SetActive(true);
						if (val2.TryGetComponent<Bloodsplatter>(ref val3))
						{
							val3.GetReady();
						}
					}
					return false;
				}
			}
			DcSchizo.DcWave.Remove(DcSchizo.DcInfo[((Component)__instance).gameObject]);
			DcSchizo.DcInfo.Remove(((Component)__instance).gameObject);
			DcSchizo.DcDead.Remove(((Component)__instance).gameObject);
			if (DcSchizo.DcLinkedEnemy.ContainsKey(((Component)__instance).gameObject))
			{
				DcSchizo.DcLinkedEnemy[((Component)__instance).gameObject].SetActive(true);
				DcSchizo.EnabledEnemies.Add(DcSchizo.DcLinkedEnemy[((Component)__instance).gameObject]);
				EnemyIdentifier val4 = DcSchizo.DcLinkedEnemy[((Component)__instance).gameObject].GetComponent<EnemyIdentifier>();
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = DcSchizo.DcLinkedEnemy[((Component)__instance).gameObject].GetComponentInChildren<EnemyIdentifier>(true);
				}
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ((Component)DcSchizo.DcLinkedEnemy[((Component)__instance).gameObject].transform.parent).GetComponentInChildren<EnemyIdentifier>(true);
				}
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = DcSchizo.DcLinkedEnemy[((Component)__instance).gameObject].GetComponentInParent<EnemyIdentifier>(true);
				}
				if ((Object)(object)val4 != (Object)null)
				{
					CoroutineRunner.Instance.RunCoroutine(InstakillWait(val4));
				}
				DcSchizo.DcLinkedEnemy.Remove(((Component)__instance).gameObject);
			}
			return true;
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdateHard(Deathcatcher __instance)
		{
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			if (DcSchizo.Hard && DcSchizo.DcInfo.ContainsKey(((Component)__instance).gameObject) && ((Component)__instance).GetComponent<EnemyIdentifier>().blessed)
			{
				FieldRef<Deathcatcher, List<CaughtEnemy>> val = AccessTools.FieldRefAccess<Deathcatcher, List<CaughtEnemy>>("deadCaughtEnemies");
				List<CaughtEnemy> list = val.Invoke(__instance);
				GameObject[] array = DcSchizo.DcWave[DcSchizo.DcInfo[((Component)__instance).gameObject]];
				if (!DcSchizo.DcDead.ContainsKey(((Component)__instance).gameObject))
				{
					List<GameObject> value = new List<GameObject>(1);
					DcSchizo.DcDead.Add(((Component)__instance).gameObject, value);
				}
				if (array == null || !array.Any())
				{
					return;
				}
				GameObject[] array2 = array;
				foreach (GameObject val2 in array2)
				{
					if ((Object)(object)val2 != (Object)null && val2.activeInHierarchy && !DcSchizo.DcDead[((Component)__instance).gameObject].Contains(val2))
					{
						DcSchizo.DcDead[((Component)__instance).gameObject].Add(val2);
					}
				}
				if (!DcSchizo.DcDead[((Component)__instance).gameObject].Contains(((Component)__instance).gameObject))
				{
					DcSchizo.DcDead[((Component)__instance).gameObject].Add(((Component)__instance).gameObject);
				}
				if (DcSchizo.DcDead[((Component)__instance).gameObject].Count > array.Length)
				{
					int num = 0;
					do
					{
						num++;
						foreach (GameObject item in DcSchizo.DcDead[((Component)__instance).gameObject])
						{
							if ((Object)(object)item == (Object)null)
							{
								DcSchizo.DcDead[((Component)__instance).gameObject].Remove(item);
								break;
							}
						}
					}
					while ((DcSchizo.DcDead[((Component)__instance).gameObject].Count > array.Length) & (num < DcSchizo.DcDead[((Component)__instance).gameObject].Count));
				}
				int num2 = DcSchizo.DcDead[((Component)__instance).gameObject].Count - 1;
				int num3 = 1;
				if (DcSchizo.DcLinkedEnemy.ContainsKey(((Component)__instance).gameObject))
				{
				}
				if (DcSchizo.DebugMode)
				{
					DcSchizo.Logger.LogInfo((object)("Dead " + list.Count + " - Count " + DcSchizo.DcDead[((Component)__instance).gameObject].Count + " - Length " + array.Length + " - Required " + num2));
				}
				if (((array.Length > num3) & (DcSchizo.DcDead[((Component)__instance).gameObject].Capacity > num3) & (list.Count >= num2)) || array.Length <= 1)
				{
					((Component)__instance).GetComponent<EnemyIdentifier>().Unbless(false);
					if ((Object)(object)DcSchizo.Clicky != (Object)null)
					{
						GameObject val3 = Object.Instantiate<GameObject>(DcSchizo.Clicky);
						val3.transform.position = ((Component)__instance).transform.position;
						Object.Destroy((Object)(object)val3.GetComponent<VirtualAudioFilter>());
					}
				}
			}
			else if (!DcSchizo.Hard && DcSchizo.DcInfo.ContainsKey(((Component)__instance).gameObject) && ((Component)__instance).GetComponent<EnemyIdentifier>().blessed)
			{
				((Component)__instance).GetComponent<EnemyIdentifier>().Unbless(false);
				__instance.killPuppetsOnDeath = true;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}