Decompiled source of EnemyAbilities v1.9.0

plugins/EnemyAbilities.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnemyAbilities.Abilities;
using EntityStates;
using EntityStates.MajorConstruct.Weapon;
using EntityStates.Vulture;
using Grumpy;
using HarmonyLib;
using IL.RoR2;
using IL.RoR2.Projectile;
using JetBrains.Annotations;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using Rewired.ComponentControls.Effects;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Scripts.GameBehaviors;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EnemyAbilities")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b0c3ec8d853d694e14a0babdc8e53df95c815a8a")]
[assembly: AssemblyProduct("EnemyAbilities")]
[assembly: AssemblyTitle("EnemyAbilities")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EnemyAbilities
{
	public static class EnemiesPlusUtils
	{
		public class ProjectileDetonateOnImpact : ProjectileExplosion, IProjectileImpactBehavior
		{
			public enum TransformSpace
			{
				World,
				Local,
				Normal
			}

			private Vector3 impactNormal = Vector3.up;

			public GameObject impactEffect;

			public NetworkSoundEventDef lifetimeExpiredSound;

			public float offsetForLifetimeExpiredSound;

			public bool destroyOnEnemy = true;

			public bool detonateOnEnemy;

			public bool detonateOnWorld;

			public bool destroyOnWorld;

			public bool destroyOnDistance;

			public float maxDistance;

			private float maxDistanceSqr;

			public bool impactOnWorld = true;

			public bool timerAfterImpact;

			public float lifetime;

			public float lifetimeAfterImpact;

			public float lifetimeRandomOffset;

			private float stopwatch;

			public uint minimumPhysicsStepsToKeepAliveAfterImpact;

			private float stopwatchAfterImpact;

			private bool hasImpact;

			private bool hasPlayedLifetimeExpiredSound;

			public TransformSpace transformSpace;

			private Vector3 startPos;

			public bool explodeOnLifeTimeExpiration;

			public bool nullifyExplosions = false;

			public override void Awake()
			{
				((ProjectileExplosion)this).Awake();
				lifetime += Random.Range(0f, lifetimeRandomOffset);
			}

			protected void Start()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				startPos = ((Component)this).transform.position;
				maxDistanceSqr = maxDistance * maxDistance;
			}

			protected void FixedUpdate()
			{
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_0226: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				stopwatch += Time.fixedDeltaTime;
				if (!NetworkServer.active && !base.projectileController.isPrediction)
				{
					return;
				}
				if (explodeOnLifeTimeExpiration && base.alive && stopwatch >= lifetime)
				{
					base.explosionEffect = impactEffect ?? base.explosionEffect;
					if (!nullifyExplosions)
					{
						((ProjectileExplosion)this).Detonate();
					}
				}
				if (timerAfterImpact && hasImpact)
				{
					stopwatchAfterImpact += Time.fixedDeltaTime;
				}
				bool flag = stopwatch >= lifetime;
				bool flag2 = timerAfterImpact && stopwatchAfterImpact > lifetimeAfterImpact;
				bool flag3 = Object.op_Implicit((Object)(object)base.projectileHealthComponent) && !base.projectileHealthComponent.alive;
				bool flag4 = false;
				if (destroyOnDistance)
				{
					Vector3 val = ((Component)this).transform.position - startPos;
					if (((Vector3)(ref val)).sqrMagnitude >= maxDistanceSqr)
					{
						flag4 = true;
					}
				}
				if (flag || flag2 || flag3 || flag4)
				{
					base.alive = false;
				}
				if (timerAfterImpact && hasImpact && minimumPhysicsStepsToKeepAliveAfterImpact != 0)
				{
					minimumPhysicsStepsToKeepAliveAfterImpact--;
					base.alive = true;
				}
				if (base.alive && !hasPlayedLifetimeExpiredSound)
				{
					bool flag5 = stopwatch > lifetime - offsetForLifetimeExpiredSound;
					if (timerAfterImpact)
					{
						flag5 |= stopwatchAfterImpact > lifetimeAfterImpact - offsetForLifetimeExpiredSound;
					}
					if (flag5)
					{
						hasPlayedLifetimeExpiredSound = true;
						if (NetworkServer.active && Object.op_Implicit((Object)(object)lifetimeExpiredSound))
						{
							PointSoundManager.EmitSoundServer(lifetimeExpiredSound.index, ((Component)this).transform.position);
						}
					}
				}
				if (!base.alive)
				{
					base.explosionEffect = impactEffect ?? base.explosionEffect;
					if (!nullifyExplosions)
					{
						((ProjectileExplosion)this).Detonate();
					}
				}
			}

			public override Quaternion GetRandomDirectionForChild()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				//IL_0058: 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_004d: Unknown result type (might be due to invalid IL or missing references)
				Quaternion randomChildRollPitch = ((ProjectileExplosion)this).GetRandomChildRollPitch();
				TransformSpace transformSpace = this.transformSpace;
				if (1 == 0)
				{
				}
				Quaternion result = (Quaternion)(transformSpace switch
				{
					TransformSpace.Local => ((Component)this).transform.rotation * randomChildRollPitch, 
					TransformSpace.Normal => Quaternion.FromToRotation(Vector3.forward, impactNormal) * randomChildRollPitch, 
					_ => randomChildRollPitch, 
				});
				if (1 == 0)
				{
				}
				return result;
			}

			public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
			{
				//IL_0026: 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_002f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: 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_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_00fd: 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_0107: 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_0118: 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_013a: Unknown result type (might be due to invalid IL or missing references)
				if (nullifyExplosions || !base.alive)
				{
					return;
				}
				Collider collider = impactInfo.collider;
				impactNormal = impactInfo.estimatedImpactNormal;
				if (!Object.op_Implicit((Object)(object)collider))
				{
					return;
				}
				DamageInfo val = new DamageInfo();
				if (Object.op_Implicit((Object)(object)base.projectileDamage))
				{
					val.damage = base.projectileDamage.damage;
					val.crit = base.projectileDamage.crit;
					val.attacker = (Object.op_Implicit((Object)(object)base.projectileController.owner) ? base.projectileController.owner.gameObject : null);
					val.inflictor = ((Component)this).gameObject;
					val.damageType = base.projectileDamage.damageType;
					val.inflictor = ((Component)this).gameObject;
					val.position = impactInfo.estimatedPointOfImpact;
					val.force = base.projectileDamage.force * ((Component)this).transform.forward;
					val.procChainMask = base.projectileController.procChainMask;
					val.procCoefficient = base.projectileController.procCoefficient;
					val.damageType = base.projectileDamage.damageType;
				}
				HurtBox component = ((Component)collider).GetComponent<HurtBox>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (destroyOnEnemy)
					{
						HealthComponent healthComponent = component.healthComponent;
						if (Object.op_Implicit((Object)(object)healthComponent))
						{
							if ((Object)(object)((Component)healthComponent).gameObject == (Object)(object)base.projectileController.owner || (Object.op_Implicit((Object)(object)base.projectileHealthComponent) && (Object)(object)healthComponent == (Object)(object)base.projectileHealthComponent))
							{
								return;
							}
							base.alive = false;
						}
					}
					else if (detonateOnEnemy)
					{
						HealthComponent healthComponent2 = component.healthComponent;
						if (Object.op_Implicit((Object)(object)healthComponent2) && (Object)(object)((Component)healthComponent2).gameObject != (Object)(object)base.projectileController.owner && (Object)(object)healthComponent2 != (Object)(object)base.projectileHealthComponent)
						{
							((ProjectileExplosion)this).DetonateNoDestroy();
						}
					}
				}
				else if (detonateOnWorld)
				{
					((ProjectileExplosion)this).DetonateNoDestroy();
				}
				else if (destroyOnWorld)
				{
					base.alive = false;
				}
				hasImpact = Object.op_Implicit((Object)(object)component) || impactOnWorld;
				if (NetworkServer.active && hasImpact)
				{
					GlobalEventManager.instance.OnHitAll(val, ((Component)collider).gameObject);
				}
			}
		}

		public static void ReorderSkillDrivers(this GameObject master, AISkillDriver targetSkill, int targetIdx)
		{
			AISkillDriver[] components = master.GetComponents<AISkillDriver>();
			master.ReorderSkillDrivers(components, Array.IndexOf(components, targetSkill), targetIdx);
		}

		public static void ReorderSkillDrivers(this GameObject master, AISkillDriver[] skills, int currentIdx, int targetIdx)
		{
			if (currentIdx < 0 || currentIdx >= skills.Length)
			{
				Log.Error($"{currentIdx} index not found or out of range. Must be less than {skills.Length}");
				return;
			}
			string targetName = skills[currentIdx].customName;
			if (targetIdx < 0 || targetIdx >= skills.Length)
			{
				Log.Error($"Unable to reorder skilldriver {targetName} into position {targetIdx}. target must be less than {skills.Length}");
				return;
			}
			if (targetIdx == currentIdx)
			{
				Log.Warning($"Skilldriver {targetName} already has the target index of {targetIdx}");
				return;
			}
			Dictionary<string, string> dictionary = skills.Where((AISkillDriver s) => (Object)(object)s.nextHighPriorityOverride != (Object)null).ToDictionary((AISkillDriver s) => s.customName, (AISkillDriver s) => s.nextHighPriorityOverride.customName);
			if (targetIdx > currentIdx)
			{
				master.AddComponentCopy<AISkillDriver>(skills[currentIdx]);
				Object.DestroyImmediate((Object)(object)skills[currentIdx]);
			}
			for (int i = targetIdx; i < skills.Length; i++)
			{
				if (i != currentIdx)
				{
					master.AddComponentCopy<AISkillDriver>(skills[i]);
					Object.DestroyImmediate((Object)(object)skills[i]);
				}
			}
			skills = master.GetComponents<AISkillDriver>();
			AISkillDriver val = ((IEnumerable<AISkillDriver>)skills).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == targetName));
			if (!dictionary.Any())
			{
				return;
			}
			foreach (AISkillDriver val2 in skills)
			{
				if (Object.op_Implicit((Object)(object)val2) && dictionary.TryGetValue(val2.customName, out var target))
				{
					AISkillDriver val3 = ((IEnumerable<AISkillDriver>)skills).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == target));
					if (!((Object)(object)val3 == (Object)null))
					{
						val2.nextHighPriorityOverride = val3;
					}
				}
			}
		}

		public static T GetCopyOf<T>(this Component comp, T other) where T : Component
		{
			Type type = ((object)comp).GetType();
			if (type != ((object)other).GetType())
			{
				return default(T);
			}
			BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			PropertyInfo[] properties = type.GetProperties(bindingAttr);
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				if (propertyInfo.CanWrite)
				{
					try
					{
						propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
					}
					catch
					{
					}
				}
			}
			FieldInfo[] fields = type.GetFields(bindingAttr);
			FieldInfo[] array2 = fields;
			foreach (FieldInfo fieldInfo in array2)
			{
				fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		public static T AddComponentCopy<T>(this GameObject go, T toAdd) where T : Component
		{
			return ((Component)(object)go.AddComponent<T>()).GetCopyOf(toAdd);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Skeletogne.EnemyAbilities", "EnemyAbilities", "1.9.0")]
	public class EnemyAbilities : BaseUnityPlugin
	{
		public class ModuleInfoAttribute : Attribute
		{
			public string ModuleName { get; }

			public string Description { get; }

			public string Section { get; }

			public bool RequiresRestart { get; }

			public ModuleInfoAttribute(string moduleName, string description, string section, bool requiresRestart)
			{
				ModuleName = moduleName;
				Description = description;
				Section = section;
				RequiresRestart = requiresRestart;
			}
		}

		public const string PluginGUID = "Skeletogne.EnemyAbilities";

		public const string PluginAuthor = "Skeletogne";

		public const string PluginName = "EnemyAbilities";

		public const string PluginVersion = "1.9.0";

		public Dictionary<Type, ConfigEntry<bool>> configEntries = new Dictionary<Type, ConfigEntry<bool>>();

		internal static bool RooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public static EnemyAbilities Instance { get; private set; }

		internal string DirectoryName => Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);

		public void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PluginConfig.Init(((BaseUnityPlugin)this).Config);
			foreach (KeyValuePair<Type, ConfigEntry<bool>> configEntry in configEntries)
			{
				Type key = configEntry.Key;
				((Component)Instance).gameObject.AddComponent(key);
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public static class PluginConfig
	{
		public enum FormatType
		{
			None,
			Percentage,
			Time,
			Distance,
			Speed
		}

		public static void Init(ConfigFile cfg)
		{
			if (EnemyAbilities.RooInstalled)
			{
				InitRoO();
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Type[] array = (from type in executingAssembly.GetTypes()
				where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(BaseModule))
				select type).ToArray();
			Type[] array2 = array;
			foreach (Type type2 in array2)
			{
				EnemyAbilities.ModuleInfoAttribute customAttribute = type2.GetCustomAttribute<EnemyAbilities.ModuleInfoAttribute>();
				if (customAttribute != null)
				{
					ConfigEntry<bool> value = cfg.BindOption(customAttribute.Section ?? "", customAttribute.ModuleName ?? "", defaultValue: true, customAttribute.Description ?? "", customAttribute.RequiresRestart);
					EnemyAbilities.Instance.configEntries.Add(type2, value);
				}
				else
				{
					Log.Error("ModuleInfo for " + type2.FullName + " does not exist! No PluginConfig entry has been created.");
				}
			}
		}

		public static void InitRoO()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_005e: 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)
			try
			{
				ModSettingsManager.SetModDescription("Give enemies new abilities!", "Skeletogne.EnemyAbilities", "EnemyAbilities");
				byte[] array = File.ReadAllBytes(Path.Combine(EnemyAbilities.Instance.DirectoryName, "icon.png"));
				Texture2D val = new Texture2D(256, 256);
				ImageConversion.LoadImage(val, array);
				Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
				ModSettingsManager.SetModIcon(modIcon);
			}
			catch (Exception data)
			{
				Log.Debug(data);
			}
		}

		public static ConfigEntry<T> BindOption<T>(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", bool restartRequired = false)
		{
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			bool flag = ((defaultValue is int || defaultValue is float) ? true : false);
			if (flag && !typeof(T).IsEnum)
			{
				Log.Warning("Config entry " + name + " in section " + section + " is a numeric " + typeof(T).Name + " type, but has been registered without using BindOptionSlider. Lower and upper bounds will be set to the defaults [0, 20]. Was this intentional?");
				return myConfig.BindOptionSlider(section, name, defaultValue, description, 0f, 20f, restartRequired);
			}
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			if (restartRequired)
			{
				description += " (restart required)";
			}
			AcceptableValueBase val = null;
			if (typeof(T).IsEnum)
			{
				val = (AcceptableValueBase)(object)new AcceptableValueList<string>(Enum.GetNames(typeof(T)));
			}
			ConfigEntry<T> val2 = myConfig.Bind<T>(section, name, defaultValue, new ConfigDescription(description, val, Array.Empty<object>()));
			if (EnemyAbilities.RooInstalled)
			{
				TryRegisterOption<T>(val2, restartRequired);
			}
			return val2;
		}

		public static ConfigEntry<T> BindOptionSlider<T>(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false)
		{
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			bool flag = ((defaultValue is int || defaultValue is float) ? true : false);
			if (!flag || typeof(T).IsEnum)
			{
				Log.Warning("Config entry " + name + " in section " + section + " is a not a numeric " + typeof(T).Name + " type, but has been registered as a slider option using BindOptionSlider. Was this intentional?");
				return myConfig.BindOption(section, name, defaultValue, description, restartRequired);
			}
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			string text = description;
			T val = defaultValue;
			description = text + " (Default: " + val?.ToString() + ")";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			AcceptableValueBase val2 = (AcceptableValueBase)((typeof(T) == typeof(int)) ? ((object)new AcceptableValueRange<int>((int)min, (int)max)) : ((object)new AcceptableValueRange<float>(min, max)));
			ConfigEntry<T> val3 = myConfig.Bind<T>(section, name, defaultValue, new ConfigDescription(description, val2, Array.Empty<object>()));
			if (EnemyAbilities.RooInstalled)
			{
				TryRegisterOptionSlider<T>(val3, min, max, restartRequired);
			}
			return val3;
		}

		public static ConfigEntry<T> BindOptionSteppedSlider<T>(this ConfigFile myConfig, string section, string name, T defaultValue, float increment = 1f, string description = "", float min = 0f, float max = 20f, bool restartRequired = false, FormatType formatType = FormatType.None)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			string text = description;
			T val = defaultValue;
			description = text + " (Default: " + val?.ToString() + ")";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> val2 = myConfig.Bind<T>(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()));
			if (EnemyAbilities.RooInstalled)
			{
				TryRegisterOptionSteppedSlider<T>(val2, increment, min, max, restartRequired, formatType);
			}
			return val2;
		}

		public static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired)
		{
			//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)
			//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_002a: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			if (entry is ConfigEntry<string> val)
			{
				ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(val, new InputFieldConfig
				{
					submitOn = (SubmitEnum)6,
					restartRequired = restartRequired
				}));
				return;
			}
			if (entry is ConfigEntry<bool> val2)
			{
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val2, restartRequired));
				return;
			}
			if (entry is ConfigEntry<KeyboardShortcut> val3)
			{
				ModSettingsManager.AddOption((BaseOption)new KeyBindOption(val3, restartRequired));
				return;
			}
			if (typeof(T).IsEnum)
			{
				ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, restartRequired));
				return;
			}
			Log.Warning("Config entry " + ((ConfigEntryBase)entry).Definition.Key + " in section " + ((ConfigEntryBase)entry).Definition.Section + " with type " + typeof(T).Name + " could not be registered in Risk Of Options using TryRegisterOption.");
		}

		public static void TryRegisterOptionSlider<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired)
		{
			//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)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_005b: 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_0067: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if (entry is ConfigEntry<int> val)
			{
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val, new IntSliderConfig
				{
					min = (int)min,
					max = (int)max,
					formatString = "{0:0}",
					restartRequired = restartRequired
				}));
			}
			else if (entry is ConfigEntry<float> val2)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig
				{
					min = min,
					max = max,
					FormatString = "{0:0.000}",
					restartRequired = restartRequired
				}));
			}
			else
			{
				Log.Warning("Config entry " + ((ConfigEntryBase)entry).Definition.Key + " in section " + ((ConfigEntryBase)entry).Definition.Section + " with type " + typeof(T).Name + " could not be registered in Risk Of Options using TryRegisterOptionSlider.");
			}
		}

		public static void TryRegisterOptionSteppedSlider<T>(ConfigEntry<T> entry, float increment, float min, float max, bool restartRequired, FormatType formatType)
		{
			//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)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if (entry is ConfigEntry<float> val)
			{
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(val, new StepSliderConfig
				{
					increment = increment,
					min = min,
					max = max,
					FormatString = GetStepSizePrecision((decimal)increment, formatType),
					restartRequired = restartRequired
				}));
			}
			else
			{
				Log.Warning("Config entry " + ((ConfigEntryBase)entry).Definition.Key + " in section " + ((ConfigEntryBase)entry).Definition.Section + " with type " + typeof(T).Name + " could not be registered in Risk Of Options using TryRegisterOptionSteppedSlider.");
			}
		}

		private static string GetStepSizePrecision(decimal n, FormatType formatType)
		{
			n = Math.Abs(n);
			n -= (decimal)(int)n;
			int num = 0;
			string text = "{0:";
			while (n > 0m)
			{
				num++;
				n *= 10m;
				n -= (decimal)(int)n;
			}
			if (num == 0)
			{
				return text + "0}" + AppendSuffix(formatType);
			}
			if (num > 0)
			{
				text += "0.";
				for (int i = 0; i < num; i++)
				{
					text += "0";
				}
				text += "}";
				return text + AppendSuffix(formatType);
			}
			Log.Error("Could not determine string format!");
			return "{0:000}";
		}

		private static string AppendSuffix(FormatType formatType)
		{
			return formatType switch
			{
				FormatType.Percentage => "%", 
				FormatType.Time => "s", 
				FormatType.Distance => "m", 
				FormatType.Speed => "m/s", 
				_ => "", 
			};
		}
	}
}
namespace EnemyAbilities.Abilities
{
	public class BaseModule : MonoBehaviour
	{
		protected class SkillDefData
		{
			public string objectName;

			public string skillName;

			public string esmName;

			public SerializableEntityStateType activationState;

			public float cooldown;

			public int baseMaxStock = 1;

			public int rechargeStock = 1;

			public int requiredStock = 1;

			public int stockToConsume = 1;

			public InterruptPriority intPrio = (InterruptPriority)0;

			public bool resetCdOnUse = false;

			public bool cdOnEnd = false;

			public bool cdBlocked = false;

			public bool combatSkill = true;
		}

		protected class AISkillDriverData
		{
			public GameObject masterPrefab;

			public string customName;

			public SkillSlot skillSlot;

			public float minDistance = 0f;

			public float maxDistance = float.PositiveInfinity;

			public int desiredIndex = 0;

			public float moveInputScale = 1f;

			public MovementType movementType;

			public AimType aimType;

			public TargetType targetType;

			public bool ignoreNodeGraph = false;

			public float maxHealthFraction = float.PositiveInfinity;

			public float minHealthFraction = float.NegativeInfinity;

			public float maxTargetHealthFraction = float.PositiveInfinity;

			public float minTargetHealthFraction = float.NegativeInfinity;

			public bool requireReady = false;

			public SkillDef requiredSkillDef = null;

			public bool activationRequiresAimTargetLoS = false;

			public bool activationRequiresAimConfirmation = false;

			public bool activationRequiresTargetLoS = false;

			public bool selectionRequiresAimTarget = false;

			public bool selectionRequiresOnGround = false;

			public bool selectionRequiresTargetLoS = false;

			public bool selectionRequiresTargetNonFlier = false;

			public int maxTimesSelected = -1;

			public float driverUpdateTimerOverride = -1f;

			public bool noRepeat = false;

			public AISkillDriver nextHighPriorityOverride = null;

			public bool shouldSprint = false;

			public float aimVectorMaxSpeedOverride = -1f;
		}

		private string _section;

		protected ConfigFile config => ((BaseUnityPlugin)EnemyAbilities.Instance).Config;

		protected string Section
		{
			get
			{
				if (_section == null)
				{
					_section = ((object)this).GetType().GetCustomAttribute<EnemyAbilities.ModuleInfoAttribute>()?.Section ?? ((object)this).GetType().Name;
				}
				return _section;
			}
		}

		public virtual void Awake()
		{
			RegisterConfig();
			if (IsModuleEnabled())
			{
				Initialise();
			}
		}

		private bool IsModuleEnabled()
		{
			if (EnemyAbilities.Instance.configEntries.TryGetValue(((object)this).GetType(), out var value))
			{
				return value.Value;
			}
			return false;
		}

		protected ConfigEntry<float> BindFloat(string name, float defaultValue, string desc, float min, float max, float step = 0.1f, PluginConfig.FormatType format = PluginConfig.FormatType.None)
		{
			return config.BindOptionSteppedSlider(Section, name, defaultValue, step, desc, min, max, restartRequired: true, format);
		}

		protected ConfigEntry<bool> BindBool(string name, bool defaultValue, string desc)
		{
			return config.BindOption(Section, name, defaultValue, desc, restartRequired: true);
		}

		public virtual void RegisterConfig()
		{
		}

		public virtual void Initialise()
		{
		}

		protected T CreateSkillDef<T>(SkillDefData data) where T : SkillDef
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			T val = ScriptableObject.CreateInstance<T>();
			((Object)(object)val).name = data.objectName;
			((SkillDef)val).skillName = data.skillName;
			((SkillDef)val).activationStateMachineName = data.esmName;
			((SkillDef)val).activationState = data.activationState;
			((SkillDef)val).baseRechargeInterval = data.cooldown;
			((SkillDef)val).baseMaxStock = data.baseMaxStock;
			((SkillDef)val).rechargeStock = data.rechargeStock;
			((SkillDef)val).requiredStock = data.requiredStock;
			((SkillDef)val).stockToConsume = data.stockToConsume;
			((SkillDef)val).interruptPriority = data.intPrio;
			((SkillDef)val).resetCooldownTimerOnUse = data.resetCdOnUse;
			((SkillDef)val).beginSkillCooldownOnSkillEnd = data.cdOnEnd;
			((SkillDef)val).isCooldownBlockedUntilManuallyReset = data.cdBlocked;
			((SkillDef)val).isCombatSkill = data.combatSkill;
			ContentAddition.AddSkillDef((SkillDef)(object)val);
			return val;
		}

		protected GenericSkill CreateGenericSkill(GameObject bodyPrefab, string skillName, string familyName, SkillDef skillDef, SkillSlot slot)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0054: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected I4, but got Unknown
			SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val).name = familyName;
			val.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = skillDef
				}
			};
			GenericSkill val2 = bodyPrefab.AddComponent<GenericSkill>();
			val2.skillName = skillName;
			val2._skillFamily = val;
			SkillLocator component = bodyPrefab.GetComponent<SkillLocator>();
			switch (slot - -1)
			{
			case 0:
				Log.Error("SkillSlot.None detected in AddGenericSkill!");
				break;
			case 1:
				component.primary = val2;
				break;
			case 2:
				component.secondary = val2;
				break;
			case 3:
				component.utility = val2;
				break;
			case 4:
				component.special = val2;
				break;
			}
			ContentAddition.AddSkillFamily(val);
			return val2;
		}

		protected EntityStateMachine CreateEntityStateMachine(GameObject bodyPrefab, string name, Type initialState = null, Type mainState = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine val = bodyPrefab.AddComponent<EntityStateMachine>();
			val.customName = name;
			val.initialStateType = new SerializableEntityStateType(initialState ?? typeof(Idle));
			val.mainStateType = new SerializableEntityStateType(mainState ?? typeof(Idle));
			return val;
		}

		protected AISkillDriver CreateAISkillDriver(AISkillDriverData data)
		{
			//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_0074: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (data == null || (Object)(object)data.masterPrefab == (Object)null)
			{
				Log.Error("Could not create AISkillDriver");
				return null;
			}
			AISkillDriver val = data.masterPrefab.AddComponent<AISkillDriver>();
			val.customName = data.customName;
			val.skillSlot = data.skillSlot;
			val.minDistance = data.minDistance;
			val.maxDistance = data.maxDistance;
			val.moveInputScale = data.moveInputScale;
			val.movementType = data.movementType;
			val.aimType = data.aimType;
			val.moveTargetType = data.targetType;
			val.ignoreNodeGraph = data.ignoreNodeGraph;
			val.maxUserHealthFraction = data.maxHealthFraction;
			val.minUserHealthFraction = data.minHealthFraction;
			val.maxTargetHealthFraction = data.maxTargetHealthFraction;
			val.minTargetHealthFraction = data.minTargetHealthFraction;
			val.requireSkillReady = data.requireReady;
			val.requiredSkill = data.requiredSkillDef;
			val.activationRequiresAimConfirmation = data.activationRequiresAimConfirmation;
			val.activationRequiresAimTargetLoS = data.activationRequiresAimTargetLoS;
			val.activationRequiresTargetLoS = data.activationRequiresTargetLoS;
			val.selectionRequiresAimTarget = data.selectionRequiresAimTarget;
			val.selectionRequiresOnGround = data.selectionRequiresOnGround;
			val.selectionRequiresTargetLoS = data.selectionRequiresTargetLoS;
			val.selectionRequiresTargetNonFlier = data.selectionRequiresTargetNonFlier;
			val.maxTimesSelected = data.maxTimesSelected;
			val.driverUpdateTimerOverride = data.driverUpdateTimerOverride;
			val.noRepeat = data.noRepeat;
			val.nextHighPriorityOverride = data.nextHighPriorityOverride;
			val.shouldSprint = data.shouldSprint;
			val.aimVectorMaxSpeedOverride = data.aimVectorMaxSpeedOverride;
			data.masterPrefab.ReorderSkillDrivers(val, data.desiredIndex);
			return val;
		}
	}
}
namespace EnemyAbilities.Abilities.SolusProspector
{
	[EnemyAbilities.ModuleInfo("Drill Burrow", "Gives Solus Prospectors a new Secondary ability: \n- Drill Burrow: Allows the Prospector to disappear underground to remain hidden for 1 second, before burrowing up beneath a nearby target.", "Solus Prospector", true)]
	public class DrillBurrowModule : BaseModule
	{
		private static GameObject bodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_WorkerUnit.WorkerUnitBody_prefab).WaitForCompletion();

		private static GameObject masterPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_WorkerUnit.WorkerUnitMaster_prefab).WaitForCompletion();

		internal static ConfigEntry<float> entryDuration;

		internal static ConfigEntry<float> waitDuration;

		internal static ConfigEntry<float> telegraphDuration;

		internal static ConfigEntry<float> damageCoeff;

		internal static ConfigEntry<float> radius;

		internal static ConfigEntry<float> baseVelocity;

		internal static ConfigEntry<float> cooldown;

		public override void RegisterConfig()
		{
			base.RegisterConfig();
			entryDuration = BindFloat("Burrow Entry Duration", 1f, "How long it takes for the Solus Prospector to burrow underground.", 0.2f, 2f, 0.1f, PluginConfig.FormatType.Time);
			waitDuration = BindFloat("Burrow Wait Duration", 1f, "How long the Solus Prospector remains burrowed without attacking", 0.2f, 2f, 0.1f, PluginConfig.FormatType.Time);
			telegraphDuration = BindFloat("Burrow Telegraph Duration", 1f, "How long the Solus Prospector telegraphs before bursting up from the ground", 0.2f, 2f, 0.1f, PluginConfig.FormatType.Time);
			radius = BindFloat("Burrow Radius", 6f, "The radius of the burrow attack explosion", 6f, 16f, 1f, PluginConfig.FormatType.Distance);
			damageCoeff = BindFloat("Burrow Damage Coefficient", 300f, "The damage coefficient of the burrow attack", 100f, 500f, 5f, PluginConfig.FormatType.Percentage);
			baseVelocity = BindFloat("Burrow Upwards Velocity Modifier", 250f, "The speed multiplier at which the Prospector is ejected from the ground", 100f, 500f, 10f, PluginConfig.FormatType.Percentage);
			cooldown = BindFloat("Burrow Cooldown", 15f, "The cooldown of the burrow", 8f, 30f, 0.1f, PluginConfig.FormatType.Time);
		}

		public override void Initialise()
		{
			base.Initialise();
			CreateSkill();
		}

		public void CreateSkill()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			SkillDefData data = new SkillDefData
			{
				objectName = "WorkerUnitBodyDrillBurrow",
				skillName = "WorkerUnitDrillBurrow",
				esmName = "Weapon",
				activationState = ContentAddition.AddEntityState<DrillBurrow>(ref flag),
				cooldown = cooldown.Value,
				combatSkill = true
			};
			SkillDef val = CreateSkillDef<SkillDef>(data);
			CreateGenericSkill(bodyPrefab, val.skillName, "WorkerUnitSecondaryFamily", val, (SkillSlot)1);
			AISkillDriverData data2 = new AISkillDriverData
			{
				masterPrefab = masterPrefab,
				customName = "useSecondary",
				skillSlot = (SkillSlot)1,
				requireReady = true,
				minDistance = 20f,
				maxDistance = 50f,
				selectionRequiresOnGround = true,
				selectionRequiresTargetNonFlier = true,
				movementType = (MovementType)0,
				aimType = (AimType)0,
				ignoreNodeGraph = true,
				desiredIndex = 0
			};
			CreateAISkillDriver(data2);
		}
	}
	public class DrillBurrow : BaseSkillState
	{
		private enum DrillBurrowState
		{
			None,
			Windup,
			Burrowed,
			Telegraphing,
			Attacking
		}

		public static float baseWindupDuration = DrillBurrowModule.entryDuration.Value;

		public static float baseBurrowDuration = DrillBurrowModule.waitDuration.Value;

		public static float baseTelegraphDuration = DrillBurrowModule.telegraphDuration.Value;

		public static float baseAttackDuration = 1f;

		public static float blastRadius = DrillBurrowModule.radius.Value;

		public static float force = 1500f;

		public static Vector3 bonusForce = new Vector3(0f, 2500f, 0f);

		public static float damageCoefficient = DrillBurrowModule.damageCoeff.Value / 100f;

		public static float exitSpeedMultiplier = DrillBurrowModule.baseVelocity.Value / 100f;

		private static GameObject indicatorPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common.TeamAreaIndicator__GroundOnly_prefab).WaitForCompletion();

		private static GameObject explosionPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleGuard.BeetleGuardGroundSlam_prefab).WaitForCompletion();

		private static GameObject burrowPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_MiniMushroom.MiniMushroomPlantEffect_prefab).WaitForCompletion();

		private float windupDuration;

		private float burrowDuration;

		private float telegraphDuration;

		private float attackDuration;

		private float totalDuration;

		private float stopwatch = 0f;

		private int originalLayerIndex;

		private Vector3 targetPos;

		private GameObject indicatorInstance;

		private ChildLocator childLocator;

		private Animator animator;

		private bool reachedApex;

		private float burrowEffectTimer = 0f;

		private float burrowEffectInterval = 0.2f;

		private Vector3 startPos;

		private HurtBox target;

		private DrillBurrowState currentState = DrillBurrowState.None;

		public override void OnEnter()
		{
			//IL_00ab: 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_00bb: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			childLocator = ((Component)animator).GetComponent<ChildLocator>();
			originalLayerIndex = ((EntityState)this).gameObject.layer;
			windupDuration = baseWindupDuration / ((BaseState)this).attackSpeedStat;
			burrowDuration = baseBurrowDuration / ((BaseState)this).attackSpeedStat;
			telegraphDuration = baseTelegraphDuration;
			attackDuration = baseAttackDuration / ((BaseState)this).attackSpeedStat;
			totalDuration = windupDuration + burrowDuration + telegraphDuration + attackDuration;
			currentState = DrillBurrowState.Windup;
			startPos = ((EntityState)this).characterBody.transform.position;
			BullseyeSearch val = new BullseyeSearch();
			val.viewer = ((EntityState)this).characterBody;
			val.teamMaskFilter = TeamMask.allButNeutral;
			((TeamMask)(ref val.teamMaskFilter)).RemoveTeam(((EntityState)this).characterBody.teamComponent.teamIndex);
			val.sortMode = (SortMode)3;
			val.minDistanceFilter = 0f;
			val.maxDistanceFilter = 60f;
			val.searchOrigin = ((EntityState)this).inputBank.aimOrigin;
			val.searchDirection = ((EntityState)this).inputBank.aimDirection;
			val.maxAngleFilter = 360f;
			val.filterByLoS = false;
			val.RefreshCandidates();
			HurtBox val2 = val.GetResults().FirstOrDefault();
			if ((Object)(object)val2 != (Object)null)
			{
				target = val2;
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			SetSprintEffectState(active: false);
			if (currentState != DrillBurrowState.Attacking)
			{
				Emerge();
			}
		}

		public void SpawnDirtEffect()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0007: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			EffectData val = new EffectData();
			Vector3 val2 = Random.insideUnitSphere * 1f;
			if (currentState == DrillBurrowState.Windup)
			{
				val._origin = ((EntityState)this).characterBody.footPosition + val2;
			}
			else if (currentState == DrillBurrowState.Telegraphing)
			{
				val._origin = targetPos + val2;
			}
			else if (currentState == DrillBurrowState.Burrowed)
			{
				Vector3 val3 = ((EntityState)this).characterBody.footPosition;
				if ((Object)(object)target != (Object)null && (Object)(object)target.healthComponent != (Object)null && (Object)(object)target.healthComponent.body != (Object)null)
				{
					val3 = target.healthComponent.body.transform.position;
				}
				Vector3 val4 = startPos;
				if (val3.y > startPos.y)
				{
					val4.y = val3.y;
				}
				else
				{
					val3.y = val4.y;
				}
				Vector3 val5 = Vector3.Lerp(val4, val3, Mathf.Clamp01((stopwatch - windupDuration) / burrowDuration));
				RaycastHit val6 = default(RaycastHit);
				if (Physics.Raycast(val5, Vector3.down, ref val6, 1000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
				{
					val._origin = ((RaycastHit)(ref val6)).point + val2;
				}
			}
			val.scale = ((currentState == DrillBurrowState.Burrowed) ? 1f : 2f);
			EffectManager.SpawnEffect(burrowPrefab, val, true);
		}

		public override void FixedUpdate()
		{
			//IL_002e: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (currentState == DrillBurrowState.Windup)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (stopwatch > windupDuration && currentState == DrillBurrowState.Windup)
			{
				Burrow();
				currentState = DrillBurrowState.Burrowed;
				burrowEffectTimer = 0f;
				burrowEffectInterval = 0.05f;
			}
			if (stopwatch > windupDuration + burrowDuration && currentState == DrillBurrowState.Burrowed)
			{
				Telegraph();
				burrowEffectTimer = 0f;
				burrowEffectInterval = 0.2f;
				currentState = DrillBurrowState.Telegraphing;
			}
			if (stopwatch > windupDuration + burrowDuration + telegraphDuration && currentState == DrillBurrowState.Telegraphing)
			{
				FireAttack();
				currentState = DrillBurrowState.Attacking;
			}
			if (currentState == DrillBurrowState.Attacking && !reachedApex)
			{
				if (((EntityState)this).characterMotor.velocity.y <= 0f)
				{
					reachedApex = true;
					OnReachedApex();
				}
				else
				{
					((EntityState)this).inputBank.aimDirection = Vector3.up;
				}
			}
			if ((stopwatch > totalDuration && ((EntityState)this).characterMotor.isGrounded) || stopwatch > totalDuration + 3f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			if (currentState == DrillBurrowState.Windup || currentState == DrillBurrowState.Telegraphing || currentState == DrillBurrowState.Burrowed)
			{
				burrowEffectTimer -= Time.fixedDeltaTime;
				if (burrowEffectTimer < 0f)
				{
					burrowEffectTimer += burrowEffectInterval;
					SpawnDirtEffect();
				}
			}
		}

		public void OnReachedApex()
		{
			SetSprintEffectState(active: false);
		}

		public void Burrow()
		{
			//IL_0043: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((EntityState)this).characterBody == (Object)null) && !((Object)(object)((EntityState)this).characterMotor == (Object)null))
			{
				((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 0f;
				if (((EntityState)this).characterBody.GetBuffCount(Buffs.HiddenInvincibility.buffIndex) < 1)
				{
					((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility.buffIndex);
				}
				((EntityState)this).gameObject.layer = LayerIndex.GetAppropriateFakeLayerForTeam(((EntityState)this).teamComponent.teamIndex).intVal;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
				if ((Object)(object)((EntityState)this).modelLocator != (Object)null && (Object)(object)((EntityState)this).modelLocator.modelTransform != (Object)null)
				{
					((Component)((EntityState)this).modelLocator.modelTransform).gameObject.SetActive(false);
				}
			}
		}

		public void Telegraph()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//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)
			targetPos = ((EntityState)this).transform.position;
			if ((Object)(object)target != (Object)null && (Object)(object)target.healthComponent != (Object)null && (Object)(object)target.healthComponent.body != (Object)null)
			{
				targetPos = target.healthComponent.body.footPosition;
				Util.PlaySound("Play_GildedElite_Pillar_Spawn", ((Component)target.healthComponent.body).gameObject);
			}
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(targetPos, Vector3.down, ref val, 1000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
			{
				targetPos = ((RaycastHit)(ref val)).point;
			}
			indicatorInstance = Object.Instantiate<GameObject>(indicatorPrefab, targetPos, Util.QuaternionSafeLookRotation(Vector3.up));
			indicatorInstance.transform.localScale = Vector3.one * blastRadius;
			TeamAreaIndicator component = indicatorInstance.GetComponent<TeamAreaIndicator>();
			if ((Object)(object)component != (Object)null)
			{
				component.teamComponent = ((EntityState)this).teamComponent;
			}
		}

		private void SetSprintEffectState(bool active)
		{
			if (Object.op_Implicit((Object)(object)childLocator))
			{
				Transform obj = childLocator.FindChild("SprintEffect");
				if (obj != null)
				{
					((Component)obj).gameObject.SetActive(active);
				}
			}
		}

		public void FireAttack()
		{
			//IL_0008: 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_005f: 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_006c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0082: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00de: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			TeleportHelper.TeleportBody(((EntityState)this).characterBody, targetPos, false);
			Util.PlaySound("Play_MULT_m2_secondary_explode", ((EntityState)this).gameObject);
			Emerge();
			SetSprintEffectState(active: true);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FrenziedMeleeAttack", "attack.playbackRate", 1f, 0f);
			DamageTypeCombo val = default(DamageTypeCombo);
			val.damageSource = (DamageSource)2;
			val.damageType = (DamageType)0;
			DamageTypeCombo damageType = val;
			BlastAttack val2 = new BlastAttack();
			val2.attacker = ((EntityState)this).gameObject;
			val2.attackerFiltering = (AttackerFiltering)2;
			val2.baseDamage = damageCoefficient * ((BaseState)this).damageStat;
			val2.baseForce = force;
			val2.bonusForce = bonusForce;
			val2.crit = ((BaseState)this).RollCrit();
			val2.damageColorIndex = (DamageColorIndex)0;
			val2.damageType = damageType;
			val2.falloffModel = (FalloffModel)2;
			val2.inflictor = ((EntityState)this).gameObject;
			val2.position = targetPos;
			val2.procCoefficient = 1f;
			val2.procChainMask = default(ProcChainMask);
			val2.radius = blastRadius;
			val2.teamIndex = ((EntityState)this).teamComponent.teamIndex;
			val2.Fire();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)this).characterMotor.velocity = new Vector3(0f, ((BaseState)this).moveSpeedStat * 2.5f, 0f);
			}
			EffectManager.SpawnEffect(explosionPrefab, new EffectData
			{
				origin = ((EntityState)this).characterBody.transform.position,
				scale = blastRadius
			}, true);
		}

		public void Emerge()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((EntityState)this).characterBody == (Object)null) && !((Object)(object)((EntityState)this).characterMotor == (Object)null))
			{
				if ((Object)(object)indicatorInstance != (Object)null)
				{
					Object.Destroy((Object)(object)indicatorInstance);
				}
				((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 1f;
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility.buffIndex);
				((EntityState)this).gameObject.layer = originalLayerIndex;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
				if ((Object)(object)((EntityState)this).modelLocator != (Object)null && (Object)(object)((EntityState)this).modelLocator.modelTransform != (Object)null)
				{
					((Component)((EntityState)this).modelLocator.modelTransform).gameObject.SetActive(true);
				}
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0022: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			if (currentState == DrillBurrowState.Windup || currentState == DrillBurrowState.Attacking)
			{
				return (InterruptPriority)2;
			}
			return (InterruptPriority)9;
		}
	}
}
namespace EnemyAbilities.Abilities.Vulture
{
	[EnemyAbilities.ModuleInfo("Swoop", "Gives Alloy Vultures a new secondary:\n- Swoop: Allows Alloy Vultures to swoop towards the player in an arc, dealing contact damage.", "Alloy Vulture", true)]
	public class SwoopModule : BaseModule
	{
		private static GameObject bodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Vulture.VultureBody_prefab).WaitForCompletion();

		private static GameObject masterPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Vulture.VultureMaster_prefab).WaitForCompletion();

		internal static ConfigEntry<float> damageCoeff;

		internal static ConfigEntry<float> hitboxScale;

		internal static ConfigEntry<bool> inflictsBleed;

		internal static ConfigEntry<float> predictionTime;

		internal static ConfigEntry<float> selfStunDuration;

		internal static ConfigEntry<float> cooldown;

		public override void RegisterConfig()
		{
			base.RegisterConfig();
			predictionTime = BindFloat("Swoop Prediction Duration", 1.5f, "Affects how far into the future the Alloy Vulture will predict when swooping towards the player. Increasing the value increases the duration of the attack, and slows the speed at which the Vulture travels.", 1f, 3f, 0.1f, PluginConfig.FormatType.Time);
			hitboxScale = BindFloat("Swoop Hitbox Scale", 100f, "Affects how large the hitbox for swoop is.", 50f, 200f, 1f, PluginConfig.FormatType.Percentage);
			damageCoeff = BindFloat("Swoop Damage Coefficient", 125f, "The damage coefficient of the swoop attack", 100f, 300f, 5f, PluginConfig.FormatType.Percentage);
			selfStunDuration = BindFloat("Swoop Stun Duration on Impact", 2f, "How long the Alloy Vulture stuns itself for upon hitting terrain at high speed.", 0f, 4f, 0.1f, PluginConfig.FormatType.Time);
			inflictsBleed = BindBool("Swoop Inflicts Bleed", defaultValue: true, "Allows Alloy Vultures to inflict 1 stack of bleed for 3 seconds when swoop hits.");
			cooldown = BindFloat("Swoop Cooldown", 12f, "The cooldown of the swoop ability", 8f, 30f, 0.1f, PluginConfig.FormatType.Time);
		}

		public override void Initialise()
		{
			base.Initialise();
			TargetingAndPredictionController val = bodyPrefab.AddComponent<TargetingAndPredictionController>();
			val.manualTrackingMaxDistance = 100f;
			val.manualTrackingMaxAngle = 360f;
			CreateSkill();
			AddMeleeHitBox();
		}

		private void AddMeleeHitBox()
		{
			//IL_0044: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			ModelLocator component = bodyPrefab.GetComponent<ModelLocator>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.modelTransform != (Object)null)
			{
				CreateHitBoxAndGroup(component.modelTransform, "VultureMelee", new Vector3(0f, -2f, 0f), new Vector3(30f, 30f, 30f) * (hitboxScale.Value / 100f));
			}
		}

		private void CreateHitBoxAndGroup(Transform modelTransform, string hitBoxGroupName, Vector3 localPosition, Vector3 localScale, string hitBoxGroupObjName = "", string hitBoxObjName = "")
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			hitBoxGroupObjName = ((hitBoxGroupObjName == "") ? hitBoxGroupName : hitBoxGroupObjName);
			hitBoxObjName = ((hitBoxObjName == "") ? hitBoxGroupName : hitBoxObjName);
			GameObject val = new GameObject(hitBoxGroupObjName);
			val.transform.SetParent(modelTransform);
			val.transform.localPosition = localPosition;
			val.transform.localScale = localScale;
			val.transform.localRotation = Quaternion.identity;
			HitBox val2 = val.AddComponent<HitBox>();
			((Object)((Component)val2).gameObject).name = hitBoxObjName;
			HitBoxGroup val3 = ((Component)modelTransform).gameObject.AddComponent<HitBoxGroup>();
			val3.groupName = hitBoxGroupName;
			val3.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 };
		}

		public void CreateSkill()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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)
			bool flag = default(bool);
			SkillDefData data = new SkillDefData
			{
				objectName = "VultureBodySwoop",
				skillName = "VultureSwoop",
				esmName = "Body",
				activationState = ContentAddition.AddEntityState<SwoopWindup>(ref flag),
				cooldown = cooldown.Value,
				combatSkill = true
			};
			SwoopSkillDef swoopSkillDef = CreateSkillDef<SwoopSkillDef>(data);
			ContentAddition.AddEntityState<Swoop>(ref flag);
			CreateGenericSkill(bodyPrefab, ((SkillDef)swoopSkillDef).skillName, "VultureSecondaryFamily", (SkillDef)(object)swoopSkillDef, (SkillSlot)1);
			AISkillDriverData data2 = new AISkillDriverData
			{
				masterPrefab = masterPrefab,
				customName = "strafeAndUseSecondary",
				skillSlot = (SkillSlot)1,
				requiredSkillDef = (SkillDef)(object)swoopSkillDef,
				requireReady = true,
				minDistance = 25f,
				maxDistance = 50f,
				targetType = (TargetType)0,
				movementType = (MovementType)2,
				desiredIndex = 2
			};
			CreateAISkillDriver(data2);
		}
	}
	public class SwoopSkillDef : SkillDef
	{
		private class InstanceData : BaseSkillInstanceData
		{
			public CharacterBody body;

			public EntityStateMachine flightEsm;
		}

		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			CharacterBody characterBody = skillSlot.characterBody;
			EntityStateMachine flightEsm = ((IEnumerable<EntityStateMachine>)((Component)characterBody).GetComponents<EntityStateMachine>()).FirstOrDefault((Func<EntityStateMachine, bool>)((EntityStateMachine esm) => esm.customName == "Flight"));
			return (BaseSkillInstanceData)(object)new InstanceData
			{
				body = characterBody,
				flightEsm = flightEsm
			};
		}

		public override bool IsReady([NotNull] GenericSkill skillSlot)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			InstanceData instanceData = skillSlot.skillInstanceData as InstanceData;
			if ((Object)(object)instanceData?.flightEsm == (Object)null || (Object)(object)instanceData.body == (Object)null)
			{
				return false;
			}
			if (!(instanceData.flightEsm.state is Fly))
			{
				return false;
			}
			if (Physics.Raycast(instanceData.body.corePosition, Vector3.down, 8f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				return false;
			}
			if ((Object)(object)instanceData.body.characterMotor != (Object)null && instanceData.body.characterMotor.isGrounded)
			{
				return false;
			}
			return ((SkillDef)this).IsReady(skillSlot);
		}
	}
	public class SwoopWindup : BaseSkillState
	{
		private float duration;

		private static float baseDuration = 0.5f;

		private Vector3 targetLocation;

		private BaseAI ai;

		private bool success;

		private GameObject jumpEffect = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Vulture.VultureJumpEffect_prefab).WaitForCompletion();

		public override void OnEnter()
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00ff: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).skillLocator.utility.SetSkillOverride((object)((EntityState)this).gameObject, CommonAssets.disabledSkill, (SkillOverridePriority)4);
			CharacterMaster master = ((EntityState)this).characterBody.master;
			if ((Object)(object)master != (Object)null)
			{
				ai = ((Component)master).gameObject.GetComponent<BaseAI>();
			}
			if ((Object)(object)ai != (Object)null && ai.currentEnemy != null && (Object)(object)ai.currentEnemy.characterBody != (Object)null)
			{
				targetLocation = ai.currentEnemy.characterBody.transform.position;
			}
			Vector3 val = ((EntityState)this).characterBody.corePosition - targetLocation;
			val.y = 0f;
			((Vector3)(ref val)).Normalize();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				EffectManager.SpawnEffect(jumpEffect, new EffectData
				{
					scale = 2f,
					origin = ((EntityState)this).characterBody.footPosition,
					rotation = Util.QuaternionSafeLookRotation(Vector3.down)
				}, true);
				((EntityState)this).characterMotor.velocity = val * 10f + new Vector3(0f, 25f, 0f);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (!success)
			{
				((EntityState)this).skillLocator.utility.UnsetSkillOverride((object)((EntityState)this).gameObject, CommonAssets.disabledSkill, (SkillOverridePriority)4);
			}
		}

		public override void FixedUpdate()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null && ((EntityState)this).characterMotor.isGrounded)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (((EntityState)this).fixedAge > duration)
			{
				if (ai.currentEnemy.characterBody.transform.position.y > ((EntityState)this).characterBody.transform.position.y)
				{
					((EntityState)this).outer.SetNextStateToMain();
					return;
				}
				success = true;
				((EntityState)this).outer.SetNextState((EntityState)(object)new Swoop());
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class Swoop : BaseSkillState
	{
		public static float predictionDuration = 0.5f;

		private static float swoopDurationTilTarget = SwoopModule.predictionTime.Value;

		private static float recoverDuration = 0.5f;

		private static GameObject slashEffect = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Croco.CrocoSlash_prefab).WaitForCompletion();

		private static GameObject hitEffect = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.OmniImpactVFXSlash_prefab).WaitForCompletion();

		private GameObject slashEffectInstance;

		private EffectManagerHelper _emh_slashEffectInstance;

		private GameObject jumpEffect = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Vulture.VultureJumpEffect_prefab).WaitForCompletion();

		private static float effectInterval = 0.25f;

		private float effectTimer;

		private static int maxSwingCount = 5;

		private int swingCount = 0;

		private bool startLeftFoot;

		private static float firstSwingDelay = 1.1f;

		private static float swingInterval = 0.2f;

		private float nextSwingTime;

		private float recoverTimer = 0f;

		private float swoopStopwatch = 0f;

		private float swoopFullDuration = 3f;

		private TargetingAndPredictionController targetController;

		private Transform trackedTarget;

		private Vector3 vultureStartPosition;

		private Vector3 finalTarget;

		private bool madePrediction = false;

		private bool finishedSwoop = false;

		private bool pastTarget = false;

		private float damageCoefficient = SwoopModule.damageCoeff.Value / 100f;

		private float procCoefficient = 1f;

		private float crashAngle = 40f;

		private OverlapAttack attack;

		private int _origLayer;

		public override void OnEnter()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0116: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			DisableCollision();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.onMovementHit += new MovementHitDelegate(OnMovementHit);
			}
			nextSwingTime = firstSwingDelay;
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null && ((EntityState)this).characterMotor.isGrounded)
			{
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			swoopFullDuration = swoopDurationTilTarget * 2f;
			targetController = ((EntityState)this).GetComponent<TargetingAndPredictionController>();
			if ((Object)(object)targetController != (Object)null && ((EntityState)this).isAuthority)
			{
				trackedTarget = targetController.StartPredictTarget((Action)OnTargetLost);
			}
			startLeftFoot = Random.RandomRangeInt(0, 2) == 1;
			attack = new OverlapAttack();
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((EntityState)this).teamComponent.teamIndex;
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.hitEffectPrefab = hitEffect;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.procCoefficient = procCoefficient;
			DamageTypeCombo val = default(DamageTypeCombo);
			val.damageSource = (DamageSource)2;
			val.damageType = (DamageType)(SwoopModule.inflictsBleed.Value ? 1024 : 0);
			DamageTypeCombo damageType = val;
			attack.damageType = damageType;
			attack.hitBoxGroup = ((BaseState)this).FindHitBoxGroup("VultureMelee");
			attack.forceVector = ((EntityState)this).characterDirection.forward * 500f;
		}

		private void OnMovementHit(ref MovementHitInfo movementHitInfo)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (((Vector3)(ref ((EntityState)this).characterMotor.velocity)).magnitude < 5f)
			{
				return;
			}
			Vector3 normalized = ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized;
			Vector3 hitNormal = movementHitInfo.hitNormal;
			float num = Vector3.Angle(normalized, hitNormal);
			if (num > 180f - crashAngle)
			{
				SetStateOnHurt component = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<SetStateOnHurt>();
				if ((Object)(object)component != (Object)null)
				{
					component.SetStun(SwoopModule.selfStunDuration.Value);
				}
			}
		}

		public override void OnExit()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			((EntityState)this).OnExit();
			((EntityState)this).skillLocator.utility.UnsetSkillOverride((object)((EntityState)this).gameObject, CommonAssets.disabledSkill, (SkillOverridePriority)4);
			((EntityState)this).characterMotor.velocity = new Vector3(0f, 0f, 0f);
			((EntityState)this).characterMotor.onMovementHit -= new MovementHitDelegate(OnMovementHit);
			EnableCollision();
			if ((Object)(object)_emh_slashEffectInstance != (Object)null && _emh_slashEffectInstance.OwningPool != null)
			{
				((GenericPool<EffectManagerHelper>)(object)_emh_slashEffectInstance.OwningPool).ReturnObject(_emh_slashEffectInstance);
			}
			else if (Object.op_Implicit((Object)(object)slashEffectInstance))
			{
				EntityState.Destroy((Object)(object)slashEffectInstance);
			}
			slashEffectInstance = null;
			_emh_slashEffectInstance = null;
		}

		public override void FixedUpdate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0095: 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_00a6: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (!madePrediction)
			{
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.velocity /= 1.2f;
			}
			if (((EntityState)this).fixedAge > predictionDuration && !madePrediction)
			{
				Vector3 position = default(Vector3);
				if (!targetController.GetPredictionPositionConsumePredictor(swoopDurationTilTarget, ref position))
				{
					position = trackedTarget.position;
				}
				finalTarget = position + new Vector3(0f, 4f, 0f);
				vultureStartPosition = ((EntityState)this).characterBody.corePosition;
				if (finalTarget.y > vultureStartPosition.y)
				{
					((EntityState)this).outer.SetNextStateToMain();
					return;
				}
				madePrediction = true;
				swoopStopwatch = 0f;
			}
			if (madePrediction && !finishedSwoop)
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				}
				swoopStopwatch += Time.fixedDeltaTime;
				float num = finalTarget.x - vultureStartPosition.x;
				float num2 = finalTarget.y - vultureStartPosition.y;
				float num3 = finalTarget.z - vultureStartPosition.z;
				float num4 = 2f * num / Mathf.Pow(swoopDurationTilTarget, 2f);
				float num5 = 2f * num3 / Mathf.Pow(swoopDurationTilTarget, 2f);
				float num6 = 2f * num2 / Mathf.Pow(swoopDurationTilTarget, 2f);
				float num7 = 0f;
				float num8 = 0f;
				float num9 = 0f;
				if (!pastTarget)
				{
					num7 = num4 * swoopStopwatch;
					num8 = num6 * (swoopDurationTilTarget - swoopStopwatch);
					num9 = num5 * swoopStopwatch;
				}
				if (pastTarget)
				{
					num7 = num4 * (swoopFullDuration - swoopStopwatch);
					num8 = 0f - num6 * (swoopStopwatch - swoopDurationTilTarget);
					num9 = num5 * (swoopFullDuration - swoopStopwatch);
				}
				if (((EntityState)this).isAuthority && swoopStopwatch > firstSwingDelay && swoopStopwatch < firstSwingDelay + (float)maxSwingCount * swingInterval)
				{
					attack.Fire((List<HurtBox>)null);
				}
				if (swoopStopwatch > nextSwingTime && swingCount < maxSwingCount)
				{
					nextSwingTime += swingInterval;
					swingCount++;
					SwingEffect();
				}
				Vector3 velocity = default(Vector3);
				((Vector3)(ref velocity))..ctor(num7, num8, num9);
				((EntityState)this).characterMotor.velocity = velocity;
				if ((Object)(object)((EntityState)this).characterDirection != (Object)null)
				{
					((EntityState)this).characterDirection.moveVector = ((Vector3)(ref velocity)).normalized;
				}
				effectTimer -= Time.fixedDeltaTime;
				if (effectTimer < 0f)
				{
					effectTimer += effectInterval;
					EffectManager.SpawnEffect(jumpEffect, new EffectData
					{
						scale = 2f,
						origin = ((EntityState)this).characterBody.footPosition,
						rotation = Util.QuaternionSafeLookRotation(((EntityState)this).characterMotor.velocity)
					}, true);
				}
			}
			if (swoopStopwatch > swoopDurationTilTarget)
			{
				pastTarget = true;
			}
			if (swoopStopwatch > swoopFullDuration)
			{
				finishedSwoop = true;
				CharacterMotor characterMotor2 = ((EntityState)this).characterMotor;
				characterMotor2.velocity /= 1.2f;
				recoverTimer += Time.fixedDeltaTime;
				if (recoverTimer > recoverDuration)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private void OnTargetLost()
		{
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void SwingEffect()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound("Play_acrid_m1_slash", ((EntityState)this).gameObject);
			string text = "";
			int num = (swingCount - 1) % 2;
			text = ((num != ((!startLeftFoot) ? 1 : 0)) ? "FootR" : "FootL");
			if (!Object.op_Implicit((Object)(object)slashEffect))
			{
				return;
			}
			Transform val = ((BaseState)this).FindModelChild(text);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			if (!EffectManager.ShouldUsePooledEffect(slashEffect))
			{
				if ((Object)(object)slashEffectInstance != (Object)null)
				{
					EntityState.Destroy((Object)(object)slashEffectInstance);
					slashEffectInstance = null;
				}
				slashEffectInstance = Object.Instantiate<GameObject>(slashEffect, val);
				slashEffectInstance.transform.localScale = Vector3.one;
			}
			else
			{
				if ((Object)(object)_emh_slashEffectInstance != (Object)null && _emh_slashEffectInstance.OwningPool != null)
				{
					((GenericPool<EffectManagerHelper>)(object)_emh_slashEffectInstance.OwningPool).ReturnObject(_emh_slashEffectInstance);
					_emh_slashEffectInstance = null;
				}
				_emh_slashEffectInstance = EffectManager.GetAndActivatePooledEffect(slashEffect, val, true);
				slashEffectInstance = ((Component)_emh_slashEffectInstance).gameObject;
				if ((Object)(object)slashEffectInstance == (Object)null)
				{
					return;
				}
				slashEffectInstance.transform.localScale = Vector3.one;
			}
			ScaleParticleSystemDuration component = slashEffectInstance.GetComponent<ScaleParticleSystemDuration>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.newDuration = component.initialDuration;
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}

		private void DisableCollision()
		{
			//IL_002f: 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)
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				_origLayer = ((EntityState)this).gameObject.layer;
				((EntityState)this).gameObject.layer = LayerIndex.GetAppropriateFakeLayerForTeam(((EntityState)this).teamComponent.teamIndex).intVal;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			}
		}

		private void EnableCollision()
		{
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).gameObject.layer = _origLayer;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			}
		}
	}
}
namespace EnemyAbilities.Abilities.XiConstruct
{
	[EnemyAbilities.ModuleInfo("Core Launch", "Gives Xi Constructs a new Secondary:\n-Core Launch: The Xi Construct spins up to launch it's core at a player, then retracts it after a short delay. Damaging the core returns the damage to the Xi Construct.", "Xi Construct", true)]
	public class DetachEyeModule : BaseModule
	{
		public class DetachEyeDamageEffectOrb : GenericDamageOrb
		{
			public override void Begin()
			{
				base.speed = 240f;
				base.damageValue = 0f;
				base.procCoefficient = 0f;
				((GenericDamageOrb)this).Begin();
			}

			public override GameObject GetOrbEffect()
			{
				return OrbStorageUtility.Get("Prefabs/Effects/OrbEffects/ClayGooOrbEffect");
			}

			public override void OnArrival()
			{
				//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_0016: 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_0033: Expected O, but got Unknown
				EffectManager.SpawnEffect(transferDamageImpactEffect, new EffectData
				{
					scale = 4f,
					origin = ((Component)((Orb)this).target).transform.position
				}, true);
			}
		}

		private static GameObject bodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_MajorAndMinorConstruct.MegaConstructBody_prefab).WaitForCompletion();

		private static GameObject masterPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_MajorAndMinorConstruct.MegaConstructMaster_prefab).WaitForCompletion();

		private static GameObject projectileGhost = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_ClayGrenadier.ClayGrenadierBarrelGhost_prefab).WaitForCompletion(), "MegaConstructEyeProjectileGhost");

		private static Material eyeMaterial = Addressables.LoadAssetAsync<Material>((object)RoR2_DLC1_MajorAndMinorConstruct.matMegaConstructEye_mat).WaitForCompletion();

		private static GameObject impactEffect = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Parent.ParentSlamEffect_prefab).WaitForCompletion();

		public static GameObject vagrantProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Vagrant.VagrantTrackingBomb_prefab).WaitForCompletion(), "ClonedVagrantProjectile");

		private static Material trailMaterial = Addressables.LoadAssetAsync<Material>((object)RoR2_DLC1_MajorAndMinorConstruct.matConstructBeamInitial_mat).WaitForCompletion();

		public static GameObject transferDamageImpactEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.OmniImpactVFXLarge_prefab).WaitForCompletion(), "scalableImpactEffect");

		private static GameObject megaConstructModel = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_MajorAndMinorConstruct.mdlMegaConstruct_fbx).WaitForCompletion();

		public static GameObject pulseEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_MajorAndMinorConstruct.MajorConstructMuzzleflashSpawnMinorConstruct_prefab).WaitForCompletion(), "megaConstructBeaconEffect");

		internal static ConfigEntry<float> damageCoeff;

		internal static ConfigEntry<float> explosionRadius;

		internal static ConfigEntry<float> waitDuration;

		internal static ConfigEntry<float> windupDuration;

		internal static ConfigEntry<float> cooldown;

		public override void RegisterConfig()
		{
			base.RegisterConfig();
			damageCoeff = BindFloat("Core Damage Coefficient", 250f, "The damage coefficient of the core attack", 100f, 500f, 5f, PluginConfig.FormatType.Percentage);
			explosionRadius = BindFloat("Core Explosion Radius", 10f, "The damage radius of the core attack", 6f, 20f, 0.1f, PluginConfig.FormatType.Distance);
			waitDuration = BindFloat("Core Wait Duration", 3.5f, "The amount of time that the Xi Construct will wait between firing and recalling it's Core.", 1f, 6f, 0.01f, PluginConfig.FormatType.Time);
			windupDuration = BindFloat("Core Windup Duration", 0.75f, "The amount of time the Xi Construct will spin up for before firing it's core.", 0.5f, 2f, 0.01f, PluginConfig.FormatType.Time);
			cooldown = BindFloat("Core Cooldown", 15f, "The cooldown of the core launch", 10f, 30f, 0.1f, PluginConfig.FormatType.Time);
		}

		public override void Initialise()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			base.Initialise();
			ModifyProjectilePrefab();
			CreateSkill();
			bodyPrefab.AddComponent<MegaConstructUtilityController>();
			HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(CreateDamageEffectOrb);
			transferDamageImpactEffect.GetComponent<EffectComponent>().applyScale = true;
			ContentAddition.AddEffect(transferDamageImpactEffect);
			EffectComponent component = pulseEffect.GetComponent<EffectComponent>();
			component.applyScale = true;
			component.positionAtReferencedTransform = false;
			component.parentToReferencedTransform = false;
			ContentAddition.AddEffect(pulseEffect);
		}

		private void CreateDamageEffectOrb(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0039: 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_00bc: 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)
			if ((Object)(object)self != (Object)null && damageInfo != null && damageInfo.damage > 0f && (Object)(object)self.body != (Object)null && self.body.bodyIndex == BodyPrefabs.MegaConstructBody.bodyIndex && (Object)(object)damageInfo.inflictedHurtbox != (Object)null && ((Behaviour)damageInfo.inflictedHurtbox).enabled)
			{
				MegaConstructUtilityController component = ((Component)self.body).gameObject.GetComponent<MegaConstructUtilityController>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.eyeProjectile != (Object)null)
				{
					DetachEyeDamageEffectOrb detachEyeDamageEffectOrb = new DetachEyeDamageEffectOrb();
					((Orb)detachEyeDamageEffectOrb).origin = component.eyeProjectile.transform.position;
					((Orb)detachEyeDamageEffectOrb).target = self.body.mainHurtBox;
					OrbManager.instance.AddOrb((Orb)(object)detachEyeDamageEffectOrb);
				}
			}
			orig.Invoke(self, damageInfo);
		}

		public void ModifyProjectilePrefab()
		{
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: 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_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			ProjectileDirectionalTargetFinder component = vagrantProjectile.GetComponent<ProjectileDirectionalTargetFinder>();
			Object.Destroy((Object)(object)component);
			ProjectileSteerTowardTarget component2 = vagrantProjectile.GetComponent<ProjectileSteerTowardTarget>();
			Object.Destroy((Object)(object)component2);
			ProjectileTargetComponent component3 = vagrantProjectile.GetComponent<ProjectileTargetComponent>();
			Object.Destroy((Object)(object)component3);
			Transform[] componentsInChildren = vagrantProjectile.GetComponentsInChildren<Transform>();
			List<string> list = new List<string>(3) { "ProximityDetonator", "AuthorityEffect", "PredictionEffect" };
			if (componentsInChildren != null && componentsInChildren.Length != 0)
			{
				for (int num = componentsInChildren.Length - 1; num >= 0; num--)
				{
					if ((Object)(object)componentsInChildren[num] != (Object)null && list.Contains(((Object)((Component)componentsInChildren[num]).gameObject).name))
					{
						Object.Destroy((Object)(object)((Component)componentsInChildren[num]).gameObject);
					}
				}
			}
			Transform[] componentsInChildren2 = megaConstructModel.GetComponentsInChildren<Transform>();
			GameObject gameObject = ((Component)componentsInChildren2.Where((Transform transform) => ((Object)((Component)transform).gameObject).name == "MegaConstructEyeMesh").FirstOrDefault()).gameObject;
			GameObject val = PrefabAPI.InstantiateClone(gameObject, "eyeObjectClone");
			MeshRenderer component4 = val.GetComponent<MeshRenderer>();
			((Renderer)component4).lightProbeUsage = (LightProbeUsage)1;
			((Renderer)component4).material = eyeMaterial;
			PrintController val2 = val.AddComponent<PrintController>();
			val2.printTime = 0f;
			val2.disableWhenFinished = true;
			val2.maxPrintHeight = -10f;
			val2.startingPrintHeight = 4f;
			val2.printCurve = bodyPrefab.GetComponentInChildren<PrintController>().printCurve;
			val2.materialPrintCutoffPostSkinApplying = true;
			Transform component5 = vagrantProjectile.GetComponent<Transform>();
			component5.localScale = Vector3.one;
			ProjectileController component6 = vagrantProjectile.GetComponent<ProjectileController>();
			ParticleSystem[] componentsInChildren3 = projectileGhost.GetComponentsInChildren<ParticleSystem>();
			Rigidbody component7 = vagrantProjectile.GetComponent<Rigidbody>();
			SphereCollider component8 = ((Component)component7).GetComponent<SphereCollider>();
			Transform[] componentsInChildren4 = projectileGhost.GetComponentsInChildren<Transform>();
			GameObject gameObject2 = ((Component)componentsInChildren4.Where((Transform transform) => ((Object)((Compo