Decompiled source of ShadowTheHedgehog v0.2.1

ShadowTheHedgehog.dll

Decompiled 16 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using 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 HedgehogUtils;
using HedgehogUtils.Boost;
using HedgehogUtils.Boost.EntityStates;
using HedgehogUtils.Forms;
using HedgehogUtils.Forms.EntityStates;
using HedgehogUtils.Forms.SuperForm;
using HedgehogUtils.Launch;
using HedgehogUtils.Miscellaneous;
using JetBrains.Annotations;
using KinematicCharacterController;
using LoadingScreenFix;
using LookingGlass.LookingGlassLanguage;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.HudOverlay;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPaths;
using RoR2BepInExPack.GameAssetPathsBetter;
using ShadowTheHedgehog.Components;
using ShadowTheHedgehog.Modules;
using ShadowTheHedgehog.Modules.Achievements;
using ShadowTheHedgehog.Modules.Characters;
using ShadowTheHedgehog.Modules.ShadowSkillDefs;
using ShadowTheHedgehog.Modules.Survivors;
using ShadowTheHedgehog.SkillStates;
using ShadowTheHedgehog.SkillStates.SuperUpgrades;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ShadowTheHedgehog
{
	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)
		{
			if (Config.EnableLogs().Value)
			{
				_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)
		{
			if (Config.EnableLogs().Value)
			{
				_logSource.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			if (Config.EnableLogs().Value)
			{
				_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.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.gavinel.ShadowTheHedgehog", "ShadowTheHedgehog", "0.2.1")]
	public class ShadowTheHedgehogPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.gavinel.ShadowTheHedgehog";

		public const string MODNAME = "ShadowTheHedgehog";

		public const string MODVERSION = "0.2.1";

		public const string DEVELOPER_PREFIX = "GAVINEL";

		public static ShadowTheHedgehogPlugin instance;

		public static bool emoteAPILoaded = false;

		public static bool lookingGlassLoaded = false;

		public static bool riskOfOptionsLoaded = false;

		public static bool ancientScepterLoaded = false;

		public static bool loadingScreenFixLoaded = false;

		private static BodyIndex shadowBodyIndex = (BodyIndex)(-1);

		private const float hitBoostFraction = 0.01f;

		private const float hurtBoostRatio = 0.5f;

		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();
			DamageTypes.Initialize();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			NetworkingAPI.RegisterMessageType<SonicParryHit>();
			NetworkingAPI.RegisterMessageType<ShadowTrickMessage>();
			new ShadowTheHedgehogCharacter().Initialize();
			new ContentPacks().Initialize();
			if (riskOfOptionsLoaded)
			{
				RiskOfOptionsSetup();
			}
			Hook();
		}

		private void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			HealthComponent.TakeDamage += new hook_TakeDamage(TakeDamage);
			FootstepHandler.Footstep_string_GameObject += new hook_Footstep_string_GameObject(ShadowFootstep);
			GlobalEventManager.onCharacterDeathGlobal += KillRefillsBoost;
			GlobalEventManager.onServerDamageDealt += DamageRefillsBoost;
			CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(AddGrandSlamJuggleFloat);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(SonicRecalculateStats);
			UserProfile.OnLogin += new hook_OnLogin(ConfigUnlocks);
			if (lookingGlassLoaded)
			{
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LookingGlassSetup));
			}
		}

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

		public static void LookingGlassSetup()
		{
			if (Language.languagesByName.TryGetValue("en", out var value))
			{
				RegisterLookingGlassBuff(value, Buffs.boostBuff, "Shadow 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 Shadow Boost", $"Gain <style=cIsUtility>+{100f}% movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.ballBuff, "Shadow Ball", $"Gain <style=cIsUtility>+{100f} armor</style>.");
				RegisterLookingGlassBuff(value, Buffs.parryBuff, "Shadow Parry", $"Gain <style=cIsUtility>+{25f}% attack speed</style> and <style=cIsUtility>+{25f}% movement speed</style>.");
				RegisterLookingGlassBuff(value, Buffs.superParryDebuff, "Super Shadow Parry Debuff", $"Reduces <style=cIsUtility>armor</style> by {50f}, reduces <style=cIsUtility>attack speed and movement speed</style> by {50f}%.");
				RegisterLookingGlassBuff(value, Buffs.chaosSpearDebuff, "Chaos Spear Debuff", $"Reduces <style=cIsUtility>armor</style> by {5f} per stack.");
				RegisterLookingGlassBuff(value, Buffs.chaosModeBuff, "Chaos Mode", $"Gain <style=cIsDamage>+{15f}% damage</style>, <style=cIsUtility>+{10f} armor</style>, <style=cIsUtility>+{15f}% movement speed</style> and <style=cIsDamage>+{15f}% attack speed</style> while the Boost meter drains.");
				RegisterLookingGlassBuff(value, Buffs.chaosControlBuff, "Chaos Control", "<style=cIsUtility>Invincible</style> while teleporting. Enemies that hit you are frozen in time.");
				RegisterLookingGlassBuff(value, Buffs.chaosBlastBuff, "Chaos Blast", "Charging a <style=cIsDamage>Chaos Blast</style>: heavily reduced damage taken.");
				RegisterLookingGlassBuff(value, Buffs.timeStopDebuff, "Time Stop", "<style=cIsUtility>Frozen in time</style>: cannot move or act.");
			}
		}

		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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			ModSettingsManager.SetModIcon(ShadowModel.Icon("texShadowPortrait"));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.KeyPressHomingAttack()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockParry()));
			Config.ForceUnlockParry().SettingChanged += ShadowTheHedgehogCharacter.UnlockParryConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockMastery()));
			Config.ForceUnlockMastery().SettingChanged += ShadowTheHedgehogCharacter.UnlockMasteryConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.EnableLogs()));
		}

		private void SonicRecalculateStats(CharacterBody self, StatHookEventArgs stats)
		{
			if (!Object.op_Implicit((Object)(object)self))
			{
				return;
			}
			if (self.HasBuff(Buffs.boostBuff))
			{
				BoostLogic.BoostStats(self, stats, PowerBoostLogic.ShouldPowerBoost(self) ? 0.65f : 0.35f);
				stats.armorAdd += 50f;
			}
			if (self.HasBuff(Buffs.superBoostBuff))
			{
				BoostLogic.BoostStats(self, stats, 1f);
				stats.armorAdd += 50f;
			}
			if (self.HasBuff(Buffs.ballBuff))
			{
				stats.armorAdd += 100f;
			}
			if (self.HasBuff(Buffs.parryBuff))
			{
				stats.attackSpeedMultAdd += 0.25f;
				stats.moveSpeedMultAdd += 0.25f;
			}
			if (self.HasBuff(Buffs.superParryDebuff))
			{
				stats.baseMoveSpeedAdd -= self.baseMoveSpeed / 2f;
				stats.armorAdd -= 50f;
				stats.baseAttackSpeedAdd -= self.baseAttackSpeed / 2f;
			}
			if (self.HasBuff(Buffs.grandSlamJuggleDebuff))
			{
				stats.moveSpeedReductionMultAdd += 1f;
			}
			if (self.HasBuff(Buffs.sonicBoomDebuff))
			{
				stats.armorAdd -= 5f * (float)self.GetBuffCount(Buffs.sonicBoomDebuff);
			}
			if (self.HasBuff(Buffs.chaosModeBuff))
			{
				stats.damageMultAdd += 0.15f;
				stats.armorAdd += 10f;
				stats.moveSpeedMultAdd += 0.15f;
				stats.attackSpeedMultAdd += 0.15f;
			}
			if (self.HasBuff(Buffs.timeStopDebuff))
			{
				stats.moveSpeedReductionMultAdd += 9f;
				stats.attackSpeedReductionMultAdd += 9f;
				if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<TimeStopFreezer>()))
				{
					((Component)self).gameObject.AddComponent<TimeStopFreezer>();
				}
			}
			if (self.HasBuff(Buffs.chaosSpearDebuff))
			{
				stats.armorAdd -= 5f * (float)self.GetBuffCount(Buffs.chaosSpearDebuff);
			}
			if (self.HasBuff(Buffs.crossSlashDebuff))
			{
				stats.armorAdd -= 10f * (float)self.GetBuffCount(Buffs.crossSlashDebuff);
			}
		}

		private void ShadowFootstep(orig_Footstep_string_GameObject orig, FootstepHandler self, string childName, GameObject footstepEffect)
		{
			ShadowAnimator shadowAnimator = (Object.op_Implicit((Object)(object)self) ? ((Component)self).GetComponent<ShadowAnimator>() : null);
			bool num = Object.op_Implicit((Object)(object)shadowAnimator) && Time.time - shadowAnimator.lastOwnStepTime < 0.2f;
			if (childName == "ToeL" && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)self).GetComponent<ShadowAnimator>()))
			{
				ChildLocator component = ((Component)self).GetComponent<ChildLocator>();
				childName = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.FindChild("ToeR"))) ? "ToeR" : "FootR");
			}
			if (num)
			{
				string baseFootstepString = self.baseFootstepString;
				self.baseFootstepString = "";
				orig.Invoke(self, childName, footstepEffect);
				self.baseFootstepString = baseFootstepString;
			}
			else
			{
				orig.Invoke(self, childName, footstepEffect);
			}
		}

		private void TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damage)
		{
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(Buffs.chaosBlastBuff) && damage != null)
			{
				damage.rejected = true;
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(Buffs.chaosControlBuff) && damage != null && !damage.rejected)
			{
				damage.rejected = true;
				if (Object.op_Implicit((Object)(object)damage.attacker))
				{
					CharacterBody component = damage.attacker.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && (Object)(object)component != (Object)(object)self.body)
					{
						component.AddTimedBuff(Buffs.timeStopDebuff, 2f);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)self) && NetworkServer.active)
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)self).gameObject, "Body");
				if (Object.op_Implicit((Object)(object)val))
				{
					EntityState state = val.state;
					NetworkIdentity component2 = ((Component)self).gameObject.GetComponent<NetworkIdentity>();
					if (typeof(Parry).IsAssignableFrom(((object)state).GetType()) && Object.op_Implicit((Object)(object)component2))
					{
						((Parry)(object)state).OnTakeDamage(damage);
						NetMessageExtensions.Send((INetMessage)(object)new SonicParryHit(component2.netId, damage), (NetworkDestination)1);
					}
				}
			}
			orig.Invoke(self, damage);
			if (DamageAPI.HasModdedDamageType(ref damage.damageType, DamageTypes.grandSlamJuggle) && NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && !((Enum)self.body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)16384))
			{
				self.body.AddTimedBuff(Buffs.grandSlamJuggleDebuff, 1f, 1);
			}
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)self) || !self.alive || !Object.op_Implicit((Object)(object)self.body))
			{
				return;
			}
			for (int i = 0; i < DamageTypes.chaosSpearLevel.Length; i++)
			{
				if (DamageAPI.HasModdedDamageType(ref damage.damageType, DamageTypes.chaosSpearLevel[i]))
				{
					float stun = StaticValues.chaosSpearStunDuration[i];
					self.body.AddTimedBuff(Buffs.chaosSpearDebuff, StaticValues.chaosSpearDebuffDuration[i]);
					SetStateOnHurt component3 = ((Component)self).GetComponent<SetStateOnHurt>();
					if (Object.op_Implicit((Object)(object)component3) && component3.canBeStunned)
					{
						component3.SetStun(stun);
					}
					break;
				}
			}
		}

		private void DamageRefillsBoost(DamageReport report)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Invalid comparison between Unknown and I4
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || report == null || report.damageInfo == null)
			{
				return;
			}
			if ((int)shadowBodyIndex == -1)
			{
				shadowBodyIndex = BodyCatalog.FindBodyIndex("ShadowTheHedgehog");
			}
			if ((Object)(object)report.attackerBody == (Object)(object)report.victimBody)
			{
				return;
			}
			CharacterBody attackerBody = report.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody) && attackerBody.bodyIndex == shadowBodyIndex && CanGainFightBoost(attackerBody) && (int)report.dotType == -1 && report.damageInfo.procChainMask.mask == 0 && report.damageInfo.procCoefficient > 0f)
			{
				DamageSource damageSource = report.damageInfo.damageType.damageSource;
				if ((damageSource & 7) != 0 && (damageSource & 8) == 0)
				{
					BoostLogic component = ((Component)attackerBody).GetComponent<BoostLogic>();
					if (Object.op_Implicit((Object)(object)component) && component.boostExists)
					{
						component.AddBoost(component.maxBoostMeter * 0.01f * Mathf.Min(1f, report.damageInfo.procCoefficient));
					}
				}
			}
			CharacterBody victimBody = report.victimBody;
			if (Object.op_Implicit((Object)(object)victimBody) && victimBody.bodyIndex == shadowBodyIndex && CanGainFightBoost(victimBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && report.damageDealt > 0f)
			{
				BoostLogic component2 = ((Component)victimBody).GetComponent<BoostLogic>();
				float fullCombinedHealth = victimBody.healthComponent.fullCombinedHealth;
				if (Object.op_Implicit((Object)(object)component2) && component2.boostExists && fullCombinedHealth > 0f)
				{
					component2.AddBoost(component2.maxBoostMeter * 0.5f * Mathf.Clamp01(report.damageDealt / fullCombinedHealth));
				}
			}
		}

		private static bool CanGainFightBoost(CharacterBody body)
		{
			if (!body.HasBuff(Buffs.chaosBlastBuff))
			{
				return !body.HasBuff(Buffs.chaosModeBuff);
			}
			return false;
		}

		private void KillRefillsBoost(DamageReport report)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || report == null || !Object.op_Implicit((Object)(object)report.attackerBody))
			{
				return;
			}
			if ((int)shadowBodyIndex == -1)
			{
				shadowBodyIndex = BodyCatalog.FindBodyIndex("ShadowTheHedgehog");
			}
			if (report.attackerBody.bodyIndex == shadowBodyIndex && !report.attackerBody.HasBuff(Buffs.chaosBlastBuff))
			{
				BoostLogic component = ((Component)report.attackerBody).GetComponent<BoostLogic>();
				if (Object.op_Implicit((Object)(object)component) && component.boostExists)
				{
					component.AddBoost(component.maxBoostMeter * 0.1f);
				}
			}
		}

		private void AddGrandSlamJuggleFloat(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buff)
		{
			orig.Invoke(self, buff);
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)buff) && (Object)(object)buff == (Object)(object)Buffs.grandSlamJuggleDebuff && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<GrandSlamJuggleFloat>()))
			{
				((Component)self).gameObject.AddComponent<GrandSlamJuggleFloat>();
			}
		}

		private void ConfigUnlocks(orig_OnLogin orig, UserProfile self)
		{
			orig.Invoke(self);
			if (!self.HasAchievement("GAVINELSHADOWPARRYUNLOCKABLE") && Config.ForceUnlockParry().Value)
			{
				self.AddAchievement("GAVINELSHADOWPARRYUNLOCKABLE", true);
			}
			if (!self.HasAchievement("GAVINELSHADOWMASTERYUNLOCKABLE") && Config.ForceUnlockMastery().Value)
			{
				self.AddAchievement("GAVINELSHADOWMASTERYUNLOCKABLE", true);
			}
		}
	}
}
namespace ShadowTheHedgehog.SkillStates
{
	public class BoostIdle : BoostIdle
	{
		public override void OnEnter()
		{
			((BoostIdle)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((BoostIdle)this).OnExit();
		}
	}
	public class ChaosBlast : BaseState
	{
		private enum Phase
		{
			Charging,
			Exploding
		}

		public bool isSuper;

		private readonly HashSet<HealthComponent> enemiesHit = new HashSet<HealthComponent>();

		private Phase phase;

		private float power;

		private Vector3 origin;

		private float phaseTimer;

		private float tickTimer;

		private float chargeEffectTimer;

		private float cleanseTimer;

		private ChaosModeController controller;

		private CameraParamsOverrideHandle cameraHandle;

		private GameObject areaIndicator;

		private float indicatorSpin;

		private static readonly Vector3 indicatorSpinAxis;

		private const float indicatorSpinSpeed = 25f;

		public static event Action<CharacterBody, int> onServerEnemiesHit;

		public override void OnEnter()
		{
			//IL_002b: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: 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)
			((BaseState)this).OnEnter();
			controller = ((EntityState)this).GetComponent<ChaosModeController>();
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				cameraHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
				{
					cameraParamsData = 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, 2f, isSuper ? (-38f) : (-26f))),
						wallCushion = BlendableFloat.op_Implicit(0.1f)
					},
					priority = 2f
				}, 0.6f);
			}
			if (isSuper)
			{
				power = 1f;
			}
			else
			{
				BoostLogic component = ((EntityState)this).GetComponent<BoostLogic>();
				float num = 0f;
				float num2 = 100f;
				if (Object.op_Implicit((Object)(object)component))
				{
					num = (NetworkServer.active ? component.boostMeter : component.predictedMeter);
					num2 = Mathf.Max(1f, component.maxBoostMeter);
					component.InstantChangeBoostMeter(0f - num2);
				}
				power = Mathf.Clamp01(num / num2);
			}
			if (Object.op_Implicit((Object)(object)controller))
			{
				controller.superBlast = isSuper;
			}
			origin = ((EntityState)this).characterBody.corePosition;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.chaosBlastBuff);
				Util.CleanseBody(((EntityState)this).characterBody, true, false, false, true, true, false);
			}
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			SetResistance(0.8f);
			((EntityState)this).PlayAnimation("FullBody, Override", "ParryEnter");
			ShadowAnimator.Play(((EntityState)this).GetModelTransform(), "Shadow_ChaosBlastCharge", loop: false, stopOnMove: false, holdAtEnd: true, 1f, restart: true);
			Util.PlaySound("Play_shadow_chaosblast_chargeup", ((EntityState)this).gameObject);
			SpawnChargeEffect();
		}

		public override void FixedUpdate()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (NetworkServer.active)
			{
				cleanseTimer -= Time.fixedDeltaTime;
				if (cleanseTimer <= 0f)
				{
					cleanseTimer = 0.1f;
					Util.CleanseBody(((EntityState)this).characterBody, true, false, false, true, true, false);
				}
			}
			PauseSpecialCooldown();
			phaseTimer += Time.fixedDeltaTime;
			if (phase == Phase.Charging)
			{
				UpdateAreaIndicator(Mathf.Lerp(0.5f, StartRadius(), Mathf.Clamp01(phaseTimer / 1.5f)));
				chargeEffectTimer += Time.fixedDeltaTime;
				if (chargeEffectTimer >= 0.5f)
				{
					chargeEffectTimer = 0f;
					SpawnChargeEffect();
				}
				if (phaseTimer >= 1.5f)
				{
					phase = Phase.Exploding;
					phaseTimer = 0f;
					tickTimer = 0.25f;
					Util.PlaySound("Play_shadow_chaosblast_explosion", ((EntityState)this).gameObject);
				}
				return;
			}
			float t = Mathf.Clamp01(phaseTimer / 2.5f);
			SetResistance(0.8f * (1f - Mathf.Clamp01(phaseTimer / 0.6f)));
			UpdateAreaIndicator(CurrentRadius(t));
			tickTimer += Time.fixedDeltaTime;
			if (tickTimer >= 0.25f)
			{
				tickTimer -= 0.25f;
				float radius = CurrentRadius(t);
				SpawnExplosionEffect(radius);
				if (NetworkServer.active)
				{
					FireTick(radius);
				}
			}
			if (((EntityState)this).isAuthority && phaseTimer >= 2.5f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private float SizeMultiplier()
		{
			if (!isSuper)
			{
				return 1f;
			}
			return 2f;
		}

		private float StartRadius()
		{
			return 4f * SizeMultiplier();
		}

		private float MaxRadius()
		{
			return ((power < 0.5f) ? (25f * Mathf.Lerp(0.3f, 1f, power)) : Mathf.Lerp(22f, 32f, (power - 0.5f) / 0.5f)) * SizeMultiplier();
		}

		private float CurrentRadius(float t)
		{
			float num = Mathf.Clamp01(t / 0.4f);
			return Mathf.Lerp(StartRadius(), MaxRadius(), num);
		}

		private void FireTick(float radius)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Lerp(0.3f, 1f, power) * (isSuper ? 2f : 1f);
			Result val = new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = ((BaseState)this).GetTeam(),
				position = origin,
				radius = radius,
				baseDamage = 2f * num * base.damageStat,
				baseForce = 0f,
				bonusForce = Vector3.zero,
				crit = ((BaseState)this).RollCrit(),
				procCoefficient = 0.5f,
				falloffModel = (FalloffModel)0,
				damageColorIndex = (DamageColorIndex)0,
				attackerFiltering = (AttackerFiltering)2,
				damageType = DamageTypeCombo.op_Implicit((DamageType)0),
				damageType = 
				{
					damageSource = (DamageSource)8
				}
			}.Fire();
			int count = enemiesHit.Count;
			if (val.hitPoints != null)
			{
				for (int i = 0; i < val.hitCount && i < val.hitPoints.Length; i++)
				{
					HurtBox hurtBox = val.hitPoints[i].hurtBox;
					if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent))
					{
						enemiesHit.Add(hurtBox.healthComponent);
					}
				}
			}
			if (enemiesHit.Count != count && ChaosBlast.onServerEnemiesHit != null)
			{
				ChaosBlast.onServerEnemiesHit(((EntityState)this).characterBody, enemiesHit.Count);
			}
		}

		private void SpawnChargeEffect()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Assets.chaosBlastChargeEffect))
			{
				EffectManager.SimpleEffect(Assets.chaosBlastChargeEffect, origin, Quaternion.identity, false);
			}
		}

		private void SpawnExplosionEffect(float radius)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00bf: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)Assets.chaosBlastExplosionEffect))
			{
				return;
			}
			int num = (isSuper ? 6 : 3);
			for (int i = 0; i < num; i++)
			{
				Vector2 val = Random.insideUnitCircle * radius * 0.85f;
				Vector3 val2 = origin + new Vector3(val.x, Random.Range(-0.25f, 0.4f) * radius * 0.5f, val.y);
				if (i == 0)
				{
					val2 = origin;
				}
				float scale = Mathf.Lerp(4f, 8f, Random.value) * (isSuper ? 1.5f : 1f);
				EffectManager.SpawnEffect(Assets.chaosBlastExplosionEffect, new EffectData
				{
					origin = val2,
					scale = scale
				}, false);
			}
		}

		private void UpdateAreaIndicator(float radius)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Assets.chaosBlastAreaIndicator))
			{
				if (!Object.op_Implicit((Object)(object)areaIndicator))
				{
					areaIndicator = Object.Instantiate<GameObject>(Assets.chaosBlastAreaIndicator, origin, Quaternion.identity);
				}
				areaIndicator.transform.position = origin;
				areaIndicator.transform.localScale = Vector3.one * radius * 1f;
				indicatorSpin = (indicatorSpin + 25f * Time.fixedDeltaTime) % 360f;
				areaIndicator.transform.rotation = Quaternion.AngleAxis(indicatorSpin, indicatorSpinAxis);
			}
		}

		private void SetResistance(float value)
		{
			if (Object.op_Implicit((Object)(object)controller))
			{
				controller.blastResistance = value;
			}
		}

		private void PauseSpecialCooldown()
		{
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.special))
			{
				((EntityState)this).skillLocator.special.rechargeStopwatch = 0f;
			}
		}

		public override void OnExit()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)areaIndicator))
			{
				Object.Destroy((Object)(object)areaIndicator);
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.RemoveParamsOverride(cameraHandle, 0.8f);
			}
			SetResistance(0f);
			if (Object.op_Implicit((Object)(object)controller))
			{
				controller.superBlast = false;
			}
			if (NetworkServer.active && ((EntityState)this).characterBody.HasBuff(Buffs.chaosBlastBuff))
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.chaosBlastBuff);
			}
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags & -2);
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			ShadowAnimator.Stop(((EntityState)this).GetModelTransform());
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			//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)
			((EntityState)this).OnDeserialize(reader);
			power = reader.ReadSingle();
			origin = reader.ReadVector3();
			isSuper = reader.ReadBoolean();
		}

		static ChaosBlast()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Vector3 val = new Vector3(0.25f, 1f, 0.15f);
			indicatorSpinAxis = ((Vector3)(ref val)).normalized;
		}
	}
	public class ChaosControl : BaseState
	{
		public bool isSuper;

		private Vector3 blinkDirection;

		private float duration;

		private float speed;

		private CharacterModel characterModel;

		private bool madeInvisible;

		public override void OnEnter()
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_01ee: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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)
			((BaseState)this).OnEnter();
			duration = 0.2f;
			float num = 25f * (isSuper ? 1.6f : 1f);
			float num2 = ((EntityState)this).characterBody.baseMoveSpeed * (((EntityState)this).characterBody.isSprinting ? ((EntityState)this).characterBody.sprintingSpeedMultiplier : 1f);
			if (num2 > 0f)
			{
				num *= Mathf.Max(1f, ((EntityState)this).characterBody.moveSpeed / num2);
			}
			speed = num / duration;
			BoostLogic component = ((EntityState)this).GetComponent<BoostLogic>();
			if (!isSuper)
			{
				if (Object.op_Implicit((Object)(object)component) && !((EntityState)this).characterBody.HasBuff(Buffs.chaosModeBuff))
				{
					component.InstantChangeBoostMeter(0f - Cost(component));
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility))
				{
					((EntityState)this).skillLocator.utility.DeductStock(1);
				}
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.chaosControlBuff);
			}
			Vector3 val = (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) ? ((EntityState)this).inputBank.moveVector : Vector3.zero);
			if (((Vector3)(ref val)).sqrMagnitude > 0.01f)
			{
				blinkDirection = ((Vector3)(ref val)).normalized;
				if (isSuper && Helpers.Flying(((EntityState)this).gameObject))
				{
					Vector3 aimDirection = ((EntityState)this).inputBank.aimDirection;
					Vector3 val2 = default(Vector3);
					((Vector3)(ref val2))..ctor(aimDirection.x, 0f, aimDirection.z);
					if (((Vector3)(ref val2)).sqrMagnitude > 0.01f && Vector3.Dot(blinkDirection, ((Vector3)(ref val2)).normalized) > 0.5f)
					{
						blinkDirection = ((Vector3)(ref aimDirection)).normalized;
					}
				}
			}
			else
			{
				Vector3 aimDirection2 = ((EntityState)this).inputBank.aimDirection;
				aimDirection2.y = 0f;
				blinkDirection = ((((Vector3)(ref aimDirection2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref aimDirection2)).normalized : ((EntityState)this).characterDirection.forward);
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount + 1;
				madeInvisible = true;
			}
			CreateBlinkEffect(((EntityState)this).characterBody.corePosition);
			Util.PlaySound("Play_shadow_chaossnap", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.rootMotion += blinkDirection * (speed * Time.fixedDeltaTime);
			}
			if (!((EntityState)this).isAuthority || !(((EntityState)this).fixedAge >= duration))
			{
				return;
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(blinkDirection.x, 0f, blinkDirection.z);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && ((Vector3)(ref val)).sqrMagnitude > 0.01f)
			{
				((EntityState)this).characterDirection.forward = ((Vector3)(ref val)).normalized;
			}
			if (isSuper)
			{
				bool flag = Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).characterMotor.isGrounded;
				bool flag2 = Helpers.Flying(((EntityState)this).gameObject);
				if (!Object.op_Implicit((Object)(object)((EntityState)this).inputBank) || !((EntityState)this).inputBank.skill3.down)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				else if ((flag || flag2) && ((EntityState)this).inputBank.moveVector == Vector3.zero)
				{
					SkillDef skillDef = ((EntityState)this).skillLocator.utility.skillDef;
					IBoostSkill val2 = (IBoostSkill)(object)((skillDef is IBoostSkill) ? skillDef : null);
					if (val2 != null)
					{
						((EntityState)this).outer.SetNextState(BoostSkillDef.InstantiateState(((EntityState)this).skillLocator.utility, val2.boostIdleState));
					}
					else
					{
						((EntityState)this).outer.SetNextStateToMain();
					}
				}
				else
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new ChaosControlSuperAirBoost
					{
						airBoosting = !(flag || flag2)
					});
				}
			}
			else
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ChaosControlAirBoost
				{
					airBoosting = true
				});
			}
		}

		public override void OnExit()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (madeInvisible && Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount - 1;
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.chaosControlBuff);
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.1f);
			}
			CreateBlinkEffect(((EntityState)this).characterBody.corePosition);
			((EntityState)this).OnExit();
		}

		private void CreateBlinkEffect(Vector3 origin)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)Assets.chaosControlEffect))
			{
				EffectData val = new EffectData
				{
					rotation = Util.QuaternionSafeLookRotation(blinkDirection),
					origin = origin
				};
				EffectManager.SpawnEffect(Assets.chaosControlEffect, val, false);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((EntityState)this).OnSerialize(writer);
			writer.Write(isSuper);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			isSuper = reader.ReadBoolean();
		}

		public static bool ShouldChaosControl(GenericSkill skillSlot)
		{
			return ShouldChaosControl(skillSlot, isSuper: false);
		}

		public static bool ShouldChaosControl(GenericSkill skillSlot, bool isSuper)
		{
			if (!Object.op_Implicit((Object)(object)skillSlot) || !Object.op_Implicit((Object)(object)skillSlot.characterBody) || !Object.op_Implicit((Object)(object)skillSlot.characterBody.characterMotor))
			{
				return false;
			}
			if (isSuper)
			{
				InputBankTest inputBank = skillSlot.characterBody.inputBank;
				BoostLogic component = ((Component)skillSlot).GetComponent<BoostLogic>();
				if (Object.op_Implicit((Object)(object)inputBank) && ((ButtonState)(ref inputBank.skill3)).justPressed)
				{
					if (Object.op_Implicit((Object)(object)component))
					{
						return component.boostAvailable;
					}
					return true;
				}
				return false;
			}
			if (skillSlot.characterBody.characterMotor.isGrounded)
			{
				return false;
			}
			if (Helpers.Flying(((Component)skillSlot).gameObject))
			{
				return false;
			}
			BoostLogic component2 = ((Component)skillSlot).GetComponent<BoostLogic>();
			if (!Object.op_Implicit((Object)(object)component2))
			{
				return false;
			}
			float num = (NetworkServer.active ? component2.boostMeter : component2.predictedMeter);
			if (skillSlot.characterBody.HasBuff(Buffs.chaosModeBuff))
			{
				return num > 0f;
			}
			return num >= Cost(component2) - 0.01f;
		}

		public static float Cost(BoostLogic boostLogic)
		{
			return Mathf.Min(100f, boostLogic.maxBoostMeter) * 0.5f;
		}

		public static EntityState Create(GenericSkill skillSlot, bool isSuper)
		{
			return (EntityState)(object)new ChaosControl
			{
				isSuper = isSuper
			};
		}
	}
	public class ChaosControlAirBoost : NewBoost
	{
		protected override float boostStartMeterDrain => 0f;
	}
	public class ChaosControlSuperAirBoost : NewSuperBoost
	{
		public override void OnEnter()
		{
			int num = ((Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility)) ? ((EntityState)this).skillLocator.utility.stock : 0);
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility) && ((EntityState)this).skillLocator.utility.stock < num)
			{
				((EntityState)this).skillLocator.utility.stock = num;
			}
		}
	}
	public class ChaosModeActivate : BaseState
	{
		private Vector3 startVelocity;

		public override void OnEnter()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			startVelocity = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			if (NetworkServer.active)
			{
				Util.CleanseBody(((EntityState)this).characterBody, true, false, false, true, true, false);
				if (!((EntityState)this).characterBody.HasBuff(Buffs.chaosModeBuff))
				{
					((EntityState)this).characterBody.AddBuff(Buffs.chaosModeBuff);
				}
			}
			if (Object.op_Implicit((Object)(object)Assets.chaosModeActivateEffect))
			{
				EffectManager.SimpleEffect(Assets.chaosModeActivateEffect, ((EntityState)this).characterBody.corePosition, Quaternion.identity, false);
			}
			Util.PlaySound("Play_shadow_chaosmode_start", ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("FullBody, Override", "ParryRelease");
			ShadowAnimator.Play(((EntityState)this).GetModelTransform(), "Shadow_ChaosModeActivate", loop: false, stopOnMove: true);
		}

		public override void FixedUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			ShadowHover.Apply((BaseState)(object)this, startVelocity, ((EntityState)this).fixedAge, 0.15f);
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.4f)
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public static class ChaosModeHoming
	{
		public static bool TryTeleport(EntityState state, CharacterBody body, CharacterMotor motor, HurtBox target, bool force = false)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)motor) || !Object.op_Implicit((Object)(object)target) || (!force && !body.HasBuff(Buffs.chaosModeBuff)))
			{
				return false;
			}
			Vector3 val = ((Component)target).transform.position - body.footPosition;
			Vector3 val2 = val;
			val2.y = 0f;
			Vector3 val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : body.transform.forward);
			Vector3 val4 = ((Component)target).transform.position - val3 * 2.5f;
			if (Object.op_Implicit((Object)(object)Assets.chaosControlEffect))
			{
				EffectManager.SpawnEffect(Assets.chaosControlEffect, new EffectData
				{
					origin = body.corePosition,
					rotation = Util.QuaternionSafeLookRotation(val)
				}, true);
			}
			Util.PlaySound("Play_shadow_chaossnap", ((Component)body).gameObject);
			TeleportHelper.TeleportBody(body, val4, false);
			if (Object.op_Implicit((Object)(object)Assets.chaosControlEffect))
			{
				EffectManager.SpawnEffect(Assets.chaosControlEffect, new EffectData
				{
					origin = val4,
					rotation = Util.QuaternionSafeLookRotation(val)
				}, true);
			}
			return true;
		}
	}
	public class ChaosSpearCharge : BaseSkillState
	{
		protected int level;

		private float levelTimer;

		private float timeAtMaxLevel;

		private Vector3 startVelocity;

		private uint chargeSoundId;

		protected virtual bool isSuper => false;

		public override void OnEnter()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			level = (isSuper ? 1 : 0);
			startVelocity = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			}
			((EntityState)this).characterBody.SetAimTimer(2f);
			((EntityState)this).PlayAnimation("FullBody, Override", "ParryEnter");
			ShadowAnimator.SetMirror(((EntityState)this).GetModelTransform(), on: true);
			chargeSoundId = Util.PlaySound("Play_shadow_spear_chargeup", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			((BaseState)this).StartAimMode(2f, false);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				Vector3 val = ((Vector3)(ref ((EntityState)this).inputBank.moveVector)).normalized * ((EntityState)this).characterBody.moveSpeed * 0.15f;
				val.y = -0.5f;
				((EntityState)this).characterMotor.velocity = Vector3.Lerp(startVelocity, val, Mathf.Clamp01(((EntityState)this).fixedAge / 0.35f));
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			GenericSkill secondary = ((EntityState)this).skillLocator.secondary;
			if (Object.op_Implicit((Object)(object)secondary) && secondary.stock < secondary.maxStock)
			{
				secondary.rechargeStopwatch = Mathf.Max(0f, secondary.rechargeStopwatch - Time.fixedDeltaTime);
			}
			float num = StaticValues.chaosSpearChargeTimePerLevelValue / ((BaseState)this).attackSpeedStat;
			if (level < 2)
			{
				levelTimer += Time.fixedDeltaTime;
				if (levelTimer >= num && ((EntityState)this).skillLocator.secondary.stock > 0)
				{
					levelTimer = 0f;
					level++;
					((EntityState)this).skillLocator.secondary.DeductStock(1);
					OnLevelUp();
				}
			}
			else
			{
				timeAtMaxLevel += Time.fixedDeltaTime;
			}
			if (!((EntityState)this).inputBank.skill2.down || timeAtMaxLevel >= 1.5f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ChaosSpearFire
				{
					level = level,
					isSuper = isSuper
				});
			}
		}

		public override void OnExit()
		{
			ShadowAnimator.SetMirror(((EntityState)this).GetModelTransform(), on: false);
			if (chargeSoundId != 0)
			{
				AkSoundEngine.StopPlayingID(chargeSoundId);
			}
			((EntityState)this).OnExit();
		}

		protected virtual void OnLevelUp()
		{
			Util.PlaySound("Play_sonicthehedgehog_boost_change", ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(Assets.sonicBoomKickEffect, ((EntityState)this).gameObject, "SwingCenter", false);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write((byte)level);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			level = reader.ReadByte();
		}
	}
	public class ChaosSpearFire : BaseSkillState
	{
		public int level;

		public bool isSuper;

		private const float baseDuration = 0.35f;

		private float duration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = 0.35f / ((BaseState)this).attackSpeedStat;
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			((EntityState)this).PlayAnimation("Gesture, Override", "ThrowBomb", "ThrowBomb.playbackRate", duration, 0f);
			ShadowAnimator.Play(((EntityState)this).GetModelTransform(), "Shadow_ChaosSpearAir", loop: false);
			Util.PlaySound("Play_shadow_spear_shoot", ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(Assets.sonicBoomKickEffect, ((EntityState)this).gameObject, "SwingCenter", false);
			if (((EntityState)this).isAuthority)
			{
				Fire();
			}
		}

		private void Fire()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			GameObject val = (isSuper ? Projectiles.superChaosSpearPrefabs[level] : Projectiles.chaosSpearPrefabs[level]);
			int num = StaticValues.chaosSpearCount[level];
			if (isSuper)
			{
				num = Mathf.RoundToInt((float)num * 2f);
			}
			float num2 = StaticValues.chaosSpearSpreadDegrees[level];
			if (isSuper && num2 <= 0f)
			{
				num2 = StaticValues.chaosSpearSpreadDegrees[1];
			}
			float num3 = StaticValues.chaosSpearDamagePerLevel[level];
			bool flag = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
			Quaternion val2 = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
			for (int i = 0; i < num; i++)
			{
				Vector2 val3 = Random.insideUnitCircle * num2;
				Quaternion val4 = val2 * Quaternion.Euler(val3.y, val3.x, 0f);
				ProjectileManager.instance.FireProjectile(val, ((Ray)(ref aimRay)).origin, val4, ((EntityState)this).gameObject, num3 * ((BaseState)this).damageStat, 200f, flag, (DamageColorIndex)0, (GameObject)null, 150f, (DamageTypeCombo?)null);
			}
			((EntityState)this).characterBody.AddSpreadBloom(1.5f);
		}

		public override void FixedUpdate()
		{
			//IL_001e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				Vector3 velocity = ((Vector3)(ref ((EntityState)this).inputBank.moveVector)).normalized * ((EntityState)this).characterBody.moveSpeed * 0.3f;
				velocity.y = -0.5f;
				((EntityState)this).characterMotor.velocity = velocity;
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write((byte)level);
			writer.Write(isSuper);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			level = reader.ReadByte();
			isSuper = reader.ReadBoolean();
		}
	}
	public class ChaosSpecialInput : BaseSkillState
	{
		private Vector3 startVelocity;

		public override void OnEnter()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			startVelocity = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "ParryEnter");
			ShadowAnimator.Play(((EntityState)this).GetModelTransform(), "Shadow_ChaosBlastCharge", loop: false, stopOnMove: false, holdAtEnd: true, 0f);
		}

		public override void FixedUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			ShadowHover.Apply((BaseState)(object)this, startVelocity, ((EntityState)this).fixedAge);
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			bool flag = ((EntityState)this).characterBody.HasBuff(Buffs.chaosModeBuff);
			if (!((EntityState)this).inputBank.skill4.down)
			{
				if (flag)
				{
					((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
					ShadowAnimator.Stop(((EntityState)this).GetModelTransform());
					((EntityState)this).outer.SetNextStateToMain();
				}
				else
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new ChaosModeActivate());
				}
			}
			else if (((EntityState)this).fixedAge >= 0.8f)
			{
				((EntityState)this).skillLocator.special.DeductStock(1);
				((EntityState)this).outer.SetNextState((EntityState)(object)new ChaosBlast());
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class Death : GenericCharacterDeath
	{
		protected string soundString = "Play_hedgehogutils_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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((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 FollowUp : BaseSkillState
	{
		protected string hitboxName = "FollowUp";

		protected DamageType damageType;

		protected float hitStopDuration;

		protected float attackRecoil;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.meleeFinalHitSoundEvent.index;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private ICharacterFlightParameterProvider flight;

		private bool effectPlayed;

		protected ParryFollowUpTracker followUp;

		protected virtual float launchPushForce => 400f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			flight = ((Component)((EntityState)this).characterBody).GetComponent<ICharacterFlightParameterProvider>();
			followUp = ((EntityState)this).GetComponent<ParryFollowUpTracker>();
			RemoveFollowUpAttack();
			hasFired = false;
			swingSoundString = "Play_sonicthehedgehog_swing_strong";
			hitStopDuration = 0.2f;
			attackRecoil = 3f;
			duration = 1.4f / ((EntityState)this).characterBody.attackSpeed;
			((BaseState)this).StartAimMode(2f, false);
			PlayAttackAnimation();
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			if (!Helpers.Flying(flight) && !((EntityState)this).characterMotor.isGrounded && ((EntityState)this).isAuthority)
			{
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, 12f);
			}
			PrepareOverlapAttack();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.SmallArmorBoost);
			}
		}

		protected virtual void PlayAttackAnimation()
		{
			((EntityState)this).PlayAnimation("Body", "ParryFollowUp", "Slash.playbackRate", duration * 0.8f, 0f);
		}

		public override void OnExit()
		{
			if (!hasFired)
			{
				FireAttack();
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.SmallArmorBoost);
			}
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (!effectPlayed)
			{
				effectPlayed = 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 (!hasFired)
			{
				hasFired = true;
				Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
				if (((EntityState)this).isAuthority)
				{
					((BaseState)this).AddRecoil(-0.4f * attackRecoil, -0.3f * attackRecoil, -1f * attackRecoil, 1f * attackRecoil);
					OnFireAuthority();
				}
			}
			if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null))
			{
				OnHitEnemyAuthority();
			}
		}

		public override void FixedUpdate()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			((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;
			}
			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("Slash.playbackRate", 0f);
				}
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.velocity.y = Mathf.Max(((EntityState)this).characterMotor.velocity.y, -3f);
			}
			if (stopwatch >= duration * 0.4f && stopwatch <= duration * 0.6f)
			{
				attack.forceVector = ((EntityState)this).characterDirection.forward * launchPushForce;
				if (!hasFired)
				{
					Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
					EffectManager.SimpleMuzzleFlash(Assets.followUpKickEffect, ((EntityState)this).gameObject, muzzleString, true);
				}
				if (((EntityState)this).isAuthority)
				{
					FireAttack();
				}
				hasFired = true;
			}
			if (stopwatch >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		protected virtual void RemoveFollowUpAttack()
		{
			if (Object.op_Implicit((Object)(object)followUp))
			{
				followUp.RemoveFollowUpAttack();
			}
		}

		protected virtual void OnFireAuthority()
		{
		}

		public virtual void PrepareOverlapAttack()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			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)2;
			DamageAPI.AddModdedDamageType(ref attack.damageType, DamageTypes.launch);
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = 7f * ((BaseState)this).damageStat;
			attack.procCoefficient = 1f;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
			attack.maximumOverlapTargets = 2;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	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;

		protected Vector3 bonusForce = Vector3.zero;

		protected float baseAttackStartTime = 0.5f;

		protected float attackStartTime;

		protected float attackRecoil = 3f;

		protected float hitHopVelocity = 6f;

		protected bool cancelled;

		protected float noTargetDistancePercentage = 0.7f;

		protected float dashSpeed;

		protected float estimatedDashTime;

		protected float dashOvershoot;

		protected HurtBox target;

		private Vector3 targetDirection;

		protected string chargeSoundString = "Play_sonicthehedgehog_spindash_charge";

		protected string launchSoundString = "Play_sonicthehedgehog_spindash_release";

		protected string hitSoundString = "Play_sonicthehedgehog_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;

		private HomingTracker homingTracker;

		public override void OnEnter()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			((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.75f;
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			if (Object.op_Implicit((Object)(object)homingTracker))
			{
				target = homingTracker.GetTrackingTarget(allowTargetingLaunched: true);
			}
			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)
			{
				if (Object.op_Implicit((Object)(object)target.healthComponent) && Object.op_Implicit((Object)(object)target.healthComponent.body) && target.healthComponent.body.HasBuff(Buffs.launchedBuff))
				{
					dashOvershoot *= 2.5f;
				}
				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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!hasHit)
			{
				hasHit = true;
				EffectManager.SimpleEffect(Assets.homingAttackHitEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
			}
			SetNextState();
		}

		private void FireAttack()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			((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 virtual void PrepareOverlapAttack()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			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);
			DamageAPI.AddModdedDamageType(ref attack.damageType, DamageTypes.grandSlamJuggle);
			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()
		{
			return (InterruptPriority)2;
		}
	}
	public class GrandSlamFinal : BaseSkillState
	{
		protected string hitboxName = "Stomp";

		protected DamageType damageType;

		protected float damageCoefficient = 22f;

		protected float procCoefficient = 1.5f;

		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_sonicthehedgehog_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;

		private bool effectFired;

		protected float startUpVelocityMax = 60f;

		protected float startUpVelocityMin = 3f;

		protected virtual float basePushForce => 1000f;

		public override void OnEnter()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			((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_sonicthehedgehog_swing_low", ((EntityState)this).gameObject);
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			PrepareOverlapAttack();
		}

		public override void OnExit()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: 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)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpda