Decompiled source of Madara Uchiha v0.6.2

plugins/Madara/Madara.dll

Decompiled 12 hours 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+8d6a26e366f7fd965e9a0d569694447352c59d7f")]
[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 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, ((Component)body).gameObject);
			Combat.Trace?.Invoke("VOICE " + (flag ? "VE_" : "V_") + key);
			return true;
		}
	}
	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 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);

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

		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 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
	{
		private sealed class Part
		{
			public SkinnedMeshRenderer r;

			public Material m;

			public Material line;

			public string region;

			public bool fire;

			public bool blade;

			public bool guard;

			public bool eye;

			public bool crest;
		}

		public SusanooVisual sv;

		private CharacterBody body;

		private Transform root;

		private Transform rig;

		private Transform fxRoot;

		private Transform hiltBone;

		private Animation anim;

		private TrailRenderer trail;

		private Transform tipT;

		private Light light;

		private readonly List<Part> parts = new List<Part>();

		private readonly List<KeyValuePair<Renderer, Transform>> eyeHalos = new List<KeyValuePair<Renderer, Transform>>();

		private float start;

		private float abortAt = -1f;

		private float S = 8f;

		private float abortScale;

		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 float impactD;

		public static float SlashInner = 0.62f;

		public static float ShellAlpha = 0.74f;

		public static float FireAlpha = 0.07f;

		public static float GuardAlpha = 0.12f;

		public static float BladeAlpha = 0.55f;

		public static float Back = 6f;

		public static float TrailWidth = 9f;

		public static float StripWidth = 5f;

		public static float WaveHeight = 30f;

		private bool fxLive;

		public static float ManifestDelay = 0.2f;

		public static float EyeSize = 0.3f;

		public static float EyeAlpha = 0.45f;

		public static float LineAlpha = 0.35f;

		public static float CrestAlpha = 0.03f;

		public static float StripAlpha = 0.12f;

		public static float ThinTo = 0.45f;

		public bool Playing { get; private set; }

		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()
		{
			foreach (Part part in parts)
			{
				yield return (Renderer)(object)part.r;
			}
		}

		private void Start()
		{
			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
			{
				Build();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("MADARA_CLEAVER build " + ex));
				((Behaviour)this).enabled = false;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)root))
			{
				Object.Destroy((Object)(object)((Component)root).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;
			}
		}

		private void Build()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Expected O, but got Unknown
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			root = new GameObject("Madara Perfect Susanoo").transform;
			rig = Rigs.Instantiate("Susanoo", root).transform;
			anim = ((Component)rig).GetComponent<Animation>();
			SkinnedMeshRenderer[] componentsInChildren = ((Component)rig).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				string name = ((Object)val).name;
				int num = name.LastIndexOf('@');
				string region = ((num >= 0) ? name.Substring(num + 1) : "torso");
				bool flag = name.Contains("fire") || name.Contains("_eff") || name.Contains("tsuba");
				bool blade = name.Contains("_eff");
				bool guard = name.Contains("tsuba");
				bool flag2 = name.Contains("_eye_");
				Texture val2 = (Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial) ? ((Renderer)val).sharedMaterial.mainTexture : null);
				Material val3 = null;
				Material val4 = Fx.Transparent(flag || flag2);
				if (flag2)
				{
					val4.mainTexture = (Texture)(object)Fx.Soft;
				}
				else if (flag)
				{
					val4.mainTexture = (Texture)(Object.op_Implicit((Object)(object)val2) ? ((object)val2) : ((object)Fx.Soft));
				}
				else
				{
					val4.mainTexture = (Texture)(Object.op_Implicit((Object)(object)val2) ? ((object)PerfectLook.Fill((Texture2D)(object)((val2 is Texture2D) ? val2 : null))) : ((object)Fx.Soft));
					val4.SetInt("_Cull", 2);
					val4.renderQueue = 2990;
					if (Object.op_Implicit((Object)(object)val2))
					{
						val3 = Fx.Additive(PerfectLook.Lines((Texture2D)(object)((val2 is Texture2D) ? val2 : null)));
						val3.SetInt("_Cull", 2);
						val3.renderQueue = 2991;
					}
				}
				((Renderer)val).sharedMaterials = (Material[])(object)(Object.op_Implicit((Object)(object)val3) ? new Material[2] { val4, val3 } : new Material[1] { val4 });
				((Renderer)val).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)val).receiveShadows = false;
				val.quality = (SkinQuality)2;
				val.updateWhenOffscreen = true;
				parts.Add(new Part
				{
					r = val,
					m = val4,
					line = val3,
					region = region,
					fire = flag,
					blade = blade,
					guard = guard,
					eye = flag2,
					crest = name.Contains("fire_hair")
				});
			}
			Transform[] componentsInChildren2 = ((Component)rig).GetComponentsInChildren<Transform>(true);
			foreach (Transform val5 in componentsInChildren2)
			{
				if (((Object)val5).name == "3kms02t0 sword01")
				{
					hiltBone = val5;
				}
			}
			fxRoot = new GameObject("Madara Mountain Cleaver FX").transform;
			foreach (Part part in parts)
			{
				if (part.eye)
				{
					GameObject val6 = Fx.Quad(fxRoot, PerfectLook.EyeHalo, "eye halo");
					val6.AddComponent<FaceCamera>();
					val6.SetActive(false);
					eyeHalos.Add(new KeyValuePair<Renderer, Transform>((Renderer)(object)part.r, val6.transform));
				}
			}
			GameObject val7 = new GameObject("light");
			val7.transform.SetParent(root, false);
			val7.transform.localPosition = new Vector3(0f, 4f, 0.5f);
			light = val7.AddComponent<Light>();
			light.type = (LightType)2;
			light.color = MadaraFx.Blue;
			light.range = 15f;
			light.intensity = 0f;
			light.shadows = (LightShadows)0;
			tipT = new GameObject("tip").transform;
			tipT.SetParent(fxRoot, false);
			trail = ((Component)tipT).gameObject.AddComponent<TrailRenderer>();
			trail.time = 0.18f;
			trail.minVertexDistance = 1.5f;
			trail.widthMultiplier = TrailWidth;
			trail.widthCurve = AnimationCurve.Linear(0f, 1f, 1f, 0.1f);
			((Renderer)trail).material = CleaverFx.TrailMat;
			trail.emitting = false;
			((Renderer)trail).shadowCastingMode = (ShadowCastingMode)0;
			fx.BuildObjects(fxRoot);
			root.position = ((Component)this).transform.position + Vector3.down * 2f;
			foreach (Part part2 in parts)
			{
				((Renderer)part2.r).enabled = true;
				part2.m.SetColor("_TintColor", new Color(0f, 0f, 0f, 0f));
				if (Object.op_Implicit((Object)(object)part2.line))
				{
					part2.line.SetColor("_TintColor", new Color(0f, 0f, 0f, 0f));
				}
			}
			warm = 3;
			((Component)root).gameObject.SetActive(true);
			((Component)fxRoot).gameObject.SetActive(true);
		}

		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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)root))
			{
				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));
			CleaverTimeline.Blade(26f, out var _, out var tip);
			impactD = tip.z * S - Back;
			((Component)root).gameObject.SetActive(true);
			((Component)fxRoot).gameObject.SetActive(true);
			trail.emitting = false;
			trail.Clear();
			fx.Reset();
			if (Object.op_Implicit((Object)(object)anim))
			{
				foreach (AnimationState item in anim)
				{
					item.enabled = false;
				}
			}
			fx.Manifest((Object.op_Implicit((Object)(object)sv) && Object.op_Implicit((Object)(object)sv.madara)) ? sv.madara.Presentation.position : ground, S);
			Snd.Sfx("Cleaver_Manifest", ((Component)body).gameObject);
			Snd.Voice(body, "Cleaver", 2.4f);
		}

		public void Abort()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (Playing && !(abortAt >= 0f))
			{
				abortAt = Time.time;
				abortScale = root.localScale.x;
				abortPos = root.position;
				trail.emitting = false;
			}
		}

		private void Stop()
		{
			Playing = false;
			if (Object.op_Implicit((Object)(object)root))
			{
				((Component)root).gameObject.SetActive(false);
			}
			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;
			}
			trail.emitting = false;
			foreach (KeyValuePair<Renderer, Transform> eyeHalo in eyeHalos)
			{
				if (Object.op_Implicit((Object)(object)eyeHalo.Value))
				{
					((Component)eyeHalo.Value).gameObject.SetActive(false);
				}
			}
		}

		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 (!Playing || !Object.op_Implicit((Object)(object)anim))
			{
				return;
			}
			CleaverTimeline.Pose(Time.time - start, out var clip, out var f);
			AnimationState val = anim[clip];
			if (!TrackedReference.op_Implicit((TrackedReference)(object)val))
			{
				return;
			}
			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;
		}

		private void LateUpdate()
		{
			//IL_008e: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: 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_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06da: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0810: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08da: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_0935: Unknown result type (might be due to invalid IL or missing references)
			//IL_0937: Unknown result type (might be due to invalid IL or missing references)
			//IL_093c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0964: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_0989: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
			if (warm > 0)
			{
				if (--warm == 0 && !Playing)
				{
					((Component)root).gameObject.SetActive(false);
					((Component)fxRoot).gameObject.SetActive(false);
				}
				return;
			}
			if (!Playing)
			{
				if (fxLive)
				{
					TickFx();
				}
				return;
			}
			float num = Time.time - start;
			Vector3 val = ((Object.op_Implicit((Object)(object)sv) && Object.op_Implicit((Object)(object)sv.madara)) ? sv.madara.Presentation.position : ground);
			float num2 = ((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)((Component)body).GetComponent<MadaraController>())) ? ((Component)body).GetComponent<MadaraController>().ConstructScale : 1f);
			float num4;
			Vector3 position;
			float num5;
			if (abortAt >= 0f)
			{
				float num3 = Mathf.Clamp01((Time.time - abortAt) / 0.35f);
				num4 = Mathf.Lerp(abortScale, num2, num3);
				position = Vector3.Lerp(abortPos, val, num3);
				num5 = 1f - num3;
				if (Object.op_Implicit((Object)(object)sv))
				{
					sv.CleaverFade = num3;
				}
				if (num3 >= 1f)
				{
					Stop();
					return;
				}
			}
			else if (num < CleaverTimeline.Manifest)
			{
				float num6 = Mathf.Clamp01((num - ManifestDelay) / (CleaverTimeline.Manifest - ManifestDelay));
				float num7 = num6 * num6 * (3f - 2f * num6);
				num4 = Mathf.Lerp(num2, S, num7);
				position = Vector3.Lerp(val, anchor, num7);
				num5 = 1f;
				if (Object.op_Implicit((Object)(object)sv))
				{
					sv.CleaverFade = 1f - Mathf.Clamp01((num - ManifestDelay) / 0.3f);
				}
			}
			else if (num < CleaverTimeline.TDissolve)
			{
				num4 = S;
				position = anchor;
				num5 = 1f;
				if (Object.op_Implicit((Object)(object)sv))
				{
					sv.CleaverFade = 0f;
				}
			}
			else
			{
				float num8 = Mathf.Clamp01((num - CleaverTimeline.TDissolve) / CleaverTimeline.Dissolve);
				float num9 = num8 * num8 * (3f - 2f * num8);
				num4 = Mathf.Lerp(S, num2, num9);
				position = Vector3.Lerp(anchor, val, num9);
				num5 = 1f - num9;
				if (Object.op_Implicit((Object)(object)sv))
				{
					sv.CleaverFade = Mathf.Clamp01((num8 - 0.3f) / 0.7f);
				}
				if (!sDissolve)
				{
					sDissolve = true;
					fx.Wisps(anchor, rot, S);
					Snd.Sfx("Susanoo_End", ((Component)body).gameObject);
				}
				if (num8 >= 1f)
				{
					Stop();
					return;
				}
			}
			root.position = position;
			root.rotation = rot;
			root.localScale = Vector3.one * num4;
			float num10 = ((num < CleaverTimeline.TTop) ? 0f : ((num < CleaverTimeline.TCut) ? Mathf.Clamp01((num - CleaverTimeline.TTop) / (CleaverTimeline.TCut - CleaverTimeline.TTop)) : ((num < CleaverTimeline.TAfter + 0.2f) ? 1.4f : Mathf.Max(0.3f, 1.4f - (num - CleaverTimeline.TAfter - 0.2f) * 2f))));
			bool hasEffectiveAuthority = body.hasEffectiveAuthority;
			float num11 = ShellAlpha * (hasEffectiveAuthority ? 1f : 1.15f);
			float num12 = ((num > CleaverTimeline.TAfter) ? Mathf.Lerp(1f, ThinTo, Mathf.Clamp01((num - CleaverTimeline.TAfter) / 0.25f)) : 1f);
			num11 *= num12;
			float num13 = 0.85f + 0.15f * Mathf.Sin(Time.time * 23f) * Mathf.Sin(Time.time * 7.3f + 1f);
			foreach (Part part in parts)
			{
				float num14 = num5 * Stagger(part.region, num);
				if (part.region == "rib")
				{
					num14 = 0f;
				}
				if (((Renderer)part.r).enabled != num14 > 0.002f)
				{
					((Renderer)part.r).enabled = num14 > 0.002f;
				}
				if (!(num14 <= 0.002f))
				{
					if (part.blade)
					{
						part.m.SetColor("_TintColor", new Color(0.45f, 0.72f, 1f, BladeAlpha * num14 * (1f + num10)));
					}
					else if (part.eye)
					{
						part.m.SetColor("_TintColor", new Color(0.9f, 0.97f, 1f, EyeAlpha * num14));
					}
					else if (part.guard)
					{
						part.m.SetColor("_TintColor", new Color(0.26f, 0.5f, 1f, GuardAlpha * num14));
					}
					else if (part.fire)
					{
						part.m.SetColor("_TintColor", new Color(0.3f, 0.56f, 1f, (part.crest ? CrestAlpha : StripAlpha) * num14 * num13 * num12));
					}
					else
					{
						part.m.SetColor("_TintColor", new Color(1f, 1f, 1f, num11 * num14));
					}
					if (Object.op_Implicit((Object)(object)part.line))
					{
						part.line.SetColor("_TintColor", new Color(0.55f, 0.85f, 1f, LineAlpha * num14 * num12 * (1f + 0.5f * Mathf.Min(1f, num10))));
					}
				}
			}
			foreach (KeyValuePair<Renderer, Transform> eyeHalo in eyeHalos)
			{
				if (Object.op_Implicit((Object)(object)eyeHalo.Value))
				{
					bool enabled = eyeHalo.Key.enabled;
					if (((Component)eyeHalo.Value).gameObject.activeSelf != enabled)
					{
						((Component)eyeHalo.Value).gameObject.SetActive(enabled);
					}
					if (enabled)
					{
						Transform value = eyeHalo.Value;
						Bounds bounds = eyeHalo.Key.bounds;
						value.position = ((Bounds)(ref bounds)).center;
						eyeHalo.Value.localScale = Vector3.one * EyeSize * num4 * (1f + 0.1f * num13);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)light))
			{
				light.intensity = (1.2f + 1.5f * Mathf.Min(1f, num10)) * num5;
				light.range = 4f * num4;
			}
			if (CleaverFx.OnlySplit && sImpact)
			{
				foreach (Part part2 in parts)
				{
					((Renderer)part2.r).enabled = false;
				}
			}
			if (curClip == "atk02")
			{
				CleaverTimeline.Pose(num, out var _, out var f);
				CleaverTimeline.Blade(f, out var hilt, out var tip);
				tipT.position = root.position + rot * (tip * num4);
				bool flag = num >= CleaverTimeline.TCut - 0.02f && num <= CleaverTimeline.TAfter + 0.03f && abortAt < 0f;
				if (flag && !sCut)
				{
					sCut = true;
					trail.Clear();
					Snd.Sfx("Cleaver_Swing", ((Component)body).gameObject);
					Snd.Voice(body, "CleaverCut", 1.2f);
				}
				trail.emitting = flag;
				if (flag && Combat.Trace != null && Object.op_Implicit((Object)(object)hiltBone))
				{
					Vector3 val2 = root.position + rot * (hilt * num4);
					Action<string> trace = Combat.Trace;
					string[] obj = new string[12]
					{
						"CLEAVER_VIS age=",
						num.ToString("0.000"),
						" frame=",
						f.ToString("0.00"),
						" hiltErr=",
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					Vector3 val3 = hiltBone.position - val2;
					obj[5] = ((Vector3)(ref val3)).magnitude.ToString("0.00");
					obj[6] = " tip=";
					val3 = tipT.position;
					obj[7] = ((Vector3)(ref val3)).ToString("F1");
					obj[8] = " tipUp=";
					obj[9] = (tipT.position.y - ground.y).ToString("0.0");
					obj[10] = " tipFwd=";
					obj[11] = Vector3.Dot(tipT.position - ground, fwd).ToString("0.0");
					trace(string.Concat(obj));
				}
				if (!sImpact && num >= CleaverTimeline.ImpactTime && abortAt < 0f)
				{
					sImpact = true;
					List<Vector3[]> list = new List<Vector3[]>();
					for (int i = 0; i <= 28; i++)
					{
						CleaverTimeline.Blade(Mathf.Lerp(24.2f, 26f, (float)i / 28f), out var hilt2, out var tip2);
						tip2 += (tip2 - hilt2) * MountainCleaver.EdgeExtend;
						Vector3 val4 = Vector3.Lerp(hilt2, tip2, SlashInner);
						list.Add((Vector3[])(object)new Vector3[2]
						{
							anchor + rot * (val4 * S),
							anchor + rot * (tip2 * S)
						});
					}
					Vector3 at = Combat.Ground(ground + fwd * impactD + Vector3.up * 20f);
					fx.Impact(at, list, ground, fwd, S);
					Snd.Sfx("Cleaver_Impact", ((Component)body).gameObject);
				}
			}
			if (sImpact)
			{
				TickFx();
			}
		}

		private static float Stagger(string region, float age)
		{
			return Mathf.Clamp01((age - region switch
			{
				"legs" => 0f, 
				"torso" => 0.05f, 
				"cape" => 0.1f, 
				"arms" => 0.12f, 
				"head" => 0.18f, 
				"wings" => 0.24f, 
				_ => 0.3f, 
			}) / 0.3f);
		}
	}
	public static class PerfectLook
	{
		private static readonly Dictionary<Texture2D, Texture2D> fill = new Dictionary<Texture2D, Texture2D>();

		private static readonly Dictionary<Texture2D, Texture2D> lines = new Dictionary<Texture2D, Texture2D>();

		private static Material eyeHalo;

		public static Material EyeHalo
		{
			get
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)eyeHalo))