Decompiled source of Madara Uchiha v0.7.5

plugins/Madara/Madara.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using ExtraSkillSlots;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.CameraModes;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Networking;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Madara")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+79bb2e83e328235d7d0332a6171cf41842977d57")]
[assembly: AssemblyProduct("Madara")]
[assembly: AssemblyTitle("Madara")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MadaraMod
{
	public static class Snd
	{
		private static readonly Dictionary<int, float> voiceUntil = new Dictionary<int, float>();

		public static void Init()
		{
			string path = Path.Combine(Media.Assets, "Audio", "Madara.bnk");
			if (File.Exists(path))
			{
				SoundBanks.Add(File.ReadAllBytes(path));
			}
			else
			{
				Plugin.Log.LogWarning((object)"MADARA_AUDIO bank missing");
			}
		}

		public static uint Sfx(string key, GameObject at)
		{
			uint result = (Object.op_Implicit((Object)(object)at) ? AkSoundEngine.PostEvent("Play_Madara_" + key, at) : 0u);
			Combat.Trace?.Invoke("SFX Play_Madara_" + key + " playingId=" + result + " rt=" + Time.realtimeSinceStartup.ToString("0.000"));
			return result;
		}

		public static bool Voice(CharacterBody body, string key, float length, bool grunt = false)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				return VoiceAt(body, key, length, grunt, ((Component)body).gameObject);
			}
			return false;
		}

		public static bool VoiceAt(CharacterBody body, string key, float length, bool grunt, GameObject at)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			int instanceID = ((Object)body).GetInstanceID();
			float time = Time.time;
			if (voiceUntil.TryGetValue(instanceID, out var value) && time < value)
			{
				return false;
			}
			if (grunt && Random.value > 0.55f)
			{
				return false;
			}
			voiceUntil[instanceID] = time + length;
			bool flag = VoiceLoadout.Get(body) == VoiceLoadout.Lang.English;
			Sfx((flag ? "VE_" : "V_") + key, at);
			Combat.Trace?.Invoke("VOICE " + (flag ? "VE_" : "V_") + key);
			return true;
		}
	}
	[DefaultExecutionOrder(1003)]
	public sealed class CleaverEar : MonoBehaviour
	{
		public const float MinDist = 6f;

		public const float MaxDist = 14f;

		public const float Tail = 3.4f;

		private CharacterBody body;

		private CameraRigController rig;

		private float dist;

		private float until;

		private Vector3 dir = Vector3.forward;

		private static LocalUser Owner(CharacterBody b)
		{
			if (Object.op_Implicit((Object)(object)b))
			{
				foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
				{
					if (readOnlyLocalUsers != null && (Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)b)
					{
						return readOnlyLocalUsers;
					}
				}
			}
			return null;
		}

		public static GameObject Begin(CharacterBody b, ref CleaverEar ear)
		{
			//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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a9: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			LocalUser val = Owner(b);
			CameraRigController val2 = ((val != null) ? val.cameraRigController : null);
			if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.sceneCam))
			{
				if (Object.op_Implicit((Object)(object)ear))
				{
					ear.until = 0f;
				}
				ear = null;
				if (!Object.op_Implicit((Object)(object)b))
				{
					return null;
				}
				return ((Component)b).gameObject;
			}
			Vector3 position = ((Component)val2.sceneCam).transform.position;
			Vector3 corePosition = b.corePosition;
			if (!Object.op_Implicit((Object)(object)ear))
			{
				GameObject val3 = new GameObject("Madara Cleaver Ear");
				val3.transform.position = corePosition;
				ear = val3.AddComponent<CleaverEar>();
				ear.body = b;
			}
			ear.rig = val2;
			CleaverEar obj = ear;
			Vector3 val4 = corePosition - position;
			obj.dist = Mathf.Clamp(((Vector3)(ref val4)).magnitude, 6f, 14f);
			ear.until = Time.time + 3.4f;
			ear.Follow();
			if (!Object.op_Implicit((Object)(object)((Component)ear).GetComponent<AkGameObj>()))
			{
				((Component)ear).gameObject.AddComponent<AkGameObj>();
			}
			return ((Component)ear).gameObject;
		}

		public static GameObject At(CharacterBody b, CleaverEar ear)
		{
			if (!Object.op_Implicit((Object)(object)ear))
			{
				if (!Object.op_Implicit((Object)(object)b))
				{
					return null;
				}
				return ((Component)b).gameObject;
			}
			ear.until = Time.time + 3.4f;
			return ((Component)ear).gameObject;
		}

		private void Follow()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0047: 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_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_00a9: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)rig) && Object.op_Implicit((Object)(object)rig.sceneCam))
			{
				Vector3 position = ((Component)rig.sceneCam).transform.position;
				Vector3 val = body.corePosition - position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude > 0.01f)
				{
					dir = val / magnitude;
				}
				if ((Object)(object)((Component)this).transform.parent != (Object)(object)((Component)rig.sceneCam).transform)
				{
					((Component)this).transform.SetParent(((Component)rig.sceneCam).transform, true);
				}
				((Component)this).transform.position = position + dir * Mathf.Min(magnitude, dist);
			}
		}

		private void LateUpdate()
		{
			if (!Object.op_Implicit((Object)(object)body) || Time.time >= until)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Follow();
			}
		}
	}
	public static class PrimaryVoice
	{
		private sealed class St
		{
			public float last = -999f;

			public int target = -1;
		}

		private static readonly Dictionary<int, St> state = new Dictionary<int, St>();

		public static void Swing(CharacterBody body, int stage, int finisher, string key, float length)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			int instanceID = ((Object)body).GetInstanceID();
			if (!state.TryGetValue(instanceID, out var value))
			{
				value = (state[instanceID] = new St());
			}
			if (stage == 0)
			{
				value.target = ((!(Random.value < Tuning.PrimaryVoiceChance.Value)) ? (-1) : ((!(Random.value < 0.5f)) ? finisher : 0));
				Combat.Trace?.Invoke("PRIMARYVOICE string start plan=" + value.target);
			}
			if (value.target == stage)
			{
				value.target = -1;
				float num = Time.time - value.last;
				if (num < Tuning.PrimaryVoiceCooldown.Value)
				{
					Combat.Trace?.Invoke("PRIMARYVOICE cooldown skip age=" + num.ToString("0.0"));
				}
				else if (Snd.Voice(body, key, length))
				{
					value.last = Time.time;
					Combat.Trace?.Invoke("PRIMARYVOICE played " + key + " stage=" + stage);
				}
			}
		}
	}
	public static class ChakraFx
	{
		private static Transform holder;

		private static ParticleSystem core;

		private static ParticleSystem hot;

		private static ParticleSystem rim;

		private static ParticleSystem ring;

		private static ParticleSystem gring;

		private static ParticleSystem frag;

		private static ParticleSystem dust;

		private static ParticleSystem tongue;

		private static ParticleSystem ember;

		private static Texture2D thinRing;

		private static Texture2D chunk;

		private static Texture2D puff;

		public static float HotAlpha = 0.85f;

		public static float RimAlpha = 0.5f;

		public static float CoreAlpha = 1f;

		public static float RingAlpha = 1f;

		public static float FragAlpha = 1f;

		public static float DustAlpha = 0.6f;

		public static float Size = 1f;

		public static float WaveK = 1f;

		private static readonly Color CoreC = new Color(0.85f, 0.96f, 1f);

		private static readonly Color HotC = new Color(0.7f, 0.9f, 1f);

		private static readonly Color RimC = new Color(0.15f, 0.45f, 1f);

		private static readonly Color FragC = new Color(0.75f, 0.92f, 1f);

		private static readonly Color RingC = new Color(0.75f, 0.93f, 1f);

		public static float DetCore = 2.1f;

		public static float DetColumn = 1.35f;

		private static Texture2D ThinRing
		{
			get
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				//IL_004f: 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_00de: 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)
				if (!Object.op_Implicit((Object)(object)thinRing))
				{
					thinRing = new Texture2D(256, 256, (TextureFormat)4, true)
					{
						wrapMode = (TextureWrapMode)1
					};
					Color[] array = (Color[])(object)new Color[65536];
					float num = 127.5f;
					for (int i = 0; i < 256; i++)
					{
						for (int j = 0; j < 256; j++)
						{
							float num2 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num, num)) / num;
							float num3 = Mathf.Clamp01((num2 - 0.86f) / 0.03f) * Mathf.Clamp01((0.985f - num2) / 0.02f);
							num3 = Mathf.Max(num3, 0.25f * Mathf.Clamp01((num2 - 0.7f) / 0.16f) * Mathf.Clamp01((0.985f - num2) / 0.02f));
							array[i * 256 + j] = new Color(1f, 1f, 1f, num3);
						}
					}
					thinRing.SetPixels(array);
					thinRing.Apply(true);
				}
				return thinRing;
			}
		}

		private static Texture2D Chunk
		{
			get
			{
				//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_0026: Expected O, but got Unknown
				//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)
				if (!Object.op_Implicit((Object)(object)chunk))
				{
					chunk = new Texture2D(32, 32, (TextureFormat)4, true)
					{
						wrapMode = (TextureWrapMode)1
					};
					Color[] array = (Color[])(object)new Color[1024];
					for (int i = 0; i < 32; i++)
					{
						for (int j = 0; j < 32; j++)
						{
							float num = Mathf.Abs((float)j / 31f * 2f - 1f);
							float num2 = Mathf.Abs((float)i / 31f * 2f - 1f);
							float num3 = Mathf.Pow(Mathf.Pow(num, 1.4f) + Mathf.Pow(num2, 1.4f), 0.71428573f);
							float num4 = Mathf.Clamp01((1f - num3) / 0.25f);
							array[i * 32 + j] = new Color(1f, 1f, 1f, num4);
						}
					}
					chunk.SetPixels(array);
					chunk.Apply(true);
				}
				return chunk;
			}
		}

		private static Texture2D Puff
		{
			get
			{
				//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_0026: Expected O, but got Unknown
				//IL_00dd: 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_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)
				if (!Object.op_Implicit((Object)(object)puff))
				{
					puff = new Texture2D(64, 64, (TextureFormat)4, true)
					{
						wrapMode = (TextureWrapMode)1
					};
					Random random = new Random(41);
					float[,] array = new float[9, 9];
					float[,] array2 = new float[17, 17];
					for (int i = 0; i < 9; i++)
					{
						for (int j = 0; j < 9; j++)
						{
							array[i, j] = (float)random.NextDouble();
						}
					}
					for (int k = 0; k < 17; k++)
					{
						for (int l = 0; l < 17; l++)
						{
							array2[k, l] = (float)random.NextDouble();
						}
					}
					Color[] array3 = (Color[])(object)new Color[4096];
					for (int m = 0; m < 64; m++)
					{
						for (int n = 0; n < 64; n++)
						{
							float num = (float)n / 63f;
							float num2 = (float)m / 63f;
							float num3 = Vector2.Distance(new Vector2(num, num2), new Vector2(0.5f, 0.5f)) * 2f;
							float num4 = V(array, 8, num * 8f, num2 * 8f) * 0.65f + V(array2, 16, num * 16f, num2 * 16f) * 0.35f;
							float num5 = Mathf.Clamp01(((1f - num3) * 1.5f - num4 * 0.6f) / 0.35f);
							array3[m * 64 + n] = new Color(1f, 1f, 1f, num5 * num5);
						}
					}
					puff.SetPixels(array3);
					puff.Apply(true);
				}
				return puff;
				static float V(float[,] gg, int G2, float u, float v)
				{
					int num6 = Mathf.Min(G2 - 1, (int)u);
					int num7 = Mathf.Min(G2 - 1, (int)v);
					float num8 = Mathf.SmoothStep(0f, 1f, u - (float)num6);
					float num9 = Mathf.SmoothStep(0f, 1f, v - (float)num7);
					return Mathf.Lerp(Mathf.Lerp(gg[num6, num7], gg[num6 + 1, num7], num8), Mathf.Lerp(gg[num6, num7 + 1], gg[num6 + 1, num7 + 1], num8), num9);
				}
			}
		}

		private static Material Mat(Texture tex, bool add)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			Material obj = (add ? Fx.Additive(tex) : Fx.AlphaTex(tex));
			obj.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f));
			obj.SetFloat("_VertexColorOn", 1f);
			obj.EnableKeyword("VERTEXCOLOR");
			obj.SetFloat("_VertexAlphaOn", 1f);
			obj.EnableKeyword("VERTEXALPHA");
			return obj;
		}

		private static ParticleSystem Sys(string name, Material m, int max, ParticleSystemRenderMode mode, AnimationCurve size, Gradient col, float drag = 0f, float gravity = 0f, float maxScreen = 2f)
		{
			//IL_0006: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_009e: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = Fx.Particles(holder, m, Color.white, 1f, 1f, 0f, max);
			((Object)((Component)val).gameObject).name = "MadaraChakra " + name;
			MainModule main = val.main;
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity);
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
			ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>();
			component.renderMode = mode;
			component.maxParticleSize = maxScreen;
			SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, size);
			ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(col);
			if (drag > 0f)
			{
				LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val.limitVelocityOverLifetime;
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true;
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(0f);
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = drag;
			}
			return val;
		}

		private static Gradient G(params float[] ak)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return GC(Color.white, Color.white, ak);
		}

		private static Gradient GC(Color c0, Color c1, params float[] ak)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			GradientAlphaKey[] array = (GradientAlphaKey[])(object)new GradientAlphaKey[ak.Length / 2];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new GradientAlphaKey(ak[i * 2 + 1], ak[i * 2]);
			}
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(c0, 0f),
				new GradientColorKey(c1, 1f)
			}, array);
			return val;
		}

		private static AnimationCurve C(params float[] k)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AnimationCurve val = new AnimationCurve();
			for (int i = 0; i < k.Length; i += 2)
			{
				val.AddKey(new Keyframe(k[i], k[i + 1]));
			}
			for (int j = 0; j < val.length; j++)
			{
				val.SmoothTangents(j, 0f);
			}
			return val;
		}

		public static void Warm()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_00ab: 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_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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)holder))
			{
				GameObject val = new GameObject("MadaraChakraFx");
				Object.DontDestroyOnLoad((Object)val);
				holder = val.transform;
				core = Sys("core", Mat((Texture)(object)Fx.Soft, add: true), 60, (ParticleSystemRenderMode)0, C(0f, 0.35f, 0.15f, 0.9f, 0.7f, 1f, 1f, 1.1f), G(0f, 1f, 0.7f, 0.9f, 1f, 0f));
				hot = Sys("hot", Mat((Texture)(object)Puff, add: true), 400, (ParticleSystemRenderMode)0, C(0f, 0.4f, 0.3f, 0.9f, 1f, 1.25f), GC(Color.white, new Color(0.35f, 0.6f, 1f), 0f, 0f, 0.05f, 1f, 0.45f, 0.7f, 1f, 0f), 0.08f);
				RotationOverLifetimeModule rotationOverLifetime = hot.rotationOverLifetime;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-0.8f, 0.8f);
				rim = Sys("rim", Mat((Texture)(object)Puff, add: false), 400, (ParticleSystemRenderMode)0, C(0f, 0.5f, 0.35f, 0.95f, 1f, 1.3f), G(0f, 0f, 0.06f, 1f, 0.5f, 0.55f, 1f, 0f), 0.08f);
				ring = Sys("ring", Mat((Texture)(object)ThinRing, add: true), 40, (ParticleSystemRenderMode)0, C(0f, 0.08f, 0.3f, 0.9f, 1f, 1f), G(0f, 1f, 0.55f, 0.7f, 1f, 0f));
				gring = Sys("gring", Mat((Texture)(object)ThinRing, add: true), 40, (ParticleSystemRenderMode)2, C(0f, 0.06f, 0.3f, 0.85f, 1f, 1f), G(0f, 1f, 0.6f, 0.65f, 1f, 0f));
				MainModule main = gring.main;
				((MainModule)(ref main)).startRotation = MinMaxCurve.op_Implicit(0f);
				frag = Sys("frag", Mat((Texture)(object)Chunk, add: true), 400, (ParticleSystemRenderMode)0, C(0f, 1f, 0.7f, 0.75f, 1f, 0.3f), G(0f, 1f, 0.6f, 0.9f, 1f, 0f), 0.05f, 1.4f, 0.2f);
				dust = Sys("dust", Fx.SmokeMat, 500, (ParticleSystemRenderMode)0, C(0f, 0.4f, 0.3f, 0.85f, 1f, 1.25f), G(0f, 0f, 0.08f, 1f, 0.5f, 0.55f, 1f, 0f), 0.1f, -0.05f);
				RotationOverLifetimeModule rotationOverLifetime2 = dust.rotationOverLifetime;
				((RotationOverLifetimeModule)(ref rotationOverLifetime2)).enabled = true;
				((RotationOverLifetimeModule)(ref rotationOverLifetime2)).z = new MinMaxCurve(-0.6f, 0.6f);
				Material val2 = Mat((Texture)(object)SusanooVisual.TongueTex, add: false);
				val2.renderQueue = 3000;
				tongue = Sys("tongue", val2, 300, (ParticleSystemRenderMode)0, C(0f, 0.55f, 0.4f, 1f, 1f, 0.75f), G(0f, 0f, 0.2f, 1f, 0.6f, 0.6f, 1f, 0f), 0.05f, -0.15f, 0.35f);
				MainModule main2 = tongue.main;
				((MainModule)(ref main2)).startRotation = MinMaxCurve.op_Implicit(0f);
				((MainModule)(ref main2)).startSize3D = true;
				ember = Sys("ember", Mat((Texture)(object)Fx.Soft, add: true), 300, (ParticleSystemRenderMode)0, C(0f, 1f, 0.6f, 0.8f, 1f, 0.2f), G(0f, 0f, 0.1f, 1f, 0.7f, 0.8f, 1f, 0f), 0.06f, -0.25f, 0.03f);
			}
		}

		public static void Tongue(Vector3 p, Vector3 v, float w, float h, float life, Color c)
		{
			//IL_000c: 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_001c: 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_0040: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			ParticleSystem obj = tongue;
			EmitParams val = default(EmitParams);
			((EmitParams)(ref val)).position = p;
			((EmitParams)(ref val)).velocity = v;
			((EmitParams)(ref val)).startSize3D = new Vector3(w, h, 1f);
			((EmitParams)(ref val)).startLifetime = life;
			((EmitParams)(ref val)).startColor = Color32.op_Implicit(c);
			obj.Emit(val, 1);
		}

		private static void E(ParticleSystem ps, Vector3 p, Vector3 v, float size, float life, Color c)
		{
			//IL_0003: 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_0013: 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_002e: 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)
			EmitParams val = default(EmitParams);
			((EmitParams)(ref val)).position = p;
			((EmitParams)(ref val)).velocity = v;
			((EmitParams)(ref val)).startSize = size;
			((EmitParams)(ref val)).startLifetime = life;
			((EmitParams)(ref val)).startColor = Color32.op_Implicit(c);
			ps.Emit(val, 1);
		}

		public static void Burst(Vector3 at, float R, float power, bool groundFx = true)
		{
			//IL_001a: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00ab: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			R *= Size;
			float num = Mathf.Sqrt(R);
			E(core, at, Vector3.zero, R * 1.3f, 0.26f, new Color(CoreC.r, CoreC.g, CoreC.b, CoreAlpha));
			int num2 = Mathf.Clamp(Mathf.RoundToInt(8f + R * 2.5f), 8, 28);
			for (int i = 0; i < num2; i++)
			{
				Vector3 onUnitSphere = Random.onUnitSphere;
				onUnitSphere.y = Mathf.Abs(onUnitSphere.y) * 0.7f + 0.1f;
				E(hot, at + onUnitSphere * R * 0.1f, onUnitSphere * R * Random.Range(1.6f, 2.6f), R * Random.Range(0.7f, 1.05f), Random.Range(0.35f, 0.55f), new Color(HotC.r, HotC.g, HotC.b, HotAlpha * Random.Range(0.75f, 1f)));
				if (i % 2 == 0)
				{
					onUnitSphere = Random.onUnitSphere;
					onUnitSphere.y = Mathf.Abs(onUnitSphere.y) * 0.6f + 0.05f;
					E(rim, at + onUnitSphere * R * 0.3f, onUnitSphere * R * Random.Range(2.4f, 3.4f), R * Random.Range(0.8f, 1.2f), Random.Range(0.45f, 0.7f), new Color(RimC.r, RimC.g, RimC.b, RimAlpha * Random.Range(0.7f, 1f)));
				}
			}
			E(ring, at, Vector3.zero, R * 3f, 0.3f + 0.05f * power, new Color(RingC.r, RingC.g, RingC.b, RingAlpha));
			int num3 = Mathf.Clamp(Mathf.RoundToInt(6f + R * 1.5f * (0.5f + power * 0.5f)), 6, 16);
			for (int j = 0; j < num3; j++)
			{
				Vector3 onUnitSphere2 = Random.onUnitSphere;
				onUnitSphere2.y = Mathf.Abs(onUnitSphere2.y) + 0.25f;
				E(frag, at + onUnitSphere2 * R * 0.2f, ((Vector3)(ref onUnitSphere2)).normalized * R * Random.Range(4f, 7f), Random.Range(0.25f, 0.45f) * num, Random.Range(0.4f, 0.7f), new Color(FragC.r, FragC.g, FragC.b, FragAlpha));
			}
			RaycastHit val = default(RaycastHit);
			if (groundFx && Physics.Raycast(at + Vector3.up * 0.5f, Vector3.down, ref val, R * 1.5f + 1.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				Ground(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal, R * 2.2f, power, wall: false);
			}
		}

		public static void Detonation(Vector3 at, float R, float k = 1f)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_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)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00bc: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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_0175: 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_018c: 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)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			R *= Size;
			float num = ((k >= 1f) ? 1f : Mathf.Lerp(0.7f, 1f, k));
			E(core, at + Vector3.up * R * 0.3f, Vector3.zero, R * DetCore, 0.34f * num, new Color(CoreC.r, CoreC.g, CoreC.b, CoreAlpha));
			if (k >= 0.6f)
			{
				E(core, at + Vector3.up * R * 0.9f, Vector3.up * R * 2f, R * 1.3f, 0.4f, new Color(0.6f, 0.85f, 1f, CoreAlpha * 0.7f));
			}
			int num2 = ((k >= 1f) ? 26 : (Mathf.Max(6, Mathf.RoundToInt(26f * k)) & -2));
			int num3 = ((k >= 1f) ? 14 : Mathf.Max(3, Mathf.RoundToInt(14f * k)));
			for (int i = 0; i < num2; i++)
			{
				bool flag = i % 2 == 0;
				Vector3 onUnitSphere = Random.onUnitSphere;
				onUnitSphere.y = Mathf.Abs(onUnitSphere.y) * 0.6f + 0.1f;
				Vector3 v = (flag ? ((Vector3.up * Random.Range(2.4f, 4.2f) * DetColumn + new Vector3(onUnitSphere.x, 0f, onUnitSphere.z) * 0.6f) * R) : (onUnitSphere * R * Random.Range(1.8f, 2.8f)));
				E(hot, at + (flag ? (Vector3.up * R * 0.3f) : (onUnitSphere * R * 0.15f)), v, R * Random.Range(0.75f, 1.15f), Random.Range(0.45f, 0.7f) * num, new Color(HotC.r, HotC.g, HotC.b, HotAlpha * Random.Range(0.8f, 1f)));
				if (i % 2 == 1)
				{
					onUnitSphere = Random.onUnitSphere;
					onUnitSphere.y = Mathf.Abs(onUnitSphere.y) * 0.7f + 0.1f;
					E(rim, at + onUnitSphere * R * 0.35f, onUnitSphere * R * Random.Range(2.4f, 3.4f) + Vector3.up * R, R * Random.Range(0.85f, 1.25f), Random.Range(0.55f, 0.8f) * num, new Color(RimC.r, RimC.g, RimC.b, RimAlpha * Random.Range(0.8f, 1f)));
				}
			}
			for (int j = 0; j < num3; j++)
			{
				Vector3 onUnitSphere2 = Random.onUnitSphere;
				onUnitSphere2.y = Mathf.Abs(onUnitSphere2.y) + 0.4f;
				E(ember, at + onUnitSphere2 * R * 0.2f, ((Vector3)(ref onUnitSphere2)).normalized * R * Random.Range(2.5f, 5f), Random.Range(0.25f, 0.45f), Random.Range(0.5f, 0.9f), new Color(0.7f, 0.9f, 1f, 0.9f));
			}
		}

		public static void Spark(Vector3 p, Vector3 v, float size, float life)
		{
			//IL_000a: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			E(ember, p, v, size, life, new Color(0.65f, 0.88f, 1f, 0.85f));
		}

		public static void GroundDust(Vector3 g, Vector3 n, float R)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0031: 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_003f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a9: 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_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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			Vector3 val = ((((Vector3)(ref n)).sqrMagnitude > 0.1f) ? n : Vector3.up);
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < 10; i++)
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
				((Vector3)(ref val2))..ctor(normalized.x, 0f, normalized.y);
				Color c = WindFx.DustTint();
				c.a = DustAlpha * Random.Range(0.4f, 0.7f);
				E(dust, g + val2 * R * 0.35f + val * 0.6f, (val2 * Random.Range(1.2f, 2.2f) + val * Random.Range(0.4f, 1f)) * R * 0.6f, R * Random.Range(0.45f, 0.7f), Random.Range(0.9f, 1.3f), c);
			}
		}

		public static void Ground(Vector3 g, Vector3 n, float D, float power, bool wall)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_002a: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00bc: 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_00d4: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			Vector3 val = ((((Vector3)(ref n)).sqrMagnitude > 0.1f) ? n : Vector3.up);
			float num = D * 0.5f;
			E(gring, g + val * 0.2f, Vector3.zero, D, 0.35f + 0.08f * power, new Color(RingC.r, RingC.g, RingC.b, RingAlpha));
			int num2 = Mathf.Clamp(Mathf.RoundToInt((6f + num * 2f) * (0.5f + power * 0.5f)), 4, 36);
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < num2; i++)
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
				((Vector3)(ref val2))..ctor(normalized.x, 0f, normalized.y);
				Color c = WindFx.DustTint();
				c.a = DustAlpha * Random.Range(0.6f, 1f);
				if (wall)
				{
					E(dust, g + val2 * num * Random.Range(0.6f, 0.9f) + val * 0.5f, val2 * num * Random.Range(0.6f, 1.2f) + val * Random.Range(3f, 7f), Random.Range(1.6f, 2.6f) * Mathf.Sqrt(num), Random.Range(0.9f, 1.4f), c);
				}
				else
				{
					E(dust, g + val2 * num * 0.3f + val * 0.4f, (val2 * Random.Range(1.8f, 3.2f) + val * Random.Range(0.4f, 1.2f)) * num * 0.7f, num * Random.Range(0.4f, 0.7f), Random.Range(0.8f, 1.2f), c);
				}
			}
			if (power >= 0.9f)
			{
				Fx.Debris(g, num * 0.3f, Mathf.Clamp(Mathf.RoundToInt(num * power), 4, 14), 6f + num);
			}
		}

		public static void GroundPuff(Vector3 g, Vector3 n, Vector3 along, float scale)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0093: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			Color c = WindFx.DustTint();
			c.a = DustAlpha * 0.8f;
			E(dust, g + n * 0.3f, (n * Random.Range(0.6f, 1.4f) + along * Random.Range(1f, 2.5f)) * scale, Random.Range(1.2f, 2f) * scale, Random.Range(0.6f, 0.9f), c);
			E(hot, g + n * 0.4f, (n * 1.2f + along * 1.5f + Random.insideUnitSphere) * scale, Random.Range(0.5f, 0.8f) * scale, Random.Range(0.3f, 0.45f), new Color(HotC.r, HotC.g, HotC.b, HotAlpha * 0.6f));
		}

		public static void WaveSlice(Vector3 p, Vector3 fwd, Vector3 side, float W, float H)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0049: 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_0050: 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_0065: 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_00d0: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			Warm();
			for (int i = 0; i < 4; i++)
			{
				float num = Random.Range(-0.5f, 0.5f) * W;
				Vector3 val = p + side * num + Vector3.up * Random.Range(1f, 4f);
				E(hot, val, fwd * Random.Range(8f, 14f) + Vector3.up * Random.Range(6f, 12f), Random.Range(5f, 8f) * WaveK, Random.Range(0.5f, 0.8f), new Color(HotC.r, HotC.g, HotC.b, HotAlpha * 0.9f));
				E(rim, val + Vector3.up * 2f, fwd * Random.Range(6f, 10f) + Vector3.up * Random.Range(4f, 9f), Random.Range(6f, 10f) * WaveK, Random.Range(0.6f, 0.9f), new Color(RimC.r, RimC.g, RimC.b, RimAlpha * 0.8f));
			}
			if (Random.value < 0.5f)
			{
				Vector3 val2 = fwd + Vector3.up * 0.6f;
				E(frag, p + Vector3.up * 2f, val2 * Random.Range(10f, 18f) + side * Random.Range(-6f, 6f), Random.Range(0.6f, 1f), Random.Range(0.5f, 0.8f), new Color(FragC.r, FragC.g, FragC.b, FragAlpha));
			}
		}
	}
	public sealed class CleaverSkillDef : SkillDef
	{
		private static bool Ok(GenericSkill s)
		{
			MadaraController madaraController = ((Object.op_Implicit((Object)(object)s) && Object.op_Implicit((Object)(object)s.characterBody)) ? ((Component)s.characterBody).GetComponent<MadaraController>() : null);
			if (Object.op_Implicit((Object)(object)madaraController) && madaraController.CurrentForm == MadaraController.Form.Susanoo && !madaraController.CleaverUsed)
			{
				return !madaraController.CleaverRunning;
			}
			return false;
		}

		public override bool CanExecute(GenericSkill s)
		{
			if (Ok(s))
			{
				return ((SkillDef)this).CanExecute(s);
			}
			return false;
		}

		public override bool IsReady(GenericSkill s)
		{
			if (Ok(s))
			{
				return ((SkillDef)this).IsReady(s);
			}
			return false;
		}
	}
	public static class CleaverTimeline
	{
		public static float Manifest = 0.8f;

		public static float Raise = 0.45f;

		public static float Hold = 0.45f;

		public static float Coil = 0.25f;

		public static float Cut = 0.15f;

		public static float After = 0.75f;

		public static float Dissolve = 0.7f;

		public const float TopF = 9f;

		public const float HoldF = 9.6f;

		public const float CutStartF = 22f;

		public const float CutEndF = 26.5f;

		public const float ImpactF = 26f;

		public const float AfterF = 40f;

		public const float EndF = 52f;

		public static float TTop => Manifest + Raise;

		public static float TCoil => TTop + Hold;

		public static float TCut => TCoil + Coil;

		public static float TAfter => TCut + Cut;

		public static float TDissolve => TAfter + After;

		public static float Total => TDissolve + Dissolve;

		public static float ImpactTime => TCut + Cut * 4f / 4.5f;

		private static float Smooth(float k)
		{
			k = Mathf.Clamp01(k);
			return k * k * (3f - 2f * k);
		}

		public static void Pose(float t, out string clip, out float f)
		{
			clip = "atk02";
			if (t < Manifest)
			{
				clip = "ent0";
				f = 18f * (1f - Mathf.Pow(1f - Mathf.Clamp01(t / Manifest), 2f));
			}
			else if (t < TTop)
			{
				f = Mathf.Lerp(0f, 9f, Smooth((t - Manifest) / Raise));
			}
			else if (t < TCoil)
			{
				f = Mathf.Lerp(9f, 9.6f, (t - TTop) / Hold);
			}
			else if (t < TCut)
			{
				float num = Mathf.Clamp01((t - TCoil) / Coil);
				f = Mathf.Lerp(9.6f, 22f, num * num);
			}
			else if (t < TAfter)
			{
				f = Mathf.Lerp(22f, 26.5f, (t - TCut) / Cut);
			}
			else if (t < TDissolve)
			{
				f = Mathf.Lerp(26.5f, 40f, Smooth((t - TAfter) / After));
			}
			else
			{
				f = Mathf.Lerp(40f, 52f, Mathf.Clamp01((t - TDissolve) / Dissolve));
			}
		}

		public static void Blade(float f, out Vector3 hilt, out Vector3 tip)
		{
			//IL_002e: 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_0030: 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_0037: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_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_0053: 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_0067: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.FloorToInt(f);
			float num2 = f - (float)num;
			SusanooBlade.Sample("atk02", num, out var hilt2, out var tip2);
			SusanooBlade.Sample("atk02", num + 1, out var hilt3, out var tip3);
			Vector3 val = tip2 - hilt2;
			Vector3 val2 = tip3 - hilt3;
			hilt = Vector3.Lerp(hilt2, hilt3, num2);
			tip = hilt + Vector3.Slerp(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized, num2) * Mathf.Lerp(((Vector3)(ref val)).magnitude, ((Vector3)(ref val2)).magnitude, num2);
		}
	}
	public sealed class CleaverWeaponLock : BaseState
	{
		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Body");
				if (((EntityState)this).fixedAge > 6f || !Object.op_Implicit((Object)(object)val) || !(val.state is MountainCleaver))
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public sealed class MountainCleaver : BaseState
	{
		private struct Pending
		{
			public HurtBox h;

			public string kind;

			public float frame;

			public float age;
		}

		public static float WaveSpeed = 150f;

		public static float Margin = 4f;

		public static float EdgeExtend = 0.1f;

		public static int DealsPerStep = 4;

		public static int Casts;

		public static int Hits;

		public static string LastSummary = "";

		private Vector3 fwd;

		private Vector3 ground;

		private Quaternion rot;

		private float S;

		private float lastAge;

		private float impactZ;

		private MadaraController c;

		private PerfectSusanoo giant;

		private ActionPlay act;

		private bool valid = true;

		private bool thrust;

		private bool camOff;

		private bool crit;

		private readonly HashSet<HealthComponent> done = new HashSet<HealthComponent>();

		private readonly Dictionary<HealthComponent, HurtBox> cand = new Dictionary<HealthComponent, HurtBox>();

		private readonly List<Pending> pending = new List<Pending>();

		private int hitsThisCast;

		private int blade;

		private int impact;

		private int wave;

		public static float StateEnd => CleaverTimeline.TDissolve + 0.1f;

		public override void OnEnter()
		{
			//IL_0020: 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_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_0032: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c3: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((BaseState)this).OnEnter();
			c = ((EntityState)this).GetComponent<MadaraController>();
			Casts++;
			Ray aimRay = ((BaseState)this).GetAimRay();
			fwd = Aim.Flat(((Ray)(ref aimRay)).direction);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = fwd;
			}
			rot = Quaternion.LookRotation(fwd, Vector3.up);
			ground = Combat.Ground(((EntityState)this).characterBody.footPosition + Vector3.up * 0.5f, 80f);
			S = Mathf.Max(1f, Tuning.CleaverScale.Value);
			CleaverTimeline.Blade(26f, out var _, out var tip);
			impactZ = tip.z * S;
			if (Object.op_Implicit((Object)(object)c))
			{
				if (NetworkServer.active)
				{
					if (c.CleaverUsed && !((EntityState)this).isAuthority)
					{
						valid = false;
					}
					c.ServerUseCleaver();
				}
				else
				{
					c.CleaverUsed = true;
				}
				c.CleaverUntil = Time.fixedTime + CleaverTimeline.Total + 0.5f;
				c.CleaverCamGround = ground;
				c.CleaverCamFwd = fwd;
				c.CleaverCamera(on: true, 0.35f);
			}
			if (((EntityState)this).isAuthority)
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Weapon");
				if (Object.op_Implicit((Object)(object)val))
				{
					val.SetNextState((EntityState)(object)new CleaverWeaponLock());
				}
			}
			giant = PerfectSusanoo.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)giant))
			{
				giant.Play(ground, fwd, S);
			}
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)charVisual))
			{
				act = new ActionPlay
				{
					clip = "awa0",
					startF = 0f,
					endF = 17f,
					duration = 0.8f,
					holdEnd = true
				};
				charVisual.PlayAction(act);
				if (Object.op_Implicit((Object)(object)charVisual.Eyes))
				{
					charVisual.Eyes.Flash(1.6f, 2.6f);
				}
			}
			crit = ((EntityState)this).characterBody.RollCrit();
			((EntityState)this).characterBody.SetAimTimer(CleaverTimeline.Total);
			Combat.Trace?.Invoke("CLEAVER_BEGIN valid=" + valid + " ground=" + ((Vector3)(ref ground)).ToString("F1") + " fwd=" + ((Vector3)(ref fwd)).ToString("F2") + " S=" + S + " impactFromMadara=" + (impactZ - PerfectSusanoo.Back).ToString("0.0") + " tImpact=" + CleaverTimeline.ImpactTime.ToString("0.000") + " left=" + (Object.op_Implicit((Object)(object)c) ? c.Remaining.ToString("0.0") : "?"));
		}

		public override void FixedUpdate()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!Sus.Active((EntityState)(object)this))
			{
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				return;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.moveDirection = Vector3.zero;
				if (((EntityState)this).characterMotor.isGrounded)
				{
					((EntityState)this).characterMotor.velocity = new Vector3(0f, ((EntityState)this).characterMotor.velocity.y, 0f);
				}
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = fwd;
			}
			if (!thrust && ((EntityState)this).fixedAge >= CleaverTimeline.TCoil)
			{
				thrust = true;
				CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
				if (Object.op_Implicit((Object)(object)charVisual))
				{
					if (act != null)
					{
						charVisual.EndAction(act);
					}
					act = new ActionPlay
					{
						clip = "cmr00",
						startF = 0f,
						endF = 9f,
						duration = 0.3f,
						holdEnd = true
					};
					charVisual.PlayAction(act);
				}
			}
			if (NetworkServer.active && valid)
			{
				Damage(lastAge, ((EntityState)this).fixedAge);
			}
			lastAge = ((EntityState)this).fixedAge;
			DealPending(DealsPerStep);
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= StateEnd)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Damage(float a0, float a1)
		{
			//IL_00b0: 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_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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			float tCut = CleaverTimeline.TCut;
			float tAfter = CleaverTimeline.TAfter;
			float impactTime = CleaverTimeline.ImpactTime;
			float value = Tuning.CleaverLength.Value;
			float value2 = Tuning.CleaverWidth.Value;
			float value3 = Tuning.CleaverHeight.Value;
			float back = PerfectSusanoo.Back;
			bool flag = a1 > tCut && a0 < tAfter;
			bool flag2 = a0 < impactTime && a1 >= impactTime;
			bool flag3 = a1 > impactTime;
			if (!flag && !flag2 && !flag3)
			{
				return;
			}
			float num = impactZ - back + Mathf.Max(0f, a1 - impactTime) * WaveSpeed;
			if (flag3 && !flag2 && num - (a1 - a0) * WaveSpeed > value + 5f)
			{
				return;
			}
			CharacterBody characterBody = ((EntityState)this).characterBody;
			Vector3 val = ground - fwd * back;
			Combat.Box(characterBody, ground + fwd * (value * 0.5f - 4f) + Vector3.up * (value3 - 40f) * 0.5f, new Vector3(value2 * 0.5f, (value3 + 40f) * 0.5f, value * 0.5f + 4f), rot, cand);
			if (cand.Count == 0)
			{
				return;
			}
			Quaternion val2 = Quaternion.Inverse(rot);
			float f = 0f;
			float f2 = 0f;
			int num2 = 0;
			if (flag)
			{
				CleaverTimeline.Pose(Mathf.Max(a0, tCut), out var clip, out f);
				CleaverTimeline.Pose(Mathf.Min(a1, tAfter - 0.0001f), out clip, out f2);
				num2 = Mathf.Max(1, Mathf.CeilToInt((f2 - f) / 0.25f));
			}
			Vector2 p = default(Vector2);
			foreach (KeyValuePair<HealthComponent, HurtBox> item in cand)
			{
				HealthComponent key = item.Key;
				HurtBox value4 = item.Value;
				if (done.Contains(key))
				{
					continue;
				}
				Vector3 val3;
				if (!Object.op_Implicit((Object)(object)value4.collider))
				{
					val3 = ((Component)value4).transform.position;
				}
				else
				{
					Bounds bounds = value4.collider.bounds;
					val3 = ((Bounds)(ref bounds)).center;
				}
				Vector3 val4 = val3;
				Vector3 val5 = val2 * (val4 - val);
				if (Mathf.Abs(val5.x) > value2 * 0.5f || val5.z < -2f)
				{
					continue;
				}
				string text = null;
				float frame = 0f;
				if (flag && f2 > f)
				{
					((Vector2)(ref p))..ctor(val5.z, val5.y);
					BladeYZ(f, out var h, out var t);
					for (int i = 1; i <= num2; i++)
					{
						if (text != null)
						{
							break;
						}
						float num3 = Mathf.Lerp(f, f2, (float)i / (float)num2);
						BladeYZ(num3, out var h2, out var t2);
						if (InQuad(p, h, t, t2, h2) || SegDist(p, h2, t2) < Margin)
						{
							text = "blade";
							frame = num3;
						}
						h = h2;
						t = t2;
					}
				}
				if (text == null && flag2 && val5.z <= impactZ + Margin)
				{
					text = "impact";
					frame = 26f;
				}
				if (text == null && flag3 && !flag2 && val5.z - back <= Mathf.Min(value, num))
				{
					text = "wave";
					frame = 26f;
				}
				if (text != null)
				{
					done.Add(key);
					pending.Add(new Pending
					{
						h = value4,
						kind = text,
						frame = frame,
						age = a1
					});
					float num4 = Mathf.Atan2(val5.z, val5.y - 3.4f * S) * 57.29578f;
					Combat.Trace?.Invoke("CLEAVER_HIT kind=" + text + " victim=" + (Object.op_Implicit((Object)(object)key.body) ? ((Object)key.body).name : ((Object)key).name) + " age=" + a1.ToString("0.000") + " frame=" + frame.ToString("0.00") + " fwd=" + (val5.z - back).ToString("0.0") + " side=" + val5.x.ToString("0.0") + " up=" + (val4.y - ground.y).ToString("0.0") + " phi=" + num4.ToString("0"));
				}
			}
		}

		private void BladeYZ(float f, out Vector2 h, out Vector2 t)
		{
			//IL_000a: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_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_0045: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			CleaverTimeline.Blade(f, out var hilt, out var tip);
			tip += (tip - hilt) * EdgeExtend;
			h = new Vector2(hilt.z, hilt.y) * S;
			t = new Vector2(tip.z, tip.y) * S;
		}

		private static float Cross(Vector2 a, Vector2 b)
		{
			//IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return a.x * b.y - a.y * b.x;
		}

		private static bool InTri(Vector2 p, Vector2 a, Vector2 b, Vector2 c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_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_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_0029: 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_0030: 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)
			float num = Cross(b - a, p - a);
			float num2 = Cross(c - b, p - b);
			float num3 = Cross(a - c, p - c);
			if (num < 0f || num2 < 0f || num3 < 0f)
			{
				if (!(num > 0f) && !(num2 > 0f))
				{
					return !(num3 > 0f);
				}
				return false;
			}
			return true;
		}

		private static bool InQuad(Vector2 p, Vector2 a, Vector2 b, Vector2 c, Vector2 d)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_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_001a: 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_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_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!InTri(p, a, b, c) && !InTri(p, a, c, d) && !InTri(p, a, b, d))
			{
				return InTri(p, b, c, d);
			}
			return true;
		}

		private static float SegDist(Vector2 p, Vector2 a, Vector2 b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = b - a;
			float num = Mathf.Clamp01(Vector2.Dot(p - a, val) / Mathf.Max(0.0001f, ((Vector2)(ref val)).sqrMagnitude));
			Vector2 val2 = a + val * num - p;
			return ((Vector2)(ref val2)).magnitude;
		}

		private void DealPending(int max)
		{
			//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_00b9: 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_00be: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			if (this.pending.Count == 0 || !NetworkServer.active)
			{
				return;
			}
			CharacterBody characterBody = ((EntityState)this).characterBody;
			int num = 0;
			float value = Tuning.CleaverDamage.Value;
			float value2 = Tuning.CleaverProc.Value;
			while (this.pending.Count > 0 && num < max)
			{
				Pending pending = this.pending[0];
				this.pending.RemoveAt(0);
				if (!Object.op_Implicit((Object)(object)pending.h) || !Object.op_Implicit((Object)(object)pending.h.healthComponent))
				{
					continue;
				}
				num++;
				Vector3 val;
				if (!Object.op_Implicit((Object)(object)pending.h.collider))
				{
					val = ((Component)pending.h).transform.position;
				}
				else
				{
					Bounds bounds = pending.h.collider.bounds;
					val = ((Bounds)(ref bounds)).center;
				}
				Vector3 val2 = val;
				Combat.Source = "Cleaver." + pending.kind;
				Vector3 val3 = fwd * 0.55f + Vector3.up * 0.8f;
				Vector3 force = ((Vector3)(ref val3)).normalized * 3500f;
				if (Combat.Deal(characterBody, pending.h, val2, value, value2, crit, force, (DamageType)0, null, (DamageColorIndex)0, (DamageSource)8))
				{
					hitsThisCast++;
					Hits++;
					if (pending.kind == "blade")
					{
						blade++;
					}
					else if (pending.kind == "impact")
					{
						impact++;
					}
					else
					{
						wave++;
					}
					if (hitsThisCast <= 3)
					{
						Fx.Emit(SusanooFx.SwordImpact, val2, 3f, val2 - fwd);
					}
				}
				Combat.Trace?.Invoke("CLEAVER_DEAL kind=" + pending.kind + " decidedAge=" + pending.age.ToString("0.000") + " dealtAge=" + ((EntityState)this).fixedAge.ToString("0.000") + " frame=" + pending.frame.ToString("0.00"));
			}
		}

		public override void OnExit()
		{
			if (NetworkServer.active && valid && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive)
			{
				DealPending(999);
			}
			LastSummary = "hits=" + hitsThisCast + " blade=" + blade + " impact=" + impact + " wave=" + wave + " age=" + ((EntityState)this).fixedAge.ToString("0.00");
			Combat.Trace?.Invoke("CLEAVER_END " + LastSummary + " form=" + (Object.op_Implicit((Object)(object)c) ? c.CurrentForm.ToString() : "?") + " left=" + (Object.op_Implicit((Object)(object)c) ? c.Remaining.ToString("0.0") : "?"));
			if (Object.op_Implicit((Object)(object)c))
			{
				c.CleaverUntil = -1f;
				if (((EntityState)this).fixedAge >= StateEnd - 0.05f && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive)
				{
					c.CleaverCameraOffLater(0.6f, 1.1f);
				}
				else
				{
					c.CleaverCamera(on: false, 0.5f);
				}
			}
			if (Object.op_Implicit((Object)(object)giant) && ((EntityState)this).fixedAge < CleaverTimeline.TDissolve - 0.05f)
			{
				giant.Abort();
			}
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)charVisual) && act != null)
			{
				charVisual.EndAction(act);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	[DefaultExecutionOrder(1002)]
	public sealed class PerfectSusanoo : MonoBehaviour
	{
		public SusanooVisual sv;

		private CharacterBody body;

		private SusanooVisual giant;

		private Transform holder;

		private Transform fxRoot;

		private Transform hiltBone;

		private float start;

		private float abortAt = -1f;

		private float S = 8f;

		private float abortScale;

		private float curAge;

		private float curFade;

		private float lastF = -1f;

		private Vector3 anchor;

		private Vector3 ground;

		private Vector3 fwd;

		private Vector3 abortPos;

		private Quaternion rot;

		private string curClip;

		private int warm;

		private readonly CleaverFx fx = new CleaverFx();

		private bool sCut;

		private bool sImpact;

		private bool sDissolve;

		private bool fxLive;

		private float impactD;

		private CleaverEar ear;

		public static float SlashInner = 0.62f;

		public static float Back = 6f;

		public static float WaveHeight = 30f;

		public static float ManifestDelay = 0.2f;

		public static float ThinTo = 0.6f;

		public static float BladeCharge = 2.2f;

		public static float CamInsideThin = 0.7f;

		public static float CamInside;

		private float camFade = 1f;

		public bool Playing { get; private set; }

		public SusanooVisual Giant => giant;

		public static PerfectSusanoo Find(CharacterBody b)
		{
			CharVisual charVisual = CharVisual.Find(b);
			if (!Object.op_Implicit((Object)(object)charVisual))
			{
				return null;
			}
			return ((Component)charVisual).GetComponent<PerfectSusanoo>();
		}

		public IEnumerable<Renderer> Renderers()
		{
			if (Object.op_Implicit((Object)(object)giant) && Object.op_Implicit((Object)(object)giant.Rig))
			{
				SkinnedMeshRenderer[] componentsInChildren = ((Component)giant.Rig).GetComponentsInChildren<SkinnedMeshRenderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					yield return (Renderer)(object)componentsInChildren[i];
				}
			}
		}

		private void Start()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)sv))
			{
				sv = ((Component)this).GetComponent<SusanooVisual>();
			}
			body = ((Object.op_Implicit((Object)(object)sv) && Object.op_Implicit((Object)(object)sv.madara)) ? sv.madara.body : null);
			if (!Object.op_Implicit((Object)(object)body))
			{
				((Behaviour)this).enabled = false;
				return;
			}
			try
			{
				holder = new GameObject("Madara Perfect Susanoo").transform;
				giant = ((Component)holder).gameObject.AddComponent<SusanooVisual>();
				giant.Giant = true;
				giant.madara = sv.madara;
				giant.GiantWeight = (string r) => Stagger(r, curAge) * curFade;
				fxRoot = new GameObject("Madara Mountain Cleaver FX").transform;
				fx.BuildObjects(fxRoot);
				warm = 4;
				curAge = 10f;
				curFade = 0.004f;
				giant.GiantFade = 0.004f;
				giant.GiantScale = 8f;
				giant.GiantRot = Quaternion.identity;
				giant.GiantPos = ((Component)this).transform.position + Vector3.down * 30f;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("MADARA_CLEAVER build " + ex));
				((Behaviour)this).enabled = false;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)holder))
			{
				Object.Destroy((Object)(object)((Component)holder).gameObject);
			}
			if (Object.op_Implicit((Object)(object)fxRoot))
			{
				Object.Destroy((Object)(object)((Component)fxRoot).gameObject);
			}
			if (Object.op_Implicit((Object)(object)sv))
			{
				sv.CleaverFade = 1f;
			}
		}

		public void Play(Vector3 groundAt, Vector3 forward, float scale)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)giant))
			{
				return;
			}
			warm = 0;
			ground = groundAt;
			fwd = forward;
			rot = Quaternion.LookRotation(fwd, Vector3.up);
			S = scale;
			anchor = ground - fwd * Back;
			start = Time.time;
			abortAt = -1f;
			Playing = true;
			fxLive = false;
			curClip = null;
			sCut = (sImpact = (sDissolve = false));
			lastF = -1f;
			CleaverTimeline.Blade(26f, out var _, out var tip);
			impactD = tip.z * S - Back;
			((Component)fxRoot).gameObject.SetActive(true);
			fx.Reset();
			if (giant.Slash != null)
			{
				giant.Slash.Clear();
			}
			Animation anim = giant.Anim;
			if (Object.op_Implicit((Object)(object)anim))
			{
				foreach (AnimationState item in anim)
				{
					item.enabled = false;
				}
			}
			giant.BladeBoost = 1f;
			giant.GiantThin = 1f;
			camFade = 1f;
			Place(0f);
			fx.Manifest((Object.op_Implicit((Object)(object)sv) && Object.op_Implicit((Object)(object)sv.madara)) ? sv.madara.Presentation.position : ground, S);
			GameObject at = CleaverEar.Begin(body, ref ear);
			Snd.Sfx("Cleaver_Manifest", at);
			Snd.VoiceAt(body, "Cleaver", 2.4f, grunt: false, at);
		}

		public void Abort()
		{
			//IL_0063: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			if (Playing && !(abortAt >= 0f))
			{
				abortAt = Time.time;
				abortScale = (Object.op_Implicit((Object)(object)giant) ? giant.GiantScale : S);
				abortPos = (Object.op_Implicit((Object)(object)giant) ? giant.GiantPos : anchor);
			}
		}

		private void Stop()
		{
			Playing = false;
			if (Object.op_Implicit((Object)(object)giant))
			{
				giant.GiantFade = 0f;
				giant.BladeBoost = 1f;
			}
			fxLive = sImpact && abortAt < 0f;
			if (Object.op_Implicit((Object)(object)fxRoot) && !fxLive)
			{
				((Component)fxRoot).gameObject.SetActive(false);
			}
			if (Object.op_Implicit((Object)(object)sv))
			{
				sv.CleaverFade = 1f;
			}
		}

		private void TickFx()
		{
			//IL_0038: 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)
			if (!fx.Tick(Time.time - start - CleaverTimeline.ImpactTime, impactD, MountainCleaver.WaveSpeed, Tuning.CleaverLength.Value, Tuning.CleaverWidth.Value, ground, fwd) && !Playing)
			{
				fxLive = false;
				if (Object.op_Implicit((Object)(object)fxRoot))
				{
					((Component)fxRoot).gameObject.SetActive(false);
				}
			}
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)giant))
			{
				return;
			}
			Animation anim = giant.Anim;
			if (warm > 0 || !Playing || !Object.op_Implicit((Object)(object)anim))
			{
				return;
			}
			float num = Time.time - start;
			CleaverTimeline.Pose(num, out var clip, out var f);
			AnimationState val = anim[clip];
			if (TrackedReference.op_Implicit((TrackedReference)(object)val))
			{
				if (clip != curClip)
				{
					val.wrapMode = (WrapMode)8;
					val.speed = 0f;
					val.time = f / 30f;
					if (curClip == null)
					{
						anim.Play(clip);
					}
					else
					{
						AnimationState val2 = anim[curClip];
						if (TrackedReference.op_Implicit((TrackedReference)(object)val2))
						{
							val2.speed = 0f;
						}
						anim.CrossFade(clip, 0.16f);
					}
					curClip = clip;
				}
				val.speed = 0f;
				val.time = f / 30f;
			}
			Place(num);
		}

		private void Place(float age)
		{
			//IL_0020: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing