Decompiled source of SpawnerArmExtras v9.1.0

SpawnerArmExtras.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using Sandbox;
using SettingsMenu.Components.Pages;
using TMPro;
using ULTRAKILL.Cheats;
using ULTRAKILL.Cheats.UnityEditor;
using ULTRAKILL.Enemy;
using ULTRAKILL.Portal;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ProBuilder;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using plog.Models;

[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("SpawnerArmExtras")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("9.1.0.0")]
[assembly: AssemblyInformationalVersion("9.1.0+35bdf000cf6858834406e55c7444d669af6cc9bf")]
[assembly: AssemblyProduct("SpawnerArmExtras")]
[assembly: AssemblyTitle("SpawnerArmExtras")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("9.1.0.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 SpawnerArmExtras
{
	public class AbsorbsmachineSetValues : MonoBehaviour
	{
		public float whiteHoleReachTime = 6f;

		public Vector3 whiteHoleRelativePosition = new Vector3(0f, 30f, 0f);
	}
	public class AbsorbsmachineSpawned : MonoBehaviour
	{
		public AbsorbsmachineWhiteHole whiteHole;

		public Vector3 whiteHoleRelativePosition = new Vector3(0f, 30f, 0f);

		public float whiteHoleReachTime = 6f;

		public float whiteHoleStallTime = 2f;

		public bool dieEarly = true;

		public float healthCooldown = 0f;

		public float healthCooldownMax = 1f;

		public bool createdWhiteHole = false;

		public float createDelay = 0f;

		public float createDelayMax = 1.5f;

		public bool doingBlackHoles = false;

		public float blackHoleCooldown = 0f;

		public float blackHoleCooldownMax = 0.8f;

		public bool difficultyStarted = false;

		public bool configValuesSet = false;

		public Enemy enemy;

		public EnemyIdentifier eid;

		public MortarLauncher mortarLauncher;

		public Vector3 ShootPoint => mortarLauncher.shootPoint.position;

		public Vector3 WhiteHoleAbsolutePosition
		{
			get
			{
				//IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references)
				return ShootPoint + whiteHoleRelativePosition;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//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)
				whiteHoleRelativePosition = value - ShootPoint;
			}
		}

		public Vector3 WhiteHoleRelativePosition
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return whiteHoleRelativePosition;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				whiteHoleRelativePosition = value;
			}
		}

		public bool Blind => BlindEnemies.Blind || EnemyIgnorePlayer.Active;

		public void Awake()
		{
			enemy = ((Component)this).GetComponent<Enemy>();
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			mortarLauncher = ((Component)this).GetComponent<MortarLauncher>();
			CheckSetValues();
			SkinnedMeshRenderer componentInChildren = ((Component)((Component)this).transform).GetComponentInChildren<SkinnedMeshRenderer>(true);
			((Renderer)componentInChildren).material.mainTexture = (Texture)(object)EnemyAssets.Textures["Absorbsmachine"];
			Collider[] componentsInChildren = ((Component)((Component)this).transform.Find("Armature")).GetComponentsInChildren<Collider>(true);
			foreach (Collider val in componentsInChildren)
			{
				if (((Component)val).tag == "Body")
				{
					((Component)val).tag = "Armor";
				}
			}
		}

		public void CheckSetValues()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			AbsorbsmachineSetValues component = ((Component)this).GetComponent<AbsorbsmachineSetValues>();
			if (!((Object)(object)component == (Object)null))
			{
				whiteHoleReachTime = component.whiteHoleReachTime;
				whiteHoleRelativePosition = component.whiteHoleRelativePosition;
			}
		}

		public void Start()
		{
			StartDifficulty();
			SetConfigValues();
		}

		public void StartDifficulty()
		{
			if (!difficultyStarted)
			{
				difficultyStarted = true;
				int difficulty = eid.difficulty;
				if (1 == 0)
				{
				}
				float num = difficulty switch
				{
					4 => 2f, 
					3 => 2.5f, 
					2 => 2.75f, 
					1 => 3.25f, 
					0 => 3.5f, 
					_ => 2f, 
				};
				if (1 == 0)
				{
				}
				whiteHoleStallTime = num;
				if (eid.difficulty <= 1)
				{
					whiteHoleReachTime *= 1.2f;
				}
			}
		}

		public void SetConfigValues()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0079: 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_008a: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00d5: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			if (!configValuesSet && !((Object)(object)Util.FindParentWithNameContaining(Plugin.SpawnedStrictName, ((Component)this).transform) != (Object)null))
			{
				configValuesSet = true;
				if (ModConfig.AbsorbsmachineWhiteHoleReachTime != null)
				{
					whiteHoleReachTime = ModConfig.AbsorbsmachineWhiteHoleReachTime.value;
				}
				Vector3 val = WhiteHoleRelativePosition;
				if (ModConfig.AbsorbsmachineWhiteHoleRelativeX != null)
				{
					WhiteHoleRelativePosition = new Vector3(ModConfig.AbsorbsmachineWhiteHoleRelativeX.value, val.y, val.z);
					val = WhiteHoleRelativePosition;
				}
				if (ModConfig.AbsorbsmachineWhiteHoleRelativeY != null)
				{
					WhiteHoleRelativePosition = new Vector3(val.x, ModConfig.AbsorbsmachineWhiteHoleRelativeY.value, val.z);
					val = WhiteHoleRelativePosition;
				}
				if (ModConfig.AbsorbsmachineWhiteHoleRelativeZ != null)
				{
					WhiteHoleRelativePosition = new Vector3(val.x, val.y, ModConfig.AbsorbsmachineWhiteHoleRelativeZ.value);
				}
			}
		}

		public void FixedUpdate()
		{
			((Behaviour)mortarLauncher).enabled = false;
			if (doingBlackHoles)
			{
				UpdateBlackHoles();
				UpdateHealth();
				return;
			}
			if (!createdWhiteHole)
			{
				UpdateWhiteHole();
				return;
			}
			UpdateHealth();
			if (dieEarly && !CanWhiteHoleReach())
			{
				enemy.health = -1f;
				eid.health = -1f;
			}
		}

		public void UpdateBlackHoles()
		{
			blackHoleCooldown += Time.fixedDeltaTime;
			if (!(blackHoleCooldown < blackHoleCooldownMax))
			{
				if (Blind)
				{
					blackHoleCooldown = 0f;
					return;
				}
				blackHoleCooldown = 0f;
				CreateBlackHole();
			}
		}

		public void UpdateWhiteHole()
		{
			createDelay += Time.fixedDeltaTime;
			if (!(createDelay < createDelayMax))
			{
				CreateWhiteHole();
			}
		}

		public void UpdateHealth()
		{
			if (eid.health <= 0f)
			{
				eid.SimpleDamage(0f);
			}
			healthCooldown += Time.fixedDeltaTime;
			if (!(healthCooldown < healthCooldownMax))
			{
				if (Blind)
				{
					healthCooldown = 0f;
					return;
				}
				healthCooldown = 0f;
				Enemy obj = enemy;
				obj.health -= 1f / eid.totalHealthModifier;
				EnemyIdentifier obj2 = eid;
				obj2.health -= 1f / eid.totalHealthModifier;
			}
		}

		public void Finish()
		{
			AbsorbsmachineWhiteHole absorbsmachineWhiteHole = whiteHole;
			if (absorbsmachineWhiteHole != null)
			{
				BlackHoleProjectile blackHoleProjectile = absorbsmachineWhiteHole.blackHoleProjectile;
				if (blackHoleProjectile != null)
				{
					blackHoleProjectile.Explode();
				}
			}
			doingBlackHoles = true;
			Enemy obj = enemy;
			obj.health += 3f;
			EnemyIdentifier obj2 = eid;
			obj2.health += 3f;
		}

		public void OnDestroy()
		{
			try
			{
				AbsorbsmachineWhiteHole absorbsmachineWhiteHole = whiteHole;
				if (absorbsmachineWhiteHole != null)
				{
					BlackHoleProjectile blackHoleProjectile = absorbsmachineWhiteHole.blackHoleProjectile;
					if (blackHoleProjectile != null)
					{
						blackHoleProjectile.Explode();
					}
				}
			}
			catch
			{
			}
		}

		public bool CanWhiteHoleReach()
		{
			if ((Object)(object)whiteHole == (Object)null)
			{
				return true;
			}
			float num = (whiteHole.moving ? 0f : (whiteHole.thisTimeStalled - whiteHole.stallProgress));
			float num2 = whiteHole.reachTime - whiteHole.timeProgress + num;
			float num3 = eid.health * eid.totalHealthModifier * healthCooldownMax;
			return num2 < num3;
		}

		public void CreateWhiteHole()
		{
			//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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			createdWhiteHole = true;
			GameObject val = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["BlackHole"], WhiteHoleAbsolutePosition, Quaternion.identity, ((Component)this).transform.parent);
			Transform transform = val.transform;
			transform.localScale *= 3f;
			whiteHole = val.AddComponent<AbsorbsmachineWhiteHole>();
			whiteHole.absorbsmachine = this;
			whiteHole.reachTime = whiteHoleReachTime;
			whiteHole.stallTime = whiteHoleStallTime;
			whiteHole.startPosition = WhiteHoleAbsolutePosition;
		}

		public void CreateBlackHole()
		{
			//IL_000b: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//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_0061: Unknown result type (might be due to invalid IL or missing references)
			Quaternion val = Quaternion.LookRotation(((Component)MonoSingleton<NewMovement>.Instance).transform.position - ShootPoint);
			BlackHoleProjectile component = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["BlackHole"], ShootPoint, val).GetComponent<BlackHoleProjectile>();
			Transform transform = ((Component)component).transform;
			transform.localScale *= 5f;
			component.safeType = (EnemyType)35;
			component.speed = 20f;
			component.Activate();
		}
	}
	public class AbsorbsmachineWhiteHole : MonoBehaviour
	{
		public AbsorbsmachineSpawned absorbsmachine;

		public float reachTime = 6f;

		public float stallTime = 2f;

		public Vector3 startPosition;

		public bool isPlayerTouching = false;

		public float stallProgress = 0f;

		public int hardDamage = 2;

		public float hardDamageCooldown = 0f;

		public float hardDamageCooldownMax = 0.6f;

		public float thisTimeStalled = 0f;

		public SpriteRenderer spriteRenderer;

		public Color transparentColor = new Color(1f, 1f, 1f, 0.4f);

		public Color normalColor = Color.white;

		public bool moving = true;

		public float timeProgress = 0f;

		public BlackHoleProjectile blackHoleProjectile;

		public static Sprite sprite;

		public bool Blind => BlindEnemies.Blind || EnemyIgnorePlayer.Active;

		public void Awake()
		{
			//IL_0021: 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)
			((Object)this).name = "White Hole(Clone)";
			blackHoleProjectile = ((Component)this).GetComponent<BlackHoleProjectile>();
			blackHoleProjectile.safeType = (EnemyType)35;
			((Behaviour)blackHoleProjectile).enabled = false;
			((Component)this).GetComponent<SphereCollider>().radius = 1f;
			((Renderer)((Component)this).GetComponent<MeshRenderer>()).enabled = false;
			((Component)this).GetComponent<Light>().color = new Color(0.9f, 0.8f, 0.7f);
			((Renderer)((Component)((Component)this).transform.Find("Particle System")).GetComponent<ParticleSystemRenderer>()).enabled = false;
		}

		public void Start()
		{
			blackHoleProjectile.Start();
			blackHoleProjectile.Activate();
			blackHoleProjectile.target = null;
			StartSprite();
			blackHoleProjectile.aura = ((Component)spriteRenderer).transform;
			((MonoBehaviour)blackHoleProjectile).CancelInvoke("ShootRandomLightning");
			((Behaviour)((Component)this).GetComponentInChildren<BlackHoleTrigger>()).enabled = false;
		}

		public void StartSprite()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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)
			GameObject gameObject = ((Component)((Component)this).transform.Find("BlackHole")).gameObject;
			Object.Destroy((Object)(object)gameObject);
			GameObject val = new GameObject("WhiteHole");
			val.transform.SetParent(((Component)this).transform);
			val.transform.SetSiblingIndex(0);
			val.transform.localPosition = Vector3.zero;
			val.transform.localScale = 5f * Vector3.one;
			val.layer = LayerMask.NameToLayer("TransparentFX");
			val.AddComponent<AlwaysLookAtCamera>();
			spriteRenderer = val.AddComponent<SpriteRenderer>();
			if ((Object)(object)sprite == (Object)null)
			{
				sprite = Sprite.Create(EnemyAssets.Textures["WhiteHole"], new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f));
			}
			spriteRenderer.sprite = sprite;
		}

		public void Update()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			((Component)spriteRenderer).transform.localPosition = new Vector3(Random.Range(-0.05f, 0.05f), Random.Range(-0.05f, 0.05f), Random.Range(-0.05f, 0.05f));
		}

		public void FixedUpdate()
		{
			UpdateMovement();
			UpdateHardDamage();
			UpdateStalling();
		}

		public void UpdateMovement()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (moving && !Blind)
			{
				timeProgress += Time.fixedDeltaTime;
				((Component)this).transform.position = Vector3.Lerp(startPosition, absorbsmachine.ShootPoint, timeProgress / reachTime);
				if (timeProgress >= reachTime)
				{
					absorbsmachine.Finish();
				}
			}
		}

		public void UpdateHardDamage()
		{
			if (isPlayerTouching)
			{
				hardDamageCooldown += Time.fixedDeltaTime;
				if (!(hardDamageCooldown < hardDamageCooldownMax))
				{
					hardDamageCooldown -= hardDamageCooldownMax;
					DoHardDamage();
				}
			}
		}

		public void DoHardDamage()
		{
			MonoSingleton<NewMovement>.Instance.ForceAddAntiHP((float)hardDamage, false, false, true, false);
			hardDamage += 2;
		}

		public void UpdateStalling()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (moving)
			{
				return;
			}
			if (isPlayerTouching)
			{
				thisTimeStalled += Time.fixedDeltaTime;
				return;
			}
			stallProgress += Time.fixedDeltaTime;
			if (stallProgress >= thisTimeStalled)
			{
				moving = true;
				spriteRenderer.color = normalColor;
			}
		}

		public void OnTriggerEnter(Collider other)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)other).CompareTag("Player"))
			{
				if (moving)
				{
					thisTimeStalled = stallTime;
					stallProgress = 0f;
				}
				else
				{
					thisTimeStalled = stallTime + stallProgress;
				}
				isPlayerTouching = true;
				moving = false;
				spriteRenderer.color = transparentColor;
				hardDamageCooldown = 0f;
				DoHardDamage();
			}
		}

		public void OnTriggerExit(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				isPlayerTouching = false;
			}
		}
	}
	public class BlackHoleFromMortar : MonoBehaviour
	{
		public EnemyIdentifier source = null;

		public static List<EnemyIdentifier> sources = new List<EnemyIdentifier>();

		public void Start()
		{
			sources.Add(source);
		}

		public void Update()
		{
			if ((Object)(object)source == (Object)null)
			{
				((Component)this).GetComponent<BlackHoleProjectile>().Explode();
			}
		}
	}
	[HarmonyPatch(typeof(BlackHoleProjectile), "Explode")]
	public static class BlackHoleFromMortarPatch
	{
		public static void Prefix(BlackHoleProjectile __instance)
		{
			try
			{
				BlackHoleFromMortar component = ((Component)__instance).GetComponent<BlackHoleFromMortar>();
				if ((Object)(object)component == (Object)null)
				{
					return;
				}
				if ((Object)(object)component.source == (Object)null)
				{
					BlackHoleFromMortar.sources.Remove(component.source);
					return;
				}
				MortarLauncher component2 = ((Component)component.source).GetComponent<MortarLauncher>();
				if (component2 != null)
				{
					component2.cooldown = 2f;
				}
				BlackHoleFromMortar.sources.Remove(component.source);
			}
			catch
			{
			}
		}
	}
	public class DashblockSpawned : MonoBehaviour
	{
		public Deathcatcher deathcatcher;

		public static int count;

		public void Awake()
		{
			deathcatcher = ((Component)this).GetComponent<Deathcatcher>();
		}

		public void FixedUpdate()
		{
			((Behaviour)deathcatcher).enabled = false;
		}

		public void Update()
		{
			if (count >= 1)
			{
				MonoSingleton<NewMovement>.Instance.EmptyStamina();
			}
		}

		public void Start()
		{
			Recolor();
			count++;
		}

		public void OnDestroy()
		{
			count--;
			count = Mathf.Max(count, 0);
			if (count == 0)
			{
				MonoSingleton<NewMovement>.Instance.FullStamina();
			}
		}

		public void Recolor()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = ((Component)((Component)this).transform.Find("Model/Deathcatcher_Animated/Deathcatcher_Open")).GetComponent<MeshRenderer>();
			((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["Dashblock"]);
			DistantSprite componentInChildren = ((Component)this).GetComponentInChildren<DistantSprite>();
			((Component)componentInChildren).GetComponent<SpriteRenderer>().color = new Color(0f, 1f, 0f, 0.502f);
			Transform child = ((Component)componentInChildren).transform.GetChild(0);
			((Component)child).GetComponent<SpriteRenderer>().color = new Color(0f, 0.5f, 0f, 0.502f);
			Color color = default(Color);
			((Color)(ref color))..ctor(0f, 1f, 0f, 1f);
			Transform val = ((Component)this).transform.Find("Model/ParticleEffects/Effects");
			((Component)val.Find("Glow (Red)")).GetComponent<SpriteRenderer>().color = color;
			((Component)val.Find("Point Light")).GetComponent<Light>().color = color;
		}
	}
	public class DisarmerSpawned : MonoBehaviour
	{
		public Deathcatcher deathcatcher;

		public static int count;

		public void Awake()
		{
			deathcatcher = ((Component)this).GetComponent<Deathcatcher>();
		}

		public void FixedUpdate()
		{
			((Behaviour)deathcatcher).enabled = false;
		}

		public void Start()
		{
			Recolor();
			count++;
			SetAllArms((VariantOption)2);
		}

		public void OnDestroy()
		{
			count--;
			count = Mathf.Max(count, 0);
			if (count == 0)
			{
				SetAllArms((VariantOption)0);
			}
		}

		public void Recolor()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = ((Component)((Component)this).transform.Find("Model/Deathcatcher_Animated/Deathcatcher_Open")).GetComponent<MeshRenderer>();
			((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["Disarmer"]);
			DistantSprite componentInChildren = ((Component)this).GetComponentInChildren<DistantSprite>();
			((Component)componentInChildren).GetComponent<SpriteRenderer>().color = new Color(0.75f, 0.25f, 1f, 0.502f);
			Transform child = ((Component)componentInChildren).transform.GetChild(0);
			((Component)child).GetComponent<SpriteRenderer>().color = new Color(0.35f, 0f, 0.5f, 0.502f);
			Color color = default(Color);
			((Color)(ref color))..ctor(0.75f, 0.25f, 1f, 1f);
			Transform val = ((Component)this).transform.Find("Model/ParticleEffects/Effects");
			((Component)val.Find("Glow (Red)")).GetComponent<SpriteRenderer>().color = color;
			((Component)val.Find("Point Light")).GetComponent<Light>().color = color;
		}

		public void SetAllArms(VariantOption variantOption)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_002a: 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)
			ForcedLoadout forcedLoadout = MonoSingleton<FistControl>.Instance.forcedLoadout;
			forcedLoadout.arm.blueVariant = variantOption;
			forcedLoadout.arm.redVariant = variantOption;
			forcedLoadout.arm.greenVariant = variantOption;
			MonoSingleton<FistControl>.Instance.ResetFists();
		}
	}
	public class JumpblockSpawned : MonoBehaviour
	{
		public Deathcatcher deathcatcher;

		public static int count;

		public void Awake()
		{
			deathcatcher = ((Component)this).GetComponent<Deathcatcher>();
		}

		public void FixedUpdate()
		{
			((Behaviour)deathcatcher).enabled = false;
		}

		public void Start()
		{
			Recolor();
			count++;
		}

		public void OnDestroy()
		{
			count--;
			count = Mathf.Max(count, 0);
		}

		public void Recolor()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = ((Component)((Component)this).transform.Find("Model/Deathcatcher_Animated/Deathcatcher_Open")).GetComponent<MeshRenderer>();
			((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["Jumpblock"]);
			DistantSprite componentInChildren = ((Component)this).GetComponentInChildren<DistantSprite>();
			((Component)componentInChildren).GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 0f, 0.502f);
			Transform child = ((Component)componentInChildren).transform.GetChild(0);
			((Component)child).GetComponent<SpriteRenderer>().color = new Color(0.5f, 0.5f, 0f, 0.502f);
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 0f, 1f);
			Transform val = ((Component)this).transform.Find("Model/ParticleEffects/Effects");
			((Component)val.Find("Glow (Red)")).GetComponent<SpriteRenderer>().color = color;
			((Component)val.Find("Point Light")).GetComponent<Light>().color = color;
		}
	}
	[HarmonyPatch(typeof(NewMovement))]
	public static class JumpPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(NewMovement), "Jump")]
		[HarmonyPriority(600)]
		public static bool JumpPrefix()
		{
			if (JumpblockSpawned.count >= 1)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(NewMovement), "WallJump")]
		[HarmonyPriority(600)]
		public static bool WallJumpPrefix(WallCheck wcInstance)
		{
			if (JumpblockSpawned.count >= 1)
			{
				return false;
			}
			return true;
		}
	}
	public class NullifierChecker : MonoBehaviour
	{
		public void FixedUpdate()
		{
			if (NullifierSpawned.count > 0)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class NullifierSpawned : MonoBehaviour
	{
		public Deathcatcher deathcatcher;

		public static int count;

		public void Awake()
		{
			deathcatcher = ((Component)this).GetComponent<Deathcatcher>();
		}

		public void FixedUpdate()
		{
			((Behaviour)deathcatcher).enabled = false;
		}

		public void Start()
		{
			Recolor();
			count++;
			SetAllWeapons((VariantOption)2);
		}

		public void OnDestroy()
		{
			count--;
			count = Mathf.Max(count, 0);
			if (count == 0)
			{
				SetAllWeapons((VariantOption)0);
			}
		}

		public void Recolor()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = ((Component)((Component)this).transform.Find("Model/Deathcatcher_Animated/Deathcatcher_Open")).GetComponent<MeshRenderer>();
			((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["Nullifier"]);
			DistantSprite componentInChildren = ((Component)this).GetComponentInChildren<DistantSprite>();
			((Component)componentInChildren).GetComponent<SpriteRenderer>().color = new Color(0f, 0.25f, 1f, 0.502f);
			Transform child = ((Component)componentInChildren).transform.GetChild(0);
			((Component)child).GetComponent<SpriteRenderer>().color = new Color(0f, 0f, 0.5f, 0.502f);
			Color color = default(Color);
			((Color)(ref color))..ctor(0f, 0.25f, 1f, 1f);
			Transform val = ((Component)this).transform.Find("Model/ParticleEffects/Effects");
			((Component)val.Find("Glow (Red)")).GetComponent<SpriteRenderer>().color = color;
			((Component)val.Find("Point Light")).GetComponent<Light>().color = color;
		}

		public void SetAllWeapons(VariantOption variantOption)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ForcedLoadout forcedLoadout = MonoSingleton<GunSetter>.Instance.forcedLoadout;
			SetAllVariants(forcedLoadout.revolver, variantOption);
			SetAllVariants(forcedLoadout.shotgun, variantOption);
			SetAllVariants(forcedLoadout.nailgun, variantOption);
			SetAllVariants(forcedLoadout.railcannon, variantOption);
			SetAllVariants(forcedLoadout.rocketLauncher, variantOption);
			SetAllVariants(forcedLoadout.altRevolver, variantOption);
			SetAllVariants(forcedLoadout.altShotgun, variantOption);
			SetAllVariants(forcedLoadout.altNailgun, variantOption);
			MonoSingleton<GunSetter>.Instance.ResetWeapons(false);
		}

		public void SetAllVariants(VariantSetting variantSetting, VariantOption variantOption)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//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)
			variantSetting.blueVariant = variantOption;
			variantSetting.greenVariant = variantOption;
			variantSetting.redVariant = variantOption;
		}
	}
	public class DisgraceSpawned : MonoBehaviour
	{
		public bool dashing = false;

		public float dashCooldown = 0f;

		public float dashCooldownMax = 0.6f;

		public float randomizedSpeed;

		public Color red = new Color(0.9f, 0.5f, 0.6f);

		public Color green = new Color(0.5f, 0.9f, 0.6f);

		public Transform mf;

		public Follow follow;

		public AlwaysLookAtCamera looker;

		public SkinnedMeshRenderer renderer;

		public EnemyIdentifier eid;

		public float difficultySpeedModifier;

		public void Start()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			mf = ((Component)this).transform.Find("MaliciousFace");
			follow = ((Component)this).gameObject.AddComponent<Follow>();
			follow.speed = 12f;
			looker = ((Component)mf).gameObject.AddComponent<AlwaysLookAtCamera>();
			mf.localScale = new Vector3(0.1f, 0.0875f, 0.0005f);
			randomizedSpeed = Random.Range(-1.6f, 1.6f);
			renderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			for (int i = 0; i < ((Component)this).transform.parent.childCount; i++)
			{
				Transform child = ((Component)this).transform.parent.GetChild(i);
				if (((Object)child).name.Contains("Leg"))
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
			int difficulty = eid.difficulty;
			if (1 == 0)
			{
			}
			float num = difficulty switch
			{
				4 => 1f, 
				3 => 0.9f, 
				2 => 0.75f, 
				1 => 0.5f, 
				0 => 0.4f, 
				_ => 1.15f, 
			};
			if (1 == 0)
			{
			}
			difficultySpeedModifier = num;
			dashCooldownMax /= difficultySpeedModifier;
		}

		public IEnumerator Dash(int times)
		{
			yield return (object)new WaitForSeconds(0.01f);
			if (times > 0)
			{
				Vector3 distance = ((Component)mf).transform.position - ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
				Transform transform = ((Component)this).transform;
				transform.position -= 0.1f * distance;
				((MonoBehaviour)this).StartCoroutine(Dash(times - 1));
			}
			else
			{
				Object.Instantiate<GameObject>(EnemyAssets.Prefabs["Explosion"], ((Component)this).transform.position, ((Component)this).transform.rotation);
				dashing = false;
				dashCooldown = 0f;
			}
		}

		public void Update()
		{
			//IL_004f: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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)
			if (eid.dead)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			if (!dashing)
			{
				dashCooldown += Time.deltaTime;
			}
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			Vector3 val = ((Component)mf).transform.position - ((Component)instance).transform.position;
			float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)instance.cc).transform.forward);
			if (((Vector3)(ref val)).magnitude <= 12f && dashCooldown >= dashCooldownMax && !dashing && !BlindEnemies.Blind && !EnemyIgnorePlayer.Active && !eid.dead)
			{
				dashing = true;
				((MonoBehaviour)this).StartCoroutine(Dash(10));
			}
			if (num > 0.9f)
			{
				follow.speed = (3f + randomizedSpeed * 0.375f) * difficultySpeedModifier;
				((Renderer)renderer).material.color = red;
			}
			else
			{
				follow.speed = (8f + randomizedSpeed) * difficultySpeedModifier;
				((Renderer)renderer).material.color = green;
			}
			if (eid.dead)
			{
				((Renderer)renderer).material.color = ((Renderer)renderer).material.color / 3f;
			}
			if (BlindEnemies.Blind || EnemyIgnorePlayer.Active)
			{
				((Behaviour)follow).enabled = false;
				((Behaviour)looker).enabled = false;
			}
			else
			{
				((Behaviour)follow).enabled = true;
				((Behaviour)looker).enabled = true;
			}
		}
	}
	public class FlangerBeam : MonoBehaviour
	{
		public float angularSpeed = 180f;

		public float angularSpeedIncrease = 0.25f;

		public float radialSpeed = 4f;

		public float radialSpeedIncrease = 0.25f;

		public GameObject damageZone;

		public Vector3 startPoint;

		public float angle;

		public float radius = 0f;

		public void Awake()
		{
			damageZone = ((Component)((Component)this).transform.Find("DamageZone")).gameObject;
		}

		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)
			startPoint = ((Component)this).transform.position;
		}

		public void Update()
		{
			//IL_00ac: 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)
			//IL_00c2: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			if (damageZone.activeInHierarchy)
			{
				angularSpeed += angularSpeedIncrease * Time.deltaTime;
				angle += angularSpeed * Time.deltaTime;
				radialSpeed += radialSpeedIncrease * Time.deltaTime;
				radius += radialSpeed * Time.deltaTime;
				float num = angle * (MathF.PI / 180f);
				float num2 = radius * Mathf.Cos(num);
				float num3 = radius * Mathf.Sin(num);
				((Component)this).transform.position = startPoint + num2 * -((Component)this).transform.right + num3 * -((Component)this).transform.up;
			}
		}
	}
	public class FlangerSpawned : MonoBehaviour
	{
		public float cooldown = 2f;

		public float cooldownMax = 4f;

		public float flashPreAttackTime = 0.5f;

		public bool didFlash = false;

		public float beamAngularSpeed = 180f;

		public float beamAngularSpeedIncrease = 0.25f;

		public float beamRadialSpeed = 4f;

		public float beamRadialSpeedIncrease = 0.25f;

		public float difficultySpeedModifier = 1f;

		public bool finishedSetup = false;

		public bool difficultyStarted = false;

		public Transform model;

		public EnemyIdentifier eid;

		public Drone drone;

		public DroneFlesh droneFlesh;

		public void Awake()
		{
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			if (!finishedSetup)
			{
				SetupWeaknesses();
				RemoveParts();
				SetupModel();
			}
			else
			{
				RetextureModel();
			}
		}

		public void SetupWeaknesses()
		{
			eid.weaknesses = Array.Empty<string>();
			eid.weaknessMultipliers = Array.Empty<float>();
		}

		public void RemoveParts()
		{
			drone = ((Component)this).GetComponent<Drone>();
			droneFlesh = ((Component)this).GetComponent<DroneFlesh>();
			((Behaviour)drone).enabled = false;
			((Behaviour)droneFlesh).enabled = false;
			((Component)((Component)this).transform.Find("HardDamageBeam")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("Particle System")).gameObject.SetActive(false);
		}

		public void SetupModel()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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)
			//IL_009d: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			model = ((Component)this).transform.Find("Gib_Eyeball");
			model.localScale = 3.175f * Vector3.one;
			ParticleSystem component = ((Component)((Component)this).transform.Find("Particle System (1)")).GetComponent<ParticleSystem>();
			MainModule main = component.main;
			MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
			((MinMaxGradient)(ref startColor)).color = new Color(1f, 0.6f, 0.2f, 1f);
			((MainModule)(ref main)).startColor = startColor;
			Transform val = ((Component)this).transform.Find("AlwaysLookAtCamera/Square");
			val.localScale = 6.25f * Vector3.one;
			SpriteRenderer component2 = ((Component)val).GetComponent<SpriteRenderer>();
			component2.color = new Color(1f, 0.4f, 0f, component2.color.a);
			AlwaysLookAtCamera val2 = ((Component)this).gameObject.AddComponent<AlwaysLookAtCamera>();
			val2.overrideTarget = ((Component)MonoSingleton<NewMovement>.Instance).transform;
			val2.dontRotateIfBlind = true;
			RetextureModel();
		}

		public void RetextureModel()
		{
			MeshRenderer component = ((Component)model).GetComponent<MeshRenderer>();
			((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["Flanger"]);
			((Renderer)component).material.EnableKeyword("ENEMY");
		}

		public void Start()
		{
			drone.difficulty = Enemy.InitializeDifficulty(eid);
			drone.bsm = MonoSingleton<BloodsplatterManager>.Instance;
			drone.gz = GoreZone.ResolveGoreZone(((Component)this).transform);
			drone.kib = ((Component)this).GetComponent<KeepInBounds>();
			StartDifficulty();
			MeshRenderer component = ((Component)((Component)this).transform.Find("Gib_Eyeball")).GetComponent<MeshRenderer>();
			((Renderer)component).material.EnableKeyword("ENEMY");
		}

		public void StartDifficulty()
		{
			if (!difficultyStarted)
			{
				difficultyStarted = true;
				difficultySpeedModifier = GetDifficultyModifier(eid.difficulty);
				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 float GetEidSpeedModifier()
		{
			float num = 1f;
			float num2 = Mathf.Max(OptionsManager.radianceTier, eid.radianceTier);
			if (eid.speedBuff || OptionsManager.forceRadiance)
			{
				num *= eid.speedBuffModifier * ((num2 > 1f) ? (0.75f + num2 / 4f) : num2);
			}
			if (eid.puppet)
			{
				num *= 0.75f;
			}
			return num;
		}

		public void Update()
		{
			cooldown += Time.deltaTime * GetEidSpeedModifier();
			if ((Object)(object)eid == (Object)null || eid.health <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			bool flag = !BlindEnemies.Blind && !EnemyIgnorePlayer.Active;
			float num = flashPreAttackTime / difficultySpeedModifier / GetEidSpeedModifier();
			if (!didFlash && cooldown >= cooldownMax - num && flag)
			{
				Flash();
			}
			if (cooldown >= cooldownMax && didFlash && flag)
			{
				didFlash = false;
				cooldown = 0f;
				ShootOrangeBeamThis();
			}
			((Behaviour)drone).enabled = false;
			((Behaviour)droneFlesh).enabled = false;
		}

		public void Flash()
		{
			//IL_0011: 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_0028: 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_0070: 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)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_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)
			Transform transform = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.unparryableFlash, ((Component)this).transform.position, Quaternion.identity).transform;
			transform.localScale *= 25f;
			transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
			((Component)transform).GetComponent<AudioSource>().volume = 0.5f;
			didFlash = true;
			Vector3 val = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)this).transform.position;
			transform.localPosition += 3f * ((Vector3)(ref val)).normalized;
		}

		public GameObject ShootOrangeBeamThis()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return ShootOrangeBeam(((Component)this).transform.position, difficultySpeedModifier, GetEidSpeedModifier(), beamAngularSpeed, beamAngularSpeedIncrease, beamRadialSpeed, beamRadialSpeedIncrease);
		}

		public static GameObject ShootOrangeBeam(Vector3 position, float difficultySpeedModifier, float eidSpeedModifier, float? angularSpeed = null, float? angularSpeedIncrease = null, float? radialSpeed = null, float? radialSpeedIncrease = null)
		{
			//IL_001a: 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_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_006c: 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)
			GameObject val = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["GeryonUpArrowBeam"], ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
			Vector3 val2 = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - position;
			val.transform.rotation = Quaternion.LookRotation(Vector3.down, val2);
			val.transform.localScale = new Vector3(0.4f, 0.4f, 1f);
			HurtZone componentInChildren = val.GetComponentInChildren<HurtZone>(true);
			componentInChildren.affected = (AffectedSubjects)1;
			componentInChildren.enemyDamageOverride = 0f;
			float num = 1f / difficultySpeedModifier / eidSpeedModifier;
			RemoveOnTime val3 = val.AddComponent<RemoveOnTime>();
			val3.time = 12f * num;
			ScaleTransform component = val.GetComponent<ScaleTransform>();
			component.speed = 0.125f / num;
			Screenshaker componentInChildren2 = val.GetComponentInChildren<Screenshaker>(true);
			componentInChildren2.amount = 1f;
			Light componentInChildren3 = val.GetComponentInChildren<Light>(true);
			componentInChildren3.intensity *= 0.2f;
			FlangerBeam flangerBeam = val.AddComponent<FlangerBeam>();
			float valueOrDefault = angularSpeed.GetValueOrDefault();
			if (!angularSpeed.HasValue)
			{
				valueOrDefault = flangerBeam.angularSpeed;
				angularSpeed = valueOrDefault;
			}
			valueOrDefault = angularSpeedIncrease.GetValueOrDefault();
			if (!angularSpeedIncrease.HasValue)
			{
				valueOrDefault = flangerBeam.angularSpeedIncrease;
				angularSpeedIncrease = valueOrDefault;
			}
			valueOrDefault = radialSpeed.GetValueOrDefault();
			if (!radialSpeed.HasValue)
			{
				valueOrDefault = flangerBeam.radialSpeed;
				radialSpeed = valueOrDefault;
			}
			valueOrDefault = radialSpeedIncrease.GetValueOrDefault();
			if (!radialSpeedIncrease.HasValue)
			{
				valueOrDefault = flangerBeam.radialSpeedIncrease;
				radialSpeedIncrease = valueOrDefault;
			}
			flangerBeam.angularSpeed = angularSpeed.Value / num;
			flangerBeam.angularSpeedIncrease = angularSpeedIncrease.Value / num;
			flangerBeam.radialSpeed = radialSpeed.Value / num;
			flangerBeam.radialSpeedIncrease = radialSpeedIncrease.Value / num;
			val.AddComponent<RemoveOnRespawn>();
			return val;
		}
	}
	public class FuchsiaSetValues : MonoBehaviour
	{
		public float cycleOffsetTime = 0f;

		public float lasersRotation = 0f;

		public bool pushForceFollowsRotation = false;

		public int laserEnvironmentMask = 16777664;
	}
	public class FuchsiaSpawned : MonoBehaviour
	{
		public Transform lasersTransform;

		public Transform[] lasers = (Transform[])(object)new Transform[2];

		public Transform[] lasersMelee = (Transform[])(object)new Transform[2];

		public bool rotatingLasers = true;

		public int laserEnvironmentMask = 16777664;

		public FuchsiaState state = FuchsiaState.Nothing;

		public float nextCycleTime = 0f;

		public float cycleOffsetTime = 0f;

		public float timeModulo;

		public bool telegraphing = true;

		[SerializeField]
		private bool canPushUp = false;

		[SerializeField]
		private bool canPushDown = true;

		public Transform model;

		public Transform wings;

		public Transform crown;

		public bool finishedSetup = false;

		public bool difficultyStarted = false;

		public bool configValuesSet = false;

		public float meleeTriggerDistance = 16f;

		public bool alreadyInMeleeZone = false;

		public float meleeZoneEndDistance = 16f;

		public float meleePushDistance = 18f;

		public bool pushForceFollowsRotation = false;

		public float pushForce = 65f;

		public float prePushDelay = 0.5f;

		public float pushDuration = 0.3f;

		public float preMeleeFireDelay = 0.35f;

		public float meleeFireDuration = 0.25f;

		public float postMeleeFireDelay = 0.2f;

		public float didntDoMeleeTime = 0.2f;

		public float pushStartTimepoint;

		public float meleeFireStartTimepoint;

		public bool didMeleePushAction = false;

		public bool parried = false;

		public bool checkingForParry = false;

		public bool unparriableAttack = false;

		public float difficultySpeedModifier = 1f;

		public EnemyIdentifier eid;

		public Rigidbody rigidbody;

		public Enemy enemy;

		public AlwaysLookAtCamera looker;

		public RealTypeSaver realTypeSaver;

		public BoxCollider collider;

		public Drone drone;

		public DroneFlesh droneFlesh;

		public Vector3 originalPosition;

		public Quaternion originalRotation;

		public bool originalTransformSet = false;

		public float LasersRotation
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				Quaternion localRotation = lasersTransform.localRotation;
				return ((Quaternion)(ref localRotation)).eulerAngles.z;
			}
			set
			{
				//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_0014: 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_002c: 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)
				Transform obj = lasersTransform;
				Quaternion localRotation = lasersTransform.localRotation;
				float x = ((Quaternion)(ref localRotation)).eulerAngles.x;
				localRotation = lasersTransform.localRotation;
				obj.localRotation = Quaternion.Euler(x, ((Quaternion)(ref localRotation)).eulerAngles.y, value);
			}
		}

		public float CycleOffsetTime
		{
			get
			{
				return cycleOffsetTime;
			}
			set
			{
				cycleOffsetTime = value;
			}
		}

		public bool CanPushUp
		{
			get
			{
				return canPushUp;
			}
			set
			{
				AllowPushUp(value);
			}
		}

		public bool CanPushDown
		{
			get
			{
				return canPushDown;
			}
			set
			{
				AllowPushDown(value);
			}
		}

		public bool PushForceFollowsRotation
		{
			get
			{
				return pushForceFollowsRotation;
			}
			set
			{
				pushForceFollowsRotation = value;
			}
		}

		public int LaserEnvironmentMask
		{
			get
			{
				return laserEnvironmentMask;
			}
			set
			{
				laserEnvironmentMask = value;
			}
		}

		public void Awake()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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)
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			enemy = ((Component)this).GetComponent<Enemy>();
			realTypeSaver = ((Component)this).GetComponent<RealTypeSaver>();
			collider = ((Component)this).GetComponent<BoxCollider>();
			rigidbody = ((Component)this).GetComponent<Rigidbody>();
			SetupWeaknesses();
			if (!originalTransformSet)
			{
				originalPosition = ((Component)this).transform.position;
				originalRotation = ((Component)this).transform.rotation;
				originalTransformSet = true;
			}
			if (!finishedSetup)
			{
				RemoveParts();
				AddParts();
				SetupLasers();
				AddLooker();
				finishedSetup = true;
			}
			else
			{
				RetextureAll();
			}
			Telegraph(telegraphing: true);
			CheckSetValues();
		}

		public void CheckSetValues()
		{
			FuchsiaSetValues component = ((Component)this).GetComponent<FuchsiaSetValues>();
			if (!((Object)(object)component == (Object)null))
			{
				CycleOffsetTime = component.cycleOffsetTime;
				LasersRotation = component.lasersRotation;
				PushForceFollowsRotation = component.pushForceFollowsRotation;
				LaserEnvironmentMask = component.laserEnvironmentMask;
			}
		}

		public void SetupWeaknesses()
		{
			eid.weaknesses[0] = "nail";
			eid.weaknessMultipliers[0] = 1.25f;
			Util.ArrayAdd(ref eid.weaknesses, "explosion");
			Util.ArrayAdd(ref eid.weaknessMultipliers, 0.75f);
			Util.ArrayAdd(ref eid.weaknesses, "railcannon");
			Util.ArrayAdd(ref eid.weaknessMultipliers, 1.65f);
			eid.immuneToFriendlyFire = true;
		}

		public void RemoveParts()
		{
			drone = ((Component)this).GetComponent<Drone>();
			droneFlesh = ((Component)this).GetComponent<DroneFlesh>();
			((Behaviour)drone).enabled = false;
			((Behaviour)droneFlesh).enabled = false;
			((Component)((Component)this).transform.Find("HardDamageBeam")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("Particle System")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("Particle System (1)")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("AlwaysLookAtCamera")).gameObject.SetActive(false);
		}

		public void AddParts()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			model = ((Component)this).transform.Find("Gib_Eyeball");
			model.localScale = 3.81f * Vector3.one;
			Transform transform = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["Virtue"], model).transform;
			((Component)transform).gameObject.SetActive(false);
			transform.localPosition = Vector3.zero;
			DisableVirtue(transform);
			Transform val = transform.Find("DivineOrthos");
			val.localScale = 6f * Vector3.one;
			val.localRotation = Quaternion.Euler(90f, 0f, 0f);
			Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true);
			foreach (Transform val2 in componentsInChildren)
			{
				if (((Object)val2).name != "Wings" && (Object)(object)val2 != (Object)(object)val)
				{
					((Component)val2).gameObject.SetActive(false);
				}
				else if (((Object)val2).name == "Wings")
				{
					wings = val2;
				}
			}
			((Component)transform).gameObject.SetActive(true);
			AllowPushUp(CanPushUp);
			crown = Object.Instantiate<Transform>(EnemyAssets.Prefabs["Virtue"].transform.Find("DivineOrthos/Orthos_Root/Crown"), model);
			crown.localScale = 0.08f * Vector3.one;
			crown.localPosition = new Vector3(-0.02f, -0.04f, 0.2f);
			AllowPushDown(CanPushDown);
			RetextureAll();
		}

		public void DisableVirtue(Transform virtue)
		{
			((Component)virtue).gameObject.layer = LayerMask.NameToLayer("Default");
			((Component)virtue).tag = "Untagged";
			((Behaviour)((Component)virtue).GetComponent<EnemySpawnableInstance>()).enabled = false;
			((Behaviour)((Component)virtue).GetComponent<EnemyIdentifier>()).enabled = false;
			((Behaviour)((Component)virtue).GetComponent<Enemy>()).enabled = false;
			((Behaviour)((Component)virtue).GetComponent<Drone>()).enabled = false;
			((Collider)((Component)virtue).GetComponent<SphereCollider>()).enabled = false;
			((Collider)((Component)virtue).GetComponent<SphereCollider>()).isTrigger = true;
			((Behaviour)((Component)virtue).GetComponent<AudioSource>()).enabled = false;
			((Behaviour)((Component)virtue).GetComponent<KeepInBounds>()).enabled = false;
			((Behaviour)((Component)virtue).GetComponent<PortalAwareRenderer>()).enabled = false;
			Collider component = ((Component)virtue.Find("Sphere")).GetComponent<Collider>();
			component.enabled = false;
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<EnemySpawnableInstance>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<EnemyIdentifier>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<Enemy>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<Drone>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<SphereCollider>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<Rigidbody>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<AudioSource>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<KeepInBounds>());
			Object.Destroy((Object)(object)((Component)virtue).GetComponent<PortalAwareRenderer>());
			Object.Destroy((Object)(object)((Component)virtue.Find("Sphere")).gameObject);
			Object.Destroy((Object)(object)((Component)virtue.Find("ParticleEffects")).gameObject);
			Object.Destroy((Object)(object)((Component)virtue.Find("SpawnEffect Projectile")).gameObject);
		}

		public void RetextureAll()
		{
			RetextureMeshRenderer(model, EnemyAssets.Textures["Fuchsia"]);
			RetextureMeshRenderer(crown, EnemyAssets.Textures["FuchsiaCrown"]);
			RetextureSkinnedMeshRenderer(wings, EnemyAssets.Textures["FuchsiaWings"]);
		}

		public void RetextureMeshRenderer(Transform tr, Texture2D texture)
		{
			if (!((Object)(object)tr == (Object)null))
			{
				MeshRenderer component = ((Component)tr).GetComponent<MeshRenderer>();
				((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)texture);
				((Renderer)component).material.EnableKeyword("ENEMY");
			}
		}

		public void RetextureSkinnedMeshRenderer(Transform tr, Texture2D texture)
		{
			if (!((Object)(object)tr == (Object)null))
			{
				SkinnedMeshRenderer component = ((Component)tr).GetComponent<SkinnedMeshRenderer>();
				((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)texture);
			}
		}

		public void SetupLasers()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			lasersTransform = new GameObject("Lasers").transform;
			lasersTransform.SetParent(((Component)this).transform);
			lasersTransform.localPosition = new Vector3(0f, 0f, 0.8f);
			lasersTransform.localRotation = Quaternion.identity;
			lasers[0] = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform;
			lasers[1] = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform;
			lasersMelee[0] = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform;
			lasersMelee[1] = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform;
			ConfigureLaserBeam(lasers[0], "Laser 0");
			ConfigureLaserBeam(lasers[1], "Laser 1");
			ConfigureLaserBeam(lasersMelee[0], "Melee Laser 0");
			ConfigureLaserBeam(lasersMelee[1], "Melee Laser 1");
			Renderer[] componentsInChildren = ((Component)lasersTransform).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer item in componentsInChildren)
			{
				eid.buffUnaffectedRenderers.Add(item);
			}
			MeleeUnfire();
		}

		public void ConfigureLaserBeam(Transform laser, string laserName, bool startup = false)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			((Object)laser).name = laserName;
			ContinuousBeam component = ((Component)laser).GetComponent<ContinuousBeam>();
			component.canHitEnemy = false;
			component.safeEnemyType = (EnemyType)1;
			component.beamWidth = 3f;
			component.originalWidth = 3f;
			component.startup = startup;
			component.startUpSpeed = 300f;
			Object.Destroy((Object)(object)((Component)component).GetComponent<DestroyOnCheckpointRestart>());
		}

		public void AddLooker()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			looker = ((Component)this).gameObject.AddComponent<AlwaysLookAtCamera>();
			looker.overrideTarget = ((Component)MonoSingleton<NewMovement>.Instance).transform;
			((Behaviour)looker).enabled = false;
			((Component)this).transform.rotation = originalRotation;
		}

		public void Start()
		{
			//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)
			lasersTransform.localScale = 0.25f * Vector3.one;
			eid.hookIgnore = true;
			drone.difficulty = Enemy.InitializeDifficulty(eid);
			drone.bsm = MonoSingleton<BloodsplatterManager>.Instance;
			drone.gz = GoreZone.ResolveGoreZone(((Component)this).transform);
			drone.kib = ((Component)this).GetComponent<KeepInBounds>();
			MeshRenderer component = ((Component)((Component)this).transform.Find("Gib_Eyeball")).GetComponent<MeshRenderer>();
			((Renderer)component).material.EnableKeyword("ENEMY");
			StartDifficulty();
			SetConfigValues();
			((MonoBehaviour)this).StartCoroutine(StartFiring());
		}

		public IEnumerator StartIdling()
		{
			yield return (object)new WaitForSeconds(1f);
			Idle();
			yield return (object)new WaitForSeconds(0.1f);
			UpdateLaserEnvironmentMask();
		}

		public IEnumerator StartFiring()
		{
			yield return (object)new WaitForSeconds(1f);
			Fire();
			yield return (object)new WaitForSeconds(0.1f);
			UpdateLaserEnvironmentMask();
		}

		public void StartDifficulty()
		{
			if (!difficultyStarted)
			{
				difficultyStarted = true;
				difficultySpeedModifier = GetDifficultyModifier(eid.difficulty);
				prePushDelay /= difficultySpeedModifier;
				pushDuration /= difficultySpeedModifier;
				preMeleeFireDelay /= difficultySpeedModifier;
				meleeFireDuration /= difficultySpeedModifier;
				postMeleeFireDelay /= difficultySpeedModifier;
				didntDoMeleeTime /= difficultySpeedModifier;
			}
		}

		public float GetDifficultyModifier(int difficulty)
		{
			if (1 == 0)
			{
			}
			float result = difficulty switch
			{
				4 => 1f, 
				3 => 0.8f, 
				2 => 0.65f, 
				1 => 0.45f, 
				0 => 0.3f, 
				_ => 1.15f, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public void SetConfigValues()
		{
			//IL_00a5: 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)
			if (!configValuesSet && !((Object)(object)Util.FindParentWithNameContaining(Plugin.SpawnedStrictName, ((Component)this).transform) != (Object)null))
			{
				configValuesSet = true;
				if (ModConfig.FuchsiaLaserRotation != null)
				{
					LasersRotation = ModConfig.FuchsiaLaserRotation.value;
				}
				if (ModConfig.FuchsiaCycleOffset != null)
				{
					CycleOffsetTime = MathF.PI * ModConfig.FuchsiaCycleOffset.value;
				}
				BoolField fuchsiaLookAtPlayerWhenSpawned = ModConfig.FuchsiaLookAtPlayerWhenSpawned;
				if (fuchsiaLookAtPlayerWhenSpawned != null && fuchsiaLookAtPlayerWhenSpawned.value)
				{
					((Component)this).transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
					originalRotation = ((Component)this).transform.rotation;
				}
				if (ModConfig.FuchsiaPushForceFollowsRotation != null)
				{
					PushForceFollowsRotation = ModConfig.FuchsiaPushForceFollowsRotation.value;
				}
			}
		}

		public void Update()
		{
			if ((Object)(object)eid == (Object)null || eid.health <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (checkingForParry && !enemy.parryable && !unparriableAttack)
			{
				parried = true;
			}
			if (((Behaviour)drone).enabled)
			{
				((Behaviour)drone).enabled = false;
			}
			if (((Behaviour)droneFlesh).enabled)
			{
				((Behaviour)droneFlesh).enabled = false;
			}
		}

		public void FixedUpdate()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			timeModulo = (Time.fixedTime - CycleOffsetTime) * GetEidSpeedModifier() % (MathF.PI * 2f);
			if (rotatingLasers)
			{
				RotateLasers();
			}
			if (!rigidbody.isKinematic)
			{
				rigidbody.isKinematic = true;
			}
			switch (state)
			{
			case FuchsiaState.Idle:
				((Behaviour)looker).enabled = false;
				((Component)this).transform.rotation = originalRotation;
				if (Time.fixedTime >= nextCycleTime)
				{
					Fire();
				}
				else
				{
					CheckMelee();
				}
				break;
			case FuchsiaState.Firing:
				((Behaviour)looker).enabled = false;
				((Component)this).transform.rotation = originalRotation;
				CheckMelee();
				break;
			case FuchsiaState.MeleePushing:
				MeleePushingMove();
				break;
			case FuchsiaState.MeleeFiring:
				((Component)this).transform.position = originalPosition;
				MeleeFireMoveLasers();
				break;
			case FuchsiaState.MeleeStart:
				break;
			}
		}

		public void Idle()
		{
			nextCycleTime = Time.fixedTime - CycleOffsetTime - (Time.fixedTime - CycleOffsetTime) % MathF.PI + MathF.PI / 2f + CycleOffsetTime;
			state = FuchsiaState.Idle;
		}

		public void RotateLasers()
		{
			//IL_000b: 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)
			lasers[0].localRotation = GetLaserRotation();
			lasers[1].localRotation = GetLaserRotation(firstLaser: false);
		}

		public Quaternion GetLaserRotation(bool firstLaser = true)
		{
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			float num = ((!firstLaser) ? (45f * Mathf.Sin(MathF.PI + timeModulo)) : (45f * Mathf.Sin(timeModulo)));
			return Quaternion.Euler(num, 0f, 0f);
		}

		public float GetEidSpeedModifier()
		{
			float num = 1f;
			float num2 = Mathf.Max(OptionsManager.radianceTier, eid.radianceTier);
			if (eid.speedBuff || OptionsManager.forceRadiance)
			{
				num *= eid.speedBuffModifier * ((num2 > 1f) ? (0.75f + num2 / 4f) : num2);
			}
			if (eid.puppet)
			{
				num *= 0.75f;
			}
			return num;
		}

		public void Fire()
		{
			MeleeUnfire();
			if (telegraphing)
			{
				Telegraph(telegraphing: false);
			}
			state = FuchsiaState.Firing;
			((Component)lasers[0]).gameObject.SetActive(true);
			((Component)lasers[1]).gameObject.SetActive(true);
			UpdateLaserEnvironmentMask();
		}

		public void Unfire()
		{
			((Component)lasers[0]).gameObject.SetActive(false);
			((Component)lasers[1]).gameObject.SetActive(false);
		}

		public void UpdateLaserEnvironmentMask()
		{
			//IL_001e: 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)
			ContinuousBeam[] componentsInChildren = ((Component)lasersTransform).GetComponentsInChildren<ContinuousBeam>(true);
			foreach (ContinuousBeam val in componentsInChildren)
			{
				val.environmentMask = LayerMask.op_Implicit(LaserEnvironmentMask);
			}
		}

		public void Telegraph(bool telegraphing)
		{
			this.telegraphing = telegraphing;
			Transform[] array = lasers;
			foreach (Transform val in array)
			{
				((Component)val).gameObject.SetActive(true);
				((Behaviour)((Component)val).GetComponent<ContinuousBeam>()).enabled = !telegraphing;
				((Renderer)((Component)val).GetComponent<LineRenderer>()).enabled = !telegraphing;
				((Component)val.Find("Ring (1)")).gameObject.SetActive(!telegraphing);
			}
		}

		public void AllowPushUp(bool newValue = true)
		{
			canPushUp = newValue;
			Transform obj = wings;
			if (obj != null)
			{
				((Component)obj).gameObject.SetActive(newValue);
			}
			UpdateRealType();
		}

		public void AllowPushDown(bool newValue = true)
		{
			canPushDown = newValue;
			Transform obj = crown;
			if (obj != null)
			{
				((Component)obj).gameObject.SetActive(newValue);
			}
			UpdateRealType();
		}

		public void UpdateRealType()
		{
			RealType realType = RealType.FuchsiaPushUpPushDown;
			if (CanPushUp && !CanPushDown)
			{
				realType = RealType.FuchsiaPushUp;
			}
			else if (!CanPushUp && CanPushDown)
			{
				realType = RealType.FuchsiaPushDown;
			}
			else if (!CanPushUp && !CanPushDown)
			{
				realType = RealType.Fuchsia;
			}
			realTypeSaver.realType = realType;
			GameObject[] activateOnDeath = eid.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (((Object)val).name == "RealTypeSaver")
				{
					RealTypeSaver component = val.GetComponent<RealTypeSaver>();
					component.realType = realType;
					break;
				}
			}
		}

		public void CheckMelee()
		{
			if (IsInDistance(meleeTriggerDistance) && IsInView() && !alreadyInMeleeZone)
			{
				alreadyInMeleeZone = true;
				((MonoBehaviour)this).StartCoroutine(MeleeFull());
			}
			else if (!IsInDistance(meleeZoneEndDistance))
			{
				alreadyInMeleeZone = false;
			}
		}

		public bool IsInDistance(float targetDistance)
		{
			//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)
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position);
			if (num > targetDistance || BlindEnemies.Blind || EnemyIgnorePlayer.Active)
			{
				return false;
			}
			return true;
		}

		public bool IsInView()
		{
			//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)
			//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			Vector3 val = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)this).transform.position;
			bool flag = Physics.Raycast(((Component)this).transform.position, val, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)));
			return !flag;
		}

		public void MeleePushingMove()
		{
			//IL_002b: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			float num = Time.fixedTime - pushStartTimepoint;
			float num2 = 0.5f * pushDuration;
			if (num < num2)
			{
				((Component)this).transform.position = Vector3.Lerp(originalPosition, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, num / num2);
			}
			else if (num >= num2)
			{
				if (!didMeleePushAction)
				{
					MeleePushAction();
					didMeleePushAction = true;
				}
				((Component)this).transform.position = Vector3.Lerp(((Component)MonoSingleton<NewMovement>.Instance).transform.position, originalPosition, (num - num2) / num2);
			}
		}

		public IEnumerator MeleeFull()
		{
			Unfire();
			state = FuchsiaState.MeleeStart;
			looker.speed = 0f;
			((Behaviour)looker).enabled = true;
			if (!unparriableAttack)
			{
				enemy.parryable = true;
			}
			checkingForParry = true;
			ParryFlash();
			yield return (object)new WaitForSeconds(prePushDelay);
			checkingForParry = false;
			enemy.parryable = false;
			((Collider)collider).enabled = false;
			bool startedMeleePush = MeleePushStart();
			bool parriedThis = parried;
			parried = false;
			if (startedMeleePush)
			{
				((Component)this).transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
				yield return (object)new WaitForSeconds(pushDuration);
				((Collider)collider).enabled = true;
				looker.speed = 40f;
				yield return (object)new WaitForSeconds(preMeleeFireDelay);
				didMeleePushAction = false;
				MeleeFire();
				yield return (object)new WaitForSeconds(meleeFireDuration);
				MeleeUnfire();
				((Behaviour)looker).enabled = false;
				((Component)this).transform.rotation = originalRotation;
				yield return (object)new WaitForSeconds(postMeleeFireDelay);
			}
			else
			{
				yield return (object)new WaitForSeconds(didntDoMeleeTime);
				((Collider)collider).enabled = true;
				didMeleePushAction = false;
				((Behaviour)looker).enabled = false;
				((Component)this).transform.rotation = originalRotation;
			}
			unparriableAttack = parriedThis && eid.difficulty >= 2 && !unparriableAttack;
			RotateLasers();
			Fire();
		}

		public void ParryFlash()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			Transform transform = Object.Instantiate<GameObject>((!unparriableAttack) ? MonoSingleton<DefaultReferenceManager>.Instance.parryableFlash : MonoSingleton<DefaultReferenceManager>.Instance.unparryableFlash, lasersTransform.position, lasersTransform.rotation, lasersTransform).transform;
			transform.localScale *= 12.5f;
			transform.localPosition += 0.3f * Vector3.forward;
		}

		public bool MeleePushStart()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if ((!parried && !IsInDistance(meleePushDistance)) || !IsInView())
			{
				return false;
			}
			pushStartTimepoint = Time.fixedTime;
			originalPosition = ((Component)this).transform.position;
			state = FuchsiaState.MeleePushing;
			return true;
		}

		public void MeleePushAction()
		{
			//IL_000d: 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)
			Rigidbody val = MonoSingleton<NewMovement>.Instance.Rigidbody;
			val.velocity = Vector3.zero;
			if (CanPushUp && !CanPushDown)
			{
				MeleePushDirection();
			}
			else if (CanPushDown && !CanPushUp)
			{
				MeleePushDirection(up: false);
			}
			else if (CanPushUp && CanPushDown)
			{
				if (((Component)val).transform.position.y + 1.5f >= originalPosition.y)
				{
					MeleePushDirection();
				}
				else
				{
					MeleePushDirection(up: false);
				}
			}
			else
			{
				MonoSingleton<NewMovement>.Instance.GetHurt(20, true, 1f, false, false, 0.35f, false);
			}
		}

		public void MeleePushDirection(bool up = true)
		{
			//IL_007c: 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)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (MonoSingleton<NewMovement>.Instance.gc.heavyFall)
			{
				MonoSingleton<NewMovement>.Instance.fallSpeed = 0f;
				MonoSingleton<NewMovement>.Instance.gc.heavyFall = false;
			}
			float num = (up ? pushForce : (0f - pushForce));
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, num, 0f);
			if (PushForceFollowsRotation)
			{
				val = originalRotation * val;
			}
			MonoSingleton<NewMovement>.Instance.Rigidbody.AddForce(val, (ForceMode)2);
		}

		public void MeleeFire()
		{
			//IL_0038: 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)
			Unfire();
			state = FuchsiaState.MeleeFiring;
			meleeFireStartTimepoint = Time.fixedTime;
			rotatingLasers = false;
			lasersMelee[0].localRotation = Quaternion.Euler(22.5f, 0f, 0f);
			lasersMelee[1].localRotation = Quaternion.Euler(-22.5f, 0f, 0f);
			((Component)lasersMelee[0]).gameObject.SetActive(true);
			((Component)lasersMelee[1]).gameObject.SetActive(true);
			((Component)lasersMelee[0]).GetComponent<ContinuousBeam>().damage = 20f;
			((Component)lasersMelee[1]).GetComponent<ContinuousBeam>().damage = 20f;
			UpdateLaserEnvironmentMask();
		}

		public void MeleeUnfire()
		{
			((Component)lasersMelee[0]).GetComponent<ContinuousBeam>().damage = 0f;
			((Component)lasersMelee[1]).GetComponent<ContinuousBeam>().damage = 0f;
			((Component)lasersMelee[0]).gameObject.SetActive(false);
			((Component)lasersMelee[1]).gameObject.SetActive(false);
			rotatingLasers = true;
		}

		public void MeleeFireMoveLasers()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			float num = Time.fixedTime - meleeFireStartTimepoint;
			float num2 = 0.33f * meleeFireDuration;
			if (num < num2)
			{
				lasersMelee[0].rotation = Quaternion.Lerp(lasersMelee[0].rotation, ((Component)this).transform.rotation, num / num2);
				lasersMelee[1].rotation = Quaternion.Lerp(lasersMelee[1].rotation, ((Component)this).transform.rotation, num / num2);
			}
			else if (num >= num2)
			{
				lasersMelee[0].rotation = ((Component)this).transform.rotation;
				lasersMelee[1].rotation = ((Component)this).transform.rotation;
			}
			else if (num >= 2f * num2 && (((Component)lasersMelee[0]).gameObject.activeSelf || ((Component)lasersMelee[1]).gameObject.activeSelf))
			{
				Unfire();
			}
		}
	}
	public enum FuchsiaState
	{
		Nothing,
		Idle,
		Firing,
		MeleeStart,
		MeleePushing,
		MeleeFiring
	}
	public class HarpoonGunManager : MonoBehaviour
	{
		private static HarpoonGunManager s_instance = null;

		public static List<HarpoonGunSpawned> all = new List<HarpoonGunSpawned>();

		public static HarpoonGunSpawned current;

		public static bool tryingNextHarpoonGun = false;

		public static bool isSoloActive = true;

		public static float distanceWeight = 0.1f;

		public static float cooldownWeight = 2f;

		public static HarpoonGunManager Instance
		{
			get
			{
				return s_instance ?? CreateInstance();
			}
			private set
			{
				s_instance = value;
			}
		}

		public static HarpoonGunManager CreateInstance()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("HarpoonGunManager");
			s_instance = val.AddComponent<HarpoonGunManager>();
			return s_instance;
		}

		public void Update()
		{
			if ((Object)(object)current == (Object)null || !current.CanSeePlayer() || tryingNextHarpoonGun)
			{
				FindNewCurrent();
			}
		}

		public static void FindNewCurrent()
		{
			HarpoonGunSpawned[] array = all.Where((HarpoonGunSpawned harpoonGun) => (Object)(object)harpoonGun != (Object)(object)current && harpoonGun.CanSeePlayer()).ToArray();
			HarpoonGunSpawned harpoonGunSpawned = null;
			if (array.Length == 1)
			{
				harpoonGunSpawned = array[0];
			}
			else if (array.Length >= 2)
			{
				harpoonGunSpawned = array.OrderBy(delegate(HarpoonGunSpawned harpoonGun)
				{
					float num = distanceWeight * harpoonGun.GetDistanceToPlayer();
					float num2 = cooldownWeight * (harpoonGun.cooldown + harpoonGun.dummyCooldownForTargeting);
					return num - num2;
				}).First();
			}
			if (!tryingNextHarpoonGun || !((Object)(object)harpoonGunSpawned == (Object)null))
			{
				current = harpoonGunSpawned;
				if (harpoonGunSpawned != null)
				{
					harpoonGunSpawned.cooldown -= 0.1f;
				}
			}
			tryingNextHarpoonGun = false;
		}

		public static HarpoonGunSpawned GetPlayerHit()
		{
			foreach (HarpoonGunSpawned item in all)
			{
				if ((Object)(object)item.spear != (Object)null && item.spear.hitPlayer)
				{
					return item;
				}
			}
			return null;
		}

		public static void UpdateIsSoloActive()
		{
			bool flag = all.Count((HarpoonGunSpawned harpoonGun) => ((Component)harpoonGun).gameObject.activeInHierarchy) <= 1;
			if (flag == isSoloActive)
			{
				return;
			}
			isSoloActive = flag;
			foreach (HarpoonGunSpawned item in all)
			{
				if (isSoloActive)
				{
					item.cooldown /= item.cooldownMaxNotSoloMult;
				}
				else
				{
					item.cooldown *= item.cooldownMaxNotSoloMult;
				}
			}
		}
	}
	public class HarpoonGunSpawned : MonoBehaviour
	{
		public MassSpear spear;

		public float cooldownMaxSolo = 3f;

		public float cooldownMaxNotSoloMult = 1.5f;

		public float cooldown = 0f;

		public float dummyCooldownForTargeting = 0f;

		public static float dummyCooldownDeltaMultiplier = 0.2f;

		public GameObject currentFlash;

		public bool didFlash = false;

		public float flashPreAttackTime = 0.75f;

		public float previousHealth;

		public bool switchingToNext = false;

		public float switchToNextCooldown = 0f;

		public float switchToNextCooldownMax = 0.25f;

		public Transform modelParent;

		public Transform turret;

		public Transform harpoonOrigin;

		public bool finishedSetup = false;

		public bool difficultyStarted = false;

		public float difficultySpeedModifier = 1f;

		public EnemyIdentifier eid;

		public Rigidbody rigidbody;

		public Drone drone;

		public DroneFlesh droneFlesh;

		public AlwaysLookAtCamera looker;

		public float CooldownMax => HarpoonGunManager.isSoloActive ? cooldownMaxSolo : (cooldownMaxSolo * cooldownMaxNotSoloMult);

		public void Awake()
		{
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			eid.weaknesses = Array.Empty<string>();
			eid.weaknessMultipliers = Array.Empty<float>();
			eid.flying = false;
			rigidbody = ((Component)this).GetComponent<Rigidbody>();
			if (!finishedSetup)
			{
				RemoveParts();
				AddModel();
				finishedSetup = true;
			}
			else
			{
				ModelProcessParts();
			}
			if ((Object)(object)HarpoonGunManager.Instance == (Object)null)
			{
				HarpoonGunManager.CreateInstance();
			}
		}

		public void RemoveParts()
		{
			drone = ((Component)this).GetComponent<Drone>();
			droneFlesh = ((Component)this).GetComponent<DroneFlesh>();
			((Behaviour)drone).enabled = false;
			((Behaviour)droneFlesh).enabled = false;
			((Behaviour)((Component)this).GetComponent<KeepInBounds>()).enabled = false;
			((Component)((Component)this).transform.Find("Audio Source")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("Particle System")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("Particle System (1)")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("AlwaysLookAtCamera")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("Gib_Eyeball")).gameObject.SetActive(false);
		}

		public void AddModel()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_005a: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			modelParent = new GameObject("ModelParent").transform;
			modelParent.SetParent(((Component)this).transform);
			modelParent.localRotation = Quaternion.identity;
			modelParent.localPosition = Vector3.zero;
			modelParent.localScale = 0.4f * Vector3.one;
			turret = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["Turret"], ((Component)this).transform.position, ((Component)this).transform.rotation).transform;
			turret.SetParent(modelParent);
			((Component)turret).tag = "Untagged";
			((Component)turret).gameObject.layer = LayerMask.NameToLayer("Default");
			turret.localScale = Vector3.one;
			turret.localPosition = Vector3.zero;
			turret.localRotation = Quaternion.identity;
			Transform val = turret.Find("Light");
			looker = ((Component)val).GetComponent<AlwaysLookAtCamera>();
			looker.easeIn = true;
			looker.speed = 5f;
			looker.dontRotateIfBlind = true;
			val.GetChild(0).localRotation = Quaternion.Euler(90f, 0f, 0f);
			GameObject gameObject = ((Component)turret.Find("Tracker")).gameObject;
			gameObject.SetActive(false);
			Object.Destroy((Object)(object)gameObject);
			Transform val2 = turret.Find("Stand");
			val2.localScale = new Vector3(1f, 3f, 1f);
			val2.localPosition = new Vector3(0f, -4f, 0f);
			Transform val3 = turret.Find("Light/Cylinder");
			((Component)val3.Find("CycleOff")).gameObject.SetActive(false);
			((Component)val3.Find("CycleOn")).gameObject.SetActive(false);
			((Component)val3.Find("Particle System")).gameObject.SetActive(false);
			Light componentInChildren = ((Component)val3).GetComponentInChildren<Light>();
			componentInChildren.intensity = 5f;
			componentInChildren.range = 100f;
			harpoonOrigin = new GameObject("Harpoon Origin").transform;
			((Component)harpoonOrigin).gameObject.SetActive(false);
			harpoonOrigin.SetParent(val3);
			harpoonOrigin.localPosition = new Vector3(0f, 7f, -1f);
			harpoonOrigin.localScale = Vector3.one;
			ModelProcessParts();
		}

		public void ModelProcessParts()
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.layer = LayerMask.NameToLayer("EnemyTrigger");
			((Component)this).gameObject.AddComponent<EnemyIdentifierIdentifier>();
			OutdoorsDelayed componentInParent = ((Component)turret).GetComponentInParent<OutdoorsDelayed>(true);
			Renderer[] componentsInChildren = ((Component)turret).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				if (!(((Object)val).name == "Capsule"))
				{
					((Component)val).tag = "Body";
					if ((Object)(object)componentInParent == (Object)null)
					{
						((Component)val).gameObject.layer = LayerMask.NameToLayer("Limb");
					}
					else
					{
						((Component)val).gameObject.layer = componentInParent.layer;
					}
					for (int j = 0; j < val.materials.Length; j++)
					{
						val.materials[j] = Object.Instantiate<Material>(val.materials[j]);
						val.materials[j].EnableKeyword("ENEMY");
						val.materials[j].SetFloat("ENEMY", 1f);
						val.materials[j].DisableKeyword("VERTEX_LIGHTING");
						val.materials[j].SetFloat("VERTEX_LIGHTING", 0f);
					}
					ComponentExtensions.GetOrAddComponent<EnemySimplifier>((Component)(object)val);
				}
			}
			Collider[] componentsInChildren2 = ((Component)turret).GetComponentsInChildren<Collider>(true);
			foreach (Collider val2 in componentsInChildren2)
			{
				Object.Destroy((Object)(object)val2);
			}
			BoxCollider component = ((Component)((Component)this).transform).GetComponent<BoxCollider>();
			component.size = 1.6f * Vector3.one;
			Transform val3 = ((Component)this).transform.Find("Sphere");
			SphereCollider component2 = ((Component)val3).GetComponent<SphereCollider>();
			component2.radius = 0.8f;
			Transform transform = new GameObject("SubSphereFollowTarget").transform;
			transform.SetParent(harpoonOrigin.parent);
			transform.localPosition = new Vector3(0f, 6f, 0f);
			Transform child = val3.GetChild(0);
			child.localScale = Vector3.one;
			SphereCollider component3 = ((Component)child).GetComponent<SphereCollider>();
			component3.radius = 0.5f;
			Follow orAddComponent = ComponentExtensions.GetOrAddComponent<Follow>((Component)(object)child);
			orAddComponent.followingPlayer = false;
			orAddComponent.target = transform;
			orAddComponent.mimicRotation = true;
		}

		public void Start()
		{
			drone.difficulty = Enemy.InitializeDifficulty(eid);
			drone.bsm = MonoSingleton<BloodsplatterManager>.Instance;
			drone.gz = GoreZone.ResolveGoreZone(((Component)this).transform);
			drone.kib = ((Component)this).GetComponent<KeepInBounds>();
			rigidbody.isKinematic = true;
			HarpoonGunManager.all.Add(this);
			HarpoonGunManager.UpdateIsSoloActive();
			StartDifficulty();
		}

		public void OnDestroy()
		{
			HarpoonGunManager.all.Remove(this);
			HarpoonGunManager.UpdateIsSoloActive();
		}

		public void StartDifficulty()
		{
			if (!difficultyStarted)
			{
				difficultyStarted = true;
				difficultySpeedModifier = GetDifficultyModifier(eid.difficulty);
				cooldownMaxSolo /= 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 float GetEidSpeedModifier()
		{
			float num = 1f;
			float num2 = Mathf.Max(OptionsManager.radianceTier, eid.radianceTier);
			if (eid.speedBuff || OptionsManager.forceRadiance)
			{
				num *= eid.speedBuffModifier * ((num2 > 1f) ? (0.75f + num2 / 4f) : num2);
			}
			if (eid.puppet)
			{
				num *= 0.75f;
			}
			return num;
		}

		public void FixedUpdate()
		{
			if ((Object)(object)spear != (Object)null && spear.deflected)
			{
				Object.Destroy((Object)(object)((Component)spear).gameObject);
				spear = null;
			}
			if (previousHealth > eid.health && (Object)(object)spear != (Object)null)
			{
				MassSpear obj = spear;
				obj.spearHealth -= Mathf.Abs(previousHealth - eid.health);
			}
			previousHealth = eid.health;
		}

		public void Update()
		{
			bool flag = (Object)(object)HarpoonGunManager.GetPlayerHit() != (Object)null;
			float num = Time.deltaTime * GetEidSpeedModifier();
			dummyCooldownForTargeting += dummyCooldownDeltaMultiplier * num;
			if (!flag)
			{
				cooldown += num;
			}
			else
			{
				cooldown = 0.5f * CooldownMax;
				didFlash = false;
			}
			if ((Object)(object)eid == (Object)null || eid.health <= 0f)
			{
				if ((Object)(object)spear != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)spear).gameObject);
				}
				spear = null;
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				UpdateAttacking();
				UpdateSwitchingToNext();
				((Behaviour)drone).enabled = false;
				((Behaviour)droneFlesh).enabled = false;
			}
		}

		public void UpdateAttacking()
		{
			float num = flashPreAttackTime / difficultySpeedModifier / GetEidSpeedModifier();
			if ((Object)(object)HarpoonGunManager.current != (Object)(object)this)
			{
				cooldown = Mathf.Min(cooldown, CooldownMax - num);
				didFlash = false;
				return;
			}
			bool flag = !BlindEnemies.Blind && !EnemyIgnorePlayer.Active;
			if (!didFlash && cooldown >= CooldownMax - num && flag)
			{
				Flash();
				MakeSound();
			}
			if (cooldown >= CooldownMax && didFlash && flag)
			{
				didFlash = false;
				cooldown = 0f;
				dummyCooldownForTargeting = 0f;
				Shoot();
			}
		}

		public void UpdateSwitchingToNext()
		{
			if (!switchingToNext)
			{
				switchToNextCooldown = 0f;
				return;
			}
			switchToNextCooldown += Time.deltaTime;
			if (((Object)(object)spear != (Object)null && spear.beenStopped) || switchToNextCooldown >= switchToNextCooldownMax)
			{
				HarpoonGunManager.tryingNextHarpoonGun = true;
				switchingToNext = false;
			}
		}

		public void Flash()
		{
			//IL_0011: 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_0028: 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_007c: 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_008c: 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)
			//IL_0094: 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_00a5: 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)
			Transform transform = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.parryableFlash, ((Component)this).transform.position, Quaternion.identity).transform;
			transform.localScale *= 25f;
			transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
			((Component)transform).GetComponent<AudioSource>().volume = 0.65f;
			didFlash = true;
			currentFlash = ((Component)transform).gameObject;
			Vector3 val = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)this).transform.position;
			transform.localPosition += 3f * ((Vector3)(ref val)).normalized;
		}

		public void MakeSound()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["HarpoonSound"], ((Component)this).transform.position, ((Component)this).transform.rotation);
			AudioSource component = val.GetComponent<AudioSource>();
			component.volume = 1f;
		}

		public void Shoot()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0091: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["Harpoon"], harpoonOrigin.position, ((Component)looker).transform.rotation);
			val.transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
			switchingToNext = true;
			spear = val.GetComponent<MassSpear>();
			if (!((Object)(object)spear == (Object)null))
			{
				spear.target = EnemyTarget.TrackPlayer();
				spear.targetHandle = new TargetHandle((ITarget)(object)MonoSingleton<NewMovement>.Instance);
				spear.originPoint = harpoonOrigin;
				spear.damageMultiplier = eid.totalDamageModifier;
				spear.difficulty = eid.difficulty;
			}
		}

		public bool CanSeePlayer()
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0022: 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_0026: 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)
			Vector3 position = harpoonOrigin.position;
			Vector3 val = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - position;
			bool flag = Physics.Raycast(position, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)));
			if (flag && (Object)(object)currentFlash != (Object)null)
			{
				Object.Destroy((Object)(object)currentFlash);
				currentFlash = null;
			}
			return !flag;
		}

		public float GetDistanceToPlayer()
		{
			//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)
			return Vector3.Distance(((Component)this).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position);
		}
	}
	public class EnragerTarget : MonoBehaviour
	{
		public int number = 0;
	}
	public class IdolStart : MonoBehaviour
	{
		public Idol idol;

		public EnemyIdentifier targetOnAwake;

		public bool configValuesSet = false;

		public void Start()
		{
			idol = ((Component)this).GetComponent<Idol>();
			if (((Object)this).name.Contains("Enrager"))
			{
				StartEnrager();
			}
			else if (((Object)this).name.Contains("Lumen"))
			{
				StartLumen();
			}
			else if (((Object)this).name.Contains("Puppeteer"))
			{
				StartPuppeteer();
			}
			else if (((Object)this).name.Contains("Sander"))
			{
				StartSander();
			}