Decompiled source of KrisMod v1.0.1

plugins/KrisMod/KrisMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using KinematicCharacterController;
using KrisMod.Components;
using KrisMod.Content;
using KrisMod.Modules;
using KrisMod.SkillStates;
using Microsoft.CodeAnalysis;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ConVar;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("KrisMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c2dd7d3c5e80eb8d38d5346d493d21db723761cf")]
[assembly: AssemblyProduct("Kris (DELTARUNE) Survivor")]
[assembly: AssemblyTitle("KrisMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace KrisMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.deltarune.KrisMod", "KrisMod", "1.0.1")]
	public class KrisPlugin : BaseUnityPlugin
	{
		public const string Author = "deltarune";

		public const string ModName = "KrisMod";

		public const string Guid = "com.deltarune.KrisMod";

		public const string Version = "1.0.1";

		public static KrisPlugin Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Log.Info("Kris is waking up.");
			KrisAssets.Init();
			Sounds.Init();
			Tokens.Init();
			Buffs.Init();
			KrisSkills.RegisterEntityStates();
			KrisBody.Init();
			KrisDiagnostics.Init();
			KrisMenuSounds.Spawn();
			Log.Info("Kris is ready. It's what they call \"you.\"");
		}
	}
}
namespace KrisMod.SkillStates
{
	public abstract class BaseKrisState : BaseSkillState
	{
		protected TensionController tension;

		private bool facingLocked;

		private string ownedPose;

		private string ownedGesture;

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

		private Animator cachedAnimator;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			tension = ((EntityState)this).GetComponent<TensionController>();
		}

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

		private Transform TakeFacing(Vector3 direction, out Vector3 flat)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			flat = Vector3.zero;
			if ((Object)(object)((EntityState)this).characterDirection == (Object)null)
			{
				return null;
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(direction.x, 0f, direction.z);
			if (((Vector3)(ref val)).sqrMagnitude < 0.001f)
			{
				return null;
			}
			flat = ((Vector3)(ref val)).normalized;
			if (!facingLocked)
			{
				facingLocked = true;
				FacingLock.Take(((EntityState)this).characterDirection);
			}
			Transform val2 = ((EntityState)this).characterDirection.targetTransform;
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((EntityState)this).GetModelBaseTransform();
			}
			return val2;
		}

		protected void LockFacing(Vector3 direction)
		{
			//IL_0001: 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_0016: 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)
			Vector3 flat;
			Transform val = TakeFacing(direction, out flat);
			if (!((Object)(object)val == (Object)null))
			{
				val.rotation = Quaternion.LookRotation(flat);
				((EntityState)this).characterDirection.forward = flat;
			}
		}

		protected void TrackFacing(Vector3 direction, float degreesPerSecond = 720f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector3 flat;
			Transform val = TakeFacing(direction, out flat);
			if (!((Object)(object)val == (Object)null))
			{
				val.rotation = Quaternion.RotateTowards(val.rotation, Quaternion.LookRotation(flat), degreesPerSecond * Time.fixedDeltaTime);
				((EntityState)this).characterDirection.forward = flat;
			}
		}

		protected void ReleaseFacing()
		{
			if (facingLocked)
			{
				FacingLock.Give(((EntityState)this).characterDirection);
				facingLocked = false;
			}
		}

		protected void PlayPose(string state, float crossfade = 0.08f, string fallback = null)
		{
			Animator krisAnimator = GetKrisAnimator();
			if ((Object)(object)krisAnimator == (Object)null || string.IsNullOrEmpty(state))
			{
				return;
			}
			int num = krisAnimator.GetLayerIndex("Base Layer");
			if (num < 0)
			{
				num = 0;
			}
			if (!krisAnimator.HasState(num, Animator.StringToHash(state)))
			{
				KrisAnimations.ReportOnce(state, "animator has no pose '" + state + "'" + (string.IsNullOrEmpty(fallback) ? "" : (" - wearing '" + fallback + "' instead")));
				if (!string.IsNullOrEmpty(fallback) && !(fallback == state))
				{
					PlayPose(fallback, crossfade);
				}
				return;
			}
			ownedPose = state;
			krisAnimator.CrossFadeInFixedTime(state, crossfade, num);
			KrisLocomotion component = ((EntityState)this).GetComponent<KrisLocomotion>();
			if ((Object)(object)component != (Object)null)
			{
				component.SkillPosed();
			}
			ApplyWeaponsFor(state);
		}

		private void ApplyWeaponsFor(string pose)
		{
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (!((Object)(object)modelTransform == (Object)null))
			{
				KrisModelEnforcer component = ((Component)modelTransform).GetComponent<KrisModelEnforcer>();
				if ((Object)(object)component != (Object)null)
				{
					component.WantWeapons(KrisAnimations.ShowsSword(pose), KrisAnimations.ShowsShield(pose));
				}
			}
		}

		protected void ReleasePose()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(ownedPose))
			{
				return;
			}
			Animator krisAnimator = GetKrisAnimator();
			if (!((Object)(object)krisAnimator == (Object)null))
			{
				int num = krisAnimator.GetLayerIndex("Base Layer");
				if (num < 0)
				{
					num = 0;
				}
				AnimatorStateInfo val = (krisAnimator.IsInTransition(num) ? krisAnimator.GetNextAnimatorStateInfo(num) : krisAnimator.GetCurrentAnimatorStateInfo(num));
				if (((AnimatorStateInfo)(ref val)).shortNameHash == Animator.StringToHash(ownedPose))
				{
					PlayIdle();
				}
			}
		}

		protected void PlayGesture(string state, float crossfade = 0.05f, string fallback = null)
		{
			Animator krisAnimator = GetKrisAnimator();
			if ((Object)(object)krisAnimator == (Object)null || string.IsNullOrEmpty(state))
			{
				return;
			}
			int layerIndex = krisAnimator.GetLayerIndex("Gesture");
			KrisLocomotion component = ((EntityState)this).GetComponent<KrisLocomotion>();
			if (layerIndex < 0 || (Object)(object)component == (Object)null || !krisAnimator.HasState(layerIndex, Animator.StringToHash(state)))
			{
				KrisAnimations.ReportOnce("gesture " + state, "animator has no '" + state + "' on layer 'Gesture' - playing it whole-body; Kris stops moving their legs to swing");
				PlayPose(state, crossfade, fallback);
				return;
			}
			if (krisAnimator.GetLayerWeight(layerIndex) < 0.01f)
			{
				krisAnimator.Play(state, layerIndex, 0f);
			}
			else
			{
				krisAnimator.CrossFadeInFixedTime(state, crossfade, layerIndex, 0f);
			}
			component.FadeGesture(layerIndex, 1f, crossfade);
			ownedGesture = state;
			ApplyWeaponsFor(state);
		}

		protected void ReleaseGesture(float fade = 0.15f)
		{
			//IL_005a: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			ReleasePose();
			if (string.IsNullOrEmpty(ownedGesture))
			{
				return;
			}
			Animator krisAnimator = GetKrisAnimator();
			KrisLocomotion component = ((EntityState)this).GetComponent<KrisLocomotion>();
			if ((Object)(object)krisAnimator == (Object)null || (Object)(object)component == (Object)null)
			{
				return;
			}
			int layerIndex = krisAnimator.GetLayerIndex("Gesture");
			if (layerIndex >= 0)
			{
				AnimatorStateInfo val = (krisAnimator.IsInTransition(layerIndex) ? krisAnimator.GetNextAnimatorStateInfo(layerIndex) : krisAnimator.GetCurrentAnimatorStateInfo(layerIndex));
				if (((AnimatorStateInfo)(ref val)).shortNameHash == Animator.StringToHash(ownedGesture))
				{
					component.FadeGesture(layerIndex, 0f, fade);
				}
			}
		}

		protected void SetPoseSpeed(float speed)
		{
			Animator krisAnimator = GetKrisAnimator();
			if (!((Object)(object)krisAnimator == (Object)null) && !((Object)(object)krisAnimator.runtimeAnimatorController == (Object)null))
			{
				krisAnimator.SetFloat(SpeedParameterHash, speed);
			}
		}

		protected Animator GetKrisAnimator()
		{
			if ((Object)(object)cachedAnimator != (Object)null)
			{
				return cachedAnimator;
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if ((Object)(object)modelTransform == (Object)null)
			{
				return null;
			}
			Transform val = KrisModelEnforcer.FindCustom(modelTransform);
			cachedAnimator = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInChildren<Animator>(true) : ((EntityState)this).GetModelAnimator());
			return cachedAnimator;
		}

		protected void PlayIdle(float crossfade = 0.12f)
		{
			PlayPose("Idle", crossfade);
		}

		protected Vector3 SoulOrigin()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("Chest");
			if (!((Object)(object)val != (Object)null))
			{
				if (!((Object)(object)((EntityState)this).characterBody != (Object)null))
				{
					return ((EntityState)this).transform.position;
				}
				return ((EntityState)this).characterBody.corePosition;
			}
			return val.position;
		}
	}
	internal static class KrisAnimations
	{
		internal const string BaseLayer = "Base Layer";

		internal const string GestureLayer = "Gesture";

		internal const string BraceLayer = "Brace";

		internal const string ModelObject = "KrisCustomModel";

		internal const string Idle = "Idle";

		internal const string SelectIntro = "SelectIntro";

		internal const string Select = "Select";

		internal const string SlashA = "SlashA";

		internal const string SlashB = "SlashB";

		internal const string Defend = "Defend";

		internal const string SoulAim = "SoulAim";

		internal const string SoulBrace = "SoulBrace";

		internal const string SoulThrow = "SoulThrow";

		internal const string SoulPull = "SoulPull";

		internal const string SoulSlash = "SoulSlash";

		internal const string Act = "Act";

		internal const string ActEnd = "ActEnd";

		internal const string XSlash = "XSlash";

		internal const string Pirouette = "Pirouette";

		internal const string SpeedParameter = "SlashSpeed";

		internal const string MoveXParameter = "MoveX";

		internal const string MoveZParameter = "MoveZ";

		internal const string SprintParameter = "Sprint";

		internal const string LocoSpeedParameter = "LocoSpeed";

		internal const string Jump = "Jump";

		internal const string Air = "Air";

		internal const string AirUpParameter = "AirUp";

		internal const string SwordMesh = "mesh_krissword";

		internal const string ShieldMesh = "mesh_krisshield";

		private static readonly HashSet<string> reported = new HashSet<string>();

		internal static bool ShowsSword(string pose)
		{
			if (pose != "Select" && pose != "SelectIntro")
			{
				return pose != "Pirouette";
			}
			return false;
		}

		internal static bool ShowsShield(string pose)
		{
			return pose == "Defend";
		}

		internal static void ReportOnce(string key, string message)
		{
			if (reported.Add(key))
			{
				Log.Warning("Kris animator: " + message);
			}
		}
	}
	public interface IKrisActState
	{
	}
	public class KrisActMenu : BaseKrisState, IKrisActState
	{
		private KrisAct[] options;

		private ActMenuHud hud;

		private bool chose;

		public override void OnEnter()
		{
			base.OnEnter();
			PlayPose("Act", 0.1f);
			Sounds.PlayAt("Special/Select", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				options = KrisActs.Draw();
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Weapon");
				if ((Object)(object)val != (Object)null)
				{
					val.SetInterruptState((EntityState)(object)new ActWeaponLock(), (InterruptPriority)7);
				}
				hud = ((EntityState)this).GetComponent<ActMenuHud>();
				if ((Object)(object)hud != (Object)null)
				{
					hud.Show(options, tension);
				}
			}
		}

		public override void FixedUpdate()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.velocity = new Vector3(0f, Mathf.Min(0f, ((EntityState)this).characterMotor.velocity.y), 0f);
				((EntityState)this).characterMotor.moveDirection = Vector3.zero;
			}
			if (!((EntityState)this).isAuthority || chose)
			{
				return;
			}
			if ((Object)(object)((EntityState)this).inputBank != (Object)null && ((ButtonState)(ref ((EntityState)this).inputBank.jump)).justPressed)
			{
				Close(refund: true);
				return;
			}
			if (((EntityState)this).fixedAge >= Mathf.Max(1f, 6f))
			{
				Close(refund: true);
				return;
			}
			int num = PickedIndex();
			if (num < 0 || options == null || num >= options.Length)
			{
				return;
			}
			KrisAct krisAct = options[num];
			EntityState val = (EntityState)Activator.CreateInstance(krisAct.State);
			if ((val is BaseKrisAct baseKrisAct && !baseKrisAct.Prepare(((EntityState)this).characterBody, ((BaseState)this).GetAimRay())) || (Object)(object)tension == (Object)null || !tension.TrySpend(krisAct.Cost))
			{
				if ((Object)(object)hud != (Object)null)
				{
					hud.Deny(num);
				}
				Sounds.PlayAt("Special/Deny", ((EntityState)this).gameObject);
			}
			else
			{
				chose = true;
				((EntityState)this).outer.SetNextState(val);
			}
		}

		private int PickedIndex()
		{
			if (!((Object)(object)hud != (Object)null))
			{
				return -1;
			}
			return hud.TakeKeyPick();
		}

		private void Close(bool refund)
		{
			if (refund && (Object)(object)((EntityState)this).skillLocator != (Object)null && (Object)(object)((EntityState)this).skillLocator.special != (Object)null)
			{
				((EntityState)this).skillLocator.special.Reset();
			}
			((EntityState)this).outer.SetNextStateToMain();
		}

		public override void OnExit()
		{
			if ((Object)(object)hud != (Object)null)
			{
				hud.Hide();
			}
			ReleasePose();
			base.OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public class ActWeaponLock : BaseState
	{
		private EntityStateMachine body;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			body = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Body");
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && !(((EntityState)this).fixedAge < 0.1f) && ((Object)(object)body == (Object)null || !(body.state is IKrisActState)))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public abstract class BaseKrisAct : BaseKrisState, IKrisActState
	{
		private string followUp;

		private float followUpAt;

		protected abstract float Duration { get; }

		protected virtual string Pose => "ActEnd";

		protected virtual string Sound => null;

		internal virtual bool Prepare(CharacterBody body, Ray aim)
		{
			return true;
		}

		public override void OnEnter()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			PlayPose(Pose, 0.08f, "Act");
			Ray aimRay = ((BaseState)this).GetAimRay();
			LockFacing(((Ray)(ref aimRay)).direction);
			int index = Sounds.PickIndex("Special/Select");
			Sounds.PlayAt("Special/Select", index, ((EntityState)this).gameObject);
			KrisAct krisAct = KrisActs.For(((object)this).GetType());
			followUp = ((krisAct != null && krisAct.Kind == ActKind.Item) ? "Special/Item" : Sound);
			followUpAt = Sounds.AudibleLength("Special/Select", index);
		}

		public override void FixedUpdate()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (followUp != null && ((EntityState)this).fixedAge >= followUpAt)
			{
				PlayFollowUp();
			}
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.velocity = new Vector3(0f, Mathf.Min(0f, ((EntityState)this).characterMotor.velocity.y), 0f);
				((EntityState)this).characterMotor.moveDirection = Vector3.zero;
			}
			if (((EntityState)this).fixedAge >= Duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (followUp != null)
			{
				PlayFollowUp();
			}
			ReleasePose();
			base.OnExit();
		}

		private void PlayFollowUp()
		{
			Sounds.PlayAt(followUp, ((EntityState)this).gameObject);
			followUp = null;
		}

		protected void Flourish(Color color, bool transmit = false)
		{
			//IL_0015: 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)
			if (!((Object)(object)((EntityState)this).characterBody == (Object)null))
			{
				Burst(((EntityState)this).characterBody.corePosition, 1.5f, color, transmit);
			}
		}

		protected static void Burst(Vector3 position, float scale, Color color, bool transmit = false)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if (!((Object)(object)KrisAssets.BuffEffect == (Object)null))
			{
				KrisEffects.Spawn(KrisAssets.BuffEffect, new EffectData
				{
					origin = position,
					scale = scale,
					color = Color32.op_Implicit(color)
				}, transmit);
			}
		}

		protected void BuffAllies(BuffDef buff, float duration, float radius)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || (Object)(object)buff == (Object)null || (Object)(object)((EntityState)this).characterBody == (Object)null)
			{
				return;
			}
			float num = radius * radius;
			ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(((BaseState)this).GetTeam());
			for (int i = 0; i < teamMembers.Count; i++)
			{
				CharacterBody val = (((Object)(object)teamMembers[i] != (Object)null) ? teamMembers[i].body : null);
				if ((Object)(object)val == (Object)null || (Object)(object)val.healthComponent == (Object)null || !val.healthComponent.alive)
				{
					continue;
				}
				if ((Object)(object)val != (Object)(object)((EntityState)this).characterBody)
				{
					Vector3 val2 = val.corePosition - ((EntityState)this).characterBody.corePosition;
					if (((Vector3)(ref val2)).sqrMagnitude > num)
					{
						continue;
					}
				}
				val.AddTimedBuff(buff, duration);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public abstract class BaseHealAct : BaseKrisAct
	{
		protected abstract float MinFraction { get; }

		protected abstract float MaxFraction { get; }

		protected override float Duration => 0.6f;

		public override void OnEnter()
		{
			//IL_0016: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Flourish(new Color(0.4f, 1f, 0.4f));
			if (NetworkServer.active && (Object)(object)((EntityState)this).healthComponent != (Object)null)
			{
				((EntityState)this).healthComponent.HealFraction(Random.Range(MinFraction, MaxFraction), default(ProcChainMask));
			}
		}
	}
	public class DarkCandyAct : BaseHealAct
	{
		internal const float MinHeal = 0.15f;

		internal const float MaxHeal = 0.3f;

		protected override float MinFraction => 0.15f;

		protected override float MaxFraction => 0.3f;
	}
	public class TvDinnerAct : BaseHealAct
	{
		internal const float MinHeal = 0.3f;

		internal const float MaxHeal = 0.5f;

		protected override float MinFraction => 0.3f;

		protected override float MaxFraction => 0.5f;
	}
	public class ScarlixirAct : BaseHealAct
	{
		internal const float MinHeal = 0.7f;

		internal const float MaxHeal = 0.8f;

		protected override float MinFraction => 0.7f;

		protected override float MaxFraction => 0.8f;
	}
	public class PirouetteAct : BaseKrisAct
	{
		private const float SpinTime = 0.6f;

		private const float HealFraction = 0.15f;

		private const float StumbleFraction = 0.15f;

		private static readonly Color Lucky = new Color(1f, 0.85f, 0.3f);

		private static readonly Color Unlucky = new Color(0.55f, 0.35f, 0.85f);

		private Vector3 startForward;

		private const int GoodOutcomes = 5;

		private const int BadOutcomes = 6;

		private const int GoodWeight = 5;

		private const int BadWeight = 4;

		protected override float Duration => 0.8f;

		protected override string Pose => "Pirouette";

		protected override string Sound => "Special/Pirouette";

		public override void OnEnter()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0016: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			startForward = new Vector3(direction.x, 0f, direction.z);
			if (((Vector3)(ref startForward)).sqrMagnitude < 0.001f)
			{
				startForward = ((EntityState)this).transform.forward;
			}
			((Vector3)(ref startForward)).Normalize();
			if (NetworkServer.active)
			{
				Roll();
			}
		}

		public override void Update()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			float num = Mathf.Clamp01(((EntityState)this).age / 0.6f);
			float num2 = 1f - (1f - num) * (1f - num);
			LockFacing(Quaternion.Euler(0f, 360f * num2, 0f) * startForward);
		}

		private static int PickOutcome()
		{
			int num = 25;
			int num2 = Random.Range(0, num + 24);
			if (num2 >= num)
			{
				return 5 + (num2 - num) / 4;
			}
			return num2 / 5;
		}

		private void Roll()
		{
			//IL_00b9: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			switch (PickOutcome())
			{
			case 0:
				Give(Buffs.Courage, 15f, lucky: true);
				break;
			case 1:
				Give(Buffs.HoldBreath, 15f, lucky: true);
				break;
			case 2:
				Give(Buffs.PetalFeather, 15f, lucky: true);
				break;
			case 3:
				Give(Buffs.Nimble, 15f, lucky: true);
				break;
			case 4:
				if ((Object)(object)((EntityState)this).healthComponent != (Object)null)
				{
					((EntityState)this).healthComponent.HealFraction(0.15f, default(ProcChainMask));
				}
				Flourish(new Color(0.4f, 1f, 0.4f), transmit: true);
				break;
			case 5:
				Give(Buffs.Dizzy, 15f, lucky: false);
				break;
			case 6:
				Give(Buffs.Sluggish, 15f, lucky: false);
				break;
			case 7:
				Give(Buffs.Clumsy, 15f, lucky: false);
				break;
			case 8:
				Give(Buffs.Exposed, 15f, lucky: false);
				break;
			case 9:
				Give(Buffs.Rooted, 8f, lucky: false);
				break;
			default:
				Stumble();
				Flourish(Unlucky, transmit: true);
				break;
			}
		}

		private void Stumble()
		{
			//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_0031: 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_0042: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			if (!((Object)(object)((EntityState)this).healthComponent == (Object)null))
			{
				((EntityState)this).healthComponent.TakeDamage(new DamageInfo
				{
					damage = ((EntityState)this).healthComponent.fullCombinedHealth * 0.15f,
					position = ((EntityState)this).characterBody.corePosition,
					damageType = DamageTypeCombo.op_Implicit((DamageType)67),
					procCoefficient = 0f,
					damageColorIndex = (DamageColorIndex)0
				});
			}
		}

		private void Give(BuffDef buff, float duration, bool lucky)
		{
			//IL_0021: 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)
			if ((Object)(object)buff != (Object)null)
			{
				((EntityState)this).characterBody.AddTimedBuff(buff, duration);
			}
			Flourish(lucky ? Lucky : Unlucky, transmit: true);
		}
	}
	public class XSlashAct : BaseKrisAct
	{
		internal const float DamagePerCut = 5f;

		private const float FirstCut = 0.15f;

		private const float SecondCut = 0.4f;

		private const float Radius = 4.5f;

		private const float Reach = 3f;

		private const float ArcLead = 0.05f;

		private const float ArcReveal = 0.11f;

		private const float ArcFade = 0.35f;

		private const float ArcRadius = 2.2f;

		private const float ArcWidth = 0.8f;

		private const float ArcFrom = 100f;

		private const float ArcTo = -45f;

		private int cutsDone;

		private int arcsDone;

		protected override float Duration => 0.75f;

		protected override string Pose => "XSlash";

		protected override string Sound => "Special/XSlash";

		public override void FixedUpdate()
		{
			if (arcsDone == 0 && ((EntityState)this).fixedAge >= 71f / (226f * (float)Math.PI))
			{
				Smear(-35f);
			}
			if (arcsDone == 1 && ((EntityState)this).fixedAge >= 0.35f)
			{
				Smear(35f);
			}
			if (cutsDone == 0 && ((EntityState)this).fixedAge >= 0.15f)
			{
				Cut(KrisAssets.FightHitB);
			}
			if (cutsDone == 1 && ((EntityState)this).fixedAge >= 0.4f)
			{
				Cut(KrisAssets.FightHitA);
			}
			base.FixedUpdate();
		}

		private Vector3 Forward()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 forward = default(Vector3);
			((Vector3)(ref forward))..ctor(((Ray)(ref aimRay)).direction.x, 0f, ((Ray)(ref aimRay)).direction.z);
			if (((Vector3)(ref forward)).sqrMagnitude < 0.001f)
			{
				forward = ((EntityState)this).transform.forward;
			}
			return ((Vector3)(ref forward)).normalized;
		}

		private void Smear(float roll)
		{
			//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_0015: 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_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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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)
			arcsDone++;
			Vector3 val = Forward();
			Quaternion rotation = Quaternion.LookRotation(val) * Quaternion.Euler(0f, 0f, roll);
			Vector3 position = ((EntityState)this).characterBody.corePosition + val * 1f + Vector3.up * 0.5f;
			SlashArcVfx slashArcVfx = SlashArcVfx.Spawn(null, position, rotation, 100f, -45f, 0.11f);
			slashArcVfx.radius = 2.2f;
			slashArcVfx.width = 0.8f;
			slashArcVfx.fade = 0.35f;
		}

		private void Cut(GameObject mark)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			cutsDone++;
			if (((EntityState)this).isAuthority)
			{
				Vector3 val = Forward();
				Vector3 position = ((EntityState)this).characterBody.corePosition + val * 3f;
				BlastAttack val2 = new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = ((BaseState)this).GetTeam(),
					baseDamage = ((BaseState)this).damageStat * 5f,
					baseForce = 800f,
					position = position,
					radius = 4.5f,
					falloffModel = (FalloffModel)0,
					procCoefficient = 1f,
					crit = ((BaseState)this).RollCrit(),
					damageType = KrisDamage.Of((DamageType)0, (DamageSource)8),
					damageColorIndex = (DamageColorIndex)0,
					attackerFiltering = (AttackerFiltering)2
				};
				if ((Object)(object)mark != (Object)null)
				{
					val2.impactEffect = EffectCatalog.FindEffectIndexFromPrefab(mark);
				}
				Result val3 = val2.Fire();
				if ((Object)(object)tension != (Object)null)
				{
					tension.AddForHits(val3.hitCount);
				}
			}
		}
	}
	public class CourageAct : BaseKrisAct
	{
		internal const float BuffDuration = 15f;

		internal const float Radius = 40f;

		protected override float Duration => 0.6f;

		protected override string Sound => "Special/Basic";

		public override void OnEnter()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Flourish(KrisAssets.TpOrange);
			BuffAllies(Buffs.Courage, 15f, 40f);
		}
	}
	public class HoldBreathAct : BaseKrisAct
	{
		internal const float BuffDuration = 15f;

		protected override float Duration => 0.5f;

		protected override string Sound => "Special/Basic";

		public override void OnEnter()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Flourish(KrisAssets.KrisBlue);
			if (NetworkServer.active && (Object)(object)Buffs.HoldBreath != (Object)null)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HoldBreath, 15f);
			}
		}
	}
	public class PetalFeatherAct : BaseKrisAct
	{
		internal const float BuffDuration = 15f;

		protected override float Duration => 0.6f;

		protected override string Sound => "Special/PetalFeather";

		public override void OnEnter()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Flourish(new Color(1f, 0.75f, 0.85f));
			if (NetworkServer.active && (Object)(object)Buffs.PetalFeather != (Object)null)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.PetalFeather, 15f);
			}
		}
	}
	public abstract class BaseSoulShineAct : BaseKrisAct
	{
		private const float RiseHeight = 2.2f;

		private const float ReturnTime = 0.3f;

		private static readonly Color Glow = new Color(1f, 0.35f, 0.35f);

		private SoulVisual soul;

		private Light glow;

		private bool flared;

		protected abstract float StunRadius { get; }

		protected abstract float StunSeconds { get; }

		protected abstract float DamageCoefficient { get; }

		protected abstract float SoulScale { get; }

		protected abstract float LightIntensity { get; }

		protected abstract float LightRange { get; }

		protected virtual float RiseTime => 0.45f;

		protected virtual float RootSeconds => 0f;

		protected override string Sound => "Special/Soul";

		public override void OnEnter()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			soul = SoulVisual.Create(SoulOrigin());
			glow = ((Component)soul).gameObject.AddComponent<Light>();
			glow.type = (LightType)2;
			glow.color = Glow;
			glow.range = LightRange;
			glow.intensity = 0f;
			glow.shadows = (LightShadows)0;
		}

		public override void Update()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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)
			((EntityState)this).Update();
			if (!((Object)(object)soul == (Object)null))
			{
				Vector3 val = SoulOrigin();
				float num = Mathf.Clamp01(((EntityState)this).age / RiseTime);
				float num2 = 1f - (1f - num) * (1f - num);
				((Component)soul).transform.position = val + Vector3.up * (2.2f * num2);
				float num3 = (flared ? Mathf.Clamp01((((EntityState)this).age - RiseTime) / 0.15f) : 0f);
				float num4 = Mathf.Lerp(1f, SoulScale, num2) * (1f + 0.35f * num3 * (1f - Mathf.Clamp01((((EntityState)this).age - RiseTime - 0.15f) / 0.4f)));
				((Component)soul).transform.localScale = Vector3.one * num4;
				if ((Object)(object)glow != (Object)null)
				{
					float num5 = 1f - Mathf.Clamp01((((EntityState)this).age - (Duration - 0.3f)) / 0.3f);
					float num6 = (flared ? Mathf.Max(0f, 1f - (((EntityState)this).age - RiseTime) / 0.5f) : 0f);
					glow.intensity = LightIntensity * (0.25f * num2 + 0.75f * num3 + num6 * 1.5f) * num5;
				}
			}
		}

		public override void FixedUpdate()
		{
			if (!flared && ((EntityState)this).fixedAge >= RiseTime)
			{
				Flare();
			}
			base.FixedUpdate();
		}

		private void Flare()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0082: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			flared = true;
			Vector3 val = (((Object)(object)soul != (Object)null) ? ((Component)soul).transform.position : (SoulOrigin() + Vector3.up * 2.2f));
			BaseKrisAct.Burst(val, SoulScale * 1.5f, Color.white);
			BaseKrisAct.Burst(val, StunRadius * 0.25f, KrisAssets.SoulRed);
			if (((EntityState)this).isAuthority)
			{
				Result val2 = new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = ((BaseState)this).GetTeam(),
					baseDamage = ((BaseState)this).damageStat * DamageCoefficient,
					baseForce = 0f,
					position = val,
					radius = StunRadius,
					falloffModel = (FalloffModel)0,
					procCoefficient = 1f,
					crit = ((BaseState)this).RollCrit(),
					damageType = KrisDamage.Of((DamageType)0, (DamageSource)8),
					damageColorIndex = (DamageColorIndex)0,
					attackerFiltering = (AttackerFiltering)2
				}.Fire();
				if ((Object)(object)tension != (Object)null)
				{
					tension.AddForHits(val2.hitCount);
				}
			}
			if (!NetworkServer.active)
			{
				return;
			}
			TeamIndex team = ((BaseState)this).GetTeam();
			float num = StunRadius * StunRadius;
			ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
			for (int i = 0; i < readOnlyInstancesList.Count; i++)
			{
				CharacterBody val3 = readOnlyInstancesList[i];
				if ((Object)(object)val3 == (Object)null || (Object)(object)val3.teamComponent == (Object)null || val3.teamComponent.teamIndex == team || (Object)(object)val3.healthComponent == (Object)null || !val3.healthComponent.alive)
				{
					continue;
				}
				Vector3 val4 = val3.corePosition - val;
				if (!(((Vector3)(ref val4)).sqrMagnitude > num))
				{
					SetStateOnHurt.SetStunOnObject(((Component)val3).gameObject, StunSeconds);
					if (RootSeconds > 0f)
					{
						GroundPin.Pin(val3, RootSeconds);
					}
				}
			}
		}

		public override void OnExit()
		{
			if ((Object)(object)glow != (Object)null)
			{
				Object.Destroy((Object)(object)glow);
			}
			if ((Object)(object)soul != (Object)null)
			{
				soul.Absorb(((BaseState)this).FindModelChild("Chest"), 0.3f);
			}
			soul = null;
			base.OnExit();
		}
	}
	public class BanishAct : BaseSoulShineAct
	{
		internal const float Radius = 15f;

		internal const float StunTime = 3f;

		internal static float Damage => 2.5f;

		protected override float Duration => 1.3f;

		protected override float StunRadius => 15f;

		protected override float StunSeconds => 3f;

		protected override float DamageCoefficient => Damage;

		protected override float SoulScale => 2f;

		protected override float LightIntensity => 6f;

		protected override float LightRange => 18f;
	}
	public class UnleashAct : BaseSoulShineAct
	{
		internal const float Radius = 30f;

		internal const float StunTime = 6f;

		internal const float RootTime = 15f;

		internal static float Damage => BanishAct.Damage * 2f;

		protected override float RootSeconds => 15f;

		protected override float Duration => 1.7f;

		protected override float RiseTime => 0.6f;

		protected override float StunRadius => 30f;

		protected override float StunSeconds => 6f;

		protected override float DamageCoefficient => Damage;

		protected override float SoulScale => 3.5f;

		protected override float LightIntensity => 12f;

		protected override float LightRange => 35f;
	}
	public class ProceedAct : BaseKrisAct
	{
		private const float Range = 60f;

		private const float ConeHalfAngle = 45f;

		private const float StrikeAt = 0.35f;

		private GameObject target;

		private bool struck;

		protected override float Duration => 0.9f;

		protected override string Pose => "XSlash";

		protected override string Sound => "Special/Proceed";

		internal override bool Prepare(CharacterBody body, Ray aim)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null || (Object)(object)body.teamComponent == (Object)null)
			{
				return false;
			}
			BullseyeSearch val = new BullseyeSearch
			{
				teamMaskFilter = TeamMask.GetEnemyTeams(body.teamComponent.teamIndex),
				filterByLoS = true,
				searchOrigin = ((Ray)(ref aim)).origin,
				searchDirection = ((Ray)(ref aim)).direction,
				sortMode = (SortMode)1,
				maxDistanceFilter = 60f,
				maxAngleFilter = 45f
			};
			val.RefreshCandidates();
			val.FilterOutGameObject(((Component)body).gameObject);
			foreach (HurtBox result in val.GetResults())
			{
				if (!((Object)(object)result == (Object)null) && !((Object)(object)result.healthComponent == (Object)null) && result.healthComponent.alive)
				{
					target = ((Component)result.healthComponent).gameObject;
					return true;
				}
			}
			return false;
		}

		public override void OnEnter()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			if ((Object)(object)target != (Object)null)
			{
				LockFacing(target.transform.position - ((EntityState)this).transform.position);
			}
		}

		public override void FixedUpdate()
		{
			if (!struck && ((EntityState)this).fixedAge >= 0.35f)
			{
				Strike();
			}
			base.FixedUpdate();
		}

		private void Strike()
		{
			//IL_005a: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d7: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_014d: 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_014f: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			struck = true;
			if ((Object)(object)target == (Object)null)
			{
				return;
			}
			HealthComponent component = target.GetComponent<HealthComponent>();
			if (!((Object)(object)component == (Object)null) && component.alive)
			{
				Vector3 val = (((Object)(object)component.body != (Object)null) ? component.body.corePosition : target.transform.position);
				float num = (((Object)(object)component.body != (Object)null) ? Mathf.Clamp(component.body.bestFitRadius, 1f, 8f) : 1.5f);
				if ((Object)(object)KrisAssets.ProceedFrostEffect != (Object)null)
				{
					KrisEffects.Spawn(KrisAssets.ProceedFrostEffect, new EffectData
					{
						origin = val,
						scale = 2f + num * 2f,
						color = Color32.op_Implicit(SnowfallVfx.Ice)
					}, transmit: false);
				}
				SnowfallVfx.Spawn(val, 1.5f + num * 1.5f, 2.5f + num * 1.5f, 160);
				BaseKrisAct.Burst(val, 3f, SnowfallVfx.Ice);
				if (NetworkServer.active)
				{
					component.TakeDamage(new DamageInfo
					{
						attacker = ((EntityState)this).gameObject,
						inflictor = ((EntityState)this).gameObject,
						damage = (component.fullCombinedHealth + component.barrier) * 10f,
						position = val,
						force = Vector3.zero,
						crit = true,
						procCoefficient = 0f,
						damageType = KrisDamage.Of((DamageType)262210, (DamageSource)8),
						damageColorIndex = (DamageColorIndex)5
					});
				}
			}
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			target = reader.ReadGameObject();
		}
	}
	public class KrisDefend : BaseKrisState
	{
		private int savedJumpCount;

		public override void OnEnter()
		{
			base.OnEnter();
			PlayPose("Defend");
			Sounds.PlayAt("Secondary", ((EntityState)this).gameObject);
			((BaseState)this).StartAimMode(1f, false);
			if (NetworkServer.active && (Object)(object)Buffs.Defend != (Object)null)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.Defend);
			}
			if (((EntityState)this).isAuthority && (Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				savedJumpCount = ((EntityState)this).characterMotor.jumpCount;
				HoldGround();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				if ((Object)(object)((EntityState)this).characterBody != (Object)null && ((EntityState)this).characterBody.isSprinting)
				{
					((EntityState)this).characterBody.isSprinting = false;
				}
				if ((Object)(object)((EntityState)this).characterBody != (Object)null)
				{
					((EntityState)this).characterBody.SetAimTimer(0.5f);
				}
				HoldGround();
				if (!((BaseSkillState)this).IsKeyDownAuthority())
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private void HoldGround()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((EntityState)this).characterMotor == (Object)null))
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					Vector3 velocity = ((EntityState)this).characterMotor.velocity;
					((EntityState)this).characterMotor.velocity = new Vector3(0f, velocity.y, 0f);
				}
				if ((Object)(object)((EntityState)this).characterBody != (Object)null)
				{
					((EntityState)this).characterMotor.jumpCount = ((EntityState)this).characterBody.maxJumpCount;
				}
			}
		}

		public override void OnExit()
		{
			if (NetworkServer.active && (Object)(object)Buffs.Defend != (Object)null && ((EntityState)this).characterBody.HasBuff(Buffs.Defend))
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.Defend);
			}
			if (((EntityState)this).isAuthority && (Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.jumpCount = ((!((EntityState)this).characterMotor.isGrounded) ? Mathf.Max(savedJumpCount, 1) : 0);
			}
			ReleasePose();
			base.OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class KrisSlash : BaseKrisState, IStepSetter
	{
		public const string HitBoxGroupName = "KrisSword";

		public static float attackStartFraction = 0.2f;

		public static float attackEndFraction = 0.5f;

		public static float procCoefficient = 1f;

		public static float pushAwayForce = 600f;

		private const float ArcStartFraction = 0.25f;

		private const float ArcRevealFraction = 0.22f;

		private readonly List<HurtBox> hits = new List<HurtBox>();

		private OverlapAttack attack;

		private float duration;

		private bool attackStarted;

		private bool arcSpawned;

		private bool attackFinished;

		private int swingIndex;

		private static bool warnedAboutHitbox;

		private bool Forehand => swingIndex % 2 == 0;

		private GameObject HitEffect
		{
			get
			{
				GameObject val = (Forehand ? KrisAssets.FightHitA : KrisAssets.FightHitB);
				if (!((Object)(object)val != (Object)null))
				{
					return KrisAssets.SlashHitEffect;
				}
				return val;
			}
		}

		public void SetStep(int i)
		{
			swingIndex = i;
		}

		public override void OnEnter()
		{
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			duration = 0.5f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(2f, false);
			if ((Object)(object)((EntityState)this).characterBody != (Object)null)
			{
				((EntityState)this).characterBody.SetAimTimer(1.5f);
			}
			string state = ((swingIndex % 2 == 0) ? "SlashA" : "SlashB");
			PlayGesture(state, 0.05f / Mathf.Max(((BaseState)this).attackSpeedStat, 0.1f), "SlashA");
			SetPoseSpeed(((BaseState)this).attackSpeedStat);
			attack = ((BaseState)this).InitMeleeOverlap(2.5f, HitEffect, ((EntityState)this).GetModelTransform(), "KrisSword");
			attack.procCoefficient = procCoefficient;
			attack.pushAwayForce = pushAwayForce;
			attack.damageType = KrisDamage.Of((DamageType)0, (DamageSource)1);
			attack.damageColorIndex = (DamageColorIndex)0;
			if (((EntityState)this).isAuthority && (Object)(object)attack.hitBoxGroup == (Object)null && !warnedAboutHitbox)
			{
				warnedAboutHitbox = true;
				Log.Error("FIGHT found no HitBoxGroup named 'KrisSword' on the model - the slash will not damage anything.");
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			float num = ((duration > 0f) ? (((EntityState)this).fixedAge / duration) : 1f);
			if (!attackStarted && num >= attackStartFraction)
			{
				attackStarted = true;
			}
			if (!arcSpawned && num >= 0.25f)
			{
				arcSpawned = true;
				SpawnSwingEffect();
				PlaySwingSound();
			}
			if (attackStarted && !attackFinished)
			{
				if (num >= attackEndFraction)
				{
					attackFinished = true;
				}
				else if (((EntityState)this).isAuthority && attack != null)
				{
					hits.Clear();
					if (attack.Fire(hits) && (Object)(object)tension != (Object)null)
					{
						tension.AddForHits(hits.Count);
					}
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void PlaySwingSound()
		{
			Sounds.PlayAt("Primary", ((EntityState)this).gameObject);
		}

		private void SpawnSwingEffect()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_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_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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 forward = default(Vector3);
			((Vector3)(ref forward))..ctor(((Ray)(ref aimRay)).direction.x, 0f, ((Ray)(ref aimRay)).direction.z);
			if (((Vector3)(ref forward)).sqrMagnitude < 0.001f)
			{
				forward = ((EntityState)this).transform.forward;
			}
			((Vector3)(ref forward)).Normalize();
			float startAngle = (Forehand ? (-5f) : 95f);
			float endAngle = (Forehand ? 178f : (-140f));
			Quaternion rotation = Quaternion.LookRotation(forward) * Quaternion.Euler(0f, 0f, 90f);
			Vector3 position = ((EntityState)this).characterBody.corePosition + Vector3.up * 0.2f;
			SlashArcVfx.Spawn(((EntityState)this).transform, position, rotation, startAngle, endAngle, duration * 0.22f);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

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

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

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			swingIndex = reader.ReadByte();
		}
	}
	public class KrisSpawnState : BaseState
	{
		private CharacterModel characterModel;

		private AimRequest aimRequest;

		private bool hasTeleported;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if ((Object)(object)modelTransform != (Object)null)
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
			}
			if ((Object)(object)characterModel != (Object)null)
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount + 1;
			}
			if ((Object)(object)((EntityState)this).cameraTargetParams != (Object)null)
			{
				aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)2);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!hasTeleported && ((EntityState)this).fixedAge >= SpawnTeleporterState.initialDelay)
			{
				hasTeleported = true;
				if ((Object)(object)characterModel != (Object)null)
				{
					CharacterModel obj = characterModel;
					int invisibilityCount = obj.invisibilityCount;
					obj.invisibilityCount = invisibilityCount - 1;
					TeleportOutController.AddTPOutEffect(characterModel, 1f, 0f, SpawnTeleporterState.initialDelay);
				}
				GameObject val = (((Object)(object)Run.instance != (Object)null) ? Run.instance.GetTeleportEffectPrefab(((EntityState)this).gameObject) : null);
				if ((Object)(object)val != (Object)null && !Run.instance.spawnWithPod)
				{
					EffectManager.SimpleEffect(val, ((EntityState)this).transform.position, Quaternion.identity, false);
					Util.PlaySound(SpawnTeleporterState.soundString, ((EntityState)this).gameObject);
				}
			}
			if (hasTeleported && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (!hasTeleported && (Object)(object)characterModel != (Object)null)
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount - 1;
			}
			if (aimRequest != null)
			{
				aimRequest.Dispose();
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 3f);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
	public class SoulAim : BaseKrisState
	{
		internal const float StandOff = 1.2f;

		private const float GhostAlpha = 0.4f;

		private SoulVisual marker;

		private bool released;

		public override void OnEnter()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			PlayGesture("SoulAim", 0.1f);
			KrisLocomotion component = ((EntityState)this).GetComponent<KrisLocomotion>();
			if ((Object)(object)component != (Object)null)
			{
				component.Brace(on: true);
			}
			Sounds.PlayAt("Utility", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				marker = SoulVisual.Create(FindTarget(((BaseState)this).GetAimRay()), 0.4f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			((EntityState)this).FixedUpdate();
			Ray aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 0.5f, false);
			if (((EntityState)this).isAuthority)
			{
				Vector3 val = FindTarget(aimRay);
				if ((Object)(object)marker != (Object)null)
				{
					((Component)marker).transform.position = val;
				}
				if (!released && !((BaseSkillState)this).IsKeyDownAuthority())
				{
					released = true;
					Throw(val);
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private void Throw(Vector3 target)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)tension == (Object)null || !tension.TrySpend(15f))
			{
				Log.Warning("SOUL released without the TP to pay for it - not thrown.");
				return;
			}
			EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Body");
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("Kris has no Body state machine - the SOUL cannot pull.");
				return;
			}
			val.SetNextState((EntityState)(object)new SoulPull
			{
				target = target,
				origin = SoulOrigin()
			});
		}

		private Vector3 FindTarget(Ray aim)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_003e: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(5f, 45f);
			LayerIndex val = LayerIndex.world;
			int num2 = LayerMask.op_Implicit(((LayerIndex)(ref val)).mask);
			val = LayerIndex.entityPrecise;
			int num3 = num2 | LayerMask.op_Implicit(((LayerIndex)(ref val)).mask);
			Vector3 val2 = SoulOrigin();
			float num4 = Vector3.Distance(((Ray)(ref aim)).origin, val2);
			Vector3 val3 = Vector3.zero;
			RaycastHit val4 = default(RaycastHit);
			Vector3 val5;
			if (Util.CharacterRaycast(((EntityState)this).gameObject, aim, ref val4, num + num4, LayerMask.op_Implicit(num3), (QueryTriggerInteraction)1))
			{
				val5 = ((RaycastHit)(ref val4)).point;
				val3 = ((RaycastHit)(ref val4)).normal;
			}
			else
			{
				val5 = ((Ray)(ref aim)).GetPoint(num + num4);
			}
			Vector3 val6 = val5 - val2;
			if (((Vector3)(ref val6)).magnitude > num)
			{
				val5 = val2 + ((Vector3)(ref val6)).normalized * num;
				val3 = Vector3.zero;
			}
			val6 = val5 - val2;
			if (((Vector3)(ref val6)).sqrMagnitude > 0.01f)
			{
				Vector3 normalized = ((Vector3)(ref val6)).normalized;
				float magnitude = ((Vector3)(ref val6)).magnitude;
				val = LayerIndex.world;
				if (Physics.Raycast(val2, normalized, ref val4, magnitude, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)1))
				{
					val5 = ((RaycastHit)(ref val4)).point;
					val3 = ((RaycastHit)(ref val4)).normal;
				}
			}
			return val5 + val3 * 0.275f;
		}

		public override void OnExit()
		{
			if ((Object)(object)marker != (Object)null)
			{
				marker.Remove();
			}
			KrisLocomotion component = ((EntityState)this).GetComponent<KrisLocomotion>();
			if ((Object)(object)component != (Object)null)
			{
				component.Brace(on: false);
			}
			ReleaseGesture(0.1f);
			base.OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class SoulPull : BaseKrisState
	{
		private const float MinFlightTime = 0.12f;

		private const float ExitSpeedFraction = 0.35f;

		private const float PullGrace = 0.4f;

		private const float ExitHop = 6f;

		private const float RipAt = 0.05f;

		private const float ReleaseAt = 0.15f;

		private const float GrabReach = 4f;

		private const float AbsorbTime = 0.15f;

		private const float RipDamage = 1f;

		private const float MaxReturnTime = 0.45f;

		public Vector3 target;

		public Vector3 origin;

		private SoulVisual soul;

		private Transform hand;

		private Vector3 releasedFrom;

		private bool released;

		private float flightTime;

		private float pullTime;

		private bool pulling;

		private float pullStartedAt;

		private Vector3 pullDirection;

		private bool gravitySuspended;

		private float hurtEndsAt;

		private bool pullSoundPlayed;

		private bool caught;

		public override void OnEnter()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_005d: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			if (origin == Vector3.zero)
			{
				origin = SoulOrigin();
			}
			float num = Vector3.Distance(origin, target);
			flightTime = Mathf.Max(0.12f, num / Mathf.Max(1f, 110f));
			Vector3 val = ((EntityState)this).transform.position - origin;
			Vector3 direction = target - origin;
			Vector3 val2 = target - ((Vector3)(ref direction)).normalized * Mathf.Min(1.2f, ((Vector3)(ref direction)).magnitude);
			float num2 = Vector3.Distance(((EntityState)this).transform.position, val2 + val);
			pullTime = num2 / Mathf.Max(1f, 60f);
			hand = ((BaseState)this).FindModelChild("HandL");
			releasedFrom = origin;
			PlayPose("SoulThrow", 0.05f, "SoulAim");
			LockFacing(direction);
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				Gravity.Suspend(((EntityState)this).characterMotor);
				gravitySuspended = true;
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
		}

		public override void FixedUpdate()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_0080: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!pulling)
			{
				if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if ((Object)(object)soul == (Object)null && ((EntityState)this).fixedAge >= 0.05f)
				{
					Rip();
				}
				if (!(((EntityState)this).fixedAge < 0.15f))
				{
					if (!released)
					{
						released = true;
						releasedFrom = HandPosition();
						flightTime = Mathf.Max(0.12f, Vector3.Distance(releasedFrom, target) / Mathf.Max(1f, 110f));
					}
					float num = Mathf.Clamp01((((EntityState)this).fixedAge - 0.15f) / flightTime);
					if ((Object)(object)soul != (Object)null)
					{
						((Component)soul).transform.position = Vector3.Lerp(releasedFrom, target, num);
					}
					if (num >= 1f)
					{
						BeginPull();
					}
				}
				return;
			}
			PlaceSoul();
			if (!pullSoundPlayed && ((EntityState)this).fixedAge >= hurtEndsAt)
			{
				PlayPullSound();
			}
			if (!((EntityState)this).isAuthority || (Object)(object)((EntityState)this).characterMotor == (Object)null)
			{
				return;
			}
			if ((Object)(object)((EntityState)this).inputBank != (Object)null && (((ButtonState)(ref ((EntityState)this).inputBank.skill1)).justPressed || ((ButtonState)(ref ((EntityState)this).inputBank.skill3)).justPressed))
			{
				Catch();
				return;
			}
			Vector3 val = target - NearestPointTo(target);
			float magnitude = ((Vector3)(ref val)).magnitude;
			float num2 = ((EntityState)this).fixedAge - pullStartedAt;
			if (magnitude <= 1.2f || num2 >= pullTime + 0.4f)
			{
				Catch();
				return;
			}
			pullDirection = val / magnitude;
			((EntityState)this).characterMotor.velocity = pullDirection * 60f;
			LockFacing(pullDirection);
		}

		public override void Update()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if ((Object)(object)soul != (Object)null && !released)
			{
				((Component)soul).transform.position = HandPosition();
			}
			else if (pulling)
			{
				PlaceSoul();
			}
		}

		private void Rip()
		{
			//IL_0002: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			soul = SoulVisual.Create(HandPosition());
			Transform val = ((BaseState)this).FindModelChild("Chest");
			if ((Object)(object)val != (Object)null)
			{
				soul.SetTether(val);
			}
			int index = Sounds.PickIndex("Utility/Hurt");
			Sounds.PlayAt("Utility/Hurt", index, ((EntityState)this).gameObject);
			if (!Sounds.Overlaps)
			{
				hurtEndsAt = ((EntityState)this).fixedAge + Sounds.AudibleLength("Utility/Hurt", index);
			}
			if (NetworkServer.active && (Object)(object)((EntityState)this).healthComponent != (Object)null)
			{
				((EntityState)this).healthComponent.TakeDamage(new DamageInfo
				{
					damage = 1f,
					attacker = null,
					inflictor = ((EntityState)this).gameObject,
					position = HandPosition(),
					force = Vector3.zero,
					crit = false,
					procCoefficient = 0f,
					damageType = KrisDamage.Of((DamageType)67, (DamageSource)4),
					damageColorIndex = (DamageColorIndex)0
				});
			}
		}

		private void PlaceSoul()
		{
			//IL_0010: 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_0044: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)soul == (Object)null))
			{
				float num = Mathf.Clamp01((Vector3.Distance(target, NearestPointTo(target)) - 1.2f) / 4f);
				((Component)soul).transform.position = Vector3.Lerp(HandPosition(), target, num);
			}
		}

		private void PlayPullSound()
		{
			pullSoundPlayed = true;
			Sounds.PlayAt("Utility/Pull", ((EntityState)this).gameObject);
		}

		private void Catch()
		{
			//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)
			caught = true;
			EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Weapon");
			if ((Object)(object)val != (Object)null)
			{
				val.SetNextState((EntityState)(object)new SoulSlash
				{
					direction = pullDirection
				});
			}
			else
			{
				Log.Error("Kris has no Weapon state machine - the SOUL is caught without the cuts.");
			}
			((EntityState)this).outer.SetNextStateToMain();
		}

		private Vector3 NearestPointTo(Vector3 point)
		{
			//IL_0001: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_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)
			Vector3 val = SoulOrigin();
			Vector3 val2 = (((Object)(object)((EntityState)this).characterBody != (Object)null) ? ((EntityState)this).characterBody.footPosition : ((EntityState)this).transform.position);
			Vector3 val3 = val - val2;
			float num = ((((Vector3)(ref val3)).sqrMagnitude > 0.0001f) ? Mathf.Clamp01(Vector3.Dot(point - val2, val3) / ((Vector3)(ref val3)).sqrMagnitude) : 0f);
			return val2 + val3 * num;
		}

		private Vector3 HandPosition()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)hand != (Object)null))
			{
				return origin;
			}
			return hand.position;
		}

		private void BeginPull()
		{
			//IL_0015: 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_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_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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			pulling = true;
			pullStartedAt = ((EntityState)this).fixedAge;
			Vector3 val = target - NearestPointTo(target);
			pullDirection = ((Vector3)(ref val)).normalized;
			PlayPose("SoulPull", 0.06f, "SoulAim");
			if (((EntityState)this).fixedAge >= hurtEndsAt)
			{
				PlayPullSound();
			}
			if ((Object)(object)KrisAssets.SoulLandEffect != (Object)null)
			{
				KrisEffects.SpawnDetached(KrisAssets.SoulLandEffect, target, Quaternion.LookRotation(-pullDirection), 1.5f);
			}
			if (((EntityState)this).isAuthority && (Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			}
		}

		public override void OnExit()
		{
			//IL_0035: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)soul != (Object)null)
			{
				Transform val = ((BaseState)this).FindModelChild("Chest");
				float seconds = Mathf.Clamp((((Object)(object)val != (Object)null) ? Vector3.Distance(((Component)soul).transform.position, val.position) : 0f) / Mathf.Max(1f, 110f), 0.15f, 0.45f);
				soul.Absorb(val, seconds);
			}
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				if (gravitySuspended)
				{
					Gravity.Restore(((EntityState)this).characterMotor);
					gravitySuspended = false;
				}
				if (((EntityState)this).isAuthority && pulling)
				{
					((EntityState)this).characterMotor.velocity = pullDirection * 21f + Vector3.up * 6f;
					if (caught)
					{
						((EntityState)this).characterMotor.velocity.y = Mathf.Max(((EntityState)this).characterMotor.velocity.y, 8f);
					}
				}
			}
			ReleasePose();
			base.OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0009: 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)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(target);
			writer.Write(origin);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//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_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)
			((BaseSkillState)this).OnDeserialize(reader);
			target = reader.ReadVector3();
			origin = reader.ReadVector3();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class SoulSlash : BaseKrisState
	{
		public const string HitBoxGroupName = "KrisSoulSlash";

		private const float BaseDuration = 0.5f;

		private const float CutAt = 0.34f;

		private const float CutWindow = 0.08f;

		internal const float Hop = 8f;

		private static bool warnedAboutHitbox;

		public Vector3 direction;

		private float duration;

		private bool cut;

		private Vector3 flat;

		private OverlapAttack attack;

		private float attackEnd;

		private readonly List<HurtBox> hits = new List<HurtBox>();

		public override void OnEnter()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			base.OnEnter();
			duration = 0.5f / Mathf.Max(((BaseState)this).attackSpeedStat, 0.1f);
			flat = new Vector3(direction.x, 0f, direction.z);
			if (((Vector3)(ref flat)).sqrMagnitude < 0.001f && (Object)(object)((EntityState)this).characterDirection != (Object)null)
			{
				flat = ((EntityState)this).characterDirection.forward;
			}
			if (((Vector3)(ref flat)).sqrMagnitude < 0.001f)
			{
				flat = ((EntityState)this).transform.forward;
			}
			((Vector3)(ref flat)).Normalize();
			PlayPose("SoulSlash", 0.05f / Mathf.Max(((BaseState)this).attackSpeedStat, 0.1f), "SoulPull");
			SetPoseSpeed(((BaseState)this).attackSpeedStat);
			LockFacing(flat);
			if (((EntityState)this).isAuthority && (Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)this).characterMotor.velocity.y = Mathf.Max(((EntityState)this).characterMotor.velocity.y, 8f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!cut && ((EntityState)this).fixedAge >= 0.34f * duration)
			{
				Cut();
			}
			if (attack != null)
			{
				hits.Clear();
				if (attack.Fire(hits) && (Object)(object)tension != (Object)null)
				{
					tension.AddForHits(hits.Count);
				}
				if (((EntityState)this).fixedAge >= attackEnd)
				{
					attack = null;
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Cut()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_004a: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0