Decompiled source of SonicTheHedgehog v2.0.0

SonicTheHedgehog.dll

Decompiled 3 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterUI;
using EmotesAPI;
using EntityStates;
using EntityStates.Commando;
using HG;
using HG.BlendableTypes;
using KinematicCharacterController;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using SonicTheHedgehog.Components;
using SonicTheHedgehog.Modules;
using SonicTheHedgehog.Modules.Achievements;
using SonicTheHedgehog.Modules.Characters;
using SonicTheHedgehog.Modules.Forms;
using SonicTheHedgehog.Modules.Survivors;
using SonicTheHedgehog.SkillStates;
using SonicTheHedgehog.SkillStates.BaseStates;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SonicTheHedgehog")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SonicTheHedgehog")]
[assembly: AssemblyTitle("SonicTheHedgehog")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace SonicTheHedgehog
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.ds_gaming.SonicTheHedgehog", "SonicTheHedgehog", "2.0.0")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "UnlockableAPI" })]
	public class SonicTheHedgehogPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Init <>9__11_0;

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

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

		public const string MODNAME = "SonicTheHedgehog";

		public const string MODVERSION = "2.0.0";

		public const string DEVELOPER_PREFIX = "DS_GAMING";

		public static SonicTheHedgehogPlugin instance;

		public static bool emoteAPILoaded;

		public static bool betterUILoaded;

		public static bool riskOfOptionsLoaded;

		public static bool ancientScepterLoaded;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			emoteAPILoaded = Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI");
			Log.Message("Emote API exists? " + emoteAPILoaded);
			betterUILoaded = Chainloader.PluginInfos.ContainsKey("com.xoxfaby.BetterUI");
			Log.Message("Better UI exists? " + betterUILoaded);
			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);
			Assets.Initialize();
			Config.ReadConfig();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			Items.RegisterItems();
			Forms.Initialize();
			SuperSonicHandler.Initialize();
			ChaosEmeraldInteractable.Initialize();
			ItemDisplays.PopulateDisplays();
			NetworkingAPI.RegisterMessageType<SonicParryHit>();
			NetworkingAPI.RegisterMessageType<ScepterBoostDamage>();
			NetworkingAPI.RegisterMessageType<SuperSonicTransform>();
			new SonicTheHedgehogCharacter().Initialize();
			new ContentPacks().Initialize();
			if (betterUILoaded)
			{
				BetterUISetup();
			}
			if (riskOfOptionsLoaded)
			{
				RiskOfOptionsSetup();
			}
			Hook();
		}

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

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

		private static void BetterUISetup()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0044: 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_004c: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			ProcCoefficientInfo val = default(ProcCoefficientInfo);
			val.name = "Melee / Homing Attack";
			val.procCoefficient = 1f;
			ProcCoefficientInfo val2 = val;
			val = default(ProcCoefficientInfo);
			val.name = "Projectile";
			val.procCoefficient = 0f;
			ProcCoefficientInfo item = val;
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_PRIMARY_MELEE_NAME", val2);
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SUPER_PRIMARY_MELEE_NAME", new List<ProcCoefficientInfo> { val2, item });
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SECONDARY_SONIC_BOOM_NAME", new ProcCoefficientInfo
			{
				name = "Sonic Boom",
				procCoefficient = 0.5f
			});
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SUPER_SECONDARY_SONIC_BOOM_NAME", new ProcCoefficientInfo
			{
				name = "Sonic Boom",
				procCoefficient = 0.5f
			});
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SUPER_SECONDARY_IDW_ATTACK_NAME", new ProcCoefficientInfo
			{
				name = "Attack",
				procCoefficient = 0.7f
			});
			val = default(ProcCoefficientInfo);
			val.name = "Repeated Attack";
			val.procCoefficient = 0.5f;
			ProcCoefficientInfo item2 = val;
			val = default(ProcCoefficientInfo);
			val.name = "Final Attack";
			val.procCoefficient = 1.5f;
			ProcCoefficientInfo item3 = val;
			val = default(ProcCoefficientInfo);
			val.name = "Afterimages";
			val.procCoefficient = 0.3f;
			ProcCoefficientInfo item4 = val;
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SPECIAL_GRAND_SLAM_NAME", new List<ProcCoefficientInfo> { item2, item3 });
			ProcCoefficientCatalog.AddSkill("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SUPER_SPECIAL_GRAND_SLAM_NAME", new List<ProcCoefficientInfo> { item2, item3, item4 });
			Buffs.RegisterBuffInfo(Buffs.boostBuff, "Sonic Boost", $"+{50f} Armor. If health is above 90%, +{65f}% movement speed. Otherwise, +{35f}% movement speed");
			Buffs.RegisterBuffInfo(Buffs.ballBuff, "Sonic Ball", $"+{100f} Armor.");
			Buffs.RegisterBuffInfo(Buffs.superSonicBuff, "Super Sonic", $"Upgrades all of your skills. +{100f}% Damage. +{30.000002f}% Attack speed. +{100f}% Base movement speed. Complete invincibility and flight.");
			Buffs.RegisterBuffInfo(Buffs.parryBuff, "Sonic Parry", $"+{40f}% Attack speed. +{30.000002f}% Movement speed.");
			Buffs.RegisterBuffInfo(Buffs.superParryDebuff, "Super Sonic Parry Debuff", $"-{5000f} Armor. -{50f}% Attack speed. -{50f}% Movement speed.");
		}

		private static void RiskOfOptionsSetup()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			Sprite modIcon = Assets.mainAssetBundle.LoadAsset<Sprite>("texSonicIcon");
			ModSettingsManager.SetModIcon(modIcon);
			float min = -500f;
			float max = 500f;
			ModSettingsManager.AddOption((BaseOption)new SliderOption(Config.BoostMeterLocationX(), new SliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(Config.BoostMeterLocationY(), new SliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.KeyPressHomingAttack()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockParry()));
			Config.ForceUnlockParry().SettingChanged += SonicTheHedgehogCharacter.UnlockParryConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config.ForceUnlockMastery()));
			Config.ForceUnlockMastery().SettingChanged += SonicTheHedgehogCharacter.UnlockMasteryConfig;
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(Config.SuperTransformKey()));
		}

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

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

		private bool CanApplyAmmoPackToBoost(orig_CanApplyAmmoPack orig, GenericSkill self)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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)
			SerializableEntityStateType activationState = self.activationState;
			if (!(((SerializableEntityStateType)(ref activationState)).stateType == typeof(Boost)))
			{
				activationState = self.activationState;
				if (!(((SerializableEntityStateType)(ref activationState)).stateType == typeof(ScepterBoost)))
				{
					goto IL_006f;
				}
			}
			BoostLogic component = ((Component)self.characterBody).GetComponent<BoostLogic>();
			if (Object.op_Implicit((Object)(object)component))
			{
				return component.boostMeter < component.maxBoostMeter;
			}
			goto IL_006f;
			IL_006f:
			return orig.Invoke(self);
		}

		private void ApplyAmmoPackToBoost(orig_ApplyAmmoPack orig, GenericSkill self)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			SerializableEntityStateType activationState = self.activationState;
			if (!(((SerializableEntityStateType)(ref activationState)).stateType == typeof(Boost)))
			{
				activationState = self.activationState;
				if (!(((SerializableEntityStateType)(ref activationState)).stateType == typeof(ScepterBoost)))
				{
					return;
				}
			}
			BoostLogic component = ((Component)self.characterBody).GetComponent<BoostLogic>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.AddBoost(25f);
			}
		}

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

		private void TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damage)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)self).gameObject, "Body");
			if (Object.op_Implicit((Object)(object)val))
			{
				EntityState state = val.state;
				NetworkIdentity component = ((Component)self).gameObject.GetComponent<NetworkIdentity>();
				if (((object)state).GetType() == typeof(Parry) && Object.op_Implicit((Object)(object)component))
				{
					((Parry)(object)state).OnTakeDamage(damage);
					NetMessageExtensions.Send((INetMessage)(object)new SonicParryHit(component.netId, damage), (NetworkDestination)1);
				}
			}
			if (self.body.HasBuff(Buffs.superSonicBuff))
			{
				damage.rejected = true;
				EffectManager.SpawnEffect(AssetReferences.damageRejectedPrefab, new EffectData
				{
					origin = damage.position
				}, true);
			}
			orig.Invoke(self, damage);
		}

		private static string SuperNamePrefix(orig_GetBestBodyName orig, GameObject bodyObject)
		{
			if (Object.op_Implicit((Object)(object)bodyObject))
			{
				CharacterBody component = bodyObject.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.HasBuff(Buffs.superSonicBuff))
				{
					string text = orig.Invoke(bodyObject);
					return Language.GetStringFormatted("DS_GAMING_SONIC_THE_HEDGEHOG_BODY_SUPER_PREFIX", new object[1] { text });
				}
			}
			return orig.Invoke(bodyObject);
		}

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

		private void SceneDirectorOnStart(orig_Start orig, SceneDirector self)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Invalid comparison between Unknown and I4
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			orig.Invoke(self);
			if (!NetworkServer.active)
			{
				return;
			}
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (!Object.op_Implicit((Object)(object)SuperSonicHandler.instance))
			{
				NetworkServer.Spawn(Object.Instantiate<GameObject>(SuperSonicHandler.handlerPrefab));
			}
			bool flag = false;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (BodyCatalog.FindBodyIndex(instance.master.bodyPrefab) == BodyCatalog.FindBodyIndex("SonicTheHedgehog"))
				{
					flag = true;
				}
			}
			Debug.Log((object)("Anyone playing Sonic? " + flag));
			if (!flag)
			{
				SuperSonicHandler.instance.SetEvents(active: false);
				return;
			}
			bool flag2 = RunArtifactManager.instance.IsArtifactEnabled(Artifacts.randomSurvivorOnRespawnArtifactDef);
			Debug.Log((object)("Metamorphosis? " + flag2));
			if (flag2)
			{
				SuperSonicHandler.instance.SetEvents(active: false);
				return;
			}
			SuperSonicHandler.instance.SetEvents(active: true);
			SuperSonicHandler.instance.ResetAvailable();
			SuperSonicHandler.instance.FilterOwnedEmeralds();
			if (SuperSonicHandler.available.Count > 0 && Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && (int)sceneDefForCurrentScene.sceneType == 1 && !sceneDefForCurrentScene.cachedName.Contains("moon") && !sceneDefForCurrentScene.cachedName.Contains("voidraid") && !sceneDefForCurrentScene.cachedName.Contains("voidstage"))
			{
				int num = ((Run.instance is InfiniteTowerRun) ? 5 : 3);
				SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
				val.nodeGraphType = (GraphType)0;
				val.sendOverNetwork = true;
				val.prefab = ChaosEmeraldInteractable.prefabBase;
				for (int i = 0; i < num && i < SuperSonicHandler.available.Count; i++)
				{
					DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, ChaosEmeraldInteractable.placementRule, Run.instance.stageRng));
				}
			}
		}
	}
}
namespace SonicTheHedgehog.SkillStates
{
	public class InteractablePurchased : EntityState
	{
		public const float dropTime = 0.5f;

		public ChaosEmeraldInteractable interactable;

		private bool soundPlayed = false;

		private bool dropped = false;

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

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

		public static float extendedDuration = 0.6f;

		public static float initialSpeedCoefficient = 1.3f;

		public static float finalSpeedCoefficient = 1f;

		public static float boostMeterDrain = 0.88f;

		public static float airBoostY = 8f;

		public static float screenShake = 3.5f;

		private string jumpSoundString = "Play_jump";

		public static string boostSoundString = "Play_boost";

		public static string boostChangeSoundString = "Play_boost_change";

		public static float dodgeFOV = DodgeState.dodgeFOV;

		private Vector3 forwardDirection;

		public BoostLogic boostLogic;

		private TemporaryOverlay temporaryOverlay;

		private GameObject trailObject;

		private float boostEffectCooldown;

		private ICharacterFlightParameterProvider flight;

		private static float boostCameraDistance = -13f;

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

		private CameraParamsOverrideHandle camOverrideHandle;

		public bool powerBoosting = false;

		public bool boosting = false;

		private bool checkBoostEffects = false;

		private bool boostChangedEffect = false;

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

		public override void FixedUpdate()
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterMain)this).FixedUpdate();
			boostEffectCooldown -= Time.fixedDeltaTime;
			UpdateBoosting();
			UpdatePowerBoosting();
			if (checkBoostEffects)
			{
				checkBoostEffects = false;
				PlayBoostEffects();
			}
			if (Moving())
			{
				if (!((BaseState)this).HasBuff(Buffs.superSonicBuff))
				{
					if (NetworkServer.active)
					{
						boostLogic.RemoveBoost(boostMeterDrain);
					}
					boostLogic.boostDraining = true;
				}
				else
				{
					boostLogic.boostDraining = false;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
				{
					((EntityState)this).characterBody.isSprinting = true;
					((EntityState)this).characterDirection.moveVector = forwardDirection;
				}
			}
			else
			{
				boostLogic.boostDraining = false;
				if (((BaseState)this).isGrounded)
				{
					((EntityState)this).characterBody.isSprinting = false;
				}
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.fovOverride = Mathf.Lerp(dodgeFOV, 60f, ((EntityState)this).fixedAge / duration);
			}
			UpdateDirection();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge < extendedDuration && !((BaseState)this).isGrounded)
			{
				((EntityState)this).characterMotor.velocity.x = forwardDirection.x * ((EntityState)this).characterBody.moveSpeed;
				((EntityState)this).characterMotor.velocity.z = forwardDirection.z * ((EntityState)this).characterBody.moveSpeed;
				if (Flying())
				{
					((EntityState)this).characterMotor.velocity.y = forwardDirection.y * ((EntityState)this).characterBody.moveSpeed;
				}
				else
				{
					((EntityState)this).characterMotor.velocity.y = Mathf.Max(airBoostY, ((EntityState)this).characterMotor.velocity.y);
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > duration && !((EntityState)this).inputBank.skill3.down)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (((EntityState)this).isAuthority && (boostLogic.boostMeter <= 0f || !boostLogic.boostAvailable))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void UpdatePowerBoosting()
		{
			if (!powerBoosting && ((EntityState)this).characterBody.healthComponent.health / ((EntityState)this).characterBody.healthComponent.fullHealth >= 0.9f && Moving())
			{
				((EntityState)this).characterBody.MarkAllStatsDirty();
				powerBoosting = true;
				OnPowerBoostChanged();
			}
			else if (powerBoosting && (((EntityState)this).characterBody.healthComponent.health / ((EntityState)this).characterBody.healthComponent.fullHealth < 0.9f || !Moving()))
			{
				((EntityState)this).characterBody.MarkAllStatsDirty();
				powerBoosting = false;
				OnPowerBoostChanged();
			}
		}

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

		private void OnPowerBoostChanged()
		{
			boostLogic.powerBoosting = powerBoosting;
			if (powerBoosting)
			{
				if (boostEffectCooldown <= 0f && ((EntityState)this).isAuthority)
				{
					checkBoostEffects = true;
				}
				else if (Object.op_Implicit((Object)(object)temporaryOverlay))
				{
					temporaryOverlay.AddToCharacerModel(((Component)((EntityState)this).GetModelTransform()).GetComponent<CharacterModel>());
				}
			}
			else if (boostEffectCooldown <= 0f && boosting && ((EntityState)this).isAuthority)
			{
				checkBoostEffects = true;
			}
			else
			{
				checkBoostEffects = true;
			}
		}

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

		private void PlayBoostEffects()
		{
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (boosting && boostEffectCooldown <= 0f)
			{
				if (boostChangedEffect)
				{
					camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
					{
						cameraParamsData = boostingCameraParams,
						priority = 0f
					}, 0.1f);
					ScepterReset();
				}
				boostEffectCooldown = 0.6f;
				bool flag = ((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff);
				if (powerBoosting || flag)
				{
					Util.PlaySound(boostChangedEffect ? GetSoundString() : boostChangeSoundString, ((EntityState)this).gameObject);
					if (((EntityState)this).isAuthority)
					{
						((BaseState)this).AddRecoil(-1f * screenShake, 1f * screenShake, -0.5f * screenShake, 0.5f * screenShake);
						EffectManager.SimpleMuzzleFlash(GetEffectPrefab(power: true), ((EntityState)this).gameObject, "BallHitbox", true);
					}
					if (Object.op_Implicit((Object)(object)temporaryOverlay))
					{
						EntityState.Destroy((Object)(object)temporaryOverlay);
					}
					Transform modelTransform = ((EntityState)this).GetModelTransform();
					if (Object.op_Implicit((Object)(object)modelTransform))
					{
						temporaryOverlay = ((Component)modelTransform).gameObject.AddComponent<TemporaryOverlay>();
						temporaryOverlay.animateShaderAlpha = true;
						temporaryOverlay.duration = 0.2f;
						temporaryOverlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 3f, 0.25f);
						temporaryOverlay.destroyComponentOnEnd = false;
						temporaryOverlay.originalMaterial = (flag ? LegacyResourcesAPI.Load<Material>("Materials/matStrongerBurn") : LegacyResourcesAPI.Load<Material>("Materials/matOnHelfire"));
						((Behaviour)temporaryOverlay).enabled = true;
						temporaryOverlay.AddToCharacerModel(((Component)modelTransform).GetComponent<CharacterModel>());
					}
				}
				else
				{
					Util.PlaySound(boostChangedEffect ? GetSoundString() : boostChangeSoundString, ((EntityState)this).gameObject);
					if (((EntityState)this).isAuthority)
					{
						((BaseState)this).AddRecoil(-0.5f * screenShake, 0.5f * screenShake, -0.25f * screenShake, 0.25f * screenShake);
						EffectManager.SimpleMuzzleFlash(GetEffectPrefab(power: false), ((EntityState)this).gameObject, "BallHitbox", true);
					}
					if (Object.op_Implicit((Object)(object)temporaryOverlay))
					{
						temporaryOverlay.RemoveFromCharacterModel();
					}
				}
			}
			else
			{
				((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, duration * 2f);
				if (Object.op_Implicit((Object)(object)temporaryOverlay) && !powerBoosting)
				{
					temporaryOverlay.RemoveFromCharacterModel();
				}
			}
			boostChangedEffect = false;
		}

		private void UpdateDirection()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				forwardDirection = ((((EntityState)this).inputBank.moveVector != Vector3.zero) ? ((EntityState)this).inputBank.moveVector : ((EntityState)this).characterDirection.forward);
			}
		}

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

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

		public override void OnExit()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).GetModelAnimator().SetBool("isBoosting", false);
			boostLogic.boostDraining = false;
			boostLogic.powerBoosting = false;
			boosting = false;
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, duration * 1.5f);
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.boostBuff);
			}
			if (Object.op_Implicit((Object)(object)temporaryOverlay))
			{
				EntityState.Destroy((Object)(object)temporaryOverlay);
			}
			((GenericCharacterMain)this).OnExit();
		}

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

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

		public virtual void ScepterDamage()
		{
		}

		public virtual void ScepterReset()
		{
		}

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

		public virtual GameObject GetEffectPrefab(bool power)
		{
			if (power)
			{
				return ((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff) ? Assets.superBoostFlashEffect : Assets.powerBoostFlashEffect;
			}
			return Assets.boostFlashEffect;
		}

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

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

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

		private const float destroyTime = 1.6f;

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

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

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

		protected DamageType damageType = (DamageType)33;

		protected float damageCoefficient = 1.4f;

		protected float procCoefficient = 0.5f;

		protected float pushForce = 0f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float baseAttackStartTime = 0.5f;

		protected float attackStartTime;

		protected float attackRecoil = 3f;

		protected float hitHopVelocity = 6f;

		protected bool cancelled = false;

		protected float noTargetDistancePercentage = 0.7f;

		protected float maxDashRange;

		protected float dashSpeed;

		protected float estimatedDashTime;

		protected float dashOvershoot;

		protected HurtBox target = null;

		private Vector3 targetDirection;

		protected string chargeSoundString = "Play_spindash_charge";

		protected string launchSoundString = "Play_spindash_release";

		protected string hitSoundString = "Play_homing_impact";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.homingHitSoundEvent.index;

		private float earlyExitTime;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private bool hasHit = false;

		private HomingTracker homingTracker;

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

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

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

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

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

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

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

		public void PrepareOverlapAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			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 = damageType;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class GrandSlamFinal : BaseSkillState
	{
		protected string hitboxName = "Stomp";

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient = 22f;

		protected float procCoefficient = 1.5f;

		protected float basePushForce = 3000f;

		protected float superPushForce = 11000f;

		protected Vector3 bonusForce = Vector3.down;

		protected float attackRecoil = 11f;

		protected float startUpTime = 0.5f;

		private float baseMaxAttackTime = 1f;

		protected float maxAttackTime = 0.75f;

		protected float hitStopDuration = 0.2f;

		protected float endTime = 0.5f;

		protected float baseSpeedMultiplier = 200f;

		public HurtBox target;

		protected Vector3 targetDirection;

		protected string swingSoundString = "";

		protected string hitSoundString = "Play_strong_impact";

		protected string muzzleString = "SwingBottom";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.grandSlamHitSoundEvent.index;

		private float earlyExitTime;

		public float duration;

		private bool hasFired;

		private bool hasHit;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private float speedMultiplier;

		private bool animationEnded = false;

		private bool effectFired = false;

		private bool projectileFired = false;

		private Vector3 superProjectilePosition;

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

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

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

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

		public override void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: 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_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
				((EntityState)this).characterMotor.velocity = storedVelocity;
				animationEnded = true;
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).PlayAnimation("Body", "Backflip");
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Swing.playbackRate", 0f);
				}
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (!hasHit)
			{
				if (((EntityState)this).fixedAge <= startUpTime)
				{
					((EntityState)this).characterMotor.velocity = (((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff) ? (Vector3.up * Mathf.Lerp(110f, 10f, ((EntityState)this).fixedAge / startUpTime)) : (Vector3.up * Mathf.Lerp(60f, 3f, ((EntityState)this).fixedAge / startUpTime)));
				}
				else
				{
					if (!(((EntityState)this).fixedAge <= startUpTime + maxAttackTime))
					{
						((EntityState)this).characterMotor.velocity = Vector3.zero;
						((EntityState)this).outer.SetNextStateToMain();
						return;
					}
					if (!hasFired)
					{
						hasFired = true;
						EndChrysalis();
					}
					if ((Object)(object)target != (Object)null)
					{
						Vector3 val = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
						targetDirection = ((Vector3)(ref val)).normalized;
						val = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
						speedMultiplier = Mathf.Clamp(((Vector3)(ref val)).magnitude * 10f, 25f, baseSpeedMultiplier);
					}
					else
					{
						speedMultiplier = baseSpeedMultiplier;
						targetDirection = Vector3.down;
					}
					if (Vector3.Dot(targetDirection, Vector3.down) < 0.3f)
					{
						targetDirection = Vector3.down;
					}
					((EntityState)this).characterMotor.velocity = targetDirection * speedMultiplier;
					FireAttack();
				}
				if (((EntityState)this).characterMotor.isGrounded && startUpTime < ((EntityState)this).fixedAge)
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else if (stopwatch >= endTime)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void PrepareOverlapAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			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 = damageType;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = (((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff) ? superPushForce : basePushForce);
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

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

		public virtual GameObject GetProjectilePrefab(string skinName)
		{
			if (!(skinName == "DS_GAMING_SONIC_THE_HEDGEHOG_BODY_DEFAULT_SKIN_NAME"))
			{
				if (skinName == "DS_GAMING_SONIC_THE_HEDGEHOG_BODY_MASTERY_SKIN_NAME")
				{
					return Projectiles.superMetalAfterimageRainPrefab;
				}
				return Projectiles.superSonicAfterimageRainPrefab;
			}
			return Projectiles.superSonicAfterimageRainPrefab;
		}

		public virtual void FireProjectile()
		{
			//IL_003a: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				projectileFired = true;
				if (((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff))
				{
					superProjectilePosition = ((Component)((EntityState)this).characterMotor).transform.position + new Vector3(0f, 2.5f, 0f);
					GameObject projectilePrefab = GetProjectilePrefab(((Component)((EntityState)this).modelLocator.modelTransform).gameObject.GetComponentInChildren<ModelSkinController>().skins[((EntityState)this).characterBody.skinIndex].nameToken);
					ProjectileManager.instance.FireProjectile(projectilePrefab, superProjectilePosition, Util.QuaternionSafeLookRotation(Vector3.down), ((Component)((EntityState)this).characterBody).gameObject, 6f * ((BaseState)this).damageStat, 0f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f);
				}
			}
		}

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

		protected DamageType damageType = (DamageType)33;

		protected float damageCoefficient = 1.4f;

		protected float procCoefficient = 0.5f;

		protected float pushForce = 0f;

		protected Vector3 bonusForce = Vector3.up * 5f;

		protected int baseAttackCount = 4;

		protected int maxAttackCount;

		protected int attackCount;

		protected float attackRecoil = 3f;

		protected float attackDuration = 0.75f;

		public HurtBox target;

		protected string swingSoundString = "";

		protected string hitSoundString = "Play_melee_hit";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.meleeHitSoundEvent.index;

		private float earlyExitTime;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private bool effectFired;

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

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

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

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

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

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

		public void PrepareOverlapAttack()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			effectFired = false;
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = damageType;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)4;
		}
	}
	public class HomingAttack : BaseSkillState
	{
		protected string hitboxName;

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient;

		protected float procCoefficient;

		protected float pushForce = 50f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float attackStartTime;

		protected float attackEndTime;

		protected float hitStopDuration;

		protected float attackRecoil;

		protected float hitHopVelocity;

		protected bool cancelled = false;

		protected float maxHomingAttackRange;

		protected float homingAttackSpeed;

		protected float estimatedHomingAttackTime;

		protected float homingAttackOvershoot;

		protected float baseHomingAttackEndLag = 0.3f;

		protected float superHomingAttackEndLag = 0.1f;

		protected float homingAttackEndLag;

		protected float homingAttackHitHopVelocity = 12f;

		public HurtBox target;

		private Vector3 targetDirection;

		protected bool homingAttackHit;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string homingAttackSoundString = "Play_homing_attack";

		protected string muzzleString;

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab = Assets.meleeImpactEffect;

		protected NetworkSoundEventIndex impactSound = Assets.meleeHitSoundEvent.index;

		protected GameObject homingAttackEffect;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		private bool animationEnded = false;

		private ICharacterFlightParameterProvider flight;

		private HomingTracker homingTracker;

		private bool effectPlayed = false;

		public static event Action<HomingAttack, HurtBox> onAuthorityHitEnemy;

		public override void OnEnter()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			((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();
				if (targetDirection != Vector3.zero)
				{
					EffectManager.SimpleEffect(Assets.homingAttackLaunchEffect, ((EntityState)this).gameObject.transform.position, Util.QuaternionSafeLookRotation(targetDirection), true);
				}
			}
			EndChrysalis();
			estimatedHomingAttackTime = ((Vector3)(ref targetDirection)).magnitude / homingAttackSpeed * homingAttackOvershoot;
			homingAttackEndLag = (((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff) ? superHomingAttackEndLag : baseHomingAttackEndLag) / ((BaseState)this).attackSpeedStat;
			hitboxName = "Ball";
			impactSound = Assets.homingHitSoundEvent.index;
			((EntityState)this).PlayAnimation("FullBody, Override", "Ball");
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			PrepareOverlapAttack();
		}

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

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

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

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

		public override void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: 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_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_0225: 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_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: 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);
			}
			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 = ((EntityState)this).characterBody.moveSpeed * ((EntityState)this).characterBody.sprintingSpeedMultiplier * 5f;
				if ((Object)(object)target != (Object)null)
				{
					targetDirection = ((Component)target).transform.position - ((Component)((EntityState)this).characterMotor).transform.position;
				}
				if (homingAttackSpeed * Time.fixedDeltaTime > ((Vector3)(ref targetDirection)).magnitude * 3f)
				{
					homingAttackSpeed = Mathf.Max(((Vector3)(ref targetDirection)).magnitude * 3f, 15f);
				}
				((EntityState)this).characterMotor.velocity = ((Vector3)(ref targetDirection)).normalized * homingAttackSpeed;
				((EntityState)this).characterDirection.forward = ((Vector3)(ref targetDirection)).normalized;
				if (((EntityState)this).isAuthority && ((BaseState)this).isGrounded)
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground();
				}
				if (((EntityState)this).fixedAge > estimatedHomingAttackTime / 2.5f)
				{
					FireAttack();
				}
			}
			else
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

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

		public void PrepareOverlapAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			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 = damageType;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class IDWAttack : BaseSkillState
	{
		protected static DamageType damageType = (DamageType)131104;

		protected static float damageCoefficient = 8f;

		protected static float procCoefficient = 0.7f;

		protected static float baseAttackDuration = 1.6f;

		protected static float increasePerAdditionalStock = 0.2f;

		protected static float range = 25f;

		protected static int baseAttackCount = 8;

		protected static float pushForce = 400f;

		protected static float baseEndLag = 1.6f;

		protected float endLag;

		public HurtBox target = null;

		protected Vector3 targetPosition = Vector3.zero;

		public float attackDuration;

		public float duration;

		private bool hasFired;

		protected bool inHitPause;

		protected float stopwatch;

		protected Animator animator;

		private int maxAttackCount;

		private int attackCount;

		private bool invisible;

		private Transform modelTransform;

		private CharacterModel characterModel;

		private GameObject idwAttackEffect;

		private HitPoint[] hit;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
			}
			hasFired = false;
			endLag = baseEndLag;
			if (((EntityState)this).isAuthority)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground();
			}
			attackDuration = baseAttackDuration * (1f + increasePerAdditionalStock * (float)(((EntityState)this).skillLocator.secondary.maxStock - 1));
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			Util.PlaySound("Play_idw", ((EntityState)this).gameObject);
			idwAttackEffect = Object.Instantiate<GameObject>(Assets.idwAttackEffect);
			EffectManager.SimpleMuzzleFlash(Assets.superSonicBlurEffect, ((EntityState)this).gameObject, "BlurForward", true);
			hasFired = true;
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				obj.invisibilityCount++;
			}
			invisible = true;
			maxAttackCount = (int)Math.Ceiling(((EntityState)this).characterBody.attackSpeed * (float)baseAttackCount * (1f + increasePerAdditionalStock * (float)(((EntityState)this).skillLocator.secondary.maxStock - 1)));
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.Intangible);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			if (invisible)
			{
				if (Object.op_Implicit((Object)(object)characterModel))
				{
					CharacterModel obj = characterModel;
					obj.invisibilityCount--;
				}
				if (NetworkServer.active)
				{
					((EntityState)this).characterBody.RemoveBuff(Buffs.Intangible);
				}
			}
			if (Object.op_Implicit((Object)(object)idwAttackEffect))
			{
				Object.Destroy((Object)(object)idwAttackEffect);
			}
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		public override void FixedUpdate()
		{
			//IL_00b5: 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_00a3: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (!((EntityState)this).characterBody.HasBuff(Buffs.superSonicBuff))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (((EntityState)this).fixedAge <= attackDuration && ((EntityState)this).fixedAge > attackDuration / (float)maxAttackCount * (float)(attackCount + 1))
			{
				if ((Object)(object)target != (Object)null)
				{
					targetPosition = ((Component)target).transform.position;
				}
				idwAttackEffect.transform.position = targetPosition;
				Util.PlaySound("Play_idw_hit", ((EntityState)this).gameObject);
				FireBlastAttack();
			}
			else if (((EntityState)this).fixedAge > attackDuration && invisible)
			{
				EffectManager.SimpleMuzzleFlash(Assets.superSonicBlurEffect, ((EntityState)this).gameObject, "BlurSide", true);
				idwAttackEffect.GetComponentInChildren<ParticleSystem>().Stop();
				if (Object.op_Implicit((Object)(object)characterModel))
				{
					CharacterModel obj = characterModel;
					obj.invisibilityCount--;
				}
				invisible = false;
				if (NetworkServer.active)
				{
					((EntityState)this).characterBody.RemoveBuff(Buffs.Intangible);
				}
				Util.PlaySound("Play_idw_end", ((EntityState)this).gameObject);
				endLag = baseEndLag / ((EntityState)this).characterBody.attackSpeed;
				((EntityState)this).PlayAnimation("FullBody, Override", "IDWEnd", "Slash.playbackRate", endLag);
				((EntityState)this).characterDirection.forward = ((EntityState)this).characterDirection.forward * -1f;
				((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.moveVector * -1f;
			}
			else if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > attackDuration + endLag)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void FireBlastAttack()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_008b: 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_0096: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			attackCount++;
			if (((EntityState)this).isAuthority)
			{
				BlastAttack val = new BlastAttack();
				val.radius = range;
				val.procCoefficient = procCoefficient;
				val.position = targetPosition;
				val.attacker = ((EntityState)this).gameObject;
				val.crit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master);
				val.base