Decompiled source of BillionNemesis v4.2.1

BillionNemesis.dll

Decompiled a month 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 BillionNemesis.Func;
using Discord;
using HarmonyLib;
using Logic;
using Microsoft.CodeAnalysis;
using SpawnerArmExtras;
using Steamworks;
using TMPro;
using ThornClient.Core;
using ThornClient.Core.ConfigurableElements;
using ULTRAKILL.Cheats;
using ULTRAKILL.Enemy;
using ULTRAKILL.Portal;
using ULTRAKILL.Portal.Geometry;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.Animations.Rigging;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BillionNemesis")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("4.2.1.0")]
[assembly: AssemblyInformationalVersion("4.2.1+ce18bb88a12efa5b5eb07297d37d66b352688ed4")]
[assembly: AssemblyProduct("Billion Nemesis")]
[assembly: AssemblyTitle("BillionNemesis")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BillionNemesis
{
	[BepInPlugin("billy.billionnemesis", "Billion Nemesis", "4.2.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static bool IsPatched = false;

		public static bool IsAltPatched = false;

		public const string NemesisColorHex = "ff00af";

		public static bool ForceDefaultLevelPath = false;

		public static Dictionary<string, Transform> ObjectsLookedUpThisScene = new Dictionary<string, Transform>();

		public static bool DisableEnemyVertexLighting = false;

		public static bool DisableEnemyFriendlyFire = false;

		private static readonly Harmony Harmony = new Harmony("billy.billionnemesis");

		internal static ManualLogSource Logger;

		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.PatchAll();
			Logger.LogInfo((object)"Plugin BillionNemesis is almost loaded!");
			SceneManager.activeSceneChanged += SceneManagerActiveSceneChanged;
			SceneManager.sceneLoaded += SceneManagerSceneLoaded;
			LevelAssets.GetAssets();
			Logger.LogInfo((object)"Plugin BillionNemesis is loadedest!");
		}

		public static void EnabledValueChanged(bool v)
		{
			RankStuff.UpdateRanksAndColors();
			MainMenuChangeTitle();
		}

		public static void AltEnabledValueChanged(bool v)
		{
			RankStuff.UpdateRanksAndColors();
		}

		public static void SceneManagerActiveSceneChanged(Scene arg0, Scene arg1)
		{
			ResetSceneVariables();
			if (Util.IsEnabled())
			{
				LevelPatching.TryRunLevelPatch();
			}
		}

		public static void ResetSceneVariables()
		{
			IsPatched = false;
			IsAltPatched = false;
			ObjectsLookedUpThisScene = new Dictionary<string, Transform>();
			DisableEnemyVertexLighting = false;
			DisableEnemyFriendlyFire = false;
			TeleportOnCondition.GlobalConditions = new Dictionary<int, List<TeleportCondition>>();
			VariableDelay.AllDelays = new Dictionary<string, float>();
			ObjectFuncs.NemesisNavMesh = null;
		}

		public static void SceneManagerSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			MainMenuChangeTitle();
			if (SceneHelper.CurrentScene != "Bootstrap" && SceneHelper.CurrentScene != "Intro" && SceneHelper.CurrentScene != "Main Menu")
			{
				SpawnMenuPatch.MakeAllSpawnables();
			}
			LevelAssets.SetUpCustomEnemyPlaceholders();
		}

		public static void MainMenuChangeTitle()
		{
			if (SceneHelper.CurrentScene != "Main Menu")
			{
				return;
			}
			string text = "\n<color=#ff00af>(NEMESIS)</color>";
			Transform val = GeneralFuncs.FindInactive("Canvas/Chapter Select/Title (2)");
			TextMeshProUGUI val2 = ((val != null) ? ((Component)val).GetComponent<TextMeshProUGUI>() : null);
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			if (Util.IsEnabled())
			{
				if (!((TMP_Text)val2).text.Contains(text))
				{
					((TMP_Text)val2).text = ((TMP_Text)val2).text + text;
					((TMP_Text)val2).verticalAlignment = (VerticalAlignmentOptions)256;
				}
			}
			else
			{
				((TMP_Text)val2).text = ((TMP_Text)val2).text.Replace(text, "");
				((TMP_Text)val2).verticalAlignment = (VerticalAlignmentOptions)512;
			}
		}
	}
	public static class ChangedInfo
	{
		public static string[] ChangedChapters = new string[2] { "Prelude", "Act I" };

		public static string[] ChangedLayers = new string[5] { "Overture", "Layer 1 Limbo", "Layer 2 Lust", "Layer 3 Gluttony", "Layer 4 Greed" };

		public static int[] ChangedLevels = new int[19]
		{
			1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
			11, 12, 13, 14, 15, 16, 17, 18, 19
		};

		public static int[] AltChangedLevels = new int[6] { 667, 1, 3, 6, 10, 16 };

		public static string[] ChangedLevelScenes = new string[19]
		{
			"Level 0-1", "Level 0-2", "Level 0-3", "Level 0-4", "Level 0-5", "Level 1-1", "Level 1-2", "Level 1-3", "Level 1-4", "Level 2-1",
			"Level 2-2", "Level 2-3", "Level 2-4", "Level 3-1", "Level 3-2", "Level 4-1", "Level 4-2", "Level 4-3", "Level 4-4"
		};

		public static int[] LevelsWithoutSecrets = new int[9] { 5, 9, 13, 15, 19, 23, 666, 667, 668 };

		public static Dictionary<int, float> LevelTitleLineSpacing = new Dictionary<int, float>
		{
			[11] = -20f,
			[22] = -20f,
			[666] = -20f,
			[667] = -20f
		};

		public static Dictionary<int, float> AltLevelTitleLineSpacing = new Dictionary<int, float> { [3] = -20f };

		public static Dictionary<int, float> TabPanelTitleFontSizes = new Dictionary<int, float>
		{
			[11] = 22f,
			[22] = 22f,
			[666] = 22f,
			[667] = 22f
		};

		public static Dictionary<int, float> AltTabPanelTitleFontSizes = new Dictionary<int, float> { [667] = 19.5f };

		public static Dictionary<string, string> NewLevelNames = new Dictionary<string, string>
		{
			["INTO THE FIRE"] = "UNTO THE CORE",
			["THE MEATGRINDER"] = "THE BACKBURNER",
			["DOUBLE DOWN"] = "<size=150%>UP</size> THE ANTE",
			["A ONE-MACHINE ARMY"] = "DELTA P",
			["CERBERUS"] = "the Kiln",
			["HEART OF THE SUNRISE"] = "HARMED TO DEMISE",
			["THE BURNING WORLD"] = "BLOOD ON THE LEAVES",
			["HALLS OF SACRED REMAINS"] = "DANCE OF THE KNIGHTS",
			["CLAIR DE LUNE"] = "O FORTUNA",
			["BRIDGEBURNER"] = "AFTERIMAGE",
			["DEATH AT 20,000 VOLTS"] = "HARDER, BETTER, FASTER, STRONGER",
			["SHEER HEART ATTACK"] = "CURRENTS",
			["COURT OF THE CORPSE KING"] = "HYPERDRAMA",
			["BELLY OF THE BEAST"] = "THE MAW OF FOREVER",
			["IN THE FLESH"] = "ANGEL EATER",
			["SLAVES TO POWER"] = "FIGHTING GOLD",
			["GOD DAMN THE SUN"] = "GRAH",
			["A SHOT IN THE DARK"] = "LIGHTBRINGER",
			["CLAIR DE SOLEIL"] = "VELUT LUNA"
		};

		public static Dictionary<string, string> PlainLevelNames = new Dictionary<string, string> { ["<size=150%>UP</size> THE ANTE"] = "UP THE ANTE" };

		public static Dictionary<string, string> AltLevelNames = new Dictionary<string, string> { ["WAIT OF THE WORLD"] = "I TRIED TO CLOSE MY EYES, MY HANDS WERE GONE" };

		public static Dictionary<string, string> AltLevelNumbers = new Dictionary<string, string> { ["P-2"] = "P-E" };
	}
	public class CaseUnstucker : MonoBehaviour
	{
		public GameObject opener;

		public EnemyIdentifier eid;

		public CaseUnstuckerTrigger trigger;

		public float distanceLimit = 3f;

		public void Awake()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = ((Component)this).transform.Find("Opener");
			opener = ((obj != null) ? ((Component)obj).gameObject : null);
			eid = ((Component)this).GetComponentInChildren<EnemyIdentifier>(true);
			if (!((Object)(object)((Component)this).transform.Find("CaseUnstuckerTrigger") != (Object)null))
			{
				Vector3 val = ((Component)this).transform.position + 0.5f * ((Component)this).transform.right + 0.5f * ((Component)this).transform.up + 0.5f * ((Component)this).transform.forward;
				Vector3 oppositeCorner = val + new Vector3(4f, 7.5f, 4f);
				Transform transform = ArenaFuncs.MakeTrigger(((Component)this).transform, "CaseUnstuckerTrigger", val, oppositeCorner).transform;
				transform.position = ((Component)this).transform.position + 2.5f * ((Component)this).transform.right + 4.25f * ((Component)this).transform.up + 2.5f * ((Component)this).transform.forward;
				transform.localRotation = Quaternion.identity;
				((Object)transform).name = "CaseUnstuckerTrigger";
				trigger = ComponentExtensions.GetOrAddComponent<CaseUnstuckerTrigger>((Component)(object)transform);
				trigger.eid = eid;
				trigger.caseUnstucker = this;
			}
		}

		public void Update()
		{
			if (!((Object)(object)opener == (Object)null) && opener.activeSelf && opener.activeSelf)
			{
				DisableColliders();
				((Behaviour)this).enabled = false;
			}
		}

		public void DisableColliders()
		{
			Transform[] array = (Transform[])(object)new Transform[4]
			{
				((Component)this).transform.Find("Cube (41)"),
				((Component)this).transform.Find("Cube (42)"),
				((Component)this).transform.Find("Cube (43)"),
				((Component)this).transform.Find("Cube (44)")
			};
			Transform[] array2 = array;
			foreach (Transform val in array2)
			{
				Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(true);
				foreach (Collider val2 in componentsInChildren)
				{
					val2.enabled = false;
				}
			}
			((Component)this).GetComponent<Collider>().enabled = false;
		}
	}
	public class CaseUnstuckerTrigger : MonoBehaviour
	{
		public EnemyIdentifier eid;

		public CaseUnstucker caseUnstucker;

		public void OnTriggerStay(Collider other)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)other).CompareTag("Player") && ((Behaviour)caseUnstucker).enabled && !((Object)(object)eid == (Object)null) && !MonoSingleton<NewMovement>.Instance.rb.isKinematic)
			{
				Transform transform = ((Component)MonoSingleton<NewMovement>.Instance).transform;
				transform.position += 10f * ((Component)this).transform.parent.up;
			}
		}
	}
	public class CommonBoss : MonoBehaviour
	{
		public bool bossVersion = false;
	}
	[HarmonyPatch(typeof(V2))]
	public class V2CommonPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(V2), "Start")]
		public static void StartPostfix(V2 __instance)
		{
			CommonBoss component = ((Component)__instance).GetComponent<CommonBoss>();
			if (!((Object)(object)component == (Object)null))
			{
				__instance.bossVersion = component.bossVersion;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(V2), "BeginEscape")]
		public static void BeginEscapePrefix(V2 __instance)
		{
			CommonBoss component = ((Component)__instance).GetComponent<CommonBoss>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			Enemy component2 = ((Component)__instance).GetComponent<Enemy>();
			if (!((Object)(object)component2 == (Object)null))
			{
				ActivateNextWave componentInParent = ((Component)component2).GetComponentInParent<ActivateNextWave>();
				if (componentInParent != null)
				{
					componentInParent.AddDeadEnemy();
				}
			}
		}
	}
	public class EnemyBlockBreakables : MonoBehaviour
	{
		public EnemyIdentifier eid;

		public void Awake()
		{
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
		}

		public void Start()
		{
			BreakableAllower[] array = Object.FindObjectsByType<BreakableAllower>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			BreakableAllower[] array2 = array;
			foreach (BreakableAllower breakableAllower in array2)
			{
				breakableAllower.enemyBlocks.Add(this);
			}
		}
	}
	public class IdolCase : MonoBehaviour
	{
		public Idol idol;

		public Transform openAlertParent;

		public void Start()
		{
			openAlertParent = ((Component)this).transform.Find("OpenAlertParent");
		}

		public void Update()
		{
			if (!((Object)(object)idol != (Object)null))
			{
				((Component)openAlertParent).gameObject.SetActive(false);
				((Behaviour)this).enabled = false;
			}
		}
	}
	public class InsurrectionistFixer : MonoBehaviour
	{
		public Sisyphus sisyphus;

		public bool movedBoulderUp = false;

		public bool movedBoulderDown = false;

		public void Awake()
		{
			sisyphus = ((Component)this).GetComponent<Sisyphus>();
		}

		public void Update()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)sisyphus == (Object)null)
			{
				return;
			}
			if ((int)sisyphus.m_AttackType == 1)
			{
				if (!movedBoulderUp)
				{
					ref Vector3 position = ref sisyphus.m_StartPose.position;
					position += 7.5f * Vector3.up;
					movedBoulderUp = true;
					movedBoulderDown = false;
				}
			}
			else if (!movedBoulderDown && movedBoulderUp)
			{
				ref Vector3 position2 = ref sisyphus.m_StartPose.position;
				position2 -= 7.5f * Vector3.up;
				movedBoulderUp = false;
				movedBoulderDown = true;
			}
		}
	}
	[HarmonyPatch(typeof(Sisyphus), "Start")]
	public class InsurrectionistFixerPatch
	{
		public static void Postfix(Sisyphus __instance)
		{
			if (Util.IsPatched())
			{
				ComponentExtensions.GetOrAddComponent<InsurrectionistFixer>((Component)(object)__instance);
			}
		}
	}
	public class DontCatch : MonoBehaviour
	{
	}
	public class DontEnrage : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(Drone), "Enrage")]
	public class DroneDontEnragePatch
	{
		public static bool Prefix(Drone __instance)
		{
			DontEnrage component = ((Component)__instance).GetComponent<DontEnrage>();
			if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(V2), "Enrage", new Type[] { typeof(string) })]
	public class V2DontEnragePatch
	{
		public static bool Prefix(string enrageName, V2 __instance)
		{
			DontEnrage component = ((Component)__instance).GetComponent<DontEnrage>();
			if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled)
			{
				return false;
			}
			return true;
		}
	}
	public class IdolDontChangeTarget : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(Idol), "PickNewTarget")]
	public class IdolDontChangeTargetPatch
	{
		[HarmonyPriority(600)]
		public static bool Prefix(bool ignoreIfAlreadyTargeting, Idol __instance)
		{
			if ((Object)(object)((Component)__instance).GetComponent<IdolDontChangeTarget>() != (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	public class InsurrectionistNoStomped : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(Sisyphus), "FallKillEnemy")]
	public class InsurrectionistNoStompedPatch
	{
		public static bool Prefix(EnemyIdentifier eid, Sisyphus __instance)
		{
			InsurrectionistNoStomped component = ((Component)__instance).GetComponent<InsurrectionistNoStomped>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			Collider val = default(Collider);
			if (((Component)eid).TryGetComponent<Collider>(ref val))
			{
				Physics.IgnoreCollision(__instance.col, val, true);
			}
			return false;
		}
	}
	public class MoveTo : MonoBehaviour
	{
		public float speed = 20f;

		public Transform targetTransform = null;

		public bool removeOnDeath = true;

		public float delay = -1f;

		public float delayProgress = 0f;

		public bool moveX = true;

		public bool moveY = true;

		public bool moveZ = true;

		public float targetX = 0f;

		public float targetY = 0f;

		public float targetZ = 0f;

		public MoveTo MoveXYZ(bool moveX = true, bool moveY = true, bool moveZ = true)
		{
			this.moveX = moveX;
			this.moveY = moveY;
			this.moveZ = moveZ;
			return this;
		}

		public MoveTo TargetXYZ(float targetX = 0f, float targetY = 0f, float targetZ = 0f)
		{
			this.targetX = targetX;
			this.targetY = targetY;
			this.targetZ = targetZ;
			return this;
		}

		public void Update()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)targetTransform == (Object)null))
			{
				if (delayProgress < delay)
				{
					delayProgress += Time.deltaTime;
					return;
				}
				Vector3 position = targetTransform.position;
				targetTransform.position = new Vector3(moveX ? Mathf.MoveTowards(position.x, targetX, speed * Time.deltaTime) : position.x, moveY ? Mathf.MoveTowards(position.y, targetY, speed * Time.deltaTime) : position.y, moveZ ? Mathf.MoveTowards(position.z, targetZ, speed * Time.deltaTime) : position.z);
			}
		}

		public void Start()
		{
			SaveForPuppet();
		}

		public void SaveForPuppet()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			EnemyIdentifier componentInChildren = ((Component)this).GetComponentInChildren<EnemyIdentifier>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				return;
			}
			GameObject[] activateOnDeath = componentInChildren.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (((Object)val).name == "MoveTo")
				{
					return;
				}
			}
			GameObject val2 = new GameObject("MoveTo");
			MoveTo newMover = val2.AddComponent<MoveTo>();
			CopyValuesTo(newMover);
			Util.ArrayAdd(ref componentInChildren.activateOnDeath, val2);
		}

		public void CopyValuesTo(MoveTo newMover)
		{
			newMover.speed = speed;
			newMover.targetTransform = targetTransform;
			newMover.removeOnDeath = removeOnDeath;
			newMover.MoveXYZ(moveX, moveY, moveZ);
			newMover.TargetXYZ(targetX, targetY, targetZ);
		}
	}
	[HarmonyPatch(typeof(EnemyIdentifier), "ProcessDeath")]
	public class DeathPatch
	{
		public static void Prefix(EnemyIdentifier __instance)
		{
			MoveTo component = ((Component)__instance).GetComponent<MoveTo>();
			if ((Object)(object)component != (Object)null && component.removeOnDeath)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public class PowerNoJuggle : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(Power), "JuggleStart")]
	public class PowerNoJugglePatch
	{
		public static void Postfix(Power __instance)
		{
			if (!((Object)(object)((Component)__instance).GetComponent<PowerNoJuggle>() == (Object)null))
			{
				__instance.JuggleStop(false);
			}
		}
	}
	public class PowerStayClose : MonoBehaviour
	{
		public float distanceLimit = 22.5f;
	}
	[HarmonyPatch(typeof(Power), "FixedUpdate")]
	public class PowerStayClosePatch
	{
		public static void Postfix(Power __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			PowerStayClose component = ((Component)__instance).GetComponent<PowerStayClose>();
			if (!((Object)(object)component == (Object)null) && !(Vector3.Distance(((Component)__instance).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position) <= component.distanceLimit))
			{
				__instance.Teleport(true, false, false, false, false, true);
			}
		}
	}
	public class StatueSpeed : MonoBehaviour
	{
		public float multiplier = 1.2f;
	}
	[HarmonyPatch(typeof(StatueFake), "Start")]
	public class StatueFakePatch
	{
		public static void Postfix(StatueFake __instance)
		{
			StatueSpeed component = ((Component)__instance).GetComponent<StatueSpeed>();
			if (!((Object)(object)component == (Object)null))
			{
				Animator anim = __instance.anim;
				anim.speed *= component.multiplier;
			}
		}
	}
	public class StopEnemyMovement : MonoBehaviour
	{
		public bool stopWalking = true;

		public bool stopDashing = true;

		public bool stopTeleporting = true;

		public NavMeshAgent nma;

		public static bool CheckDash(Component __instance)
		{
			StopEnemyMovement component = __instance.GetComponent<StopEnemyMovement>();
			if (component != null && ((Behaviour)component).enabled && component != null && component.stopDashing)
			{
				return false;
			}
			return true;
		}

		public static bool CheckTeleport(Component __instance)
		{
			StopEnemyMovement component = __instance.GetComponent<StopEnemyMovement>();
			if (component != null && ((Behaviour)component).enabled && component != null && component.stopTeleporting)
			{
				return false;
			}
			return true;
		}

		public void Awake()
		{
			nma = ((Component)this).GetComponent<NavMeshAgent>();
		}

		public void Start()
		{
			SaveForPuppet();
		}

		public void SaveForPuppet()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			EnemyIdentifier component = ((Component)this).GetComponent<EnemyIdentifier>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			GameObject[] activateOnDeath = component.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (((Object)val).name == "StopEnemyMovement")
				{
					return;
				}
			}
			GameObject val2 = new GameObject("StopEnemyMovement");
			StopEnemyMovement newStopper = val2.AddComponent<StopEnemyMovement>();
			CopyValuesTo(newStopper);
			Util.ArrayAdd(ref component.activateOnDeath, val2);
		}

		public void FixedUpdate()
		{
			if (stopWalking && (Object)(object)nma != (Object)null && ((Behaviour)nma).enabled)
			{
				((Behaviour)nma).enabled = false;
			}
		}

		public void CopyValuesTo(StopEnemyMovement newStopper)
		{
			newStopper.stopWalking = stopWalking;
			newStopper.stopDashing = stopDashing;
		}
	}
	[HarmonyPatch(typeof(StatueBoss))]
	public class CerberusMovementPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(StatueBoss), "Tackle")]
		[HarmonyPriority(700)]
		public static bool TacklePrefix(StatueBoss __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			bool flag = StopEnemyMovement.CheckDash((Component)(object)__instance);
			if (!flag)
			{
				__instance.inAction = true;
				if (Vector3.Distance(((Component)__instance).transform.position, __instance.targetPlanePos) >= 9f)
				{
					__instance.Throw();
				}
				else
				{
					__instance.Stomp();
				}
			}
			return flag;
		}
	}
	[HarmonyPatch(typeof(Drone))]
	public class DroneMovementPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Drone), "Dodge", new Type[] { typeof(Vector3) })]
		[HarmonyPriority(700)]
		public static bool DodgePrefix(Drone __instance)
		{
			return StopEnemyMovement.CheckDash((Component)(object)__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Drone), "ProcessTargeting")]
		[HarmonyPriority(700)]
		public static bool ProcessTargetingPrefix(Drone __instance)
		{
			return StopEnemyMovement.CheckDash((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(MirrorReaper))]
	public class MirrorReaperMovementPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(MirrorReaper), "Teleport", new Type[] { typeof(Vector3) })]
		[HarmonyPriority(700)]
		public static bool TeleportVectorPrefix(Vector3 point, MirrorReaper __instance)
		{
			return StopEnemyMovement.CheckTeleport((Component)(object)__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MirrorReaper), "Teleport", new Type[] { })]
		[HarmonyPriority(700)]
		public static bool TeleportPrefix(MirrorReaper __instance)
		{
			return StopEnemyMovement.CheckTeleport((Component)(object)__instance);
		}
	}
	public class TeleportOnCondition : MonoBehaviour
	{
		public bool processPassively = false;

		public bool processIfEnemyDead = false;

		public bool onDeadcaught = true;

		public bool returnOnFirstSuccess = true;

		public TeleportCondition[] conditions = Array.Empty<TeleportCondition>();

		public EnemyIdentifier eid = null;

		public Enemy enemy = null;

		public int globalConditionKey = -1;

		public static Dictionary<int, List<TeleportCondition>> GlobalConditions = new Dictionary<int, List<TeleportCondition>>();

		public void Configure(bool processPassively = true, bool processIfEnemyDead = false, bool onDeadcaught = true, bool returnOnFirstSuccess = true)
		{
			this.processPassively = processPassively;
			this.processIfEnemyDead = processIfEnemyDead;
			this.onDeadcaught = onDeadcaught;
			this.returnOnFirstSuccess = returnOnFirstSuccess;
		}

		public TeleportCondition AddCondition(Vector3 moveVector, bool isMoveVectorAbsolute = true, bool ignoreAbsoluteMoveVectorZeroAxes = false, float continuousTimeRequired = 0f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			TeleportCondition teleportCondition = new TeleportCondition(moveVector, isMoveVectorAbsolute, ignoreAbsoluteMoveVectorZeroAxes, continuousTimeRequired);
			Util.ArrayAdd(ref conditions, teleportCondition);
			if (globalConditionKey != -1)
			{
				if (!GlobalConditions.ContainsKey(globalConditionKey))
				{
					GlobalConditions[globalConditionKey] = new List<TeleportCondition>();
				}
				GlobalConditions[globalConditionKey].Add(teleportCondition);
			}
			return teleportCondition;
		}

		public void Awake()
		{
			eid = ((Component)this).GetComponentInChildren<EnemyIdentifier>();
			enemy = ((Component)this).GetComponentInChildren<Enemy>();
			ReaddConditionsToClonedEnemy();
		}

		public void ReaddConditionsToClonedEnemy()
		{
			if (globalConditionKey != -1 && GlobalConditions.ContainsKey(globalConditionKey) && GlobalConditions[globalConditionKey] != null)
			{
				Util.ArrayAdd(ref conditions, GlobalConditions[globalConditionKey].ToArray());
				ChangeAxisTargetsToPuppet(conditions, ((Component)this).transform);
			}
		}

		public void Start()
		{
			SaveForPuppet();
		}

		public void SaveForPuppet()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			if ((Object)(object)eid == (Object)null)
			{
				return;
			}
			GameObject[] activateOnDeath = eid.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (((Object)val).name == "TeleportOnCondition")
				{
					return;
				}
			}
			GameObject val2 = new GameObject("TeleportOnCondition");
			TeleportOnCondition newTeleport = val2.AddComponent<TeleportOnCondition>();
			CopyValuesTo(newTeleport);
			Util.ArrayAdd(ref eid.activateOnDeath, val2);
		}

		public void FixedUpdate()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			bool flag = !processIfEnemyDead && ((Object)(object)eid == (Object)null || eid.dead);
			if (!processPassively || flag)
			{
				return;
			}
			Vector3 val = CheckConditions(((Component)this).transform.position, conditions, returnOnFirstSuccess);
			if (!(((Component)this).transform.position == val))
			{
				((Component)this).transform.position = val;
				Enemy obj = enemy;
				if (obj != null)
				{
					obj.terminalVelocityTimer = 0f;
				}
			}
		}

		public static Vector3 CheckConditions(Vector3 moveTargetPosition, TeleportCondition[] conditions, bool returnOnFirstSuccess = true)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			foreach (TeleportCondition teleportCondition in conditions)
			{
				if (teleportCondition != null && teleportCondition.CheckCondition())
				{
					moveTargetPosition = Teleport(teleportCondition, moveTargetPosition);
					if (returnOnFirstSuccess)
					{
						return moveTargetPosition;
					}
				}
			}
			return moveTargetPosition;
		}

		public static Vector3 Teleport(TeleportCondition condition, Vector3 moveTargetPosition)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			Vector3 moveVector = condition.moveVector;
			if (!condition.isMoveVectorAbsolute)
			{
				moveTargetPosition += moveVector;
				return moveTargetPosition;
			}
			if (!condition.ignoreAbsoluteMoveVectorZeroAxes)
			{
				moveTargetPosition = moveVector;
				return moveTargetPosition;
			}
			((Vector3)(ref moveTargetPosition))..ctor((moveVector.x != 0f) ? moveVector.x : moveTargetPosition.x, (moveVector.y != 0f) ? moveVector.y : moveTargetPosition.y, (moveVector.z != 0f) ? moveVector.z : moveTargetPosition.z);
			return moveTargetPosition;
		}

		public static void ChangeAxisTargetsToPuppet(TeleportCondition[] conditions, Transform puppet)
		{
			foreach (TeleportCondition teleportCondition in conditions)
			{
				TeleportConditionAxis[] conditionAxes = teleportCondition.conditionAxes;
				foreach (TeleportConditionAxis teleportConditionAxis in conditionAxes)
				{
					if (teleportConditionAxis.canChangeTargetToPuppet)
					{
						teleportConditionAxis.checkTarget = puppet;
					}
				}
			}
		}

		public void CopyValuesTo(TeleportOnCondition newTeleport)
		{
			newTeleport.Configure(processPassively, processIfEnemyDead, onDeadcaught, returnOnFirstSuccess);
			newTeleport.conditions = conditions;
			newTeleport.eid = eid;
		}
	}
	public class TeleportCondition
	{
		public TeleportConditionAxis[] conditionAxes = Array.Empty<TeleportConditionAxis>();

		public Vector3 moveVector = Vector3.zero;

		public bool isMoveVectorAbsolute = true;

		public bool ignoreAbsoluteMoveVectorZeroAxes = false;

		public float continuousTimeRequired = 0f;

		public bool Success { get; private set; }

		public bool SemiSuccess { get; private set; }

		public float SemiSuccessTime { get; private set; }

		public TeleportCondition(Vector3 moveVector, bool isMoveVectorAbsolute = true, bool ignoreAbsoluteMoveVectorZeroAxes = false, float continuousTimeRequired = 0f)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Success = false;
			this.moveVector = moveVector;
			this.isMoveVectorAbsolute = isMoveVectorAbsolute;
			this.ignoreAbsoluteMoveVectorZeroAxes = ignoreAbsoluteMoveVectorZeroAxes;
			this.continuousTimeRequired = continuousTimeRequired;
		}

		public TeleportConditionAxis AddAxis(Transform checkTarget, char axis = 'y', float value = -25f, bool greater = false, bool orEqual = true, bool onlyIfStuck = false, bool onlyIfTerminalVelocity = false, bool useLastTargetPositionIfNull = true, bool canChangeTargetToPuppet = true)
		{
			TeleportConditionAxis teleportConditionAxis = new TeleportConditionAxis(checkTarget, axis, value, greater, orEqual, onlyIfStuck, onlyIfTerminalVelocity, useLastTargetPositionIfNull, canChangeTargetToPuppet);
			Util.ArrayAdd(ref conditionAxes, teleportConditionAxis);
			return teleportConditionAxis;
		}

		public bool CheckCondition()
		{
			TeleportConditionAxis[] array = conditionAxes;
			foreach (TeleportConditionAxis teleportConditionAxis in array)
			{
				if (teleportConditionAxis != null && !teleportConditionAxis.CheckAxis())
				{
					Success = false;
					SemiSuccess = false;
					return Success;
				}
			}
			StartSuccess();
			return Success;
		}

		public bool StartSuccess()
		{
			if (continuousTimeRequired <= 0f)
			{
				Success = true;
				return Success;
			}
			if (!SemiSuccess)
			{
				SemiSuccessTime = Time.time;
			}
			SemiSuccess = true;
			if (Time.time - SemiSuccessTime >= continuousTimeRequired)
			{
				Success = true;
				SemiSuccess = false;
			}
			return Success;
		}
	}
	public class TeleportConditionAxis
	{
		public Transform checkTarget;

		public Vector3 lastTargetPosition;

		public Vector3 beforeLastTargetPosition;

		public char axis = 'y';

		public float value = -25f;

		public bool greater = false;

		public bool orEqual = true;

		public bool onlyIfStuck = false;

		public bool onlyIfTerminalVelocity = false;

		public bool useLastTargetPositionIfNull = true;

		public bool canChangeTargetToPuppet = true;

		public bool Success { get; private set; }

		public TeleportConditionAxis(Transform checkTarget, char axis = 'y', float value = -25f, bool greater = false, bool orEqual = true, bool onlyIfStuck = false, bool onlyIfTerminalVelocity = false, bool useLastTargetPositionIfNull = true, bool canChangeTargetToPuppet = true)
		{
			Success = false;
			this.checkTarget = checkTarget;
			this.axis = axis;
			this.value = value;
			this.greater = greater;
			this.orEqual = orEqual;
			this.onlyIfStuck = onlyIfStuck;
			this.onlyIfTerminalVelocity = onlyIfTerminalVelocity;
			this.useLastTargetPositionIfNull = useLastTargetPositionIfNull;
			this.canChangeTargetToPuppet = canChangeTargetToPuppet;
			if (axis != 'x' && axis != 'y' && axis != 'z')
			{
				Plugin.Logger.LogWarning((object)$"(new) TeleportConditionAxis must have axis 'x', 'y' or 'z', not {axis}. Resetting to 'y'");
				this.axis = 'y';
			}
		}

		public bool CheckAxis()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)checkTarget == (Object)null && !useLastTargetPositionIfNull)
			{
				return false;
			}
			if ((Object)(object)checkTarget != (Object)null)
			{
				lastTargetPosition = checkTarget.position;
			}
			bool success;
			switch (axis)
			{
			case 'x':
				success = CheckX();
				break;
			case 'y':
				success = CheckY();
				break;
			case 'z':
				success = CheckZ();
				break;
			default:
				Plugin.Logger.LogWarning((object)$"(FixedUpdate) TeleportConditionAxis must have axis 'x', 'y' or 'z', not {axis}. Resetting to 'y'");
				axis = 'y';
				success = CheckY();
				break;
			}
			if ((Object)(object)checkTarget != (Object)null)
			{
				beforeLastTargetPosition = checkTarget.position;
			}
			Success = success;
			return Success;
		}

		public bool CheckX()
		{
			bool flag = ((!greater) ? (lastTargetPosition.x < value) : (lastTargetPosition.x > value));
			if (orEqual)
			{
				flag = flag || lastTargetPosition.x == value;
			}
			return ExtraProcessEarlyResult(flag);
		}

		public bool CheckY()
		{
			bool flag = ((!greater) ? (lastTargetPosition.y < value) : (lastTargetPosition.y > value));
			if (orEqual)
			{
				flag = flag || lastTargetPosition.y == value;
			}
			return ExtraProcessEarlyResult(flag);
		}

		public bool CheckZ()
		{
			bool flag = ((!greater) ? (lastTargetPosition.z < value) : (lastTargetPosition.z > value));
			if (orEqual)
			{
				flag = flag || lastTargetPosition.z == value;
			}
			return ExtraProcessEarlyResult(flag);
		}

		public bool ExtraProcessEarlyResult(bool earlyResult)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (onlyIfStuck && !IsTargetInAction())
			{
				earlyResult = earlyResult && beforeLastTargetPosition == lastTargetPosition;
			}
			if (onlyIfTerminalVelocity)
			{
				earlyResult = earlyResult && IsTargetTerminalVelocity();
			}
			return earlyResult;
		}

		public bool IsTargetInAction()
		{
			if ((Object)(object)checkTarget == (Object)null)
			{
				return false;
			}
			Sisyphus val = default(Sisyphus);
			if (((Component)checkTarget).TryGetComponent<Sisyphus>(ref val))
			{
				return val.inAction || val.swinging;
			}
			Ferryman val2 = default(Ferryman);
			if (((Component)checkTarget).TryGetComponent<Ferryman>(ref val2))
			{
				return val2.inAction;
			}
			SwordsMachine val3 = default(SwordsMachine);
			if (((Component)checkTarget).TryGetComponent<SwordsMachine>(ref val3))
			{
				return val3.inAction || val3.inSemiAction;
			}
			StatueBoss val4 = default(StatueBoss);
			if (((Component)checkTarget).TryGetComponent<StatueBoss>(ref val4))
			{
				return val4.inAction;
			}
			return false;
		}

		public bool IsTargetTerminalVelocity()
		{
			if ((Object)(object)checkTarget == (Object)null)
			{
				return false;
			}
			Enemy val = default(Enemy);
			if (!((Component)checkTarget).TryGetComponent<Enemy>(ref val))
			{
				return false;
			}
			return val.terminalVelocityTimer >= 1f;
		}
	}
	public class TeleportToPlayer : MonoBehaviour
	{
		public bool onSpawn = true;

		public Vector3 offset = Vector3.zero;
	}
	[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
	public class TeleportToPlayerPatch
	{
		public static void Postfix(EnemyIdentifier __instance)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			TeleportToPlayer component = ((Component)__instance).GetComponent<TeleportToPlayer>();
			if ((Object)(object)component == (Object)null || !component.onSpawn || __instance.dead)
			{
				return;
			}
			((Component)__instance).transform.position = component.offset + ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
			Power component2 = ((Component)__instance).GetComponent<Power>();
			if (!((Object)(object)component2 == (Object)null))
			{
				component2.sinceLastVision = TimeSince.op_Implicit(0f);
				TargetDataRef val = default(TargetDataRef);
				if (component2.vision.TrySee(component2.targetQuery, ref val))
				{
					component2.lastTargetData = TargetDataExtensions.ToData(val);
					component2.targetHandle = component2.lastTargetData.handle;
				}
				else
				{
					component2.targetHandle = null;
				}
			}
		}
	}
	public class NemesisEnemy
	{
		private Transform _transform;

		public EnemyIdentifier eid = null;

		public Enemy enemy = null;

		public Transform enemyScale = null;

		public Transform transform
		{
			get
			{
				return _transform;
			}
			set
			{
				_transform = value;
				name = ((Object)value).name;
				UpdateEidAndEnemy();
			}
		}

		public GameObject gameObject
		{
			get
			{
				return ((Component)_transform).gameObject;
			}
			set
			{
				transform = value.transform;
			}
		}

		public Transform parent
		{
			get
			{
				return _transform.parent;
			}
			set
			{
				_transform.parent = value;
			}
		}

		public string name
		{
			get
			{
				return ((Object)_transform).name;
			}
			set
			{
				((Object)_transform).name = value;
			}
		}

		public NemesisEnemy(Transform newTransform)
		{
			transform = newTransform;
		}

		public NemesisEnemy(GameObject newGameObject)
		{
			gameObject = newGameObject;
		}

		public void UpdateEidAndEnemy()
		{
			eid = ((Component)transform).GetComponentInChildren<EnemyIdentifier>(true);
			enemy = ((Component)transform).GetComponentInChildren<Enemy>(true);
		}
	}
	public class ParentPuppetTo : MonoBehaviour
	{
		public string objectName = "";

		public void Start()
		{
			SaveForPuppet();
		}

		public void SaveForPuppet()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			EnemyIdentifier componentInChildren = ((Component)this).GetComponentInChildren<EnemyIdentifier>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				return;
			}
			GameObject[] activateOnDeath = componentInChildren.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (((Object)val).name == "ParentPuppetTo")
				{
					return;
				}
			}
			GameObject val2 = new GameObject("ParentPuppetTo");
			ParentPuppetTo parentPuppetTo = val2.AddComponent<ParentPuppetTo>();
			parentPuppetTo.objectName = objectName;
			Util.ArrayAdd(ref componentInChildren.activateOnDeath, val2);
		}
	}
	public class RadianceNerfHalo : MonoBehaviour
	{
		public Vector3 normalScale;

		public float scaleMultiplier = 1f;

		public float minDistance = 10f;

		public float maxDistance = 50f;

		public float maxScaleIncrease = 0.5f;

		public EnemyIdentifier eid;

		public Collider collider;

		public int doubleRenderCount = 0;

		public void Start()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			normalScale = ((Component)this).transform.localScale;
			eid = ((Component)this).GetComponentInParent<EnemyIdentifier>(true);
			Collider val = default(Collider);
			if (((Component)eid).TryGetComponent<Collider>(ref val))
			{
				collider = val;
			}
		}

		public void Update()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)eid == (Object)null || eid.dead)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			float num = Map(GetClampedDistance(), minDistance, maxDistance, 0f, 1f);
			((Component)this).transform.localScale = scaleMultiplier * (normalScale + normalScale * maxScaleIncrease * num);
		}

		public void FixedUpdate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)collider != (Object)null)
			{
				Transform transform = ((Component)this).transform;
				Bounds bounds = collider.bounds;
				transform.position = ((Bounds)(ref bounds)).center;
			}
			DoubleRender[] componentsInChildren = ((Component)eid).GetComponentsInChildren<DoubleRender>(true);
			if (doubleRenderCount == componentsInChildren.Length)
			{
				return;
			}
			DoubleRender[] array = componentsInChildren;
			foreach (DoubleRender val in array)
			{
				if (val != null)
				{
					val.radiantMat.SetTexture("_BuffTex", (Texture)(object)LevelAssets.Textures["RadianceNerf"]);
				}
			}
			doubleRenderCount = componentsInChildren.Length;
		}

		public float GetClampedDistance()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position);
			return Mathf.Clamp(num, minDistance, maxDistance);
		}

		public static float Map(float value, float a1, float b1, float a2, float b2)
		{
			return a2 + (value - a1) * (b2 - a2) / (b1 - a1);
		}
	}
	public class RadianceNerfParticle : MonoBehaviour
	{
		public LerpColor lerpLight;

		public LerpColor lerp1;

		public LerpColor lerp2;

		public LerpColor lerp3;

		public void Awake()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).GetComponent<RandomPitch>().defaultPitch = 0.7f;
			lerpLight = ((Component)((Component)this).transform.Find("Point Light")).GetComponent<LerpColor>();
			lerpLight.startColor = new Color(1f, 1f, 1f, 1f);
			lerpLight.targetColor = new Color(0.25f, 0.25f, 0.25f, 0f);
			lerpLight.rainbow = false;
			((Component)lerpLight).GetComponent<Light>().color = new Color(1f, 1f, 1f, 1f);
			lerp1 = ((Component)((Component)this).transform.Find("New Sprite")).GetComponent<LerpColor>();
			lerp1.startColor = new Color(1f, 1f, 1f, 1f);
			lerp1.targetColor = new Color(0.25f, 0.25f, 0.25f, 0f);
			lerp1.rainbow = false;
			lerp1.time = 0.5f;
			((Component)lerp1).GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f);
			lerp2 = ((Component)((Component)this).transform.Find("New Sprite (1)")).GetComponent<LerpColor>();
			lerp2.startColor = new Color(0.5f, 0.5f, 0.5f, 1f);
			lerp2.targetColor = new Color(0.25f, 0.25f, 0.25f, 0f);
			lerp2.rainbow = false;
			lerp2.time = 0.5f;
			((Component)lerp2).GetComponent<SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 1f);
			lerp3 = ((Component)((Component)this).transform.Find("New Sprite (2)")).GetComponent<LerpColor>();
			lerp3.startColor = new Color(0.25f, 0.25f, 0.25f, 1f);
			lerp3.targetColor = new Color(0f, 0f, 0f, 0f);
			lerp3.rainbow = false;
			lerp3.time = 0.5f;
			((Component)lerp3).GetComponent<SpriteRenderer>().color = new Color(0.25f, 0.25f, 0.25f, 1f);
		}
	}
	[HarmonyPatch(typeof(CancerousRodent))]
	public class CancerousRodentPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(CancerousRodent), "DeathEnd")]
		public static bool DeathEndPrefix(CancerousRodent __instance)
		{
			if (!Util.IsPatched())
			{
				return true;
			}
			if (__instance.enemy.musicRequested)
			{
				MonoSingleton<MusicManager>.Instance.PlayCleanMusic();
			}
			if ((Object)(object)((Component)__instance).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CancerousRodent), "OnDisable")]
		public static void OnDisablePrefix(CancerousRodent __instance)
		{
			__instance.enemy = ((Component)__instance).GetComponent<Enemy>();
		}
	}
	[HarmonyPatch]
	public class DeadcaughtEnemyPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Deathcatcher), "EnemyDeath")]
		public static bool EnemyDeathPrefix(EnemyIdentifier eid, Deathcatcher __instance)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Invalid comparison between Unknown and I4
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			if (!Util.IsPatched())
			{
				return true;
			}
			if ((Object)(object)eid == (Object)null)
			{
				Debug.LogWarning((object)"EnemyIdentifier is null. Cannot track death.");
				return false;
			}
			DontCatch component = ((Component)eid).GetComponent<DontCatch>();
			if ((Object)(object)component != (Object)null)
			{
				return false;
			}
			DontCatch component2 = ((Component)((Component)eid).transform.parent).GetComponent<DontCatch>();
			if ((Object)(object)component2 != (Object)null)
			{
				return false;
			}
			Debug.Log((object)("EnemyDeath called for " + ((Object)eid).name));
			if (!__instance.canRespawnIdols && (int)eid.enemyType == 21)
			{
				return false;
			}
			EnemyTracker instance = MonoSingleton<EnemyTracker>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				Debug.LogWarning((object)"EnemyTracker instance not found. Cannot track enemy death.");
				return false;
			}
			if (!instance.spawnedEnemies.TryGetValue(((Object)eid).GetInstanceID(), out var value))
			{
				Debug.LogWarning((object)("Enemy " + ((Object)eid).name + " not found in spawned enemies. Cannot track death."));
				return false;
			}
			TeleportOnCondition teleportOnCondition = null;
			GameObject[] activateOnDeath = eid.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (!(((Object)val).name != "TeleportOnCondition"))
				{
					teleportOnCondition = val.GetComponent<TeleportOnCondition>();
				}
			}
			CaughtEnemy val2 = new CaughtEnemy(eid, value);
			if (!__instance.deadCaughtEnemies.Contains(val2))
			{
				Debug.Log((object)$"Tracking death of enemy {eid} at position {val2.position} with rotation {val2.rotation}");
				__instance.deadCaughtEnemies.Add(val2);
				if ((Object)(object)teleportOnCondition != (Object)null && teleportOnCondition.onDeadcaught)
				{
					val2.position = TeleportOnCondition.CheckConditions(val2.position, teleportOnCondition.conditions, teleportOnCondition.returnOnFirstSuccess);
				}
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CaughtEnemy), "UpdatePuppet")]
		public static void UpdatePuppetPrefix(GameObject newPuppet, CaughtEnemy __instance)
		{
			if (!Util.IsPatched())
			{
				return;
			}
			object obj;
			if (newPuppet == null)
			{
				obj = null;
			}
			else
			{
				Transform parent = newPuppet.transform.parent;
				obj = ((parent != null) ? ((Object)parent).name : null);
			}
			string text = (string)obj;
			if (text.Contains("DeathcatcherCase") || text.Contains("PuppeteerCase"))
			{
				Transform parent2 = newPuppet.transform.parent;
				if ((Object)(object)((parent2 != null) ? parent2.parent : null) != (Object)null)
				{
					newPuppet.transform.SetParent(newPuppet.transform.parent.parent);
				}
			}
			ReaddComponents(newPuppet, __instance.original, __instance);
			if (((Object)newPuppet).name.Contains("Very Cancerous Rodent"))
			{
				ScreenDistortionField componentInChildren = newPuppet.GetComponentInChildren<ScreenDistortionField>(true);
				if (componentInChildren != null)
				{
					((Component)componentInChildren).gameObject.SetActive(false);
				}
				Rigidbody component = newPuppet.GetComponent<Rigidbody>();
				if (component != null)
				{
					component.isKinematic = true;
				}
			}
		}

		public static void ReaddComponents(GameObject puppet, EnemyIdentifier original, CaughtEnemy __instance)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] activateOnDeath = original.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				switch (((Object)val).name)
				{
				case "ParentPuppetTo":
				{
					ParentPuppetTo component2 = val.GetComponent<ParentPuppetTo>();
					ParentPuppetTo orAddComponent2 = GameObjectExtensions.GetOrAddComponent<ParentPuppetTo>(puppet);
					orAddComponent2.objectName = component2.objectName;
					if (orAddComponent2.objectName != "")
					{
						Vector3 localScale = puppet.transform.localScale;
						Transform val2 = puppet.transform.parent.Find(orAddComponent2.objectName);
						if ((Object)(object)val2 != (Object)null)
						{
							puppet.transform.SetParent(val2);
						}
						puppet.transform.localScale = localScale;
					}
					((Object)val).name = "TO_DELETE";
					break;
				}
				case "StopEnemyMovement":
				{
					StopEnemyMovement component3 = val.GetComponent<StopEnemyMovement>();
					StopEnemyMovement orAddComponent3 = GameObjectExtensions.GetOrAddComponent<StopEnemyMovement>(puppet);
					component3.CopyValuesTo(orAddComponent3);
					((Object)val).name = "TO_DELETE";
					break;
				}
				case "MoveTo":
				{
					MoveTo component4 = val.GetComponent<MoveTo>();
					MoveTo orAddComponent4 = GameObjectExtensions.GetOrAddComponent<MoveTo>(puppet);
					component4.CopyValuesTo(orAddComponent4);
					((Object)val).name = "TO_DELETE";
					break;
				}
				case "TeleportOnCondition":
				{
					TeleportOnCondition component = val.GetComponent<TeleportOnCondition>();
					TeleportOnCondition orAddComponent = GameObjectExtensions.GetOrAddComponent<TeleportOnCondition>(puppet);
					component.CopyValuesTo(orAddComponent);
					if (orAddComponent.onDeadcaught)
					{
						TeleportOnCondition.ChangeAxisTargetsToPuppet(orAddComponent.conditions, puppet.transform);
						__instance.position = TeleportOnCondition.CheckConditions(__instance.position, orAddComponent.conditions, orAddComponent.returnOnFirstSuccess);
					}
					puppet.transform.position = __instance.position;
					((Object)val).name = "TO_DELETE";
					break;
				}
				}
			}
			DeleteObjects(original);
			if (!((Object)(object)original != (Object)null) || (original.activateOnDeath != null && original.activateOnDeath.Length != 0))
			{
				EnemyIdentifier componentInChildren = puppet.GetComponentInChildren<EnemyIdentifier>();
				if ((Object)(object)__instance.original == (Object)null && (Object)(object)componentInChildren != (Object)null)
				{
					__instance.original = componentInChildren;
				}
			}
		}

		public static void DeleteObjects(EnemyIdentifier original)
		{
			int num = 0;
			while (num < original.activateOnDeath.Length)
			{
				GameObject val = original.activateOnDeath[num];
				if ((Object)(object)val == (Object)null || ((val != null) ? ((Object)val).name : null) != "TO_DELETE")
				{
					num++;
					continue;
				}
				Object.Destroy((Object)(object)val);
				List<GameObject> list = original.activateOnDeath.ToList();
				list.RemoveAt(num);
				original.activateOnDeath = list.ToArray();
			}
		}
	}
	[HarmonyPatch(typeof(HurtZone), "Start")]
	public class GoopCloudPatch
	{
		public static void Postfix(HurtZone __instance)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (Util.IsPatched() && (Object)(object)((Component)__instance).transform.parent != (Object)null && ((Object)((Component)__instance).transform.parent).name.Contains("GoopCloud"))
			{
				__instance.affected = (AffectedSubjects)1;
			}
		}
	}
	[HarmonyPatch]
	public class GroundWavePatch
	{
		[HarmonyPatch(typeof(GroundWave), "FixedUpdate")]
		public static bool FixedUpdatePrefix(GroundWave __instance, bool __runOriginal)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			if (!Util.IsPatched())
			{
				return true;
			}
			if (!__instance.isTraversingLink || !__runOriginal)
			{
				return false;
			}
			Vector3 val = __instance.traversalVelocity * Time.fixedDeltaTime;
			Transform transform = ((Component)__instance).transform;
			transform.position += val;
			if (((Vector3)(ref __instance.traversalVelocity)).sqrMagnitude > 0.001f)
			{
				((Component)__instance).transform.rotation = Quaternion.LookRotation(((Vector3)(ref __instance.traversalVelocity)).normalized, Vector3.up);
			}
			if (Object.op_Implicit((Object)(object)__instance.rb))
			{
				__instance.rb.position = ((Component)__instance).transform.position;
				__instance.rb.rotation = ((Component)__instance).transform.rotation;
			}
			if (__instance.hasCrossed)
			{
				__instance.postTeleportDistance += ((Vector3)(ref val)).magnitude;
				if (__instance.postTeleportDistance >= 2f)
				{
					__instance.isTraversingLink = false;
					((Behaviour)__instance.nma).enabled = true;
					__instance.nma.Warp(((Component)__instance).transform.position);
					__instance.nma.velocity = __instance.traversalVelocity;
					if ((Object)(object)__instance.nma != (Object)null && ((Behaviour)__instance.nma).enabled)
					{
						__instance.nma.SetDestination(__instance.target.GetNavPoint());
					}
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Enemy), "GetHurt")]
	public class MinosPatch
	{
		public static bool Prefix(GameObject target, Vector3 force, float multiplier, float critMultiplier, Vector3 hurtPos, GameObject sourceWeapon, bool fromExplosion, Enemy __instance)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			if (!Util.IsPatched() && __instance.eid.hitter == "enemy" && (int)__instance.eid.enemyType == 11)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(MirrorReaper), "Death")]
	public class MirrorReaperPatch
	{
		public static void Prefix(MirrorReaper __instance)
		{
			if (Util.IsPatched())
			{
				((Behaviour)((Component)__instance).GetComponent<RigBuilder>()).enabled = false;
			}
		}
	}
	[HarmonyPatch(typeof(Power))]
	public class PowerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Power), "EnrageNow")]
		public static bool EnrageNowPrefix(Power __instance)
		{
			if (__instance.dying || __instance.eid.dead)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Power), "Awake")]
		public static bool AwakePrefix(Power __instance)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if (!Util.IsPatched())
			{
				return true;
			}
			__instance.anim = ((Component)__instance).GetComponent<Animator>();
			__instance.eid = ((Component)__instance).GetComponent<EnemyIdentifier>();
			__instance.rb = ((Component)__instance).GetComponent<Rigidbody>();
			__instance.mach = ((Component)__instance).GetComponent<Enemy>();
			__instance.environmentMask = LayerMaskDefaults.Get((LMD)1);
			__instance.ensims = ((Component)__instance).GetComponentsInChildren<EnemySimplifier>();
			__instance.aud = ((Component)__instance).GetComponent<AudioSource>();
			if (__instance.voicePitch == -1f)
			{
				__instance.voicePitch = Random.Range(0.95f, 1.05f);
			}
			if (__instance.originalPosition == Vector3.zero)
			{
				__instance.originalPosition = ((Component)__instance).transform.position;
			}
			if (Object.op_Implicit((Object)(object)__instance.stabEffect))
			{
				__instance.stabParticle = __instance.stabEffect.GetComponentInChildren<ParticleSystem>();
				__instance.stabTrail = __instance.stabEffect.GetComponentInChildren<TrailRenderer>();
				__instance.stabAudio = __instance.stabEffect.GetComponentInChildren<AudioSource>();
			}
			if ((Object)(object)__instance.physicsArm == (Object)null)
			{
				__instance.physicsArm = new GameObject("Nemesis PowerPhysicsArm").transform;
			}
			__instance.physicsArm.SetParent(((Component)__instance).transform.parent);
			return false;
		}
	}
	[HarmonyPatch(typeof(EnemyIdentifier), "UpdateBuffs")]
	public class RadiancePatch
	{
		public static bool Prefix(bool visualsOnly, bool particle, EnemyIdentifier __instance)
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			if (!Util.IsPatched())
			{
				return true;
			}
			__instance.speedBuff = __instance.speedBuffRequests > 0;
			__instance.healthBuff = __instance.healthBuffRequests > 0;
			__instance.damageBuff = __instance.damageBuffRequests > 0;
			if (__instance.healthBuff || __instance.speedBuff || __instance.damageBuff || OptionsManager.forceRadiance)
			{
				if (!__instance.hasRadianceEffected)
				{
					__instance.hasRadianceEffected = true;
					if (particle)
					{
						Collider component = ((Component)__instance).GetComponent<Collider>();
						GameObject val;
						if (Object.op_Implicit((Object)(object)component))
						{
							GameObject radianceEffect = MonoSingleton<DefaultReferenceManager>.Instance.radianceEffect;
							Bounds bounds = component.bounds;
							val = Object.Instantiate<GameObject>(radianceEffect, ((Bounds)(ref bounds)).center, Quaternion.identity);
						}
						else
						{
							val = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.radianceEffect, ((Component)__instance).transform.position, Quaternion.identity);
						}
						if ((Object)(object)((Component)__instance).GetComponentInChildren<RadianceNerfHalo>() != (Object)null)
						{
							GameObjectExtensions.GetOrAddComponent<RadianceNerfParticle>(val);
						}
					}
				}
			}
			else
			{
				__instance.hasRadianceEffected = false;
				__instance.speedBuffRequests = 0;
				__instance.healthBuffRequests = 0;
				__instance.damageBuffRequests = 0;
			}
			if (!visualsOnly)
			{
				__instance.UpdateModifiers();
				((Component)__instance).SendMessage("UpdateBuff", (SendMessageOptions)1);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PhysicalShockwave), "CreatePortalReplicas")]
	public class ShockwavePatch
	{
		public static EnemyType[] unallowedEnemyTypes;

		public static bool Prefix(PhysicalShockwave __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Util.IsPatched() && unallowedEnemyTypes.Contains(__instance.enemyType))
			{
				return false;
			}
			return true;
		}

		static ShockwavePatch()
		{
			EnemyType[] array = new EnemyType[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			unallowedEnemyTypes = (EnemyType[])(object)array;
		}
	}
	public class SwordsmachineAddANW : MonoBehaviour
	{
		public void Add()
		{
			ActivateNextWave component = ((Component)this).GetComponent<ActivateNextWave>();
			component.deadEnemies++;
		}
	}
	[HarmonyPatch(typeof(SwordsMachine), "TeleportAway")]
	public class SwordsMachinePatch
	{
		public static bool Prefix(SwordsMachine __instance)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (!Util.IsPatched())
			{
				return true;
			}
			BossHealthBar component = ((Component)__instance).GetComponent<BossHealthBar>();
			component.DisappearBar();
			new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1.5f, ((Component)__instance).transform.position.z);
			__instance.teleportEffect.SetActive(true);
			__instance.teleportEffect.transform.SetParent((Transform)null, true);
			((Component)__instance).gameObject.SetActive(false);
			SwordsMachine[] componentsInChildren = ((Component)__instance.secondPhasePosTarget).GetComponentsInChildren<SwordsMachine>();
			if (componentsInChildren.Length != 0)
			{
				SwordsMachine[] array = componentsInChildren;
				SwordsMachine[] array2 = array;
				foreach (SwordsMachine val in array2)
				{
					((Component)val).gameObject.SetActive(false);
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
			((Component)__instance).transform.position = __instance.secondPhasePosTarget.position;
			((Component)__instance).transform.parent = __instance.secondPhasePosTarget;
			__instance.eid.spawnIn = true;
			((Component)__instance).gameObject.SetActive(true);
			((Behaviour)component).enabled = true;
			__instance.secondPhasePosTarget = null;
			SwordsmachineAddANW[] array3 = Object.FindObjectsByType<SwordsmachineAddANW>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			SwordsmachineAddANW[] array4 = array3;
			foreach (SwordsmachineAddANW swordsmachineAddANW in array4)
			{
				swordsmachineAddANW.Add();
			}
			CheckPointPatch.InheritCheckpointRooms(__instance.cpToReset);
			__instance.cpToReset.UpdateRooms();
			return false;
		}
	}
	public enum BlockType
	{
		Metal,
		SandboxCube,
		ArenaWall,
		Lava,
		Invisible,
		InvisibleJumpless,
		BlackNonPSX
	}
	public class ActionOnEnable : MonoBehaviour
	{
		public UnityEvent enableEvent = new UnityEvent();

		public bool activated = false;

		public bool oneTime = true;

		public void OnEnable()
		{
			if (!oneTime || !activated)
			{
				UnityEvent obj = enableEvent;
				if (obj != null)
				{
					obj.Invoke();
				}
				activated = true;
				if (!oneTime)
				{
					((Component)this).gameObject.SetActive(false);
				}
			}
		}
	}
	public class ArenaDelay : MonoBehaviour
	{
		public float delay = 1f;

		public ActivateArena target = null;
	}
	public class ArenaLink : MonoBehaviour
	{
		public ActivateArena[] linkedArenas = Array.Empty<ActivateArena>();

		public bool deleteWhenActivated = true;

		public bool activated = false;

		public void Update()
		{
			if (activated)
			{
				return;
			}
			ActivateArena[] array = linkedArenas;
			foreach (ActivateArena val in array)
			{
				if ((Object)(object)val != (Object)null && val.activated)
				{
					OnArenaActivated(val);
					break;
				}
			}
		}

		public void OnArenaActivated(ActivateArena arenaActivated = null)
		{
			ActivateArena[] array = linkedArenas;
			foreach (ActivateArena val in array)
			{
				bool flag = (Object)(object)arenaActivated != (Object)null && (Object)(object)val == (Object)(object)arenaActivated;
				if (!((Object)(object)val == (Object)null || flag))
				{
					if (deleteWhenActivated)
					{
						Object.Destroy((Object)(object)val);
					}
					else
					{
						val.Activate();
					}
				}
			}
			activated = true;
		}
	}
	public class ArenaStatusNotInParent : MonoBehaviour
	{
		public ArenaStatus astat = null;

		public void Awake()
		{
			ActivateArena component = ((Component)this).GetComponent<ActivateArena>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.astat == (Object)null)
			{
				component.astat = astat;
			}
		}
	}
	public class ArenaStatusUpdater : MonoBehaviour
	{
		public int statusValue = 1;

		public bool isAdditive = false;

		public ArenaStatus arenaStatus = null;

		public bool oneTime = true;

		public bool activated = false;

		public void OnEnable()
		{
			if (!((Object)(object)arenaStatus == (Object)null) && (!oneTime || !activated))
			{
				if (isAdditive)
				{
					ArenaStatus obj = arenaStatus;
					obj.currentStatus += statusValue;
				}
				else
				{
					arenaStatus.currentStatus = statusValue;
				}
				activated = true;
				if (!oneTime)
				{
					((Component)this).gameObject.SetActive(false);
				}
			}
		}
	}
	public class AudioOnEnable : MonoBehaviour
	{
		public AudioSource audioSource;

		public void OnEnable()
		{
			if (!((Object)(object)audioSource == (Object)null))
			{
				audioSource.Play();
			}
		}
	}
	public class BackAndForth : MonoBehaviour
	{
		public float speed = 10f;

		public float startZ = 0f;

		public float endZ = -40f;

		public bool forward = true;

		public void FixedUpdate()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localPosition = ((Component)this).transform.localPosition;
			Vector3 val = default(Vector3);
			if (forward)
			{
				((Vector3)(ref val))..ctor(localPosition.x, localPosition.y, endZ);
				((Component)this).transform.localPosition = Vector3.MoveTowards(localPosition, val, speed * Time.deltaTime);
			}
			else
			{
				((Vector3)(ref val))..ctor(localPosition.x, localPosition.y, startZ);
				((Component)this).transform.localPosition = Vector3.MoveTowards(localPosition, val, speed * Time.deltaTime);
			}
			if (((Component)this).transform.localPosition == val)
			{
				forward = !forward;
			}
		}

		public BackAndForth Configure(float speed = 10f, float startZ = 0f, float endZ = -40f)
		{
			this.speed = speed;
			this.startZ = startZ;
			this.endZ = endZ;
			return this;
		}
	}
	public class BreakParticlePlaceholder : MonoBehaviour
	{
		public void OnEnable()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class CheckPointActivator : MonoBehaviour
	{
		public CheckPoint checkpoint;

		public void OnEnable()
		{
			if (!((Object)(object)checkpoint == (Object)null))
			{
				checkpoint.activated = false;
				checkpoint.SetForceOff(false);
				checkpoint.SetInvisibility(false);
				checkpoint.ActivateCheckPoint();
			}
		}
	}
	public class CheckPointConstantOff : MonoBehaviour
	{
		public CheckPoint checkpoint;

		public void FixedUpdate()
		{
			if (!((Object)(object)checkpoint == (Object)null) && !checkpoint.forceOff)
			{
				checkpoint.SetForceOff(true);
				checkpoint.SetInvisibility(true);
				checkpoint.unteleportable = true;
			}
		}
	}
	public class CheckPointToUpdate : MonoBehaviour
	{
		public Dictionary<int, GameObject> rooms = new Dictionary<int, GameObject>();
	}
	public class CheckPointTurnOn : MonoBehaviour
	{
		public CheckPoint checkpoint;

		public void OnEnable()
		{
			if (!((Object)(object)checkpoint == (Object)null))
			{
				checkpoint.activated = false;
				checkpoint.SetForceOff(false);
			}
		}

		public void OnDisable()
		{
			if (!((Object)(object)checkpoint == (Object)null))
			{
				checkpoint.SetForceOff(true);
			}
		}
	}
	public class InheritRoomExceptions : MonoBehaviour
	{
		public string[] roomNames = Array.Empty<string>();
	}
	public class DoorAltarHelper : MonoBehaviour
	{
		public Door door = null;

		public ItemPlaceZone[] itemPlaceZones = Array.Empty<ItemPlaceZone>();

		public bool reversed = false;

		public bool playerInArena = false;

		public bool ignoreInactiveZones = false;

		public void Update()
		{
			if (!playerInArena && !((Object)(object)door == (Object)null))
			{
				ProcessDoor(CheckShouldUnlock());
			}
		}

		public bool CheckShouldUnlock()
		{
			bool flag = true;
			bool flag2 = true;
			ItemPlaceZone[] array = itemPlaceZones;
			foreach (ItemPlaceZone val in array)
			{
				if (!ignoreInactiveZones || ((Component)val).gameObject.activeInHierarchy)
				{
					bool flag3 = (val.acceptedItemPlaced && !reversed) || (!val.acceptedItemPlaced && reversed);
					if (flag2)
					{
						flag = flag3;
						flag2 = false;
					}
					else if (flag3 != flag)
					{
						flag = reversed;
						break;
					}
				}
			}
			return flag;
		}

		public void ProcessDoor(bool shouldUnlock)
		{
			if (shouldUnlock && door.locked)
			{
				door.Unlock();
				door.Open(false, true);
			}
			else if (!shouldUnlock && !door.locked)
			{
				door.Lock();
				door.Close(false);
			}
		}
	}
	public class DoorConstantLocker : MonoBehaviour
	{
		public Door door;

		public bool unlockOnDisable = true;

		public void FixedUpdate()
		{
			if (!((Object)(object)door == (Object)null) && !door.locked)
			{
				door.Lock();
			}
		}

		public void OnDisable()
		{
			if (!((Object)(object)door == (Object)null) && unlockOnDisable)
			{
				door.Unlock();
			}
		}
	}
	public class DualWieldUsed : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(DualWieldPickup), "PickedUp")]
	public class DualWieldUsedPatch
	{
		public static void Prefix(DualWieldPickup __instance)
		{
			if (Object.op_Implicit((Object)(object)MonoSingleton<GunControl>.Instance))
			{
				ComponentExtensions.GetOrAddComponent<DualWieldUsed>((Component)(object)__instance);
			}
		}
	}
	public class BreakableAllower : MonoBehaviour
	{
		public Breakable breakable;

		public List<EnemyBlockBreakables> enemyBlocks = new List<EnemyBlockBreakables>();

		public void FixedUpdate()
		{
			if ((Object)(object)breakable == (Object)null)
			{
				return;
			}
			List<EnemyBlockBreakables> list = new List<EnemyBlockBreakables>();
			foreach (EnemyBlockBreakables enemyBlock in enemyBlocks)
			{
				if ((Object)(object)enemyBlock == (Object)null || !((Behaviour)enemyBlock).enabled || (Object)(object)enemyBlock.eid == (Object)null || enemyBlock.eid.Dead)
				{
					list.Add(enemyBlock);
					Object.Destroy((Object)(object)enemyBlock);
				}
				else if (!enemyBlock.eid.Dead)
				{
					breakable.broken = true;
					RemoveEnemyBlocks(list);
					return;
				}
			}
			breakable.broken = false;
			RemoveEnemyBlocks(list);
		}

		public void RemoveEnemyBlocks(List<EnemyBlockBreakables> toRemove)
		{
			foreach (EnemyBlockBreakables item in toRemove)
			{
				enemyBlocks.Remove(item);
			}
		}
	}
	public class DontManipulateLight : MonoBehaviour
	{
		public Light targetLight;
	}
	public class LightManipulator : MonoBehaviour
	{
		public float multiplier = 0.125f;

		public int dimmedCounter = 0;

		public bool invertColors = true;

		public bool ignoreEnemies = true;

		public void OnEnable()
		{
			DimLights();
		}

		public void DimLights(bool reversed = false)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			Light[] array = Object.FindObjectsByType<Light>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			Light[] array2 = array;
			foreach (Light val in array2)
			{
				if (ignoreEnemies && ((Object)(object)((Component)val).GetComponentInChildren<EnemyIdentifier>() != (Object)null || (Object)(object)((Component)val).GetComponentInParent<EnemyIdentifier>() != (Object)null))
				{
					continue;
				}
				DontManipulateLight component = ((Component)val).GetComponent<DontManipulateLight>();
				if (!((Object)(object)component != (Object)null) || !((Behaviour)component).enabled || !((Object)(object)component.targetLight == (Object)(object)val))
				{
					val.intensity *= ((!reversed) ? multiplier : (1f / multiplier));
					if (invertColors)
					{
						val.color = new Color(1f - val.color.r, 1f - val.color.g, 1f - val.color.b);
					}
				}
			}
			dimmedCounter += ((!reversed) ? 1 : (-1));
			if (invertColors)
			{
				Color fogColor = RenderSettings.fogColor;
				RenderSettings.fogColor = new Color(1f - fogColor.r, 1f - fogColor.g, 1f - fogColor.b);
			}
		}

		public LightManipulator Configure(float multiplier = 0.125f, bool invertColors = true, bool ignoreEnemies = true)
		{
			this.multiplier = multiplier;
			this.invertColors = invertColors;
			this.ignoreEnemies = ignoreEnemies;
			return this;
		}
	}
	public class MusicSlower : MonoBehaviour
	{
		public float multiplier = 0.1f;

		public int slowedCounter = 0;

		public bool isGradualPitch = false;

		public float gradualPitchSpeed = 0.2f;

		public float gradualPitchMultiplierTarget = 1.25f;

		public Dictionary<int, float> gradualPitchOriginals = new Dictionary<int, float>();

		public bool gradualPitchOriginalsSet = false;

		public void OnEnable()
		{
			Slow();
		}

		public void Slow(bool reversed = false)
		{
			if (!((Object)(object)MonoSingleton<MusicManager>.Instance == (Object)null))
			{
				AudioSource[] allThemes = MonoSingleton<MusicManager>.Instance.allThemes;
				foreach (AudioSource val in allThemes)
				{
					float num = AudioSourceExtensions.GetPitch(val) * ((!reversed) ? multiplier : (1f / multiplier));
					AudioSourceExtensions.SetPitch(val, num);
				}
				slowedCounter += ((!reversed) ? 1 : (-1));
			}
		}

		public void Update()
		{
			if (!isGradualPitch || (Object)(object)MonoSingleton<MusicManager>.Instance == (Object)null)
			{
				return;
			}
			bool flag = true;
			AudioSource[] allThemes = MonoSingleton<MusicManager>.Instance.allThemes;
			foreach (AudioSource val in allThemes)
			{
				int key = Array.IndexOf(MonoSingleton<MusicManager>.Instance.allThemes, val);
				if (!gradualPitchOriginalsSet)
				{
					gradualPitchOriginals[key] = AudioSourceExtensions.GetPitch(val);
				}
				float num = Mathf.MoveTowards(AudioSourceExtensions.GetPitch(val), gradualPitchOriginals[key] * gradualPitchMultiplierTarget, gradualPitchSpeed * Time.deltaTime);
				AudioSourceExtensions.SetPitch(val, num);
				if (AudioSourceExtensions.GetPitch(val) != gradualPitchOriginals[key] * gradualPitchMultiplierTarget)
				{
					flag = false;
				}
			}
			if (!gradualPitchOriginalsSet)
			{
				gradualPitchOriginalsSet = true;
			}
			if (flag)
			{
				isGradualPitch = false;
			}
		}

		public void GradualPitchChange(float gradualPitchMultiplierTarget = 1.25f, float gradualPitchSpeed = 0.2f)
		{
			isGradualPitch = true;
			this.gradualPitchMultiplierTarget = gradualPitchMultiplierTarget;
			this.gradualPitchSpeed = gradualPitchSpeed;
			gradualPitchOriginalsSet = false;
		}
	}
	public class BeamDelayHelper : MonoBehaviour
	{
		public float chargeUpTimeToSubtract = 0f;

		public bool subtracted = false;

		public ObjectActivator objectActivator = null;

		public void Subtract()
		{
			if (!subtracted)
			{
				ObjectActivator obj = objectActivator;
				obj.delay -= chargeUpTimeToSubtract;
				subtracted = true;
			}
		}
	}
	public class Hazards4_4 : MonoBehaviour
	{
		public Enemy v2;

		public Transform laserParent;

		public MoveTo laserParentMover;

		public ContinuousBeam[] beams;

		public Transform lava;

		public MoveTo lavaMover;

		public MoveTo lavaUnmover;

		public float roomHalf = 60f;

		public float cooldown = 1.125f;

		public float cooldownMax = 2.25f;

		public float difficultySpeedModifier = 1f;

		public bool doingHazard = false;

		public HazardType hazardType = HazardType.None;

		public List<HazardType> unusedHazardTypes = new List<HazardType>(allHazardTypes);

		public static readonly List<HazardType> allHazardTypes = new List<HazardType>(5)
		{
			HazardType.LaserWall,
			HazardType.VirtueBeams,
			HazardType.PhaserBlueBeams,
			HazardType.FlangerOrangeBeams,
			HazardType.Lava
		};

		public void Start()
		{
			StartDifficulty();
			CreateLaserWall();
			CreateLava();
		}

		public void StartDifficulty()
		{
			difficultySpeedModifier = GetDifficultyModifier(MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0));
			cooldownMax /= difficultySpeedModifier;
			cooldown = 0.5f * cooldownMax;
		}

		public static float GetDifficultyModifier(int difficulty)
		{
			if (1 == 0)
			{
			}
			float result = difficulty switch
			{
				4 => 1f, 
				3 => 0.8f, 
				2 => 0.7f, 
				1 => 0.5f, 
				0 => 0.4f, 
				_ => 1.1f, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public void Update()
		{
			if (!doingHazard)
			{
				cooldown += Time.deltaTime;
			}
			if (!(cooldown < cooldownMax))
			{
				cooldown = 0f;
				DoHazard(GetNextHazardType(hazardType));
			}
		}

		public HazardType GetNextHazardType(HazardType lastHazard)
		{
			if (lastHazard == HazardType.None)
			{
				hazardType = HazardType.LaserWall;
				return hazardType;
			}
			unusedHazardTypes.Remove(lastHazard);
			if (unusedHazardTypes.Count == 0)
			{
				unusedHazardTypes = new List<HazardType>(allHazardTypes);
			}
			int index = Random.Range(0, unusedHazardTypes.Count - 1);
			hazardType = unusedHazardTypes[index];
			return hazardType;
		}

		public void DoHazard(HazardType hazard)
		{
			((MonoBehaviour)this).StartCoroutine(GetHazardCoroutine(hazard));
		}

		public IEnumerator GetHazardCoroutine(HazardType hazard)
		{
			if (1 == 0)
			{
			}
			IEnumerator result = hazard switch
			{
				HazardType.LaserWall => LaserWallFull(), 
				HazardType.VirtueBeams => VirtueBeamsFull(), 
				HazardType.PhaserBlueBeams => PhaserBlueBeamsFull(), 
				HazardType.FlangerOrangeBeams => FlangerOrangeBeamsFull(), 
				HazardType.Lava => LavaFull(), 
				_ => null, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public IEnumerator LaserWallFull()
		{
			doingHazard = true;
			float randomX = 10f * (float)Random.Range(-4, 5);
			Vector3 position = (0f - roomHalf) * ((Component)this).transform.forward + randomX * ((Component)this).transform.right;
			GeneralFuncs.DoFlash(position + 20f * ((Component)this).transform.up);
			yield return (object)new WaitForSeconds(0.5f / difficultySpeedModifier);
			laserParent.localPosition = position;
			((Component)laserParent).gameObject.SetActive(true);
			SetLaserDamage();
			((Behaviour)laserParentMover).enabled = true;
			yield return (object)new WaitForSeconds(3.25f / difficultySpeedModifier);
			doingHazard = false;
			yield return (object)new WaitForSeconds(1.75f / difficultySpeedModifier);
			((Behaviour)laserParentMover).enabled = false;
			SetLaserDamage(0f);
			((Component)laserParent).gameObject.SetActive(false);
		}

		public void CreateLaserWall()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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)
			laserParent = new GameObject("LaserParent").transform;
			((Component)laserParent).gameObject.SetActive(false);
			laserParent.SetParent(((Component)this).transform);
			laserParent.localPosition = (0f - roomHalf) * ((Component)this).transform.forward;
			laserParent.localRotation = Quaternion.identity;
			float num = 120f;
			Vector3 val = 40f * ((Component)this).transform.up;
			Vector3 val2 = roomHalf * ((Component)this).transform.forward;
			while (num > -120f)
			{
				if (Mathf.Abs(num) > 5f)
				{
					LaserWallPlaceLaser(laserParent, ((Component)this).transform.position + num * ((Component)this).transform.right - val2 + val);
				}
				num -= 2.5f;
			}
			float num2 = 5f;
			laserParentMover = EnemyFuncs.AddMover(((Component)laserParent).gameObject, ((Component)laserParent).transform, roomHalf * 2f / num2 * difficultySpeedModifier);
			((Behaviour)laserParentMover).enabled = false;
			laserParentMover.MoveXYZ(moveX: false, moveY: false);
			laserParentMover.TargetXYZ(0f, 0f, ((Component)this).transform.position.z + val2.z);
			beams = ((Component)laserParent).GetComponentsInChildren<ContinuousBeam>(true);
		}

		public void LaserWallPlaceLaser(Transform laserParent, Vector3 position)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(LevelAssets.Objects["BrainBeam"], position, Quaternion.Euler(90f, 0f, 0f));
			val.transform.SetParent(laserParent);
			ContinuousBeam component = val.GetComponent<ContinuousBeam>();
			component.damage = 0f;
			component.safeEnemyType = (EnemyType)22;
			component.canHitEnemy = false;
		}

		public void SetLaserDamage(float damage = 30f)
		{
			ContinuousBeam[] array = beams;
			foreach (ContinuousBeam val in array)
			{
				val.damage = damage;
			}
		}

		public IEnumerator VirtueBeamsFull()
		{
			doingHazard = true;
			float x = roomHalf - 10f;
			float z = roomHalf;
			int zOffset = 0;
			int zOffsetAdd = 1;
			while (z >= 0f - roomHalf)
			{
				Vector3 position = ((Component)this).transform.position + 2f * ((Component)this).transform.up + x * ((Component)this).transform.right + z * ((Component)this).transform.forward + 5f * (float)zOffset * ((Component)this).transform.forward;
				VirtueBeamCreate(1f, 0.5f, 2f, position, position + ((Component)this).transform.up, v2, 0.25f);
				yield return (object)new WaitForSeconds(0.05f);
				x -= 20f;
				if (x < 0f - (roomHalf - 10f))
				{
					x = roomHalf - 10f;
					z -= 20f;
				}
				switch (zOffset)
				{
				case 1:
					zOffsetAdd = -1;
					break;
				case -1:
					zOffsetAdd = 1;
					break;
				}
				zOffset += zOffsetAdd;
			}
			yield return (object)new WaitForSeconds(1f);
			doingHazard = false;
		}

		public static GameObject VirtueBeamCreate(float scaleMult, float windUpSpeedMult, float explosionLength, Vector3 position, Vector3 lookAtPosition, Enemy enemy, float lightIntensityMultiplier = 1f)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(LevelAssets.Objects["VirtueInsignia"], position, Quaternion.identity);
			val.SetActive(false);
			Transform transform = val.transform;
			transform.localScale *= scaleMult;
			VirtueInsignia component = val.GetComponent<VirtueInsignia>();
			component.noTracking = true;
			component.target = EnemyTarget.TrackPlayer();
			component.parentEnemy = enemy;
			component.hadParent = true;
			component.windUpSpeedMultiplier = windUpSpeedMult;
			component.explosionLength = explosionLength;
			component.damage = Mathf.RoundToInt((float)component.damage);
			Light[] componentsInChildren = val.GetComponentsInChildren<Light>(true);
			foreach (Light val2 in componentsInChildren)
			{
				val2.intensity *= lightIntensityMultiplier;
			}
			val.transform.LookAt(lookAtPosition);
			val.transform.Rotate(-90f, 0f, 180f);
			val.SetActive(true);
			return val;
		}

		public IEnumerator PhaserBlueBeamsFull()
		{
			doingHazard = true;
			Vector3 pos1 = ((Component)this).transform.position + roomHalf * ((Component)this).transform.right + 20f * ((Component)this).transform.up;
			GeneralFuncs.DoFlash(pos1 - 10f * ((Component)this).transform.right, 40f);
			yield return (object)new WaitForSeconds(0.4f / difficultySpeedModifier);
			yield return PhaserBlueBeamsShoot(pos1);
			yield return (object)new WaitForSeconds(0.1f / difficultySpeedModifier);
			Vector3 pos2 = ((Component)this).transform.position - roomHalf * ((Component)this).transform.right + 20f * ((Component)this).transform.up;
			GeneralFuncs.DoFlash(pos2 + 10f * ((Component)this).transform.right, 40f);
			yield return (object)new WaitForSeconds(0.4f / difficultySpeedModifier);
			yield return PhaserBlueBeamsShoot(pos2);
			yield return (object)new WaitForSeconds(0.1f / difficultySpeedModifier);
			Vector3 pos3 = ((Component)this).transform.position - roomHalf * ((Component)this).transform.forward + 20f * ((Component)this).transform.up;
			GeneralFuncs.DoFlash(pos3 + 10f * ((Component)this).transform.forward, 40f);
			yield return (object)new WaitForSeconds(0.4f / difficultySpeedModifier);
			yield return PhaserBlueBeamsShoot(pos3);
			doingHazard = false;
		}

		public IEnumerator PhaserBlueBeamsShoot(Vector3 position)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return PhaserSpawned.ShootBlueBeamsCoroutine(0.55f / difficultySpeedModifier, position, ((Component)this).transform.up, 25f, difficultySpeedModifier, 1f);
		}

		public IEnumerator FlangerOrangeBeamsFull()
		{
			doingHazard = true;
			for (int i = 0; i <= 1; i++)
			{
				FlangerOrangeBeamsShoot(((Component)this).transform.position + roomHalf * ((Component)this).transform.right);
				yield return (object)new WaitForSeconds(0.05f / difficultySpeedModifier);
				FlangerOrangeBeamsShoot(((Component)this).transform.position + roomHalf * ((Component)this).transform.forward);
				yield return (object)new WaitForSeconds(0.05f / difficultySpeedModifier);
				FlangerOrangeBeamsShoot(((Component)this).transform.position - roomHalf * ((Component)this).transform.right);
				yield return (object)new WaitForSeconds(0.05f / difficultySpeedModifier);
				FlangerOrangeBeamsShoot(((Component)this).transform.position - roomHalf * ((Component)this).transform.forward);
				yield return (object)new WaitForSeconds(1.6f / difficultySpeedModifier);
			}
			doingHazard = false;
		}

		public void FlangerOrangeBeamsShoot(Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			FlangerSpawned.ShootOrangeBeam(position, difficultySpeedModifier, 1f, (float?)null, (float?)null, (float?)null, (float