Decompiled source of SonicTheHedgehog v3.0.3

SonicTheHedgehog.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using EntityStates;
using EntityStates.Commando;
using HG;
using HG.BlendableTypes;
using HG.Reflection;
using HarmonyLib;
using KinematicCharacterController;
using LoadingScreenFix;
using LookingGlass.ItemStatsNameSpace;
using LookingGlass.LookingGlassLanguage;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using SonicTheHedgehog.Components;
using SonicTheHedgehog.Modules;
using SonicTheHedgehog.Modules.Achievements;
using SonicTheHedgehog.Modules.Characters;
using SonicTheHedgehog.Modules.Forms;
using SonicTheHedgehog.Modules.Survivors;
using SonicTheHedgehog.SkillStates;
using SonicTheHedgehog.SkillStates.SuperUpgrades;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SonicTheHedgehog")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SonicTheHedgehog")]
[assembly: AssemblyTitle("SonicTheHedgehog")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace SonicTheHedgehog
{
	internal static class Log
	{
		internal 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);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.ds_gaming.SonicTheHedgehog", "SonicTheHedgehog", "3.0.3")]
	public class SonicTheHedgehogPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Init <>9__12_0;

			public static Func<float, int, float, List<float>> <>9__14_0;

			internal void <EmoteSkeleton>b__12_0(orig_Init orig)
			{
				orig.Invoke();
				foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
				{
					if (((Object)allSurvivorDef.bodyPrefab).name == "SonicTheHedgehog")
					{
						GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("SonicEmoteSupport.prefab");
						CustomEmotesAPI.ImportArmature(allSurvivorDef.bodyPrefab, val, 0, true);
						val.GetComponentInChildren<BoneMapper>().scale = 1f;
					}
				}
			}

			internal List<float> <LookingGlassSetup>b__14_0(float luck, int stackCount, float procChance)
			{
				List<float> list = new List<float>();
				if (Forms.formToHandlerObject.TryGetValue(Forms.superSonicDef, out var value))
				{
					SuperSonicHandler superSonicHandler = default(SuperSonicHandler);
					if (value.TryGetComponent<SuperSonicHandler>(ref superSonicHandler))
					{
						list.Add(7 - ((SyncedItemTracker)superSonicHandler.itemTracker).missingItems.Count);
					}
				}
				else
				{
					list.Add(-1f);
				}
				return list;
			}
		}

		public const string MODUID = "com.ds_gaming.SonicTheHedgehog";

		public const string MODNAME = "SonicTheHedgehog";

		public const string MODVERSION = "3.0.3";

		public const string DEVELOPER_PREFIX = "DS_GAMING";

		public static SonicTheHedgehogPlugin instance;

		public static bool emoteAPILoaded;

		public static bool lookingGlassLoaded;

		public static bool riskOfOptionsLoaded;

		public static bool ancientScepterLoaded;

		public static bool loadingScreenFixLoaded;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			emoteAPILoaded = Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI");
			Log.Message("Emote API exists? " + emoteAPILoaded);
			lookingGlassLoaded = Chainloader.PluginInfos.ContainsKey("droppod.lookingglass");
			Log.Message("Looking Glass exists? " + lookingGlassLoaded);
			riskOfOptionsLoaded = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			Log.Message("Risk of Options exists? " + riskOfOptionsLoaded);
			ancientScepterLoaded = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			Log.Message("Ancient Scepter exists? " + ancientScepterLoaded);
			loadingScreenFixLoaded = Chainloader.PluginInfos.ContainsKey("Nebby1999.LoadingScreenFix");
			Log.Message("Loading Screen Fix exists? " + loadingScreenFixLoaded);
			Assets.Initialize();
			if (loadingScreenFixLoaded)
			{
				SonicLoadingScreenSprite();
			}
			Config.ReadConfig();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			Items.RegisterItems();
			Forms.Initialize();
			ChaosEmeraldInteractable.Initialize();
			ItemDisplays.PopulateDisplays();
			NetworkingAPI.RegisterMessageType<SonicParryHit>();
			NetworkingAPI.RegisterMessageType<ScepterBoostDamage>();
			NetworkingAPI.RegisterMessageType<SuperSonicTransform>();
			new SonicTheHedgehogCharacter().Initialize();
			new ContentPacks().Initialize();
			if (riskOfOptionsLoaded)
			{
				RiskOfOptionsSetup();
			}
			Hook();
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(WhereIsRecalcStatAPIAcceleration);
			GenericSkill.CanApplyAmmoPack += new hook_CanApplyAmmoPack(CanApplyAmmoPackToBoost);
			GenericSkill.ApplyAmmoPack += new hook_ApplyAmmoPack(ApplyAmmoPackToBoost);
			JitterBones.Start += new hook_Start(IHateJitterBones);
			HealthComponent.TakeDamage += new hook_TakeDamage(TakeDamage);
			Util.GetBestBodyName += new hook_GetBestBodyName(SuperNamePrefix);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(SonicRecalculateStats);
			UserProfile.OnLogin += new hook_OnLogin(ConfigUnlocks);
			if (emoteAPILoaded)
			{
				EmoteSkeleton();
			}
			SceneDirector.Start += new hook_Start(SceneDirectorOnStart);
			if (lookingGlassLoaded)
			{
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LookingGlassSetup));
			}
			GenericPickupController.Start += new hook_Start(EmeraldDropSound);
		}

		private void EmoteSkeleton()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				hook_Init val = delegate(orig_Init orig)
				{
					orig.Invoke();
					foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
					{
						if (((Object)allSurvivorDef.bodyPrefab).name == "SonicTheHedgehog")
						{
							GameObject val2 = Assets.mainAssetBundle.LoadAsset<GameObject>("SonicEmoteSupport.prefab");
							CustomEmotesAPI.ImportArmature(allSurvivorDef.bodyPrefab, val2, 0, true);
							val2.GetComponentInChildren<BoneMapper>().scale = 1f;
						}
					}
				};
				<>c.<>9__12_0 = val;
				obj = (object)val;
			}
			SurvivorCatalog.Init += (hook_Init)obj;
		}

		private static void SonicLoadingScreenSprite()
		{
			Sprite[] array = Assets.mainAssetBundle.LoadAssetWithSubAssets<Sprite>("SonicLoadingScreen");
			int[] array2 = new int[4] { 1, 1, 1, 1 };
			SimpleSpriteAnimation val = SimpleSpriteAnimationGenerator.CreateSpriteAnimation((IEnumerable<Sprite>)array, (IEnumerable<int>)array2, 8f);
			LoadingScreenFix.AddSpriteAnimation(val);
			Log.Message("Added Sonic loading screen sprite");
		}

		public static void LookingGlassSetup()
		{
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected I4, but got Unknown
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected I4, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected I4, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected I4, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Expected I4, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected I4, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Expected I4, but got Unknown
			if (Language.languagesByName.TryGetValue("en", out var value))
			{
				RegisterLookingGlassBuff(value, Buffs.boostBuff, "Sonic Boost", $"Gain <style=cIsUtility>+{50f} armor</style>. If <style=cIsDamage>health</style> is above <style=cIsDamage>90%</style>, gain <style=cIsUtility>+{65f}% movement speed</style>. Otherwise, gain <style=cIsUtility>+{35f}% movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.superBoostBuff, "Super Sonic Boost", $"Gain <style=cIsUtility>+{100f}% movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.ballBuff, "Sonic Ball", $"Gain <style=cIsUtility>+{100f} armor</style>.");
				RegisterLookingGlassBuff(value, Buffs.superSonicBuff, "Super Sonic", $"Immune to all attacks. Gain <style=cIsDamage>+{100f}% damage</style>, <style=cIsUtility>+{30.000002f}% attack speed</style>, and <style=cIsUtility>+{100f}% base movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.parryBuff, "Sonic Parry", $"Gain <style=cIsUtility>+{40f}% attack speed</style> and <style=cIsUtility>+{30.000002f}% movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.superParryDebuff, "Super Sonic Parry Debuff", $"Reduces <style=cIsUtility>armor</style> by {5000f}, reduces <style=cIsUtility>attack speed and movement speed</style> by {50f}%.");
			}
			ItemStatsDef val = new ItemStatsDef();
			val.descriptions.Add("Unique Emeralds: ");
			val.valueTypes.Add((ValueType)7);
			val.measurementUnits.Add((MeasurementUnits)4);
			val.calculateValuesNew = delegate
			{
				List<float> list = new List<float>();
				if (Forms.formToHandlerObject.TryGetValue(Forms.superSonicDef, out var value2))
				{
					SuperSonicHandler superSonicHandler = default(SuperSonicHandler);
					if (value2.TryGetComponent<SuperSonicHandler>(ref superSonicHandler))
					{
						list.Add(7 - ((SyncedItemTracker)superSonicHandler.itemTracker).missingItems.Count);
					}
				}
				else
				{
					list.Add(-1f);
				}
				return list;
			};
			ItemDefinitions.allItemDefinitions.Add((int)Items.redEmerald.itemIndex, val);
			ItemDefinitions.allItemDefinitions.Add((int)Items.yellowEmerald.itemIndex, val);
			ItemDefinitions.allItemDefinitions.Add((int)Items.greenEmerald.itemIndex, val);
			ItemDefinitions.allItemDefinitions.Add((int)Items.blueEmerald.itemIndex, val);
			ItemDefinitions.allItemDefinitions.Add((int)Items.purpleEmerald.itemIndex, val);
			ItemDefinitions.allItemDefinitions.Add((int)Items.cyanEmerald.itemIndex, val);
			ItemDefinitions.allItemDefinitions.Add((int)Items.grayEmerald.itemIndex, val);
		}

		private static void RegisterLookingGlassBuff(Language language, BuffDef buff, string name, string description)
		{
			LookingGlassLanguageAPI.SetupToken(language, "NAME_" + ((Object)buff).name, name);
			LookingGlassLanguageAPI.SetupToken(language, "DESCRIPTION_" + ((Object)buff).name, description);
		}

		private static void RiskOfOptionsSetup()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_004c: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			Sprite modIcon = Assets.mainAssetBundle.LoadAsset<Sprite>("texSonicIcon");
			ModSettingsManager.SetModIcon(modIcon);
			float min = -500f;
			float max = 500f;
			ModSettingsManager.AddOption((BaseOption)new SliderOption(Config.BoostMeterLocationX(), new SliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(Config.BoostMeterLocationY(), new SliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.KeyPressHomingAttack()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockParry()));
			Config.ForceUnlockParry().SettingChanged += SonicTheHedgehogCharacter.UnlockParryConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockMastery()));
			Config.ForceUnlockMastery().SettingChanged += SonicTheHedgehogCharacter.UnlockMasteryConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.EmeraldsWithoutSonic()));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(Config.EmeraldsPerStage(), new IntSliderConfig
			{
				min = 1,
				max = 7
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(Config.EmeraldsPerSimulacrumStage(), new IntSliderConfig
			{
				min = 1,
				max = 7
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(Config.EmeraldCost(), new IntSliderConfig
			{
				min = 0,
				max = 400
			}));
			Config.EmeraldCost().SettingChanged += ChaosEmeraldInteractable.UpdateInteractableCost;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ConsumeEmeraldsOnUse()));
			Config.ConsumeEmeraldsOnUse().SettingChanged += Forms.UpdateConsumeEmeraldsConfig;
			ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)Config.NeededItemSharing()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.AnnounceSuperTransformation()));
		}

		private void SonicRecalculateStats(CharacterBody self, StatHookEventArgs stats)
		{
			if (!Object.op_Implicit((Object)(object)self))
			{
				return;
			}
			if (self.HasBuff(Buffs.boostBuff))
			{
				stats.baseMoveSpeedAdd += ((self.healthComponent.health / self.healthComponent.fullHealth >= 0.9f) ? 2.975f : 1.4875f);
				stats.moveSpeedMultAdd += ((self.healthComponent.health / self.healthComponent.fullHealth >= 0.9f) ? 0.2305f : 0.15f);
				stats.armorAdd += 50f;
			}
			if (self.HasBuff(Buffs.superBoostBuff))
			{
				stats.baseMoveSpeedAdd += 4.25f;
				stats.moveSpeedMultAdd += 0.33f;
			}
			if (self.HasBuff(Buffs.superSonicBuff))
			{
				stats.baseMoveSpeedAdd += 1f * self.baseMoveSpeed;
				stats.attackSpeedMultAdd += 0.3f;
				stats.damageMultAdd += 1f;
				stats.jumpPowerMultAdd += 0.5f;
			}
			if (self.HasBuff(Buffs.ballBuff))
			{
				stats.armorAdd += 100f;
			}
			if (self.HasBuff(Buffs.parryBuff))
			{
				stats.attackSpeedMultAdd += 0.4f;
				stats.moveSpeedMultAdd += 0.3f;
			}
			BoostLogic component = ((Component)self).GetComponent<BoostLogic>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.CalculateBoostVariables();
			}
			MomentumPassive component2 = ((Component)self).GetComponent<MomentumPassive>();
			if (Object.op_Implicit((Object)(object)component2) && component2.momentumEquipped)
			{
				if (component2.momentum >= 0f)
				{
					stats.moveSpeedMultAdd += component2.momentum * MomentumPassive.speedMultiplier;
				}
				else
				{
					stats.moveSpeedReductionMultAdd += Mathf.Abs(component2.momentum) * (MomentumPassive.speedMultiplier / 3f);
				}
			}
			if (self.HasBuff(Buffs.superParryDebuff))
			{
				stats.baseMoveSpeedAdd -= self.baseMoveSpeed / 2f;
				stats.armorAdd -= 50f;
				stats.baseAttackSpeedAdd -= self.baseAttackSpeed / 2f;
			}
		}

		private void WhereIsRecalcStatAPIAcceleration(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (self.HasBuff(Buffs.superSonicBuff))
			{
				self.acceleration *= 5f;
			}
			if (self.HasBuff(Buffs.boostBuff))
			{
				self.acceleration *= 6f;
			}
		}

		private bool CanApplyAmmoPackToBoost(orig_CanApplyAmmoPack orig, GenericSkill self)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Type typeFromHandle = typeof(Boost);
			SerializableEntityStateType activationState = self.activationState;
			if (typeFromHandle.IsAssignableFrom(((SerializableEntityStateType)(ref activationState)).stateType))
			{
				BoostLogic component = ((Component)self.characterBody).GetComponent<BoostLogic>();
				if (Object.op_Implicit((Object)(object)component))
				{
					return component.boostMeter < component.maxBoostMeter;
				}
			}
			return orig.Invoke(self);
		}

		private void ApplyAmmoPackToBoost(orig_ApplyAmmoPack orig, GenericSkill self)
		{
			//IL_0014: 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)
			orig.Invoke(self);
			Type typeFromHandle = typeof(Boost);
			SerializableEntityStateType activationState = self.activationState;
			if (typeFromHandle.IsAssignableFrom(((SerializableEntityStateType)(ref activationState)).stateType))
			{
				BoostLogic component = ((Component)self.characterBody).GetComponent<BoostLogic>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.AddBoost(25f);
				}
			}
		}

		private void IHateJitterBones(orig_Start orig, JitterBones self)
		{
			if (Object.op_Implicit((Object)(object)self.skinnedMeshRenderer) && ((Object)self.skinnedMeshRenderer).name == "SonicMesh")
			{
				Object.Destroy((Object)(object)self);
			}
			orig.Invoke(self);
		}

		private void TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damage)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)self))
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)self).gameObject, "Body");
				if (Object.op_Implicit((Object)(object)val))
				{
					EntityState state = val.state;
					NetworkIdentity component = ((Component)self).gameObject.GetComponent<NetworkIdentity>();
					if (typeof(Parry).IsAssignableFrom(((object)state).GetType()) && Object.op_Implicit((Object)(object)component))
					{
						((Parry)(object)state).OnTakeDamage(damage);
						NetMessageExtensions.Send((INetMessage)(object)new SonicParryHit(component.netId, damage), (NetworkDestination)1);
					}
				}
				SuperSonicComponent superSonicComponent = default(SuperSonicComponent);
				if (((Component)self).gameObject.TryGetComponent<SuperSonicComponent>(ref superSonicComponent) && Object.op_Implicit((Object)(object)superSonicComponent.activeForm) && superSonicComponent.activeForm.invincible)
				{
					damage.rejected = true;
					EffectManager.SpawnEffect(AssetReferences.damageRejectedPrefab, new EffectData
					{
						origin = damage.position
					}, true);
				}
			}
			orig.Invoke(self, damage);
		}

		private static string SuperNamePrefix(orig_GetBestBodyName orig, GameObject bodyObject)
		{
			SuperSonicComponent superSonicComponent = default(SuperSonicComponent);
			if (Object.op_Implicit((Object)(object)bodyObject) && bodyObject.TryGetComponent<SuperSonicComponent>(ref superSonicComponent) && Object.op_Implicit((Object)(object)superSonicComponent.activeForm) && !Language.IsTokenInvalid(((Object)superSonicComponent.activeForm).name + "_PREFIX"))
			{
				string text = orig.Invoke(bodyObject);
				return Language.GetStringFormatted(((Object)superSonicComponent.activeForm).name + "_PREFIX", new object[1] { text });
			}
			return orig.Invoke(bodyObject);
		}

		private void ConfigUnlocks(orig_OnLogin orig, UserProfile self)
		{
			orig.Invoke(self);
			if (!self.HasAchievement("DS_GAMINGSONICPARRYUNLOCKABLE") && Config.ForceUnlockParry().Value)
			{
				self.AddAchievement("DS_GAMINGSONICPARRYUNLOCKABLE", true);
			}
			if (!self.HasAchievement("DS_GAMINGSONICMASTERYUNLOCKABLE") && Config.ForceUnlockMastery().Value)
			{
				self.AddAchievement("DS_GAMINGSONICMASTERYUNLOCKABLE", true);
			}
		}

		private void EmeraldDropSound(orig_Start orig, GenericPickupController self)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)self.pickupDisplay))
			{
				return;
			}
			ItemIndex itemIndex = PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex;
			if ((int)itemIndex != -1)
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex);
				if (Object.op_Implicit((Object)(object)itemDef) && (Object)(object)itemDef._itemTierDef == (Object)(object)Items.emeraldTier)
				{
					Util.PlaySound("Play_emerald_spawn", ((Component)self).gameObject);
				}
			}
		}

		private void SceneDirectorOnStart(orig_Start orig, SceneDirector self)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Invalid comparison between Unknown and I4
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Expected O, but got Unknown
			orig.Invoke(self);
			if (!NetworkServer.active)
			{
				return;
			}
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			bool flag = RunArtifactManager.instance.IsArtifactEnabled(Artifacts.randomSurvivorOnRespawnArtifactDef);
			Log.Message("Metamorphosis? " + flag);
			FormDef[] formsCatalog = FormCatalog.formsCatalog;
			foreach (FormDef formDef in formsCatalog)
			{
				bool flag2 = false;
				bool flag3 = false;
				foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
				{
					if (formDef.allowedBodyList.BodyIsAllowed(BodyCatalog.FindBodyIndex(instance.master.bodyPrefab)))
					{
						flag2 = true;
					}
					if (BodyCatalog.GetBodyName(BodyCatalog.FindBodyIndex(instance.master.bodyPrefab)) == "SonicTheHedgehog")
					{
						flag3 = true;
					}
					if (flag2 && flag3)
					{
						break;
					}
				}
				Log.Message("Anyone playing Sonic? " + flag3 + "\nAnyone can use the form? " + flag2);
				bool flag4 = flag2 && ((Object)(object)formDef != (Object)(object)Forms.superSonicDef || (flag3 && !flag) || Config.EmeraldsWithoutSonic().Value);
				if (!Forms.formToHandlerObject.ContainsKey(formDef) && flag4)
				{
					Log.Message("Spawning new handler object for form " + ((object)formDef).ToString());
					NetworkServer.Spawn(Object.Instantiate<GameObject>(GeneralExtensions.GetValueSafe<FormDef, GameObject>(Forms.formToHandlerPrefab, formDef)));
					FormHandler formHandler = GeneralExtensions.GetValueSafe<FormDef, GameObject>(Forms.formToHandlerObject, formDef).GetComponent(typeof(FormHandler)) as FormHandler;
					formHandler.SetEvents(flag4);
				}
				else
				{
					Log.Message("Did NOT spawn handler object for form " + ((object)formDef).ToString());
				}
			}
			SuperSonicHandler superSonicHandler = default(SuperSonicHandler);
			if (!Forms.formToHandlerObject.TryGetValue(Forms.superSonicDef, out var value) || !value.TryGetComponent<SuperSonicHandler>(ref superSonicHandler))
			{
				return;
			}
			superSonicHandler.FilterOwnedEmeralds();
			if (SuperSonicHandler.available.Count > 0 && Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && (int)sceneDefForCurrentScene.sceneType == 1 && !sceneDefForCurrentScene.cachedName.Contains("moon") && !sceneDefForCurrentScene.cachedName.Contains("voidraid") && !sceneDefForCurrentScene.cachedName.Contains("voidstage"))
			{
				int num = ((Run.instance is InfiniteTowerRun) ? Config.EmeraldsPerSimulacrumStage().Value : Config.EmeraldsPerStage().Value);
				SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
				val.nodeGraphType = (GraphType)0;
				val.sendOverNetwork = true;
				val.prefab = ChaosEmeraldInteractable.prefabBase;
				for (int j = 0; j < num && j < SuperSonicHandler.available.Count; j++)
				{
					DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, ChaosEmeraldInteractable.placementRule, Run.instance.stageRng));
				}
			}
		}
	}
}
namespace SonicTheHedgehog.SkillStates
{
	public class InteractablePurchased : EntityState
	{
		public const float dropTime = 0.5f;

		public ChaosEmeraldInteractable interactable;

		private bool soundPlayed = false;

		private bool dropped = false;

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			Log.Message("Emerald Interactable purchase state enter");
			interactable = ((EntityState)this).gameObject.GetComponent<ChaosEmeraldInteractable>();
			((Component)((EntityState)this).gameObject.transform.Find("RingParent/PurchaseParticle")).gameObject.GetComponent<ParticleSystem>().Play();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= 0.25f && !soundPlayed)
			{
				soundPlayed = true;
				Util.PlaySound("Play_emerald_purchase", ((EntityState)this).gameObject);
			}
			if (((EntityState)this).fixedAge >= 0.5f && !dropped)
			{
				dropped = true;
				if (Object.op_Implicit((Object)(object)interactable))
				{
					interactable.DropPickup();
					interactable.Disappear();
				}
			}
		}
	}
	public class BaseSonic : BaseState
	{
	}
	public class Boost : GenericCharacterMain
	{
		public static float duration = 0.4f;

		public static float extendedDuration = 0.6f;

		public static float initialSpeedCoefficient = 1.3f;

		public static float finalSpeedCoefficient = 1f;

		public static float boostMeterDrain = 0.88f;

		public static float airBoostY = 8f;

		public static float screenShake = 3.5f;

		private string jumpSoundString = "Play_jump";

		public static string boostSoundString = "Play_boost";

		public static string boostChangeSoundString = "Play_boost_change";

		public static float dodgeFOV = DodgeState.dodgeFOV;

		private Vector3 forwardDirection;

		public BoostLogic boostLogic;

		private TemporaryOverlayInstance temporaryOverlay;

		private float boostEffectCooldown;

		private ICharacterFlightParameterProvider flight;

		private static float boostCameraDistance = -13f;

		private CharacterCameraParamsData boostingCameraParams = new CharacterCameraParamsData
		{
			maxPitch = BlendableFloat.op_Implicit(70f),
			minPitch = BlendableFloat.op_Implicit(-70f),
			pivotVerticalOffset = BlendableFloat.op_Implicit(1.1f),
			idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, boostCameraDistance)),
			wallCushion = BlendableFloat.op_Implicit(0.1f)
		};

		private CameraParamsOverrideHandle camOverrideHandle;

		public bool powerBoosting = false;

		public bool boosting = false;

		private bool checkBoostEffects = false;

		private bool boostChangedEffect = false;

		protected GameObject aura;

		protected virtual bool drainBoostMeter => true;

		protected virtual BuffDef buff => Buffs.boostBuff;

		public override void OnEnter()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterMain)this).OnEnter();
			((EntityState)this).characterBody.skillLocator.utility.onSkillChanged += OnSkillChanged;
			flight = ((Component)((EntityState)this).characterBody).GetComponent<ICharacterFlightParameterProvider>();
			((EntityState)this).GetModelAnimator().SetBool("isBoosting", true);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(OnHitGround);
			}
			boostLogic = ((EntityState)this).GetComponent<BoostLogic>();
			if (ShouldPowerBoost())
			{
				powerBoosting = true;
			}
			OnPowerBoostChanged();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(buff);
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.6f * duration);
			}
			if (!((BaseState)this).isGrounded)
			{
				if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
				{
					Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero || Flying()) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
					forwardDirection = ((Vector3)(ref val)).normalized;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
				{
					((EntityState)this).characterMotor.velocity.x = forwardDirection.x * ((EntityState)this).characterBody.moveSpeed;
					((EntityState)this).characterMotor.velocity.z = forwardDirection.z * ((EntityState)this).characterBody.moveSpeed;
					if (Flying())
					{
						((EntityState)this).characterMotor.velocity.y = forwardDirection.y * ((EntityState)this).characterBody.moveSpeed;
					}
					else
					{
						((EntityState)this).characterMotor.velocity.y = Mathf.Max(airBoostY, ((EntityState)this).characterMotor.velocity.y);
					}
					((EntityState)this).PlayCrossfade("Body", "AirBoost", "Roll.playbackRate", duration, duration / 3f);
					boosting = true;
					OnBoostingChanged();
				}
				if (!Flying())
				{
					((EntityState)this).skillLocator.utility.DeductStock(1);
				}
			}
			else if (((EntityState)this).inputBank.moveVector != Vector3.zero)
			{
				((EntityState)this).PlayCrossfade("Body", "Boost", 0.1f);
				boosting = true;
				OnBoostingChanged();
			}
			else
			{
				((EntityState)this).PlayCrossfade("Body", "BoostIdleEnter", 0.3f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00b7: 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)
			((GenericCharacterMain)this).FixedUpdate();
			boostEffectCooldown -= Time.fixedDeltaTime;
			UpdateBoosting();
			UpdatePowerBoosting();
			if (checkBoostEffects)
			{
				checkBoostEffects = false;
				PlayBoostEffects();
			}
			if (Moving())
			{
				if (drainBoostMeter)
				{
					if (NetworkServer.active)
					{
						boostLogic.RemoveBoost(boostMeterDrain);
					}
					boostLogic.boostDraining = true;
				}
				else
				{
					boostLogic.boostDraining = false;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
				{
					((EntityState)this).characterBody.isSprinting = true;
					((EntityState)this).characterDirection.moveVector = forwardDirection;
				}
			}
			else
			{
				boostLogic.boostDraining = false;
				if (((BaseState)this).isGrounded)
				{
					((EntityState)this).characterBody.isSprinting = false;
				}
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.fovOverride = Mathf.Lerp(dodgeFOV, 60f, ((EntityState)this).fixedAge / duration);
			}
			UpdateDirection();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge < extendedDuration && !((BaseState)this).isGrounded)
			{
				((EntityState)this).characterMotor.velocity.x = forwardDirection.x * ((EntityState)this).characterBody.moveSpeed;
				((EntityState)this).characterMotor.velocity.z = forwardDirection.z * ((EntityState)this).characterBody.moveSpeed;
				if (Flying())
				{
					((EntityState)this).characterMotor.velocity.y = forwardDirection.y * ((EntityState)this).characterBody.moveSpeed;
				}
				else
				{
					((EntityState)this).characterMotor.velocity.y = Mathf.Max(airBoostY, ((EntityState)this).characterMotor.velocity.y);
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > duration && !((EntityState)this).inputBank.skill3.down)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (((EntityState)this).isAuthority && (boostLogic.boostMeter <= 0f || !boostLogic.boostAvailable))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		protected virtual bool ShouldPowerBoost()
		{
			return ((EntityState)this).characterBody.healthComponent.health / ((EntityState)this).characterBody.healthComponent.fullHealth >= 0.9f && Moving();
		}

		protected virtual void UpdatePowerBoosting()
		{
			if (!powerBoosting && ShouldPowerBoost())
			{
				((EntityState)this).characterBody.MarkAllStatsDirty();
				powerBoosting = true;
				OnPowerBoostChanged();
			}
			else if (powerBoosting && !ShouldPowerBoost())
			{
				((EntityState)this).characterBody.MarkAllStatsDirty();
				powerBoosting = false;
				OnPowerBoostChanged();
			}
		}

		protected virtual void UpdateBoosting()
		{
			if (!boosting && Moving())
			{
				boosting = true;
				OnBoostingChanged();
			}
			else if (boosting && !Moving())
			{
				boosting = false;
				OnBoostingChanged();
			}
		}

		protected void OnPowerBoostChanged()
		{
			boostLogic.powerBoosting = powerBoosting;
			if (powerBoosting)
			{
				if (boostEffectCooldown <= 0f && ((EntityState)this).isAuthority)
				{
					checkBoostEffects = true;
				}
				else
				{
					CreateTemporaryOverlay();
				}
			}
			else if (boostEffectCooldown <= 0f && boosting && ((EntityState)this).isAuthority)
			{
				checkBoostEffects = true;
			}
			else
			{
				checkBoostEffects = true;
			}
		}

		protected void OnBoostingChanged()
		{
			checkBoostEffects = true;
			boostChangedEffect = true;
		}

		protected virtual void PlayBoostEffects()
		{
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: 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_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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (boosting && boostEffectCooldown <= 0f)
			{
				if (boostChangedEffect)
				{
					camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
					{
						cameraParamsData = boostingCameraParams,
						priority = 0f
					}, 0.1f);
					ScepterReset();
				}
				boostEffectCooldown = 0.6f;
				if (powerBoosting)
				{
					Util.PlaySound(boostChangedEffect ? GetSoundString() : boostChangeSoundString, ((EntityState)this).gameObject);
					if (((EntityState)this).isAuthority)
					{
						((BaseState)this).AddRecoil(-1f * screenShake, 1f * screenShake, -0.5f * screenShake, 0.5f * screenShake);
						EffectManager.SimpleMuzzleFlash(GetFlashPrefab(power: true), ((EntityState)this).gameObject, "BallHitbox", true);
					}
					CreateTemporaryOverlay();
				}
				else
				{
					Util.PlaySound(boostChangedEffect ? GetSoundString() : boostChangeSoundString, ((EntityState)this).gameObject);
					if (((EntityState)this).isAuthority)
					{
						((BaseState)this).AddRecoil(-0.5f * screenShake, 0.5f * screenShake, -0.25f * screenShake, 0.25f * screenShake);
						EffectManager.SimpleMuzzleFlash(GetFlashPrefab(power: false), ((EntityState)this).gameObject, "BallHitbox", true);
					}
					RemoveTemporaryOverlay();
				}
				if (Object.op_Implicit((Object)(object)aura))
				{
					EntityState.Destroy((Object)(object)aura);
				}
				if (Object.op_Implicit((Object)(object)GetAuraPrefab(powerBoosting)))
				{
					aura = Object.Instantiate<GameObject>(GetAuraPrefab(powerBoosting), ((BaseState)this).FindModelChild("MainHurtbox"));
				}
			}
			else
			{
				((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, duration * 2f);
				if (!powerBoosting)
				{
					RemoveTemporaryOverlay();
				}
				if (Object.op_Implicit((Object)(object)aura))
				{
					EntityState.Destroy((Object)(object)aura);
				}
			}
			boostChangedEffect = false;
		}

		private void CreateTemporaryOverlay()
		{
			if (!Object.op_Implicit((Object)(object)GetOverlayMaterial()) || (temporaryOverlay != null && temporaryOverlay.ValidateOverlay()))
			{
				return;
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				CharacterModel component = ((Component)modelTransform).GetComponent<CharacterModel>();
				if (Object.op_Implicit((Object)(object)component))
				{
					temporaryOverlay = TemporaryOverlayManager.AddOverlay(((Component)component).gameObject);
					temporaryOverlay.originalMaterial = GetOverlayMaterial();
					temporaryOverlay.animateShaderAlpha = true;
					temporaryOverlay.duration = 0.2f;
					temporaryOverlay.alphaCurve = AnimationCurve.EaseInOut(0f, 2f, 3f, 0.4f);
					temporaryOverlay.destroyComponentOnEnd = false;
					temporaryOverlay.destroyObjectOnEnd = false;
					temporaryOverlay.inspectorCharacterModel = component;
					temporaryOverlay.Start();
				}
			}
		}

		private void RemoveTemporaryOverlay()
		{
			if (temporaryOverlay != null)
			{
				temporaryOverlay.animateShaderAlpha = false;
				temporaryOverlay.Destroy();
			}
		}

		private void UpdateDirection()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				forwardDirection = ((((EntityState)this).inputBank.moveVector != Vector3.zero) ? ((EntityState)this).inputBank.moveVector : ((EntityState)this).characterDirection.forward);
			}
		}

		public override void ProcessJump()
		{
			if (((EntityState)this).isAuthority && ((BaseCharacterMain)this).hasCharacterMotor && base.jumpInputReceived && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && ((EntityState)this).characterMotor.jumpCount < ((EntityState)this).characterBody.maxJumpCount)
			{
				Util.PlaySound(jumpSoundString, ((EntityState)this).gameObject);
				((BaseCharacterMain)this).modelAnimator.SetBool("isBall", true);
			}
			((GenericCharacterMain)this).ProcessJump();
		}

		private void OnHitGround(ref HitGroundInfo hitGroundInfo)
		{
			if (((BaseCharacterMain)this).modelAnimator.GetBool("isBall"))
			{
				((BaseCharacterMain)this).modelAnimator.SetBool("isBall", false);
			}
		}

		public override void OnExit()
		{
			//IL_0039: 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)
			((EntityState)this).GetModelAnimator().SetBool("isBoosting", false);
			boostLogic.boostDraining = false;
			boostLogic.powerBoosting = false;
			boosting = false;
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, duration * 1.5f);
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(buff);
			}
			RemoveTemporaryOverlay();
			if (Object.op_Implicit((Object)(object)aura))
			{
				EntityState.Destroy((Object)(object)aura);
			}
			((EntityState)this).characterBody.skillLocator.utility.onSkillChanged -= OnSkillChanged;
			((GenericCharacterMain)this).OnExit();
		}

		protected bool Flying()
		{
			return flight != null && flight.isFlying;
		}

		protected bool Moving()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return ((EntityState)this).characterBody.inputBank.moveVector != Vector3.zero || (!((BaseState)this).isGrounded && (!Flying() || ((EntityState)this).fixedAge < extendedDuration));
		}

		public virtual void ScepterDamage()
		{
		}

		public virtual void ScepterReset()
		{
		}

		public virtual string GetSoundString()
		{
			return "Play_boost";
		}

		public virtual GameObject GetFlashPrefab(bool power)
		{
			if (power)
			{
				return Assets.powerBoostFlashEffect;
			}
			return Assets.boostFlashEffect;
		}

		public virtual GameObject GetAuraPrefab(bool power)
		{
			if (power)
			{
				return Assets.powerBoostAuraEffect;
			}
			return null;
		}

		public virtual Material GetOverlayMaterial()
		{
			return LegacyResourcesAPI.Load<Material>("Materials/matOnHelfire");
		}

		public virtual void OnSkillChanged(GenericSkill skill)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Type typeFromHandle = typeof(Boost);
			SerializableEntityStateType activationState = skill.activationState;
			if (typeFromHandle.IsAssignableFrom(((SerializableEntityStateType)(ref activationState)).stateType))
			{
				EntityStateMachine outer = ((EntityState)this).outer;
				activationState = skill.activationState;
				outer.SetNextState(EntityStateCatalog.InstantiateState(((SerializableEntityStateType)(ref activationState)).stateType));
			}
		}

		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)3;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			writer.Write(forwardDirection);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			forwardDirection = reader.ReadVector3();
		}
	}
	public class Death : GenericCharacterDeath
	{
		protected string soundString = "Play_death";

		private const float destroyTime = 1.6f;

		public override void OnEnter()
		{
			((GenericCharacterDeath)this).OnEnter();
			Util.PlaySound(soundString, ((EntityState)this).gameObject);
			((EntityState)this).cameraTargetParams.cameraPivotTransform = ((EntityState)this).gameObject.transform;
		}

		public override void FixedUpdate()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (((EntityState)this).fixedAge >= 1.6f && NetworkServer.active)
			{
				((GenericCharacterDeath)this).DestroyBodyAsapServer();
			}
		}

		public override void OnExit()
		{
			((GenericCharacterDeath)this).DestroyModel();
			((GenericCharacterDeath)this).OnExit();
		}
	}
	public class GrandSlamDash : BaseSkillState
	{
		protected string hitboxName = "Ball";

		protected DamageType damageType = (DamageType)33;

		protected float damageCoefficient = 1.4f;

		protected float procCoefficient = 0.5f;

		protected float pushForce = 0f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float baseAttackStartTime = 0.5f;

		protected float attackStartTime;

		protected float attackRecoil = 3f;

		protected float hitHopVelocity = 6f;

		protected bool cancelled = false;

		protected float noTargetDistancePercentage = 0.7f;

		protected float maxDashRange;

		protected float dashSpeed;

		protected float estimatedDashTime;

		protected float dashOvershoot;

		protected HurtBox target = null;

		private Vector3 targetDirection;

		protected string chargeSoundString = "Play_spindash_charge";

		protected string launchSoundString = "Play_spindash_release";

		protected string hitSoundString = "Play_homing_impact";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.homingHitSoundEvent.index;

		public float duration;

		private bool hasFired;

		private OverlapAttack attack;

		protected bool inHitPause;

		protected float stopwatch;

		protected Animator animator;

		private bool hasHit = false;

		private HomingTracker homingTracker;

		public override void OnEnter()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_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)
			((BaseState)this).OnEnter();
			homingTracker = ((Component)((EntityState)this).characterBody).GetComponent<HomingTracker>();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.ballBuff);
			}
			dashSpeed = homingTracker.Speed();
			hasFired = false;
			attackStartTime = baseAttackStartTime / ((EntityState)this).characterBody.attackSpeed;
			dashOvershoot = 1.5f;
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			if (Object.op_Implicit((Object)(object)homingTracker))
			{
				target = homingTracker.GetTrackingTarget();
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			targetDirection = ((Vector3)(ref direction)).normalized * homingTracker.MaxRange() * noTargetDistancePercentage;
			if ((Object)(object)target != (Object)null)
			{
				targetDirection = ((Component)target).transform.position - ((EntityState)this).transform.position;
			}
			if (dashSpeed > 0f)
			{
				estimatedDashTime = ((Vector3)(ref targetDirection)).magnitude / dashSpeed * dashOvershoot;
			}
			else
			{
				attackStartTime *= 2f;
				estimatedDashTime = 0f;
			}
			if (((EntityState)this).isAuthority)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
			}
			if (attackStartTime >= 0.2f)
			{
				Util.PlayAttackSpeedSound(chargeSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
			}
			EndChrysalis();
			hitboxName = "Ball";
			((EntityState)this).PlayAnimation("FullBody, Override", "Ball");
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			PrepareOverlapAttack();
		}

		public override void OnExit()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags & -2);
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.ballBuff);
			}
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!hasHit)
			{
				hasHit = true;
				EffectManager.SimpleEffect(Assets.homingAttackHitEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
			}
			SetNextState();
		}

		private void FireAttack()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			List<HurtBox> list = new List<HurtBox>();
			if (attack.Fire(list))
			{
				((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
				if ((Object)(object)target == (Object)null)
				{
					target = list.FirstOrDefault();
				}
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				OnHitEnemyAuthority();
			}
		}

		protected virtual void SetNextState()
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)new GrandSlamSpin
			{
				target = target
			});
		}

		public override void FixedUpdate()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_0268: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: 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_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (((EntityState)this).fixedAge < attackStartTime)
			{
				((EntityState)this).characterMotor.velocity = Vector3.Lerp(((EntityState)this).characterMotor.velocity, Vector3.zero, ((EntityState)this).fixedAge / (attackStartTime * 0.6f));
			}
			else if (((EntityState)this).fixedAge < estimatedDashTime + attackStartTime && ((EntityState)this).fixedAge > attackStartTime)
			{
				if ((Object)(object)target != (Object)null)
				{
					targetDirection = ((Component)target).transform.position - ((EntityState)this).transform.position;
				}
				if (!hasFired)
				{
					hasFired = true;
					Util.PlaySound(launchSoundString, ((EntityState)this).gameObject);
					if (((EntityState)this).isAuthority)
					{
						EffectManager.SimpleEffect(Assets.homingAttackLaunchEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
					}
					OnLaunch();
				}
				((EntityState)this).characterDirection.forward = ((Vector3)(ref targetDirection)).normalized;
				if (((EntityState)this).fixedAge >= attackStartTime + estimatedDashTime * 0.75f)
				{
					dashSpeed = Mathf.Lerp(homingTracker.Speed(), 0f, (((EntityState)this).fixedAge - attackStartTime + estimatedDashTime * 0.75f) / (attackStartTime + estimatedDashTime));
				}
				if (dashSpeed * Time.fixedDeltaTime > ((Vector3)(ref targetDirection)).magnitude * 3f)
				{
					dashSpeed = Mathf.Max(((Vector3)(ref targetDirection)).magnitude * 3f, 15f);
				}
				((EntityState)this).characterDirection.forward = ((Vector3)(ref targetDirection)).normalized;
				((EntityState)this).characterMotor.velocity = ((Vector3)(ref targetDirection)).normalized * dashSpeed;
				FireAttack();
			}
			if (((EntityState)this).fixedAge > estimatedDashTime + attackStartTime && ((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		protected virtual void OnLaunch()
		{
		}

		private void EndChrysalis()
		{
			JetpackController val = JetpackController.FindJetpackController(((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)val) && val.stopwatch >= val.duration && NetworkServer.active)
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}

		public void PrepareOverlapAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.damageType.damageSource = (DamageSource)8;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		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 GrandSlamFinal : BaseSkillState
	{
		protected string hitboxName = "Stomp";

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient = 22f;

		protected float procCoefficient = 1.5f;

		protected Vector3 bonusForce = Vector3.down;

		protected float attackRecoil = 11f;

		protected float startUpTime = 0.5f;

		private float baseMaxAttackTime = 1f;

		protected float maxAttackTime = 0.75f;

		protected float hitStopDuration = 0.2f;

		protected float endTime = 0.5f;

		protected float baseSpeedMultiplier = 200f;

		public HurtBox target;

		protected Vector3 targetDirection;

		protected string swingSoundString = "";

		protected string hitSoundString = "Play_strong_impact";

		protected string muzzleString = "SwingBottom";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.grandSlamHitSoundEvent.index;

		private float earlyExitTime;

		public float duration;

		protected bool hasFired;

		private bool hasHit;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private float speedMultiplier;

		private bool animationEnded = false;

		private bool effectFired = false;

		protected float startUpVelocityMax = 60f;

		protected float startUpVelocityMin = 3f;

		protected virtual float basePushForce => 3000f;

		public override void OnEnter()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			maxAttackTime = baseMaxAttackTime;
			hasFired = false;
			hasHit = false;
			hitboxName = "Stomp";
			((EntityState)this).PlayAnimation("FullBody, Override", "GrandSlam", "Roll.playbackRate", startUpTime * 1.15f, 0f);
			Util.PlaySound("Play_swing_low", ((EntityState)this).gameObject);
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			PrepareOverlapAttack();
		}

		public override void OnExit()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags & -2);
			if (!animationEnded)
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).PlayAnimation("Body", "Backflip");
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
			}
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (!effectFired)
			{
				EffectManager.SimpleMuzzleFlash(Assets.grandSlamHitEffect, ((EntityState)this).gameObject, muzzleString, true);
				effectFired = true;
			}
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
			((EntityState)this).characterMotor.velocity = Vector3.up * 9f;
			hasHit = true;
			stopwatch = 0f;
			if (!inHitPause && hitStopDuration > 0f)
			{
				storedVelocity = ((EntityState)this).characterMotor.velocity;
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate");
				hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
				inHitPause = true;
			}
		}

		private void FireAttack()
		{
			if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null))
			{
				((BaseState)this).AddRecoil(-2f * attackRecoil, -0.5f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
				OnHitEnemyAuthority();
			}
		}

		public override void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: 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_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: 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_0260: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
				((EntityState)this).characterMotor.velocity = storedVelocity;
				animationEnded = true;
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).PlayAnimation("Body", "Backflip");
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Swing.playbackRate", 0f);
				}
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (!hasHit)
			{
				if (((EntityState)this).fixedAge <= startUpTime)
				{
					((EntityState)this).characterMotor.velocity = GetStartUpVelocity();
				}
				else
				{
					if (!(((EntityState)this).fixedAge <= startUpTime + maxAttackTime))
					{
						((EntityState)this).characterMotor.velocity = Vector3.zero;
						((EntityState)this).outer.SetNextStateToMain();
						return;
					}
					if (!hasFired)
					{
						hasFired = true;
						EndChrysalis();
					}
					if ((Object)(object)target != (Object)null)
					{
						Vector3 val = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
						targetDirection = ((Vector3)(ref val)).normalized;
						val = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
						speedMultiplier = Mathf.Clamp(((Vector3)(ref val)).magnitude * 10f, 25f, baseSpeedMultiplier);
					}
					else
					{
						speedMultiplier = baseSpeedMultiplier;
						targetDirection = Vector3.down;
					}
					if (Vector3.Dot(targetDirection, Vector3.down) < 0.3f)
					{
						targetDirection = Vector3.down;
					}
					((EntityState)this).characterMotor.velocity = targetDirection * speedMultiplier;
					FireAttack();
				}
				if (((EntityState)this).characterMotor.isGrounded && startUpTime < ((EntityState)this).fixedAge)
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else if (stopwatch >= endTime)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		protected virtual Vector3 GetStartUpVelocity()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.up * Mathf.Lerp(startUpVelocityMax, startUpVelocityMin, ((EntityState)this).fixedAge / startUpTime);
		}

		public void PrepareOverlapAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.damageType.damageSource = (DamageSource)8;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = basePushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		private void EndChrysalis()
		{
			JetpackController val = JetpackController.FindJetpackController(((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)val) && val.stopwatch >= val.duration && NetworkServer.active)
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)(hasHit ? 1 : 5);
		}
	}
	public class GrandSlamSpin : BaseSkillState
	{
		protected string hitboxName = "Ball";

		protected DamageType damageType = (DamageType)33;

		protected float damageCoefficient = 1.4f;

		protected float procCoefficient = 0.5f;

		protected float pushForce = 0f;

		protected Vector3 bonusForce = Vector3.up * 5f;

		protected int baseAttackCount = 4;

		protected int maxAttackCount;

		protected int attackCount;

		protected float attackRecoil = 3f;

		protected float attackDuration = 0.75f;

		public HurtBox target;

		protected string swingSoundString = "";

		protected string hitSoundString = "Play_melee_hit";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.meleeHitSoundEvent.index;

		private float earlyExitTime;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private bool effectFired;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			hasFired = false;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
			maxAttackCount = (int)Math.Ceiling(((EntityState)this).characterBody.attackSpeed * (float)baseAttackCount);
			hitboxName = "LargeBall";
			((EntityState)this).PlayAnimation("FullBody, Override", "Ball", "Slash.playbackRate", attackDuration / (float)maxAttackCount, 0f);
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
		}

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (!effectFired)
			{
				Quaternion val = Quaternion.Lerp(Util.QuaternionSafeLookRotation(((EntityState)this).characterDirection.forward), Util.QuaternionSafeLookRotation(Vector3.up, ((EntityState)this).characterDirection.forward * -1f), 0.6f);
				EffectManager.SimpleEffect(Assets.homingAttackHitEffect, ((EntityState)this).gameObject.transform.position, val, true);
				effectFired = true;
			}
		}

		private void FireAttack()
		{
			if (((EntityState)this).isAuthority)
			{
				attackCount++;
				if (attack.Fire((List<HurtBox>)null))
				{
					((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
					OnHitEnemyAuthority();
				}
			}
		}

		protected virtual void SetNextState()
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)new GrandSlamFinal
			{
				target = target
			});
		}

		public override void FixedUpdate()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (((EntityState)this).fixedAge <= attackDuration || attackCount < maxAttackCount)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				if (((EntityState)this).fixedAge >= attackDuration / (float)maxAttackCount * (float)(attackCount + 1))
				{
					PrepareOverlapAttack();
					FireAttack();
				}
			}
			else
			{
				SetNextState();
			}
		}

		public void PrepareOverlapAttack()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			effectFired = false;
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.damageType.damageSource = (DamageSource)8;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		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)5;
		}
	}
	public class HomingAttack : BaseSkillState
	{
		protected string hitboxName;

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient;

		protected float procCoefficient;

		protected float pushForce = 50f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float attackStartTime;

		protected float attackEndTime;

		protected float hitStopDuration;

		protected float attackRecoil;

		protected float hitHopVelocity;

		protected bool cancelled = false;

		protected float maxHomingAttackRange;

		protected float homingAttackSpeed;

		protected float estimatedHomingAttackTime;

		protected float homingAttackOvershoot;

		protected float homingAttackEndLag;

		protected float homingAttackHitHopVelocity = 12f;

		public HurtBox target;

		private Vector3 targetDirection;

		protected bool homingAttackHit;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string homingAttackSoundString = "Play_homing_attack";

		protected string muzzleString;

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.meleeHitSoundEvent.index;

		protected GameObject homingAttackEffect;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private bool animationEnded = false;

		private ICharacterFlightParameterProvider flight;

		private HomingTracker homingTracker;

		private bool effectPlayed = false;

		protected virtual float baseHomingAttackEndLag => 0.3f;

		public static event Action<HomingAttack, HurtBox> onAuthorityHitEnemy;

		public override void OnEnter()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_01b7: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			flight = ((Component)((EntityState)this).characterBody).GetComponent<ICharacterFlightParameterProvider>();
			homingTracker = ((Component)((EntityState)this).characterBody).GetComponent<HomingTracker>();
			hasFired = false;
			maxHomingAttackRange = homingTracker.MaxRange();
			homingAttackSpeed = homingTracker.Speed();
			homingAttackOvershoot = 1.4f;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.ballBuff);
			}
			damageCoefficient = 6f;
			procCoefficient = 1f;
			attackRecoil = 3f;
			hitStopDuration = 0.1f;
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			targetDirection = Vector3.zero;
			if ((Object)(object)target != (Object)null)
			{
				targetDirection = ((Component)target).transform.position - ((EntityState)this).transform.position;
			}
			Util.PlaySound(homingAttackSoundString, ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				if (targetDirection != Vector3.zero)
				{
					EffectManager.SimpleEffect(Assets.homingAttackLaunchEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
				}
			}
			EndChrysalis();
			estimatedHomingAttackTime = ((Vector3)(ref targetDirection)).magnitude / homingAttackSpeed * homingAttackOvershoot;
			homingAttackEndLag = baseHomingAttackEndLag / ((BaseState)this).attackSpeedStat;
			hitboxName = "Ball";
			impactSound = Assets.homingHitSoundEvent.index;
			((EntityState)this).PlayAnimation("FullBody, Override", "Ball");
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			PrepareOverlapAttack();
		}

		public override void OnExit()
		{
			//IL_0080: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired && !cancelled)
			{
				FireAttack();
			}
			if (!animationEnded || cancelled)
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			}
			if (((EntityState)this).characterBody.HasBuff(Buffs.ballBuff) && NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.ballBuff);
			}
			if (((Enum)((EntityState)this).characterBody.bodyFlags).HasFlag((Enum)(object)(BodyFlags)1))
			{
				CharacterBody characterBody = ((EntityState)this).characterBody;
				characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags & -2);
			}
			if (Object.op_Implicit((Object)(object)homingAttackEffect))
			{
				EntityState.Destroy((Object)(object)homingAttackEffect);
			}
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		protected virtual void PlayHomingAttackHitEffect()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			EffectManager.SimpleEffect(Assets.homingAttackHitEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
			if (Object.op_Implicit((Object)(object)homingAttackEffect))
			{
				homingAttackEffect.transform.parent = null;
			}
		}

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if (!effectPlayed)
			{
				PlayHomingAttackHitEffect();
				effectPlayed = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				if (!Flying())
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, homingAttackHitHopVelocity);
				}
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.ballBuff);
			}
			stopwatch = 0f;
			hasFired = true;
			hasHopped = true;
			if (!inHitPause && hitStopDuration > 0f)
			{
				storedVelocity = ((EntityState)this).characterMotor.velocity;
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate");
				hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
				inHitPause = true;
			}
		}

		private void FireAttack()
		{
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			List<HurtBox> list = new List<HurtBox>();
			if (!attack.Fire(list))
			{
				return;
			}
			((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
			foreach (HurtBox item in list)
			{
				if (HomingAttack.onAuthorityHitEnemy != null)
				{
					HomingAttack.onAuthorityHitEnemy(this, item);
				}
			}
			OnHitEnemyAuthority();
		}

		public override void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
				((EntityState)this).characterMotor.velocity = storedVelocity;
				animationEnded = true;
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).PlayAnimation("Body", "Backflip", "Slash.playbackRate", homingAttackEndLag * 2f, 0f);
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Swing.playbackRate", 0f);
				}
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (hasFired)
			{
				if (stopwatch >= homingAttackEndLag)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else if (((EntityState)this).fixedAge < estimatedHomingAttackTime)
			{
				homingAttackSpeed = homingTracker.Speed();
				if ((Object)(object)target != (Object)null)
				{
					targetDirection = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
				}
				if (homingAttackSpeed * Time.fixedDeltaTime > ((Vector3)(ref targetDirection)).magnitude * 3f)
				{
					homingAttackSpeed = Mathf.Max(((Vector3)(ref targetDirection)).magnitude * 3f, 15f);
				}
				((EntityState)this).characterMotor.velocity = ((Vector3)(ref targetDirection)).normalized * homingAttackSpeed;
				((EntityState)this).characterDirection.forward = ((Vector3)(ref targetDirection)).normalized;
				if (((EntityState)this).isAuthority && ((BaseState)this).isGrounded)
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				}
				if (((EntityState)this).fixedAge > estimatedHomingAttackTime / 2.5f)
				{
					FireAttack();
				}
			}
			else
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void EndChrysalis()
		{
			JetpackController val = JetpackController.FindJetpackController(((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)val) && val.stopwatch >= val.duration && NetworkServer.active)
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}

		private bool Flying()
		{
			return flight != null && flight.isFlying;
		}

		public void PrepareOverlapAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.damageType.damageSource = (DamageSource)1;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		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 IDWAttack : BaseSkillState
	{
		protected static DamageType damageType = (DamageType)131104;

		protected static float damageCoefficient = 8f;

		protected static float procCoefficient = 0.7f;

		protected static float baseAttackDuration = 1.6f;

		protected static float increasePerAdditionalStock = 0.2f;

		protected static float range = 25f;

		protected static int baseAttackCount = 8;

		protected static float pushForce = 400f;

		protected static float baseEndLag = 1.6f;

		protected float endLag;

		public HurtBox target = null;

		protected Vector3 targetPosition = Vector3.zero;

		public float attackDuration;

		public float duration;

		private bool hasFired;

		protected bool inHitPause;

		protected float stopwatch;

		protected Animator animator;

		private int maxAttackCount;

		private int attackCount;

		private bool invisible;

		private Transform modelTransform;

		private CharacterModel characterModel;

		private GameObject idwAttackEffect;

		private HitPoint[] hit;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
			}
			hasFired = false;
			endLag = baseEndLag;
			if (((EntityState)this).isAuthority)
			{
				((BaseCharacterController)