Decompiled source of BootlegBestiary v1.0.0

plugins/BootlegBestiary.dll

Decompiled a day 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 BootlegBestiary.Shared;
using BootlegBestiary.Shared.Assets;
using BootlegBestiary.SkyDracon.Components;
using BootlegBestiary.SkyDracon.EntityStates;
using EntityStates;
using Grumpy;
using JetBrains.Annotations;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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("BootlegBestiary")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BootlegBestiary")]
[assembly: AssemblyTitle("BootlegBestiary")]
[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 BootlegBestiary
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Skeletogne.BootlegBestiary", "BootlegBestiary", "1.0.0")]
	public class BootlegBestiary : 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.BootlegBestiary";

		public const string PluginAuthor = "Skeletogne";

		public const string PluginName = "BootlegBestiary";

		public const string PluginVersion = "1.0.0";

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

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

		public static BootlegBestiary 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);
			VanillaAssets.Init();
			CustomAssets.Init();
			ClonedAssets.Init();
			foreach (KeyValuePair<Type, ConfigEntry<bool>> mainModuleConfigEntry in mainModuleConfigEntries)
			{
				Type key = mainModuleConfigEntry.Key;
				((Component)Instance).gameObject.AddComponent(key);
			}
		}
	}
	public static class EnemiesPlusUtils
	{
		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}");
			}
			else
			{
				if (targetIdx == currentIdx)
				{
					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);
		}
	}
	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,
			Multiplier
		}

		public static void Init(ConfigFile cfg)
		{
			if (BootlegBestiary.RooInstalled)
			{
				InitRoO();
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Type[] array = (from type in executingAssembly.GetTypes()
				where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(SetupModule))
				select type).ToArray();
			Type[] array2 = array;
			foreach (Type type2 in array2)
			{
				BootlegBestiary.ModuleInfoAttribute customAttribute = type2.GetCustomAttribute<BootlegBestiary.ModuleInfoAttribute>();
				if (customAttribute != null)
				{
					ConfigEntry<bool> value = cfg.BindOption(customAttribute.Section ?? "", customAttribute.ModuleName ?? "", defaultValue: true, customAttribute.Description ?? "", customAttribute.RequiresRestart);
					BootlegBestiary.Instance.mainModuleConfigEntries.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("BootlegBestiary", "Skeletogne.BootlegBestiary", "BootlegBestiary");
				byte[] array = File.ReadAllBytes(Path.Combine(BootlegBestiary.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 ex)
			{
				Log.Debug(ex.ToString());
			}
		}

		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 (BootlegBestiary.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 (BootlegBestiary.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 (BootlegBestiary.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", 
				FormatType.Multiplier => "x", 
				_ => "", 
			};
		}
	}
}
namespace BootlegBestiary.SkyDracon
{
	[BootlegBestiary.ModuleInfo("Enable Enemy", "Adds Marrowings to the game.", "Marrowing", true)]
	public class SkyDraconSetup : SetupModule
	{
		public class DraconFlamebreathAndDiveSkillDef : SkillDef
		{
			private class InstanceData : BaseSkillInstanceData
			{
				public SkyDraconBehaviourController controller;
			}

			public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
			{
				return (BaseSkillInstanceData)(object)new InstanceData
				{
					controller = ((Component)skillSlot.characterBody).gameObject.GetComponent<SkyDraconBehaviourController>()
				};
			}

			public override bool IsReady([NotNull] GenericSkill skillSlot)
			{
				InstanceData instanceData = skillSlot.skillInstanceData as InstanceData;
				if ((Object)(object)instanceData?.controller == (Object)null)
				{
					return false;
				}
				return ((instanceData != null && instanceData.controller.draconState == SkyDraconBehaviourController.DraconState.Grounded) || instanceData.controller.canUseSkills) && ((SkillDef)this).IsReady(skillSlot);
			}
		}

		public class DraconEmergeSkillDef : SkillDef
		{
			private class InstanceData : BaseSkillInstanceData
			{
				public SkyDraconBehaviourController controller;
			}

			public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
			{
				return (BaseSkillInstanceData)(object)new InstanceData
				{
					controller = ((Component)skillSlot.characterBody).gameObject.GetComponent<SkyDraconBehaviourController>()
				};
			}

			public override bool IsReady([NotNull] GenericSkill skillSlot)
			{
				InstanceData instanceData = skillSlot.skillInstanceData as InstanceData;
				if ((Object)(object)instanceData?.controller == (Object)null)
				{
					return false;
				}
				return instanceData != null && instanceData.controller.draconState == SkyDraconBehaviourController.DraconState.Grounded && ((SkillDef)this).IsReady(skillSlot);
			}
		}

		private CharacterBody draconBody;

		public override void RegisterConfig()
		{
			base.RegisterConfig();
			BindStats(CustomAssets.SkyDraconBodyPrefab, new List<CharacterSpawnCard>(1) { CustomAssets.SkyDraconSpawnCard });
		}

		public override void Initialise()
		{
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: 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_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: 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_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_072f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0734: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07be: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_081e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Unknown result type (might be due to invalid IL or missing references)
			//IL_0838: Unknown result type (might be due to invalid IL or missing references)
			//IL_0860: Unknown result type (might be due to invalid IL or missing references)
			//IL_0865: Unknown result type (might be due to invalid IL or missing references)
			//IL_087a: Unknown result type (might be due to invalid IL or missing references)
			//IL_087f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08db: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fa: Unknown result type (might be due to invalid IL or missing references)
			base.Initialise();
			GameObject skyDraconFlamebreathEffect = ClonedAssets.SkyDraconFlamebreathEffect;
			GameObject skyDraconBodyPrefab = CustomAssets.SkyDraconBodyPrefab;
			GameObject skyDraconMasterPrefab = CustomAssets.SkyDraconMasterPrefab;
			CharacterSpawnCard skyDraconSpawnCard = CustomAssets.SkyDraconSpawnCard;
			PrefabAPI.RegisterNetworkPrefab(skyDraconBodyPrefab);
			PrefabAPI.RegisterNetworkPrefab(skyDraconMasterPrefab);
			skyDraconBodyPrefab.AddComponent<SkyDraconBehaviourController>();
			draconBody = skyDraconBodyPrefab.GetComponent<CharacterBody>();
			HurtBoxLayersToEntityPrecise(skyDraconBodyPrefab);
			string text = "Marrowing";
			AddNameToken(skyDraconBodyPrefab, text);
			AddLoreToken(skyDraconBodyPrefab, CreateLoreToken());
			SetDeathState(skyDraconBodyPrefab, typeof(Death));
			ConfigureESM(skyDraconBodyPrefab, "Body", typeof(SkyDraconCharacterMain), registerMainStateType: true, typeof(Spawn));
			ConfigureESM(skyDraconBodyPrefab, "ControlFlight", typeof(Flight), registerMainStateType: true, typeof(Flight), registerInitialStateType: false);
			ContentAddition.AddBody(skyDraconBodyPrefab);
			ContentAddition.AddMaster(skyDraconMasterPrefab);
			AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsRoost, (MonsterCategory)3, 2, (MonsterSpawnDistance)0, 5);
			AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsAqueduct, (MonsterCategory)3, 2, (MonsterSpawnDistance)0);
			AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsAlluvium, (MonsterCategory)3, 2, (MonsterSpawnDistance)0);
			AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsAbyssal, (MonsterCategory)3, 2, (MonsterSpawnDistance)0);
			AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsHelminth, (MonsterCategory)3, 2, (MonsterSpawnDistance)0);
			bool flag = default(bool);
			SkillDefData data = new SkillDefData
			{
				objectName = "SkyDraconBodyFlamebreath",
				skillName = "SkyDraconFlamebreath",
				esmName = "Body",
				activationState = ContentAddition.AddEntityState<Flamebreath>(ref flag),
				cooldown = 4f,
				cdOnEnd = true,
				intPrio = (InterruptPriority)0,
				combatSkill = true
			};
			DraconFlamebreathAndDiveSkillDef skillDef = CreateSkillDef<DraconFlamebreathAndDiveSkillDef>(data);
			CreateGenericSkill(skyDraconBodyPrefab, (SkillDef)(object)skillDef, "SkyDraconPrimaryFamily", (SkillSlot)0);
			SkillDefData data2 = new SkillDefData
			{
				objectName = "SkyDraconBodyDiveBomb",
				skillName = "SkyDraconDiveBomb",
				esmName = "Body",
				activationState = ContentAddition.AddEntityState<DiveBomb>(ref flag),
				cooldown = 15f,
				combatSkill = true,
				intPrio = (InterruptPriority)0
			};
			DraconFlamebreathAndDiveSkillDef skillDef2 = CreateSkillDef<DraconFlamebreathAndDiveSkillDef>(data2);
			CreateGenericSkill(skyDraconBodyPrefab, (SkillDef)(object)skillDef2, "SkyDraconSecondaryFamily", (SkillSlot)1);
			SkillDefData data3 = new SkillDefData
			{
				objectName = "SkyDraconBodyEmerge",
				skillName = "SkyDraconEmerge",
				esmName = "Body",
				activationState = ContentAddition.AddEntityState<BurrowEmerge>(ref flag),
				cooldown = 6f,
				combatSkill = true,
				intPrio = (InterruptPriority)0
			};
			DraconEmergeSkillDef skillDef3 = CreateSkillDef<DraconEmergeSkillDef>(data3);
			CreateGenericSkill(skyDraconBodyPrefab, (SkillDef)(object)skillDef3, "SkyDraconUtilityFamily", (SkillSlot)2);
			RegisterLooseEntityStates(new List<Type>(4)
			{
				typeof(Squirm),
				typeof(BurrowRelocate),
				typeof(Stun),
				typeof(FlyingStun)
			});
			SetupFlamebreathPrefab();
			EntityStateMachine.SetInterruptState += new hook_SetInterruptState(SetDraconStunState);
			SetupLogbookEntry(skyDraconBodyPrefab, "UnlockableSkyDraconLog", "SKELETOGNE_UNLOCKABLE_LOG_SKYDRACON", text);
			ItemDisplayRuleSet skyDraconItemDisplayRuleset = CustomAssets.SkyDraconItemDisplayRuleset;
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteFire, new HornDisplayInfo[2]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixFire,
					localPos = new Vector3(0.6f, 1.26f, -1.14f),
					localAngles = new Vector3(0f, 0f, 315f),
					localScale = new Vector3(1.2f, 1.2f, 1.2f)
				},
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixFire,
					localPos = new Vector3(-0.6f, 1.26f, -1.14f),
					localAngles = new Vector3(0f, 0f, 45f),
					localScale = new Vector3(-1.2f, 1.2f, 1.2f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteLightning, new HornDisplayInfo[2]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixLightning,
					localPos = new Vector3(0f, 0.83514f, -2.05429f),
					localAngles = new Vector3(41.17938f, 180f, 180f),
					localScale = new Vector3(3f, 3f, 3f)
				},
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixLightning,
					localPos = new Vector3(0f, 1.7556f, -1.87802f),
					localAngles = new Vector3(359.0717f, 180f, 180f),
					localScale = new Vector3(2f, 2f, 2f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteIce, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixIce,
					localPos = new Vector3(0f, -0.11602f, -3.22486f),
					localAngles = new Vector3(342.0648f, 0f, 180f),
					localScale = new Vector3(0.3f, 0.3f, 0.3f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteEarth, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixEarth,
					localPos = new Vector3(-0.08931f, 1.62895f, -1.40961f),
					localAngles = new Vector3(270f, 0f, 0f),
					localScale = new Vector3(7f, 7f, 7f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteAurelionite, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixAurelionite,
					localPos = new Vector3(0f, 1.29796f, -1.89872f),
					localAngles = new Vector3(300.7701f, 180f, 180f),
					localScale = new Vector3(5f, 5f, 5f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteVoid, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixVoid,
					localPos = new Vector3(0f, 2.18085f, -0.24028f),
					localAngles = new Vector3(290.697f, 0f, -2E-05f),
					localScale = new Vector3(2.5f, 2.5f, 2.5f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDElitePoison, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixPoison,
					localPos = new Vector3(0f, 0.64402f, -1.16346f),
					localAngles = new Vector3(38.47652f, 180f, 180f),
					localScale = new Vector3(0.6f, 0.6f, 1f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteHaunted, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixHaunted,
					localPos = new Vector3(0f, -0.08929f, -2.40165f),
					localAngles = new Vector3(338.0297f, 0f, 180f),
					localScale = new Vector3(0.6f, 0.6f, 0.6f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteBead, new HornDisplayInfo[1]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixBead,
					localPos = new Vector3(-0.00036f, 0.54291f, -1.55782f),
					localAngles = new Vector3(291.9088f, 169.829f, 173.293f),
					localScale = new Vector3(0.25f, 0.25f, 0.25f)
				}
			});
			SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteCollective, new HornDisplayInfo[3]
			{
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixCollective,
					localPos = new Vector3(0.65f, -0.25f, -2.14f),
					localAngles = new Vector3(20.40761f, 322f, 20f),
					localScale = new Vector3(2.8f, 2.8f, 2.8f)
				},
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixCollective,
					localPos = new Vector3(-0.65f, -0.25f, -2.14f),
					localAngles = new Vector3(340f, 222f, 20.00001f),
					localScale = new Vector3(2.8f, 2.8f, -2.8f)
				},
				new HornDisplayInfo
				{
					followerPrefab = VanillaAssets.DisplayAffixCollectiveRing,
					localPos = new Vector3(0f, 0.03604f, -0.00557f),
					localAngles = new Vector3(270f, -3E-05f, 0f),
					localScale = new Vector3(5f, 5f, 5f)
				}
			});
		}

		public string CreateLoreToken()
		{
			return "The water lasted two days after my exile.\n\nI had a lot of time to contemplate. On how the dunepeople weren't afraid. Not of the shrieks, not of the flames, not of my warnings.\n\nSoundly, they slept through nights where I tossed and turned, kept awake by those otherworldly calls.\n\nWhen I encountered one of the hell-beasts in the wild, when it erupted from the sand below, adrenaline overtook me.\n\nI saw a demon-skull and blood-red scales. I didn't hesitate. It wasn't the first beast I'd had to put down on this miserable planet. I told myself it wouldn't be the last.\n\n\"They're coming!\" I yelled. \"There's dozens of them out there!\" I warned. But none listened. The dunefolk stopped talking to me. Wouldn't meet my eyeline. Not long after, the chief painted a tar-black mark on my forehead. Cursed. Exiled. The guards escorted me to the walls, weapons drawn.\n\nHow was I supposed to know that killing one of those horrid things was some ridiculous cultural taboo?\n\n----------------------------------------\n\nThe mark burns. My skin burns. Everything burns. I dream of cold water and wake to a dry mouth and a screaming sky.\n\nI can hear their shrieks. Above and Below. Following. Patient. Circling.\n\n----------------------------------------\n\nI... don't think the curse is superstition.";
		}

		public void SetupFlamebreathPrefab()
		{
			//IL_002d: 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)
			ParticleSystem[] componentsInChildren = ClonedAssets.SkyDraconFlamebreathEffect.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				((Component)val).transform.localScale = new Vector3(1.8f, 1.8f, 4.5f);
				((Component)val).transform.localPosition = new Vector3(0f, 0f, 16f);
			}
		}

		private bool SetDraconStunState(orig_SetInterruptState orig, EntityStateMachine self, EntityState newNextState, InterruptPriority interruptPriority)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			bool flag = orig.Invoke(self, newNextState, interruptPriority);
			if (flag && (Object)(object)self.commonComponents.characterBody != (Object)null)
			{
				CharacterBody characterBody = self.commonComponents.characterBody;
				if (characterBody.bodyIndex == draconBody.bodyIndex && newNextState is StunState)
				{
					self.SetNextState((EntityState)(object)new Stun());
				}
			}
			return flag;
		}
	}
}
namespace BootlegBestiary.SkyDracon.EntityStates
{
	public class BurrowEmerge : BaseSkillState
	{
		private enum UnburrowState
		{
			Start,
			Burrowing,
			Telegraphing,
			Emerging
		}

		private static float startDuration = 1.5f;

		private static float burrowDuration = 1.25f;

		private static float telegraphDuration = 1f;

		private static float emergeDuration = 1f;

		private SkyDraconBehaviourController controller;

		private static GameObject indicatorPrefab = VanillaAssets.GroundOnlyTargetIndicator;

		private GameObject indicatorInstance;

		private Vector3 startPosition;

		private Vector3 targetPosition;

		private float effectTimer;

		private static float effectInterval = 0.15f;

		private static GameObject burrowEffect = VanillaAssets.MiniMushrumPlantEffect;

		private static GameObject emergeEffect = VanillaAssets.BeetleGuardSlamEffect;

		private Vector3 differenceBetweenPositionAndFootPosition;

		private UnburrowState unburrowState = UnburrowState.Start;

		public override void OnEnter()
		{
			//IL_004c: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<SkyDraconBehaviourController>();
			controller.RemoveCollision();
			((EntityState)this).PlayCrossfade("Base", "GroundedBurrow", 0.1f);
			startPosition = ((EntityState)this).characterBody.transform.position;
			differenceBetweenPositionAndFootPosition = ((EntityState)this).characterBody.transform.position - ((EntityState)this).characterBody.footPosition;
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			EntityState.Destroy((Object)(object)indicatorInstance);
			if ((Object)(object)((EntityState)this).skillLocator != (Object)null && (Object)(object)((EntityState)this).skillLocator.secondary != (Object)null)
			{
				((EntityState)this).skillLocator.secondary.RemoveAllStocks();
			}
		}

		public override void FixedUpdate()
		{
			//IL_015c: 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)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Expected O, but got Unknown
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Expected O, but got Unknown
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > startDuration && unburrowState == UnburrowState.Start)
			{
				unburrowState = UnburrowState.Burrowing;
				controller.BeginBurrowedState();
				if ((Object)(object)((EntityState)this).characterBody != (Object)null && (Object)(object)((EntityState)this).characterBody.master != (Object)null)
				{
					targetPosition = ((EntityState)this).characterBody.transform.position;
					BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent<BaseAI>();
					if ((Object)(object)component != (Object)null && (Object)(object)component.currentEnemy.characterBody != (Object)null)
					{
						Vector3 corePosition = component.currentEnemy.characterBody.corePosition;
						Vector3 position = ((EntityState)this).characterBody.transform.position;
						RaycastHit val = default(RaycastHit);
						if (Vector3.Distance(corePosition, targetPosition) < 50f && Physics.Raycast(corePosition, Vector3.down, ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
						{
							targetPosition = ((RaycastHit)(ref val)).point;
						}
					}
				}
			}
			if (unburrowState == UnburrowState.Burrowing)
			{
				float num = Mathf.Clamp01((((EntityState)this).fixedAge - startDuration) / burrowDuration);
				Vector3 val2 = Vector3.Lerp(startPosition, targetPosition, num);
				TeleportHelper.TeleportBody(((EntityState)this).characterBody, val2, true);
				effectTimer -= Time.fixedDeltaTime;
				if (effectTimer < 0f)
				{
					effectTimer += effectInterval;
					Vector3 position2 = ((EntityState)this).characterBody.transform.position;
					Vector3 position3 = ((EntityState)this).characterBody.transform.position;
					position3.y = Mathf.Max(startPosition.y, targetPosition.y);
					RaycastHit val3 = default(RaycastHit);
					if (Physics.Raycast(position3 + new Vector3(0f, 10f, 0f), Vector3.down, ref val3, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						position2 = ((RaycastHit)(ref val3)).point;
						EffectManager.SpawnEffect(burrowEffect, new EffectData
						{
							origin = position2,
							scale = 1f
						}, true);
					}
				}
			}
			if (((EntityState)this).fixedAge > startDuration + burrowDuration && unburrowState == UnburrowState.Burrowing)
			{
				unburrowState = UnburrowState.Telegraphing;
				indicatorInstance = Object.Instantiate<GameObject>(indicatorPrefab, targetPosition, Util.QuaternionSafeLookRotation(Vector3.up));
				TeamAreaIndicator component2 = indicatorInstance.GetComponent<TeamAreaIndicator>();
				component2.teamComponent = ((EntityState)this).characterBody.teamComponent;
				((Component)component2).transform.localScale = Vector3.one * 6f;
			}
			if (((EntityState)this).fixedAge > startDuration + burrowDuration + telegraphDuration && unburrowState == UnburrowState.Telegraphing)
			{
				unburrowState = UnburrowState.Emerging;
				controller.RestoreCollision();
				controller.ExitBurrowIntoAirborneState();
				TeleportHelper.TeleportBody(((EntityState)this).characterBody, targetPosition + new Vector3(0f, 2f, 0f), true);
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)this).characterMotor.velocity = new Vector3(0f, 25f, 0f);
				((EntityState)this).PlayAnimation("Base", "GroundedToAir");
				EffectManager.SpawnEffect(emergeEffect, new EffectData
				{
					origin = targetPosition,
					scale = 1f
				}, true);
				Util.PlaySound("Play_skyDracon_unburrow", ((Component)((EntityState)this).characterBody).gameObject);
				BlastAttack val4 = new BlastAttack();
				val4.attacker = ((Component)((EntityState)this).characterBody).gameObject;
				val4.inflictor = ((Component)((EntityState)this).characterBody).gameObject;
				val4.position = targetPosition;
				val4.radius = 6f;
				val4.crit = ((BaseState)this).RollCrit();
				val4.procCoefficient = 1f;
				val4.damageColorIndex = (DamageColorIndex)0;
				val4.baseDamage = 2f * ((BaseState)this).damageStat;
				val4.attackerFiltering = (AttackerFiltering)2;
				val4.baseForce = 2000f;
				val4.bonusForce = new Vector3(0f, 2000f, 0f);
				val4.damageType = new DamageTypeCombo
				{
					damageType = (DamageType)0,
					damageSource = (DamageSource)2
				};
				val4.procChainMask = default(ProcChainMask);
				val4.Fire();
			}
			if (((EntityState)this).fixedAge > startDuration + burrowDuration + telegraphDuration + emergeDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (unburrowState == UnburrowState.Start || unburrowState == UnburrowState.Emerging)
			{
				return (InterruptPriority)2;
			}
			return (InterruptPriority)9;
		}
	}
	public class BurrowRelocate : BaseSkillState
	{
		private static float burrowDuration = 1.25f;

		private static float emergeDuration = 1f;

		private static float unburrowDelay = 0.5f;

		private float effectTimer;

		private static float effectInterval = 0.2f;

		private static GameObject burrowEffect = VanillaAssets.MiniMushrumPlantEffect;

		private Vector3 startPosition;

		private Vector3 targetPosition;

		private bool completedMovement;

		private SkyDraconBehaviourController controller;

		public override void OnEnter()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			if ((Object)(object)modelAnimator != (Object)null)
			{
				modelAnimator.SetFloat("diveBombAngleCycle", 0.5f);
			}
			if ((Object)(object)((EntityState)this).skillLocator != (Object)null && (Object)(object)((EntityState)this).skillLocator.utility != (Object)null)
			{
				((EntityState)this).skillLocator.utility.RemoveAllStocks();
			}
			controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<SkyDraconBehaviourController>();
			startPosition = ((EntityState)this).characterBody.transform.position;
			targetPosition = startPosition;
			Vector3 nodeSearchPosition = ((EntityState)this).characterBody.transform.position;
			if ((Object)(object)((EntityState)this).characterBody != (Object)null && (Object)(object)((EntityState)this).characterBody.master != (Object)null)
			{
				BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent<BaseAI>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.currentEnemy.characterBody != (Object)null)
				{
					Vector3 position = component.currentEnemy.characterBody.transform.position;
					Vector3 position2 = ((EntityState)this).characterBody.transform.position;
					float num = Vector3.Distance(position, position2);
					if (num < 40f)
					{
						nodeSearchPosition = position;
					}
				}
			}
			NodeGraph groundNodes = SceneInfo.instance.groundNodes;
			NodeIndex favoredNodeIndex = GetFavoredNodeIndex(nodeSearchPosition, groundNodes);
			Vector3 val = default(Vector3);
			if (!groundNodes.GetNodePosition(favoredNodeIndex, ref val))
			{
				return;
			}
			int i = 0;
			bool flag = false;
			RaycastHit val2 = default(RaycastHit);
			for (; i < 6; i++)
			{
				if (flag)
				{
					break;
				}
				float num2 = Random.Range(-2f, 2f);
				float num3 = Random.Range(-2f, 2f);
				val.x += num2;
				val.z += num3;
				val.y += 5f;
				if (Physics.Raycast(val, Vector3.down, ref val2, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					targetPosition = ((RaycastHit)(ref val2)).point;
					flag = true;
				}
			}
		}

		public NodeIndex GetFavoredNodeIndex(Vector3 nodeSearchPosition, NodeGraph nodeGraph)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			List<NodeIndex> list = nodeGraph.FindNodesInRange(nodeSearchPosition, 10f, 30f, (HullMask)1);
			if (list.Count == 0)
			{
				return nodeGraph.FindClosestNode(nodeSearchPosition, (HullClassification)0, float.PositiveInfinity);
			}
			return list[Random.RandomRangeInt(0, list.Count)];
		}

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

		public override void FixedUpdate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			float num = Mathf.Clamp01(((EntityState)this).fixedAge / burrowDuration);
			Vector3 position = Vector3.Lerp(startPosition, targetPosition, num);
			((EntityState)this).characterBody.transform.position = position;
			effectTimer -= Time.fixedDeltaTime;
			if (effectTimer < 0f)
			{
				effectTimer += effectInterval;
				Vector3 position2 = ((EntityState)this).characterBody.transform.position;
				position2.y = Mathf.Max(targetPosition.y, startPosition.y) + 1f;
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(position2, Vector3.down, ref val, 25f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					Vector3 point = ((RaycastHit)(ref val)).point;
					EffectManager.SpawnEffect(burrowEffect, new EffectData
					{
						origin = point,
						scale = 1f
					}, true);
				}
			}
			if (((EntityState)this).fixedAge > burrowDuration + unburrowDelay && !completedMovement)
			{
				completedMovement = true;
				controller.ExitBurrowIntoGroundedState();
				((EntityState)this).PlayAnimation("Base", "Unearth");
			}
			if (((EntityState)this).fixedAge > burrowDuration + unburrowDelay + emergeDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)9;
		}
	}
	public class Death : GenericCharacterDeath
	{
		private enum FallingDeathAnimState
		{
			Start,
			Falling,
			End
		}

		private static float startDuration = 1f;

		private Animator animator;

		protected ICharacterGravityParameterProvider gravityProvider;

		protected ICharacterFlightParameterProvider flightProvider;

		private static GameObject dirtEffect = VanillaAssets.BellPartsImpactEffect;

		private float effectTimer;

		private static float effectInterval = 0.1f;

		private bool playedFlap;

		private SkyDraconBehaviourController controller;

		private SkyDraconBehaviourController.DraconState draconStateAtDeath;

		private FallingDeathAnimState fallingDeathAnimState;

		public override void OnEnter()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			draconStateAtDeath = SkyDraconBehaviourController.DraconState.Flying;
			controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<SkyDraconBehaviourController>();
			if ((Object)(object)controller != (Object)null)
			{
				draconStateAtDeath = controller.draconState;
			}
			((GenericCharacterDeath)this).OnEnter();
			Util.PlaySound("Play_skyDracon_death_new", ((EntityState)this).gameObject);
			GenericCharacterDeath.maxFallDuration = 8f;
			animator = ((EntityState)this).GetModelAnimator();
			animator.SetFloat("diveBombAngleCycle", 0.5f);
			if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Flying && (Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					HitGround();
				}
				else
				{
					((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(CharacterMotor_onHitGround);
				}
			}
			flightProvider = ((EntityState)this).gameObject.GetComponent<ICharacterFlightParameterProvider>();
			gravityProvider = ((EntityState)this).gameObject.gameObject.GetComponent<ICharacterGravityParameterProvider>();
		}

		private void CharacterMotor_onHitGround(ref HitGroundInfo hitGroundInfo)
		{
			HitGround();
		}

		private void HitGround()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_006f: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			if (fallingDeathAnimState != FallingDeathAnimState.End)
			{
				fallingDeathAnimState = FallingDeathAnimState.End;
				((EntityState)this).PlayCrossfade("Base", "DeathEnd", 0.1f);
				Util.PlaySound("Play_skyDracon_unburrow", ((EntityState)this).gameObject);
				((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(CharacterMotor_onHitGround);
				if (gravityProvider != null)
				{
					CharacterGravityParameters gravityParameters = gravityProvider.gravityParameters;
					gravityParameters.channeledAntiGravityGranterCount--;
					gravityProvider.gravityParameters = gravityParameters;
				}
				if (flightProvider != null)
				{
					CharacterFlightParameters flightParameters = flightProvider.flightParameters;
					flightParameters.channeledFlightGranterCount--;
					flightProvider.flightParameters = flightParameters;
				}
			}
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
			if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Flying)
			{
				((EntityState)this).PlayCrossfade("Base", "DeathStart", crossfadeDuration);
			}
			if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Squirming)
			{
				((EntityState)this).PlayCrossfade("Base", "SquirmDeath", 0.1f);
			}
			if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Grounded)
			{
				((EntityState)this).PlayCrossfade("Base", "GroundedDeath", 0.1f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0117: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			((GenericCharacterDeath)this).FixedUpdate();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null && ((EntityState)this).characterMotor.isGrounded && fallingDeathAnimState != FallingDeathAnimState.End && draconStateAtDeath == SkyDraconBehaviourController.DraconState.Flying)
			{
				HitGround();
			}
			if (draconStateAtDeath != 0)
			{
				return;
			}
			if (((EntityState)this).fixedAge > startDuration && fallingDeathAnimState == FallingDeathAnimState.Start)
			{
				fallingDeathAnimState = FallingDeathAnimState.Falling;
				((EntityState)this).PlayCrossfade("Base", "DeathLoop", 0.1f);
			}
			if ((Object)(object)animator != (Object)null && animator.GetFloat("deathFlapTrigger") > 0.6f && !playedFlap)
			{
				playedFlap = true;
				Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject);
			}
			if (fallingDeathAnimState != FallingDeathAnimState.End && (Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				Vector3 val = 1.5f * ((EntityState)this).characterDirection.forward + Vector3.down;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.velocity += normalized * 50f * Time.fixedDeltaTime;
			}
			if (fallingDeathAnimState == FallingDeathAnimState.End && (Object)(object)((EntityState)this).characterMotor != (Object)null && ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).magnitude > 3f && ((EntityState)this).characterMotor.isGrounded)
			{
				effectTimer -= Time.fixedDeltaTime;
				if (effectTimer < 0f)
				{
					effectTimer += effectInterval;
					EffectManager.SpawnEffect(dirtEffect, new EffectData
					{
						origin = ((EntityState)this).characterBody.transform.position,
						scale = 10f
					}, true);
				}
			}
		}
	}
	public class DiveBomb : BaseSkillState
	{
		private static float windupDuration = 1.25f;

		private static float attackDuration = 2f;

		private static float attackDurationLeniency = 0.25f;

		private Vector3 startPosition;

		private Vector3 targetPosition;

		private Vector3 initialVelocity;

		private Vector3 moveDirection;

		private bool hitGround = false;

		private bool startedDive = false;

		private Animator animator;

		private float desiredPitchValue;

		private bool failedToBurrow;

		private float flapTimer;

		private static float flapInterval = 0.2f;

		private int flapCount;

		private static int maxFramesTouchingGround = 2;

		private int framesTouchingGround;

		public override void OnEnter()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: 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_013c: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			flapTimer = flapInterval;
			animator = ((EntityState)this).GetModelAnimator();
			hitGround = false;
			((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(OnHitGround);
			startPosition = ((EntityState)this).characterBody.transform.position;
			if (!((Object)(object)((EntityState)this).characterBody != (Object)null) || !((Object)(object)((EntityState)this).characterBody.master != (Object)null))
			{
				return;
			}
			BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent<BaseAI>();
			if (!((Object)(object)component != (Object)null) || !((Object)(object)component.currentEnemy.characterBody != (Object)null))
			{
				return;
			}
			CharacterBody characterBody = component.currentEnemy.characterBody;
			NodeGraph groundNodes = SceneInfo.instance.groundNodes;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(characterBody.transform.position, Vector3.down, ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				targetPosition = ((RaycastHit)(ref val)).point;
			}
			else if ((Object)(object)characterBody != (Object)null && (Object)(object)groundNodes != (Object)null)
			{
				NodeIndex val2 = groundNodes.FindClosestNode(characterBody.transform.position, (HullClassification)0, float.PositiveInfinity);
				if (!groundNodes.GetNodePosition(val2, ref targetPosition) || targetPosition.y > startPosition.y)
				{
					((EntityState)this).outer.SetNextStateToMain();
					return;
				}
			}
			initialVelocity = Trajectory.CalculateInitialVelocityFromTime(startPosition, targetPosition, attackDuration - attackDurationLeniency, Physics.gravity.y * 1.5f, 0f, float.PositiveInfinity);
			moveDirection = targetPosition - startPosition;
			moveDirection.y = 0f;
			((Vector3)(ref moveDirection)).Normalize();
			((EntityState)this).PlayCrossfade("Base", "DiveBombStart", 0.1f);
			Vector3 normalized = ((Vector3)(ref initialVelocity)).normalized;
			float num = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f;
			desiredPitchValue = Mathf.Clamp((num + 90f) / 180f, 0f, 0.999f);
		}

		private void StartDiveBomb()
		{
			((EntityState)this).PlayCrossfade("Base", "DiveBomb", 0.1f);
		}

		private void OnHitGround(ref HitGroundInfo hitGroundInfo)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = hitGroundInfo.position;
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(((EntityState)this).characterBody.transform.position, Vector3.down, ref val, 5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				return;
			}
			if (Physics.Raycast(((EntityState)this).characterBody.transform.position - new Vector3(0f, 10f, 0f), Vector3.up, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				return;
			}
			position = ((RaycastHit)(ref val)).point;
			if (!startedDive)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (!hitGround)
			{
				hitGround = true;
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).outer.SetNextState((EntityState)(object)new Squirm
				{
					direction = moveDirection,
					groundHitPoint = position
				});
				BlastAttack val2 = new BlastAttack();
				val2.attacker = ((Component)((EntityState)this).characterBody).gameObject;
				val2.inflictor = ((Component)((EntityState)this).characterBody).gameObject;
				val2.position = position;
				val2.radius = 6f;
				val2.crit = ((BaseState)this).RollCrit();
				val2.procCoefficient = 1f;
				val2.damageColorIndex = (DamageColorIndex)0;
				val2.baseDamage = 1f * ((BaseState)this).damageStat;
				val2.attackerFiltering = (AttackerFiltering)2;
				val2.baseForce = 2000f;
				val2.bonusForce = new Vector3(0f, 2000f, 0f);
				val2.damageType = new DamageTypeCombo
				{
					damageType = (DamageType)0,
					damageSource = (DamageSource)2
				};
				val2.procChainMask = default(ProcChainMask);
				val2.Fire();
			}
		}

		public override void OnExit()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			((EntityState)this).OnExit();
			((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(OnHitGround);
		}

		public override void FixedUpdate()
		{
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!hitGround && (Object)(object)((EntityState)this).characterMotor != (Object)null && ((EntityState)this).characterMotor.isGrounded)
			{
				framesTouchingGround++;
			}
			else if (framesTouchingGround != 0)
			{
				framesTouchingGround = 0;
			}
			if (framesTouchingGround > maxFramesTouchingGround && !hitGround)
			{
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			flapTimer -= Time.fixedDeltaTime;
			if (flapTimer < 0f && flapCount < 3)
			{
				flapTimer += flapInterval;
				flapCount++;
				Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject);
			}
			if (hitGround)
			{
				return;
			}
			if (((EntityState)this).fixedAge > windupDuration && !startedDive)
			{
				startedDive = true;
				StartDiveBomb();
			}
			((EntityState)this).inputBank.moveVector = moveDirection;
			((EntityState)this).inputBank.aimDirection = moveDirection;
			((EntityState)this).characterDirection.moveVector = moveDirection;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				Vector3 val = initialVelocity + Physics.gravity * 1.5f * (((EntityState)this).fixedAge - windupDuration);
				if (val.y < 0f)
				{
					val.y *= 2f;
				}
				if (((EntityState)this).fixedAge - windupDuration < 0f)
				{
					val = initialVelocity * Mathf.Pow(Mathf.Clamp01(((EntityState)this).fixedAge / windupDuration), 3f);
				}
				((EntityState)this).characterMotor.velocity = val;
			}
			if (((EntityState)this).fixedAge > attackDuration + windupDuration)
			{
				failedToBurrow = true;
				animator.SetFloat("diveBombAngleCycle", 0.5f);
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void Update()
		{
			//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_00d4: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (failedToBurrow)
			{
				animator.SetFloat("diveBombAngleCycle", 0.5f);
			}
			else if (!startedDive)
			{
				if ((Object)(object)animator != (Object)null)
				{
					float num = Mathf.Clamp01(((EntityState)this).age / windupDuration);
					float num2 = Mathf.Lerp(0.5f, desiredPitchValue, num);
					animator.SetFloat("diveBombAngleCycle", num2);
				}
			}
			else if ((Object)(object)animator != (Object)null && ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).sqrMagnitude > 0.01f)
			{
				Vector3 normalized = ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized;
				float num3 = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f;
				float num4 = Mathf.Clamp((num3 + 90f) / 180f, 0f, 0.999f);
				animator.SetFloat("diveBombAngleCycle", num4);
			}
		}

		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 Flamebreath : BaseSkillState
	{
		private enum FlamebreathState
		{
			Windup,
			Attack,
			Exit
		}

		private static float windupDuration = 1.25f;

		private float attackDuration = 1.5f;

		private static float exitDuration = 1.75f;

		private Vector3 moveDirection;

		private Vector3 attackDirection;

		private static float flightSpeed = 30f;

		private Transform flamebreathInstance;

		private EffectManagerHelper _emh_flamebreathEffectInstance;

		private static GameObject impactEffect = VanillaAssets.OmniExplosionEffect;

		private float tickInterval = 0.25f;

		private float tickTimer;

		private bool playedEndFlap;

		private static GameObject chargeVfxPrefab = VanillaAssets.LemBruiserFlamebreathChargeEffect;

		private GameObject chargeVfxInstance;

		private EffectManagerHelper _emh_chargeVfx;

		private SkyDraconBehaviourController controller;

		private bool groundedAttack;

		private float perTickDamageCoefficient = 1f;

		private FlamebreathState attackState;

		private float totalDuration;

		private static string muzzleString = "Muzzle";

		private Transform muzzleTransform;

		private Animator modelAnimator;

		private CharacterBody targetBody;

		public override void OnEnter()
		{
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<SkyDraconBehaviourController>();
			if ((Object)(object)controller != (Object)null)
			{
				groundedAttack = controller.draconState == SkyDraconBehaviourController.DraconState.Grounded;
			}
			if (!groundedAttack)
			{
				Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject);
			}
			attackDuration = (groundedAttack ? 2.5f : 1.5f);
			perTickDamageCoefficient = (groundedAttack ? 0.5f : 0.75f);
			Util.PlaySound("Play_skyDracon_flameWindup", ((EntityState)this).gameObject);
			modelAnimator = ((EntityState)this).GetComponent<Animator>();
			totalDuration = windupDuration + attackDuration + exitDuration;
			((BaseState)this).StartAimMode(totalDuration, false);
			attackState = FlamebreathState.Windup;
			((EntityState)this).PlayCrossfade("Body", groundedAttack ? "GroundedFlamebreathWindup" : "FlamebreathWindup", 0.2f);
			BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent<BaseAI>();
			ChildLocator modelChildLocator = ((EntityState)this).GetModelChildLocator();
			if ((Object)(object)modelChildLocator != (Object)null)
			{
				muzzleTransform = modelChildLocator.FindChild(muzzleString);
			}
			if ((Object)(object)component != (Object)null && (Object)(object)component.currentEnemy.characterBody != (Object)null)
			{
				targetBody = component.currentEnemy.characterBody;
				Vector3 val = targetBody.corePosition - ((EntityState)this).characterBody.corePosition;
				if (!groundedAttack)
				{
					val.y = 0f;
					((Vector3)(ref val)).Normalize();
					moveDirection = val;
					Vector3 val2 = val + 2f * Vector3.down;
					attackDirection = ((Vector3)(ref val2)).normalized;
				}
				else
				{
					moveDirection = ((Vector3)(ref val)).normalized;
					attackDirection = ((Vector3)(ref val)).normalized;
				}
			}
			else
			{
				moveDirection = ((EntityState)this).inputBank.aimDirection;
				moveDirection.y = 0f;
				attackDirection = ((EntityState)this).inputBank.aimDirection;
			}
			if ((Object)(object)muzzleTransform != (Object)null)
			{
				if (!EffectManager.ShouldUsePooledEffect(chargeVfxPrefab))
				{
					chargeVfxInstance = Object.Instantiate<GameObject>(chargeVfxPrefab, muzzleTransform.position, muzzleTransform.rotation);
				}
				else
				{
					_emh_chargeVfx = EffectManager.GetAndActivatePooledEffect(chargeVfxPrefab, muzzleTransform.position, muzzleTransform.rotation);
					chargeVfxInstance = ((Component)_emh_chargeVfx).gameObject;
				}
				chargeVfxInstance.transform.parent = muzzleTransform;
			}
		}

		public override void FixedUpdate()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			((EntityState)this).inputBank.moveVector = moveDirection;
			Vector3 val;
			if (!groundedAttack || (Object)(object)targetBody == (Object)null)
			{
				InputBankTest inputBank = ((EntityState)this).inputBank;
				val = moveDirection + Vector3.down;
				inputBank.aimDirection = ((Vector3)(ref val)).normalized;
			}
			((EntityState)this).characterDirection.moveVector = moveDirection;
			if (groundedAttack && (Object)(object)targetBody != (Object)null)
			{
				Vector3 corePosition = targetBody.corePosition;
				Ray aimRay = ((BaseState)this).GetAimRay();
				val = corePosition - ((Ray)(ref aimRay)).origin;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				attackDirection = Vector3.RotateTowards(attackDirection, normalized, 0.005f, 0f);
				((EntityState)this).inputBank.aimDirection = attackDirection;
			}
			if (!groundedAttack)
			{
				ApplyVelocity();
				if ((Object)(object)modelAnimator != (Object)null && modelAnimator.GetFloat("flameEndFlapTrigger") > 0.6f && !playedEndFlap)
				{
					Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject);
					playedEndFlap = true;
				}
			}
			if (((EntityState)this).fixedAge > windupDuration && attackState == FlamebreathState.Windup)
			{
				attackState = FlamebreathState.Attack;
				((EntityState)this).PlayCrossfade("Body", groundedAttack ? "GroundedFlamebreathLoop" : "Flamebreath", 0.1f);
				if (!EffectManager.ShouldUsePooledEffect(ClonedAssets.SkyDraconFlamebreathEffect))
				{
					flamebreathInstance = Object.Instantiate<GameObject>(ClonedAssets.SkyDraconFlamebreathEffect, muzzleTransform).transform;
				}
				else
				{
					_emh_flamebreathEffectInstance = EffectManager.GetAndActivatePooledEffect(ClonedAssets.SkyDraconFlamebreathEffect, muzzleTransform, true);
					flamebreathInstance = ((Component)_emh_flamebreathEffectInstance).gameObject.transform;
				}
				flamebreathInstance.localScale = Vector3.one;
				((Component)flamebreathInstance).GetComponent<ScaleParticleSystemDuration>().newDuration = attackDuration;
				Util.PlaySound("Play_lemurianBruiser_m2_loop", ((Component)((EntityState)this).characterBody).gameObject);
				DestroyChargeEffect();
			}
			if (((EntityState)this).fixedAge > windupDuration + attackDuration && attackState == FlamebreathState.Attack)
			{
				((EntityState)this).PlayCrossfade("Body", groundedAttack ? "GroundedFlamebreathEnd" : "FlamebreathEnd", 0.1f);
				if (!groundedAttack)
				{
					Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject);
				}
				attackState = FlamebreathState.Exit;
				DestroyFlamebreathEffect();
				Util.PlaySound("Stop_lemurianBruiser_m2_loop", ((Component)((EntityState)this).characterBody).gameObject);
			}
			if (attackState == FlamebreathState.Attack)
			{
				tickTimer -= Time.fixedDeltaTime;
				if (tickTimer < 0f)
				{
					tickTimer += tickInterval;
					FireAttack();
				}
			}
			if ((Object)(object)flamebreathInstance != (Object)null)
			{
				((Component)flamebreathInstance).transform.forward = attackDirection;
			}
			if (((EntityState)this).fixedAge > totalDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void FireAttack()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0026: 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_0032: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			BulletAttack val = new BulletAttack();
			val.owner = ((EntityState)this).gameObject;
			val.weapon = ((EntityState)this).gameObject;
			val.origin = muzzleTransform.position;
			val.aimVector = attackDirection;
			val.minSpread = 0f;
			val.maxSpread = 0f;
			val.damage = perTickDamageCoefficient * ((BaseState)this).damageStat;
			val.force = 0f;
			val.isCrit = ((BaseState)this).RollCrit();
			val.hitEffectPrefab = impactEffect;
			val.falloffModel = (FalloffModel)0;
			val.stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask;
			val.procCoefficient = 0.5f;
			val.maxDistance = 35f;
			val.smartCollision = true;
			val.damageType = new DamageTypeCombo
			{
				damageType = (DamageType)128,
				damageSource = (DamageSource)1
			};
			val.radius = 2.5f;
			val.Fire();
		}

		private void ApplyVelocity()
		{
			//IL_004a: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((EntityState)this).characterMotor == (Object)null))
			{
				if (attackState == FlamebreathState.Windup)
				{
					float num = Mathf.Clamp01(((EntityState)this).fixedAge / windupDuration);
					float num2 = Mathf.Pow(num, 2f);
					((EntityState)this).characterMotor.velocity = moveDirection * flightSpeed * num2;
				}
				if (attackState == FlamebreathState.Attack)
				{
					((EntityState)this).characterMotor.velocity = moveDirection * flightSpeed;
				}
				if (attackState == FlamebreathState.Exit)
				{
					float num3 = 1f - Mathf.Clamp01((((EntityState)this).fixedAge - windupDuration - attackDuration) / exitDuration);
					float num4 = Mathf.Pow(num3, 2f);
					((EntityState)this).characterMotor.velocity = moveDirection * flightSpeed * num4;
				}
			}
		}

		private void DestroyFlamebreathEffect()
		{
			if ((Object)(object)flamebreathInstance != (Object)null)
			{
				if ((Object)(object)_emh_flamebreathEffectInstance != (Object)null && _emh_flamebreathEffectInstance.OwningPool != null)
				{
					((GenericPool<EffectManagerHelper>)(object)_emh_flamebreathEffectInstance.OwningPool).ReturnObject(_emh_flamebreathEffectInstance);
				}
				else
				{
					EntityState.Destroy((Object)(object)((Component)flamebreathInstance).gameObject);
				}
				flamebreathInstance = null;
				_emh_flamebreathEffectInstance = null;
			}
		}

		private void DestroyChargeEffect()
		{
			if ((Object)(object)chargeVfxInstance != (Object)null)
			{
				if ((Object)(object)_emh_chargeVfx != (Object)null && _emh_chargeVfx.OwningPool != null)
				{
					((GenericPool<EffectManagerHelper>)(object)_emh_chargeVfx.OwningPool).ReturnObject(_emh_chargeVfx);
				}
				else
				{
					EntityState.Destroy((Object)(object)chargeVfxInstance);
				}
				chargeVfxInstance = null;
				_emh_chargeVfx = null;
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			Destr