Decompiled source of TestMod v1.0.0

plugins/rob_gaming-TestMod/BelmontMod.dll

Decompiled 4 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BelmontMod.Content;
using BelmontMod.Content.Components;
using BelmontMod.Content.Survivors;
using BelmontMod.Modules;
using BelmontMod.SkillStates;
using BelmontMod.SkillStates.BaseStates;
using BelmontMod.SkillStates.Belmont;
using BelmontMod.SkillStates.Belmont.Melee;
using BelmontMod.SkillStates.Belmont.Subweapon;
using BelmontMod.SkillStates.Belmont.Whip;
using BelmontMod.SkillStates.Emote;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Croco;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using On.RoR2;
using On.RoR2.UI;
using On.RoR2.UI.MainMenu;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CameraModes;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2.UI.MainMenu;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;

[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 = "")]
[assembly: AssemblyCompany("BelmontMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BelmontMod")]
[assembly: AssemblyTitle("BelmontMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
public class RocketRotation : MonoBehaviour
{
	private Rigidbody rb;

	private void Awake()
	{
		rb = ((Component)this).GetComponent<Rigidbody>();
	}

	private void FixedUpdate()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = ((Component)this).transform;
		Vector3 velocity = rb.velocity;
		transform.rotation = Util.QuaternionSafeLookRotation(((Vector3)(ref velocity)).normalized);
	}
}
public class StupidFuckingBullshit : MonoBehaviour
{
	public ParticleSystem faggot;

	private void Awake()
	{
		faggot = ((Component)this).GetComponentInChildren<ParticleSystem>();
		((Component)faggot).transform.SetParent((Transform)null);
	}

	private void FixedUpdate()
	{
		//IL_0012: 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)
		((Component)faggot).transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation);
	}
}
internal static class Log
{
	internal static ManualLogSource _logSource;

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

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

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

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

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

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

	internal static void Warning(object data)
	{
		_logSource.LogWarning(data);
	}
}
internal enum BelmontCameraParams
{
	DEFAULT,
	AIM,
	EMOTE
}
internal class BodyInfo
{
	internal string bodyName = "";

	internal string bodyNameToken = "";

	internal string subtitleNameToken = "";

	internal Color bodyColor = Color.white;

	public Vector3 modelBasePosition = new Vector3(0f, -0.9f, 0f);

	public Vector3 aimOrigin = new Vector3(0f, 1.4f, 0f);

	public Vector3 cameraPivot = new Vector3(0f, 1.59f, 0f);

	internal Texture characterPortrait = null;

	internal GameObject crosshair = null;

	internal GameObject podPrefab = null;

	internal float maxHealth = 100f;

	internal float healthGrowth = 2f;

	internal float healthRegen = 0f;

	internal float shield = 0f;

	internal float shieldGrowth = 0f;

	internal float moveSpeed = 7f;

	internal float moveSpeedGrowth = 0f;

	internal float acceleration = 80f;

	internal float jumpPower = 15f;

	internal float jumpPowerGrowth = 0f;

	internal float damage = 12f;

	internal float attackSpeed = 1f;

	internal float attackSpeedGrowth = 0f;

	internal float armor = 0f;

	internal float armorGrowth = 0f;

	internal float crit = 1f;

	internal float critGrowth = 0f;

	internal int jumpCount = 1;
}
internal class CustomRendererInfo
{
	internal string childName;

	internal Material material;

	internal bool ignoreOverlays;
}
internal class SkillDefInfo
{
	public string skillName;

	public string skillNameToken;

	public string skillDescriptionToken;

	public string[] keywordTokens = new string[0];

	public Sprite icon;

	public SerializableEntityStateType activationState;

	public InterruptPriority interruptPriority;

	public string activationStateMachineName;

	public float baseRechargeInterval;

	public int baseMaxStock = 1;

	public int rechargeStock = 1;

	public int requiredStock = 1;

	public int stockToConsume = 1;

	public bool isCombatSkill = true;

	public bool canceledFromSprinting;

	public bool forceSprintDuringState;

	public bool cancelSprintingOnActivation = true;

	public bool beginSkillCooldownOnSkillEnd;

	public bool fullRestockOnAssign = true;

	public bool resetCooldownTimerOnUse;

	public bool mustKeyPress;

	public SkillDefInfo()
	{
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval)
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		icon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		this.interruptPriority = interruptPriority;
		this.isCombatSkill = isCombatSkill;
		this.baseRechargeInterval = baseRechargeInterval;
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		icon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		interruptPriority = (InterruptPriority)0;
		isCombatSkill = true;
		baseRechargeInterval = 0f;
		requiredStock = 0;
		stockToConsume = 0;
		cancelSprintingOnActivation = !agile;
		if (agile)
		{
			keywordTokens = new string[1] { "KEYWORD_AGILE" };
		}
	}
}
namespace BelmontMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.rob.Belmont", "Belmont", "1.0.0")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "DirectorAPI", "LoadoutAPI", "UnlockableAPI", "NetworkingAPI", "RecalculateStatsAPI" })]
	public class MainPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.rob.Belmont";

		public const string MODNAME = "Belmont";

		public const string MODVERSION = "1.0.0";

		public const string developerPrefix = "ROB";

		public static MainPlugin instance;

		public static List<HurtBox> hurtboxesList = new List<HurtBox>();

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

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

		private void Awake()
		{
			instance = this;
			Files.PluginInfo = ((BaseUnityPlugin)this).Info;
			Config.myConfig = ((BaseUnityPlugin)this).Config;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Config.ReadConfig();
			BelmontAssets.PopulateAssets();
			CameraParams.InitializeParams();
			States.RegisterStates();
			Projectiles.RegisterProjectiles();
			new LanguageTokens();
			ItemDisplays.PopulateDisplays();
			new Belmont().CreateCharacter();
			Hook();
			new ContentPacks().Initialize();
			ContentManager.onContentPacksAssigned += LateSetup;
		}

		private void LateSetup(ReadOnlyArray<ReadOnlyContentPack> obj)
		{
			Belmont.SetItemDisplays();
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			HurtBox.OnEnable += new hook_OnEnable(HurtBox_OnEnable);
			HurtBox.OnDisable += new hook_OnDisable(HurtBox_OnDisable);
		}

		private void HurtBox_OnEnable(orig_OnEnable orig, HurtBox self)
		{
			orig.Invoke(self);
			hurtboxesList.Add(self);
		}

		private void HurtBox_OnDisable(orig_OnDisable orig, HurtBox self)
		{
			orig.Invoke(self);
			hurtboxesList.Remove(self);
		}

		public static float GetICBMDamageMult(CharacterBody body)
		{
			float num = 1f;
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory))
			{
				int itemCount = body.inventory.GetItemCount(Items.MoreMissile);
				int num2 = itemCount - 1;
				if (num2 > 0)
				{
					num += (float)num2 * 0.5f;
				}
			}
			return num;
		}
	}
}
namespace BelmontMod.SkillStates
{
	public class FuckMyAss : GenericCharacterDeath
	{
		public override bool shouldAutoDestroy => false;

		public override void OnEnter()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).OnEnter();
			Vector3 val = Vector3.up * 3f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				val += ((EntityState)this).characterMotor.velocity;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			if (!Object.op_Implicit((Object)(object)((GenericCharacterDeath)this).cachedModelTransform))
			{
				return;
			}
			RagdollController component = ((Component)((GenericCharacterDeath)this).cachedModelTransform).GetComponent<RagdollController>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Transform[] bones = component.bones;
			foreach (Transform val2 in bones)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					((Component)val2).gameObject.layer = LayerIndex.ragdoll.intVal;
					((Component)val2).gameObject.SetActive(true);
				}
			}
			component.BeginRagdoll(val);
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge > 4f)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		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)7;
		}
	}
}
namespace BelmontMod.SkillStates.Emote
{
	public class BaseEmote : BaseState
	{
		private CameraParamsOverrideHandle camOverrideHandle;

		private Animator animator;

		private ChildLocator childLocator;

		private float duration;

		private uint activePlayID;

		public LocalUser localUser;

		public override void OnEnter()
		{
			//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)
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			childLocator = ((EntityState)this).GetModelChildLocator();
			FindLocalUser();
			((EntityState)this).characterBody.hideCrosshair = true;
			camOverrideHandle = CameraParams.OverrideCameraParams(((EntityState)this).cameraTargetParams, BelmontCameraParams.EMOTE);
		}

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

		protected void PlayEmote(string animString, string soundString = "", float animDuration = 0f)
		{
			PlayEmote(animString, soundString, ((EntityState)this).GetModelAnimator(), animDuration);
		}

		protected void PlayEmote(string animString, string soundString, Animator animator, float animDuration = 0f)
		{
			if (animDuration >= 0f && duration != 0f)
			{
				animDuration = duration;
			}
			if (duration > 0f)
			{
				EntityState.PlayAnimationOnAnimator(animator, "FullBody, Override", animString, "Emote.playbackRate", animDuration, 0f);
			}
			else
			{
				animator.SetFloat("Emote.playbackRate", 1f);
				EntityState.PlayAnimationOnAnimator(animator, "FullBody, Override", animString);
			}
			if (!string.IsNullOrEmpty(soundString))
			{
				activePlayID = Util.PlaySound(soundString, ((EntityState)this).gameObject);
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			if (((EntityState)this).isAuthority)
			{
				CheckEmote<Rest>(Config.restKey);
				CheckEmote<Taunt>(Config.tauntKey);
				CheckEmote<Dance>(Config.danceKey);
			}
		}

		private void CheckEmote(KeyCode keybind, EntityState state)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(keybind) && !localUser.isUIFocused)
			{
				((EntityState)this).outer.SetInterruptState(state, (InterruptPriority)0);
			}
		}

		private void CheckEmote<T>(ConfigEntry<KeyboardShortcut> keybind) where T : EntityState, new()
		{
			if (Config.GetKeyPressed(keybind))
			{
				FindLocalUser();
				if (localUser != null && !localUser.isUIFocused)
				{
					((EntityState)this).outer.SetInterruptState((EntityState)(object)new T(), (InterruptPriority)0);
				}
			}
		}

		public override void FixedUpdate()
		{
			//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)
			((EntityState)this).FixedUpdate();
			bool flag = false;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded)
			{
				flag = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				if (((EntityState)this).inputBank.skill1.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.skill2.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.skill3.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.skill4.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.moveVector != Vector3.zero)
				{
					flag = true;
				}
			}
			if (duration > 0f && ((EntityState)this).fixedAge >= duration)
			{
				flag = true;
			}
			if (flag && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnExit();
			((EntityState)this).characterBody.hideCrosshair = false;
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			if (activePlayID != 0)
			{
				AkSoundEngine.StopPlayingID(activePlayID);
			}
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, 0.5f);
		}

		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)0;
		}
	}
	public class Dance : BaseEmote
	{
		public override void OnEnter()
		{
			base.OnEnter();
			PlayEmote("Dance");
		}
	}
	public class Rest : BaseEmote
	{
		public override void OnEnter()
		{
			base.OnEnter();
			PlayEmote("Rest", "", 1.5f);
		}
	}
	public class Taunt : BaseEmote
	{
		public override void OnEnter()
		{
			base.OnEnter();
			PlayEmote("TauntEmote", "", 1.5f);
		}
	}
}
namespace BelmontMod.SkillStates.Belmont
{
	public class BaseBelmontSkillState : BaseSkillState
	{
		protected BelmontController belmont;

		protected virtual bool turningAllowed => true;

		protected virtual bool normalizeModel => false;

		public override void OnEnter()
		{
			ValidateControllerReference();
			((BaseState)this).OnEnter();
			if (!turningAllowed)
			{
				((EntityState)this).characterDirection.turnSpeed = 0f;
			}
			if (normalizeModel)
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (!turningAllowed)
			{
				((EntityState)this).characterDirection.turnSpeed = belmont.baseTurnSpeed;
			}
			if (normalizeModel)
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
		}

		protected void ValidateControllerReference()
		{
			belmont = ((EntityState)this).gameObject.GetComponent<BelmontController>();
		}
	}
	public class BaseBelmontState : BaseState
	{
		protected BelmontController belmont;

		public override void OnEnter()
		{
			ValidateControllerReference();
			((BaseState)this).OnEnter();
		}

		protected void ValidateControllerReference()
		{
			belmont = ((EntityState)this).gameObject.GetComponent<BelmontController>();
		}
	}
	public class Falling : BaseBelmontSkillState
	{
		public Vector3 overrideVelocity = Vector3.zero;

		protected Vector3 slipVector = Vector3.zero;

		private float stopwatch;

		private float previousAirControl;

		public override void OnEnter()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
			slipVector = ((Vector3)(ref val)).normalized;
			previousAirControl = ((EntityState)this).characterMotor.airControl;
			((EntityState)this).characterMotor.airControl = BaseLeap.airControl;
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags | 1);
			Util.PlaySound("sfx_hunk_airdodge", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = true;
				direction.y = Mathf.Max(direction.y, 1.05f * BaseLeap.minimumY);
				Vector3 val2 = slipVector * (0.5f * BaseLeap.aimVelocity) * 12f;
				Vector3 val3 = Vector3.up * 0.75f * BaseLeap.upwardVelocity;
				Vector3 val4 = direction * (0.75f * BaseLeap.aimVelocity) * 12f;
				val4.x = 0f;
				val4.z = 0f;
				val = new Vector3(direction.x, 0f, direction.z);
				Vector3 val5 = ((Vector3)(ref val)).normalized * (1.1f * BaseLeap.forwardVelocity);
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)this).characterMotor.velocity = val2 + val4 + val3 + val5;
			}
			if (overrideVelocity != Vector3.zero)
			{
				((EntityState)this).characterMotor.velocity = overrideVelocity;
			}
		}

		public override void OnExit()
		{
			//IL_000f: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			base.OnExit();
			CharacterBody characterBody = ((EntityState)this).characterBody;
			characterBody.bodyFlags = (BodyFlags)(characterBody.bodyFlags & -2);
			((EntityState)this).characterMotor.airControl = previousAirControl;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= 0.1f && ((EntityState)this).isAuthority && ((EntityState)this).characterMotor.isGrounded)
			{
				SetNextState();
			}
		}

		protected virtual void SetNextState()
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)new Roll());
		}

		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 MainState : GenericCharacterMain
	{
		private Animator animator;

		public LocalUser localUser;

		private BelmontController belmont;

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			animator = ((BaseCharacterMain)this).modelAnimator;
			belmont = ((EntityState)this).GetComponent<BelmontController>();
			FindLocalUser();
		}

		public override void FixedUpdate()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (belmont.isSwinging)
			{
				((EntityState)this).inputBank.moveVector = Vector3.zero;
			}
			((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);
				}
				animator.SetFloat("aimDir", ((EntityState)this).inputBank.aimDirection.y);
			}
		}

		public override void Update()
		{
			((GenericCharacterMain)this).Update();
			if (((EntityState)this).isAuthority && ((EntityState)this).characterMotor.isGrounded)
			{
				CheckEmote<Rest>(Config.restKey);
				CheckEmote<Taunt>(Config.tauntKey);
				CheckEmote<Dance>(Config.danceKey);
			}
		}

		private void CheckEmote(KeyCode keybind, EntityState state)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(keybind) && !localUser.isUIFocused)
			{
				((EntityState)this).outer.SetInterruptState(state, (InterruptPriority)0);
			}
		}

		private void CheckEmote<T>(ConfigEntry<KeyboardShortcut> keybind) where T : EntityState, new()
		{
			if (Config.GetKeyPressed(keybind))
			{
				FindLocalUser();
				if (localUser != null && !localUser.isUIFocused)
				{
					((EntityState)this).outer.SetInterruptState((EntityState)(object)new T(), (InterruptPriority)0);
				}
			}
		}

		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 ProcessJump()
		{
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: 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_0247: Expected O, but got Unknown
			//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_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Expected O, but got Unknown
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			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;
			}
			Util.PlaySound("sfx_belmont_jump", ((EntityState)this).gameObject);
			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 && flag2)
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("SprintJump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
					else if (((EntityState)this).characterMotor.jumpCount == 0)
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("Jump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
					else
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("BonusJump", ((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++;
			if (Object.op_Implicit((Object)(object)animator))
			{
				float num6 = ((CharacterAnimatorWalkParamCalculator)(ref ((BaseCharacterMain)this).animatorWalkParamCalculator)).animatorWalkSpeed.y;
				float num7 = ((CharacterAnimatorWalkParamCalculator)(ref ((BaseCharacterMain)this).animatorWalkParamCalculator)).animatorWalkSpeed.x;
				if ((Mathf.Abs(num6) <= 0.45f && Mathf.Abs(num7) <= 0.45f) || ((EntityState)this).inputBank.moveVector == Vector3.zero)
				{
					num6 = 0f;
					num7 = 0f;
				}
				if (Mathf.Abs(num6) > Mathf.Abs(num7))
				{
					num6 = ((!(num6 > 0f)) ? (-1f) : 1f);
					num7 = 0f;
				}
				else if (Mathf.Abs(num6) < Mathf.Abs(num7))
				{
					num7 = ((!(num7 > 0f)) ? (-1f) : 1f);
					num6 = 0f;
				}
				animator.SetFloat("forwardSpeedCached", num7);
				animator.SetFloat("rightSpeedCached", num6);
			}
		}
	}
	public class Roll : BaseBelmontSkillState
	{
		protected Vector3 slipVector = Vector3.zero;

		public float duration = 1.1f;

		private bool peepee;

		private float coeff = 12f;

		protected override bool turningAllowed => false;

		protected override bool normalizeModel => true;

		public override void OnEnter()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
			slipVector = ((Vector3)(ref val)).normalized;
			((EntityState)this).gameObject.layer = LayerIndex.fakeActor.intVal;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			((EntityState)this).PlayCrossfade("FullBody, Override Soft", "Roll", "Landing.playbackRate", duration * 1.2f, 0.05f);
			Util.PlaySound("sfx_hunk_roll2", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			if (peepee && ((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.jumpCount = 0;
				if (((ButtonState)(ref ((EntityState)this).inputBank.jump)).justPressed)
				{
					((EntityState)this).PlayCrossfade("FullBody, Override", "BufferEmpty", 0.05f);
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
					((EntityState)this).outer.SetNextStateToMain();
					return;
				}
			}
			else
			{
				((EntityState)this).characterMotor.jumpCount = ((EntityState)this).characterBody.maxJumpCount;
			}
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterMotor.velocity = Vector3.zero;
			((EntityState)this).characterMotor.rootMotion = slipVector * (coeff * Time.fixedDeltaTime) * Mathf.Cos(((EntityState)this).fixedAge / duration * (MathF.PI / 2f));
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = slipVector;
			}
			if (!peepee && ((EntityState)this).fixedAge >= 0.4f * duration)
			{
				peepee = true;
				coeff = 4f;
				((EntityState)this).gameObject.layer = LayerIndex.defaultLayer.intVal;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			}
			if (((EntityState)this).fixedAge >= 0.55f * duration && ((EntityState)this).inputBank.moveVector != Vector3.zero)
			{
				((EntityState)this).GetModelAnimator().SetTrigger("shouldCancel");
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				if (NetworkServer.active)
				{
					((EntityState)this).characterBody.AddTimedBuff(Buffs.KillMoveSpeed, 0.25f);
					((EntityState)this).characterBody.AddTimedBuff(Buffs.KillMoveSpeed, 0.5f);
					((EntityState)this).characterBody.AddTimedBuff(Buffs.KillMoveSpeed, 0.75f);
				}
			}
			else
			{
				if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				((EntityState)this).inputBank.moveVector = Vector3.zero;
			}
		}

		public virtual void DampenVelocity()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.velocity *= 0.75f;
		}

		public override void OnExit()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			DampenVelocity();
			((EntityState)this).characterMotor.jumpCount = 0;
			base.OnExit();
			if (((EntityState)this).isAuthority && ((EntityState)this).inputBank.moveVector != Vector3.zero)
			{
				((EntityState)this).characterBody.isSprinting = true;
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			if (peepee)
			{
				return (InterruptPriority)0;
			}
			return (InterruptPriority)5;
		}
	}
}
namespace BelmontMod.SkillStates.Belmont.Whip
{
	public class Crack : BaseBelmontSkillState
	{
		public HurtBox targetHurtbox;

		public float damageCoefficient = 6f;

		public float baseDuration = 1.5f;

		private float duration;

		private bool hasFired = false;

		private bool hasPlayedSound = false;

		private float targetTimer;

		private Vector3 targetPosition
		{
			get
			{
				//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_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)targetHurtbox))
				{
					return ((Component)targetHurtbox).transform.position;
				}
				return ((BaseState)this).FindModelChild("WhipRTip").position;
			}
		}

		public override void OnEnter()
		{
			base.OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			belmont.PerformWhipCrack(duration);
			belmont.tracker.maxTrackingAngle = 45f;
			belmont.tracker.maxTrackingDistance = 40f;
			((EntityState)this).PlayCrossfade("Gesture, Override", "WhipCrack", "Whip.playbackRate", duration, 0.05f);
			Util.PlaySound("sfx_belmont_whip_foley_01", ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			base.OnExit();
			belmont.HideWhip();
			belmont.tracker.maxTrackingDistance = 40f;
			belmont.tracker.maxTrackingAngle = 20f;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((BaseState)this).StartAimMode(0.5f, false);
			if (!hasFired)
			{
				HurtBox trackingTarget = belmont.tracker.GetTrackingTarget();
				if (Object.op_Implicit((Object)(object)trackingTarget))
				{
					targetHurtbox = trackingTarget;
					targetTimer = 0.2f;
				}
				else
				{
					targetTimer -= Time.fixedDeltaTime;
					if (targetTimer <= 0f)
					{
						targetHurtbox = null;
					}
				}
			}
			if (!hasFired && ((EntityState)this).fixedAge >= 0.32f * duration)
			{
				hasFired = true;
				FireBlast();
				belmont.tracker.maxTrackingDistance = 40f;
				belmont.tracker.maxTrackingAngle = 30f;
				if (((EntityState)this).isAuthority)
				{
					float num = 6f / ((BaseState)this).attackSpeedStat;
					((BaseState)this).AddRecoil(-1f * num, -2f * num, -0.5f * num, 0.5f * num);
				}
			}
			if (!hasPlayedSound && ((EntityState)this).fixedAge >= 0.3f * duration)
			{
				hasPlayedSound = true;
				Util.PlaySound("sfx_belmont_whip_impact", ((EntityState)this).gameObject);
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void FireBlast()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				BlastAttack val = new BlastAttack();
				val.radius = 4f;
				val.procCoefficient = 1f;
				val.position = targetPosition;
				val.attacker = ((EntityState)this).gameObject;
				val.crit = ((BaseState)this).RollCrit();
				val.baseDamage = ((BaseState)this).damageStat * damageCoefficient;
				val.falloffModel = (FalloffModel)2;
				val.baseForce = 200f;
				val.bonusForce = Vector3.up * 50f;
				val.teamIndex = TeamComponent.GetObjectTeam(val.attacker);
				val.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
				val.attackerFiltering = (AttackerFiltering)2;
				EffectManager.SpawnEffect(BelmontAssets.whipImpactEffect, new EffectData
				{
					origin = targetPosition
				}, true);
				val.Fire();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0021: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).fixedAge >= duration * 0.7f)
			{
				return (InterruptPriority)0;
			}
			return (InterruptPriority)1;
		}
	}
	public class PivotSwing : BaseBelmontSkillState
	{
		public HurtBox targetHurtbox;

		public float cachedInput;

		public float baseDuration = 0.5f;

		private GameObject rotationPoint;

		private GameObject anchor;

		private float speed;

		private GameObject whip;

		private LineRenderer whipLine;

		private float animFloat;

		private GameObject rootEffectInstance;

		private float reelSpeed;

		public override void OnEnter()
		{
			//IL_0070: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			baseDuration = belmont.whipDuration;
			if (!Object.op_Implicit((Object)(object)targetHurtbox))
			{
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			reelSpeed = belmont.whipReelSpeed;
			Util.PlaySound("sfx_belmont_whip_latch", ((EntityState)this).gameObject);
			animFloat = 0f;
			float num = Vector3.Distance(((EntityState)this).transform.position, ((Component)targetHurtbox).transform.position);
			speed = ((EntityState)this).characterBody.baseMoveSpeed * Util.Remap(num, 0f, 28f, belmont.whipMinSpeed, belmont.whipMaxSpeed);
			((EntityState)this).PlayCrossfade("FullBody, Override Soft", "Swing", 0.05f);
			((EntityState)this).PlayCrossfade("FullBody, Override", "BufferEmpty", 0.02f);
			whip = ((Component)((BaseState)this).FindModelChild("WhipLLine")).gameObject;
			whipLine = whip.GetComponent<LineRenderer>();
			whipLine.SetPositions((Vector3[])(object)new Vector3[2]
			{
				whip.transform.position,
				whip.transform.position
			});
			whip.SetActive(true);
			belmont.isSwinging = true;
			((EntityState)this).characterDirection.turnSpeed = 2048f;
			SetupPoints();
		}

		private void SetupPoints()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0032: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			anchor = new GameObject("Anchor");
			rotationPoint = new GameObject("RotationPoint");
			rotationPoint.transform.position = ((EntityState)this).transform.position;
			anchor.transform.position = targetHurtbox.healthComponent.body.corePosition;
			anchor.transform.rotation = Util.QuaternionSafeLookRotation(((EntityState)this).transform.position - anchor.transform.position);
			rotationPoint.transform.rotation = Util.QuaternionSafeLookRotation(anchor.transform.position - ((EntityState)this).transform.position);
			rotationPoint.transform.SetParent(anchor.transform, true);
			rootEffectInstance = Object.Instantiate<GameObject>(BelmontAssets.whipRootEffect);
			rootEffectInstance.transform.SetParent(anchor.transform, false);
			rootEffectInstance.transform.localPosition = new Vector3(0f, -1f, 0f);
			rootEffectInstance.transform.rotation = Quaternion.identity;
			rootEffectInstance.transform.localScale = Vector3.one * 0.33f;
			string name = ((Object)((Component)targetHurtbox.healthComponent).gameObject).name;
			if (BelmontAssets.whipRootEffectScale.ContainsKey(name))
			{
				rootEffectInstance.transform.localScale = BelmontAssets.whipRootEffectScale[name];
			}
		}

		public override void OnExit()
		{
			base.OnExit();
			if (Object.op_Implicit((Object)(object)belmont))
			{
				belmont.isSwinging = false;
			}
			if (Object.op_Implicit((Object)(object)anchor))
			{
				EntityState.Destroy((Object)(object)anchor);
			}
			if (Object.op_Implicit((Object)(object)rotationPoint))
			{
				EntityState.Destroy((Object)(object)rotationPoint);
			}
			if (Object.op_Implicit((Object)(object)whip))
			{
				whip.SetActive(false);
			}
			((EntityState)this).characterDirection.turnSpeed = belmont.baseTurnSpeed;
			((EntityState)this).PlayCrossfade("FullBody, Override Soft", "SwingRelease", 0.05f);
		}

		private void UpdateRotation()
		{
			//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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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)
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				anchor.transform.position = targetHurtbox.healthComponent.body.corePosition + Vector3.up;
				Quaternion val = Quaternion.Euler(0f, speed * Time.fixedDeltaTime * cachedInput, 0f);
				anchor.transform.rotation = anchor.transform.rotation * val;
				rotationPoint.transform.position = Vector3.Lerp(rotationPoint.transform.position, anchor.transform.position, reelSpeed * Time.fixedDeltaTime);
				reelSpeed = Mathf.Lerp(reelSpeed, 0f, ((EntityState)this).fixedAge / baseDuration);
				if (reelSpeed <= 0f)
				{
					reelSpeed = 0f;
				}
			}
		}

		public override void Update()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			((EntityState)this).Update();
			((EntityState)this).characterBody.isSprinting = true;
			if (Object.op_Implicit((Object)(object)targetHurtbox) && Object.op_Implicit((Object)(object)anchor) && Object.op_Implicit((Object)(object)rotationPoint))
			{
				whipLine.SetPositions((Vector3[])(object)new Vector3[2]
				{
					whip.transform.position,
					anchor.transform.position - Vector3.up
				});
			}
		}

		private void UpdateAnimator()
		{
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				animFloat = Mathf.Lerp(animFloat, 0f - cachedInput, belmont.swingAnimSpeed * Time.fixedDeltaTime);
				modelAnimator.SetFloat("dashR", animFloat);
			}
		}

		private void UpdatePlayerRotation()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			Vector3 moveVector = anchor.transform.position - ((EntityState)this).transform.position;
			((EntityState)this).characterDirection.moveVector = moveVector;
		}

		public override void FixedUpdate()
		{
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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)
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.isSprinting = true;
			((EntityState)this).characterBody.aimTimer = -1f;
			if (Object.op_Implicit((Object)(object)targetHurtbox) && Object.op_Implicit((Object)(object)anchor) && Object.op_Implicit((Object)(object)rotationPoint))
			{
				if (((EntityState)this).isAuthority)
				{
					UpdateRotation();
					UpdatePlayerRotation();
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPosition(rotationPoint.transform.position, false);
				}
				whipLine.SetPositions((Vector3[])(object)new Vector3[2]
				{
					whip.transform.position,
					anchor.transform.position
				});
				UpdateAnimator();
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= baseDuration && !((EntityState)this).inputBank.skill3.down)
			{
				UpdateRotation();
				Vector3 val = rotationPoint.transform.position - ((EntityState)this).transform.position;
				((EntityState)this).outer.SetNextState((EntityState)(object)new Falling
				{
					overrideVelocity = val * speed * 0.25f
				});
			}
		}
	}
	public class PreDash : BaseBelmontSkillState
	{
		public float baseDuration = 0.15f;

		protected Vector3 slipVector = Vector3.zero;

		public float duration = 0.15f;

		private Vector3 cachedForward;

		private HurtBox targetHurtbox;

		private GameObject whip;

		private LineRenderer whipLine;

		private float cachedInput;

		public override void OnEnter()
		{
			//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_0065: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//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_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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00e0: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: 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_0200: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			duration = baseDuration;
			if (Object.op_Implicit((Object)(object)belmont.tracker.GetTrackingTarget()))
			{
				duration = 0.3f;
			}
			Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
			slipVector = ((Vector3)(ref val)).normalized;
			cachedForward = ((EntityState)this).characterDirection.forward;
			targetHurtbox = belmont.tracker.GetTrackingTarget();
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				Vector3 moveVector = ((Component)targetHurtbox).transform.position - ((EntityState)this).transform.position;
				((EntityState)this).characterDirection.moveVector = moveVector;
			}
			Vector3 val2 = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.moveVector : slipVector);
			Vector3 val3 = Vector3.Cross(Vector3.up, val2);
			float num = Vector3.Dot(slipVector, val2);
			float num2 = Vector3.Dot(slipVector, val3);
			modelAnimator.SetFloat("dashF", num);
			modelAnimator.SetFloat("dashR", num2);
			if (num2 > 0f)
			{
				cachedInput = -1f;
			}
			else
			{
				cachedInput = 1f;
			}
			whip = ((Component)((BaseState)this).FindModelChild("WhipLLine")).gameObject;
			whipLine = whip.GetComponent<LineRenderer>();
			whipLine.SetPositions((Vector3[])(object)new Vector3[2]
			{
				whip.transform.position,
				whip.transform.position
			});
			whip.SetActive(true);
			ApplyBuff();
			CreateDashEffect();
			((EntityState)this).characterDirection.moveVector = slipVector;
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				Util.PlaySound("sfx_belmont_whip_swing", ((EntityState)this).gameObject);
				((EntityState)this).PlayAnimation("FullBody, Override", "DashTarget", "Dash.playbackRate", duration * 2f, 0f);
			}
			else
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "Dash", "Dash.playbackRate", duration * 4f, 0f);
			}
		}

		public virtual void ApplyBuff()
		{
		}

		public virtual void CreateDashEffect()
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			EffectData val = new EffectData();
			val.rotation = Util.QuaternionSafeLookRotation(slipVector);
			val.origin = ((EntityState)this).characterBody.corePosition;
			EffectManager.SpawnEffect(BelmontAssets.dashEffect, val, false);
			float num = 3f;
			if (((EntityState)this).isAuthority)
			{
				((BaseState)this).AddRecoil(-1f * num, -2f * num, -0.5f * num, 0.5f * num);
			}
			Transform val2 = belmont.childLocator.FindChild("JetL");
			Transform val3 = belmont.childLocator.FindChild("JetR");
			if (Object.op_Implicit((Object)(object)val2))
			{
				Object.Instantiate<GameObject>(BelmontAssets.jetEffect, val2);
			}
			if (Object.op_Implicit((Object)(object)val3))
			{
				Object.Instantiate<GameObject>(BelmontAssets.jetEffect, val3);
			}
		}

		private void UpdateWhipEffect()
		{
			//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_0041: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				whipLine.SetPositions((Vector3[])(object)new Vector3[2]
				{
					whip.transform.position,
					Vector3.Lerp(whip.transform.position, ((Component)targetHurtbox).transform.position, Util.Remap(((EntityState)this).fixedAge, 0f, duration, 0f, 1f))
				});
			}
		}

		public override void Update()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			((EntityState)this).characterBody.isSprinting = true;
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				Vector3 moveVector = ((Component)targetHurtbox).transform.position - ((EntityState)this).transform.position;
				((EntityState)this).characterDirection.moveVector = moveVector;
			}
		}

		public override void FixedUpdate()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.isSprinting = true;
			((EntityState)this).characterMotor.velocity = slipVector * ((BaseState)this).moveSpeedStat * belmont.dashSpeed * Time.fixedDeltaTime;
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				Vector3 moveVector = ((Component)targetHurtbox).transform.position - ((EntityState)this).transform.position;
				((EntityState)this).characterDirection.moveVector = moveVector;
			}
			UpdateWhipEffect();
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = cachedForward;
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				if (Object.op_Implicit((Object)(object)targetHurtbox))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new PivotSwing
					{
						targetHurtbox = targetHurtbox,
						cachedInput = cachedInput
					});
				}
				else
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public virtual void DampenVelocity()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.velocity *= 0.8f;
		}

		public override void OnExit()
		{
			DampenVelocity();
			base.OnExit();
		}

		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)5;
		}
	}
	public class PrepThrow : BaseBelmontSkillState
	{
		public HurtBox target;

		private GameObject rootEffectInstance;

		public override void OnEnter()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			target = belmont.tracker.GetTrackingTarget();
			belmont.lockOnTarget = ((Component)belmont.tracker.GetTrackingTarget()).gameObject;
			rootEffectInstance = Object.Instantiate<GameObject>(BelmontAssets.whipRootEffect);
			rootEffectInstance.transform.SetParent(((Component)target).transform, false);
			rootEffectInstance.transform.localPosition = new Vector3(0f, -1f, 0f);
			rootEffectInstance.transform.rotation = Quaternion.identity;
			rootEffectInstance.transform.localScale = Vector3.one * 0.33f;
			string name = ((Object)((Component)target.healthComponent).gameObject).name;
			if (BelmontAssets.whipRootEffectScale.ContainsKey(name))
			{
				rootEffectInstance.transform.localScale = BelmontAssets.whipRootEffectScale[name];
			}
		}

		public override void OnExit()
		{
			base.OnExit();
			belmont.lockOnTarget = null;
			if (Object.op_Implicit((Object)(object)rootEffectInstance))
			{
				EntityState.Destroy((Object)(object)rootEffectInstance);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!((EntityState)this).inputBank.skill2.down && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ThrowTarget());
			}
		}
	}
	public class ThrowTarget : BaseBelmontSkillState
	{
		public float baseDuration = 0.2f;

		private float duration;

		public override void OnEnter()
		{
			base.OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			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)1;
		}
	}
}
namespace BelmontMod.SkillStates.Belmont.Subweapon
{
	public class BaseAimState : BaseBelmontSkillState
	{
		public CameraParamsOverrideHandle camParamsOverrideHandle;

		private GameObject flaskInstance;

		public override void OnEnter()
		{
			//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_0094: 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)
			base.OnEnter();
			PlayAnim();
			if (!((CameraParamsOverrideHandle)(ref camParamsOverrideHandle)).isValid)
			{
				camParamsOverrideHandle = CameraParams.OverrideCameraParams(((EntityState)this).cameraTargetParams, BelmontCameraParams.AIM);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.Slow50);
			}
			flaskInstance = Object.Instantiate<GameObject>(BelmontAssets.holyWater);
			flaskInstance.transform.SetParent(belmont.childLocator.FindChild("Weapon"), false);
			flaskInstance.transform.localPosition = Vector3.zero;
			flaskInstance.transform.localRotation = Quaternion.identity;
		}

		protected virtual void PlayAnim()
		{
			((EntityState)this).PlayCrossfade("Gesture, Override", "Aim", 0.05f);
			((EntityState)this).PlayCrossfade("AimPitch", "AimPitchAiming", 0.05f);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			((EntityState)this).characterBody.isSprinting = false;
			((EntityState)this).characterBody.SetAimTimer(0.2f);
			if (((EntityState)this).inputBank.skill2.down && ((EntityState)this).isAuthority && ((EntityState)this).fixedAge > 0.05f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (((EntityState)this).inputBank.skill1.down && ((EntityState)this).isAuthority && ((EntityState)this).fixedAge > 0.05f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new BaseThrowState());
			}
		}

		public override void OnExit()
		{
			//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)
			base.OnExit();
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camParamsOverrideHandle, 0.2f);
			((EntityState)this).PlayCrossfade("AimPitch", "AimPitch", 0.1f);
			if (Object.op_Implicit((Object)(object)flaskInstance))
			{
				EntityState.Destroy((Object)(object)flaskInstance);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.Slow50);
			}
		}

		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 BaseThrowState : GenericProjectileBaseState
	{
		public override void OnEnter()
		{
			((GenericProjectileBaseState)this).OnEnter();
			base.baseDuration = 0.8f;
			base.duration = base.baseDuration / ((BaseState)this).attackSpeedStat;
			base.damageCoefficient = 5f;
			((EntityState)this).PlayAnimation("Gesture, Override", "Throw", "Action.playbackRate", base.duration, 0f);
			((GenericProjectileBaseState)this).FireProjectile();
		}

		public override void FireProjectile()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			base.firedProjectile = true;
			if (((EntityState)this).isAuthority)
			{
				Ray val = ((BaseState)this).GetAimRay();
				val = ((GenericProjectileBaseState)this).ModifyProjectileAimRay(val);
				((Ray)(ref val)).direction = Util.ApplySpread(((Ray)(ref val)).direction, base.minSpread, base.maxSpread, 1f, 1f, 0f, base.projectilePitchBonus);
				ProjectileManager.instance.FireProjectile(Projectiles.holyWaterFlaskProjectile, ((Ray)(ref val)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref val)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * base.damageCoefficient, base.force, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, 50f);
			}
		}

		public override void FixedUpdate()
		{
			((GenericProjectileBaseState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= base.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;
		}
	}
}
namespace BelmontMod.SkillStates.Belmont.Melee
{
	public class Slash : BaseMeleeAttack
	{
		private bool bladeHidden = true;

		private GameObject swingEffectInstance;

		public override void OnEnter()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			ValidateControllerReference();
			if (Object.op_Implicit((Object)(object)belmont) && Object.op_Implicit((Object)(object)belmont.tracker) && Object.op_Implicit((Object)(object)belmont.tracker.GetTrackingTarget()))
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector3 searchOrigin = ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 1.5f;
				bool flag = false;
				BullseyeSearch val = new BullseyeSearch
				{
					teamMaskFilter = TeamMask.GetEnemyTeams(((BaseState)this).GetTeam()),
					filterByLoS = false,
					searchOrigin = searchOrigin,
					searchDirection = Random.onUnitSphere,
					sortMode = (SortMode)1,
					maxDistanceFilter = 6f,
					maxAngleFilter = 360f
				};
				val.RefreshCandidates();
				val.FilterOutGameObject(((EntityState)this).gameObject);
				List<HurtBox> list = val.GetResults().ToList();
				if (list.Count > 0)
				{
					flag = true;
				}
				if (Vector3.Distance(((Component)belmont.tracker.GetTrackingTarget().healthComponent).transform.position, ((EntityState)this).transform.position) >= 8f && !flag)
				{
					hasFired = true;
					((EntityState)this).outer.SetNextState((EntityState)(object)new Crack
					{
						targetHurtbox = belmont.tracker.GetTrackingTarget()
					});
					return;
				}
			}
			hitboxName = "Blade";
			if (belmont.swordActiveTimer > 0f)
			{
				swingIndex = Random.Range(0, 5);
			}
			else
			{
				swingIndex = Random.Range(0, 1);
			}
			damageCoefficient = 3.5f;
			pushForce = 200f;
			baseDuration = 0.95f;
			baseEarlyExitTime = 0.525f;
			attackRecoil = 2f / ((BaseState)this).attackSpeedStat;
			hitHopVelocity = 6f;
			attackStartTime = 0.175f;
			attackEndTime = 0.25f;
			hitStopDuration = 0.06f;
			smoothHitstop = true;
			swingSoundString = "sfx_belmont_swing_sword";
			hitSoundString = "";
			impactSound = BelmontAssets.swordImpactSoundEvent.index;
			hitEffectPrefab = BelmontAssets.slashImpactEffect;
			swingEffectPrefab = BelmontAssets.swingEffect;
			damageType = (DamageType)0;
			switch (swingIndex)
			{
			case 0:
				muzzleString = "SwingBlade1";
				break;
			case 1:
				muzzleString = "SwingBlade2";
				break;
			case 2:
				muzzleString = "SwingBlade3";
				break;
			case 3:
				muzzleString = "SwingBlade4";
				break;
			case 4:
				muzzleString = "SwingBlade5";
				break;
			}
			base.OnEnter();
			if (belmont.swordActiveTimer > 0f)
			{
				bladeHidden = false;
				((Component)((BaseState)this).FindModelChild("BladeModel")).gameObject.SetActive(true);
				((Component)((BaseState)this).FindModelChild("BladeSheathedModel")).gameObject.SetActive(false);
			}
			belmont.swordActiveTimer = duration;
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (stopwatch >= 0.85f * duration && !bladeHidden)
			{
				bladeHidden = true;
				((Component)((BaseState)this).FindModelChild("BladeModel")).gameObject.SetActive(false);
				((Component)((BaseState)this).FindModelChild("BladeSheathedModel")).gameObject.SetActive(true);
			}
		}

		public override void OnExit()
		{
			if (!bladeHidden)
			{
				bladeHidden = true;
				((Component)((BaseState)this).FindModelChild("BladeModel")).gameObject.SetActive(false);
				((Component)((BaseState)this).FindModelChild("BladeSheathedModel")).gameObject.SetActive(true);
			}
			base.OnExit();
		}

		protected override void FireAttack()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector3 direction = ((Ray)(ref aimRay)).direction;
				direction.y = Mathf.Max(direction.y, direction.y * 0.5f);
				((BaseState)this).FindModelChild("MeleePivot").rotation = Util.QuaternionSafeLookRotation(direction);
			}
			base.FireAttack();
		}

		protected override void PlaySwingEffect()
		{
			bladeHidden = false;
			((Component)((BaseState)this).FindModelChild("BladeModel")).gameObject.SetActive(true);
			((Component)((BaseState)this).FindModelChild("BladeSheathedModel")).gameObject.SetActive(false);
			Util.PlaySound(swingSoundString, ((EntityState)this).gameObject);
			if (!Object.op_Implicit((Object)(object)swingEffectPrefab))
			{
				return;
			}
			Transform val = ((BaseState)this).FindModelChild(muzzleString);
			if (Object.op_Implicit((Object)(object)val))
			{
				swingEffectInstance = Object.Instantiate<GameObject>(swingEffectPrefab, val);
				ScaleParticleSystemDuration component = swingEffectInstance.GetComponent<ScaleParticleSystemDuration>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.newDuration = component.initialDuration;
				}
			}
		}

		protected override void TriggerHitStop()
		{
			base.TriggerHitStop();
			if (Object.op_Implicit((Object)(object)swingEffectInstance))
			{
				ScaleParticleSystemDuration component = swingEffectInstance.GetComponent<ScaleParticleSystemDuration>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.newDuration = 20f;
				}
			}
		}

		protected override void ClearHitStop()
		{
			base.ClearHitStop();
			if (Object.op_Implicit((Object)(object)swingEffectInstance))
			{
				ScaleParticleSystemDuration component = swingEffectInstance.GetComponent<ScaleParticleSystemDuration>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.newDuration = component.initialDuration;
				}
			}
		}

		protected override void PlayAttackAnimation()
		{
			((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), "Slash.playbackRate", duration, 0.1f);
		}

		protected override void SetNextState()
		{
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0021: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			if (stopwatch >= 0.5f * duration)
			{
				return (InterruptPriority)0;
			}
			return (InterruptPriority)2;
		}
	}
}
namespace BelmontMod.SkillStates.BaseStates
{
	public class BaseMeleeAttack : BaseBelmontSkillState
	{
		public int swingIndex;

		protected string hitboxName = "Sword";

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient = 3.5f;

		protected float procCoefficient = 1f;

		protected float pushForce = 300f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float baseDuration = 1f;

		protected float attackStartTime = 0.2f;

		protected float attackEndTime = 0.4f;

		protected float baseEarlyExitTime = 0.4f;

		protected float hitStopDuration = 0.012f;

		protected float attackRecoil = 0.75f;

		protected float hitHopVelocity = 4f;

		protected bool smoothHitstop = false;

		protected bool isCrit;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab;

		protected NetworkSoundEventIndex impactSound;

		protected float earlyExitTime;

		public float duration;

		protected bool hasFired;

		private float hitPauseTimer;

		protected OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		protected HitStopCachedState hitStopCachedState;

		protected Vector3 storedVelocity;

		protected List<HurtBox> hitResults = new List<HurtBox>();

		public override void OnEnter()
		{
			isCrit = Util.CheckRoll(((EntityState)this).characterBody.crit, 0f, (CharacterMaster)null);
			base.OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			earlyExitTime = baseEarlyExitTime;
			hasFired = false;
			animator = ((EntityState)this).GetModelAnimator();
			((BaseState)this).StartAimMode(0.5f + duration, false);
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			PlayAttackAnimation();
			InitializeAttack();
		}

		protected virtual void InitializeAttack()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_007d: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			attack = new OverlapAttack();
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = isCrit;
			attack.impactSound = impactSound;
		}

		protected virtual void FireShuriken()
		{
			PrimarySkillShurikenBehavior component = ((EntityState)this).GetComponent<PrimarySkillShurikenBehavior>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.OnSkillActivated(((EntityState)this).skillLocator.primary);
			}
		}

		protected virtual void PlayAttackAnimation()
		{
			((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), "Slash.playbackRate", duration, 0.05f);
		}

		public override void OnExit()
		{
			if (!hasFired)
			{
				FireAttack();
			}
			if (inHitPause)
			{
				ClearHitStop();
			}
			base.OnExit();
		}

		protected virtual void PlaySwingEffect()
		{
			EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
		}

		protected virtual void OnHitEnemyAuthority(int amount)
		{
			Util.PlaySound(hitSoundString, ((EntityState)this).gameObject);
			if (!hasHopped)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity);
				}
				hasHopped = true;
			}
			if (!inHitPause)
			{
				TriggerHitStop();
			}
		}

		protected virtual void TriggerHitStop()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			storedVelocity = ((EntityState)this).characterMotor.velocity;
			hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate");
			hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
			inHitPause = true;
		}

		protected virtual void FireAttack()
		{
			if (!hasFired)
			{
				hasFired = true;
				Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
				PlaySwingEffect();
				if (((EntityState)this).isAuthority)
				{
					((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
				}
			}
			if (((EntityState)this).isAuthority)
			{
				hitResults.Clear();
				if (attack.Fire(hitResults))
				{
					OnHitEnemyAuthority(hitResults.Count);
				}
			}
		}

		protected virtual void SetNextState()
		{
			int num = ((swingIndex == 0) ? 1 : 0);
			((EntityState)this).outer.SetNextState((EntityState)(object)new BaseMeleeAttack
			{
				swingIndex = num
			});
		}

		public override void FixedUpdate()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				ClearHitStop();
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Slash.playbackRate", 0f);
				}
			}
			if (stopwatch >= duration * attackStartTime && stopwatch <= duration * attackEndTime)
			{
				FireAttack();
			}
			if (((EntityState)this).fixedAge >= duration * earlyExitTime && ((EntityState)this).isAuthority && ((EntityState)this).inputBank.skill1.down)
			{
				if (!hasFired)
				{
					FireAttack();
				}
				SetNextState();
			}
			else if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		protected virtual void ClearHitStop()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
			inHitPause = false;
			((EntityState)this).characterMotor.velocity = storedVelocity;
		}

		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)1;
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			swingIndex = reader.ReadInt32();
		}
	}
}
namespace BelmontMod.Content
{
	public class BelmontTrackingSkillDef : SkillDef
	{
		protected class InstanceData : BaseSkillInstanceData
		{
			public BelmontTracker tracker;
		}

		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			return (BaseSkillInstanceData)(object)new InstanceData
			{
				tracker = ((Component)skillSlot).GetComponent<BelmontTracker>()
			};
		}

		private static bool HasTarget([NotNull] GenericSkill skillSlot)
		{
			BelmontTracker tracker = ((InstanceData)(object)skillSlot.skillInstanceData).tracker;
			return Object.op_Implicit((Object)(object)(((Object)(object)tracker != (Object)null) ? tracker.GetTrackingTarget() : null));
		}

		public override bool CanExecute([NotNull] GenericSkill skillSlot)
		{
			return HasTarget(skillSlot) && ((SkillDef)this).CanExecute(skillSlot);
		}

		public override bool IsReady([NotNull] GenericSkill skillSlot)
		{
			return ((SkillDef)this).IsReady(skillSlot) && HasTarget(skillSlot);
		}
	}
	public class BullseyeSearch2
	{
		private struct CandidateInfo
		{
			[StructLayout(LayoutKind.Sequential, Size = 1)]
			public struct EntityEqualityComparer : IEqualityComparer<CandidateInfo>
			{
				public bool Equals(CandidateInfo a, CandidateInfo b)
				{
					return (Object)(object)a.hurtBox.healthComponent == (Object)(object)b.hurtBox.healthComponent;
				}

				public int GetHashCode(CandidateInfo obj)
				{
					return ((object)obj.hurtBox.healthComponent).GetHashCode();
				}
			}

			public HurtBox hurtBox;

			public Vector3 position;

			public float dot;

			public float distanceSqr;
		}

		public enum SortMode
		{
			None,
			Distance,
			Angle,
			DistanceAndAngle
		}

		private delegate CandidateInfo Selector(HurtBox hurtBox);

		public CharacterBody viewer;

		public bool onlyBullseyes;

		public Vector3 searchOrigin;

		public Vector3 searchDirection;

		private float minThetaDot = -1f;

		private float maxThetaDot = 1f;

		public float minDistanceFilter;

		public float maxDistanceFilter = float.PositiveInfinity;

		public TeamMask teamMaskFilter = TeamMask.allButNeutral;

		public bool filterByLoS = true;

		public bool filterByDistinctEntity;

		public QueryTriggerInteraction queryTriggerInteraction;

		public SortMode sortMode = SortMode.Distance;

		private IEnumerable<CandidateInfo> candidatesEnumerable;

		public float minAngleFilter
		{
			set
			{
				maxThetaDot = Mathf.Cos(Mathf.Clamp(value, 0f, 180f) * (MathF.PI / 180f));
			}
		}

		public float maxAngleFilter
		{
			set
			{
				minThetaDot = Mathf.Cos(Mathf.Clamp(value, 0f, 180f) * (MathF.PI / 180f));
			}
		}

		private bool filterByDistance => minDistanceFilter > 0f || maxDistanceFilter < float.PositiveInfinity || (Object.op_Implicit((Object)(object)viewer) && viewer.visionDistance < float.PositiveInfinity);

		private bool filterByAngle => minThetaDot > -1f || maxThetaDot < 1f;

		private Func<HurtBox, CandidateInfo> GetSelector()
		{
			bool getDot = filterByAngle;
			bool getDistanceSqr = filterByDistance;
			getDistanceSqr |= sortMode == SortMode.Distance || sortMode == SortMode.DistanceAndAngle;
			getDot |= sortMode == SortMode.Angle || sortMode == SortMode.DistanceAndAngle;
			bool getDifference = getDot || getDistanceSqr;
			bool getPosition = getDot || getDistanceSqr || filterByLoS;
			return delegate(HurtBox hurtBox)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
				CandidateInfo candidateInfo = default(CandidateInfo);
				candidateInfo.hurtBox = hurtBox;
				CandidateInfo result = candidateInfo;
				if (getPosition)
				{
					result.position = ((Component)hurtBox).transform.position;
				}
				Vector3 val = default(Vector3);
				if (getDifference)
				{
					val = result.position - searchOrigin;
				}
				if (getDot)
				{
					result.dot = Vector3.Dot(searchDirection, ((Vector3)(ref val)).normalized);
				}
				if (getDistanceSqr)
				{
					result.distanceSqr = ((Vector3)(ref val)).sqrMagnitude;
				}
				return result;
			};
		}

		public void RefreshCandidates()
		{
			Func<HurtBox, CandidateInfo> selector = GetSelector();
			if (onlyBullseyes)
			{
				candidatesEnumerable = HurtBox.readOnlyBullseyesList.Where((HurtBox hurtBox) => ((TeamMask)(ref teamMaskFilter)).HasTeam(hurtBox.teamIndex)).Select(selector);
			}
			else
			{
				candidatesEnumerable = MainPlugin.hurtboxesList.Where((HurtBox hurtBox) => ((TeamMask)(ref teamMaskFilter)).HasTeam(hurtBox.teamIndex)).Select(selector);
			}
			if (filterByAngle)
			{
			}
			if (filterByDistance)
			{
				candidatesEnumerable = candidatesEnumerable.Where((CandidateInfo v) => Vector3.Distance(searchOrigin, ((Component)v.hurtBox).transform.position) <= maxDistanceFilter);
			}
			if (filterByDistinctEntity)
			{
				candidatesEnumerable = candidatesEnumerable.Distinct(default(CandidateInfo.EntityEqualityComparer));
			}
			Func<CandidateInfo, float> sorter = GetSorter();
			if (sorter != null)
			{
				candidatesEnumerable = candidatesEnumerable.OrderBy(sorter);
			}
		}

		private Func<CandidateInfo, float> GetSorter()
		{
			return sortMode switch
			{
				SortMode.Distance => (CandidateInfo candidateInfo) => candidateInfo.distanceSqr, 
				SortMode.Angle => (CandidateInfo candidateInfo) => 0f - candidateInfo.dot, 
				SortMode.DistanceAndAngle => (CandidateInfo candidateInfo) => (0f - candidateInfo.dot) * candidateInfo.distanceSqr, 
				_ => null, 
			};
		}

		public void FilterCandidatesByHealthFraction(float minHealthFraction = 0f, float maxHealthFraction = 1f)
		{
			if (minHealthFraction > 0f)
			{
				if (maxHealthFraction < 1f)
				{
					candidatesEnumerable = candidatesEnumerable.Where(delegate(CandidateInfo v)
					{
						float combinedHealthFraction = v.hurtBox.healthComponent.combinedHealthFraction;
						return combinedHealthFraction >= minHealthFraction && combinedHealthFr