Decompiled source of Warlock v1.0.8

plugins/WarlockMod.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.ImpBossMonster;
using EntityStates.ImpMonster;
using EntityStates.Treebot.Weapon;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using ShaderSwapper;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using WarlockMod.Modules;
using WarlockMod.Modules.Achievements;
using WarlockMod.Modules.BaseStates;
using WarlockMod.Modules.Characters;
using WarlockMod.Warlock;
using WarlockMod.Warlock.Achievements;
using WarlockMod.Warlock.Compatibility;
using WarlockMod.Warlock.Components;
using WarlockMod.Warlock.Content;
using WarlockMod.Warlock.SkillStates;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WarlockMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+563f72f5e0c9949d2144c11ff6edda2aea74cb60")]
[assembly: AssemblyProduct("WarlockMod")]
[assembly: AssemblyTitle("WarlockMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
internal enum InterrogatorCameraParams
{
	DEFAULT,
	AIM_PISTOL,
	AIM_SNIPER,
	EMOTE
}
namespace WarlockMod
{
	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 ErrorAssetBundle(string assetName, string bundleName)
		{
			Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
		}

		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);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.kenko.Warlock", "Warlock", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WarlockPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.kenko.Warlock";

		public const string MODNAME = "Warlock";

		public const string MODVERSION = "1.0.0";

		public const string DEVELOPER_PREFIX = "KENKO";

		public static WarlockPlugin instance;

		private ContentPacks contentPacks;

		public static bool emotesInstalled => Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI");

		public static bool riskOfOptionsInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public static bool scepterInstalled => Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");

		private void Awake()
		{
			instance = this;
			NetworkingAPI.RegisterMessageType<SyncBloodExplosion>();
			NetworkingAPI.RegisterMessageType<SyncOrbWarlock>();
			NetworkingAPI.RegisterMessageType<SyncCrimsonManaRefill>();
			Log.Init(((BaseUnityPlugin)this).Logger);
			SoundBanks.Init();
			WarlockConfig.Init();
			Language.Init();
			WarlockAssets.Init(Assets.LoadAssetBundle("warlock"));
			((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(WarlockAssets.mainAssetBundle));
			new WarlockSurvivor().Initialize();
			contentPacks = new ContentPacks();
			contentPacks.Initialize();
		}

		private void OnDestroy()
		{
			CharacterBase<WarlockSurvivor>.instance?.RemoveHooks();
			contentPacks?.Shutdown();
			DamageTypes.Unhook();
			if (emotesInstalled)
			{
				EmotesCompat.Shutdown();
			}
		}
	}
}
namespace WarlockMod.Warlock
{
	public class WarlockSurvivor : SurvivorBase<WarlockSurvivor>
	{
		public const string WARLOCK_PREFIX = "KENKO_WARLOCK_";

		internal static GameObject characterPrefab;

		public static SkillDef ritualScepterSkillDef;

		public static WarlockSkillDef m1EmpowerSkillDef;

		public static WarlockSkillDef m2EmpowerSkillDef;

		public static WarlockSkillDef utilityEmpowerSkillDef;

		public static SkillDef empowerSkillDef;

		public override string assetBundleName => "warlock";

		public override string bodyName => "WarlockBody";

		public override string masterName => "WarlockMonsterMaster";

		public override string modelPrefabName => "mdlWarlock";

		public override string displayPrefabName => "WarlockDisplay";

		public override string survivorTokenPrefix => "KENKO_WARLOCK_";

		public override BodyInfo bodyInfo
		{
			get
			{
				//IL_003f: 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_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				BodyInfo bodyInfo = new BodyInfo();
				bodyInfo.bodyName = bodyName;
				bodyInfo.bodyNameToken = "KENKO_WARLOCK_NAME";
				bodyInfo.subtitleNameToken = "KENKO_WARLOCK_SUBTITLE";
				bodyInfo.characterPortrait = assetBundle.LoadAsset<Texture>("texWarlockIcon");
				bodyInfo.bodyColor = WarlockAssets.warlockColor;
				bodyInfo.sortPosition = 99f;
				bodyInfo.crosshair = Assets.LoadCrosshair("Standard");
				bodyInfo.podPrefab = null;
				bodyInfo.initialStateType = new SerializableEntityStateType(typeof(WarlockSpawnState));
				bodyInfo.maxHealth = 100f;
				bodyInfo.armor = 0f;
				bodyInfo.damage = 12f;
				bodyInfo.jumpCount = 1;
				return bodyInfo;
			}
		}

		public override CustomRendererInfo[] customRendererInfos => new CustomRendererInfo[5]
		{
			new CustomRendererInfo
			{
				childName = "Model"
			},
			new CustomRendererInfo
			{
				childName = "BookModel"
			},
			new CustomRendererInfo
			{
				childName = "DaggerModel"
			},
			new CustomRendererInfo
			{
				childName = "CloakModel"
			},
			new CustomRendererInfo
			{
				childName = "RopeModel"
			}
		};

		public override UnlockableDef characterUnlockableDef => WarlockUnlockables.characterUnlockableDef;

		public override ItemDisplaysBase itemDisplays => new WarlockItemDisplays();

		public override AssetBundle assetBundle { get; protected set; }

		public override GameObject bodyPrefab { get; protected set; }

		public override CharacterBody prefabCharacterBody { get; protected set; }

		public override GameObject characterModelObject { get; protected set; }

		public override CharacterModel prefabCharacterModel { get; protected set; }

		public override GameObject displayPrefab { get; protected set; }

		public override void Initialize()
		{
			base.Initialize();
		}

		public override void InitializeCharacter()
		{
			//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)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			WarlockUnlockables.Init();
			base.InitializeCharacter();
			RendererInfo[] baseRendererInfos = prefabCharacterModel.baseRendererInfos;
			foreach (RendererInfo val in baseRendererInfos)
			{
				val.defaultMaterial.SetCull().SetSpecular(0.2857f, 20f);
			}
			if (WarlockPlugin.riskOfOptionsInstalled)
			{
				Config.InitializeOptions(prefabCharacterBody.portraitIcon);
			}
			CameraParams.InitializeParams();
			ChildLocator componentInChildren = bodyPrefab.GetComponentInChildren<ChildLocator>();
			DamageTypes.Init();
			WarlockStates.Init();
			WarlockTokens.Init();
			WarlockAssets.InitAssets();
			WarlockBuffs.Init(assetBundle);
			InitializeEntityStateMachines();
			InitializeSkills();
			InitializeSkins();
			InitializeCharacterMaster();
			AdditionalBodySetup();
			characterPrefab = bodyPrefab;
			AddHooks();
		}

		private void AdditionalBodySetup()
		{
			AddHitboxes();
			bodyPrefab.AddComponent<WarlockController>();
			bodyPrefab.AddComponent<WarlockTracker>();
			bodyPrefab.AddComponent<WarlockBookController>();
			bodyPrefab.AddComponent<WarlockEyeController>();
		}

		public void AddHitboxes()
		{
			Prefabs.SetupHitBoxGroup(characterModelObject, "MeleeHitbox", "MeleeHitbox");
		}

		public override void InitializeEntityStateMachines()
		{
			Prefabs.ClearEntityStateMachines(bodyPrefab);
			Prefabs.AddMainEntityStateMachine(bodyPrefab, "Body", typeof(MainState), typeof(SpawnTeleporterState));
			Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon");
			Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon2");
			Prefabs.AddEntityStateMachine(bodyPrefab, "MetaMenu");
		}

		public override void InitializeSkills()
		{
			bodyPrefab.AddComponent<WarlockPassive>();
			Skills.CreateSkillFamilies(bodyPrefab);
			AddPassiveSkills();
			AddPrimarySkills();
			AddSecondarySkills();
			AddUtilitySkills();
			AddSpecialSkills();
		}

		private Sprite LoadSkillIcon(string name)
		{
			return assetBundle.LoadAsset<Sprite>(name) ?? throw new InvalidOperationException("Missing " + name + " sprite. Rebuild the Unity asset bundle, then rebuild and deploy WarlockMod.dll.");
		}

		private void AddPassiveSkills()
		{
			//IL_0075: 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_00ba: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			WarlockPassive component = bodyPrefab.GetComponent<WarlockPassive>();
			SkillLocator component2 = bodyPrefab.GetComponent<SkillLocator>();
			component2.passiveSkill.enabled = false;
			component.interrogatorPassive = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "KENKO_WARLOCK_PASSIVE_NAME",
				skillNameToken = "KENKO_WARLOCK_PASSIVE_NAME",
				skillDescriptionToken = "KENKO_WARLOCK_PASSIVE_DESCRIPTION",
				skillIcon = LoadSkillIcon("texWarlockPassive"),
				keywordTokens = new string[0],
				activationState = new SerializableEntityStateType(typeof(Idle)),
				activationStateMachineName = "",
				baseMaxStock = 1,
				baseRechargeInterval = 0f,
				beginSkillCooldownOnSkillEnd = false,
				canceledFromSprinting = false,
				forceSprintDuringState = false,
				fullRestockOnAssign = true,
				interruptPriority = (InterruptPriority)0,
				resetCooldownTimerOnUse = false,
				isCombatSkill = false,
				mustKeyPress = false,
				cancelSprintingOnActivation = false,
				rechargeStock = 1,
				requiredStock = 2,
				stockToConsume = 1
			});
			Skills.AddPassiveSkills(component.passiveSkillSlot.skillFamily, component.interrogatorPassive);
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Empower1";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_PRIMARY_EMPOWER1_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_PRIMARY_EMPOWER1_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockPrimaryEmpowered");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(Empower1));
			skillDefInfo.activationStateMachineName = "MetaMenu";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)2;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 0;
			m1EmpowerSkillDef = Skills.CreateSkillDef<WarlockSkillDef>(skillDefInfo);
			skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Empower2";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_SECONDARY_EMPOWER_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_SECONDARY_EMPOWER_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockSecondaryEmpowered");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(Empower2));
			skillDefInfo.activationStateMachineName = "MetaMenu";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)2;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 0;
			m2EmpowerSkillDef = Skills.CreateSkillDef<WarlockSkillDef>(skillDefInfo);
			skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Empower3";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_UTILITY_EMPOWER_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_UTILITY_EMPOWER_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockUtilityEmpowered");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(Empower3));
			skillDefInfo.activationStateMachineName = "MetaMenu";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)2;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 0;
			utilityEmpowerSkillDef = Skills.CreateSkillDef<WarlockSkillDef>(skillDefInfo);
			skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Empower";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_SPECIAL_EMPOWER_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_SPECIAL_EMPOWER_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockSpecial");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(Empower));
			skillDefInfo.activationStateMachineName = "MetaMenu";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)1;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 0;
			empowerSkillDef = Skills.CreateSkillDef(skillDefInfo);
		}

		private void AddPrimarySkills()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Crimson Surge";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_PRIMARY_SURGE_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_PRIMARY_SURGE_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockPrimary");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(CrimsonSurgePrep));
			skillDefInfo.activationStateMachineName = "Weapon";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)1;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = true;
			skillDefInfo.mustKeyPress = false;
			skillDefInfo.cancelSprintingOnActivation = true;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 0;
			SkillDef val = Skills.CreateSkillDef(skillDefInfo);
			Skills.AddPrimarySkills(bodyPrefab, val);
		}

		private void AddSecondarySkills()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Hex";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_SECONDARY_HEX_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_SECONDARY_HEX_DESCRIPTION";
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockSecondary");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(Hex));
			skillDefInfo.activationStateMachineName = "Weapon2";
			skillDefInfo.baseMaxStock = 2;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)1;
			skillDefInfo.isCombatSkill = true;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 0;
			skillDefInfo.requiredStock = 0;
			skillDefInfo.stockToConsume = 1;
			skillDefInfo.keywordTokens = new string[1] { Tokens.agileKeyword };
			SkillDef val = (SkillDef)(object)Skills.CreateSkillDef<WarlockTrackerSkillDef>(skillDefInfo);
			Skills.AddSecondarySkills(bodyPrefab, val);
		}

		private void AddUtilitySkills()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Blood Dash";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_UTILITY_BLOOD_DASH_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_UTILITY_BLOOD_DASH_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockUtility");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(BloodDash));
			skillDefInfo.activationStateMachineName = "Weapon2";
			skillDefInfo.baseMaxStock = 2;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)2;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 0;
			skillDefInfo.requiredStock = 0;
			skillDefInfo.stockToConsume = 1;
			SkillDef val = (SkillDef)(object)Skills.CreateSkillDef<BloodDashSkillDef>(skillDefInfo);
			Skills.AddUtilitySkills(bodyPrefab, val);
		}

		private void AddSpecialSkills()
		{
			//IL_0058: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Ritual";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_SPECIAL_RITUAL_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_SPECIAL_RITUAL_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[1] { Tokens.metaMagicKeyword };
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockSpecial");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(RitualPrep));
			skillDefInfo.activationStateMachineName = "MetaMenu";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = true;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)1;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 1;
			WarlockSkillDef warlockSkillDef = Skills.CreateSkillDef<WarlockSkillDef>(skillDefInfo);
			Skills.AddSpecialSkills(bodyPrefab, warlockSkillDef);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void InitializeScepter()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "Ritual Scepter";
			skillDefInfo.skillNameToken = "KENKO_WARLOCK_SPECIAL_SCEPTER_RITUAL_NAME";
			skillDefInfo.skillDescriptionToken = "KENKO_WARLOCK_SPECIAL_SCEPTER_RITUAL_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[0];
			skillDefInfo.skillIcon = LoadSkillIcon("texWarlockSpecial");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(RitualPrep));
			skillDefInfo.activationStateMachineName = "MetaMenu";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 5f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = true;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)1;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = true;
			skillDefInfo.mustKeyPress = true;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 1;
			ritualScepterSkillDef = Skills.CreateSkillDef(skillDefInfo);
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill(ritualScepterSkillDef, bodyName, (SkillSlot)3, 0);
		}

		public override void InitializeSkins()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			ModelSkinController val = ((Component)prefabCharacterModel).gameObject.AddComponent<ModelSkinController>();
			ChildLocator component = ((Component)prefabCharacterModel).GetComponent<ChildLocator>();
			RendererInfo[] baseRendererInfos = prefabCharacterModel.baseRendererInfos;
			List<SkinDef> list = new List<SkinDef>();
			SkinDef val2 = Skins.CreateSkinDef("DEFAULT_SKIN", Skins.CreateSkinIcon(WarlockAssets.warlockColor, new Color(11f / 51f, 0.19215687f, 0.22745098f), new Color(0.3372549f, 19f / 51f, 24f / 85f), new Color(0.08627451f, 0.08627451f, 0.101960786f)), baseRendererInfos, ((Component)prefabCharacterModel).gameObject);
			list.Add(val2);
			val.skins = list.ToArray();
			CharacterModel component2 = displayPrefab.GetComponent<CharacterModel>();
			ModelSkinController val3 = displayPrefab.AddComponent<ModelSkinController>();
			val3.skins = (SkinDef[])(object)new SkinDef[1] { Skins.CreateSkinDef("DEFAULT_SKIN", val2.icon, component2.baseRendererInfos, displayPrefab) };
		}

		public override void InitializeCharacterMaster()
		{
			WarlockAI.Init(bodyPrefab, masterName);
		}

		private void AddHooks()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			WarlockUnlockAchievement.InstallDamageTracking();
			LoadoutPanelController.Rebuild += new hook_Rebuild(LoadoutPanelController_Rebuild);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			if (WarlockPlugin.emotesInstalled)
			{
				SurvivorCatalog.Init += new hook_Init(SurvivorCatalog_Init);
			}
		}

		private static void SurvivorCatalog_Init(orig_Init orig)
		{
			orig.Invoke();
			if (WarlockPlugin.emotesInstalled)
			{
				EmotesCompat.Initialize();
			}
		}

		internal void RemoveHooks()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			WarlockUnlockAchievement.UninstallDamageTracking();
			LoadoutPanelController.Rebuild -= new hook_Rebuild(LoadoutPanelController_Rebuild);
			GlobalEventManager.onCharacterDeathGlobal -= GlobalEventManager_onCharacterDeathGlobal;
			GlobalEventManager.onServerDamageDealt -= GlobalEventManager_onServerDamageDealt;
			CharacterBody.RecalculateStats -= new hook_RecalculateStats(CharacterBody_RecalculateStats);
			SurvivorCatalog.Init -= new hook_Init(SurvivorCatalog_Init);
			ContentManager.onContentPacksAssigned -= base.SetItemDisplays;
		}

		private static void LoadoutPanelController_Rebuild(orig_Rebuild orig, LoadoutPanelController self)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self.currentDisplayData.bodyIndex != BodyCatalog.FindBodyIndex("WarlockBody"))
			{
				return;
			}
			LanguageTextMeshController[] componentsInChildren = ((Component)self).gameObject.GetComponentsInChildren<LanguageTextMeshController>();
			foreach (LanguageTextMeshController val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val) && val.token == "LOADOUT_SKILL_MISC")
				{
					val.token = "Passive";
				}
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self) && (self.HasBuff(WarlockBuffs.warlockHexxedDebuff) || self.HasBuff(WarlockBuffs.warlockHexxedEmpoweredDebuff)))
			{
				self.moveSpeed *= 0.85f;
			}
		}

		private static void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport)
		{
			AddCrimsonManaProgress(damageReport);
		}

		private static void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Invalid comparison between Unknown and I4
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)damageReport.victim) && damageReport.victim.alive && (damageReport.victimIsBoss || damageReport.victimIsChampion) && !damageReport.isFriendlyFire)
			{
				DamageInfo damageInfo = damageReport.damageInfo;
				if (!damageInfo.rejected && !(damageReport.damageDealt <= 0f) && (int)damageInfo.dotIndex == -1 && !damageInfo.delayedDamageSecondHalf && (damageInfo.damageType.damageSource & 0xF) != 0 && !((Object)(object)damageInfo.inflictor != (Object)(object)damageInfo.attacker) && !DamageAPI.HasModdedDamageType(damageInfo, DamageTypes.HexMask))
				{
					AddCrimsonManaProgress(damageReport);
				}
			}
		}

		private static void AddCrimsonManaProgress(DamageReport damageReport)
		{
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.victim))
			{
				return;
			}
			CharacterBody attackerBody = damageReport.attackerBody;
			if (!Object.op_Implicit((Object)(object)((Component)attackerBody).GetComponent<WarlockController>()))
			{
				return;
			}
			int num = attackerBody.GetBuffCount(WarlockBuffs.warlockCrimsonManaStack) + 1;
			if (num >= WarlockConfig.KillsPerCrimsonMana)
			{
				HurtBox val = Util.FindBodyMainHurtBox(attackerBody);
				OrbManager val2 = OrbManager.instance;
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
				{
					attackerBody.SetBuffCount(WarlockBuffs.warlockCrimsonManaStack.buffIndex, num);
					Log.Warning("Cannot launch a Crimson Mana orb without a target hurtbox and OrbManager; progress retained.");
					return;
				}
				attackerBody.SetBuffCount(WarlockBuffs.warlockCrimsonManaStack.buffIndex, num - WarlockConfig.KillsPerCrimsonMana);
				val2.AddOrb((Orb)(object)new ConsumeOrb
				{
					origin = ((Component)damageReport.victim).transform.position,
					target = val
				});
				NetworkIdentity val3 = default(NetworkIdentity);
				if (((Component)damageReport.victim).gameObject.TryGetComponent<NetworkIdentity>(ref val3))
				{
					NetMessageExtensions.Send((INetMessage)(object)new SyncBloodExplosion(val3.netId, ((Component)damageReport.victim).transform.position, !damageReport.victim.alive), (NetworkDestination)1);
				}
			}
			else
			{
				attackerBody.SetBuffCount(WarlockBuffs.warlockCrimsonManaStack.buffIndex, num);
			}
		}
	}
}
namespace WarlockMod.Warlock.SkillStates
{
	public abstract class BaseMetamagicCharge : BaseWarlockSkillState
	{
		protected int consumedStacks;

		protected bool hadMetaMagic;

		private int remainingStacks;

		private float interval;

		private float nextConsumption;

		private bool continuing;

		private bool transferringEffect;

		private bool releasedDuringWindup;

		private GameObject chargeEffect;

		protected bool IsContinuingCharge => transferringEffect;

		protected abstract bool IsHeld { get; }

		protected abstract GameObject ChargeEffectPrefab { get; }

		protected virtual float ChargeSpeed => ((BaseState)this).attackSpeedStat;

		protected virtual float InitialChargeDuration => interval;

		protected virtual bool WaitForInitialCharge => false;

		protected virtual bool FinishOnRelease => false;

		protected virtual bool CanCharge => Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive;

		protected virtual void BeginCharge()
		{
		}

		protected virtual void ApplyConsumedStack()
		{
		}

		protected abstract BaseMetamagicCharge NextStep();

		protected abstract EntityState FinishCharge();

		public override void OnEnter()
		{
			//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)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			if (!continuing)
			{
				if (NetworkServer.active || ((EntityState)this).isAuthority)
				{
					consumedStacks = 0;
					remainingStacks = ((EntityState)this).characterBody.GetBuffCount(WarlockBuffs.warlockMetaMagicBuff);
					hadMetaMagic = remainingStacks > 0;
					interval = Mathf.Max(0.05f, 0.5f / Mathf.Max(0.01f, ChargeSpeed));
					nextConsumption = InitialChargeDuration;
				}
				BeginCharge();
			}
			if (CanCharge && !Object.op_Implicit((Object)(object)chargeEffect))
			{
				GameObject chargeEffectPrefab = ChargeEffectPrefab;
				Transform muzzle = ((BaseState)this).FindModelChild("Muzzle");
				Ray aimRay = ((BaseState)this).GetAimRay();
				chargeEffect = WarlockAssets.CreateChargeEffect(chargeEffectPrefab, muzzle, ((Ray)(ref aimRay)).direction);
			}
			if (!continuing || (!NetworkServer.active && !((EntityState)this).isAuthority) || !CanCharge)
			{
				return;
			}
			if (NetworkServer.active ? warlockController.TryConsumeMetaMagic() : (remainingStacks > 0))
			{
				consumedStacks++;
				remainingStacks--;
				if (NetworkServer.active)
				{
					ApplyConsumedStack();
				}
			}
			if (NetworkServer.active)
			{
				remainingStacks = ((EntityState)this).characterBody.GetBuffCount(WarlockBuffs.warlockMetaMagicBuff);
			}
		}

		public override void Update()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (Object.op_Implicit((Object)(object)chargeEffect))
			{
				Transform transform = chargeEffect.transform;
				Ray aimRay = ((BaseState)this).GetAimRay();
				transform.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (!CanCharge)
			{
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			bool flag = !IsHeld;
			if (WaitForInitialCharge && !continuing)
			{
				releasedDuringWindup |= flag;
				if (((EntityState)this).fixedAge < nextConsumption)
				{
					return;
				}
				flag = releasedDuringWindup;
			}
			if ((FinishOnRelease && flag) || (hadMetaMagic && (flag || remainingStacks <= 0)) || (!hadMetaMagic && ((EntityState)this).fixedAge >= nextConsumption))
			{
				((EntityState)this).outer.SetNextState(FinishCharge());
			}
			else if (hadMetaMagic && ((EntityState)this).fixedAge >= nextConsumption)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)NextStep());
			}
		}

		public override void ModifyNextState(EntityState nextState)
		{
			((EntityState)this).ModifyNextState(nextState);
			if (nextState is BaseMetamagicCharge baseMetamagicCharge && ((object)baseMetamagicCharge).GetType() == ((object)this).GetType())
			{
				transferringEffect = true;
				baseMetamagicCharge.continuing = true;
				baseMetamagicCharge.chargeEffect = chargeEffect;
				((BaseSkillState)baseMetamagicCharge).activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
				if (NetworkServer.active || ((EntityState)this).isAuthority)
				{
					baseMetamagicCharge.consumedStacks = consumedStacks;
					baseMetamagicCharge.remainingStacks = remainingStacks;
					baseMetamagicCharge.hadMetaMagic = hadMetaMagic;
					baseMetamagicCharge.interval = Mathf.Max(0.05f, interval * 0.5f);
					baseMetamagicCharge.nextConsumption = Mathf.Max(0f, baseMetamagicCharge.interval - Mathf.Max(0f, ((EntityState)this).fixedAge - nextConsumption));
				}
			}
		}

		public override void OnExit()
		{
			if (!transferringEffect)
			{
				WarlockAssets.StopChargeEffect(chargeEffect);
			}
			((EntityState)this).OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(continuing);
			writer.Write(consumedStacks);
			writer.Write(remainingStacks);
			writer.Write(hadMetaMagic);
			writer.Write(interval);
			writer.Write(nextConsumption);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			continuing = reader.ReadBoolean();
			consumedStacks = reader.ReadInt32();
			remainingStacks = reader.ReadInt32();
			hadMetaMagic = reader.ReadBoolean();
			interval = reader.ReadSingle();
			nextConsumption = reader.ReadSingle();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class BloodDash : BaseWarlockSkillState
	{
		private bool crimsonManaEmpowered;

		public bool targeted;

		public Vector3 destination;

		public int metamagicStacks;

		private Vector3 blinkStart;

		private bool hasBlinkMotion;

		private bool arrived;

		private bool motorWasEnabled;

		private int originalLayer;

		private GameObject destinationEffect;

		private Transform modelTransform;

		private float stopwatch;

		private Vector3 blinkVector = Vector3.zero;

		public Material destealthMaterial = WarlockAssets.destealthMaterial;

		public static float blastAttackRadius = 15f;

		public static float blastAttackForce = 1f;

		[SerializeField]
		public float duration = 0.15f;

		[SerializeField]
		public float speedCoefficient = 10f;

		[SerializeField]
		private CharacterModel characterModel;

		private HurtBoxGroup hurtboxGroup;

		public static float blastAttackDamageCoefficient => WarlockConfig.BloodDashDamage;

		public static float blastAttackProcCoefficient => WarlockConfig.BloodDashProc;

		public override void OnEnter()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0038: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			RefreshState();
			base.OnEnter();
			if (!hasBlinkMotion)
			{
				blinkStart = ((EntityState)this).transform.position;
				Vector3 normalized;
				if (!targeted)
				{
					normalized = GetBlinkVector();
				}
				else
				{
					Vector3 val = destination - blinkStart;
					normalized = ((Vector3)(ref val)).normalized;
				}
				blinkVector = normalized;
				hasBlinkMotion = true;
			}
			crimsonManaEmpowered = warlockController.TryConsumeEmpowerment(WarlockBuffs.warlockEmpoweredUtilityBuff);
			Util.PlaySound(targeted ? "Play_imp_overlord_teleport_start" : BlinkState.beginSoundString, ((EntityState)this).gameObject);
			if (crimsonManaEmpowered)
			{
				FireAOEStun(blinkStart);
			}
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
				hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>();
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount + 1;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup val2 = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = val2.hurtBoxesDeactivatorCounter + 1;
				val2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
			}
			if (targeted && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				duration = 0.1f;
				motorWasEnabled = ((Behaviour)((EntityState)this).characterMotor).enabled;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
				originalLayer = ((EntityState)this).gameObject.layer;
				((EntityState)this).gameObject.layer = LayerIndex.GetAppropriateFakeLayerForTeam(((EntityState)this).teamComponent.teamIndex).intVal;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
				destinationEffect = Object.Instantiate<GameObject>(WarlockAssets.dashBlinkDestinationEffect, destination, Quaternion.identity);
				destinationEffect.GetComponent<ScaleParticleSystemDuration>().newDuration = duration;
			}
			CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject));
		}

		protected virtual Vector3 GetBlinkVector()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
			return ((Vector3)(ref val)).normalized;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(targeted);
			writer.Write(destination);
			writer.Write(metamagicStacks);
			writer.Write(blinkStart);
			writer.Write(blinkVector);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//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)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((BaseSkillState)this).OnDeserialize(reader);
			targeted = reader.ReadBoolean();
			destination = reader.ReadVector3();
			metamagicStacks = Mathf.Max(0, reader.ReadInt32());
			blinkStart = reader.ReadVector3();
			blinkVector = reader.ReadVector3();
			hasBlinkMotion = true;
		}

		private void CreateBlinkEffect(Vector3 origin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			EffectData val = new EffectData();
			val.rotation = Util.QuaternionSafeLookRotation(blinkVector);
			val.origin = origin;
			EffectManager.SpawnEffect(targeted ? WarlockAssets.dashBlinkEffect : BlinkState.blinkPrefab, val, false);
		}

		private void FireAOEStun(Vector3 position)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004c: 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_0079: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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)
			if (NetworkServer.active)
			{
				DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)32);
				damageType.damageSource = (DamageSource)4;
				BlastAttack val = new BlastAttack
				{
					radius = blastAttackRadius,
					procCoefficient = blastAttackProcCoefficient,
					position = position,
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					crit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master),
					baseDamage = ((EntityState)this).characterBody.damage * (blastAttackDamageCoefficient + (float)(targeted ? metamagicStacks : 0)),
					falloffModel = (FalloffModel)0,
					damageType = damageType,
					baseForce = blastAttackForce
				};
				val.teamIndex = TeamComponent.GetObjectTeam(val.attacker);
				val.attackerFiltering = (AttackerFiltering)2;
				val.Fire();
			}
			if (NetworkServer.active && !targeted && Object.op_Implicit((Object)(object)GroundPound.slamEffectPrefab))
			{
				EffectData val2 = new EffectData();
				val2.rotation = Util.QuaternionSafeLookRotation(blinkVector);
				val2.origin = Util.GetCorePosition(((EntityState)this).gameObject);
				EffectManager.SpawnEffect(GroundPound.slamEffectPrefab, val2, true);
			}
		}

		private void CompleteTargetedBlink()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			if (!arrived)
			{
				arrived = true;
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
					((EntityState)this).characterMotor.rootMotion = Vector3.zero;
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPosition(destination, true);
				}
				if (((EntityState)this).isAuthority)
				{
					TeleportHelper.TeleportGameObject(((EntityState)this).gameObject, destination);
				}
				if (Object.op_Implicit((Object)(object)destinationEffect))
				{
					EntityState.Destroy((Object)(object)destinationEffect);
				}
				destinationEffect = null;
				Util.PlaySound("Play_imp_overlord_teleport_end", ((EntityState)this).gameObject);
				CreateBlinkEffect(destination);
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive)
				{
					FireAOEStun(destination);
				}
			}
		}

		public override void FixedUpdate()
		{
			//IL_003e: 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_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_0064: 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_007c: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (targeted)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
					((EntityState)this).characterMotor.rootMotion = Vector3.zero;
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPosition(Vector3.Lerp(blinkStart, destination, stopwatch / duration), true);
				}
				if (stopwatch >= duration && !arrived)
				{
					CompleteTargetedBlink();
				}
				if (arrived && ((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
					CharacterMotor characterMotor = ((EntityState)this).characterMotor;
					characterMotor.rootMotion += blinkVector * (((BaseState)this).moveSpeedStat * speedCoefficient * Time.fixedDeltaTime);
				}
				if (stopwatch >= duration && ((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void OnExit()
		{
			//IL_006b: 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)
			if (targeted && !arrived && !((EntityState)this).outer.destroying && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive)
			{
				CompleteTargetedBlink();
			}
			if (!targeted && crimsonManaEmpowered)
			{
				FireAOEStun(((EntityState)this).transform.position);
			}
			if (!((EntityState)this).outer.destroying)
			{
				if (!targeted)
				{
					Util.PlaySound(BlinkState.endSoundString, ((EntityState)this).gameObject);
					CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject));
				}
				modelTransform = ((EntityState)this).GetModelTransform();
				if (Object.op_Implicit((Object)(object)modelTransform) && Object.op_Implicit((Object)(object)destealthMaterial))
				{
					TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((Component)modelTransform).gameObject);
					val.duration = 1f;
					val.destroyComponentOnEnd = true;
					val.originalMaterial = destealthMaterial;
					val.inspectorCharacterModel = ((Component)modelTransform).gameObject.GetComponent<CharacterModel>();
					val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
					val.animateShaderAlpha = true;
				}
			}
			if (Object.op_Implicit((Object)(object)destinationEffect))
			{
				EntityState.Destroy((Object)(object)destinationEffect);
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount - 1;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup val2 = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = val2.hurtBoxesDeactivatorCounter - 1;
				val2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
				if (targeted)
				{
					((EntityState)this).gameObject.layer = originalLayer;
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
					((Behaviour)((EntityState)this).characterMotor).enabled = motorWasEnabled;
				}
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)(targeted ? 2 : ((int)((EntityState)this).GetMinimumInterruptPriority()));
		}
	}
	public class BloodDashPrep : BaseMetamagicCharge
	{
		private static readonly int ChargeBlink = Animator.StringToHash("ChargeBlink");

		private static readonly int ChargeBlinkLoop = Animator.StringToHash("ChargeBlinkLoop");

		private Vector3 destination;

		private bool hasDestination;

		private bool transferring;

		private bool refunding;

		private float chargeAge;

		private Vector3 frozenPosition;

		private bool movementLocked;

		private bool motorWasEnabled;

		private Vector3 initialCameraPosition;

		private GameObject preview;

		private CameraParamsOverrideHandle cameraOverride;

		internal float MaxDistance => 25f + 5f * (float)consumedStacks;

		protected override bool IsHeld => Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.skill3.down;

		protected override bool CanCharge => base.CanCharge && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor);

		protected override GameObject ChargeEffectPrefab => WarlockAssets.hexChargeEffect;

		protected override void BeginCharge()
		{
			((BaseState)this).StartAimMode(0.5f, false);
		}

		public override void OnEnter()
		{
			//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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			UpdateAnimation();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !movementLocked)
			{
				movementLocked = true;
				frozenPosition = ((EntityState)this).transform.position;
				motorWasEnabled = ((Behaviour)((EntityState)this).characterMotor).enabled;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
				HoldPosition();
				if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
				{
					initialCameraPosition = ((EntityState)this).cameraTargetParams.currentCameraParamsData.idealLocalCameraPos.value;
				}
			}
			if (((EntityState)this).isAuthority)
			{
				if (!Object.op_Implicit((Object)(object)preview))
				{
					preview = Object.Instantiate<GameObject>(WarlockAssets.dashDestinationPreview);
					preview.transform.localScale = Vector3.one * BloodDash.blastAttackRadius;
					preview.SetActive(false);
				}
				UpdateDestination();
			}
		}

		public override void Update()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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)
			base.Update();
			UpdateAnimation();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			chargeAge += Time.deltaTime;
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				CharacterCameraParamsData cameraParamsData = new CharacterCameraParamsData
				{
					idealLocalCameraPos = BlendableVector3.op_Implicit(initialCameraPosition + new Vector3(0f, chargeAge, -4f * chargeAge))
				};
				if (((CameraParamsOverrideHandle)(ref cameraOverride)).isValid)
				{
					cameraOverride.target.cameraParamsData = cameraParamsData;
					return;
				}
				cameraOverride = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
				{
					cameraParamsData = cameraParamsData,
					priority = 0.1f
				}, 0f);
			}
		}

		private void UpdateAnimation()
		{
			if (Object.op_Implicit((Object)(object)modelAnimator) && ((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				modelAnimator.SetBool("chargingBlink", true);
				int animationStateHash = GetAnimationStateHash("FullBody, Override");
				if (animationStateHash != ChargeBlink && animationStateHash != ChargeBlinkLoop)
				{
					((EntityState)this).PlayCrossfade("FullBody, Override", "ChargeBlink", 0.05f);
				}
			}
		}

		public override void FixedUpdate()
		{
			HoldPosition();
			if (((EntityState)this).isAuthority)
			{
				UpdateDestination();
			}
			base.FixedUpdate();
		}

		private void HoldPosition()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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)
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && movementLocked)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).characterMotor.rootMotion = Vector3.zero;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPosition(frozenPosition, true);
			}
		}

		private void UpdateDestination()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0055: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				return;
			}
			float num = default(float);
			Ray val = CameraRigController.ModifyAimRayIfApplicable(((BaseState)this).GetAimRay(), ((EntityState)this).gameObject, ref num);
			float num2 = MaxDistance + num;
			RaycastHit val2 = default(RaycastHit);
			Vector3 targetPosition = (Physics.Raycast(val, ref val2, num2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val2)).point : ((Ray)(ref val)).GetPoint(num2));
			if (TryGetSafePosition(targetPosition, out var position))
			{
				destination = position;
				hasDestination = true;
			}
			if (Object.op_Implicit((Object)(object)preview))
			{
				preview.SetActive(hasDestination);
				if (hasDestination)
				{
					preview.transform.position = destination;
				}
			}
		}

		private bool TryGetSafePosition(Vector3 targetPosition, out Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			Vector3 lossyScale = ((EntityState)this).transform.lossyScale;
			float num = ((EntityState)this).characterMotor.capsuleRadius * Mathf.Max(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.z));
			float num2 = Mathf.Max(num * 2f, ((EntityState)this).characterMotor.capsuleHeight * Mathf.Abs(lossyScale.y));
			Vector3 val = ((EntityState)this).transform.TransformPoint(Vector3.up * ((EntityState)this).characterMotor.capsuleYOffset);
			Vector3 val2 = Vector3.up * (num2 * 0.5f - num);
			Vector3 val3 = val - val2;
			Vector3 val4 = val + val2;
			Vector3 val5 = Vector3.ClampMagnitude(targetPosition - ((EntityState)this).transform.position, MaxDistance);
			float num3 = Mathf.Max(0.01f, num - 0.02f);
			RaycastHit val6 = default(RaycastHit);
			if (((Vector3)(ref val5)).sqrMagnitude > 0f && Physics.CapsuleCast(val3, val4, num3, ((Vector3)(ref val5)).normalized, ref val6, ((Vector3)(ref val5)).magnitude, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				val5 = ((Vector3)(ref val5)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val6)).distance - 0.05f);
			}
			position = ((EntityState)this).transform.position + val5;
			return !Physics.CheckCapsule(val3 + val5, val4 + val5, num3, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
		}

		protected override BaseMetamagicCharge NextStep()
		{
			return new BloodDashPrep();
		}

		protected override EntityState FinishCharge()
		{
			//IL_0052: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			if (consumedStacks == 0)
			{
				BloodDash bloodDash = new BloodDash();
				((BaseSkillState)bloodDash).activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
				return (EntityState)(object)bloodDash;
			}
			if (!hasDestination)
			{
				Log.Warning("Blood Dash found no unobstructed destination; refunding its charge and metamagic.");
				return (EntityState)new Idle();
			}
			BloodDash obj = new BloodDash
			{
				targeted = true,
				destination = destination,
				metamagicStacks = consumedStacks
			};
			((BaseSkillState)obj).activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
			return (EntityState)(object)obj;
		}

		public override void ModifyNextState(EntityState nextState)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			base.ModifyNextState(nextState);
			if (nextState is BloodDashPrep bloodDashPrep)
			{
				transferring = true;
				bloodDashPrep.destination = destination;
				bloodDashPrep.hasDestination = hasDestination;
				bloodDashPrep.chargeAge = chargeAge;
				bloodDashPrep.frozenPosition = frozenPosition;
				bloodDashPrep.movementLocked = movementLocked;
				bloodDashPrep.motorWasEnabled = motorWasEnabled;
				bloodDashPrep.initialCameraPosition = initialCameraPosition;
				bloodDashPrep.preview = preview;
				bloodDashPrep.cameraOverride = cameraOverride;
			}
			if (nextState is BloodDash bloodDash && (NetworkServer.active || ((EntityState)this).isAuthority))
			{
				bloodDash.metamagicStacks = consumedStacks;
			}
			refunding = nextState is Idle;
		}

		public override void OnExit()
		{
			//IL_00a4: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			if (!transferring)
			{
				if (Object.op_Implicit((Object)(object)modelAnimator))
				{
					modelAnimator.SetBool("chargingBlink", false);
					if (((Behaviour)modelAnimator).isActiveAndEnabled && GetAnimationStateHash("FullBody, Override") == ChargeBlink)
					{
						((EntityState)this).PlayCrossfade("FullBody, Override", "BufferEmpty", 0.05f);
					}
				}
				if (Object.op_Implicit((Object)(object)preview))
				{
					EntityState.Destroy((Object)(object)preview);
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
				{
					((EntityState)this).cameraTargetParams.RemoveParamsOverride(cameraOverride, 0.25f);
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && movementLocked)
				{
					((Behaviour)((EntityState)this).characterMotor).enabled = motorWasEnabled;
				}
			}
			if (refunding && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive)
			{
				if (NetworkServer.active && consumedStacks > 0)
				{
					((EntityState)this).characterBody.SetBuffCount(WarlockBuffs.warlockMetaMagicBuff.buffIndex, ((EntityState)this).characterBody.GetBuffCount(WarlockBuffs.warlockMetaMagicBuff) + consumedStacks);
				}
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).skillLocator.utility.AddOneStock();
				}
			}
			base.OnExit();
		}
	}
	public class CrimsonManaRefill : BaseWarlockSkillState
	{
		internal uint requestId;

		internal bool secondary;

		internal HurtBox target;

		private bool responseReceived;

		private bool accepted;

		private bool reservedMana;

		private bool castCommitted;

		private WarlockTracker tracker;

		private SkillDef originalSkill;

		private GenericSkill Slot => secondary ? ((EntityState)this).skillLocator.secondary : ((EntityState)this).skillLocator.utility;

		private bool TargetValid => !secondary || Hex.IsTargetValid(target, ((EntityState)this).characterBody, tracker);

		public override void OnEnter()
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			tracker = ((EntityState)this).GetComponent<WarlockTracker>();
			originalSkill = Slot.skillDef;
			if (secondary)
			{
				tracker.SetChargeTarget(target);
			}
			if (NetworkServer.active)
			{
				reservedMana = Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive && TargetValid && originalSkill is CrimsonManaSkillDef && warlockController.TryConsumeCrimsonMana(playSound: false);
				ReceiveResult(reservedMana);
				if (!((EntityState)this).isAuthority)
				{
					NetMessageExtensions.Send((INetMessage)(object)new SyncCrimsonManaRefill(((EntityState)this).GetComponent<NetworkIdentity>().netId, requestId, reservedMana), (NetworkDestination)1);
				}
			}
		}

		internal void ReceiveResult(bool success)
		{
			if (!responseReceived)
			{
				responseReceived = true;
				accepted = success;
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (!responseReceived)
			{
				if (((EntityState)this).fixedAge >= 3f)
				{
					Log.Warning("Crimson Mana refill timed out waiting for the server.");
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else if (!accepted || !((EntityState)this).characterBody.healthComponent.alive || !TargetValid || (Object)(object)Slot.skillDef != (Object)(object)originalSkill)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (!((EntityState)this).outer.HasPendingState())
			{
				int stock = Slot.stock;
				Slot.stock = Slot.maxStock;
				if (!Slot.ExecuteIfReady())
				{
					Slot.stock = stock;
					Log.Warning("Crimson Mana refill could not execute the requested skill.");
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void ModifyNextState(EntityState nextState)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).ModifyNextState(nextState);
			castCommitted = accepted && (secondary ? (nextState is Hex) : (nextState is BloodDash || nextState is BloodDashPrep));
			if (castCommitted && NetworkServer.active)
			{
				reservedMana = false;
				SoundBanks.PlayUseMana(((EntityState)this).characterBody.corePosition);
				if (secondary)
				{
					warlockController.ApplySecondaryEmpowerment(Mathf.Max(1, Slot.maxStock / 2));
				}
				else
				{
					warlockController.ApplyUtilityEmpowerment();
				}
				if (!((EntityState)this).isAuthority)
				{
					Slot.stock = Mathf.Max(0, Slot.maxStock - 1);
				}
			}
		}

		public override void OnExit()
		{
			if (NetworkServer.active && reservedMana)
			{
				((EntityState)this).characterBody.AddBuff(WarlockBuffs.warlockCrimsonManaFullStack);
			}
			if (secondary && !castCommitted && Object.op_Implicit((Object)(object)tracker))
			{
				tracker.ClearChargeTarget();
			}
			((EntityState)this).OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(requestId);
			writer.Write(secondary);
			NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(target));
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			requestId = reader.ReadUInt32();
			secondary = reader.ReadBoolean();
			HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader);
			target = ((HurtBoxReference)(ref val)).ResolveHurtBox();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class CrimsonSurgeFire : BaseWarlockSkillState
	{
		public float baseDuration = 1f;

		public float selfKnockbackForce = 2250f;

		public float damageCoefficient = WarlockConfig.CrimsonSurgeDamage;

		private float duration;

		private float fireInterval;

		public int maxShots = 1;

		private int shotCounter;

		private bool empoweredShot;

		public Ray initialAimRay;

		private float fireTimer;

		private Ray aimRay;

		private bool animationStarted;

		public GameObject hitEffectPrefab = WarlockAssets.warlockHitImpactEffect;

		public GameObject tracerEffectPrefab = WarlockAssets.warlockTracerEffect;

		private bool IsBlasting => maxShots > 1 && shotCounter < maxShots;

		public override void OnEnter()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			RefreshState();
			base.OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			empoweredShot = warlockController.TryConsumeEmpowerment(WarlockBuffs.warlockEmpoweredM1Buff);
			fireInterval = duration / (float)maxShots;
			fireTimer = fireInterval;
			shotCounter = 1;
			UpdateAnimation();
			aimRay = ((((Ray)(ref initialAimRay)).direction == Vector3.zero) ? ((BaseState)this).GetAimRay() : initialAimRay);
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			Util.PlaySound("Play_imp_overlord_teleport_end", ((EntityState)this).gameObject);
			Fire();
		}

		public override void Update()
		{
			((EntityState)this).Update();
			UpdateAnimation();
		}

		private void UpdateAnimation()
		{
			if (!Object.op_Implicit((Object)(object)modelAnimator) || !((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				animationStarted = false;
				return;
			}
			modelAnimator.SetBool("isBlasting", IsBlasting);
			if (!CanPlayGestureAnimation(primary: true))
			{
				animationStarted = false;
			}
			else if (!animationStarted)
			{
				((EntityState)this).PlayCrossfade("Gesture, Override", "BlastFire", "Blast.playbackRate", Mathf.Max(0.01f, fireInterval), 0.05f);
				animationStarted = true;
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_001d: 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)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(maxShots);
			writer.Write(((Ray)(ref aimRay)).origin);
			writer.Write(((Ray)(ref aimRay)).direction);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			maxShots = Mathf.Max(1, reader.ReadInt32());
			initialAimRay = new Ray(reader.ReadVector3(), reader.ReadVector3());
		}

		private void Fire()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0049: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			EffectManager.SimpleMuzzleFlash(WarlockAssets.warlockSurgeMuzzleEffect, ((EntityState)this).gameObject, "Muzzle", false);
			if (NetworkServer.active)
			{
				DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)(empoweredShot ? 16384 : 0));
				damageType.damageSource = (DamageSource)1;
				BulletAttack val = new BulletAttack();
				val.owner = ((EntityState)this).gameObject;
				val.weapon = ((EntityState)this).gameObject;
				val.origin = ((Ray)(ref aimRay)).origin;
				val.aimVector = ((Ray)(ref aimRay)).direction;
				val.minSpread = 0f;
				val.maxSpread = ((EntityState)this).characterBody.spreadBloomAngle;
				val.radius = 2f;
				val.bulletCount = 1u;
				val.procCoefficient = WarlockConfig.CrimsonSurgeProc;
				val.damage = damageCoefficient * ((BaseState)this).damageStat;
				val.force = 0f;
				val.falloffModel = (FalloffModel)0;
				val.tracerEffectPrefab = tracerEffectPrefab;
				val.muzzleName = "Muzzle";
				val.hitEffectPrefab = hitEffectPrefab;
				val.isCrit = ((BaseState)this).RollCrit();
				val.HitEffectNormal = false;
				val.stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask;
				val.smartCollision = true;
				val.maxDistance = 500f;
				val.damageType = damageType;
				if (empoweredShot)
				{
					val.hitCallback = new HitCallback(EmpoweredHit);
				}
				val.Fire();
			}
			if (((EntityState)this).isAuthority && !((EntityState)this).characterMotor.isGrounded)
			{
				float num = selfKnockbackForce * Mathf.Pow(0.5f, (float)(shotCounter - 1));
				((EntityState)this).characterBody.characterMotor.ApplyForce((0f - num) * ((Ray)(ref aimRay)).direction, true, false);
			}
		}

		private static bool EmpoweredHit(BulletAttack attack, ref BulletHit hit)
		{
			//IL_0057: 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_00cf: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00f6: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			bool result = BulletAttack.defaultHitCallback.Invoke(attack, ref hit);
			HealthComponent val = (Object.op_Implicit((Object)(object)hit.hitHurtBox) ? hit.hitHurtBox.healthComponent : null);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)val) && val.alive && Object.op_Implicit((Object)(object)val.body) && FriendlyFireManager.ShouldDirectHitProceed(val, TeamComponent.GetObjectTeam(attack.owner)))
			{
				CharacterBody body = val.body;
				Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
				float num = (Object.op_Implicit((Object)(object)body.characterMotor) ? body.characterMotor.mass : (Object.op_Implicit((Object)(object)component) ? component.mass : 1f));
				float num2 = FireSonicBoom.shoveSuitabilityCurve.Evaluate(num);
				body.RecalculateStats();
				Vector3 val2 = Vector3.ProjectOnPlane(hit.direction, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				float num3 = Trajectory.CalculateInitialYSpeedForHeight(30f, 0f - body.acceleration);
				Vector3 val3 = normalized * num3 + Vector3.up * 3f;
				val.TakeDamageForce(val3 * (num * num2), true, true);
			}
			return result;
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				modelAnimator.SetBool("isBlasting", false);
			}
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			//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)
			base.FixedUpdate();
			while (shotCounter < maxShots && ((EntityState)this).fixedAge >= fireTimer)
			{
				shotCounter++;
				if (Object.op_Implicit((Object)(object)modelAnimator))
				{
					modelAnimator.SetBool("isBlasting", IsBlasting);
				}
				fireTimer += fireInterval;
				aimRay = ((BaseState)this).GetAimRay();
				((BaseState)this).StartAimMode(aimRay, 2f, false);
				Util.PlaySound("Play_imp_overlord_teleport_end", ((EntityState)this).gameObject);
				Fire();
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		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 CrimsonSurgePrep : BaseMetamagicCharge
	{
		private static readonly int BlastCharge = Animator.StringToHash("BlastCharge");

		private bool firing;

		private uint chargeSoundId;

		protected override bool IsHeld => Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.skill1.down;

		protected override GameObject ChargeEffectPrefab => WarlockAssets.spawnPrefab;

		protected override bool WaitForInitialCharge => true;

		public override void OnEnter()
		{
			base.OnEnter();
			UpdateAnimation();
		}

		public override void Update()
		{
			base.Update();
			UpdateAnimation();
		}

		private void UpdateAnimation()
		{
			if (Object.op_Implicit((Object)(object)modelAnimator) && ((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				modelAnimator.SetBool("chargingBlast", true);
				modelAnimator.SetBool("isBlasting", consumedStacks > 0);
				if (CanPlayGestureAnimation(primary: true) && GetAnimationStateHash("Gesture, Override") != BlastCharge)
				{
					modelAnimator.SetFloat("Blast.playbackRate", Mathf.Max(0.01f, ((BaseState)this).attackSpeedStat));
					((EntityState)this).PlayCrossfade("Gesture, Override", "BlastCharge", 0.05f);
				}
			}
		}

		protected override void BeginCharge()
		{
			((BaseState)this).StartAimMode(0.5f, false);
			chargeSoundId = Util.PlayAttackSpeedSound("Play_voidDevastator_m1_chargeUp", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
		}

		protected override BaseMetamagicCharge NextStep()
		{
			return new CrimsonSurgePrep();
		}

		protected override EntityState FinishCharge()
		{
			return (EntityState)(object)new CrimsonSurgeFire();
		}

		public override void ModifyNextState(EntityState nextState)
		{
			//IL_0071: 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)
			base.ModifyNextState(nextState);
			firing = nextState is CrimsonSurgeFire;
			if (nextState is CrimsonSurgePrep crimsonSurgePrep)
			{
				crimsonSurgePrep.chargeSoundId = chargeSoundId;
			}
			if (nextState is CrimsonSurgeFire crimsonSurgeFire && (NetworkServer.active || ((EntityState)this).isAuthority))
			{
				crimsonSurgeFire.maxShots = consumedStacks + 1;
				if (((EntityState)this).isAuthority)
				{
					crimsonSurgeFire.initialAimRay = ((BaseState)this).GetAimRay();
				}
				((BaseSkillState)crimsonSurgeFire).activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
			}
		}

		public override void OnExit()
		{
			if (!base.IsContinuingCharge && chargeSoundId != 0)
			{
				AkSoundEngine.StopPlayingID(chargeSoundId);
			}
			if (!base.IsContinuingCharge && Object.op_Implicit((Object)(object)modelAnimator))
			{
				modelAnimator.SetBool("chargingBlast", false);
				modelAnimator.SetBool("isBlasting", false);
				if (!firing && ((Behaviour)modelAnimator).isActiveAndEnabled && GetAnimationStateHash("Gesture, Override") == BlastCharge)
				{
					((EntityState)this).PlayCrossfade("Gesture, Override", "BufferEmpty", 0.05f);
				}
			}
			base.OnExit();
		}
	}
	public class Empower : BaseWarlockSkillState
	{
		private bool repeating;

		private bool continuing;

		private bool animationStarted;

		private int remainingMana;

		private float nextConversion = 0.5f;

		private bool IsCreatingMetaMagic => remainingMana > 0 && (!((EntityState)this).isAuthority || ((EntityState)this).inputBank.skill4.down);

		public override void OnEnter()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			if (!repeating)
			{
				warlockController.OpenRitualMenu();
				if (NetworkServer.active || ((EntityState)this).isAuthority)
				{
					remainingMana = ((EntityState)this).characterBody.GetBuffCount(WarlockBuffs.warlockCrimsonManaFullStack);
				}
			}
			if (NetworkServer.active)
			{
				if (warlockController.TryConsumeCrimsonMana(playSound: false))
				{
					((EntityState)this).characterBody.AddBuff(WarlockBuffs.warlockMetaMagicBuff);
					SoundBanks.PlayConsume(((EntityState)this).characterBody.corePosition);
				}
				remainingMana = ((EntityState)this).characterBody.GetBuffCount(WarlockBuffs.warlockCrimsonManaFullStack);
			}
			else if (((EntityState)this).isAuthority)
			{
				remainingMana = Mathf.Max(0, remainingMana - 1);
			}
			UpdateAnimation();
		}

		public override void Update()
		{
			((EntityState)this).Update();
			UpdateAnimation();
		}

		private void UpdateAnimation()
		{
			if (!Object.op_Implicit((Object)(object)modelAnimator) || !((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				animationStarted = false;
				return;
			}
			if (Object.op_Implicit((Object)(object)secondaryStateMachine) && secondaryStateMachine.state is BloodDashPrep)
			{
				modelAnimator.SetBool("creatingMetaMagic", false);
				animationStarted = false;
				return;
			}
			modelAnimator.SetBool("creatingMetaMagic", IsCreatingMetaMagic);
			if (!animationStarted)
			{
				modelAnimator.SetFloat("MetaMagic.playbackRate", Mathf.Max(0.01f, ((BaseState)this).attackSpeedStat));
				((EntityState)this).PlayCrossfade("FullBody, Override", "CreateMetaMagic", 0.05f);
				animationStarted = true;
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				if (!((EntityState)this).inputBank.skill4.down)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				else if (remainingMana > 0 && ((EntityState)this).fixedAge >= nextConversion)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new Empower());
				}
			}
		}

		public override void ModifyNextState(EntityState nextState)
		{
			((EntityState)this).ModifyNextState(nextState);
			if (nextState is Empower empower)
			{
				continuing = true;
				empower.repeating = true;
				empower.animationStarted = animationStarted;
				((BaseSkillState)empower).activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
				if (NetworkServer.active || ((EntityState)this).isAuthority)
				{
					empower.remainingMana = remainingMana;
					empower.nextConversion = Mathf.Max(0f, 0.1f - Mathf.Max(0f, ((EntityState)this).fixedAge - nextConversion));
				}
			}
		}

		public override void OnExit()
		{
			if (!continuing)
			{
				if (Object.op_Implicit((Object)(object)modelAnimator))
				{
					modelAnimator.SetBool("creatingMetaMagic", false);
				}
				warlockController.CloseRitualMenu();
			}
			((EntityState)this).OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(repeating);
			writer.Write(remainingMana);
			writer.Write(nextConversion);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			repeating = reader.ReadBoolean();
			remainingMana = reader.ReadInt32();
			nextConversion = reader.ReadSingle();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class Empower1 : BaseWarlockSkillState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			if (((EntityState)this).isAuthority)
			{
				warlockController.primaryRequiresRelease = true;
			}
			if (Object.op_Implicit((Object)(object)modelAnimator) && ((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				modelAnimator.SetFloat("Mana.playbackRate", Mathf.Max(0.01f, ((BaseState)this).attackSpeedStat));
				((EntityState)this).PlayCrossfade("Gesture, Override", "UseMana", 0.05f);
			}
			warlockController.CloseRitualMenu();
			if (warlockController.TryConsumeCrimsonMana())
			{
				warlockController.ApplyPrimaryEmpowerment();
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.1f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class Empower2 : BaseWarlockSkillState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)modelAnimator) && ((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				modelAnimator.SetFloat("Mana.playbackRate", Mathf.Max(0.01f, ((BaseState)this).attackSpeedStat));
				((EntityState)this).PlayCrossfade("Gesture, Override", "UseMana", 0.05f);
			}
			warlockController.CloseRitualMenu();
			if (warlockController.TryConsumeCrimsonMana())
			{
				warlockController.ApplySecondaryEmpowerment(((EntityState)this).skillLocator.secondary.maxStock / 2);
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).skillLocator.secondary.stock = ((EntityState)this).skillLocator.secondary.maxStock;
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.1f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class Empower3 : BaseWarlockSkillState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)modelAnimator) && ((Behaviour)modelAnimator).isActiveAndEnabled)
			{
				modelAnimator.SetFloat("Mana.playbackRate", Mathf.Max(0.01f, ((BaseState)this).attackSpeedStat));
				((EntityState)this).PlayCrossfade("Gesture, Override", "UseMana", 0.05f);
			}
			warlockController.CloseRitualMenu();
			if (warlockController.TryConsumeCrimsonMana())
			{
				warlockController.ApplyUtilityEmpowerment();
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).skillLocator.ut