Decompiled source of ShadowTheHedgehog v0.4.2

ShadowTheHedgehog.dll

Decompiled 2 weeks 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 EntityStates.FalseSonBoss;
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 On.RoR2.UI;
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 TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.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.4.2")]
	public class ShadowTheHedgehogPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.gavinel.ShadowTheHedgehog";

		public const string MODNAME = "ShadowTheHedgehog";

		public const string MODVERSION = "0.4.2";

		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 static readonly Color ammoColor = new Color(1f, 0.82f, 0.3f);

		private static readonly Color uninhibitedCountdownColor = new Color(1f, 0.82f, 0.3f);

		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);
			LoadTimer.Mark("start");
			Assets.Initialize();
			LoadTimer.Mark("ShadowTheHedgehog.Modules.Assets.Initialize");
			if (loadingScreenFixLoaded)
			{
				SonicLoadingScreenSprite();
			}
			Config.ReadConfig();
			States.RegisterStates();
			LoadTimer.Mark("States.RegisterStates");
			Buffs.RegisterBuffs();
			LoadTimer.Mark("Buffs.RegisterBuffs");
			DamageTypes.Initialize();
			LoadTimer.Mark("DamageTypes.Initialize");
			Projectiles.RegisterProjectiles();
			LoadTimer.Mark("Projectiles.RegisterProjectiles");
			Tokens.AddTokens();
			LoadTimer.Mark("Tokens.AddTokens");
			ItemDisplays.PopulateDisplays();
			LoadTimer.Mark("ItemDisplays.PopulateDisplays");
			NetworkingAPI.RegisterMessageType<ShadowTrickMessage>();
			NetworkingAPI.RegisterMessageType<ShadowGunShotMessage>();
			new ShadowTheHedgehogCharacter().Initialize();
			LoadTimer.Mark("ShadowTheHedgehogCharacter");
			new ContentPacks().Initialize();
			LoadTimer.Mark("ContentPacks");
			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
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(SonicRecalculateStats);
			UserProfile.OnLogin += new hook_OnLogin(ConfigUnlocks);
			GenericSkill.ExecuteIfReady += new hook_ExecuteIfReady(BlockSkillsWhileShooting);
			SkillIcon.LateUpdate += new hook_LateUpdate(ShowGunAmmo);
			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.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.gunHasteBuff, "Locked and Loaded: Shotgun", $"Gain <style=cIsDamage>+{2.5f}% attack speed</style> per stack.");
				RegisterLookingGlassBuff(value, Buffs.gunShredDebuff, "Locked and Loaded: Assault Rifle", $"Reduces <style=cIsUtility>armor</style> by {2f} per stack.");
				RegisterLookingGlassBuff(value, Buffs.uninhibitedBuff, "Uninhibited", $"Inhibitor Rings off: everything from Chaos Mode, plus <style=cIsDamage>+{50f}% damage</style>, <style=cIsDamage>+{25f}% attack speed</style> and <style=cIsUtility>+{25f}% movement speed</style>. Drains <style=cIsHealth>max health</style> instead of Boost.");
				RegisterLookingGlassBuff(value, Buffs.uninhibitedDrainBuff, "Uninhibited Strain", "Max health lost to Uninhibited: <style=cIsHealth>0.1%</style> per stack. Comes back slowly once the rings are back on.");
				RegisterLookingGlassBuff(value, Buffs.uninhibitedExhaustedBuff, "Uninhibited Exhausted", "Forced out of Uninhibited: can't move or act, and no Boost comes back.");
				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
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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.ForceUnlockUninhibited()));
			Config.ForceUnlockUninhibited().SettingChanged += ShadowTheHedgehogCharacter.UnlockUninhibitedConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockFalseSonSkin()));
			Config.ForceUnlockFalseSonSkin().SettingChanged += ShadowTheHedgehogCharacter.UnlockFalseSonSkinConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockSolusSkin()));
			Config.ForceUnlockSolusSkin().SettingChanged += ShadowTheHedgehogCharacter.UnlockSolusSkinConfig;
			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.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.uninhibitedBuff))
			{
				stats.damageMultAdd += 0.5f;
				stats.attackSpeedMultAdd += 0.25f;
				stats.moveSpeedMultAdd += 0.25f;
			}
			int buffCount = self.GetBuffCount(Buffs.uninhibitedDrainBuff);
			if (buffCount > 0)
			{
				float num = Mathf.Max(0.05f, 1f - (float)buffCount / 1000f);
				stats.curseTotalMult *= 1f / num;
			}
			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.gunHasteBuff))
			{
				stats.attackSpeedMultAdd += 0.025f * (float)self.GetBuffCount(Buffs.gunHasteBuff);
			}
			if (self.HasBuff(Buffs.gunShredDebuff))
			{
				stats.armorAdd -= 2f * (float)self.GetBuffCount(Buffs.gunShredDebuff);
			}
			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_0145: 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_01b0: 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);
					}
				}
			}
			orig.Invoke(self, damage);
			if (NetworkServer.active && damage != null && !damage.rejected && Object.op_Implicit((Object)(object)damage.attacker) && DamageAPI.HasModdedDamageType(ref damage.damageType, DamageTypes.chaosMarkFinisher) && Object.op_Implicit((Object)(object)self) && self.alive && Object.op_Implicit((Object)(object)self.body))
			{
				ChaosModeController component2 = damage.attacker.GetComponent<ChaosModeController>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.ServerApplyMark(self.body);
				}
			}
			if (NetworkServer.active && damage != null && !damage.rejected && DamageAPI.HasModdedDamageType(ref damage.damageType, DamageTypes.gunHaste) && Object.op_Implicit((Object)(object)damage.attacker))
			{
				Buffs.AddStackRefreshAll(damage.attacker.GetComponent<CharacterBody>(), Buffs.gunHasteBuff, 4f, 20);
			}
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)self) || !self.alive || !Object.op_Implicit((Object)(object)self.body))
			{
				return;
			}
			if (damage != null && !damage.rejected && DamageAPI.HasModdedDamageType(ref damage.damageType, DamageTypes.gunShred))
			{
				Buffs.AddStackRefreshAll(self.body, Buffs.gunShredDebuff, 6f, 10);
			}
			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_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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: 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_0073: Invalid comparison between Unknown and I4
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Invalid comparison between Unknown and I4
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			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.HasBuff(Buffs.uninhibitedBuff) && report.damageInfo.procCoefficient > 0f && (int)report.dotType == -1)
			{
				UninhibitedController uninhibitedController = UninhibitedController.Get(attackerBody);
				if (Object.op_Implicit((Object)(object)uninhibitedController))
				{
					uninhibitedController.ServerRegain(0.5f * Mathf.Min(1f, report.damageInfo.procCoefficient));
				}
			}
			if (Object.op_Implicit((Object)(object)attackerBody) && attackerBody.bodyIndex == shadowBodyIndex && attackerBody.HasBuff(Buffs.chaosModeBuff) && !attackerBody.HasBuff(Buffs.chaosBlastBuff) && !attackerBody.HasBuff(Buffs.uninhibitedBuff) && (int)report.dotType == -1 && report.damageInfo.procChainMask.mask == 0 && report.damageInfo.procCoefficient > 0f)
			{
				DamageSource damageSource = report.damageInfo.damageType.damageSource;
				ChaosModeController component = ((Component)attackerBody).GetComponent<ChaosModeController>();
				BoostLogic component2 = ((Component)attackerBody).GetComponent<BoostLogic>();
				if ((damageSource & 7) != 0 && (damageSource & 8) == 0 && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component2.boostExists)
				{
					float num = Mathf.Min(1f, report.damageInfo.procCoefficient);
					float num2 = component.ServerTakeFightBoost(0.5f * num);
					num2 += component.ServerTakeMarkBoost(report.victimBody, num);
					if (num2 > 0f)
					{
						component2.AddBoost(component2.maxBoostMeter * 0.01f * num2);
					}
				}
			}
			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 damageSource2 = report.damageInfo.damageType.damageSource;
				if ((damageSource2 & 7) != 0 && (damageSource2 & 8) == 0)
				{
					BoostLogic component3 = ((Component)attackerBody).GetComponent<BoostLogic>();
					if (Object.op_Implicit((Object)(object)component3) && component3.boostExists)
					{
						component3.AddBoost(component3.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 component4 = ((Component)victimBody).GetComponent<BoostLogic>();
				float fullCombinedHealth = victimBody.healthComponent.fullCombinedHealth;
				if (Object.op_Implicit((Object)(object)component4) && component4.boostExists && fullCombinedHealth > 0f)
				{
					component4.AddBoost(component4.maxBoostMeter * 0.25f * 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!NetworkServer.active || report == null || !Object.op_Implicit((Object)(object)report.attackerBody))
			{
				return;
			}
			if ((int)shadowBodyIndex == -1)
			{
				shadowBodyIndex = BodyCatalog.FindBodyIndex("ShadowTheHedgehog");
			}
			if (report.attackerBody.HasBuff(Buffs.uninhibitedBuff) && Object.op_Implicit((Object)(object)report.victimBody))
			{
				UninhibitedController uninhibitedController = UninhibitedController.Get(report.attackerBody);
				if (Object.op_Implicit((Object)(object)uninhibitedController))
				{
					float percent = (report.victimBody.isBoss ? 10f : (report.victimBody.isElite ? 5f : 2f));
					uninhibitedController.ServerRegain(percent);
				}
			}
			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.07f);
				}
			}
		}

		private void ShowGunAmmo(orig_LateUpdate orig, SkillIcon self)
		{
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.targetSkill) && Object.op_Implicit((Object)(object)self.cooldownText) && self.targetSkill.skillDef is UninhibitedSkillDef)
			{
				ShowUninhibitedCountdown(self);
			}
			else
			{
				if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)self.targetSkill) || !Object.op_Implicit((Object)(object)self.cooldownText) || !(self.targetSkill.skillDef is LockedAndLoadedSkillDef))
				{
					return;
				}
				ShadowGunController component = ((Component)self.targetSkill).GetComponent<ShadowGunController>();
				ShadowAmmoText shadowAmmoText = ((Component)self.cooldownText).GetComponent<ShadowAmmoText>();
				if (Object.op_Implicit((Object)(object)component) && component.heldGun >= 0 && component.ammo >= 0)
				{
					if (!Object.op_Implicit((Object)(object)shadowAmmoText))
					{
						shadowAmmoText = ((Component)self.cooldownText).gameObject.AddComponent<ShadowAmmoText>();
						shadowAmmoText.originalColor = ((Graphic)self.cooldownText).color;
					}
					shadowAmmoText.active = true;
					((Component)self.cooldownText).gameObject.SetActive(true);
					((Graphic)self.cooldownText).color = ammoColor;
					((TMP_Text)self.cooldownText).SetText(component.ammo.ToString(), true);
					self.previousCoolDownInt = -1;
				}
				else if (Object.op_Implicit((Object)(object)shadowAmmoText) && shadowAmmoText.active)
				{
					shadowAmmoText.active = false;
					((Graphic)self.cooldownText).color = shadowAmmoText.originalColor;
				}
			}
		}

		private void ShowUninhibitedCountdown(SkillIcon self)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			int num = UninhibitedSkillDef.SecondsLeft(self.targetSkill.characterBody);
			ShadowAmmoText shadowAmmoText = ((Component)self.cooldownText).GetComponent<ShadowAmmoText>();
			if (num > 0)
			{
				if (!Object.op_Implicit((Object)(object)shadowAmmoText))
				{
					shadowAmmoText = ((Component)self.cooldownText).gameObject.AddComponent<ShadowAmmoText>();
					shadowAmmoText.originalColor = ((Graphic)self.cooldownText).color;
				}
				shadowAmmoText.active = true;
				((Component)self.cooldownText).gameObject.SetActive(true);
				((Graphic)self.cooldownText).color = uninhibitedCountdownColor;
				((TMP_Text)self.cooldownText).SetText(num.ToString(), true);
				self.previousCoolDownInt = -1;
			}
			else if (Object.op_Implicit((Object)(object)shadowAmmoText) && shadowAmmoText.active)
			{
				shadowAmmoText.active = false;
				((Graphic)self.cooldownText).color = shadowAmmoText.originalColor;
				((Component)self.cooldownText).gameObject.SetActive(false);
			}
		}

		private bool BlockSkillsWhileShooting(orig_ExecuteIfReady orig, GenericSkill self)
		{
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.characterBody))
			{
				ShadowGunController component = ((Component)self.characterBody).GetComponent<ShadowGunController>();
				if (Object.op_Implicit((Object)(object)component) && component.IsShooting && !(self.skillDef is LockedAndLoadedSkillDef))
				{
					return false;
				}
			}
			return orig.Invoke(self);
		}

		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);
			}
			if (!self.HasAchievement("GAVINELSHADOWUNINHIBITEDUNLOCKABLE") && Config.ForceUnlockUninhibited().Value)
			{
				self.AddAchievement("GAVINELSHADOWUNINHIBITEDUNLOCKABLE", true);
			}
			if (!self.HasAchievement("GAVINELSHADOWFALSESONSKINUNLOCKABLE") && Config.ForceUnlockFalseSonSkin().Value)
			{
				self.AddAchievement("GAVINELSHADOWFALSESONSKINUNLOCKABLE", true);
			}
			if (!self.HasAchievement("GAVINELSHADOWSOLUSSKINUNLOCKABLE") && Config.ForceUnlockSolusSkin().Value)
			{
				self.AddAchievement("GAVINELSHADOWSOLUSSKINUNLOCKABLE", 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;

		private bool uninhibited;

		protected virtual bool isSuper => false;

		public override void OnEnter()
		{
			//IL_005c: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			uninhibited = !isSuper && ((EntityState)this).characterBody.HasBuff(Buffs.uninhibitedBuff);
			level = ((isSuper || uninhibited) ? 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 = Mathf.Max(0.1f, Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.attackSpeed : ((BaseState)this).attackSpeedStat);
			float num2 = Mathf.Max(0.15f, StaticValues.chaosSpearChargeTimePerLevelValue / num);
			if (level < 2)
			{
				levelTimer += Time.fixedDeltaTime;
				if (levelTimer >= num2 && ((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,
					homing = uninhibited
				});
			}
		}

		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;

		public bool homing;

		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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c2: 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_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_00df: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			GameObject val = ((isSuper || homing) ? 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 HomingAttack : BaseSkillState
	{
		protected string hitboxName;

		protected DamageType damageType;

		protected float damageCoefficient;

		protected float procCoefficient;

		protected float attackStartTime;

		protected float attackEndTime;

		protected float hitStopDuration;

		protected float attackRecoil;

		protected float hitHopVelocity;

		protected bool cancelled;

		protected float maxHomingAttackRange;

		protected float homingAttackSpeed;

		protected float estimatedHomingAttackTime;

		protected float homingAttackOvershoot;

		protected float homingAttackEndLag;

		protected float homingAttackHitHopVelocity = 12f;

		public HurtBox target;

		private Vector3 targetDirection;

		protected bool homingAttackHit;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string homingAttackSoundString = "Play_sonicthehedgehog_homing_attack";

		protected string muzzleString;

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.meleeHitSoundEvent.index;

		protected GameObject homingAttackEffect;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private bool animationEnded;

		private ICharacterFlightParameterProvider flight;

		private HomingTracker homingTracker;

		private bool effectPlayed;

		protected virtual float launchPushForce => 250f;

		protected virtual float baseHomingAttackEndLag => 0.3f;

		protected virtual bool alwaysTeleport => false;

		public static event Action<HomingAttack, HurtBox> onAuthorityHitEnemy;

		public override void OnEnter()
		{
			//IL_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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();
			flight = ((Component)((EntityState)this).characterBody).GetComponent<ICharacterFlightParameterProvider>();
			homingTracker = ((Component)((EntityState)this).characterBody).GetComponent<HomingTracker>();
			hasFired = false;
			maxHomingAttackRange = homingTracker.MaxRange();
			homingAttackSpeed = homingTracker.Speed();
			homingAttackOvershoot = 1.4f;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.ballBuff);
			}
			damageCoefficient = 6f;
			procCoefficient = 1f;
			attackRecoil = 3f;
			hitStopDuration = 0.1f;
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			targetDirection = Vector3.zero;
			if ((Object)(object)target != (Object)null)
			{
				targetDirection = ((Component)target).transform.position - ((EntityState)this).transform.position;
			}
			Util.PlaySound(homingAttackSoundString, ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				if (targetDirection != Vector3.zero)
				{
					EffectManager.SimpleEffect(Assets.homingAttackLaunchEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
				}
			}
			EndChrysalis();
			bool flag = false;
			if (((EntityState)this).isAuthority && (Object)(object)target != (Object)null && ChaosModeHoming.TryTeleport((EntityState)(object)this, ((EntityState)this).characterBody, ((EntityState)this).characterMotor, target, alwaysTeleport))
			{
				flag = true;
				targetDirection = ((Component)target).transform.position - ((EntityState)this).transform.position;
			}
			estimatedHomingAttackTime = ((Vector3)(ref targetDirection)).magnitude / homingAttackSpeed * homingAttackOvershoot;
			if (flag)
			{
				estimatedHomingAttackTime = Mathf.Max(estimatedHomingAttackTime, 0.15f);
			}
			homingAttackEndLag = baseHomingAttackEndLag / ((BaseState)this).attackSpeedStat;
			hitboxName = "Ball";
			impactSound = Assets.homingHitSoundEvent.index;
			((EntityState)this).PlayAnimation("FullBody, Override", "Ball");
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			PrepareOverlapAttack();
		}

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

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

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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)
			if (!effectPlayed)
			{
				PlayHomingAttackHitEffect();
				effectPlayed = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				if (!Flying())
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, homingAttackHitHopVelocity);
				}
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.ballBuff);
			}
			stopwatch = 0f;
			hasFired = true;
			hasHopped = true;
			if (!inHitPause && hitStopDuration > 0f)
			{
				storedVelocity = ((EntityState)this).characterMotor.velocity;
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate");
				hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
				inHitPause = true;
			}
		}

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

		public override void FixedUpdate()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
				((EntityState)this).characterMotor.velocity = storedVelocity;
				animationEnded = true;
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).PlayAnimation("Body", "Backflip", "Slash.playbackRate", homingAttackEndLag * 2f, 0f);
				if (((EntityState)this).isAuthority)
				{
					ShadowAnimator.PlayRandomTrick(((EntityState)this).characterBody);
				}
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Swing.playbackRate", 0f);
				}
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (hasFired)
			{
				if (stopwatch >= homingAttackEndLag)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else if (((EntityState)this).fixedAge < estimatedHomingAttackTime)
			{
				homingAttackSpeed = homingTracker.Speed();
				if ((Object)(object)target != (Object)null)
				{
					targetDirection = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
				}
				if (homingAttackSpeed * Time.fixedDeltaTime > ((Vector3)(ref targetDirection)).magnitude * 3f)
				{
					homingAttackSpeed = Mathf.Max(((Vector3)(ref targetDirection)).magnitude * 3f, 15f);
				}
				((EntityState)this).characterMotor.velocity = ((Vector3)(ref targetDirection)).normalized * homingAttackSpeed;
				((EntityState)this).characterDirection.forward = ((Vector3)(ref targetDirection)).normalized;
				if (((BaseState)this).isGrounded)
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				}
				if (((EntityState)this).fixedAge > estimatedHomingAttackTime / 2.5f)
				{
					attack.forceVector = ((Vector3)(ref targetDirection)).normalized * launchPushForce;
					FireAttack();
				}
			}
			else
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

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

		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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.damageType.damageSource = (DamageSource)1;
			DamageAPI.AddModdedDamageType(ref attack.damageType, DamageTypes.launchOnKill);
			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.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
			attack.maximumOverlapTargets = 2;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class LockedAndLoaded : BaseSkillState
	{
		private class ArsenalGun
		{
			public float interval;

			public float damage;

			public float proc;

			public int pellets = 1;

			public float spread;

			public bool pierce;

			public bool weakPoints;

			public float kick;
		}

		private const float arsenalBarrageStart = 0.6f;

		private const float arsenalBarrageEnd = 2.4f;

		private const float arsenalGatherTime = 0.35f;

		private const float arsenalFinaleTime = 2.85f;

		private const float arsenalDuration = 3.45f;

		private const float arsenalRange = 70f;

		private const float arsenalMissileDamage = 20f;

		private const float arsenalMissileForce = 5000f;

		private static readonly ArsenalGun[] arsenalGuns = new ArsenalGun[5]
		{
			new ArsenalGun
			{
				interval = 0.14f,
				damage = 1.2f,
				proc = 0.5f,
				spread = 0.4f,
				kick = 0.5f
			},
			new ArsenalGun
			{
				interval = 0.45f,
				damage = 0.35f,
				proc = 0.3f,
				pellets = 8,
				spread = 5f,
				kick = 1f
			},
			new ArsenalGun
			{
				interval = 0.07f,
				damage = 0.4f,
				proc = 0.25f,
				spread = 1.2f,
				kick = 0.25f
			},
			null,
			new ArsenalGun
			{
				interval = 0.45f,
				damage = 2.5f,
				proc = 1f,
				pierce = true,
				weakPoints = true,
				kick = 1f
			}
		};

		private bool arsenal;

		private ChaosArsenalVisual arsenalVisual;

		private readonly float[] arsenalTimers = new float[5];

		private readonly HurtBox[] arsenalTargets = (HurtBox[])(object)new HurtBox[5];

		private float arsenalRetargetTimer;

		private bool arsenalGathered;

		private bool arsenalFired;

		public const string stateMachineName = "ShadowGun";

		private ShadowGunController controller;

		private GunDef gun;

		private int gunIndex = -1;

		private int ammo;

		private float fireTimer;

		private float idleTimer;

		private bool super;

		private bool discarded;

		private int hits;

		private GameObject weakPointViewer;

		private void ArsenalEnter()
		{
			//IL_009d: 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)
			if (Object.op_Implicit((Object)(object)controller))
			{
				controller.heldGun = -1;
				controller.ammo = -1;
				controller.lastShotTime = Time.time;
			}
			for (int i = 0; i < arsenalTimers.Length; i++)
			{
				arsenalTimers[i] = (float)i * 0.03f;
			}
			Util.PlaySound("Play_shadow_gun_equip", ((EntityState)this).gameObject);
			arsenalVisual = ChaosArsenalVisual.Create(((EntityState)this).characterBody, ((EntityState)this).GetModelTransform());
			ArsenalAim(out var point, out var direction);
			if (Object.op_Implicit((Object)(object)arsenalVisual))
			{
				arsenalVisual.SetAim(point, direction);
			}
		}