Decompiled source of Elemental Battlegrounds Arsenal v0.1.0

plugins/ElementalBattlegrounds.dll

Decompiled 6 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ElementalBattlegroundsMod.Api;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using TMPro;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ElementalBattlegrounds")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+f2b1fe22fefe01facacd07d31e16c6ff909474f4")]
[assembly: AssemblyProduct("ElementalBattlegrounds")]
[assembly: AssemblyTitle("ElementalBattlegrounds")]
[assembly: AssemblyVersion("0.1.0.0")]
[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 ElementalBattlegroundsMod
{
	internal static class ArsenalLoadout
	{
		private static bool rebuilding;

		internal static void Rebuild(GunSetter setter, bool firstTime)
		{
			if (rebuilding || (Object)(object)setter == (Object)null || (Object)(object)setter.gunc == (Object)null || !EBSettings.Enabled)
			{
				return;
			}
			rebuilding = true;
			try
			{
				SlotResourceOwnerResolver.ClearCache();
				GunControl gunc = setter.gunc;
				WeaponVariantBindsCompat.CaptureNativeOrder(gunc);
				for (int i = 0; i < 5 && i < gunc.slots.Count; i++)
				{
					WeaponFamily family = (WeaponFamily)i;
					LoadoutChoice[] uniqueChoices = EBSettings.GetUniqueChoices(family);
					List<GameObject> list = gunc.slots[i];
					foreach (GameObject item in list)
					{
						if ((Object)(object)item != (Object)null)
						{
							Object.Destroy((Object)(object)item);
						}
					}
					list.Clear();
					for (int j = 0; j < 3; j++)
					{
						LoadoutChoice loadoutChoice = uniqueChoices[j];
						GameObject val;
						if (loadoutChoice.IsNone || loadoutChoice.IsMissing)
						{
							val = EmptySlotRuntime.CreatePlaceholder(((Component)setter).transform);
						}
						else
						{
							GameObject val2 = (loadoutChoice.IsVanilla ? GetVanillaPrefab(setter, family, loadoutChoice.vanillaVariant, loadoutChoice.vanillaForm) : ElementCatalog.GetElementPrefab(setter, family, loadoutChoice.id));
							if ((Object)(object)val2 == (Object)null)
							{
								ManualLogSource logSource = Plugin.LogSource;
								if (logSource != null)
								{
									logSource.LogWarning((object)("No prefab for " + family.ToString() + " position " + j + " / " + loadoutChoice.displayName + "."));
								}
								val = EmptySlotRuntime.CreatePlaceholder(((Component)setter).transform);
							}
							else
							{
								val = Object.Instantiate<GameObject>(val2, ((Component)setter).transform);
							}
						}
						((Object)val).name = "EB " + loadoutChoice.displayName + " " + family.ToString() + " " + (j + 1);
						ElementalSlotMarker elementalSlotMarker = val.AddComponent<ElementalSlotMarker>();
						elementalSlotMarker.element = loadoutChoice.element;
						elementalSlotMarker.elementId = (loadoutChoice.IsElement ? ElementRegistry.Canonicalize(loadoutChoice.id) : null);
						elementalSlotMarker.family = family;
						elementalSlotMarker.position = j;
						elementalSlotMarker.choiceId = loadoutChoice.id;
						elementalSlotMarker.choiceName = loadoutChoice.displayName;
						elementalSlotMarker.explosiveMode = loadoutChoice.explosiveMode;
						if (loadoutChoice.IsVanilla)
						{
							elementalSlotMarker.hasVanillaTemplate = VanillaWeaponTemplateMap.TryFromDirectChoice(loadoutChoice.id, out elementalSlotMarker.vanillaTemplate);
						}
						else if (loadoutChoice.IsElement)
						{
							elementalSlotMarker.hasVanillaTemplate = ElementCatalog.TryGetWeaponTemplate(loadoutChoice.id, family, out elementalSlotMarker.vanillaTemplate);
						}
						if (!loadoutChoice.IsNone && !loadoutChoice.IsMissing)
						{
							ElementWeaponRuntime.Attach(val, elementalSlotMarker);
							GrenadeLauncherCompat.Configure(val, elementalSlotMarker);
						}
						list.Add(val);
					}
				}
				gunc.UpdateWeaponList(firstTime);
				RefreshWeaponVariantBinds();
			}
			catch (Exception ex)
			{
				ManualLogSource logSource2 = Plugin.LogSource;
				if (logSource2 != null)
				{
					logSource2.LogError((object)("Failed rebuilding EB arsenal: " + ex));
				}
			}
			finally
			{
				rebuilding = false;
			}
		}

		internal static bool IsApplied(GunSetter setter)
		{
			if ((Object)(object)setter == (Object)null || (Object)(object)setter.gunc == (Object)null || setter.gunc.slots == null)
			{
				return false;
			}
			int num = Mathf.Min(5, setter.gunc.slots.Count);
			if (num < 5)
			{
				return false;
			}
			for (int i = 0; i < num; i++)
			{
				List<GameObject> list = setter.gunc.slots[i];
				if (list == null || list.Count != 3)
				{
					return false;
				}
				for (int j = 0; j < list.Count; j++)
				{
					GameObject val = list[j];
					if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent<ElementalSlotMarker>() == (Object)null)
					{
						return false;
					}
				}
			}
			return true;
		}

		private static void RefreshWeaponVariantBinds()
		{
			try
			{
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				for (int i = 0; i < assemblies.Length; i++)
				{
					Type type = assemblies[i].GetType("WeaponVariantBinds.Plugin", throwOnError: false);
					if (!(type == null))
					{
						type.GetField("VanillaWeaponCyclesDetermined", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(null, false);
						ManualLogSource logSource = Plugin.LogSource;
						if (logSource != null)
						{
							logSource.LogInfo((object)"Marked WeaponVariantBinds weapon cycles dirty after EB loadout rebuild.");
						}
						break;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logSource2 = Plugin.LogSource;
				if (logSource2 != null)
				{
					logSource2.LogWarning((object)("WeaponVariantBinds refresh failed: " + ex.Message));
				}
			}
		}

		private static GameObject GetVanillaPrefab(GunSetter setter, WeaponFamily family, int variant, int form)
		{
			AssetReference[] refs = null;
			switch (family)
			{
			case WeaponFamily.Revolver:
				refs = variant switch
				{
					1 => setter.revolverTwirl, 
					0 => setter.revolverPierce, 
					_ => setter.revolverRicochet, 
				};
				break;
			case WeaponFamily.Shotgun:
				refs = variant switch
				{
					1 => setter.shotgunPump, 
					0 => setter.shotgunGrenade, 
					_ => setter.shotgunRed, 
				};
				break;
			case WeaponFamily.Rapid:
				refs = variant switch
				{
					1 => setter.nailOverheat, 
					0 => setter.nailMagnet, 
					_ => setter.nailRed, 
				};
				break;
			case WeaponFamily.Ultimate:
				refs = variant switch
				{
					1 => setter.railHarpoon, 
					0 => setter.railCannon, 
					_ => setter.railMalicious, 
				};
				break;
			case WeaponFamily.Explosive:
				refs = variant switch
				{
					1 => setter.rocketGreen, 
					0 => setter.rocketBlue, 
					_ => setter.rocketRed, 
				};
				break;
			}
			return Pick(refs, form);
		}

		private static GameObject Pick(AssetReference[] refs, int index)
		{
			if (refs == null || refs.Length == 0)
			{
				return null;
			}
			index = Mathf.Clamp(index, 0, refs.Length - 1);
			AssetReference val = refs[index];
			if (val == null || !val.RuntimeKeyIsValid())
			{
				return null;
			}
			return AddressablesExtensions.ToAsset(val);
		}
	}
	internal sealed class LoadoutAutoApplyRuntime : MonoBehaviour
	{
		private Coroutine pendingApply;

		private int lastAppliedSetterId = int.MinValue;

		private void OnEnable()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
			QueueApply();
		}

		private void OnDisable()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
			if (pendingApply != null)
			{
				((MonoBehaviour)this).StopCoroutine(pendingApply);
				pendingApply = null;
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			QueueApply();
		}

		private void QueueApply()
		{
			if (pendingApply != null)
			{
				((MonoBehaviour)this).StopCoroutine(pendingApply);
			}
			pendingApply = ((MonoBehaviour)this).StartCoroutine(ApplyWhenReady());
		}

		private IEnumerator ApplyWhenReady()
		{
			yield return null;
			yield return null;
			for (int attempt = 0; attempt < 40; attempt++)
			{
				if (!EBSettings.Enabled)
				{
					pendingApply = null;
					yield break;
				}
				GunSetter setter = Object.FindObjectOfType<GunSetter>();
				if ((Object)(object)setter != (Object)null)
				{
					int setterId = ((Object)setter).GetInstanceID();
					if (setterId == lastAppliedSetterId && ArsenalLoadout.IsApplied(setter))
					{
						pendingApply = null;
						yield break;
					}
					bool flag = false;
					try
					{
						flag = EBSettings.EnsureWorkingLoadoutInitialized();
					}
					catch (Exception ex)
					{
						ManualLogSource logSource = Plugin.LogSource;
						if (logSource != null)
						{
							logSource.LogWarning((object)("EB loadout initialization is not ready yet: " + ex.Message));
						}
					}
					if (!flag)
					{
						yield return (object)new WaitForSecondsRealtime(0.1f);
						continue;
					}
					try
					{
						setter.ResetWeapons(false);
					}
					catch (Exception ex2)
					{
						ManualLogSource logSource2 = Plugin.LogSource;
						if (logSource2 != null)
						{
							logSource2.LogWarning((object)("Automatic EB loadout apply attempt failed: " + ex2.Message));
						}
					}
					yield return null;
					if (ArsenalLoadout.IsApplied(setter))
					{
						lastAppliedSetterId = setterId;
						ManualLogSource logSource3 = Plugin.LogSource;
						if (logSource3 != null)
						{
							logSource3.LogInfo((object)"Applied Elemental Battlegrounds loadout automatically for the current level.");
						}
						pendingApply = null;
						yield break;
					}
				}
				yield return (object)new WaitForSecondsRealtime(0.1f);
			}
			ManualLogSource logSource4 = Plugin.LogSource;
			if (logSource4 != null)
			{
				logSource4.LogWarning((object)"Elemental Battlegrounds loadout was not fully available during level startup; the manual Apply loadout button remains available.");
			}
			pendingApply = null;
		}
	}
	[HarmonyPatch(typeof(GunSetter), "ResetWeapons")]
	internal static class GunSetterResetWeaponsPatch
	{
		private static void Postfix(GunSetter __instance, bool firstTime)
		{
			ArsenalLoadout.Rebuild(__instance, firstTime);
		}
	}
	internal sealed class CounterShotgunController : ActiveWeaponController
	{
		private Shotgun shotgun;

		private Animator animator;

		private bool initialDrawFinished;

		private float storedSpeed;

		private float speedStorageAge = 1f;

		private float jackhammerSpeed;

		private int jackhammerTier;

		private float tierDownAge = 1f;

		private static readonly FieldRef<Shotgun, bool> ShotgunGunReady = AccessTools.FieldRefAccess<Shotgun, bool>("gunReady");

		private static readonly FieldInfo HammerHitSoundField = AccessTools.Field(typeof(ShotgunHammer), "hitSound");

		private static readonly FieldInfo HammerHitImpactParticleField = AccessTools.Field(typeof(ShotgunHammer), "hitImpactParticle");

		private static readonly FieldRef<Sisyphus, bool> InsurrectionistSwinging = AccessTools.FieldRefAccess<Sisyphus, bool>("swinging");

		private static readonly FieldInfo EnemyScriptField = AccessTools.Field(typeof(Enemy), "script");

		protected override void Awake()
		{
			base.Awake();
			shotgun = ((Component)this).GetComponent<Shotgun>();
			animator = ((Component)this).GetComponentInChildren<Animator>();
		}

		protected override void OnEnable()
		{
			base.OnEnable();
			initialDrawFinished = false;
			storedSpeed = 0f;
			speedStorageAge = 1f;
			jackhammerSpeed = 0f;
			jackhammerTier = 0;
			tierDownAge = 1f;
		}

		protected override void Update()
		{
			base.Update();
			UpdateJackhammerTier();
			if ((Object)(object)shotgun == (Object)null)
			{
				return;
			}
			if (!initialDrawFinished && ShotgunGunReady.Invoke(shotgun))
			{
				initialDrawFinished = true;
			}
			if (!CanUseSecondary() || !initialDrawFinished || !SecondaryInputTiming.IsPressed)
			{
				return;
			}
			if (ShotgunGunReady.Invoke(shotgun))
			{
				Animator obj = animator;
				if (obj != null)
				{
					obj.Play("FireNoReload", -1, 0f);
				}
			}
			PlayerAnimations instance = MonoSingleton<PlayerAnimations>.Instance;
			if (instance != null)
			{
				instance.Shoot(1f);
			}
			Counter();
			StartCooldown(WeaponTuning.CounterCooldown);
		}

		private void Counter()
		{
			//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_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_001d: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: 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_00ef: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: 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_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Invalid comparison between Unknown and I4
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Invalid comparison between Unknown and I4
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			CameraController instance = MonoSingleton<CameraController>.Instance;
			Vector3 defaultPos = instance.GetDefaultPos();
			Vector3 forward = ((Component)instance).transform.forward;
			int num = 0x4000 | LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)0)) | LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1));
			RaycastHit[] array = Physics.SphereCastAll(defaultPos, 0.75f, forward, 4.5f, num, (QueryTriggerInteraction)2);
			Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance));
			RaycastHit[] array2 = array;
			RaycastHit val3 = default(RaycastHit);
			RaycastHit val7 = default(RaycastHit);
			for (int num2 = 0; num2 < array2.Length; num2++)
			{
				RaycastHit hit = array2[num2];
				Transform val = ((RaycastHit)(ref hit)).transform;
				ParryHelper component = ((Component)val).GetComponent<ParryHelper>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.target != (Object)null)
				{
					val = component.target;
				}
				Cannonball val2 = ((Component)val).GetComponent<Cannonball>() ?? ((Component)val).GetComponentInParent<Cannonball>();
				if ((Object)(object)val2 != (Object)null && val2.launchable)
				{
					Vector3 parryLookTarget = Punch.GetParryLookTarget();
					if (Vector3.Distance(((Component)val2).transform.position, parryLookTarget) < 10f)
					{
						if (Physics.Raycast(defaultPos, forward, ref val3, 5f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3))))
						{
							((Component)val2).transform.position = ((RaycastHit)(ref val3)).point;
						}
						else
						{
							((Component)val2).transform.position = defaultPos + forward * 5f;
						}
						((Component)val2).transform.forward = forward;
					}
					else
					{
						((Component)val2).transform.LookAt(parryLookTarget);
					}
					EnemyIdentifier val4 = (((Object)(object)val2.sisy != (Object)null) ? ((Component)val2.sisy).GetComponent<EnemyIdentifier>() : null);
					if ((Object)(object)val4 != (Object)null)
					{
						AwardVanillaParry(val4);
						RuntimeRegistry.GrantCounterBuff(WeaponTuning.CounterBuffDuration);
					}
					else
					{
						TimeController instance2 = MonoSingleton<TimeController>.Instance;
						if (instance2 != null)
						{
							instance2.ParryFlash();
						}
					}
					val2.Launch();
					CounterEnemyImpactFeedback(playHammerSound: true);
					ApplyCounterEnemyRecoil(forward);
					return;
				}
				ParryReceiver val5 = ((Component)val).GetComponent<ParryReceiver>() ?? ((Component)val).GetComponentInParent<ParryReceiver>();
				if ((Object)(object)val5 != (Object)null && ((Behaviour)val5).enabled)
				{
					EnemyIdentifier componentInParent = ((Component)val).GetComponentInParent<EnemyIdentifier>();
					val5.Parry();
					if ((Object)(object)componentInParent != (Object)null && IsNativeMeleeParryWindow(componentInParent, ((RaycastHit)(ref hit)).transform))
					{
						TriggerMeleeParry(componentInParent);
						RuntimeRegistry.GrantCounterBuff(WeaponTuning.CounterBuffDuration);
					}
					CounterEnemyImpactFeedback(playHammerSound: true);
					ApplyCounterEnemyRecoil(forward);
					return;
				}
				Grenade componentInParent2 = ((Component)val).GetComponentInParent<Grenade>();
				if ((Object)(object)componentInParent2 != (Object)null && !componentInParent2.enemy)
				{
					Vector3 val6 = defaultPos + forward * 1000f;
					if (Physics.Raycast(defaultPos, forward, ref val7, 1000f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3))))
					{
						val6 = ((RaycastHit)(ref val7)).point;
					}
					componentInParent2.GrenadeBeam(val6, ((Component)this).gameObject);
					CounterEnemyImpactFeedback(playHammerSound: true);
					return;
				}
				Landmine componentInParent3 = ((Component)val).GetComponentInParent<Landmine>();
				if ((Object)(object)componentInParent3 != (Object)null)
				{
					((Component)componentInParent3).transform.LookAt(Punch.GetParryLookTarget());
					componentInParent3.Parry();
					CounterEnemyImpactFeedback(playHammerSound: true);
					return;
				}
				Chainsaw componentInParent4 = ((Component)val).GetComponentInParent<Chainsaw>();
				if ((Object)(object)componentInParent4 != (Object)null)
				{
					componentInParent4.GetPunched();
					((Component)componentInParent4).transform.position = defaultPos + forward;
					Rigidbody rb = componentInParent4.rb;
					Vector3 val8 = Punch.GetParryLookTarget() - ((Component)componentInParent4).transform.position;
					rb.velocity = ((Vector3)(ref val8)).normalized * 105f;
					CounterEnemyImpactFeedback(playHammerSound: true);
					return;
				}
				EnemyIdentifierIdentifier componentInParent5 = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent<EnemyIdentifierIdentifier>();
				EnemyIdentifier val9 = (((Object)(object)componentInParent5 != (Object)null) ? componentInParent5.eid : ((Component)val).GetComponentInParent<EnemyIdentifier>());
				if ((Object)(object)val9 != (Object)null && !val9.dead)
				{
					Gutterman component2 = ((Component)val9).GetComponent<Gutterman>();
					bool num3 = (Object)(object)component2 != (Object)null && component2.hasShield;
					bool flag = IsNativeMeleeParryWindow(val9, ((RaycastHit)(ref hit)).transform);
					if (num3)
					{
						component2.ShieldBreak(true, false);
						AwardVanillaParry(val9);
						RuntimeRegistry.GrantCounterBuff(WeaponTuning.CounterBuffDuration);
					}
					else if (flag)
					{
						TriggerMeleeParry(val9);
						RuntimeRegistry.GrantCounterBuff(WeaponTuning.CounterBuffDuration);
					}
					bool flag2 = (int)val9.enemyType == 21 || (int)val9.enemyType == 39;
					val9.hitter = (flag2 ? "hammer" : "ebcounter");
					if (!val9.hitterWeapons.Contains("ebcounter"))
					{
						val9.hitterWeapons.Add("ebcounter");
					}
					using (RuntimeRegistry.BeginAttack())
					{
						val9.DeliverDamage(((Component)((RaycastHit)(ref hit)).collider).gameObject, forward * 50000f, ((RaycastHit)(ref hit)).point, WeaponTuning.CounterDamage, false, 0f, ((Component)this).gameObject, false, false);
					}
					CounterEnemyImpactFeedback(playHammerSound: true);
					ApplyCounterEnemyRecoil(forward);
					return;
				}
				if (LayerMaskDefaults.IsMatchingLayer(((Component)((RaycastHit)(ref hit)).collider).gameObject.layer, (LMD)1))
				{
					CounterTerrainImpactFeedback(hit, forward);
					ApplyCounterTerrainRecoil(forward);
					return;
				}
			}
			SpawnCounterImpactEffect(defaultPos + forward * 2.5f);
		}

		private void FixedUpdate()
		{
			//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)
			PlayerTracker instance = MonoSingleton<PlayerTracker>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				speedStorageAge += Time.fixedDeltaTime;
				Vector3 playerVelocity = instance.GetPlayerVelocity(false);
				float magnitude = ((Vector3)(ref playerVelocity)).magnitude;
				if (magnitude >= storedSpeed - 5f || speedStorageAge > 0.5f)
				{
					storedSpeed = magnitude;
					speedStorageAge = 0f;
				}
			}
		}

		private void UpdateJackhammerTier()
		{
			//IL_0012: 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)
			PlayerTracker instance = MonoSingleton<PlayerTracker>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			Vector3 playerVelocity = instance.GetPlayerVelocity(false);
			float num = Mathf.Min(((Vector3)(ref playerVelocity)).magnitude / 60f, 1f);
			jackhammerSpeed = Mathf.MoveTowards(jackhammerSpeed, num, Time.deltaTime * 2f);
			HookArm instance2 = MonoSingleton<HookArm>.Instance;
			if ((Object)(object)instance2 != (Object)null && instance2.beingPulled)
			{
				jackhammerSpeed = Mathf.Min(jackhammerSpeed, 0.5f);
			}
			int num2 = ((jackhammerSpeed > 0.66f) ? 2 : ((jackhammerSpeed > 0.33f) ? 1 : 0));
			if ((Object)(object)instance2 != (Object)null && instance2.beingPulled && jackhammerTier == 2)
			{
				num2 = Mathf.Min(num2, 1);
			}
			if (num2 < jackhammerTier)
			{
				tierDownAge += Time.deltaTime;
				if (tierDownAge <= 0.5f)
				{
					num2 = jackhammerTier;
				}
			}
			else
			{
				tierDownAge = 0f;
			}
			jackhammerTier = num2;
		}

		private static void CounterEnemyImpactFeedback(bool playHammerSound)
		{
			//IL_007d: 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)
			if (WeaponTuning.CounterHitstop > 0f && (Object)(object)MonoSingleton<TimeController>.Instance != (Object)null)
			{
				MonoSingleton<TimeController>.Instance.HitStop(WeaponTuning.CounterHitstop);
			}
			if ((Object)(object)MonoSingleton<CameraController>.Instance != (Object)null)
			{
				MonoSingleton<CameraController>.Instance.CameraShake(0.55f);
			}
			if (!playHammerSound)
			{
				return;
			}
			ShotgunHammer[] array = Resources.FindObjectsOfTypeAll<ShotgunHammer>();
			foreach (ShotgunHammer obj in array)
			{
				object? obj2 = HammerHitSoundField?.GetValue(obj);
				AudioSource val = (AudioSource)((obj2 is AudioSource) ? obj2 : null);
				if ((Object)(object)val != (Object)null)
				{
					Object.Instantiate<AudioSource>(val, MonoSingleton<CameraController>.Instance.GetDefaultPos(), Quaternion.identity);
					break;
				}
			}
		}

		private void CounterTerrainImpactFeedback(RaycastHit hit, Vector3 direction)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0043: 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)
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.CameraShake(0.35f);
			}
			if ((Object)(object)((RaycastHit)(ref hit)).collider != (Object)null && SceneHelper.IsStaticEnvironment(hit))
			{
				SceneHelper instance2 = MonoSingleton<SceneHelper>.Instance;
				if (instance2 != null)
				{
					instance2.CreateEnviroGibs(((RaycastHit)(ref hit)).point - direction, direction, 8f, 10, 2f);
				}
			}
			SpawnCounterImpactEffect(((RaycastHit)(ref hit)).point - ((Vector3)(ref direction)).normalized);
		}

		private void SpawnCounterImpactEffect(Vector3 position)
		{
			//IL_0048: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			CameraController instance = MonoSingleton<CameraController>.Instance;
			ShotgunHammer[] array = Resources.FindObjectsOfTypeAll<ShotgunHammer>();
			foreach (ShotgunHammer obj in array)
			{
				if (HammerHitImpactParticleField?.GetValue(obj) is GameObject[] array2 && array2.Length != 0)
				{
					GameObject val = array2[0];
					if ((Object)(object)val != (Object)null)
					{
						Object.Instantiate<GameObject>(val, position, ((Object)(object)instance != (Object)null) ? ((Component)instance).transform.rotation : Quaternion.identity);
					}
					break;
				}
			}
		}

		private void ApplyCounterEnemyRecoil(Vector3 direction)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			instance.Launch(-direction * (300f * (float)jackhammerTier + 100f), 8f, false);
			if (storedSpeed > 0f)
			{
				Vector3 velocity = instance.rb.velocity;
				if (((Vector3)(ref velocity)).magnitude < storedSpeed)
				{
					instance.rb.velocity = -((Vector3)(ref direction)).normalized * storedSpeed;
				}
			}
		}

		private void ApplyCounterTerrainRecoil(Vector3 direction)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = ((float)instance.hammerJumps + 3f) / 3f;
				instance.Launch(-direction * ((100f * (float)jackhammerTier + 300f) / num), 8f, false);
				instance.hammerJumps++;
				instance.explosionLaunchResistance = 0.5f;
			}
		}

		private static bool IsNativeMeleeParryWindow(EnemyIdentifier eid, Transform hitTransform)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			if ((Object)(object)eid == (Object)null)
			{
				return false;
			}
			if ((int)eid.enemyType == 19)
			{
				Sisyphus component = ((Component)eid).GetComponent<Sisyphus>();
				if ((Object)(object)component != (Object)null && InsurrectionistSwinging.Invoke(component))
				{
					return true;
				}
			}
			Enemy val = eid.machine ?? eid.zombie ?? eid.statue;
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)eid).GetComponent<Enemy>();
			}
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			if (val.parryable)
			{
				return true;
			}
			if (!val.partiallyParryable)
			{
				return false;
			}
			if (val.parryables != null && (Object)(object)hitTransform != (Object)null)
			{
				Transform val2 = hitTransform;
				while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)((Component)eid).transform.parent)
				{
					if (val.parryables.Contains(val2))
					{
						return true;
					}
					val2 = val2.parent;
				}
			}
			return val.parryFramesLeft > 0;
		}

		private static void TriggerMeleeParry(EnemyIdentifier eid)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			if ((Object)(object)eid == (Object)null)
			{
				return;
			}
			Enemy val = eid.machine ?? eid.zombie ?? eid.statue;
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)eid).GetComponent<Enemy>();
			}
			bool flag = false;
			if ((Object)(object)val != (Object)null)
			{
				object? obj = EnemyScriptField?.GetValue(val);
				EnemyScript val2 = (EnemyScript)((obj is EnemyScript) ? obj : null);
				if ((Object)(object)val2 != (Object)null)
				{
					DamageData val3 = new DamageData
					{
						hitTarget = (((Object)(object)val.chest != (Object)null) ? val.chest : ((Component)eid).gameObject),
						hitter = "hammerzone",
						damage = 0f,
						sourceWeapon = null,
						force = Vector3.zero,
						fromExplosion = false
					};
					val2.OnParry(ref val3, true);
					flag = val2 is SwordsMachine;
				}
				val.parryable = false;
				val.partiallyParryable = false;
				val.parryFramesLeft = 0;
				if (val.parryables != null)
				{
					val.parryables.Clear();
				}
				if ((Object)(object)val.parryChallenge != (Object)null)
				{
					val.parryChallenge.Done();
				}
			}
			AwardVanillaParry(eid);
			if (!flag)
			{
				((Component)eid).gameObject.SendMessage("GotParried", (SendMessageOptions)1);
			}
		}

		private static void AwardVanillaParry(EnemyIdentifier eid)
		{
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.Parry(eid, "");
			}
		}
	}
	internal sealed class WaterDashController : ActiveWeaponController
	{
		private ShotgunHammer hammer;

		private bool initialDrawFinished;

		private static readonly FieldRef<ShotgunHammer, bool> HammerGunReady = AccessTools.FieldRefAccess<ShotgunHammer, bool>("gunReady");

		protected override void Awake()
		{
			base.Awake();
			hammer = ((Component)this).GetComponent<ShotgunHammer>();
			ElementalJackhammerHudRegistry.Register(this, hammer, ElementId.Water);
		}

		private void OnDestroy()
		{
			ElementalJackhammerHudRegistry.Unregister(this);
		}

		protected override void OnEnable()
		{
			base.OnEnable();
			initialDrawFinished = false;
		}

		protected override void Update()
		{
			//IL_007e: 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_0086: 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_00a3: 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)
			base.Update();
			if ((Object)(object)hammer != (Object)null && !initialDrawFinished && HammerGunReady.Invoke(hammer))
			{
				initialDrawFinished = true;
			}
			if (CanUseSecondary() && SecondaryInputTiming.AllowsInstantFreshPress(initialDrawFinished))
			{
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				RuntimeAudio.PlayWaterDash(instance);
				Animator component = ((Component)this).GetComponent<Animator>();
				if (component != null)
				{
					component.Play("Fire", -1, 0f);
				}
				Vector3 forward = ((Component)MonoSingleton<CameraController>.Instance).transform.forward;
				Vector3 normalized = ((Vector3)(ref forward)).normalized;
				WaterDashRuntime waterDashRuntime = new GameObject("EB Water Dash").AddComponent<WaterDashRuntime>();
				waterDashRuntime.movement = instance;
				waterDashRuntime.direction = normalized;
				waterDashRuntime.minimumSpeed = WeaponTuning.WaterDashMinSpeed;
				waterDashRuntime.maximumSpeed = WeaponTuning.WaterDashMaxSpeed;
				StartCooldown(WeaponTuning.WaterDashCooldown);
			}
		}
	}
	internal sealed class CycloneShotgunController : ActiveWeaponController
	{
		private Shotgun shotgun;

		private Animator animator;

		private bool initialDrawFinished;

		private static readonly FieldRef<Shotgun, bool> ShotgunGunReady = AccessTools.FieldRefAccess<Shotgun, bool>("gunReady");

		protected override void Awake()
		{
			base.Awake();
			shotgun = ((Component)this).GetComponent<Shotgun>();
			animator = ((Component)this).GetComponentInChildren<Animator>();
		}

		protected override void OnEnable()
		{
			base.OnEnable();
			initialDrawFinished = false;
		}

		protected override void Update()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			base.Update();
			if ((Object)(object)shotgun != (Object)null && !initialDrawFinished && ShotgunGunReady.Invoke(shotgun))
			{
				initialDrawFinished = true;
			}
			if (!CanUseSecondary() || !SecondaryInputTiming.AllowsInstantFreshPress(initialDrawFinished))
			{
				return;
			}
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if ((Object)(object)shotgun == (Object)null || ShotgunGunReady.Invoke(shotgun))
			{
				Animator obj = animator;
				if (obj != null)
				{
					obj.Play("FireNoReload", -1, 0f);
				}
			}
			PlayerAnimations instance2 = MonoSingleton<PlayerAnimations>.Instance;
			if (instance2 != null)
			{
				instance2.Shoot(1f);
			}
			RuntimeAudio.PlaySawedOnLaunch(shotgun);
			GameObject val = new GameObject("EB Cyclone");
			val.transform.position = instance.GetDefaultPos() + ((Component)instance).transform.forward * 2f - ((Component)instance).transform.up * 1.1f;
			CycloneRuntime cycloneRuntime = val.AddComponent<CycloneRuntime>();
			cycloneRuntime.velocity = ((Component)instance).transform.forward * WeaponTuning.CycloneSpeed;
			cycloneRuntime.sourceWeapon = ((Component)this).gameObject;
			StartCooldown(WeaponTuning.CycloneCooldown);
		}
	}
	[HarmonyPatch(typeof(Shotgun), "Update")]
	internal static class ShotgunCustomAltSuppressPatch
	{
		private static readonly FieldRef<Shotgun, bool> ResettingCores = AccessTools.FieldRefAccess<Shotgun, bool>("resettingCores");

		private static readonly FieldRef<Shotgun, Slider> ChargeSlider = AccessTools.FieldRefAccess<Shotgun, Slider>("chargeSlider");

		private static void Prefix(Shotgun __instance)
		{
			ElementalSlotMarker elementalSlotMarker = MarkerUtility.Find((Component)(object)__instance);
			if (!((Object)(object)elementalSlotMarker == (Object)null) && (elementalSlotMarker.element == ElementId.Fire || elementalSlotMarker.element == ElementId.Grass || elementalSlotMarker.element == ElementId.Wind))
			{
				ResettingCores.Invoke(__instance) = true;
			}
		}

		private static void Postfix(Shotgun __instance)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			ElementalSlotMarker elementalSlotMarker = MarkerUtility.Find((Component)(object)__instance);
			if (!((Object)(object)elementalSlotMarker == (Object)null) && (elementalSlotMarker.element == ElementId.Fire || elementalSlotMarker.element == ElementId.Grass || elementalSlotMarker.element == ElementId.Wind || elementalSlotMarker.element == ElementId.Earth))
			{
				ActiveWeaponController component = ((Component)__instance).GetComponent<ActiveWeaponController>();
				Slider val = ChargeSlider.Invoke(__instance);
				if ((Object)(object)component != (Object)null && (Object)(object)val != (Object)null)
				{
					val.value = val.maxValue * component.CooldownReadyFraction;
				}
				if ((Object)(object)__instance.sliderFill != (Object)null)
				{
					((Graphic)__instance.sliderFill).color = ElementPalette.Accent(elementalSlotMarker.element);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Shotgun), "Shoot")]
	internal static class ShotgunShootPatch
	{
		private static void Postfix(Shotgun __instance)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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)
			ElementalSlotMarker elementalSlotMarker = MarkerUtility.Find((Component)(object)__instance);
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if ((Object)(object)elementalSlotMarker != (Object)null && elementalSlotMarker.element == ElementId.Grass && (Object)(object)instance != (Object)null)
			{
				CycloneRuntime.PushFromShot(instance.GetDefaultPos(), ((Component)instance).transform.forward);
			}
			if ((Object)(object)elementalSlotMarker != (Object)null && RuntimeRegistry.CounterBuffActive && (Object)(object)instance != (Object)null)
			{
				RuntimeRegistry.IgniteSporeCloudsAlongRay(instance.GetDefaultPos(), ((Component)instance).transform.forward, 20f, 5f, ((Component)__instance).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunHammer), "Update")]
	internal static class WaterJackhammerSecondarySuppressPatch
	{
		private static readonly FieldRef<ShotgunHammer, bool> AboutToSecondary = AccessTools.FieldRefAccess<ShotgunHammer, bool>("aboutToSecondary");

		private static readonly FieldRef<ShotgunHammer, Image> SecondaryMeter = AccessTools.FieldRefAccess<ShotgunHammer, Image>("secondaryMeter");

		private static void Prefix(ShotgunHammer __instance)
		{
			(((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent<ElementalJackhammerPrimaryCooldownState>() : null)?.BeginNative(__instance);
			ElementalSlotMarker elementalSlotMarker = MarkerUtility.Find((Component)(object)__instance);
			if ((Object)(object)elementalSlotMarker != (Object)null && (elementalSlotMarker.element == ElementId.Water || elementalSlotMarker.element == ElementId.Storm || elementalSlotMarker.element == ElementId.Earth))
			{
				AboutToSecondary.Invoke(__instance) = true;
			}
		}

		private static void Postfix(ShotgunHammer __instance)
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			(((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent<ElementalJackhammerPrimaryCooldownState>() : null)?.EndNative(__instance);
			ElementalSlotMarker elementalSlotMarker = MarkerUtility.Find((Component)(object)__instance);
			if (!((Object)(object)elementalSlotMarker == (Object)null) && (elementalSlotMarker.element == ElementId.Water || elementalSlotMarker.element == ElementId.Storm || elementalSlotMarker.element == ElementId.Earth))
			{
				ActiveWeaponController component = ((Component)__instance).GetComponent<ActiveWeaponController>();
				Image val = SecondaryMeter.Invoke(__instance);
				if ((Object)(object)val != (Object)null && (Object)(object)component != (Object)null)
				{
					float cooldownReadyFraction = component.CooldownReadyFraction;
					val.fillAmount = ((cooldownReadyFraction >= 0.999f) ? 1f : ((cooldownReadyFraction <= 0f) ? 0f : Mathf.Lerp(0.275f, 0.625f, cooldownReadyFraction)));
					((Graphic)val).color = ElementPalette.Accent(elementalSlotMarker.element);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunHammer), "LateUpdate")]
	internal static class ElementalJackhammerPrimaryCooldownLateUpdatePatch
	{
		private static void Prefix(ShotgunHammer __instance)
		{
			if (__instance != null)
			{
				((Component)__instance).GetComponent<ElementalJackhammerPrimaryCooldownState>()?.BeginNative(__instance);
			}
		}

		private static void Postfix(ShotgunHammer __instance)
		{
			if (__instance != null)
			{
				((Component)__instance).GetComponent<ElementalJackhammerPrimaryCooldownState>()?.EndNative(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunHammer), "DeliverDamage")]
	internal static class ElementalJackhammerPrimaryCooldownDamagePatch
	{
		private static void Prefix(ShotgunHammer __instance)
		{
			if (__instance != null)
			{
				((Component)__instance).GetComponent<ElementalJackhammerPrimaryCooldownState>()?.BeginNative(__instance);
			}
		}

		private static void Postfix(ShotgunHammer __instance)
		{
			if (__instance != null)
			{
				((Component)__instance).GetComponent<ElementalJackhammerPrimaryCooldownState>()?.EndNative(__instance);
			}
		}
	}
	internal static class RuntimeVisuals
	{
		internal static GameObject Primitive(PrimitiveType type, string name, Vector3 position, Vector3 scale, Color color, float placeholderAlpha = 0.5f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(type);
			((Object)obj).name = name;
			obj.transform.position = position;
			obj.transform.localScale = scale;
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = obj.GetComponent<Renderer>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.material = CreatePlaceholderMaterial(color, placeholderAlpha);
			}
			return obj;
		}

		internal static LineRenderer Circle(string name, Vector3 center, float radius, Color color, int points = 64)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0065: 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)
			GameObject val = new GameObject(name);
			val.transform.position = center;
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.loop = true;
			val2.useWorldSpace = false;
			val2.positionCount = Mathf.Max(12, points);
			val2.widthMultiplier = 0.09f;
			((Renderer)val2).material = CreatePlaceholderMaterial(color, 0.5f);
			color.a = 0.5f;
			val2.startColor = color;
			val2.endColor = color;
			for (int i = 0; i < val2.positionCount; i++)
			{
				float num = (float)i / (float)val2.positionCount * MathF.PI * 2f;
				val2.SetPosition(i, new Vector3(Mathf.Cos(num) * radius, 0.05f, Mathf.Sin(num) * radius));
			}
			return val2;
		}

		internal static Material CreatePlaceholderMaterial(Color color, float alpha)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Shader.Find("Unlit/Transparent") ?? Shader.Find("Legacy Shaders/Transparent/Diffuse") ?? Shader.Find("Sprites/Default") ?? (((Object)(object)MonoSingleton<DefaultReferenceManager>.Instance != (Object)null && (Object)(object)MonoSingleton<DefaultReferenceManager>.Instance.blankMaterial != (Object)null) ? MonoSingleton<DefaultReferenceManager>.Instance.blankMaterial.shader : Shader.Find("Standard")));
			color.a = Mathf.Clamp01(alpha);
			if (val.HasProperty("_MainTex"))
			{
				val.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			if (val.HasProperty("_BaseColor"))
			{
				val.SetColor("_BaseColor", color);
			}
			if (val.HasProperty("_EmissiveColor"))
			{
				val.SetColor("_EmissiveColor", color);
			}
			if (val.HasProperty("_EmissionColor"))
			{
				val.SetColor("_EmissionColor", color);
			}
			if (val.HasProperty("_Mode"))
			{
				val.SetFloat("_Mode", 3f);
			}
			if (val.HasProperty("_Surface"))
			{
				val.SetFloat("_Surface", 1f);
			}
			if (val.HasProperty("_SrcBlend"))
			{
				val.SetInt("_SrcBlend", 5);
			}
			if (val.HasProperty("_DstBlend"))
			{
				val.SetInt("_DstBlend", 10);
			}
			if (val.HasProperty("_ZWrite"))
			{
				val.SetInt("_ZWrite", 0);
			}
			val.SetOverrideTag("RenderType", "Transparent");
			val.DisableKeyword("_ALPHATEST_ON");
			val.EnableKeyword("_ALPHABLEND_ON");
			val.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			val.renderQueue = 3000;
			return val;
		}

		internal static void SetCircleRadius(LineRenderer line, float radius)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)line == (Object)null))
			{
				for (int i = 0; i < line.positionCount; i++)
				{
					float num = (float)i / (float)line.positionCount * MathF.PI * 2f;
					line.SetPosition(i, new Vector3(Mathf.Cos(num) * radius, 0.05f, Mathf.Sin(num) * radius));
				}
			}
		}

		internal static HashSet<EnemyIdentifier> EnemiesInSphere(Vector3 center, float radius)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			HashSet<EnemyIdentifier> hashSet = new HashSet<EnemyIdentifier>();
			Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)0)), (QueryTriggerInteraction)2);
			foreach (Collider val in array)
			{
				EnemyIdentifierIdentifier componentInParent = ((Component)val).GetComponentInParent<EnemyIdentifierIdentifier>();
				EnemyIdentifier val2 = (((Object)(object)componentInParent != (Object)null) ? componentInParent.eid : ((Component)val).GetComponentInParent<EnemyIdentifier>());
				if ((Object)(object)val2 != (Object)null && !val2.dead)
				{
					hashSet.Add(val2);
				}
			}
			return hashSet;
		}

		internal static Rigidbody EnemyBody(EnemyIdentifier eid)
		{
			if ((Object)(object)eid == (Object)null)
			{
				return null;
			}
			Rigidbody component = ((Component)eid).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			return ((Component)eid).GetComponentInChildren<Rigidbody>();
		}

		internal static GameObject SpawnEnemyOnlyExplosion(Vector3 position, float sizeMultiplier, int damage, GameObject sourceWeapon, bool super = false)
		{
			//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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			DefaultReferenceManager instance = MonoSingleton<DefaultReferenceManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return null;
			}
			GameObject val = (super ? instance.superExplosion : instance.explosion);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val, position, Quaternion.identity);
			Explosion[] componentsInChildren = val2.GetComponentsInChildren<Explosion>();
			foreach (Explosion obj in componentsInChildren)
			{
				obj.sourceWeapon = sourceWeapon;
				obj.hitterWeapon = "ebelemental";
				obj.canHit = (AffectedSubjects)2;
				obj.damage = damage;
				obj.maxSize *= sizeMultiplier;
				obj.speed *= sizeMultiplier;
			}
			Transform transform = val2.transform;
			transform.localScale *= sizeMultiplier;
			return val2;
		}

		internal static LineRenderer Lightning(string name, Vector3 start, Vector3 end, Color color, float width = 0.1f, int segments = 8, float jitter = 0.4f)
		{
			//IL_0001: 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_0034: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer val = new GameObject(name).AddComponent<LineRenderer>();
			val.useWorldSpace = true;
			val.loop = false;
			val.positionCount = Mathf.Max(2, segments + 1);
			val.widthMultiplier = width;
			((Renderer)val).material = CreatePlaceholderMaterial(color, color.a);
			val.startColor = color;
			Color endColor = color;
			endColor.a *= 0.45f;
			val.endColor = endColor;
			Vector3 val2 = end - start;
			Vector3 val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Vector3.down);
			Vector3 val4 = Vector3.Cross(val3, Vector3.up);
			if (((Vector3)(ref val4)).sqrMagnitude < 0.01f)
			{
				val4 = Vector3.Cross(val3, Vector3.right);
			}
			((Vector3)(ref val4)).Normalize();
			Vector3 val5 = Vector3.Cross(val3, val4);
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			for (int i = 0; i < val.positionCount; i++)
			{
				float num = (float)i / (float)(val.positionCount - 1);
				Vector3 val6 = Vector3.Lerp(start, end, num);
				if (i > 0 && i < val.positionCount - 1)
				{
					float num2 = Mathf.Sin(num * MathF.PI);
					val6 += (val4 * Random.Range(0f - jitter, jitter) + normalized * Random.Range(0f - jitter, jitter)) * num2;
				}
				val.SetPosition(i, val6);
			}
			return val;
		}
	}
	internal sealed class FireColumnRuntime : MonoBehaviour
	{
		public GameObject sourceWeapon;

		public float damageMultiplier = 1f;

		private float age;

		private float tick;

		private GameObject visual;

		private int attackId;

		private readonly HashSet<EnemyIdentifier> launched = new HashSet<EnemyIdentifier>();

		private void Start()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0058: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			attackId = RuntimeRegistry.NewAttackId();
			visual = RuntimeVisuals.Primitive((PrimitiveType)2, "Fire Column Visual", ((Component)this).transform.position + Vector3.up * (WeaponTuning.FireColumnHeight * 0.5f), new Vector3(WeaponTuning.FireColumnRadius * 2f, WeaponTuning.FireColumnHeight * 0.5f, WeaponTuning.FireColumnRadius * 2f), new Color(1f, 0.18f, 0.02f, 0.55f));
			RuntimeRegistry.IgniteSporeClouds(((Component)this).transform.position + Vector3.up * 3f, 6f, sourceWeapon);
		}

		private void Update()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			tick -= Time.deltaTime;
			if (tick <= 0f)
			{
				tick = WeaponTuning.FireColumnTick;
				using (RuntimeRegistry.BeginAttack(attackId))
				{
					Vector3 val = ((Component)this).transform.position + Vector3.up * 0.1f;
					Vector3 val2 = ((Component)this).transform.position + Vector3.up * WeaponTuning.FireColumnHeight;
					Collider[] array = Physics.OverlapCapsule(val, val2, WeaponTuning.FireColumnRadius, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)0)), (QueryTriggerInteraction)2);
					HashSet<EnemyIdentifier> hashSet = new HashSet<EnemyIdentifier>();
					Collider[] array2 = array;
					foreach (Collider val3 in array2)
					{
						EnemyIdentifierIdentifier componentInParent = ((Component)val3).GetComponentInParent<EnemyIdentifierIdentifier>();
						EnemyIdentifier val4 = (((Object)(object)componentInParent != (Object)null) ? componentInParent.eid : ((Component)val3).GetComponentInParent<EnemyIdentifier>());
						if ((Object)(object)val4 != (Object)null && !val4.dead)
						{
							hashSet.Add(val4);
						}
					}
					foreach (EnemyIdentifier item in hashSet)
					{
						item.hitter = "ebfirecolumn";
						item.DeliverDamage(((Component)item).gameObject, Vector3.up * 1600f, item.bodyTransform.position, WeaponTuning.FireColumnDamage * damageMultiplier, false, 0f, sourceWeapon, false, false);
						if (!item.bigEnemy && launched.Add(item))
						{
							Rigidbody val5 = RuntimeVisuals.EnemyBody(item);
							if ((Object)(object)val5 != (Object)null)
							{
								val5.AddForce(Vector3.up * 8f, (ForceMode)2);
							}
						}
					}
				}
			}
			if (age >= WeaponTuning.FireColumnLifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)visual != (Object)null)
			{
				Object.Destroy((Object)(object)visual);
			}
		}
	}
	internal sealed class VineAnchorRuntime : MonoBehaviour
	{
		public GameObject sourceWeapon;

		public EnemyIdentifier anchorEnemy;

		private float age;

		private GameObject visual;

		private LineRenderer ring;

		private readonly HashSet<EnemyIdentifier> captured = new HashSet<EnemyIdentifier>();

		private void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			visual = RuntimeVisuals.Primitive((PrimitiveType)0, "Vine Anchor Visual", ((Component)this).transform.position, Vector3.one * 0.7f, new Color(0.1f, 0.85f, 0.15f, 0.8f));
			if ((Object)(object)visual != (Object)null)
			{
				visual.transform.SetParent(((Component)this).transform, true);
			}
			ring = RuntimeVisuals.Circle("Vine Closing Ring", ((Component)this).transform.position, WeaponTuning.VineStartRadius, new Color(0.15f, 1f, 0.2f, 0.9f));
			foreach (EnemyIdentifier item in RuntimeVisuals.EnemiesInSphere(((Object)(object)anchorEnemy != (Object)null) ? anchorEnemy.bodyTransform.position : ((Component)this).transform.position, WeaponTuning.VineStartRadius))
			{
				if ((Object)(object)item != (Object)(object)anchorEnemy && !IsRopePullExcluded(item))
				{
					captured.Add(item);
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_005a: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			age += Time.fixedDeltaTime;
			if ((Object)(object)anchorEnemy != (Object)null && anchorEnemy.dead)
			{
				anchorEnemy = null;
			}
			Vector3 val = (((Object)(object)anchorEnemy != (Object)null) ? anchorEnemy.bodyTransform.position : ((Component)this).transform.position);
			if ((Object)(object)ring != (Object)null)
			{
				((Component)ring).transform.position = val;
			}
			bool flag = age < WeaponTuning.VinePullDuration;
			float num = Mathf.Clamp01(age / WeaponTuning.VinePullDuration);
			float num2 = Mathf.Lerp(WeaponTuning.VineStartRadius, WeaponTuning.VineEndRadius, Mathf.SmoothStep(0f, 1f, num));
			RuntimeVisuals.SetCircleRadius(ring, num2);
			captured.RemoveWhere((EnemyIdentifier eid) => (Object)(object)eid == (Object)null || eid.dead || IsRopePullExcluded(eid));
			foreach (EnemyIdentifier item in captured)
			{
				Rigidbody val2 = RuntimeVisuals.EnemyBody(item);
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				Vector3 val3 = val - item.bodyTransform.position;
				float magnitude = ((Vector3)(ref val3)).magnitude;
				if (magnitude <= 0.35f)
				{
					val2.velocity = Vector3.Lerp(val2.velocity, Vector3.zero, 0.7f);
					continue;
				}
				val2.WakeUp();
				Vector3 val4 = val3 / magnitude;
				if (flag)
				{
					float num3 = Mathf.Lerp(WeaponTuning.VineMinPullSpeed, WeaponTuning.VineMaxPullSpeed, Mathf.Clamp01(magnitude / WeaponTuning.VineStartRadius));
					Vector3 val5 = val2.velocity;
					float num4 = Vector3.Dot(val5, val4);
					if (num4 < num3)
					{
						val5 += val4 * (num3 - num4);
					}
					val2.velocity = val5;
					float num5 = magnitude - num2;
					if (num5 > 0f)
					{
						Vector3 val6 = val4 * num5;
						if (val2.isKinematic)
						{
							val2.position += val6;
						}
						else
						{
							val2.MovePosition(val2.position + val6);
						}
					}
				}
				else if (magnitude > WeaponTuning.VineEndRadius)
				{
					float num6 = Mathf.Min(24f, Mathf.Max(WeaponTuning.VineMinPullSpeed, magnitude * 8f));
					float num7 = Vector3.Dot(val2.velocity, val4);
					if (num7 < num6)
					{
						val2.velocity += val4 * (num6 - num7);
					}
					float num8 = magnitude - WeaponTuning.VineEndRadius;
					if (num8 > 0f)
					{
						Vector3 val7 = val4 * num8;
						if (val2.isKinematic)
						{
							val2.position += val7;
						}
						else
						{
							val2.MovePosition(val2.position + val7);
						}
					}
				}
				else
				{
					val2.velocity = Vector3.Lerp(val2.velocity, Vector3.zero, 0.82f);
				}
			}
			if (age >= WeaponTuning.VinePullDuration + WeaponTuning.VineHoldDuration)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private static bool IsRopePullExcluded(EnemyIdentifier enemy)
		{
			//IL_001c: 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_0022: 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_002a: Invalid comparison between Unknown and I4
			//IL_002f: 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_00b8: Expected I4, but got Unknown
			if ((Object)(object)enemy == (Object)null || enemy.stationary || enemy.bigEnemy)
			{
				return true;
			}
			EnemyType enemyType = enemy.enemyType;
			if ((int)enemyType != 0 && (int)enemyType != 2)
			{
				switch (enemyType - 11)
				{
				case 0:
				case 5:
				case 6:
				case 7:
				case 8:
				case 10:
				case 16:
				case 17:
				case 18:
				case 19:
				case 21:
				case 22:
				case 23:
				case 24:
				case 27:
				case 28:
				case 29:
				case 31:
					break;
				default:
					return false;
				}
			}
			return true;
		}

		private void OnDestroy()
		{
			if ((Object)(object)visual != (Object)null)
			{
				Object.Destroy((Object)(object)visual);
			}
			if ((Object)(object)ring != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)ring).gameObject);
			}
		}
	}
	internal sealed class CycloneRuntime : MonoBehaviour
	{
		internal static readonly HashSet<CycloneRuntime> Active = new HashSet<CycloneRuntime>();

		public Vector3 velocity;

		public GameObject sourceWeapon;

		private float age;

		private float tick;

		private int attackId;

		private GameObject visual;

		private void Start()
		{
			//IL_0024: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			attackId = RuntimeRegistry.NewAttackId();
			Active.Add(this);
			visual = RuntimeVisuals.Primitive((PrimitiveType)2, "Cyclone Visual", ((Component)this).transform.position, new Vector3(WeaponTuning.CycloneRadius * 1.1f, 4f, WeaponTuning.CycloneRadius * 1.1f), new Color(0.35f, 0.95f, 0.25f, 1f), 1f);
		}

		private void Update()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_00c1: 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_00fa: Invalid comparison between Unknown and I4
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_017b: 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_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			Transform transform = ((Component)this).transform;
			transform.position += velocity * Time.deltaTime;
			if ((Object)(object)visual != (Object)null)
			{
				visual.transform.position = ((Component)this).transform.position;
				visual.transform.Rotate(Vector3.up, 420f * Time.deltaTime, (Space)0);
			}
			tick -= Time.deltaTime;
			if (tick <= 0f)
			{
				tick = 0.2f;
				using (RuntimeRegistry.BeginAttack(attackId))
				{
					foreach (EnemyIdentifier item in RuntimeVisuals.EnemiesInSphere(((Component)this).transform.position, WeaponTuning.CycloneRadius))
					{
						item.hitter = "ebcyclone";
						float num = WeaponTuning.CycloneDamage * (((int)item.enemyType == 3) ? 2f : 1f);
						item.DeliverDamage(((Component)item).gameObject, ((Vector3)(ref velocity)).normalized * 1500f + Vector3.up * 2200f, item.bodyTransform.position, num, false, 0f, sourceWeapon, false, false);
						if (!item.bigEnemy)
						{
							Rigidbody val = RuntimeVisuals.EnemyBody(item);
							if ((Object)(object)val != (Object)null)
							{
								val.AddForce(((Vector3)(ref velocity)).normalized * 6f + Vector3.up * 10f, (ForceMode)2);
							}
						}
					}
				}
				Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 3f, 16384, (QueryTriggerInteraction)2);
				for (int i = 0; i < array.Length; i++)
				{
					Projectile componentInParent = ((Component)array[i]).GetComponentInParent<Projectile>();
					if ((Object)(object)componentInParent != (Object)null && !componentInParent.playerBullet && componentInParent.breakable)
					{
						componentInParent.Break();
					}
				}
			}
			if (age >= WeaponTuning.CycloneLifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		internal static void PushFromShot(Vector3 origin, Vector3 direction)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0044: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			CycloneRuntime[] array = new CycloneRuntime[Active.Count];
			Active.CopyTo(array);
			CycloneRuntime[] array2 = array;
			foreach (CycloneRuntime cycloneRuntime in array2)
			{
				if ((Object)(object)cycloneRuntime == (Object)null)
				{
					continue;
				}
				Vector3 val = ((Component)cycloneRuntime).transform.position - origin;
				float num = Vector3.Dot(val, direction);
				if (!(num < 0f) && !(num > 45f))
				{
					Vector3 val2 = Vector3.Cross(((Vector3)(ref direction)).normalized, val);
					if (!(((Vector3)(ref val2)).magnitude > 5f))
					{
						cycloneRuntime.velocity = Vector3.Lerp(cycloneRuntime.velocity, ((Vector3)(ref direction)).normalized * WeaponTuning.CycloneSpeed, 0.65f);
					}
				}
			}
		}

		private void OnDestroy()
		{
			Active.Remove(this);
			if ((Object)(object)visual != (Object)null)
			{
				Object.Destroy((Object)(object)visual);
			}
		}
	}
	internal sealed class PoisonSeedStatus : MonoBehaviour
	{
		public float remaining = 8f;

		private GameObject visual;

		private EnemyIdentifier eid;

		private bool counted;

		private static int liveCount;

		internal bool IsLive
		{
			get
			{
				if ((Object)(object)eid != (Object)null && !eid.dead)
				{
					return remaining > 0f;
				}
				return false;
			}
		}

		internal static bool AnyLive => liveCount > 0;

		private void OnEnable()
		{
			if (!counted)
			{
				counted = true;
				liveCount++;
			}
		}

		private void Start()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			eid = ((Component)this).GetComponent<EnemyIdentifier>();
			visual = RuntimeVisuals.Primitive((PrimitiveType)0, "Poison Seed Attached", ((Component)this).transform.position, Vector3.one * 0.65f, new Color(0.35f, 1f, 0.2f, 0.8f));
			if ((Object)(object)visual != (Object)null)
			{
				visual.transform.SetParent(((Component)this).transform, true);
				visual.transform.localPosition = Vector3.up * 0.8f;
			}
		}

		private void Update()
		{
			if ((Object)(object)eid == (Object)null || eid.dead)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			remaining -= Time.deltaTime;
			if (remaining <= 0f)
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void OnDisable()
		{
			if (counted)
			{
				counted = false;
				liveCount = Mathf.Max(0, liveCount - 1);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)visual != (Object)null)
			{
				Object.Destroy((Object)(object)visual);
			}
		}
	}
	internal sealed class PoisonOrbRuntime : MonoBehaviour
	{
		public GameObject sourceWeapon;

		public Vector3 direction;

		private GameObject visual;

		private float age;

		private Vector3 previousPosition;

		private const float Radius = 0.35f;

		private static readonly RaycastHit[] HitBuffer = (RaycastHit[])(object)new RaycastHit[24];

		private void Start()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0031: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			if (((Vector3)(ref direction)).sqrMagnitude < 0.001f)
			{
				direction = (((Object)(object)MonoSingleton<CameraController>.Instance != (Object)null) ? ((Component)MonoSingleton<CameraController>.Instance).transform.forward : Vector3.forward);
			}
			((Vector3)(ref direction)).Normalize();
			previousPosition = ((Component)this).transform.position;
			visual = RuntimeVisuals.Primitive((PrimitiveType)0, "Poison Orb Visual", ((Component)this).transform.position, Vector3.one * 0.45f, new Color(0.4f, 0.95f, 0.15f, 0.85f));
		}

		private void Update()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			Vector3 val = ((Component)this).transform.position + direction * WeaponTuning.PoisonOrbSpeed * Time.deltaTime;
			Vector3 val2 = val - previousPosition;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			if (magnitude > 0.001f)
			{
				int num = Physics.SphereCastNonAlloc(previousPosition, 0.35f, ((Vector3)(ref val2)).normalized, HitBuffer, magnitude, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3)), (QueryTriggerInteraction)2);
				float num2 = float.PositiveInfinity;
				EnemyIdentifier val3 = null;
				bool flag = false;
				for (int i = 0; i < num; i++)
				{
					RaycastHit val4 = HitBuffer[i];
					if (!((Object)(object)((RaycastHit)(ref val4)).collider == (Object)null) && !(((RaycastHit)(ref val4)).distance >= num2))
					{
						EnemyIdentifierIdentifier componentInParent = ((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<EnemyIdentifierIdentifier>();
						EnemyIdentifier val5 = (((Object)(object)componentInParent != (Object)null) ? componentInParent.eid : ((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<EnemyIdentifier>());
						bool flag2 = LayerMaskDefaults.IsMatchingLayer(((Component)((RaycastHit)(ref val4)).collider).gameObject.layer, (LMD)1);
						if ((!((Object)(object)val5 == (Object)null) && !val5.dead) || flag2)
						{
							num2 = ((RaycastHit)(ref val4)).distance;
							val3 = (((Object)(object)val5 != (Object)null && !val5.dead) ? val5 : null);
							flag = true;
						}
					}
				}
				if (flag)
				{
					if ((Object)(object)val3 != (Object)null)
					{
						Attach(val3);
					}
					else
					{
						Object.Destroy((Object)(object)((Component)this).gameObject);
					}
					return;
				}
			}
			((Component)this).transform.position = val;
			previousPosition = val;
			if ((Object)(object)visual != (Object)null)
			{
				visual.transform.position = ((Component)this).transform.position;
			}
			if (age >= WeaponTuning.PoisonOrbLifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void Attach(EnemyIdentifier target)
		{
			PoisonSeedStatus poisonSeedStatus = ((Component)target).GetComponent<PoisonSeedStatus>();
			if ((Object)(object)poisonSeedStatus == (Object)null)
			{
				poisonSeedStatus = ((Component)target).gameObject.AddComponent<PoisonSeedStatus>();
			}
			poisonSeedStatus.remaining = WeaponTuning.PoisonSeedLifetime;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void OnDestroy()
		{
			if ((Object)(object)visual != (Object)null)
			{
				Object.Destroy((Object)(object)visual);
			}
		}
	}
	internal sealed class PoisonStatus : MonoBehaviour
	{
		private EnemyIdentifier eid;

		private GameObject sourceWeapon;

		private float remaining;

		private float potency;

		private float tick;

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

		internal void Add(GameObject source, float duration, float potencyAdd)
		{
			sourceWeapon = source ?? sourceWeapon;
			remaining = Mathf.Min(10f, remaining + duration);
			potency = Mathf.Clamp(potency + potencyAdd, 0.25f, Mathf.Max(0.25f, WeaponTuning.PoisonMaxPotency));
		}

		private void Update()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)eid == (Object)null || eid.dead)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			remaining -= Time.deltaTime;
			tick -= Time.deltaTime;
			potency = Mathf.Clamp(potency, 0.25f, Mathf.Max(0.25f, WeaponTuning.PoisonMaxPotency));
			if (tick <= 0f)
			{
				tick = 0.5f;
				eid.hitter = "ebpoison";
				eid.DeliverDamage(((Component)eid).gameObject, Vector3.zero, eid.bodyTransform.position, potency, false, 0f, sourceWeapon, false, false);
			}
			if (remaining <= 0f)
			{
				Object.Destroy((Object)(object)this);
			}
		}

		internal static void Apply(EnemyIdentifier eid, GameObject source, float duration = 2f, float potencyAdd = 0.08f)
		{
			if (!((Object)(object)eid == (Object)null) && !eid.dead)
			{
				PoisonStatus poisonStatus = ((Component)eid).GetComponent<PoisonStatus>();
				if ((Object)(object)poisonStatus == (Object)null)
				{
					poisonStatus = ((Component)eid).gameObject.AddComponent<PoisonStatus>();
				}
				poisonStatus.Add(source, duration, potencyAdd);
			}
		}
	}
	internal sealed class WaterDashRuntime : MonoBehaviour
	{
		public NewMovement movement;

		public Vector3 direction;

		public float minimumSpeed = 40f;

		public float maximumSpeed = 55f;

		private Vector3 dashVelocity;

		private int fixedFrames;

		private void Start()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_00a0: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)movement == (Object)null || (Object)(object)movement.rb == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Vector3 val = ((((Vector3)(ref direction)).sqrMagnitude > 0.001f) ? ((Vector3)(ref direction)).normalized : ((Component)movement).transform.forward);
			Vector3 val2 = movement.rb.velocity;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			float num = Mathf.Clamp(Mathf.Max(minimumSpeed, magnitude), minimumSpeed, Mathf.Max(minimumSpeed, maximumSpeed));
			dashVelocity = val * num;
			movement.Launch(val, 0.01f, true);
			movement.rb.velocity = dashVelocity;
			Transform transform = ((Component)movement).transform;
			Vector3 position = transform.position;
			val2 = PhysicsExtensions.GetGravityDirection(movement.rb);
			transform.position = position + -((Vector3)(ref val2)).normalized * 0.06f;
			movement.windState = Mathf.Max(movement.windState, 0.18f);
		}

		private void FixedUpdate()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)movement == (Object)null || (Object)(object)movement.rb == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else if (fixedFrames < 2)
			{
				movement.rb.velocity = dashVelocity;
				fixedFrames++;
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal sealed class GeyserRuntime : MonoBehaviour
	{
		public GameObject sourceWeapon;

		public Vector3 up = Vector3.up;

		private float age;

		private GameObject visual;

		private bool launchedPlayer;

		public bool playerAlreadyLaunched;

		public bool allowPlayerLaunch = true;

		private readonly HashSet<EnemyIdentifier> launchedEnemies = new HashSet<EnemyIdentifier>();

		private void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			visual = RuntimeVisuals.Primitive((PrimitiveType)2, "Geyser Visual", ((Component)this).transform.position + up * 4f, new Vector3(5f, 4f, 5f), new Color(0.15f, 0.65f, 1f, 0.4f));
		}

		private void FixedUpdate()
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_007d: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0104: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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)
			age += Time.fixedDeltaTime;
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			if (playerAlreadyLaunched)
			{
				launchedPlayer = true;
			}
			if (allowPlayerLaunch && !launchedPlayer && (Object)(object)instance != (Object)null)
			{
				Vector3 val = ((Component)instance).transform.position - ((Component)this).transform.position;
				float num = Vector3.Dot(val, up);
				Vector3 val2 = val - up * num;
				if (num >= -1f && num <= 6f && ((Vector3)(ref val2)).magnitude <= 3.25f)
				{
					Vector3 velocity = instance.rb.velocity;
					float num2 = Vector3.Dot(velocity, up);
					instance.rb.velocity = Vector3.ProjectOnPlane(velocity, up) + up * Mathf.Max(WeaponTuning.GeyserPlayerSpeed, num2);
					Transform transform = ((Component)instance).transform;
					transform.position += up * 0.08f;
					RuntimeAudio.PlayBoostPadLaunch(instance);
					launchedPlayer = true;
				}
			}
			foreach (EnemyIdentifier item in RuntimeVisuals.EnemiesInSphere(((Component)this).transform.position + up * 4f, 6f))
			{
				if (!item.bigEnemy && launchedEnemies.Add(item))
				{
					Rigidbody val3 = RuntimeVisuals.EnemyBody(item);
					if ((Object)(object)val3 != (Object)null)
					{
						val3.AddForce(up * WeaponTuning.GeyserEnemySpeed, (ForceMode)2);
					}
				}
			}
			if (age >= WeaponTuning.GeyserLifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)visual != (Object)null)
			{
				Object.Destroy((Object)(object)visual);
			}
		}
	}
	internal enum ElementId
	{
		None = -1,
		Vanilla,
		Fire,
		Water,
		Grass,
		Wind,
		Storm,
		Earth,
		Lava,
		Ice,
		Nature,
		Sand,
		Metal,
		Plasma,
		Crystal,
		Spirit,
		Sound,
		Light,
		Darkness,
		Gravity,
		Explosion,
		Technology,
		Phoenix,
		Dragon,
		Acid,
		Aurora,
		Nightmare,
		Time,
		Void,
		Spectrum,
		Chaos,
		Angel,
		Space,
		Reaper,
		Illusion,
		Slime,
		Creation,
		Solar,
		Physical,
		PhysicalAlt,
		Sans
	}
	internal enum WeaponFamily
	{
		Revolver,
		Shotgun,
		Rapid,
		Ultimate,
		Explosive
	}
	internal sealed class ElementalSlotMarker : MonoBehaviour
	{
		public ElementId element;

		public string elementId;

		public WeaponFamily family;

		public int position;

		public string choiceId;

		public string choiceName;

		public ExplosiveIntegrationMode explosiveMode;

		public bool hasVanillaTemplate;

		public VanillaWeaponTemplate vanillaTemplate;

		public bool IsCustom
		{
			get
			{
				if (string.IsNullOrEmpty(elementId))
				{
					if (element != ElementId.Vanilla)
					{
						return element != ElementId.None;
					}
					return false;
				}
				return true;
			}
		}

		public bool IsEmpty
		{
			get
			{
				if (string.IsNullOrEmpty(elementId))
				{
					return element == ElementId.None;
				}
				return false;
			}
		}
	}
	internal static class MarkerUtility
	{
		internal static ElementalSlotMarker Find(Component component)
		{
			if ((Object)(object)component == (Object)null)
			{
				return null;
			}
			ElementalSlotMarker component2 = component.GetComponent<ElementalSlotMarker>();
			if ((Object)(object)component2 != (Object)null)
			{
				return component2;
			}
			return component.GetComponentInParent<ElementalSlotMarker>();
		}

		internal static ElementalSlotMarker Find(GameObject gameObject)
		{
			if ((Object)(object)gameObject == (Object)null)
			{
				return null;
			}
			ElementalSlotMarker component = gameObject.GetComponent<ElementalSlotMarker>();
			if ((Object)(object)component != (Object)null)
			{
				return component;
			}
			return gameObject.GetComponentInPa