Decompiled source of SpawnerArmExtras v6.0.3

SpawnerArmExtras.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Configgy;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Sandbox;
using ULTRAKILL.Cheats;
using ULTRAKILL.Enemy;
using ULTRAKILL.Portal;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.ProBuilder;
using UnityEngine.SceneManagement;
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("6.0.3.0")]
[assembly: AssemblyInformationalVersion("6.0.3+c7dd3ee3b1c00c36027615cfa1102f97786d5efc")]
[assembly: AssemblyProduct("SpawnerArmExtras")]
[assembly: AssemblyTitle("SpawnerArmExtras")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("6.0.3.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 BlackHoleFromMortar : MonoBehaviour
	{
		public EnemyIdentifier source = null;

		public void Update()
		{
			if ((Object)(object)source == (Object)null)
			{
				((Component)this).GetComponent<BlackHoleProjectile>().Explode();
			}
		}
	}
	[HarmonyPatch(typeof(BlackHoleProjectile), "Explode")]
	public class BlackHoleFromMortarPatch
	{
		public static void Prefix(BlackHoleProjectile __instance)
		{
			BlackHoleFromMortar component = ((Component)__instance).GetComponent<BlackHoleFromMortar>();
			if (!((Object)(object)component == (Object)null) && !((Object)(object)component.source == (Object)null))
			{
				MortarLauncher component2 = ((Component)component.source).GetComponent<MortarLauncher>();
				if (component2 != null)
				{
					component2.cooldown = 2f;
				}
			}
		}
	}
	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_0049: 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_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_0061: 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)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			if (eid.dead)
			{
				Object.Destroy((Object)(object)this);
			}
			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 FuchsiaSetValues : MonoBehaviour
	{
		public float cycleOffsetTime = 0f;

		public float lasersRotation = 0f;

		public bool pushForceFollowsRotation = false;
	}
	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 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 float meleeTriggerDistance = 16f;

		public bool alreadyInMeleeZone = false;

		public float meleeZoneEndDistance = 16f;

		public float meleePushDistance = 18f;

		public bool pushForceFollowsRotation = false;

		public const float pushForceDefault = 65f;

		public float pushForce = 65f;

		public const float prePushDelayDefault = 0.5f;

		public const float pushDurationDefault = 0.3f;

		public const float preMeleeFireDelayDefault = 0.35f;

		public const float meleeFireDurationDefault = 0.25f;

		public const float postMeleeFireDelayDefault = 0.2f;

		public const float didntDoMeleeTimeDefault = 0.2f;

		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 RealEnemyTypeSaver realEnemyTypeSaver;

		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 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>();
			realEnemyTypeSaver = ((Component)this).GetComponent<RealEnemyTypeSaver>();
			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(newValue: 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;
			}
		}

		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)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if (!((Object)(object)tr == (Object)null))
			{
				MeshRenderer component = ((Component)tr).GetComponent<MeshRenderer>();
				Material val = Object.Instantiate<Material>(((Renderer)component).material);
				val.mainTexture = (Texture)(object)texture;
				((Renderer)component).material = val;
				MaterialPropertyBlock val2 = new MaterialPropertyBlock();
				((Renderer)component).GetPropertyBlock(val2);
				val2.SetTexture("_MainTex", (Texture)(object)texture);
				((Renderer)component).SetPropertyBlock(val2);
				val.EnableKeyword("ENEMY");
			}
		}

		public void RetextureSkinnedMeshRenderer(Transform tr, Texture2D texture)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if (!((Object)(object)tr == (Object)null))
			{
				SkinnedMeshRenderer component = ((Component)tr).GetComponent<SkinnedMeshRenderer>();
				Material val = Object.Instantiate<Material>(((Renderer)component).material);
				val.mainTexture = (Texture)(object)texture;
				((Renderer)component).material = val;
				MaterialPropertyBlock val2 = new MaterialPropertyBlock();
				((Renderer)component).GetPropertyBlock(val2);
				val2.SetTexture("_MainTex", (Texture)(object)texture);
				((Renderer)component).SetPropertyBlock(val2);
			}
		}

		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;
			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();
			((MonoBehaviour)this).StartCoroutine(StartFiring());
		}

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

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

		public void StartDifficulty()
		{
			int difficulty = eid.difficulty;
			if (1 == 0)
			{
			}
			float num = difficulty switch
			{
				4 => 1f, 
				3 => 0.8f, 
				2 => 0.65f, 
				1 => 0.45f, 
				0 => 0.3f, 
				_ => 1.15f, 
			};
			if (1 == 0)
			{
			}
			difficultySpeedModifier = num;
			prePushDelay = 0.5f / difficultySpeedModifier;
			pushDuration = 0.3f / difficultySpeedModifier;
			preMeleeFireDelay = 0.35f / difficultySpeedModifier;
			meleeFireDuration = 0.25f / difficultySpeedModifier;
			postMeleeFireDelay = 0.2f / difficultySpeedModifier;
			didntDoMeleeTime = 0.2f / difficultySpeedModifier;
		}

		public void Update()
		{
			if ((Object)(object)eid == (Object)null || eid.health <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (eid.hooked)
			{
				MonoSingleton<HookArm>.Instance.StopThrow(1f, true);
			}
			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) * GetTotalSpeedModifier() % (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 GetTotalSpeedModifier()
		{
			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(newValue: false);
			}
			state = FuchsiaState.Firing;
			((Component)lasers[0]).gameObject.SetActive(true);
			((Component)lasers[1]).gameObject.SetActive(true);
		}

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

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

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

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

		public void UpdateRealEnemyType()
		{
			RealEnemyType type = RealEnemyType.FuchsiaPushUpPushDown;
			if (CanPushUp && !CanPushDown)
			{
				type = RealEnemyType.FuchsiaPushUp;
			}
			else if (!CanPushUp && CanPushDown)
			{
				type = RealEnemyType.FuchsiaPushDown;
			}
			else if (!CanPushUp && !CanPushDown)
			{
				type = RealEnemyType.Fuchsia;
			}
			realEnemyTypeSaver.type = type;
			GameObject[] activateOnDeath = eid.activateOnDeath;
			foreach (GameObject val in activateOnDeath)
			{
				if (((Object)val).name == "RealEnemyTypeSaver")
				{
					RealEnemyTypeSaver component = val.GetComponent<RealEnemyTypeSaver>();
					component.type = type;
					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 >= 4 && !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);
		}

		public void MeleeUnfire()
		{
			((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 IdolStart : MonoBehaviour
	{
		public Idol idol;

		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();
			}
			PostStart();
		}

		public void PostStart()
		{
			RealEnemyTypeSaver component = ((Component)this).GetComponent<RealEnemyTypeSaver>();
			RealEnemyType realEnemyType;
			if ((Object)(object)component != (Object)null)
			{
				realEnemyType = component.type;
			}
			else
			{
				Transform val = Util.FindParentWithNameContaining("Spawned", ((Component)this).transform);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				realEnemyType = IdollikePatch.GetIdolType(((Object)val).name);
			}
			if (!RealEnemyTypeSaver.IdollikeTypes.Contains(realEnemyType))
			{
				return;
			}
			Transform val2 = ((Component)this).transform.Find("SpawnEffect Idol");
			if ((Object)(object)val2 != (Object)null)
			{
				SpawnEffectPitch orAddComponent = ComponentExtensions.GetOrAddComponent<SpawnEffectPitch>((Component)(object)val2);
				SpawnEffectPitch spawnEffectPitch = orAddComponent;
				if (1 == 0)
				{
				}
				float pitchMultiplier = realEnemyType switch
				{
					RealEnemyType.Enrager => 1.2f, 
					RealEnemyType.Lumen => 1.2f, 
					RealEnemyType.Puppeteer => 0.8f, 
					RealEnemyType.Sander => 0.8f, 
					_ => 1f, 
				};
				if (1 == 0)
				{
				}
				spawnEffectPitch.pitchMultiplier = pitchMultiplier;
			}
		}

		public void StartEnrager()
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Util.FindParentWithNameContaining("EnragerSpawned", ((Component)idol).transform);
			if (!((Object)(object)val == (Object)null))
			{
				if (idol.eid.overrideFullName == "IDOL")
				{
					idol.eid.overrideFullName = "ENRAGER";
				}
				Util.UpdateEnemyHealthbar(idol.eid);
				ComponentExtensions.GetOrAddComponent<RealEnemyTypeSaver>((Component)(object)idol).type = RealEnemyType.Enrager;
				ComponentExtensions.GetOrAddComponent<PuppetName>((Component)(object)idol).puppetName = ((Object)idol).name;
				((Component)idol.halo).gameObject.SetActive(false);
				EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren<EnemySimplifier>();
				GameObject val2 = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.enrageEffect, ((Component)componentInChildren).transform.parent);
				val2.transform.localPosition = new Vector3(0f, 0.5f, 0f);
				val2.transform.localScale = 0.667f * Vector3.one;
				MeshRenderer component = ((Component)componentInChildren).GetComponent<MeshRenderer>();
				((Renderer)component).material.color = new Color(1f, 0.35f, 0f);
				idol.beam.endColor = new Color(1f, 0.75f, 0f);
				idol.beam.startColor = Color.red;
				DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren<DistantSprite>();
				((Component)componentInChildren2).GetComponent<SpriteRenderer>().color = new Color(0.6557f, 0f, 0f, 0.502f);
				Transform child = ((Component)componentInChildren2).transform.GetChild(0);
				((Component)child).GetComponent<SpriteRenderer>().color = new Color(1f, 0.2f, 0f, 0.749f);
			}
		}

		public void StartLumen()
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Util.FindParentWithNameContaining("LumenSpawned", ((Component)idol).transform);
			if (!((Object)(object)val == (Object)null))
			{
				if (idol.eid.overrideFullName == "IDOL")
				{
					idol.eid.overrideFullName = "LUMEN";
				}
				Util.UpdateEnemyHealthbar(idol.eid);
				ComponentExtensions.GetOrAddComponent<RealEnemyTypeSaver>((Component)(object)idol).type = RealEnemyType.Lumen;
				ComponentExtensions.GetOrAddComponent<PuppetName>((Component)(object)idol).puppetName = ((Object)idol).name;
				Collider component = ((Component)idol).GetComponent<Collider>();
				Vector3 val2;
				if (!Object.op_Implicit((Object)(object)component))
				{
					val2 = ((Component)idol).transform.position;
				}
				else
				{
					Bounds bounds = component.bounds;
					val2 = ((Bounds)(ref bounds)).center;
				}
				Vector3 val3 = val2;
				Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.radianceEffect, val3, Quaternion.identity);
				((Renderer)idol.beam).material = idol.radiantBeam;
				idol.halo.sprite = idol.radiantHalo;
				idol.halo.color = Color.white;
				EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren<EnemySimplifier>();
				MeshRenderer component2 = ((Component)componentInChildren).GetComponent<MeshRenderer>();
				((Renderer)component2).material.color = new Color(0.6f, 0.5f, 1.5f);
				idol.beam.endColor = new Color(0.6f, 0.6f, 1f);
				idol.beam.startColor = new Color(0.6f, 0.6f, 1f);
				DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren<DistantSprite>();
				((Component)componentInChildren2).GetComponent<SpriteRenderer>().color = new Color(0.7f, 0.5f, 1f, 0.502f);
				Transform child = ((Component)componentInChildren2).transform.GetChild(0);
				((Component)child).GetComponent<SpriteRenderer>().color = new Color(0.4f, 0.3f, 1f, 0.749f);
			}
		}

		public void StartPuppeteer()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Util.FindParentWithNameContaining("PuppeteerSpawned", ((Component)idol).transform);
			if (!((Object)(object)val == (Object)null))
			{
				if (idol.eid.overrideFullName == "IDOL")
				{
					idol.eid.overrideFullName = "PUPPETEER";
				}
				Util.UpdateEnemyHealthbar(idol.eid);
				ComponentExtensions.GetOrAddComponent<RealEnemyTypeSaver>((Component)(object)idol).type = RealEnemyType.Puppeteer;
				ComponentExtensions.GetOrAddComponent<PuppetName>((Component)(object)idol).puppetName = ((Object)idol).name;
				ComponentExtensions.GetOrAddComponent<PuppeteerSpawned>((Component)(object)idol);
				EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren<EnemySimplifier>();
				MeshRenderer component = ((Component)componentInChildren).GetComponent<MeshRenderer>();
				((Renderer)component).material.color = new Color(1f, 0f, 0.35f);
				idol.beam.endColor = new Color(1f, 0f, 0.35f);
				idol.beam.startColor = new Color(1f, 0f, 0.6f);
				idol.halo.color = new Color(1f, 0.65f, 0.85f);
				idol.haloColor = new Color(1f, 0.65f, 0.85f);
				DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren<DistantSprite>();
				((Component)componentInChildren2).GetComponent<SpriteRenderer>().color = new Color(0.8f, 0f, 0.6f, 0.502f);
				Transform child = ((Component)componentInChildren2).transform.GetChild(0);
				((Component)child).GetComponent<SpriteRenderer>().color = new Color(1f, 0f, 0.3f, 0.749f);
			}
		}

		public void StartSander()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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)
			Transform val = Util.FindParentWithNameContaining("SanderSpawned", ((Component)idol).transform);
			if (!((Object)(object)val == (Object)null))
			{
				if (idol.eid.overrideFullName == "IDOL")
				{
					idol.eid.overrideFullName = "SANDER";
				}
				Util.UpdateEnemyHealthbar(idol.eid);
				ComponentExtensions.GetOrAddComponent<RealEnemyTypeSaver>((Component)(object)idol).type = RealEnemyType.Sander;
				ComponentExtensions.GetOrAddComponent<PuppetName>((Component)(object)idol).puppetName = ((Object)idol).name;
				EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren<EnemySimplifier>();
				MeshRenderer component = ((Component)componentInChildren).GetComponent<MeshRenderer>();
				((Renderer)component).material.color = new Color(1f, 0.9f, 0.55f);
				idol.beam.endColor = new Color(1f, 0.9f, 0.55f);
				idol.beam.startColor = new Color(1f, 0.9f, 0.55f);
				idol.halo.color = new Color(1f, 0.9f, 0.55f);
				idol.haloColor = new Color(1f, 0.9f, 0.55f);
				DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren<DistantSprite>();
				((Component)componentInChildren2).GetComponent<SpriteRenderer>().color = new Color(1f, 0.9f, 0.55f, 0.502f);
				Transform child = ((Component)componentInChildren2).transform.GetChild(0);
				((Component)child).GetComponent<SpriteRenderer>().color = new Color(1f, 0.9f, 0.55f, 0.749f);
				SandifySelf();
			}
		}

		private void SandifySelf()
		{
			//IL_0052: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			EnemyIdentifier eid = idol.eid;
			if (eid.puppet)
			{
				eid.InstaKill();
				return;
			}
			EnemyIdentifierIdentifier[] componentsInChildren = ((Component)eid).GetComponentsInChildren<EnemyIdentifierIdentifier>();
			EnemyIdentifierIdentifier[] array = componentsInChildren;
			Bounds bounds;
			foreach (EnemyIdentifierIdentifier val in array)
			{
				GameObject val2 = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.sandDrip, ((Component)val).transform.position, ((Component)val).transform.rotation);
				Collider component = ((Component)val).GetComponent<Collider>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Transform transform = val2.transform;
					bounds = component.bounds;
					transform.localScale = ((Bounds)(ref bounds)).size;
				}
				val2.transform.SetParent(((Component)val).transform, true);
			}
			Collider component2 = ((Component)eid).GetComponent<Collider>();
			Vector3 val3;
			if (Object.op_Implicit((Object)(object)component2))
			{
				bounds = component2.bounds;
				val3 = ((Bounds)(ref bounds)).center;
			}
			else
			{
				val3 = ((Component)idol).transform.position;
			}
			Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.sandificationEffect, val3, Quaternion.identity);
		}
	}
	public class FromOneTimeParry : MonoBehaviour
	{
		public OneTimeParry source;

		public Enemy enemy;

		public void Awake()
		{
			source = null;
		}

		public void Update()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)source != (Object)null)
			{
				((Component)this).transform.position = ((Component)source).transform.position;
			}
			if ((Object)(object)enemy == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class OneTimeParry : MonoBehaviour
	{
		public Landmine mine;

		public GameObject deactivateOnParry;

		public Enemy enemy;

		public float subtractHealth;

		public void Start()
		{
			//IL_0017: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			mine = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["Landmine"], ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent<Landmine>();
			((Component)mine).transform.localScale = Vector3.one;
			FromOneTimeParry fromOneTimeParry = ((Component)mine).gameObject.AddComponent<FromOneTimeParry>();
			fromOneTimeParry.source = this;
			fromOneTimeParry.enemy = enemy;
			Rigidbody component = ((Component)mine).gameObject.GetComponent<Rigidbody>();
			component.isKinematic = true;
			mine.activated = true;
			AudioSource component2 = ((Component)mine).gameObject.GetComponent<AudioSource>();
			component2.volume = 0f;
			mine.activatedBeep = null;
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshCollider>());
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<ProBuilderMesh>());
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshRenderer>());
			Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshFilter>());
			Object.Destroy((Object)(object)((Component)((Component)mine).transform.Find("LightCylinder")).gameObject);
			((Component)((Component)mine).transform.Find("ParryZone")).gameObject.SetActive(true);
			Transform val = ((Component)mine).transform.Find("ParryZone/V2Flash");
			((Component)val).gameObject.AddComponent<AlwaysLookAtCamera>();
			val.position = ((Component)mine).transform.position;
			val.localScale *= 3f;
		}

		public void Update()
		{
			if (mine.parried)
			{
				((MonoBehaviour)this).StartCoroutine(GotParried());
			}
		}

		public IEnumerator GotParried()
		{
			yield return (object)new WaitForSeconds(0.1f);
			Object.Destroy((Object)(object)((Component)mine).gameObject);
			deactivateOnParry.SetActive(false);
			Enemy obj = enemy;
			if (obj != null)
			{
				obj.health -= subtractHealth;
			}
			Enemy obj2 = enemy;
			if (obj2 != null)
			{
				EnemyIdentifier eid = obj2.eid;
				if (eid != null)
				{
					eid.health -= subtractHealth;
				}
			}
			Enemy obj3 = enemy;
			if (obj3 != null && obj3.health <= 0f)
			{
				Enemy obj4 = enemy;
				if (obj4 != null)
				{
					EnemyIdentifier eid2 = obj4.eid;
					if (eid2 != null)
					{
						eid2.SimpleDamage(0f);
					}
				}
			}
			Object.Destroy((Object)(object)this);
		}
	}
	public class PermanentRage : MonoBehaviour
	{
	}
	public class PuppeteerSetValues : MonoBehaviour
	{
		public bool killPuppetsOnDeath = true;

		public float cooldownMultiplier = 1f;
	}
	public class PuppeteerSpawned : MonoBehaviour
	{
		public bool KillPuppetsOnDeath = true;

		public float CooldownMultiplier = 1f;

		public Idol idol;

		public float cooldown = 6f;

		public float cooldownMax = 6f;

		public List<CaughtEnemy> caughtEnemies = new List<CaughtEnemy>();

		public void Awake()
		{
			idol = ((Component)this).GetComponent<Idol>();
			int difficulty = idol.difficulty;
			if (1 == 0)
			{
			}
			float num = difficulty switch
			{
				4 => 6f, 
				3 => 8f, 
				2 => 9.5f, 
				1 => 11f, 
				0 => 13f, 
				_ => 6f, 
			};
			if (1 == 0)
			{
			}
			cooldownMax = num;
			CheckSetValues();
			cooldown = cooldownMax * CooldownMultiplier;
		}

		public void CheckSetValues()
		{
			PuppeteerSetValues component = ((Component)this).GetComponent<PuppeteerSetValues>();
			if (!((Object)(object)component == (Object)null))
			{
				KillPuppetsOnDeath = component.killPuppetsOnDeath;
				CooldownMultiplier = component.cooldownMultiplier;
			}
		}

		public void Update()
		{
			if ((Object)(object)idol == (Object)null || (Object)(object)idol.target == (Object)null)
			{
				cooldown = cooldownMax * CooldownMultiplier;
				return;
			}
			cooldown += Time.deltaTime;
			if (!(cooldown < cooldownMax * CooldownMultiplier))
			{
				cooldown = 0f;
				SpawnPuppet(idol.target);
			}
		}

		public void SpawnPuppet(EnemyIdentifier eid)
		{
			int num = AddCaughtEnemy(eid);
			if (num != -1)
			{
				InstantiatePuppetSpawnable(num);
			}
		}

		public int AddCaughtEnemy(EnemyIdentifier eid)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			if ((Object)(object)MonoSingleton<EnemyTracker>.Instance == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"EnemyTracker instance not found. Cannot track enemy death.");
			}
			else
			{
				if (MonoSingleton<EnemyTracker>.Instance.spawnedEnemies.TryGetValue(((Object)eid).GetInstanceID(), out var value))
				{
					CaughtEnemy val = new CaughtEnemy(eid, value);
					GameObject[] activateOnDeath = val.original.activateOnDeath;
					foreach (GameObject val2 in activateOnDeath)
					{
						if (((Object)val2).name == "RealEnemyTypeSaver")
						{
							RealEnemyType type = val2.GetComponent<RealEnemyTypeSaver>().type;
							if (EnemyAssets.SpawnableObjects.ContainsKey(type) && (Object)(object)EnemyAssets.SpawnableObjects[type] != (Object)null)
							{
								((SavedGeneric)val.savedEnemy).Spawnable = EnemyAssets.SpawnableObjects[type];
							}
						}
					}
					caughtEnemies.Add(val);
					return caughtEnemies.IndexOf(val);
				}
				Plugin.Logger.LogWarning((object)("Enemy " + ((Object)eid).name + " not found in spawned enemies. Cannot track death."));
			}
			return -1;
		}

		public void InstantiatePuppetSpawnable(int puppetIndex)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			//IL_0093: 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)
			SavedEnemy savedEnemy = caughtEnemies[puppetIndex].savedEnemy;
			SpawnableInstance val = SpawnableObjectExtensions.InstantiateSpawnable(((SavedGeneric)savedEnemy).Spawnable, (SavedGeneric)(object)savedEnemy, ((Component)this).transform.parent, true);
			((Component)val).transform.position = caughtEnemies[puppetIndex].position;
			((Component)val).transform.rotation = caughtEnemies[puppetIndex].rotation;
			val.ApplyAlterOptions((IEnumerable<AlterOption>)(object)new AlterOption[1]
			{
				new AlterOption
				{
					targetKey = "puppeted",
					useBool = true,
					boolValue = true
				}
			});
			if (idol.eid.healthBuff || idol.eid.speedBuff || idol.eid.damageBuff)
			{
				EnemyIdentifier componentInChildren = ((Component)val).GetComponentInChildren<EnemyIdentifier>(true);
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.radianceTier = idol.eid.radianceTier;
					if (idol.eid.healthBuff)
					{
						componentInChildren.healthBuff = true;
						componentInChildren.healthBuffRequests++;
						componentInChildren.healthBuffModifier = idol.eid.healthBuffModifier;
					}
					if (idol.eid.speedBuff)
					{
						componentInChildren.speedBuff = true;
						componentInChildren.speedBuffRequests++;
						componentInChildren.speedBuffModifier = idol.eid.speedBuffModifier;
					}
					if (idol.eid.damageBuff)
					{
						componentInChildren.damageBuff = true;
						componentInChildren.damageBuffRequests++;
						componentInChildren.damageBuffModifier = idol.eid.damageBuffModifier;
					}
				}
			}
			caughtEnemies[puppetIndex].UpdatePuppet(((Component)val).gameObject);
		}

		public void KillPuppets()
		{
			if (caughtEnemies == null || caughtEnemies.Count == 0)
			{
				return;
			}
			foreach (CaughtEnemy caughtEnemy in caughtEnemies)
			{
				if (caughtEnemy != null && !((Object)(object)caughtEnemy.puppet == (Object)null))
				{
					EnemyIdentifier componentInChildren = caughtEnemy.puppet.GetComponentInChildren<EnemyIdentifier>();
					if (!((Object)(object)componentInChildren == (Object)null))
					{
						componentInChildren.InstaKill();
					}
				}
			}
		}
	}
	public class ShockwaveShufflerSetValues : MonoBehaviour
	{
		public float cooldown = 4f;

		public float cooldownOffset = 0f;

		public float shockwaveSpeed = 40f;

		public float shockwaveMaxSize = 100f;

		public float shockwaveHeightMultiplier = 1f;
	}
	public class ShockwaveShufflerSpawned : MonoBehaviour
	{
		public float Cooldown = 4f;

		public float CooldownOffset = 0f;

		public float ShockwaveSpeed = 40f;

		public float ShockwaveMaxSize = 100f;

		public float ShockwaveHeightMultiplier = 1f;

		public float nextCycleTime;

		public bool didFlash = false;

		public float flashPreAttackTime = 0.75f;

		public bool finishedSetup = false;

		public float animationFirstHalfTime = 0.05f;

		public float animationHoldTime = 0.35f;

		public float animationSecondHalfTime = 0.3f;

		public float animationStartTimepoint;

		public bool doingAnimation = false;

		public Transform model;

		public Transform modelRoot;

		public Transform modelCenter;

		public Transform modelBottleneck;

		public Transform modelTip;

		public Transform modelTopBlock;

		public Vector3 modelRootPosition;

		public Vector3 modelCenterPosition;

		public Vector3 modelBottleneckPosition;

		public Vector3 modelTipPosition;

		public Vector3 modelTopBlockPosition;

		public Vector3 modelRootPositionAnim;

		public Vector3 modelCenterPositionAnim;

		public Vector3 modelBottleneckPositionAnim;

		public Vector3 modelTipPositionAnim;

		public Vector3 modelTopBlockPositionAnim;

		public EnemyIdentifier eid;

		public Rigidbody rigidbody;

		public Drone drone;

		public DroneFlesh droneFlesh;

		public void Awake()
		{
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			eid.weaknesses = Array.Empty<string>();
			eid.weaknessMultipliers = Array.Empty<float>();
			rigidbody = ((Component)this).GetComponent<Rigidbody>();
			if (!finishedSetup)
			{
				RemoveParts();
				AddModel();
				finishedSetup = true;
			}
			else
			{
				ModelProcessParts();
			}
			CheckSetValues();
		}

		public void CheckSetValues()
		{
			ShockwaveShufflerSetValues component = ((Component)this).GetComponent<ShockwaveShufflerSetValues>();
			if (!((Object)(object)component == (Object)null))
			{
				Cooldown = component.cooldown;
				CooldownOffset = component.cooldownOffset;
				ShockwaveSpeed = component.shockwaveSpeed;
				ShockwaveMaxSize = component.shockwaveMaxSize;
				ShockwaveHeightMultiplier = component.shockwaveHeightMultiplier;
			}
		}

		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("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_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_0032: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = 1.5f * Vector3.one;
			model = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["ShockwaveShuffler"], ((Component)this).transform.position, ((Component)this).transform.rotation).transform;
			model.SetParent(((Component)this).transform);
			((Component)model).tag = "Untagged";
			((Component)model).gameObject.layer = LayerMask.NameToLayer("Default");
			NavMeshModifier componentInChildren = ((Component)model).GetComponentInChildren<NavMeshModifier>();
			((Behaviour)componentInChildren).enabled = false;
			((Component)((Component)componentInChildren).transform.Find("NavMeshBlocker")).gameObject.SetActive(false);
			ModelReposition();
			model.localScale = new Vector3(0.75f, 0.125f, 0.75f);
			model.localPosition = new Vector3(0f, 1f, 0f);
			model.Rotate(0f, 0f, 180f);
			ModelProcessParts();
		}

		public void ModelReposition()
		{
			//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_0041: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			modelRoot = model.Find("Root");
			modelRootPosition = new Vector3(-2.5f, 0f, 2.5f);
			modelRootPositionAnim = new Vector3(-2.5f, 4f, 2.5f);
			modelRoot.localPosition = modelRootPosition;
			modelCenter = model.Find("Center");
			modelCenterPosition = new Vector3(0f, 1f, 0f);
			modelCenterPositionAnim = new Vector3(0f, 4.25f, 0f);
			modelCenter.localPosition = modelCenterPosition;
			modelBottleneck = model.Find("Bottleneck");
			modelBottleneckPosition = new Vector3(0f, 1f, 0f);
			modelBottleneck.localPosition = modelBottleneckPosition;
			modelTip = model.Find("Tip");
			modelTipPosition = new Vector3(0f, 1f, 0f);
			modelTipPositionAnim = new Vector3(0f, -1f, 0f);
			modelTip.localPosition = modelTipPosition;
			modelTopBlock = model.Find("Top Block");
			modelTopBlockPosition = new Vector3(-2.5f, 12f, 2.5f);
			modelTopBlockPositionAnim = new Vector3(-2.5f, 8.5f, 2.5f);
			modelTopBlock.localPosition = modelTopBlockPosition;
		}

		public void ModelProcessParts()
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.layer = LayerMask.NameToLayer("BigCorpse");
			((Component)this).gameObject.AddComponent<EnemyIdentifierIdentifier>();
			MeshRenderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val in componentsInChildren)
			{
				((Component)val).tag = "Body";
				((Component)val).gameObject.layer = LayerMask.NameToLayer("BigCorpse");
				RetextureMeshRenderer(val);
				for (int j = 0; j < ((Renderer)val).materials.Length; j++)
				{
					((Renderer)val).materials[j] = Object.Instantiate<Material>(((Renderer)val).materials[j]);
					((Renderer)val).materials[j].EnableKeyword("ENEMY");
					((Renderer)val).materials[j].SetFloat("ENEMY", 1f);
					if (Util.IsSandbox())
					{
						((Renderer)val).materials[j].DisableKeyword("VERTEX_LIGHTING");
						((Renderer)val).materials[j].SetFloat("VERTEX_LIGHTING", 0f);
					}
					else
					{
						((Renderer)val).materials[j].EnableKeyword("EMISSIVE");
					}
				}
				ComponentExtensions.GetOrAddComponent<EnemySimplifier>((Component)(object)val);
			}
			BoxCollider component = ((Component)((Component)this).transform).GetComponent<BoxCollider>();
			component.size = new Vector3(4f, 2f, 4f);
			Transform val2 = ((Component)this).transform.Find("Sphere");
			((Collider)((Component)val2).GetComponent<SphereCollider>()).enabled = false;
			ComponentExtensions.GetOrAddComponent<BoxCollider>((Component)(object)val2).size = new Vector3(2f, 1f, 2f);
		}

		public void RetextureMeshRenderer(MeshRenderer mr)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			if ((Object)(object)mr == (Object)null)
			{
				return;
			}
			for (int i = 0; i < ((Renderer)mr).materials.Length; i++)
			{
				Material val = ((Renderer)mr).materials[i];
				if (!((Object)(object)val.mainTexture == (Object)null))
				{
					string name = ((Object)val.mainTexture).name;
					if (EnemyAssets.Textures.ContainsKey(name) && (Object)(object)EnemyAssets.Textures[name] != (Object)null)
					{
						Material val2 = Object.Instantiate<Material>(val);
						val2.mainTexture = (Texture)(object)EnemyAssets.Textures[name];
						((Renderer)mr).materials[i] = val2;
						MaterialPropertyBlock val3 = new MaterialPropertyBlock();
						((Renderer)mr).GetPropertyBlock(val3);
						val3.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures[name]);
						((Renderer)mr).SetPropertyBlock(val3);
					}
				}
			}
		}

		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>();
			if ((Object)(object)((Component)this).GetComponent<ShockwaveShufflerSetValues>() == (Object)null)
			{
				CooldownOffset = Time.time % Cooldown;
				if (!BlindEnemies.Blind && !EnemyIgnorePlayer.Active)
				{
					CreateShockwave();
				}
			}
			GetNextCycleTime();
		}

		public void Update()
		{
			if ((Object)(object)eid == (Object)null || eid.health <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (doingAnimation)
			{
				DoAnimation();
			}
			if (BlindEnemies.Blind || EnemyIgnorePlayer.Active)
			{
				GetNextCycleTime();
			}
			else
			{
				bool flag = nextCycleTime - Time.time <= flashPreAttackTime;
				bool flag2 = nextCycleTime - Time.time <= 0.5f * flashPreAttackTime;
				if (flag && !didFlash && !flag2)
				{
					Flash();
				}
				if (Time.time >= nextCycleTime)
				{
					if (didFlash)
					{
						CreateShockwave();
					}
					GetNextCycleTime();
				}
			}
			if (((Behaviour)drone).enabled)
			{
				((Behaviour)drone).enabled = false;
			}
			if (((Behaviour)droneFlesh).enabled)
			{
				((Behaviour)droneFlesh).enabled = false;
			}
		}

		public void FixedUpdate()
		{
			if (!rigidbody.isKinematic)
			{
				rigidbody.isKinematic = true;
			}
		}

		public void GetNextCycleTime()
		{
			float num = Cooldown / GetTotalSpeedModifier();
			float num2 = CooldownOffset / GetTotalSpeedModifier();
			float num3 = Mathf.Floor((Time.time - num2) / num);
			nextCycleTime = num2 + num * (num3 + 1f);
			didFlash = false;
		}

		public float GetTotalSpeedModifier()
		{
			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 CreateShockwave()
		{
			//IL_0028: 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)
			//IL_0044: 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_0050: 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_0063: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			animationStartTimepoint = Time.time;
			doingAnimation = true;
			GameObject val = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["ShockwaveMagenta"], ((Component)this).transform.position, ((Component)this).transform.rotation);
			Vector3 localScale = val.transform.localScale;
			val.transform.localScale = new Vector3(localScale.x, localScale.y * ShockwaveHeightMultiplier, localScale.z);
			PhysicalShockwave component = val.GetComponent<PhysicalShockwave>();
			component.noDamageToEnemy = true;
			component.enemyType = (EnemyType)42;
			component.speed = ShockwaveSpeed;
			component.maxSize = ShockwaveMaxSize;
			component.target = new EnemyTarget(((Component)MonoSingleton<NewMovement>.Instance).transform);
			val.AddComponent<TrueMagentaShockwave>();
			MeshCollider[] componentsInChildren = val.GetComponentsInChildren<MeshCollider>(true);
			MeshCollider[] array = componentsInChildren;
			foreach (MeshCollider val2 in array)
			{
				((Component)val2).gameObject.layer = LayerMask.NameToLayer("Default");
			}
		}

		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)
			Transform transform = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.unparryableFlash, model.position, Quaternion.identity).transform;
			transform.localScale *= 20f;
			transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
			((Component)transform).GetComponent<AudioSource>().volume = 0.5f;
			didFlash = true;
		}

		public void DoAnimation()
		{
			float num = Time.time - animationStartTimepoint;
			float num2 = animationFirstHalfTime;
			float num3 = animationFirstHalfTime + animationHoldTime;
			float num4 = animationFirstHalfTime + animationHoldTime + animationSecondHalfTime;
			if (num < num2)
			{
				DoAnimationFirstPart(num);
			}
			else if (num < num3)
			{
				DoAnimationHold();
			}
			else if (num < num4)
			{
				DoAnimationSecondPart(num, num3);
			}
			else if (num >= num4)
			{
				DoAnimationEnd();
			}
		}

		public void DoAnimationFirstPart(float currentAnimationTime)
		{
			//IL_0008: 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)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			//IL_0040: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			modelRoot.localPosition = Vector3.Lerp(modelRootPosition, modelRootPositionAnim, currentAnimationTime / animationFirstHalfTime);
			modelCenter.localPosition = Vector3.Lerp(modelCenterPosition, modelCenterPositionAnim, currentAnimationTime / animationFirstHalfTime);
			modelBottleneck.localPosition = Vector3.Lerp(modelBottleneckPosition, modelBottleneckPositionAnim, currentAnimationTime / animationFirstHalfTime);
			modelTip.localPosition = Vector3.Lerp(modelTipPosition, modelTipPositionAnim, currentAnimationTime / animationFirstHalfTime);
			modelTopBlock.localPosition = Vector3.Lerp(modelTopBlockPosition, modelTopBlockPositionAnim, currentAnimationTime / animationFirstHalfTime);
		}

		public void DoAnimationHold()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			modelRoot.localPosition = modelRootPositionAnim;
			modelCenter.localPosition = modelCenterPositionAnim;
			modelBottleneck.localPosition = modelBottleneckPositionAnim;
			modelTip.localPosition = modelTipPositionAnim;
			modelTopBlock.localPosition = modelTopBlockPositionAnim;
		}

		public void DoAnimationSecondPart(float currentAnimationTime, float holdTimeFull)
		{
			//IL_0008: 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)
			//IL_001d: 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_0035: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			modelRoot.localPosition = Vector3.Lerp(modelRootPositionAnim, modelRootPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime);
			modelCenter.localPosition = Vector3.Lerp(modelCenterPositionAnim, modelCenterPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime);
			modelBottleneck.localPosition = Vector3.Lerp(modelBottleneckPositionAnim, modelBottleneckPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime);
			modelTip.localPosition = Vector3.Lerp(modelTipPositionAnim, modelTipPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime);
			modelTopBlock.localPosition = Vector3.Lerp(modelTopBlockPositionAnim, modelTopBlockPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime);
		}

		public void DoAnimationEnd()
		{
			//IL_000f: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			doingAnimation = false;
			modelRoot.localPosition = modelRootPosition;
			modelCenter.localPosition = modelCenterPosition;
			modelBottleneck.localPosition = modelBottleneckPosition;
			modelTip.localPosition = modelTipPosition;
			modelTopBlock.localPosition = modelTopBlockPosition;
		}
	}
	public class TrueMagentaShockwave : MonoBehaviour
	{
	}
	public class WatchtowerSpawned : MonoBehaviour
	{
		public bool shooting;

		public EnemyIdentifier eid;

		public Transform shootPoint;

		public Transform sphere;

		public OneTimeParry otp;

		public bool finishedSetup = false;

		public bool firstShoot = true;

		public float shootCooldown = 0f;

		public float shootCooldownMax = 1.5f;

		public float flashPreAttackTime = 0.5f;

		public bool didFlash = false;

		public const float shootCooldownMaxDefault = 1.5f;

		public int shootCount = 6;

		public float projectileSpeed = 100f;

		public const float projectileSpeedDefault = 100f;

		public float difficultySpeedModifier = 1f;

		public GameObject projectile = EnemyAssets.Prefabs["Projectile"];

		public Projectile currentProjectile;

		public List<Projectile> currentSeries = new List<Projectile>();

		public bool seriesParried;

		public void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			shootPoint = ((Component)this).GetComponent<MortarLauncher>().shootPoint;
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			if (!finishedSetup)
			{
				((Component)this).transform.localScale = new Vector3(10f, 10f, 10f);
				if (((Object)((Component)this).transform.parent).name.Contains("Automated Gore Zone"))
				{
					((Component)this).transform.localScale = new Vector3(15f, 20f, 15f);
				}
				StartSpheres();
				sphere = ((Component)shootPoint).transform.Find("Sphere (1)");
				otp = ((Component)sphere).gameObject.AddComponent<OneTimeParry>();
				otp.deactivateOnParry = ((Component)otp).gameObject;
				otp.enemy = ((Component)this).GetComponent<Enemy>();
				otp.subtractHealth = 12f;
				finishedSetup = true;
			}
			StartColliders();
			StartDifficulty();
		}

		public void StartSpheres()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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)
			Transform val = ((Component)this).transform.Find("Armature/Pole_Top/Sphere (1)");
			val.localScale = new Vector3(0.2f, 0.2f, 0.2f);
			Object.Destroy((Object)(object)((Component)val).GetComponent<ObjectActivator>());
			Object.Destroy((Object)(object)((Component)val).GetComponent<ScaleTransform>());
			((Component)val).gameObject.SetActive(false);
			Transform val2 = val.Find("Sphere (1)");
			((Renderer)((Component)val2).GetComponent<MeshRenderer>()).material.color = new Color(1f, 1f, 0f);
			Object.Destroy((Object)(object)((Component)val2).GetComponent<ScaleTransform>());
			val2.localScale = Vector3.one;
			ComponentExtensions.GetOrAddComponent<EnemySimplifier>((Component)(object)val2);
			((Renderer)((Component)val2).GetComponent<MeshRenderer>()).material.EnableKeyword("ENEMY");
		}

		public void StartDifficulty()
		{
			switch (eid.difficulty)
			{
			case 4:
				difficultySpeedModifier = 1f;
				shootCount = 5;
				break;
			case 3:
				difficultySpeedModifier = 0.85f;
				shootCount = 4;
				break;
			case 2:
				difficultySpeedModifier = 0.65f;
				shootCount = 4;
				break;
			case 1:
				difficultySpeedModifier = 0.4f;
				shootCount = 3;
				break;
			case 0:
				difficultySpeedModifier = 0.3f;
				shootCount = 3;
				break;
			default:
				difficultySpeedModifier = 1.15f;
				shootCount = 6;
				break;
			}
			shootCooldownMax = 1.5f / difficultySpeedModifier;
			projectileSpeed = 100f * difficultySpeedModifier;
		}

		public void StartColliders()
		{
			CapsuleCollider component = ((Component)((Component)this).transform.Find("Armature/Pole_Top")).GetComponent<CapsuleCollider>();
			component.height = 0.6f;
			component.radius = 0.06f;
			CapsuleCollider component2 = ((Component)((Component)this).transform.Find("Armature/Pole_Middle")).GetComponent<CapsuleCollider>();
			component2.height = 0.66f;
			component2.radius = 0.08f;
			CapsuleCollider component3 = ((Component)((Component)this).transform.Find("Armature/Pole_Bottom")).GetComponent<CapsuleCollider>();
			component3.height = 0.66f;
			component3.radius = 0.1f;
		}

		public void Update()
		{
			if (!shooting)
			{
				shootCooldown += Time.deltaTime * eid.totalSpeedModifier;
			}
			float num = flashPreAttackTime / difficultySpeedModifier / GetTotalSpeedModifier();
			if (firstShoot)
			{
				didFlash = true;
				firstShoot = false;
			}
			else if (!didFlash && shootCooldown >= shootCooldownMax - num)
			{
				FlashSmall();
			}
			if (shootCooldown >= shootCooldownMax && !shooting && didFlash && !BlindEnemies.Blind && !EnemyIgnorePlayer.Active)
			{
				shooting = true;
				currentSeries = new List<Projectile>();
				seriesParried = false;
				didFlash = false;
				shootCooldown = 0f;
				((MonoBehaviour)this).StartCoroutine(ShootTimes(shootCount));
			}
			if (currentSeries.Count > 1 && !seriesParried)
			{
				CheckParriedProjectile();
			}
		}

		public float GetTotalSpeedModifier()
		{
			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 CheckParriedProjectile()
		{
			bool flag = false;
			Projectile val = null;
			foreach (Projectile item in currentSeries)
			{
				if (!Object.op_Implicit((Object)(object)item) || !item.parried)
				{
					continue;
				}
				val = item;
				seriesParried = true;
				flag = true;
				break;
			}
			if (!flag)
			{
				return;
			}
			foreach (Projectile item2 in currentSeries)
			{
				if (!((Object)(object)item2 == (Object)(object)val) && Object.op_Implicit((Object)(object)item2) && !((Object)(object)((Component)item2).transform == (Object)null))
				{
					MakeProjectileUnparriable(item2);
				}
			}
		}

		public void FlashSmall()
		{
			//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_002d: 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 transform = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.parryableFlash, ((Component)sphere).transform.position, Quaternion.identity).transform;
			transform.localScale *= 20f;
			transform.LookAt(((Component)MonoSingleton<NewMovement>.Instance).transform);
			((Component)transform).GetComponent<AudioSource>().volume = 0.45f;
			didFlash = true;
		}

		public IEnumerator ShootTimes(int times)
		{
			if (times <= 0)
			{
				shooting = false;
				shootCooldown = 0f;
			}
			else
			{
				ShootProjectile();
				yield return (object)new WaitForSeconds(0.1f / difficultySpeedModifier);
				((MonoBehaviour)this).StartCoroutine(ShootTimes(times - 1));
			}
		}

		public void ShootProjectile()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_003f: 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)
			Vector3 predictedPosition = GetPredictedPosition();
			currentProjectile = Object.Instantiate<GameObject>(projectile, shootPoint.position, shootPoint.rotation).GetComponent<Projectile>();
			((Component)currentProjectile).transform.LookAt(predictedPosition);
			Projectile obj = currentProjectile;
			obj.damage *= eid.totalDamageModifier;
			currentProjectile.safeEnemyType = (EnemyType)35;
			currentProjectile.speed = projectileSpeed;
			currentProjectile.enemyDamageMultiplier = 0.2f;
			currentSeries.Add(currentProjectile);
			if (seriesParried)
			{
				MakeProjectileUnparriable(currentProjectile);
			}
		}

		public Vector3 GetPredictedPosition()
		{
			//IL_000b: 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_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_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)
			//IL_0029: 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)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
			Vector3 playerVelocity = MonoSingleton<PlayerTracker>.Instance.GetPlayerVelocity(false);
			Vector3 position2 = shootPoint.position;
			Vector3 val = position - position2;
			float num = Vector3.Dot(playerVelocity, playerVelocity) - projectileSpeed * projectileSpeed;
			float num2 = 2f * Vector3.Dot(playerVelocity, val);
			float num3 = Vector3.Dot(val, val);
			float num4 = num2 * num2 - 4f * num * num3;
			float num5 = 0f;
			if (num4 > 0f)
			{
				float num6 = Mathf.Sqrt(num4);
				float num7 = (0f - num2 + num6) / (2f * num);
				float num8 = (0f - num2 - num6) / (2f * num);
				num5 = Mathf.Max(num7, num8);
				if (num5 < 0f)
				{
					num5 = Mathf.Min(num7, num8);
				}
				if (num5 < 0f)
				{
					num5 = 0f;
				}
			}
			return position + playerVelocity * num5;
		}

		public void MakeProjectileUnparriable(Projectile proj)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)proj) && !((Object)(object)((Component)proj).transform == (Object)null))
			{
				proj.unparryable = true;
				proj.enemyDamageMultiplier = 0f;
				Light component = ((Component)proj).GetComponent<Light>();
				if (component != null)
				{
					component.color = new Color(0.5f, 0f, 0.85f, 1f);
				}
				TrailRenderer component2 = ((Component)proj).GetComponent<TrailRenderer>();
				if (component2 != null)
				{
					component2.endColor = new Color(0.65f, 0f, 0.95f, 1f);
				}
				if (component2 != null)
				{
					component2.startColor = new Color(0.4f, 0f, 0.7f, 1f);
				}
				if (component2 != null)
				{
					component2.endWidth = 0.75f;
				}
				MeshRenderer component3 = ((Component)((Component)proj).transform.Find("AlwaysLookAtCamera/ChargeEffect")).GetComponent<MeshRenderer>();
				if (component3 != null)
				{
					((Renderer)component3).material.color = new Color(0.7f, 0f, 0.95f, 1f);
				}
				MeshRenderer component4 = ((Component)proj).GetComponent<MeshRenderer>();
				Material val = Object.Instantiate<Material>(((Renderer)component4).material);
				val.mainTexture = (Texture)(object)EnemyAssets.Textures["ProjectilePurple"];
				((Renderer)component4).material = val;
				MaterialPropertyBlock val2 = new MaterialPropertyBlock();
				((Renderer)component4).GetPropertyBlock(val2);
				val2.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["ProjectilePurple"]);
				((Renderer)component4).SetPropertyBlock(val2);
				ComponentExtensions.GetOrAddComponent<ProjectileExplosionColor>((Component)(object)proj).color = new Color(0.75f, 0.2f, 1f, 1f);
			}
		}
	}
	[HarmonyPatch(typeof(MortarLauncher))]
	public class BlackHoleMortarLauncherPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(MortarLauncher), "Start")]
		public static void StartPostfix(MortarLauncher __instance)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Util.FindParentWithNameContaining("BlackHoleLauncherSpawned", ((Component)__instance).transform);
			if (!((Object)(object)val == (Object)null))
			{
				if (__instance.eid.overrideFullName == "EARTHMOVER MORTAR")
				{
					__instance.eid.overrideFullName = "BLACK HOLE LAUNCHER";
				}
				Util.SetEnemyHealth(__instance.eid, 27f);
				Util.UpdateEnemyHealthbar(__instance.eid);
				ComponentExtensions.GetOrAddComponent<PuppetName>((Component)(object)__instance).puppetName = ((Object)__instance).name;
				SkinnedMeshRenderer componentInChildren = ((Component)__instance).GetComponentInChildren<SkinnedMeshRenderer>();
				((Renderer)componentInChildren).material.color = new Color(0.65f, 0f, 0.8f, 1f);
				ComponentExtensions.GetOrAddComponent<RealEnemyTypeSaver>((Component)(object)__instance).type = RealEnemyType.BlackHoleLauncher;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MortarLauncher), "ShootHoming")]
		public static bool ShootHomingPrefix(MortarLauncher __instance)
		{
			//IL_0081: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Util.FindParentWithNameContaining("BlackHoleLauncherSpawned", ((Component)__instance).transform);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			BlackHoleFromMortar[] array = Object.FindObjectsByType<BlackHoleFromMortar>((FindObjectsSortMode)0);
			foreach (BlackHoleFromMortar blackHoleFromMortar in array)
			{
				if ((Object)(object)blackHoleFromMortar.source == (Object)(object)__instance.eid)
				{
					return false;
				}
			}
			BlackHoleProjectile component = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["BlackHole"], __instance.shootPoint.position, __instance.shootPoint.rotation).GetComponent<BlackHoleProjectile>();
			Transform transform = ((Component)component).transform;
			transform.localScale *= 3f;
			component.safeType = (EnemyType)35;
			component.Activate();
			component.speed = 8f * __instance.eid.totalDamageModifier;
			int difficulty = __instance.eid.difficulty;
			if (1 == 0)
			{
			}
			float num = difficulty switch
			{
				4 => 1f, 
				3 => 0.8f, 
				2 => 0.7f, 
				1 => 0.6f, 
				0 => 0.5f, 
				_ => 1.1f, 
			};
			if (1 == 0)
			{
			}
			float num2 = num;
			component.speed *= num2;
			SpriteRenderer componentInChildren = ((Component)component).GetComponentInChildren<SpriteRenderer>(true);
			((Renderer)componentInChildren).material.renderQueue = 3001;
			((Component)component).gameObject.AddComponent<BlackHoleFromMortar>().source = __instance.eid;
			if (Object.op_Implicit((Object)(object)__instance.anim))
			{
				__instance.anim.Play("Shoot", 0, 0f);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(MaliciousFace))]
	public class DisgraceMaliciousFacePatch
	{
		public static IEnumerator DisgraceDeath(Transform tr)
		{
			yield return (object)new WaitForSeconds(1f);
			Vector3 pos = tr.position;
			Quaternion rot = tr.rotation;
			Object.Instantiate<GameObject>(EnemyAssets.Prefabs["Explosion"], pos, rot);
			yield return (object)new WaitForSeconds(0.1f);
			Transform gib = Object.Instantiate<GameObject>(EnemyAssets.Prefabs["BrainGib"], pos + new Vector3(0f, -3f, 0f), rot).transform;
			gib.localScale = new Vector3(1.5f, 1.5f, 4.5f);
			Object.Destroy((Object)(object)((Component)tr.parent.parent).gameObject);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MaliciousFace), "Start")]
		public static void StartPostfix(MaliciousFace __instance)
		{
			Transform val = Util.FindParentWithNameContaining("DisgraceSpawned", ((Component)__instance).transform);
			if (!((Object)(object)val == (Object)null))
			{
				if (__instance.eid.overrideFullName == "MALICIOUS FACE")
				{
					__instance.eid.overrideFullName = "DISGRACE";
				}
				Util.SetEnemyHealth(__instance.eid, 20f);
				Util.UpdateEnemyHealthbar(__instance.eid);
				((Component)__instance).gameObject.AddComponent<DisgraceSpawned>();
				((Component)__instance).gameObject.AddComponent<RealEnemyTypeSaver>().type = RealEnemyType.Disgrace;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MaliciousFace), "Die")]
		public static bool DiePrefix(MaliciousFace __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<DisgraceSpawned>() == (Object)null)
			{
				return true;
			}
			((MonoBehaviour)__instance).StartCoroutine(DisgraceDeath(((Component)__instance).transform));
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MaliciousFace), "Update")]
		public static bool UpdatePrefix(MaliciousFace __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<DisgraceSpawned>() == (Object)null)
			{
				return true;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(DroneFlesh))]
	public class FuchsiaDroneFleshPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(DroneFlesh), "Start")]
		public static