Decompiled source of Warlock v0.5.2

plugins/WarlockMod.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.GolemMonster;
using EntityStates.ImpBossMonster;
using EntityStates.ImpMonster;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
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.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+7cf89bd7cc0de740eff662589d65aa2e76b7878b")]
[assembly: AssemblyProduct("WarlockMod")]
[assembly: AssemblyTitle("WarlockMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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.*/)]
	[BepInDependency("com.bepis.r2api.dot", "1.1.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	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();
			Dots.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 => new BodyInfo
		{
			bodyName = bodyName,
			bodyNameToken = "KENKO_WARLOCK_NAME",
			subtitleNameToken = "KENKO_WARLOCK_SUBTITLE",
			characterPortrait = assetBundle.LoadAsset<Texture>("texWarlockIcon"),
			bodyColor = WarlockAssets.warlockColor,
			sortPosition = 99f,
			crosshair = Assets.LoadCrosshair("Standard"),
			podPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/SurvivorPod"),
			maxHealth = 100f,
			armor = 0f,
			damage = 12f,
			jumpCount = 1
		};

		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()
		{
			WarlockUnlockables.Init();
			base.InitializeCharacter();
			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);
			Dots.Init();
			InitializeEntityStateMachines();
			InitializeSkills();
			InitializeSkins();
			InitializeCharacterMaster();
			AdditionalBodySetup();
			characterPrefab = bodyPrefab;
			AddHooks();
		}

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

		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();
			if (WarlockPlugin.scepterInstalled)
			{
				InitializeScepter();
			}
		}

		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<CrimsonManaSkillDef>(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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			LoadoutPanelController.Rebuild += new hook_Rebuild(LoadoutPanelController_Rebuild);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
			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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			LoadoutPanelController.Rebuild -= new hook_Rebuild(LoadoutPanelController_Rebuild);
			GlobalEventManager.onCharacterDeathGlobal -= GlobalEventManager_onCharacterDeathGlobal;
			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)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			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>()))
			{
				attackerBody.AddBuff(WarlockBuffs.warlockCrimsonManaFullStack);
				HurtBox val = Util.FindBodyMainHurtBox(attackerBody);
				if (Object.op_Implicit((Object)(object)val))
				{
					OrbManager.instance.AddOrb((Orb)(object)new ConsumeOrb
					{
						origin = ((Component)damageReport.victim).transform.position,
						target = val
					});
				}
				NetworkIdentity val2 = default(NetworkIdentity);
				if (((Component)damageReport.victim).gameObject.TryGetComponent<NetworkIdentity>(ref val2))
				{
					NetMessageExtensions.Send((INetMessage)(object)new SyncBloodExplosion(val2.netId, ((Component)damageReport.victim).transform.position), (NetworkDestination)1);
				}
			}
		}
	}
}
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 GameObject chargeEffect;

		protected abstract bool IsHeld { get; }

		protected abstract GameObject ChargeEffectPrefab { get; }

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

		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 = interval;
				}
				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 ((!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)
			{
				if (!CanCharge)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				else if ((hadMetaMagic && (!IsHeld || 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
	{
		public bool crimsonManaEmpowered;

		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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			RefreshState();
			base.OnEnter();
			utilityEmpowered |= crimsonManaEmpowered;
			Util.PlaySound(BlinkState.beginSoundString, ((EntityState)this).gameObject);
			FireAOEStun();
			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 val = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = val.hurtBoxesDeactivatorCounter + 1;
				val.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
			}
			blinkVector = GetBlinkVector();
			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)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(crimsonManaEmpowered);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			crimsonManaEmpowered = reader.ReadBoolean();
		}

		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(BlinkState.blinkPrefab, val, false);
		}

		private void FireAOEStun()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_004b: 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_0078: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)32);
				damageType.damageSource = (DamageSource)4;
				BlastAttack val = new BlastAttack
				{
					radius = blastAttackRadius,
					procCoefficient = blastAttackProcCoefficient,
					position = ((EntityState)this).transform.position,
					attacker = ((EntityState)this).gameObject,
					crit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master),
					baseDamage = ((EntityState)this).characterBody.damage * blastAttackDamageCoefficient,
					falloffModel = (FalloffModel)0,
					damageType = damageType,
					baseForce = blastAttackForce
				};
				val.teamIndex = TeamComponent.GetObjectTeam(val.attacker);
				val.attackerFiltering = (AttackerFiltering)2;
				val.Fire();
			}
			if (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, false);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_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)
			base.FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			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_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (utilityEmpowered)
			{
				FireAOEStun();
			}
			if (((EntityState)this).skillLocator.utility.stock == 0 && ((EntityState)this).characterBody.HasBuff(WarlockBuffs.warlockMetaMagicBuff))
			{
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).skillLocator.utility.Reset();
				}
				if (NetworkServer.active)
				{
					((EntityState)this).characterBody.RemoveBuff(WarlockBuffs.warlockMetaMagicBuff);
				}
			}
			if (!((EntityState)this).outer.destroying)
			{
				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)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;
			}
			((EntityState)this).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 || (Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.healthComponent) && target.healthComponent.alive && Object.op_Implicit((Object)(object)target.healthComponent.body) && target.healthComponent.body.teamComponent.teamIndex != ((EntityState)this).characterBody.teamComponent.teamIndex && Vector3.Distance(((EntityState)this).inputBank.aimOrigin, target.healthComponent.body.corePosition) <= tracker.maxTrackingDistance + target.healthComponent.body.radius);

		public override void OnEnter()
		{
			//IL_00bb: 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();
				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)
		{
			((EntityState)this).ModifyNextState(nextState);
			castCommitted = accepted && (secondary ? (nextState is Hex) : (nextState is BloodDash));
			if (!castCommitted)
			{
				return;
			}
			if (NetworkServer.active)
			{
				reservedMana = false;
				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);
				}
			}
			if (nextState is BloodDash bloodDash)
			{
				bloodDash.crimsonManaEmpowered = true;
			}
		}

		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;

		public bool empoweredShot;

		public Ray initialAimRay;

		private float fireTimer;

		private Ray aimRay;

		public GameObject hitEffectPrefab = WarlockAssets.warlockHitImpactEffect;

		public GameObject tracerEffectPrefab = WarlockAssets.warlockTracerEffect;

		public override void OnEnter()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			RefreshState();
			base.OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			if (empoweredShot)
			{
				duration *= 0.85f;
			}
			fireInterval = duration / (float)maxShots;
			fireTimer = fireInterval;
			shotCounter = 1;
			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);
			if (Object.op_Implicit((Object)(object)FireLaser.effectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(FireLaser.effectPrefab, ((EntityState)this).gameObject, "Muzzle", false);
			}
			Fire();
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			maxShots = Mathf.Max(1, reader.ReadInt32());
			empoweredShot = reader.ReadBoolean();
			initialAimRay = new Ray(reader.ReadVector3(), reader.ReadVector3());
		}

		private void Fire()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//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_0046: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)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 = selfKnockbackForce;
			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 (NetworkServer.active)
			{
				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);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			//IL_002e: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			while (shotCounter < maxShots && ((EntityState)this).fixedAge >= fireTimer)
			{
				shotCounter++;
				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 bool empoweredAtStart;

		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 float ChargeSpeed => ((BaseState)this).attackSpeedStat / (primaryEmpowered ? 0.85f : 1f);

		protected override void BeginCharge()
		{
			empoweredAtStart = primaryEmpowered;
			((BaseState)this).StartAimMode(0.5f, false);
			Util.PlayAttackSpeedSound("Play_imp_overlord_attack2_tell", ((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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			base.ModifyNextState(nextState);
			if (nextState is CrimsonSurgePrep crimsonSurgePrep)
			{
				crimsonSurgePrep.empoweredAtStart = empoweredAtStart;
			}
			if (nextState is CrimsonSurgeFire crimsonSurgeFire && (NetworkServer.active || ((EntityState)this).isAuthority))
			{
				crimsonSurgeFire.maxShots = consumedStacks + 1;
				crimsonSurgeFire.empoweredShot = empoweredAtStart;
				if (((EntityState)this).isAuthority)
				{
					crimsonSurgeFire.initialAimRay = ((BaseState)this).GetAimRay();
				}
				((BaseSkillState)crimsonSurgeFire).activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			base.OnSerialize(writer);
			writer.Write(empoweredAtStart);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			base.OnDeserialize(reader);
			empoweredAtStart = reader.ReadBoolean();
		}
	}
	public class Empower : BaseWarlockSkillState
	{
		private bool repeating;

		private bool continuing;

		private int remainingMana;

		private float nextConversion = 0.5f;

		public override void OnEnter()
		{
			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())
				{
					((EntityState)this).characterBody.AddBuff(WarlockBuffs.warlockMetaMagicBuff);
				}
				remainingMana = ((EntityState)this).characterBody.GetBuffCount(WarlockBuffs.warlockCrimsonManaFullStack);
			}
			else if (((EntityState)this).isAuthority)
			{
				remainingMana = Mathf.Max(0, remainingMana - 1);
			}
			if (!repeating)
			{
				warlockController.PlaySound();
			}
		}

		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;
				((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)
			{
				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();
			warlockController.CloseRitualMenu();
			warlockController.PlaySound();
			if (warlockController.TryConsumeCrimsonMana())
			{
				((EntityState)this).characterBody.AddTimedBuff(WarlockBuffs.warlockEmpoweredM1Buff, WarlockConfig.PrimaryEmpowerDuration);
			}
		}

		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();
			warlockController.CloseRitualMenu();
			warlockController.PlaySound();
			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();
			warlockController.CloseRitualMenu();
			warlockController.PlaySound();
			if (warlockController.TryConsumeCrimsonMana())
			{
				warlockController.ApplyUtilityEmpowerment();
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).skillLocator.utility.stock = ((EntityState)this).skillLocator.utility.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 Hex : BaseMetamagicCharge
	{
		private HurtBox victim;

		private bool empowered;

		private bool continuingHex;

		private WarlockTracker tracker;

		private AimRequest aimRequest;

		private bool transferringTarget;

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

		protected override GameObject ChargeEffectPrefab => WarlockAssets.hexChargeEffect;

		protected override bool CanCharge => base.CanCharge && Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)victim.healthComponent) && victim.healthComponent.alive && Object.op_Implicit((Object)(object)victim.healthComponent.body) && victim.healthComponent.body.teamComponent.teamIndex != ((EntityState)this).characterBody.teamComponent.teamIndex && Vector3.Distance(((EntityState)this).inputBank.aimOrigin, victim.healthComponent.body.corePosition) <= tracker.maxTrackingDistance + victim.healthComponent.body.radius;

		public override void OnEnter()
		{
			tracker = ((EntityState)this).GetComponent<WarlockTracker>();
			if (!continuingHex && ((EntityState)this).isAuthority)
			{
				victim = tracker.GetTrackingTarget();
			}
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)victim))
			{
				tracker.SetChargeTarget(victim);
				if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
				{
					aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)2);
				}
			}
		}

		protected override void BeginCharge()
		{
			if (!CanCharge)
			{
				return;
			}
			((BaseState)this).StartAimMode(0.5f, false);
			((EntityState)this).PlayAnimation("Gesture, Override", "Point", "Swing.playbackRate", 0.5f / ((BaseState)this).attackSpeedStat, 0f);
			if (NetworkServer.active)
			{
				empowered = warlockController.secondaryEmpowered;
				if (empowered)
				{
					((EntityState)this).characterBody.RemoveBuff(WarlockBuffs.warlockEmpoweredM2Buff);
				}
				ApplyHex(metamagic: false);
			}
		}

		protected override void ApplyConsumedStack()
		{
			ApplyHex(metamagic: true);
		}

		private void ApplyHex(bool metamagic)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			CharacterBody body = victim.healthComponent.body;
			body.AddTimedBuff(empowered ? WarlockBuffs.warlockHexxedEmpoweredDebuff : WarlockBuffs.warlockHexxedDebuff, WarlockConfig.HexDuration);
			if (metamagic)
			{
				body.AddTimedBuff(WarlockBuffs.warlockHexxedMetaMagicDebuff, WarlockConfig.HexDuration);
			}
			EffectManager.SpawnEffect(WarlockAssets.warlockHexConsume, new EffectData
			{
				origin = body.corePosition,
				scale = 1.5f
			}, true);
		}

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

		protected override EntityState FinishCharge()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			return (EntityState)new Idle();
		}

		public override void ModifyNextState(EntityState nextState)
		{
			base.ModifyNextState(nextState);
			if (nextState is Hex hex)
			{
				transferringTarget = true;
				hex.continuingHex = true;
				hex.victim = victim;
				hex.empowered = empowered;
			}
		}

		public override void OnExit()
		{
			if (!transferringTarget && Object.op_Implicit((Object)(object)tracker))
			{
				tracker.ClearChargeTarget();
			}
			AimRequest obj = aimRequest;
			if (obj != null)
			{
				obj.Dispose();
			}
			base.OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			base.OnSerialize(writer);
			NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(victim));
			writer.Write(empowered);
			writer.Write(continuingHex);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			base.OnDeserialize(reader);
			HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader);
			victim = ((HurtBoxReference)(ref val)).ResolveHurtBox();
			empowered = reader.ReadBoolean();
			continuingHex = reader.ReadBoolean();
		}
	}
	public class MainState : GenericCharacterMain
	{
		private Animator animator;

		public LocalUser localUser;

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			animator = ((BaseCharacterMain)this).modelAnimator;
			FindLocalUser();
		}

		private void FindLocalUser()
		{
			if (localUser != null || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				return;
			}
			foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
			{
				if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)((EntityState)this).characterBody)
				{
					localUser = readOnlyLocalUsers;
					break;
				}
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)animator))
			{
				bool flag = false;
				if (!((EntityState)this).characterBody.outOfDanger || !((EntityState)this).characterBody.outOfCombat)
				{
					flag = true;
				}
				animator.SetBool("inCombat", flag);
				if (((BaseState)this).isGrounded)
				{
					animator.SetFloat("airBlend", 0f);
				}
				else
				{
					animator.SetFloat("airBlend", 1f);
				}
			}
		}

		public override void ProcessJump()
		{
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			if (!((BaseCharacterMain)this).hasCharacterMotor)
			{
				return;
			}
			bool flag = false;
			bool flag2 = false;
			if (!base.jumpInputReceived || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody) || ((EntityState)this).characterMotor.jumpCount >= ((EntityState)this).characterBody.maxJumpCount)
			{
				return;
			}
			int itemCount = ((EntityState)this).characterBody.inventory.GetItemCount(Items.JumpBoost);
			float num = 1f;
			float num2 = 1f;
			if (((EntityState)this).characterMotor.jumpCount >= ((EntityState)this).characterBody.baseJumpCount)
			{
				flag = true;
				num = 1.5f;
				num2 = 1.5f;
			}
			else if (itemCount > 0 && ((EntityState)this).characterBody.isSprinting)
			{
				float num3 = ((EntityState)this).characterBody.acceleration * ((EntityState)this).characterMotor.airControl;
				if (((EntityState)this).characterBody.moveSpeed > 0f && num3 > 0f)
				{
					flag2 = true;
					float num4 = Mathf.Sqrt(10f * (float)itemCount / num3);
					float num5 = ((EntityState)this).characterBody.moveSpeed / num3;
					num = (num4 + num5) / num5;
				}
			}
			GenericCharacterMain.ApplyJumpVelocity(((EntityState)this).characterMotor, ((EntityState)this).characterBody, num, num2, false);
			if (((BaseCharacterMain)this).hasModelAnimator)
			{
				int layerIndex = ((BaseCharacterMain)this).modelAnimator.GetLayerIndex("Body");
				if (layerIndex >= 0)
				{
					if (((EntityState)this).characterBody.isSprinting)
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("SprintJump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
					else if (flag)
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("BonusJump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
					else
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("Jump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
				}
			}
			if (flag)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/FeatherEffect"), new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition
				}, true);
			}
			else if (((EntityState)this).characterMotor.jumpCount > 0)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/CharacterLandImpact"), new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition,
					scale = ((EntityState)this).characterBody.radius
				}, true);
			}
			if (flag2)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BoostJumpEffect"), new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition,
					rotation = Util.QuaternionSafeLookRotation(((EntityState)this).characterMotor.velocity)
				}, true);
			}
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.jumpCount++;
		}
	}
	public class RitualPrep : BaseWarlockSkillState
	{
		private bool releasedOpeningPress;

		private bool converting;

		public override void OnEnter()
		{
			base.OnEnter();
			warlockController.OpenRitualMenu();
			Util.PlaySound("sfx_scout_swap_weapon", ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Gesture, Override", "SwapToBat", "Grab.playbackRate", 0.5f / ((BaseState)this).attackSpeedStat, 0f);
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				if (!((EntityState)this).inputBank.skill4.down)
				{
					releasedOpeningPress = true;
				}
				else if (releasedOpeningPress)
				{
					EntityStateMachine outer = ((EntityState)this).outer;
					Empower empower = new Empower();
					((BaseSkillState)empower).activatorSkillSlot = ((EntityState)this).skillLocator.special;
					outer.SetNextState((EntityState)(object)empower);
				}
			}
		}

		public override void ModifyNextState(EntityState nextState)
		{
			((EntityState)this).ModifyNextState(nextState);
			converting = nextState is Empower;
		}

		public override void OnExit()
		{
			if (!converting)
			{
				warlockController.CloseRitualMenu();
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
}
namespace WarlockMod.Warlock.Content
{
	public static class DamageTypes
	{
		private struct PendingHexDamage
		{
			public HealthComponent victim;

			public DamageInfo damage;

			public int bleedStacks;
		}

		public static ModdedDamageType HexMask;

		private static bool hooked;

		private static int damageDepth;

		private static bool applyingHexDamage;

		private static readonly Queue<PendingHexDamage> pendingHexDamage = new Queue<PendingHexDamage>();

		internal static void Init()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (!hooked)
			{
				HexMask = DamageAPI.ReserveDamageType();
				HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(TakeDamageProcess);
				GlobalEventManager.onServerDamageDealt += OnDamageDealt;
				hooked = true;
			}
		}

		internal static void Unhook()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (hooked)
			{
				GlobalEventManager.onServerDamageDealt -= OnDamageDealt;
				HealthComponent.TakeDamageProcess -= new hook_TakeDamageProcess(TakeDamageProcess);
				pendingHexDamage.Clear();
				hooked = false;
			}
		}

		private static void TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damage)
		{
			damageDepth++;
			bool flag = false;
			try
			{
				orig.Invoke(self, damage);
				flag = true;
			}
			finally
			{
				damageDepth--;
				if (!flag)
				{
					pendingHexDamage.Clear();
				}
			}
			if (damageDepth == 0)
			{
				ApplyPendingHexDamage();
			}
		}

		private static void ApplyPendingHexDamage()
		{
			if (applyingHexDamage || DamageTypes.pendingHexDamage.Count == 0)
			{
				return;
			}
			applyingHexDamage = true;
			try
			{
				while (DamageTypes.pendingHexDamage.Count > 0)
				{
					PendingHexDamage pendingHexDamage = DamageTypes.pendingHexDamage.Dequeue();
					if (Object.op_Implicit((Object)(object)pendingHexDamage.victim) && pendingHexDamage.victim.alive)
					{
						pendingHexDamage.victim.TakeDamage(pendingHexDamage.damage);
						if (Object.op_Implicit((Object)(object)pendingHexDamage.victim) && !pendingHexDamage.damage.rejected)
						{
							Dots.InflictBleed(((Component)pendingHexDamage.victim).gameObject, pendingHexDamage.damage.attacker, pendingHexDamage.bleedStacks, pendingHexDamage.damage.procCoefficient);
						}
					}
				}
			}
			finally
			{
				applyingHexDamage = false;
				DamageTypes.pendingHexDamage.Clear();
			}
		}

		private static void OnDamageDealt(DamageReport report)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: 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)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Expected O, but got Unknown
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)report.attackerBody) || !Object.op_Implicit((Object)(object)report.victimBody) || !Object.op_Implicit((Object)(object)((Component)report.attackerBody).GetComponent<WarlockController>()))
			{
				return;
			}
			DamageInfo damageInfo = report.damageInfo;
			if (damageInfo.rejected || damageInfo.damage <= 0f || (int)damageInfo.dotIndex != -1)
			{
				return;
			}
			if (DamageAPI.HasModdedDamageType(damageInfo, HexMask))
			{
				DelayBlastWarlock delayBlastWarlock = (Object.op_Implicit((Object)(object)damageInfo.inflictor) ? damageInfo.inflictor.GetComponent<DelayBlastWarlock>() : null);
				if (Object.op_Implicit((Object)(object)delayBlastWarlock))
				{
					Dots.InflictBleed(((Component)report.victim).gameObject, damageInfo.attacker, delayBlastWarlock.bleedStacks, damageInfo.procCoefficient);
				}
				return;
			}
			CharacterBody victimBody = report.victimBody;
			int buffCount = victimBody.GetBuffCount(WarlockBuffs.warlockHexxedDebuff);
			int buffCount2 = victimBody.GetBuffCount(WarlockBuffs.warlockHexxedEmpoweredDebuff);
			int bleedStacks = victimBody.GetBuffCount(WarlockBuffs.warlockHexxedMetaMagicDebuff);
			if (WarlockConfig.BleedProc > 0f && ((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)5))
			{
				bleedStacks = 0;
			}
			if (buffCount2 > 0)
			{
				DamageTypeCombo val = DamageTypeCombo.op_Implicit((DamageType)32);
				val.damageSource = (DamageSource)2;
				GameObject val2 = Object.Instantiate<GameObject>(WarlockAssets.warlockHexExplodeEffect, victimBody.corePosition, Quaternion.identity);
				DelayBlastWarlock component = val2.GetComponent<DelayBlastWarlock>();
				component.position = victimBody.corePosition;
				component.baseDamage = damageInfo.damage * WarlockConfig.EmpoweredHexDamage * (float)buffCount2;
				component.radius = 16f;
				component.attacker = damageInfo.attacker;
				component.inflictor = val2;
				component.crit = damageInfo.crit;
				component.maxTimer = 0f;
				component.damageColorIndex = (DamageColorIndex)12;
				component.falloffModel = (FalloffModel)0;
				component.procChainMask = damageInfo.procChainMask;
				component.bleedStacks = bleedStacks;
				component.damageType = DamageTypeCombo.op_Implicit(val);
				component.moddedDamageTypeHolder.Add(HexMask);
				val2.GetComponent<TeamFilter>().teamIndex = report.attackerTeamIndex;
			}
			if (buffCount > 0)
			{
				DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)32);
				damageType.damageSource = (DamageSource)2;
				DamageInfo val3 = new DamageInfo
				{
					procCoefficient = damageInfo.procCoefficient * WarlockConfig.HexProcMultiplier,
					procChainMask = damageInfo.procChainMask,
					position = victimBody.corePosition,
					attacker = damageInfo.attacker,
					inflictor = ((Component)victimBody).gameObject,
					crit = damageInfo.crit,
					damage = damageInfo.damage * WarlockConfig.HexDamage * (float)buffCount,
					damageColorIndex = (DamageColorIndex)12,
					damageType = damageType
				};
				DamageAPI.AddModdedDamageType(val3, HexMask);
				pendingHexDamage.Enqueue(new PendingHexDamage
				{
					victim = victimBody.healthComponent,
					damage = val3,
					bleedStacks = bleedStacks
				});
			}
		}
	}
	internal static class Dots
	{
		private static readonly DotDef procBleedDef = new DotDef();

		private static DotIndex procBleed;

		private static bool initialized;

		internal static void Init()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_002f: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			if (!initialized)
			{
				procBleed = DotAPI.RegisterDotDef(procBleedDef, new CustomDotBehaviour(RefreshBleed), (CustomDotVisual)null, new CustomDotDamageEvaluation(DealProcBleed));
				if ((int)procBleed == -1)
				{
					throw new InvalidOperationException("Warlock metamagic bleed registration failed.");
				}
				DotController.InitDotCatalog += new hook_InitDotCatalog(InitializeBleedDefinition);
				initialized = true;
			}
		}

		private static void InitializeBleedDefinition(orig_InitDotCatalog orig)
		{
			//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)
			orig.Invoke();
			DotDef dotDef = DotController.GetDotDef((DotIndex)0);
			procBleedDef.interval = dotDef.interval;
			procBleedDef.damageCoefficient = dotDef.damageCoefficient;
			procBleedDef.damageColorIndex = dotDef.damageColorIndex;
			procBleedDef.associatedBuff = dotDef.associatedBuff;
		}

		internal static void Unhook()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (initialized)
			{
				DotController.InitDotCatalog -= new hook_InitDotCatalog(InitializeBleedDefinition);
			}
		}

		internal static void InflictBleed(GameObject victim, GameObject attacker, int stacks, float sourceProc)
		{
			//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_0058: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)attacker) && stacks > 0 && !(sourceProc <= 0f) && !(WarlockConfig.BleedDamageMultiplier <= 0f))
			{
				DotIndex val = (DotIndex)((WarlockConfig.BleedProc > 0f) ? ((int)procBleed) : 0);
				for (int i = 0; i < stacks; i++)
				{
					DotController.InflictDot(victim, attacker, (HurtBox)null, val, WarlockConfig.BleedDuration, sourceProc * WarlockConfig.BleedDamageMultiplier, (uint?)null);
				}
			}
		}

		private static void RefreshBleed(DotController controller, DotStack added)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			foreach (DotStack dotStack in controller.dotStackList)
			{
				if (dotStack.dotIndex == procBleed && dotStack.timer < added.timer)
				{
					dotStack.timer = added.timer;
					dotStack.totalDuration = added.totalDuration;
				}
			}
		}

		private static void DealProcBleed(DotController controller, PendingDamage pending)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)controller.victimHealthComponent) && Object.op_Implicit((Object)(object)controller.victimBody))
			{
				DamageInfo val = new DamageInfo
				{
					attacker = pending.attackerObject,
					damage = pending.totalDamage,
					inflictor = ((Component)controller).gameObject,
					position = controller.victimBody.corePosition,
					procCoefficient = WarlockConfig.BleedProc,
					damageColorIndex = procBleedDef.damageColorIndex,
					damageType = (pending.damageType | DamageTypeCombo.op_Implicit((DamageType)67108864)),
					dotIndex = procBleed,
					inflictedHurtbox = pending.hitHurtBox
				};
				((ProcChainMask)(ref val.procChainMask)).AddProc((ProcType)5);
				DamageAPI.AddModdedDamageType(val, DamageTypes.HexMask);
				controller.victimHealthComponent.TakeDamage(val);
				if (!val.rejected && val.procCoefficient > 0f)
				{
					GlobalEventManager.instance.OnHitEnemy(val, controller.victimObject);
					GlobalEventManager.instance.OnHitAll(val, controller.victimObject);
				}
			}
		}
	}
	public static class WarlockAI
	{
		public static void Init(GameObject bodyPrefab, string masterName)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Prefabs.CreateBlankMasterPrefab(bodyPrefab, masterName);
			BaseAI component = val.GetComponent<BaseAI>();
			component.aimVectorDampTime = 0.1f;
			component.aimVectorMaxSpeed = 360f;
			AISkillDriver val2 = val.AddComponent<AISkillDriver>();
			val2.customName = "Use Primary Swing";
			val2.skillSlot = (SkillSlot)0;
			val2.requiredSkill = null;
			val2.requireSkillReady = false;
			val2.requireEquipmentReady = false;
			val2.minUserHealthFraction = float.NegativeInfinity;
			val2.maxUserHealthFraction = float.PositiveInfinity;
			val2.minTargetHealthFraction = float.NegativeInfinity;
			val2.maxTargetHealthFraction = float.PositiveInfinity;
			val2.minDistance = 0f;
			val2.maxDistance = 8f;
			val2.selectionRequiresTargetLoS = false;
			val2.selectionRequiresOnGround = false;
			val2.selectionRequiresAimTarget = false;
			val2.maxTimesSelected = -1;
			val2.moveTargetType = (TargetType)0;
			val2.activationRequiresTargetLoS = false;
			val2.activationRequiresAimTargetLoS = false;
			val2.activationRequiresAimConfirmation = false;
			val2.movementType = (MovementType)1;
			val2.moveInputScale = 1f;
			val2.aimType = (AimType)1;
			val2.ignoreNodeGraph = false;
			val2.shouldSprint = false;
			val2.shouldFireEquipment = false;
			val2.buttonPressType = (ButtonPressType)0;
			val2.driverUpdateTimerOverride = -1f;
			val2.resetCurrentEnemyOnNextDriverSelection = false;
			val2.noRepeat = false;
			val2.nextHighPriorityOverride = null;
			AISkillDriver val3 = val.AddComponent<AISkillDriver>();
			val3.customName = "Use Secondary Shoot";
			val3.skillSlot = (SkillSlot)1;
			val3.requireSkillReady = true;
			val3.minDistance = 0f;
			val3.maxDistance = 25f;
			val3.selectionRequiresTargetLoS = false;
			val3.selectionRequiresOnGround = false;
			val3.selectionRequiresAimTarget = false;
			val3.maxTimesSelected = -1;
			val3.moveTargetType = (TargetType)0;
			val3.activationRequiresTargetLoS = false;
			val3.activationRequiresAimTargetLoS = false;
			val3.activationRequiresAimConfirmation = true;
			val3.movementType = (MovementType)1;
			val3.moveInputScale = 1f;
			val3.aimType = (AimType)1;
			val3.buttonPressType = (ButtonPressType)0;
			AISkillDriver val4 = val.AddComponent<AISkillDriver>();
			val4.customName = "Use Utility Roll";
			val4.skillSlot = (SkillSlot)2;
			val4.requireSkillReady = true;
			val4.minDistance = 8f;
			val4.maxDistance = 20f;
			val4.selectionRequiresTargetLoS = true;
			val4.selectionRequiresOnGround = false;
			val4.selectionRequiresAimTarget = false;
			val4.maxTimesSelected = -1;
			val4.moveTargetType = (TargetType)0;
			val4.activationRequiresTargetLoS = false;
			val4.activationRequiresAimTargetLoS = false;
			val4.activationRequiresAimConfirmation = false;
			val4.movementType = (MovementType)2;
			val4.moveInputScale = 1f;
			val4.aimType = (AimType)1;
			val4.buttonPressType = (ButtonPressType)0;
			AISkillDriver val5 = val.AddComponent<AISkillDriver>();
			val5.customName = "Use Special bomb";
			val5.skillSlot = (SkillSlot)3;
			val5.requireSkillReady = true;
			val5.minDistance = 0f;
			val5.maxDistance = 20f;
			val5.selectionRequiresTargetLoS = false;
			val5.selectionRequiresOnGround = false;
			val5.selectionRequiresAimTarget = false;
			val5.maxTimesSelected = -1;
			val5.moveTargetType = (TargetType)0;
			val5.activationRequiresTargetLoS = false;
			val5.activationRequiresAimTargetLoS = false;
			val5.activationRequiresAimConfirmation = false;
			val5.movementType = (MovementType)1;
			val5.moveInputScale = 1f;
			val5.aimType = (AimType)1;
			val5.buttonPressType = (ButtonPressType)0;
			AISkillDriver val6 = val.AddComponent<AISkillDriver>();
			val6.customName = "Chase";
			val6.skillSlot = (SkillSlot)(-1);
			val6.requireSkillReady = false;
			val6.minDistance = 0f;
			val6.maxDistance = float.PositiveInfinity;
			val6.moveTargetType = (TargetType)0;
			val6.activationRequiresTargetLoS = false;
			val6.activationRequiresAimTargetLoS = false;
			val6.activationRequiresAimConfirmation = false;
			val6.movementType = (MovementType)1;
			val6.moveInputScale = 1f;
			val6.aimType = (AimType)1;
			val6.buttonPressType = (ButtonPressType)0;
		}
	}
	public static class WarlockAssets
	{
		internal static AssetBundle mainAssetBundle;

		internal static GameObject spawnPrefab;

		internal static GameObject hexChargeEffect;

		internal static GameObject consumeOrb;

		internal static GameObject warlockHitImpactEffect;

		internal static GameObject warlockHexExplodeEffect;

		internal static GameObject bloodExplosionEffect;

		internal static GameObject warlockHexConsume;

		internal static GameObject warlockTracerEffect;

		internal static GameObject telekinesisTracker;

		internal static Material destealthMaterial;

		internal static readonly Color warlockColor = new Color(31f / 51f, 11f / 51f, 11f / 51f);

		internal static readonly Color warlockSpecialRed = new Color(12f / 85f, 0.08627451f, 0.08627451f);

		public static void Init(AssetBundle assetBundle)
		{
			mainAssetBundle = assetBundle;
		}

		public static void InitAssets()
		{
			destealthMaterial = Load<Material>("RoR2/Base/Imp/matImpBossDissolve.mat");
			CreateEffects();
			CreateTracker();
			CreateHexBlast();
		}

		private static T Load<T>(string key) where T : Object
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
				if (!Object.op_Implicit((Object)(object)val))
				{
					throw new InvalidOperationException("Load returned no asset.");
				}
				return val;
			}
			catch (Exception arg)
			{
				Log.Error($"Required Warlock asset '{key}' ({typeof(T).Name}) could not be loaded: {arg}");
				throw;
			}
		}

		private static GameObject CloneEffect(string key, string name)
		{
			return PrefabAPI.InstantiateClone(Load<GameObject>(key), name, false);
		}

		private static void CreateEffects()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown