Decompiled source of HulkMod v1.0.0

Mods/Hulk-SuperJump.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using AndresSuperJump;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(SuperJumpMod), "Andres Super Jump", "0.9.0", "ItzXngel", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AndresSuperJump")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AndresSuperJump")]
[assembly: AssemblyTitle("AndresSuperJump")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AndresSuperJump
{
	internal static class Beasts
	{
		private class Snapshot
		{
			public Transform root;

			public List<Rigidbody> bodies;

			public float vy;
		}

		public const string HandName = "actor_leftHand_collider";

		private static readonly string[] BlockedSceneWords = new string[12]
		{
			"menu", "lobby", "title", "load", "boot", "splash", "intro", "credits", "customi", "container",
			"crane", "truck"
		};

		private static List<string> userBlocked;

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

		private static HashSet<string> modNames;

		private static bool menuWasOpen;

		private static float menuClosedAt = -10f;

		private static int menuFrame = -1;

		private static bool menuCached;

		private const float AfterMenuDelay = 0.4f;

		private static float standHeight;

		private static bool downed;

		private static float lastDownCheck;

		private static Transform me;

		private static bool detecting;

		private static float detectStart;

		private static List<Snapshot> snapshots = new List<Snapshot>();

		private const float DetectDelay = 0.15f;

		private static bool loggedRoot;

		public static bool MenuIsOpen
		{
			get
			{
				if (menuFrame == Time.frameCount)
				{
					return menuCached;
				}
				menuFrame = Time.frameCount;
				bool result = false;
				try
				{
					if (Time.timeScale < 0.01f)
					{
						result = true;
					}
					else
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null)
						{
							GameObject currentSelectedGameObject = current.currentSelectedGameObject;
							if ((Object)(object)currentSelectedGameObject != (Object)null && currentSelectedGameObject.activeInHierarchy)
							{
								result = true;
							}
						}
					}
				}
				catch (Exception)
				{
				}
				menuCached = result;
				return result;
			}
		}

		public static bool MeDowned => downed;

		public static bool IsDetecting => detecting;

		public static bool HasMe => (Object)(object)me != (Object)null && IsBeast(me);

		private static List<string> UserBlocked()
		{
			if (userBlocked != null)
			{
				return userBlocked;
			}
			userBlocked = new List<string>();
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UserData", "AndresBlockedMaps.txt");
				if (File.Exists(path))
				{
					string[] array = File.ReadAllLines(path);
					foreach (string text in array)
					{
						string text2 = text.Trim().ToLowerInvariant();
						if (text2.Length > 0 && !text2.StartsWith("#"))
						{
							userBlocked.Add(text2);
						}
					}
					MelonLogger.Msg("[Maps] Blocked by you: " + string.Join(", ", userBlocked));
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Maps] Couldn't read AndresBlockedMaps.txt: " + ex.Message);
			}
			return userBlocked;
		}

		public static bool SceneAllowed(string sceneName)
		{
			string text = (sceneName ?? "").ToLowerInvariant();
			string[] blockedSceneWords = BlockedSceneWords;
			foreach (string value in blockedSceneWords)
			{
				if (text.Contains(value))
				{
					return false;
				}
			}
			foreach (string item in UserBlocked())
			{
				if (text.Contains(item))
				{
					return false;
				}
			}
			return true;
		}

		public static bool InMatch()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (!SceneAllowed(name))
			{
				return false;
			}
			if (moddedScenes.Contains(name))
			{
				return false;
			}
			return (Object)(object)GameObject.Find("actor_leftHand_collider") != (Object)null;
		}

		private static string Norm(string s)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string text = (s ?? "").ToLowerInvariant();
			foreach (char c in text)
			{
				if (char.IsLetterOrDigit(c))
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		private static HashSet<string> ModNames()
		{
			if (modNames != null)
			{
				return modNames;
			}
			modNames = new HashSet<string>();
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(Application.dataPath), "Mods");
				if (!Directory.Exists(path))
				{
					return modNames;
				}
				List<string> list = new List<string>();
				list.AddRange(Directory.GetDirectories(path, "*", SearchOption.AllDirectories));
				string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
				foreach (string text in files)
				{
					if (!text.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
					{
						list.Add(text);
					}
				}
				foreach (string item in list)
				{
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item);
					modNames.Add(Norm(fileNameWithoutExtension));
					string[] array = fileNameWithoutExtension.Split('-', '_', '.', ' ');
					foreach (string text2 in array)
					{
						if (text2.Length >= 3)
						{
							modNames.Add(Norm(text2));
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Maps] Couldn't read Mods folder: " + ex.Message);
			}
			return modNames;
		}

		public static void CheckScene(int buildIndex, string sceneName)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(sceneName))
			{
				return;
			}
			bool flag = false;
			string text = "";
			string text2 = Norm(sceneName);
			if (text2.Length >= 3 && ModNames().Contains(text2))
			{
				flag = true;
				text = "name matches something in your Mods folder";
			}
			if (!flag)
			{
				try
				{
					Scene sceneByName = SceneManager.GetSceneByName(sceneName);
					foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref sceneByName)).GetRootGameObjects())
					{
						foreach (MonoBehaviour componentsInChild in item.GetComponentsInChildren<MonoBehaviour>(true))
						{
							if (!((Object)(object)componentsInChild == (Object)null))
							{
								string text3 = ((Object)componentsInChild).GetIl2CppType().FullName ?? "";
								if (text3.Contains("CementGB") || text3.Contains("GBMDK") || text3.Contains("Cement."))
								{
									flag = true;
									text = "contains custom-map component " + text3;
									break;
								}
							}
						}
						if (flag)
						{
							break;
						}
					}
				}
				catch (Exception)
				{
				}
			}
			if (flag)
			{
				moddedScenes.Add(sceneName);
			}
			MelonLogger.Msg("[Maps] '" + sceneName + "' (build index " + buildIndex + ") -> " + (flag ? ("CUSTOM MAP, powers off (" + text + ")") : "official map"));
		}

		public static bool CanUsePowers()
		{
			if (!InMatch())
			{
				return false;
			}
			if (MenuIsOpen)
			{
				return false;
			}
			if (Time.unscaledTime - menuClosedAt < 0.4f)
			{
				return false;
			}
			if (downed)
			{
				return false;
			}
			return true;
		}

		private static void UpdateMenuAndDowned()
		{
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			bool menuIsOpen = MenuIsOpen;
			if (menuWasOpen && !menuIsOpen)
			{
				menuClosedAt = Time.unscaledTime;
			}
			if (menuIsOpen != menuWasOpen)
			{
				string text = "";
				try
				{
					if (Time.timeScale < 0.01f)
					{
						text = "game paused";
					}
					else
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null && (Object)(object)current.currentSelectedGameObject != (Object)null)
						{
							text = "menu item '" + ((Object)current.currentSelectedGameObject).name + "'";
						}
					}
				}
				catch (Exception)
				{
				}
				MelonLogger.Msg(menuIsOpen ? ("[Menu] Menu open (" + text + ") -- powers off") : "[Menu] Menu closed -- powers back on");
			}
			menuWasOpen = menuIsOpen;
			if (Time.time - lastDownCheck < 0.15f)
			{
				return;
			}
			lastDownCheck = Time.time;
			try
			{
				Transform myRoot = GetMyRoot();
				if ((Object)(object)myRoot == (Object)null)
				{
					downed = false;
					return;
				}
				List<Rigidbody> bodies = GetBodies(myRoot);
				if (bodies.Count == 0)
				{
					downed = false;
					return;
				}
				float num = float.MaxValue;
				float num2 = float.MinValue;
				bool flag = false;
				foreach (Rigidbody item in bodies)
				{
					if (!((Object)(object)item == (Object)null))
					{
						float y = item.position.y;
						if (y < num)
						{
							num = y;
						}
						if (((Object)item).name.ToLowerInvariant().Contains("head"))
						{
							num2 = y;
							flag = true;
						}
						else if (!flag && y > num2)
						{
							num2 = y;
						}
					}
				}
				float num3 = num2 - num;
				Vector3 val = AverageVelocity(bodies);
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < 3f)
				{
					standHeight = Mathf.Max(standHeight * 0.998f, num3);
				}
				bool flag2 = standHeight > 0.3f && num3 < standHeight * 0.5f && magnitude < 3f;
				if (flag2 != downed)
				{
					MelonLogger.Msg(flag2 ? "[Me] Knocked out / lying down -- powers off" : "[Me] Back up -- powers on");
				}
				downed = flag2;
			}
			catch (Exception)
			{
				downed = false;
			}
		}

		public static void ResetForScene()
		{
			standHeight = 0f;
			downed = false;
			me = null;
			detecting = false;
			snapshots.Clear();
			loggedRoot = false;
		}

		public static void OnJumpPressed()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (detecting || HasMe)
			{
				return;
			}
			try
			{
				snapshots.Clear();
				foreach (Transform item in AllBeastRoots())
				{
					List<Rigidbody> bodies = GetBodies(item);
					if (bodies.Count != 0)
					{
						snapshots.Add(new Snapshot
						{
							root = item,
							bodies = bodies,
							vy = AverageVelocity(bodies).y
						});
					}
				}
				if (snapshots.Count == 1)
				{
					LockOn(snapshots[0].root, "only beast in the match");
				}
				else if (snapshots.Count != 0)
				{
					detecting = true;
					detectStart = Time.time;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Me] Detection failed: " + ex.Message);
			}
		}

		public static void Tick()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			UpdateMenuAndDowned();
			if (!detecting || Time.time - detectStart < 0.15f)
			{
				return;
			}
			detecting = false;
			Snapshot snapshot = null;
			float num = 1.5f;
			foreach (Snapshot snapshot2 in snapshots)
			{
				if (!((Object)(object)snapshot2.root == (Object)null))
				{
					float num2 = AverageVelocity(snapshot2.bodies).y - snapshot2.vy;
					if (num2 > num)
					{
						num = num2;
						snapshot = snapshot2;
					}
				}
			}
			if (snapshot != null)
			{
				LockOn(snapshot.root, "it jumped when you pressed jump");
			}
			else
			{
				MelonLogger.Msg("[Me] Couldn't tell which beast is you yet. Press jump while standing on the ground.");
			}
			snapshots.Clear();
		}

		private static void LockOn(Transform root, string why)
		{
			me = root;
			MelonLogger.Msg("[Me] Locked onto '" + ((Object)root).name + "' (" + why + ")");
		}

		public static Transform GetMyRoot()
		{
			if (HasMe)
			{
				return me;
			}
			GameObject val = GameObject.Find("actor_leftHand_collider");
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return GetBeastRoot(val.transform);
		}

		public static List<Transform> AllBeastRoots()
		{
			List<Transform> list = new List<Transform>();
			HashSet<int> hashSet = new HashSet<int>();
			foreach (Transform item in Object.FindObjectsOfType<Transform>())
			{
				if (!((Object)(object)item == (Object)null) && !(((Object)item).name != "actor_leftHand_collider"))
				{
					Transform beastRoot = GetBeastRoot(item);
					if (hashSet.Add(((Object)beastRoot).GetInstanceID()))
					{
						list.Add(beastRoot);
					}
				}
			}
			return list;
		}

		public static Transform GetBeastRoot(Transform part)
		{
			Transform val = part;
			while ((Object)(object)val.parent != (Object)null && CountHands(val.parent) <= 1)
			{
				val = val.parent;
			}
			return val;
		}

		public static bool IsBeast(Transform root)
		{
			return (Object)(object)root != (Object)null && CountHands(root) == 1;
		}

		public static List<Rigidbody> GetBodies(Transform beastRoot)
		{
			List<Rigidbody> list = new List<Rigidbody>();
			if ((Object)(object)beastRoot == (Object)null)
			{
				return list;
			}
			foreach (Rigidbody componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Rigidbody>())
			{
				if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isKinematic && ((Object)componentsInChild).name.ToLowerInvariant().StartsWith("actor"))
				{
					list.Add(componentsInChild);
					if (list.Count >= 60)
					{
						break;
					}
				}
			}
			string text = "names";
			if (list.Count < 4)
			{
				list = JointWalk(beastRoot);
				text = "joints";
			}
			if (!loggedRoot)
			{
				loggedRoot = true;
				List<string> list2 = new List<string>();
				for (int i = 0; i < list.Count && i < 6; i++)
				{
					list2.Add(((Object)list[i]).name);
				}
				MelonLogger.Msg("[Me] Beast '" + ((Object)beastRoot).name + "' -> " + list.Count + " parts via " + text + ": " + string.Join(", ", list2));
			}
			return list;
		}

		private static List<Rigidbody> JointWalk(Transform beastRoot)
		{
			List<Rigidbody> list = new List<Rigidbody>();
			Transform val = null;
			foreach (Transform componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Transform>(true))
			{
				if (((Object)componentsInChild).name == "actor_leftHand_collider")
				{
					val = componentsInChild;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return list;
			}
			Rigidbody val2 = ((Component)val).GetComponent<Rigidbody>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((Component)val).GetComponentInParent<Rigidbody>();
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return list;
			}
			Dictionary<int, List<Rigidbody>> dictionary = new Dictionary<int, List<Rigidbody>>();
			foreach (Joint item in Object.FindObjectsOfType<Joint>())
			{
				if (!((Object)(object)item == (Object)null))
				{
					Rigidbody component = ((Component)item).GetComponent<Rigidbody>();
					Rigidbody connectedBody = item.connectedBody;
					if (!((Object)(object)component == (Object)null) && !((Object)(object)connectedBody == (Object)null))
					{
						Link(dictionary, component, connectedBody);
						Link(dictionary, connectedBody, component);
					}
				}
			}
			HashSet<int> hashSet = new HashSet<int> { ((Object)val2).GetInstanceID() };
			Queue<Rigidbody> queue = new Queue<Rigidbody>();
			queue.Enqueue(val2);
			while (queue.Count > 0 && list.Count < 60)
			{
				Rigidbody val3 = queue.Dequeue();
				if (!val3.isKinematic)
				{
					list.Add(val3);
				}
				if (!dictionary.TryGetValue(((Object)val3).GetInstanceID(), out var value))
				{
					continue;
				}
				foreach (Rigidbody item2 in value)
				{
					if (!((Object)(object)item2 == (Object)null) && ((Component)item2).transform.IsChildOf(beastRoot) && hashSet.Add(((Object)item2).GetInstanceID()))
					{
						queue.Enqueue(item2);
					}
				}
			}
			return list;
		}

		private static void Link(Dictionary<int, List<Rigidbody>> adj, Rigidbody from, Rigidbody to)
		{
			int instanceID = ((Object)from).GetInstanceID();
			if (!adj.TryGetValue(instanceID, out var value))
			{
				value = (adj[instanceID] = new List<Rigidbody>());
			}
			value.Add(to);
		}

		public static int CountHands(Transform root)
		{
			int num = 0;
			foreach (Transform componentsInChild in ((Component)root).GetComponentsInChildren<Transform>(true))
			{
				if (((Object)componentsInChild).name == "actor_leftHand_collider")
				{
					num++;
				}
			}
			return num;
		}

		public static bool IsHand(Rigidbody rb)
		{
			return ((Object)rb).name.ToLowerInvariant().Contains("hand");
		}

		public static Vector3 AverageVelocity(List<Rigidbody> list)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					val += item.velocity;
					num++;
				}
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static Vector3 AveragePosition(List<Rigidbody> list)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					val += item.position;
					num++;
				}
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static Vector3 FeetPosition(List<Rigidbody> list)
		{
			//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_002a: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = AveragePosition(list);
			float num = float.MaxValue;
			foreach (Rigidbody item in list)
			{
				if ((Object)(object)item != (Object)null && item.position.y < num)
				{
					num = item.position.y;
				}
			}
			if (num == float.MaxValue)
			{
				return val;
			}
			return new Vector3(val.x, num - 0.2f, val.z);
		}

		public static float GroundDistance(Vector3 from, Transform ignoreRoot, float maxDist = 20f)
		{
			//IL_0004: 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)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			float num = maxDist;
			foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(from, Vector3.down, maxDist))
			{
				RaycastHit current = item;
				if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !((RaycastHit)(ref current)).collider.isTrigger && (!((Object)(object)ignoreRoot != (Object)null) || !((Component)((RaycastHit)(ref current)).collider).transform.IsChildOf(ignoreRoot)) && ((RaycastHit)(ref current)).distance < num)
				{
					num = ((RaycastHit)(ref current)).distance;
				}
			}
			return num;
		}
	}
	internal static class CartoonFx
	{
		private enum Kind
		{
			Ring,
			Puff,
			Debris,
			Pillar,
			Bolt,
			Crack,
			Spark,
			Blast,
			Beam,
			Glow,
			Shock
		}

		private class Piece
		{
			public GameObject go;

			public Renderer rend;

			public Kind kind;

			public Vector3 velocity;

			public Vector3 spin;

			public Vector3 maxScale;

			public float born;

			public float life;

			public Vector3 origin;

			public Vector3 dir;

			public float angle;

			public float r0;

			public float r1;

			public float speed;

			public int segments;
		}

		private class Flash
		{
			public Light light;

			public float born;

			public float life;

			public float peak;
		}

		private static readonly Color Neon = new Color(0.12f, 0.85f, 0.12f);

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

		private static readonly Color Deep = new Color(0.03f, 0.4f, 0.06f);

		private static readonly List<Piece> pieces = new List<Piece>();

		private static readonly List<Flash> flashes = new List<Flash>();

		private static readonly Dictionary<string, Material> mats = new Dictionary<string, Material>();

		private static Shader borrowedShader;

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

		private static readonly Color RoarGlow = new Color(0.12f, 0.85f, 0.12f);

		private static readonly Color RoarDark = new Color(0.03f, 0.4f, 0.06f);

		private unsafe static Material GetMaterial(Transform beastRoot, Color color, float glow)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_014f: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			string key = ((object)(*(Color*)(&color))/*cast due to .constrained prefix*/).ToString() + glow;
			if (mats.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			if ((Object)(object)borrowedShader == (Object)null)
			{
				foreach (Renderer componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Renderer>(true))
				{
					if ((Object)(object)componentsInChild != (Object)null && (Object)(object)componentsInChild.sharedMaterial != (Object)null && (Object)(object)componentsInChild.sharedMaterial.shader != (Object)null)
					{
						borrowedShader = componentsInChild.sharedMaterial.shader;
						break;
					}
				}
			}
			if ((Object)(object)borrowedShader == (Object)null)
			{
				return null;
			}
			Material val = new Material(borrowedShader);
			((Object)val).hideFlags = (HideFlags)32;
			if (val.HasProperty("_BaseMap"))
			{
				val.SetTexture("_BaseMap", (Texture)null);
			}
			if (val.HasProperty("_MainTex"))
			{
				val.SetTexture("_MainTex", (Texture)null);
			}
			if (val.HasProperty("_BaseColor"))
			{
				val.SetColor("_BaseColor", color);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			if (val.HasProperty("_EmissionColor"))
			{
				val.EnableKeyword("_EMISSION");
				val.SetColor("_EmissionColor", color * Mathf.Min(glow, 0.9f));
			}
			mats[key] = val;
			return val;
		}

		public static void Burst(Vector3 pos, Transform beastRoot, float size)
		{
			//IL_0003: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 2f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Ring(material, pos, 3.5f * size, 0.45f, 0f);
				Puffs(material, pos, Mathf.RoundToInt(8f * Mathf.Max(1f, size)), size);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Burst failed: " + ex.Message);
			}
		}

		public static void Charge(Vector3 handsPos, Transform beastRoot, float progress)
		{
			//IL_0003: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_0195: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 2.5f);
				Material material2 = GetMaterial(beastRoot, Core, 4f);
				if (!((Object)(object)material == (Object)null))
				{
					int num = ((!(progress > 0.5f)) ? 1 : 2);
					for (int i = 0; i < num; i++)
					{
						Vector3 val = Random.onUnitSphere * Random.Range(1f, 1.8f);
						float num2 = Random.Range(0.08f, 0.16f);
						Spawn((PrimitiveType)0, material, Kind.Spark, handsPos + val, -val * 4f, new Vector3(num2, num2, num2), 0.25f, 0f);
					}
					if (progress > 0.2f && Random.value < 0.6f)
					{
						Vector3 a = handsPos + Random.onUnitSphere * 1.1f;
						Vector3 b = handsPos + Random.onUnitSphere * 1.1f;
						Bolt(material2, a, b, 5, 0.3f, 0.06f, 0.12f, 0f);
						Bolt(material, a, b, 5, 0.35f, 0.14f, 0.1f, 0f);
					}
					if (progress > 0.65f && Random.value < 0.3f)
					{
						Vector3 b2 = handsPos + Flat(Random.insideUnitSphere) * 1.5f + Vector3.down * 2.5f;
						Bolt(material2, handsPos, b2, 6, 0.5f, 0.07f, 0.12f, 0f);
						Bolt(material, handsPos, b2, 6, 0.6f, 0.16f, 0.1f, 0f);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Charge failed: " + ex.Message);
			}
		}

		public static void LightningSlam(Vector3 center, Transform beastRoot, float radius, int skyBolts = 5, bool pillar = true, int arcs = 12)
		{
			//IL_0003: 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_0025: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ba: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				Material material3 = GetMaterial(beastRoot, Deep, 1.5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				for (int i = 0; i < skyBolts; i++)
				{
					float num = (float)i * 0.05f;
					Vector3 val = center + Flat(Random.insideUnitSphere) * 1.5f;
					Vector3 a = val + Vector3.up * Random.Range(12f, 18f) + Flat(Random.insideUnitSphere) * 4f;
					for (int j = 0; j < 2; j++)
					{
						float num2 = num + (float)j * 0.16f;
						List<Vector3> list = Bolt(material2, a, val, 12, 1.3f, 0.22f, 0.3f, num2);
						Bolt(material, a, val, 12, 1.6f, 0.5f, 0.28f, num2);
						for (int k = 0; k < 2; k++)
						{
							Vector3 val2 = list[Random.Range(2, list.Count - 3)];
							Vector3 b = val2 + Flat(Random.onUnitSphere) * Random.Range(2.5f, 4.5f) + Vector3.down * Random.Range(1.5f, 3.5f);
							Bolt(material2, val2, b, 6, 0.7f, 0.1f, 0.25f, num2 + 0.02f);
							Bolt(material, val2, b, 6, 0.8f, 0.22f, 0.22f, num2 + 0.02f);
						}
					}
				}
				for (int l = 0; l < arcs; l++)
				{
					Vector3 val3 = Quaternion.Euler(0f, 360f / (float)arcs * (float)l + Random.Range(-15f, 15f), 0f) * Vector3.forward;
					Vector3 b2 = center + val3 * radius * Random.Range(0.7f, 1f) + Vector3.up * 0.15f;
					Bolt(material2, center + Vector3.up * 0.15f, b2, 8, 0.6f, 0.13f, 0.45f, 0.04f);
					Bolt(material, center + Vector3.up * 0.15f, b2, 8, 0.7f, 0.3f, 0.4f, 0.04f);
				}
				if (pillar)
				{
					Spawn((PrimitiveType)2, material, Kind.Pillar, center + Vector3.up * 6f, Vector3.zero, new Vector3(2.2f, 6f, 2.2f), 0.5f, 0f);
					Spawn((PrimitiveType)2, material2, Kind.Pillar, center + Vector3.up * 6f, Vector3.zero, new Vector3(0.9f, 6f, 0.9f), 0.4f, 0f);
				}
				for (int m = 0; m < 14; m++)
				{
					Vector3 val4 = Flat(Random.onUnitSphere);
					Vector3 vel = val4 * Random.Range(3f, 7f) + Vector3.up * Random.Range(6f, 12f);
					float num3 = Random.Range(0.18f, 0.45f);
					Spawn((PrimitiveType)3, (m % 3 == 0) ? material : material3, Kind.Debris, center + Vector3.up * 0.3f, vel, new Vector3(num3, num3, num3), Random.Range(1.1f, 1.6f), 0f).transform.rotation = Random.rotation;
				}
				Puffs(material, center, 16, 2.2f);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Lightning slam failed: " + ex.Message);
			}
		}

		public static void JumpFx(Vector3 feet, Transform beastRoot, float size)
		{
			//IL_0003: 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_0041: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Puffs(material, feet, Mathf.RoundToInt(8f * Mathf.Max(1f, size)), size);
				for (int i = 0; i < 3; i++)
				{
					Vector3 val = feet + Flat(Random.insideUnitSphere) * 0.8f * size;
					Vector3 b = val + Vector3.up * Random.Range(1.8f, 3f) * size + Flat(Random.insideUnitSphere) * 0.8f * size;
					float delay = (float)i * 0.04f;
					Bolt(material2, val, b, 6, 0.35f * size, 0.06f, 0.22f, delay);
					Bolt(material, val, b, 6, 0.4f * size, 0.14f, 0.2f, delay);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Jump effect failed: " + ex.Message);
			}
		}

		public static void LightningLaunch(Vector3 feet, Transform beastRoot)
		{
			//IL_0003: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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_0191: 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_01a0: 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_01c3: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: 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_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				for (int i = 0; i < 6; i++)
				{
					Vector3 a = feet + Flat(Random.insideUnitSphere) * 0.6f;
					Vector3 b = feet + Vector3.up * Random.Range(5f, 8f) + Flat(Random.insideUnitSphere) * Random.Range(1.5f, 3f);
					for (int j = 0; j < 2; j++)
					{
						float delay = (float)i * 0.02f + (float)j * 0.12f;
						Bolt(material2, a, b, 8, 0.7f, 0.12f, 0.3f, delay);
						Bolt(material, a, b, 8, 0.8f, 0.3f, 0.28f, delay);
					}
				}
				for (int k = 0; k < 8; k++)
				{
					Vector3 val = Quaternion.Euler(0f, 45f * (float)k + Random.Range(-15f, 15f), 0f) * Vector3.forward;
					Vector3 b2 = feet + val * Random.Range(2f, 3.5f) + Vector3.up * 0.15f;
					Bolt(material2, feet + Vector3.up * 0.15f, b2, 6, 0.4f, 0.09f, 0.35f, 0f);
					Bolt(material, feet + Vector3.up * 0.15f, b2, 6, 0.5f, 0.22f, 0.3f, 0f);
				}
				Ring(material2, feet, 3f, 0.35f, 0f);
				Ring(material, feet, 4.5f, 0.45f, 0.06f);
				Puffs(material, feet, 10, 1.2f);
				for (int l = 0; l < 6; l++)
				{
					Vector3 vel = Flat(Random.onUnitSphere) * Random.Range(2f, 4f) + Vector3.up * Random.Range(4f, 8f);
					float num = Random.Range(0.12f, 0.28f);
					Spawn((PrimitiveType)3, material, Kind.Debris, feet + Vector3.up * 0.3f, vel, new Vector3(num, num, num), Random.Range(0.9f, 1.3f), 0f).transform.rotation = Random.rotation;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Launch failed: " + ex.Message);
			}
		}

		public static void Trail(Vector3 pos, Transform beastRoot)
		{
			//IL_0003: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if (!((Object)(object)material == (Object)null))
				{
					Vector3 val = Random.insideUnitSphere * 0.6f;
					float num = Random.Range(0.08f, 0.18f);
					Spawn((PrimitiveType)0, material, Kind.Spark, pos + val, Random.insideUnitSphere * 1.5f, new Vector3(num, num, num), 0.35f, 0f);
					if (Random.value < 0.15f)
					{
						Vector3 a = pos + Random.onUnitSphere * 0.8f;
						Vector3 b = pos + Random.onUnitSphere * 0.8f;
						Bolt(material2, a, b, 4, 0.3f, 0.05f, 0.1f, 0f);
						Bolt(material, a, b, 4, 0.35f, 0.12f, 0.08f, 0f);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		private static Vector3 Spread(Vector3 dir, float maxAngle)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(0f - maxAngle, maxAngle);
			float num2 = Random.Range((0f - maxAngle) * 0.35f, maxAngle * 0.35f);
			Vector3 val = Vector3.Cross(Vector3.up, dir);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = Quaternion.AngleAxis(num, Vector3.up) * Quaternion.AngleAxis(num2, normalized) * dir;
			return ((Vector3)(ref val)).normalized;
		}

		private static GameObject SpawnBeam(Material m, Vector3 origin, Vector3 dir, float length, float width, float life, float delay)
		{
			//IL_0004: 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)
			//IL_0015: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Spawn((PrimitiveType)2, m, Kind.Beam, origin, Vector3.zero, new Vector3(width, length * 0.5f, width), life, delay);
			val.transform.rotation = Quaternion.FromToRotation(Vector3.up, dir);
			Piece piece = pieces[pieces.Count - 1];
			piece.origin = origin;
			piece.dir = dir;
			return val;
		}

		private static void ShockRing(Material m, Vector3 origin, Vector3 dir, float startRadius, float endRadius, float travel, float thickness, float life, float delay, int segments = 22)
		{
			//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_001c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < segments; i++)
			{
				GameObject val = Spawn((PrimitiveType)3, m, Kind.Shock, origin, Vector3.zero, new Vector3(thickness, thickness, 0.1f), life, delay);
				Piece piece = pieces[pieces.Count - 1];
				piece.origin = origin;
				piece.dir = dir;
				piece.angle = (float)Math.PI * 2f / (float)segments * (float)i;
				piece.r0 = startRadius;
				piece.r1 = endRadius;
				piece.speed = travel / life;
				piece.segments = segments;
			}
		}

		private static void SpeedLines(Material m, Vector3 origin, Vector3 dir, int count, float spreadRadius)
		{
			//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_000c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_001f: 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_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_006b: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0117: 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)
			Vector3 val = Vector3.Cross(dir, Vector3.up);
			if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
			{
				val = Vector3.Cross(dir, Vector3.right);
			}
			val = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(val, dir);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			for (int i = 0; i < count; i++)
			{
				float num = Random.Range(0f, (float)Math.PI * 2f);
				float num2 = Random.Range(0.4f, spreadRadius);
				Vector3 pos = origin + (val * Mathf.Cos(num) + normalized * Mathf.Sin(num)) * num2 + dir * Random.Range(0f, 1.5f);
				float num3 = Random.Range(1.2f, 2.6f);
				Spawn((PrimitiveType)3, m, Kind.Spark, pos, dir * Random.Range(18f, 28f), new Vector3(0.04f, 0.04f, num3), Random.Range(0.25f, 0.4f), Random.Range(0f, 0.08f)).transform.rotation = Quaternion.LookRotation(dir);
			}
		}

		public static void RoarBurst(Vector3 origin, Vector3 dir, Transform beastRoot, float range)
		{
			//IL_0003: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_0171: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarCore, 0.9f);
				Material material2 = GetMaterial(beastRoot, RoarGlow, 0.7f);
				Material material3 = GetMaterial(beastRoot, RoarDark, 0.4f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Spawn((PrimitiveType)0, material2, Kind.Glow, origin, Vector3.zero, new Vector3(0.5f, 0.5f, 0.5f), 1.3f, 0f);
				Spawn((PrimitiveType)0, material, Kind.Glow, origin, Vector3.zero, new Vector3(0.25f, 0.25f, 0.25f), 1.3f, 0f);
				for (int i = 0; i < 4; i++)
				{
					float num = (float)i * 0.08f;
					float num2 = 2.6f + (float)i * 0.7f;
					float num3 = range * (0.75f + (float)i * 0.08f);
					float life = 0.5f + (float)i * 0.05f;
					float num4 = 0.2f - (float)i * 0.03f;
					ShockRing((i == 0) ? material : material2, origin, dir, 0.35f, num2, num3, num4, life, num, 28);
					ShockRing(material3, origin, dir, 0.45f, num2 * 1.12f, num3 * 0.95f, num4 * 0.7f, life, num + 0.03f, 24);
				}
				SpeedLines(material2, origin, dir, 16, 2.2f);
				SpeedLines(material, origin, dir, 6, 1.4f);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Roar burst failed: " + ex.Message);
			}
		}

		public static void RoarStream(Vector3 origin, Vector3 dir, Transform beastRoot, float range)
		{
			//IL_0003: 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_0032: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarGlow, 0.7f);
				Material material2 = GetMaterial(beastRoot, RoarDark, 0.4f);
				if (!((Object)(object)material == (Object)null))
				{
					ShockRing(material, origin, dir, 0.3f, 2.2f, range * 0.7f, 0.12f, 0.42f, 0f);
					ShockRing(material2, origin, dir, 0.4f, 2.45f, range * 0.66f, 0.08f, 0.42f, 0.03f, 18);
					SpeedLines(material, origin, dir, 5, 1.8f);
				}
			}
			catch (Exception)
			{
			}
		}

		public static void RoarChain(Vector3 from, Vector3 to, Transform beastRoot)
		{
			//IL_0003: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			try
			{
				Material material = GetMaterial(beastRoot, RoarCore, 0.9f);
				Material material2 = GetMaterial(beastRoot, RoarGlow, 0.7f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 2; i++)
					{
						float delay = (float)i * 0.12f;
						Bolt(material, from, to, 8, 0.6f, 0.05f, 0.25f, delay);
						Bolt(material2, from, to, 8, 0.7f, 0.12f, 0.22f, delay);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static Material AimMaterial(Transform beastRoot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return GetMaterial(beastRoot, RoarCore, 0.9f);
		}

		public static void Fizzle(Vector3 origin, Transform beastRoot)
		{
			//IL_0003: 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_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarGlow, 1.6f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 5; i++)
					{
						float num = Random.Range(0.1f, 0.2f);
						Spawn((PrimitiveType)0, material, Kind.Spark, origin, Random.insideUnitSphere * 2f, new Vector3(num, num, num), 0.3f, 0f);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static void ChainLightning(Vector3 from, Vector3 to, Transform beastRoot)
		{
			//IL_0003: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0083: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 2; i++)
					{
						float delay = (float)i * 0.12f;
						Bolt(material2, from + Vector3.up * 0.5f, to, 8, 0.8f, 0.12f, 0.3f, delay);
						Bolt(material, from + Vector3.up * 0.5f, to, 8, 0.9f, 0.28f, 0.28f, delay);
					}
					Puffs(material, to, 6, 0.8f);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Chain lightning failed: " + ex.Message);
			}
		}

		private static Vector3 Flat(Vector3 v)
		{
			//IL_0024: 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_0029: 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)
			v.y = 0f;
			return (((Vector3)(ref v)).sqrMagnitude < 0.0001f) ? Vector3.forward : ((Vector3)(ref v)).normalized;
		}

		private static void Ring(Material m, Vector3 pos, float diameter, float life, float delay)
		{
			//IL_0004: 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)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			Spawn((PrimitiveType)2, m, Kind.Ring, pos + Vector3.up * 0.05f, Vector3.zero, new Vector3(diameter, 0.04f, diameter), life, delay);
		}

		private static void Puffs(Material m, Vector3 pos, int count, float size)
		{
			//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_003f: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < count; i++)
			{
				float num = 360f / (float)count * (float)i + Random.Range(-10f, 10f);
				Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward;
				Vector3 vel = val * Random.Range(3f, 5f) * size + Vector3.up * Random.Range(1f, 3f);
				float num2 = Random.Range(0.35f, 0.6f) * size;
				Spawn((PrimitiveType)0, m, Kind.Puff, pos + Vector3.up * 0.2f, vel, new Vector3(num2, num2, num2), Random.Range(0.4f, 0.6f), 0f);
			}
		}

		private static List<Vector3> Bolt(Material m, Vector3 a, Vector3 b, int segments, float jag, float thickness, float life, float delay)
		{
			//IL_0007: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3> { a };
			for (int i = 1; i < segments; i++)
			{
				float num = (float)i / (float)segments;
				float num2 = Mathf.Sin(num * (float)Math.PI);
				list.Add(Vector3.Lerp(a, b, num) + Random.insideUnitSphere * jag * num2);
			}
			list.Add(b);
			for (int j = 0; j < list.Count - 1; j++)
			{
				Vector3 val = list[j];
				Vector3 val2 = list[j + 1];
				Vector3 val3 = val2 - val;
				float magnitude = ((Vector3)(ref val3)).magnitude;
				if (!(magnitude < 0.01f))
				{
					GameObject val4 = Spawn((PrimitiveType)3, m, Kind.Bolt, (val + val2) * 0.5f, Vector3.zero, new Vector3(thickness, thickness, magnitude * 1.05f), life, delay);
					val4.transform.rotation = Quaternion.LookRotation(val3);
				}
			}
			return list;
		}

		private static GameObject Spawn(PrimitiveType type, Material m, Kind kind, Vector3 pos, Vector3 vel, Vector3 maxScale, float life, float delay)
		{
			//IL_0001: 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_005f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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)
			GameObject val = GameObject.CreatePrimitive(type);
			((Object)val).name = "AndresFx";
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = val.GetComponent<Renderer>();
			component2.sharedMaterial = m;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			val.transform.position = pos;
			val.transform.localScale = Vector3.zero;
			pieces.Add(new Piece
			{
				go = val,
				rend = component2,
				kind = kind,
				velocity = vel,
				maxScale = maxScale,
				born = Time.time + delay,
				life = life,
				spin = ((kind == Kind.Debris) ? (Random.insideUnitSphere * 720f) : Vector3.zero)
			});
			return val;
		}

		private static void AddFlash(Vector3 pos, Color color, float intensity, float range, float life)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: 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)
			GameObject val = new GameObject("AndresFlash");
			val.transform.position = pos;
			Light val2 = val.AddComponent<Light>();
			val2.type = (LightType)2;
			val2.color = color;
			val2.range = range;
			val2.intensity = intensity;
			flashes.Add(new Flash
			{
				light = val2,
				born = Time.time,
				life = life,
				peak = intensity
			});
		}

		public static void Update()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: 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_03b6: 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_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: 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_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: 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_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			float deltaTime = Time.deltaTime;
			for (int num = pieces.Count - 1; num >= 0; num--)
			{
				Piece piece = pieces[num];
				if ((Object)(object)piece.go == (Object)null)
				{
					pieces.RemoveAt(num);
				}
				else
				{
					float num2 = Time.time - piece.born;
					if (num2 < 0f)
					{
						piece.go.transform.localScale = Vector3.zero;
					}
					else
					{
						float num3 = num2 / piece.life;
						if (num3 >= 1f)
						{
							Object.Destroy((Object)(object)piece.go);
							pieces.RemoveAt(num);
						}
						else
						{
							Transform transform = piece.go.transform;
							Vector3 maxScale = piece.maxScale;
							switch (piece.kind)
							{
							case Kind.Ring:
							{
								float num6 = EaseOut(num3);
								transform.localScale = new Vector3(maxScale.x * num6, maxScale.y * (1f - num3), maxScale.z * num6);
								break;
							}
							case Kind.Puff:
							{
								float num15 = EaseOut(Mathf.Min(1f, num3 * 2.5f));
								float num16 = ((num3 > 0.6f) ? (1f - (num3 - 0.6f) / 0.4f) : 1f);
								transform.localScale = maxScale * num15 * num16;
								transform.position += piece.velocity * deltaTime;
								piece.velocity *= 1f - 4f * deltaTime;
								break;
							}
							case Kind.Debris:
							{
								piece.velocity += Physics.gravity * deltaTime;
								transform.position += piece.velocity * deltaTime;
								transform.Rotate(piece.spin * deltaTime);
								float num21 = ((num3 > 0.75f) ? (1f - (num3 - 0.75f) / 0.25f) : 1f);
								transform.localScale = maxScale * num21;
								break;
							}
							case Kind.Pillar:
							{
								float num18 = ((num3 < 0.15f) ? EaseOut(num3 / 0.15f) : (1f - (num3 - 0.15f) / 0.85f));
								transform.localScale = new Vector3(maxScale.x * num18, maxScale.y, maxScale.z * num18);
								break;
							}
							case Kind.Bolt:
							{
								piece.rend.enabled = Random.value > 0.25f;
								float num17 = ((num3 > 0.6f) ? (1f - (num3 - 0.6f) / 0.4f) : 1f);
								transform.localScale = new Vector3(maxScale.x * num17, maxScale.y * num17, maxScale.z);
								break;
							}
							case Kind.Crack:
							{
								float num11 = EaseOut(Mathf.Min(1f, num3 / 0.12f));
								float num12 = ((num3 > 0.7f) ? (1f - (num3 - 0.7f) / 0.3f) : 1f);
								transform.localScale = new Vector3(maxScale.x * num12, maxScale.y, maxScale.z * num11);
								break;
							}
							case Kind.Shock:
							{
								Vector3 dir = piece.dir;
								Vector3 val = Vector3.Cross(dir, Vector3.up);
								if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
								{
									val = Vector3.Cross(dir, Vector3.right);
								}
								val = ((Vector3)(ref val)).normalized;
								Vector3 val2 = Vector3.Cross(val, dir);
								Vector3 normalized = ((Vector3)(ref val2)).normalized;
								float num7 = EaseOut(num3);
								float num8 = Mathf.Lerp(piece.r0, piece.r1, num7);
								Vector3 val3 = piece.origin + dir * (piece.speed * piece.life * num7);
								Vector3 val4 = val * Mathf.Cos(piece.angle) + normalized * Mathf.Sin(piece.angle);
								Vector3 val5 = -val * Mathf.Sin(piece.angle) + normalized * Mathf.Cos(piece.angle);
								transform.position = val3 + val4 * num8;
								transform.rotation = Quaternion.LookRotation(val5, dir);
								float num9 = (float)Math.PI * 2f * num8 / (float)piece.segments * 1.15f;
								float num10 = maxScale.x * ((num3 < 0.7f) ? 1f : (1f - (num3 - 0.7f) / 0.3f));
								transform.localScale = new Vector3(num10, num10, num9);
								break;
							}
							case Kind.Beam:
							{
								float num19 = maxScale.y * EaseOut(Mathf.Min(1f, num3 / 0.12f));
								float num20 = ((num3 < 0.12f) ? 1f : (1f - EaseOut((num3 - 0.12f) / 0.88f)));
								transform.localScale = new Vector3(maxScale.x * num20, num19, maxScale.z * num20);
								transform.position = piece.origin + piece.dir * num19;
								break;
							}
							case Kind.Glow:
							{
								float num13 = 0.85f + 0.15f * Mathf.Sin(num2 * 40f);
								float num14 = ((num3 < 0.1f) ? (num3 / 0.1f) : (1f - (num3 - 0.1f) / 0.9f));
								transform.localScale = maxScale * num13 * num14;
								break;
							}
							case Kind.Blast:
							{
								float num4 = 0.35f + 0.65f * EaseOut(Mathf.Min(1f, num3 * 1.6f));
								float num5 = ((num3 > 0.65f) ? (1f - (num3 - 0.65f) / 0.35f) : 1f);
								transform.localScale = maxScale * num4 * num5;
								transform.position += piece.velocity * deltaTime;
								piece.velocity *= 1f - 1.2f * deltaTime;
								break;
							}
							case Kind.Spark:
								transform.position += piece.velocity * deltaTime;
								transform.localScale = maxScale * (1f - num3);
								break;
							}
						}
					}
				}
			}
			for (int num22 = flashes.Count - 1; num22 >= 0; num22--)
			{
				Flash flash = flashes[num22];
				if ((Object)(object)flash.light == (Object)null)
				{
					flashes.RemoveAt(num22);
				}
				else
				{
					float num23 = (Time.time - flash.born) / flash.life;
					if (num23 >= 1f)
					{
						Object.Destroy((Object)(object)((Component)flash.light).gameObject);
						flashes.RemoveAt(num22);
					}
					else
					{
						flash.light.intensity = flash.peak * (1f - num23) * ((Random.value > 0.3f) ? 1f : 0.35f);
					}
				}
			}
		}

		private static float EaseOut(float t)
		{
			return 1f - (1f - t) * (1f - t);
		}
	}
	internal static class Sfx
	{
		private static readonly Dictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>();

		private static AudioSource source;

		public static void Play(string name, float volume = 1f)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			try
			{
				AudioClip clip = GetClip(name);
				if (!((Object)(object)clip == (Object)null))
				{
					if ((Object)(object)source == (Object)null)
					{
						GameObject val = new GameObject("AndresSfx");
						Object.DontDestroyOnLoad((Object)(object)val);
						source = val.AddComponent<AudioSource>();
						source.spatialBlend = 0f;
						source.playOnAwake = false;
						source.volume = 1f;
					}
					source.PlayOneShot(clip, volume);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Couldn't play '" + name + "': " + ex.Message);
			}
		}

		private static AudioClip GetClip(string name)
		{
			if (clips.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			AudioClip val = null;
			string text = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UserData", "AndresSounds", name + ".wav");
			if (File.Exists(text))
			{
				val = LoadWav(text, name);
				if ((Object)(object)val != (Object)null)
				{
					MelonLogger.Msg("[Sfx] Using custom sound " + text);
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				val = LoadEmbedded(name);
			}
			if ((Object)(object)val == (Object)null)
			{
				val = (AudioClip)(name switch
				{
					"slam" => MakeThunder(name), 
					"charge" => MakeCharge(name), 
					"zap" => MakeZap(name), 
					_ => MakeBoom(name), 
				});
			}
			((Object)val).hideFlags = (HideFlags)32;
			clips[name] = val;
			return val;
		}

		private static AudioClip MakeBoom(string name)
		{
			int num = 30870;
			float[] array = new float[num];
			Random random = new Random(1234);
			double num2 = 0.0;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Lerp(140f, 35f, Mathf.Min(1f, num3 / 0.35f));
				num2 += Math.PI * 2.0 * (double)num4 / 44100.0;
				float num5 = (float)Math.Sin(num2) * Mathf.Exp((0f - num3) * 6f);
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0) * Mathf.Exp((0f - num3) * 35f) * 0.8f;
				float num7 = (num5 + num6) * 2.2f;
				array[i] = (float)Math.Tanh(num7);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeCharge(string name)
		{
			int num = 24255;
			float[] array = new float[num];
			Random random = new Random(777);
			double num2 = 0.0;
			double num3 = 0.0;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = num5 / 0.55f;
				float num7 = Mathf.Lerp(70f, 260f, num6 * num6);
				num2 += (double)(num7 / 44100f);
				num2 -= Math.Floor(num2);
				num3 += (double)(num7 * 1.01f / 44100f);
				num3 -= Math.Floor(num3);
				float num8 = (float)(num2 * 2.0 - 1.0 + (num3 * 2.0 - 1.0)) * 0.35f;
				num8 *= Mathf.Lerp(0.3f, 1f, num6);
				if (random.NextDouble() < 0.0006 + (double)num6 * 0.002)
				{
					num4 = 1f;
				}
				num4 *= 0.997f;
				float num9 = (float)(random.NextDouble() * 2.0 - 1.0) * num4 * 0.9f;
				array[i] = (float)Math.Tanh((num8 + num9) * 1.8f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeZap(string name)
		{
			int num = 19845;
			float[] array = new float[num];
			Random random = new Random(999);
			double num2 = 0.0;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Exp((0f - num3) * 7f);
				bool flag = (int)(num3 * 60f) % 3 != 2;
				float num5 = (float)(random.NextDouble() * 2.0 - 1.0);
				num2 += Math.PI * 2.0 * (double)Mathf.Lerp(1800f, 600f, num3 / 0.45f) / 44100.0;
				float num6 = (float)Math.Sin(num2) * 0.4f;
				array[i] = (float)Math.Tanh((num5 * 0.9f + num6) * num4 * (flag ? 1f : 0.2f) * 2.2f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeThunder(string name)
		{
			int num = 79380;
			float[] array = new float[num];
			Random random = new Random(4321);
			double num2 = 0.0;
			float num3 = 0f;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0);
				float num7 = num6 * Mathf.Exp((0f - num5) * 28f) * 1.2f;
				float num8 = Mathf.Lerp(110f, 30f, Mathf.Min(1f, num5 / 0.5f));
				num2 += Math.PI * 2.0 * (double)num8 / 44100.0;
				float num9 = (float)Math.Sin(num2) * Mathf.Exp((0f - num5) * 3.5f) * 1.3f;
				num3 += (num6 - num3) * 0.02f;
				num4 += (num3 - num4) * 0.05f;
				float num10 = num4 * 9f * Mathf.Exp((0f - num5) * 1.6f) * (0.7f + 0.3f * Mathf.Sin(num5 * 9f));
				array[i] = (float)Math.Tanh((num7 + num9 + num10) * 2f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip LoadEmbedded(string name)
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				using Stream stream = executingAssembly.GetManifestResourceStream("Sounds." + name + ".wav");
				if (stream == null)
				{
					return null;
				}
				MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				return ParseWav(memoryStream.ToArray(), name, "built-in " + name + ".wav");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Built-in sound '" + name + "' failed: " + ex.Message);
				return null;
			}
		}

		private static AudioClip LoadWav(string path, string name)
		{
			try
			{
				return ParseWav(File.ReadAllBytes(path), name, path);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Failed to load " + path + ": " + ex.Message);
				return null;
			}
		}

		private static AudioClip ParseWav(byte[] b, string name, string path)
		{
			try
			{
				int num = 0;
				int num2 = 0;
				int num3 = 0;
				int num4 = -1;
				int num5 = 0;
				int num6;
				for (int i = 12; i + 8 <= b.Length; i += 8 + num6 + (num6 & 1))
				{
					string text = Encoding.ASCII.GetString(b, i, 4);
					num6 = BitConverter.ToInt32(b, i + 4);
					if (text == "fmt ")
					{
						num = BitConverter.ToInt16(b, i + 10);
						num2 = BitConverter.ToInt32(b, i + 12);
						num3 = BitConverter.ToInt16(b, i + 22);
					}
					else if (text == "data")
					{
						num4 = i + 8;
						num5 = Math.Min(num6, b.Length - num4);
						break;
					}
				}
				if (num3 != 16 || num4 < 0 || num < 1)
				{
					MelonLogger.Warning("[Sfx] " + path + " must be a 16-bit PCM WAV. Using built-in sound.");
					return null;
				}
				int num7 = num5 / 2;
				float[] array = new float[num7];
				for (int j = 0; j < num7; j++)
	

Mods/Hulk-RoarBlast.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using AndresRoarBlast;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(RoarBlastMod), "Andres Roar Blast", "0.7.0", "ItzXngel", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AndresRoarBlast")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AndresRoarBlast")]
[assembly: AssemblyTitle("AndresRoarBlast")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AndresRoarBlast
{
	internal static class Beasts
	{
		private class Snapshot
		{
			public Transform root;

			public List<Rigidbody> bodies;

			public float vy;
		}

		public const string HandName = "actor_leftHand_collider";

		private static readonly string[] BlockedSceneWords = new string[12]
		{
			"menu", "lobby", "title", "load", "boot", "splash", "intro", "credits", "customi", "container",
			"crane", "truck"
		};

		private static List<string> userBlocked;

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

		private static HashSet<string> modNames;

		private static bool menuWasOpen;

		private static float menuClosedAt = -10f;

		private static int menuFrame = -1;

		private static bool menuCached;

		private const float AfterMenuDelay = 0.4f;

		private static float standHeight;

		private static bool downed;

		private static float lastDownCheck;

		private static Transform me;

		private static bool detecting;

		private static float detectStart;

		private static List<Snapshot> snapshots = new List<Snapshot>();

		private const float DetectDelay = 0.15f;

		private static bool loggedRoot;

		public static bool MenuIsOpen
		{
			get
			{
				if (menuFrame == Time.frameCount)
				{
					return menuCached;
				}
				menuFrame = Time.frameCount;
				bool result = false;
				try
				{
					if (Time.timeScale < 0.01f)
					{
						result = true;
					}
					else
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null)
						{
							GameObject currentSelectedGameObject = current.currentSelectedGameObject;
							if ((Object)(object)currentSelectedGameObject != (Object)null && currentSelectedGameObject.activeInHierarchy)
							{
								result = true;
							}
						}
					}
				}
				catch (Exception)
				{
				}
				menuCached = result;
				return result;
			}
		}

		public static bool MeDowned => downed;

		public static bool IsDetecting => detecting;

		public static bool HasMe => (Object)(object)me != (Object)null && IsBeast(me);

		private static List<string> UserBlocked()
		{
			if (userBlocked != null)
			{
				return userBlocked;
			}
			userBlocked = new List<string>();
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UserData", "AndresBlockedMaps.txt");
				if (File.Exists(path))
				{
					string[] array = File.ReadAllLines(path);
					foreach (string text in array)
					{
						string text2 = text.Trim().ToLowerInvariant();
						if (text2.Length > 0 && !text2.StartsWith("#"))
						{
							userBlocked.Add(text2);
						}
					}
					MelonLogger.Msg("[Maps] Blocked by you: " + string.Join(", ", userBlocked));
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Maps] Couldn't read AndresBlockedMaps.txt: " + ex.Message);
			}
			return userBlocked;
		}

		public static bool SceneAllowed(string sceneName)
		{
			string text = (sceneName ?? "").ToLowerInvariant();
			string[] blockedSceneWords = BlockedSceneWords;
			foreach (string value in blockedSceneWords)
			{
				if (text.Contains(value))
				{
					return false;
				}
			}
			foreach (string item in UserBlocked())
			{
				if (text.Contains(item))
				{
					return false;
				}
			}
			return true;
		}

		public static bool InMatch()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (!SceneAllowed(name))
			{
				return false;
			}
			if (moddedScenes.Contains(name))
			{
				return false;
			}
			return (Object)(object)GameObject.Find("actor_leftHand_collider") != (Object)null;
		}

		private static string Norm(string s)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string text = (s ?? "").ToLowerInvariant();
			foreach (char c in text)
			{
				if (char.IsLetterOrDigit(c))
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		private static HashSet<string> ModNames()
		{
			if (modNames != null)
			{
				return modNames;
			}
			modNames = new HashSet<string>();
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(Application.dataPath), "Mods");
				if (!Directory.Exists(path))
				{
					return modNames;
				}
				List<string> list = new List<string>();
				list.AddRange(Directory.GetDirectories(path, "*", SearchOption.AllDirectories));
				string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
				foreach (string text in files)
				{
					if (!text.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
					{
						list.Add(text);
					}
				}
				foreach (string item in list)
				{
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item);
					modNames.Add(Norm(fileNameWithoutExtension));
					string[] array = fileNameWithoutExtension.Split('-', '_', '.', ' ');
					foreach (string text2 in array)
					{
						if (text2.Length >= 3)
						{
							modNames.Add(Norm(text2));
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Maps] Couldn't read Mods folder: " + ex.Message);
			}
			return modNames;
		}

		public static void CheckScene(int buildIndex, string sceneName)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(sceneName))
			{
				return;
			}
			bool flag = false;
			string text = "";
			string text2 = Norm(sceneName);
			if (text2.Length >= 3 && ModNames().Contains(text2))
			{
				flag = true;
				text = "name matches something in your Mods folder";
			}
			if (!flag)
			{
				try
				{
					Scene sceneByName = SceneManager.GetSceneByName(sceneName);
					foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref sceneByName)).GetRootGameObjects())
					{
						foreach (MonoBehaviour componentsInChild in item.GetComponentsInChildren<MonoBehaviour>(true))
						{
							if (!((Object)(object)componentsInChild == (Object)null))
							{
								string text3 = ((Object)componentsInChild).GetIl2CppType().FullName ?? "";
								if (text3.Contains("CementGB") || text3.Contains("GBMDK") || text3.Contains("Cement."))
								{
									flag = true;
									text = "contains custom-map component " + text3;
									break;
								}
							}
						}
						if (flag)
						{
							break;
						}
					}
				}
				catch (Exception)
				{
				}
			}
			if (flag)
			{
				moddedScenes.Add(sceneName);
			}
			MelonLogger.Msg("[Maps] '" + sceneName + "' (build index " + buildIndex + ") -> " + (flag ? ("CUSTOM MAP, powers off (" + text + ")") : "official map"));
		}

		public static bool CanUsePowers()
		{
			if (!InMatch())
			{
				return false;
			}
			if (MenuIsOpen)
			{
				return false;
			}
			if (Time.unscaledTime - menuClosedAt < 0.4f)
			{
				return false;
			}
			if (downed)
			{
				return false;
			}
			return true;
		}

		private static void UpdateMenuAndDowned()
		{
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			bool menuIsOpen = MenuIsOpen;
			if (menuWasOpen && !menuIsOpen)
			{
				menuClosedAt = Time.unscaledTime;
			}
			if (menuIsOpen != menuWasOpen)
			{
				string text = "";
				try
				{
					if (Time.timeScale < 0.01f)
					{
						text = "game paused";
					}
					else
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null && (Object)(object)current.currentSelectedGameObject != (Object)null)
						{
							text = "menu item '" + ((Object)current.currentSelectedGameObject).name + "'";
						}
					}
				}
				catch (Exception)
				{
				}
				MelonLogger.Msg(menuIsOpen ? ("[Menu] Menu open (" + text + ") -- powers off") : "[Menu] Menu closed -- powers back on");
			}
			menuWasOpen = menuIsOpen;
			if (Time.time - lastDownCheck < 0.15f)
			{
				return;
			}
			lastDownCheck = Time.time;
			try
			{
				Transform myRoot = GetMyRoot();
				if ((Object)(object)myRoot == (Object)null)
				{
					downed = false;
					return;
				}
				List<Rigidbody> bodies = GetBodies(myRoot);
				if (bodies.Count == 0)
				{
					downed = false;
					return;
				}
				float num = float.MaxValue;
				float num2 = float.MinValue;
				bool flag = false;
				foreach (Rigidbody item in bodies)
				{
					if (!((Object)(object)item == (Object)null))
					{
						float y = item.position.y;
						if (y < num)
						{
							num = y;
						}
						if (((Object)item).name.ToLowerInvariant().Contains("head"))
						{
							num2 = y;
							flag = true;
						}
						else if (!flag && y > num2)
						{
							num2 = y;
						}
					}
				}
				float num3 = num2 - num;
				Vector3 val = AverageVelocity(bodies);
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < 3f)
				{
					standHeight = Mathf.Max(standHeight * 0.998f, num3);
				}
				bool flag2 = standHeight > 0.3f && num3 < standHeight * 0.5f && magnitude < 3f;
				if (flag2 != downed)
				{
					MelonLogger.Msg(flag2 ? "[Me] Knocked out / lying down -- powers off" : "[Me] Back up -- powers on");
				}
				downed = flag2;
			}
			catch (Exception)
			{
				downed = false;
			}
		}

		public static void ResetForScene()
		{
			standHeight = 0f;
			downed = false;
			me = null;
			detecting = false;
			snapshots.Clear();
			loggedRoot = false;
		}

		public static void OnJumpPressed()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (detecting || HasMe)
			{
				return;
			}
			try
			{
				snapshots.Clear();
				foreach (Transform item in AllBeastRoots())
				{
					List<Rigidbody> bodies = GetBodies(item);
					if (bodies.Count != 0)
					{
						snapshots.Add(new Snapshot
						{
							root = item,
							bodies = bodies,
							vy = AverageVelocity(bodies).y
						});
					}
				}
				if (snapshots.Count == 1)
				{
					LockOn(snapshots[0].root, "only beast in the match");
				}
				else if (snapshots.Count != 0)
				{
					detecting = true;
					detectStart = Time.time;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Me] Detection failed: " + ex.Message);
			}
		}

		public static void Tick()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			UpdateMenuAndDowned();
			if (!detecting || Time.time - detectStart < 0.15f)
			{
				return;
			}
			detecting = false;
			Snapshot snapshot = null;
			float num = 1.5f;
			foreach (Snapshot snapshot2 in snapshots)
			{
				if (!((Object)(object)snapshot2.root == (Object)null))
				{
					float num2 = AverageVelocity(snapshot2.bodies).y - snapshot2.vy;
					if (num2 > num)
					{
						num = num2;
						snapshot = snapshot2;
					}
				}
			}
			if (snapshot != null)
			{
				LockOn(snapshot.root, "it jumped when you pressed jump");
			}
			else
			{
				MelonLogger.Msg("[Me] Couldn't tell which beast is you yet. Press jump while standing on the ground.");
			}
			snapshots.Clear();
		}

		private static void LockOn(Transform root, string why)
		{
			me = root;
			MelonLogger.Msg("[Me] Locked onto '" + ((Object)root).name + "' (" + why + ")");
		}

		public static Transform GetMyRoot()
		{
			if (HasMe)
			{
				return me;
			}
			GameObject val = GameObject.Find("actor_leftHand_collider");
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return GetBeastRoot(val.transform);
		}

		public static List<Transform> AllBeastRoots()
		{
			List<Transform> list = new List<Transform>();
			HashSet<int> hashSet = new HashSet<int>();
			foreach (Transform item in Object.FindObjectsOfType<Transform>())
			{
				if (!((Object)(object)item == (Object)null) && !(((Object)item).name != "actor_leftHand_collider"))
				{
					Transform beastRoot = GetBeastRoot(item);
					if (hashSet.Add(((Object)beastRoot).GetInstanceID()))
					{
						list.Add(beastRoot);
					}
				}
			}
			return list;
		}

		public static Transform GetBeastRoot(Transform part)
		{
			Transform val = part;
			while ((Object)(object)val.parent != (Object)null && CountHands(val.parent) <= 1)
			{
				val = val.parent;
			}
			return val;
		}

		public static bool IsBeast(Transform root)
		{
			return (Object)(object)root != (Object)null && CountHands(root) == 1;
		}

		public static List<Rigidbody> GetBodies(Transform beastRoot)
		{
			List<Rigidbody> list = new List<Rigidbody>();
			if ((Object)(object)beastRoot == (Object)null)
			{
				return list;
			}
			foreach (Rigidbody componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Rigidbody>())
			{
				if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isKinematic && ((Object)componentsInChild).name.ToLowerInvariant().StartsWith("actor"))
				{
					list.Add(componentsInChild);
					if (list.Count >= 60)
					{
						break;
					}
				}
			}
			string text = "names";
			if (list.Count < 4)
			{
				list = JointWalk(beastRoot);
				text = "joints";
			}
			if (!loggedRoot)
			{
				loggedRoot = true;
				List<string> list2 = new List<string>();
				for (int i = 0; i < list.Count && i < 6; i++)
				{
					list2.Add(((Object)list[i]).name);
				}
				MelonLogger.Msg("[Me] Beast '" + ((Object)beastRoot).name + "' -> " + list.Count + " parts via " + text + ": " + string.Join(", ", list2));
			}
			return list;
		}

		private static List<Rigidbody> JointWalk(Transform beastRoot)
		{
			List<Rigidbody> list = new List<Rigidbody>();
			Transform val = null;
			foreach (Transform componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Transform>(true))
			{
				if (((Object)componentsInChild).name == "actor_leftHand_collider")
				{
					val = componentsInChild;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return list;
			}
			Rigidbody val2 = ((Component)val).GetComponent<Rigidbody>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((Component)val).GetComponentInParent<Rigidbody>();
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return list;
			}
			Dictionary<int, List<Rigidbody>> dictionary = new Dictionary<int, List<Rigidbody>>();
			foreach (Joint item in Object.FindObjectsOfType<Joint>())
			{
				if (!((Object)(object)item == (Object)null))
				{
					Rigidbody component = ((Component)item).GetComponent<Rigidbody>();
					Rigidbody connectedBody = item.connectedBody;
					if (!((Object)(object)component == (Object)null) && !((Object)(object)connectedBody == (Object)null))
					{
						Link(dictionary, component, connectedBody);
						Link(dictionary, connectedBody, component);
					}
				}
			}
			HashSet<int> hashSet = new HashSet<int> { ((Object)val2).GetInstanceID() };
			Queue<Rigidbody> queue = new Queue<Rigidbody>();
			queue.Enqueue(val2);
			while (queue.Count > 0 && list.Count < 60)
			{
				Rigidbody val3 = queue.Dequeue();
				if (!val3.isKinematic)
				{
					list.Add(val3);
				}
				if (!dictionary.TryGetValue(((Object)val3).GetInstanceID(), out var value))
				{
					continue;
				}
				foreach (Rigidbody item2 in value)
				{
					if (!((Object)(object)item2 == (Object)null) && ((Component)item2).transform.IsChildOf(beastRoot) && hashSet.Add(((Object)item2).GetInstanceID()))
					{
						queue.Enqueue(item2);
					}
				}
			}
			return list;
		}

		private static void Link(Dictionary<int, List<Rigidbody>> adj, Rigidbody from, Rigidbody to)
		{
			int instanceID = ((Object)from).GetInstanceID();
			if (!adj.TryGetValue(instanceID, out var value))
			{
				value = (adj[instanceID] = new List<Rigidbody>());
			}
			value.Add(to);
		}

		public static int CountHands(Transform root)
		{
			int num = 0;
			foreach (Transform componentsInChild in ((Component)root).GetComponentsInChildren<Transform>(true))
			{
				if (((Object)componentsInChild).name == "actor_leftHand_collider")
				{
					num++;
				}
			}
			return num;
		}

		public static bool IsHand(Rigidbody rb)
		{
			return ((Object)rb).name.ToLowerInvariant().Contains("hand");
		}

		public static Vector3 AverageVelocity(List<Rigidbody> list)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					val += item.velocity;
					num++;
				}
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static Vector3 AveragePosition(List<Rigidbody> list)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					val += item.position;
					num++;
				}
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static Vector3 FeetPosition(List<Rigidbody> list)
		{
			//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_002a: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = AveragePosition(list);
			float num = float.MaxValue;
			foreach (Rigidbody item in list)
			{
				if ((Object)(object)item != (Object)null && item.position.y < num)
				{
					num = item.position.y;
				}
			}
			if (num == float.MaxValue)
			{
				return val;
			}
			return new Vector3(val.x, num - 0.2f, val.z);
		}

		public static float GroundDistance(Vector3 from, Transform ignoreRoot, float maxDist = 20f)
		{
			//IL_0004: 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)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			float num = maxDist;
			foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(from, Vector3.down, maxDist))
			{
				RaycastHit current = item;
				if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !((RaycastHit)(ref current)).collider.isTrigger && (!((Object)(object)ignoreRoot != (Object)null) || !((Component)((RaycastHit)(ref current)).collider).transform.IsChildOf(ignoreRoot)) && ((RaycastHit)(ref current)).distance < num)
				{
					num = ((RaycastHit)(ref current)).distance;
				}
			}
			return num;
		}
	}
	internal static class CartoonFx
	{
		private enum Kind
		{
			Ring,
			Puff,
			Debris,
			Pillar,
			Bolt,
			Crack,
			Spark,
			Blast,
			Beam,
			Glow,
			Shock
		}

		private class Piece
		{
			public GameObject go;

			public Renderer rend;

			public Kind kind;

			public Vector3 velocity;

			public Vector3 spin;

			public Vector3 maxScale;

			public float born;

			public float life;

			public Vector3 origin;

			public Vector3 dir;

			public float angle;

			public float r0;

			public float r1;

			public float speed;

			public int segments;
		}

		private class Flash
		{
			public Light light;

			public float born;

			public float life;

			public float peak;
		}

		private static readonly Color Neon = new Color(0.12f, 0.85f, 0.12f);

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

		private static readonly Color Deep = new Color(0.03f, 0.4f, 0.06f);

		private static readonly List<Piece> pieces = new List<Piece>();

		private static readonly List<Flash> flashes = new List<Flash>();

		private static readonly Dictionary<string, Material> mats = new Dictionary<string, Material>();

		private static Shader borrowedShader;

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

		private static readonly Color RoarGlow = new Color(0.12f, 0.85f, 0.12f);

		private static readonly Color RoarDark = new Color(0.03f, 0.4f, 0.06f);

		private unsafe static Material GetMaterial(Transform beastRoot, Color color, float glow)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_014f: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			string key = ((object)(*(Color*)(&color))/*cast due to .constrained prefix*/).ToString() + glow;
			if (mats.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			if ((Object)(object)borrowedShader == (Object)null)
			{
				foreach (Renderer componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Renderer>(true))
				{
					if ((Object)(object)componentsInChild != (Object)null && (Object)(object)componentsInChild.sharedMaterial != (Object)null && (Object)(object)componentsInChild.sharedMaterial.shader != (Object)null)
					{
						borrowedShader = componentsInChild.sharedMaterial.shader;
						break;
					}
				}
			}
			if ((Object)(object)borrowedShader == (Object)null)
			{
				return null;
			}
			Material val = new Material(borrowedShader);
			((Object)val).hideFlags = (HideFlags)32;
			if (val.HasProperty("_BaseMap"))
			{
				val.SetTexture("_BaseMap", (Texture)null);
			}
			if (val.HasProperty("_MainTex"))
			{
				val.SetTexture("_MainTex", (Texture)null);
			}
			if (val.HasProperty("_BaseColor"))
			{
				val.SetColor("_BaseColor", color);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			if (val.HasProperty("_EmissionColor"))
			{
				val.EnableKeyword("_EMISSION");
				val.SetColor("_EmissionColor", color * Mathf.Min(glow, 0.9f));
			}
			mats[key] = val;
			return val;
		}

		public static void Burst(Vector3 pos, Transform beastRoot, float size)
		{
			//IL_0003: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 2f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Ring(material, pos, 3.5f * size, 0.45f, 0f);
				Puffs(material, pos, Mathf.RoundToInt(8f * Mathf.Max(1f, size)), size);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Burst failed: " + ex.Message);
			}
		}

		public static void Charge(Vector3 handsPos, Transform beastRoot, float progress)
		{
			//IL_0003: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_0195: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 2.5f);
				Material material2 = GetMaterial(beastRoot, Core, 4f);
				if (!((Object)(object)material == (Object)null))
				{
					int num = ((!(progress > 0.5f)) ? 1 : 2);
					for (int i = 0; i < num; i++)
					{
						Vector3 val = Random.onUnitSphere * Random.Range(1f, 1.8f);
						float num2 = Random.Range(0.08f, 0.16f);
						Spawn((PrimitiveType)0, material, Kind.Spark, handsPos + val, -val * 4f, new Vector3(num2, num2, num2), 0.25f, 0f);
					}
					if (progress > 0.2f && Random.value < 0.6f)
					{
						Vector3 a = handsPos + Random.onUnitSphere * 1.1f;
						Vector3 b = handsPos + Random.onUnitSphere * 1.1f;
						Bolt(material2, a, b, 5, 0.3f, 0.06f, 0.12f, 0f);
						Bolt(material, a, b, 5, 0.35f, 0.14f, 0.1f, 0f);
					}
					if (progress > 0.65f && Random.value < 0.3f)
					{
						Vector3 b2 = handsPos + Flat(Random.insideUnitSphere) * 1.5f + Vector3.down * 2.5f;
						Bolt(material2, handsPos, b2, 6, 0.5f, 0.07f, 0.12f, 0f);
						Bolt(material, handsPos, b2, 6, 0.6f, 0.16f, 0.1f, 0f);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Charge failed: " + ex.Message);
			}
		}

		public static void LightningSlam(Vector3 center, Transform beastRoot, float radius, int skyBolts = 5, bool pillar = true, int arcs = 12)
		{
			//IL_0003: 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_0025: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ba: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				Material material3 = GetMaterial(beastRoot, Deep, 1.5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				for (int i = 0; i < skyBolts; i++)
				{
					float num = (float)i * 0.05f;
					Vector3 val = center + Flat(Random.insideUnitSphere) * 1.5f;
					Vector3 a = val + Vector3.up * Random.Range(12f, 18f) + Flat(Random.insideUnitSphere) * 4f;
					for (int j = 0; j < 2; j++)
					{
						float num2 = num + (float)j * 0.16f;
						List<Vector3> list = Bolt(material2, a, val, 12, 1.3f, 0.22f, 0.3f, num2);
						Bolt(material, a, val, 12, 1.6f, 0.5f, 0.28f, num2);
						for (int k = 0; k < 2; k++)
						{
							Vector3 val2 = list[Random.Range(2, list.Count - 3)];
							Vector3 b = val2 + Flat(Random.onUnitSphere) * Random.Range(2.5f, 4.5f) + Vector3.down * Random.Range(1.5f, 3.5f);
							Bolt(material2, val2, b, 6, 0.7f, 0.1f, 0.25f, num2 + 0.02f);
							Bolt(material, val2, b, 6, 0.8f, 0.22f, 0.22f, num2 + 0.02f);
						}
					}
				}
				for (int l = 0; l < arcs; l++)
				{
					Vector3 val3 = Quaternion.Euler(0f, 360f / (float)arcs * (float)l + Random.Range(-15f, 15f), 0f) * Vector3.forward;
					Vector3 b2 = center + val3 * radius * Random.Range(0.7f, 1f) + Vector3.up * 0.15f;
					Bolt(material2, center + Vector3.up * 0.15f, b2, 8, 0.6f, 0.13f, 0.45f, 0.04f);
					Bolt(material, center + Vector3.up * 0.15f, b2, 8, 0.7f, 0.3f, 0.4f, 0.04f);
				}
				if (pillar)
				{
					Spawn((PrimitiveType)2, material, Kind.Pillar, center + Vector3.up * 6f, Vector3.zero, new Vector3(2.2f, 6f, 2.2f), 0.5f, 0f);
					Spawn((PrimitiveType)2, material2, Kind.Pillar, center + Vector3.up * 6f, Vector3.zero, new Vector3(0.9f, 6f, 0.9f), 0.4f, 0f);
				}
				for (int m = 0; m < 14; m++)
				{
					Vector3 val4 = Flat(Random.onUnitSphere);
					Vector3 vel = val4 * Random.Range(3f, 7f) + Vector3.up * Random.Range(6f, 12f);
					float num3 = Random.Range(0.18f, 0.45f);
					Spawn((PrimitiveType)3, (m % 3 == 0) ? material : material3, Kind.Debris, center + Vector3.up * 0.3f, vel, new Vector3(num3, num3, num3), Random.Range(1.1f, 1.6f), 0f).transform.rotation = Random.rotation;
				}
				Puffs(material, center, 16, 2.2f);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Lightning slam failed: " + ex.Message);
			}
		}

		public static void JumpFx(Vector3 feet, Transform beastRoot, float size)
		{
			//IL_0003: 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_0041: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Puffs(material, feet, Mathf.RoundToInt(8f * Mathf.Max(1f, size)), size);
				for (int i = 0; i < 3; i++)
				{
					Vector3 val = feet + Flat(Random.insideUnitSphere) * 0.8f * size;
					Vector3 b = val + Vector3.up * Random.Range(1.8f, 3f) * size + Flat(Random.insideUnitSphere) * 0.8f * size;
					float delay = (float)i * 0.04f;
					Bolt(material2, val, b, 6, 0.35f * size, 0.06f, 0.22f, delay);
					Bolt(material, val, b, 6, 0.4f * size, 0.14f, 0.2f, delay);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Jump effect failed: " + ex.Message);
			}
		}

		public static void LightningLaunch(Vector3 feet, Transform beastRoot)
		{
			//IL_0003: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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_0191: 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_01a0: 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_01c3: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: 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_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				for (int i = 0; i < 6; i++)
				{
					Vector3 a = feet + Flat(Random.insideUnitSphere) * 0.6f;
					Vector3 b = feet + Vector3.up * Random.Range(5f, 8f) + Flat(Random.insideUnitSphere) * Random.Range(1.5f, 3f);
					for (int j = 0; j < 2; j++)
					{
						float delay = (float)i * 0.02f + (float)j * 0.12f;
						Bolt(material2, a, b, 8, 0.7f, 0.12f, 0.3f, delay);
						Bolt(material, a, b, 8, 0.8f, 0.3f, 0.28f, delay);
					}
				}
				for (int k = 0; k < 8; k++)
				{
					Vector3 val = Quaternion.Euler(0f, 45f * (float)k + Random.Range(-15f, 15f), 0f) * Vector3.forward;
					Vector3 b2 = feet + val * Random.Range(2f, 3.5f) + Vector3.up * 0.15f;
					Bolt(material2, feet + Vector3.up * 0.15f, b2, 6, 0.4f, 0.09f, 0.35f, 0f);
					Bolt(material, feet + Vector3.up * 0.15f, b2, 6, 0.5f, 0.22f, 0.3f, 0f);
				}
				Ring(material2, feet, 3f, 0.35f, 0f);
				Ring(material, feet, 4.5f, 0.45f, 0.06f);
				Puffs(material, feet, 10, 1.2f);
				for (int l = 0; l < 6; l++)
				{
					Vector3 vel = Flat(Random.onUnitSphere) * Random.Range(2f, 4f) + Vector3.up * Random.Range(4f, 8f);
					float num = Random.Range(0.12f, 0.28f);
					Spawn((PrimitiveType)3, material, Kind.Debris, feet + Vector3.up * 0.3f, vel, new Vector3(num, num, num), Random.Range(0.9f, 1.3f), 0f).transform.rotation = Random.rotation;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Launch failed: " + ex.Message);
			}
		}

		public static void Trail(Vector3 pos, Transform beastRoot)
		{
			//IL_0003: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if (!((Object)(object)material == (Object)null))
				{
					Vector3 val = Random.insideUnitSphere * 0.6f;
					float num = Random.Range(0.08f, 0.18f);
					Spawn((PrimitiveType)0, material, Kind.Spark, pos + val, Random.insideUnitSphere * 1.5f, new Vector3(num, num, num), 0.35f, 0f);
					if (Random.value < 0.15f)
					{
						Vector3 a = pos + Random.onUnitSphere * 0.8f;
						Vector3 b = pos + Random.onUnitSphere * 0.8f;
						Bolt(material2, a, b, 4, 0.3f, 0.05f, 0.1f, 0f);
						Bolt(material, a, b, 4, 0.35f, 0.12f, 0.08f, 0f);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		private static Vector3 Spread(Vector3 dir, float maxAngle)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(0f - maxAngle, maxAngle);
			float num2 = Random.Range((0f - maxAngle) * 0.35f, maxAngle * 0.35f);
			Vector3 val = Vector3.Cross(Vector3.up, dir);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = Quaternion.AngleAxis(num, Vector3.up) * Quaternion.AngleAxis(num2, normalized) * dir;
			return ((Vector3)(ref val)).normalized;
		}

		private static GameObject SpawnBeam(Material m, Vector3 origin, Vector3 dir, float length, float width, float life, float delay)
		{
			//IL_0004: 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)
			//IL_0015: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Spawn((PrimitiveType)2, m, Kind.Beam, origin, Vector3.zero, new Vector3(width, length * 0.5f, width), life, delay);
			val.transform.rotation = Quaternion.FromToRotation(Vector3.up, dir);
			Piece piece = pieces[pieces.Count - 1];
			piece.origin = origin;
			piece.dir = dir;
			return val;
		}

		private static void ShockRing(Material m, Vector3 origin, Vector3 dir, float startRadius, float endRadius, float travel, float thickness, float life, float delay, int segments = 22)
		{
			//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_001c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < segments; i++)
			{
				GameObject val = Spawn((PrimitiveType)3, m, Kind.Shock, origin, Vector3.zero, new Vector3(thickness, thickness, 0.1f), life, delay);
				Piece piece = pieces[pieces.Count - 1];
				piece.origin = origin;
				piece.dir = dir;
				piece.angle = (float)Math.PI * 2f / (float)segments * (float)i;
				piece.r0 = startRadius;
				piece.r1 = endRadius;
				piece.speed = travel / life;
				piece.segments = segments;
			}
		}

		private static void SpeedLines(Material m, Vector3 origin, Vector3 dir, int count, float spreadRadius)
		{
			//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_000c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_001f: 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_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_006b: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0117: 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)
			Vector3 val = Vector3.Cross(dir, Vector3.up);
			if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
			{
				val = Vector3.Cross(dir, Vector3.right);
			}
			val = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(val, dir);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			for (int i = 0; i < count; i++)
			{
				float num = Random.Range(0f, (float)Math.PI * 2f);
				float num2 = Random.Range(0.4f, spreadRadius);
				Vector3 pos = origin + (val * Mathf.Cos(num) + normalized * Mathf.Sin(num)) * num2 + dir * Random.Range(0f, 1.5f);
				float num3 = Random.Range(1.2f, 2.6f);
				Spawn((PrimitiveType)3, m, Kind.Spark, pos, dir * Random.Range(18f, 28f), new Vector3(0.04f, 0.04f, num3), Random.Range(0.25f, 0.4f), Random.Range(0f, 0.08f)).transform.rotation = Quaternion.LookRotation(dir);
			}
		}

		public static void RoarBurst(Vector3 origin, Vector3 dir, Transform beastRoot, float range)
		{
			//IL_0003: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_0171: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarCore, 0.9f);
				Material material2 = GetMaterial(beastRoot, RoarGlow, 0.7f);
				Material material3 = GetMaterial(beastRoot, RoarDark, 0.4f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Spawn((PrimitiveType)0, material2, Kind.Glow, origin, Vector3.zero, new Vector3(0.5f, 0.5f, 0.5f), 1.3f, 0f);
				Spawn((PrimitiveType)0, material, Kind.Glow, origin, Vector3.zero, new Vector3(0.25f, 0.25f, 0.25f), 1.3f, 0f);
				for (int i = 0; i < 4; i++)
				{
					float num = (float)i * 0.08f;
					float num2 = 2.6f + (float)i * 0.7f;
					float num3 = range * (0.75f + (float)i * 0.08f);
					float life = 0.5f + (float)i * 0.05f;
					float num4 = 0.2f - (float)i * 0.03f;
					ShockRing((i == 0) ? material : material2, origin, dir, 0.35f, num2, num3, num4, life, num, 28);
					ShockRing(material3, origin, dir, 0.45f, num2 * 1.12f, num3 * 0.95f, num4 * 0.7f, life, num + 0.03f, 24);
				}
				SpeedLines(material2, origin, dir, 16, 2.2f);
				SpeedLines(material, origin, dir, 6, 1.4f);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Roar burst failed: " + ex.Message);
			}
		}

		public static void RoarStream(Vector3 origin, Vector3 dir, Transform beastRoot, float range)
		{
			//IL_0003: 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_0032: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarGlow, 0.7f);
				Material material2 = GetMaterial(beastRoot, RoarDark, 0.4f);
				if (!((Object)(object)material == (Object)null))
				{
					ShockRing(material, origin, dir, 0.3f, 2.2f, range * 0.7f, 0.12f, 0.42f, 0f);
					ShockRing(material2, origin, dir, 0.4f, 2.45f, range * 0.66f, 0.08f, 0.42f, 0.03f, 18);
					SpeedLines(material, origin, dir, 5, 1.8f);
				}
			}
			catch (Exception)
			{
			}
		}

		public static void RoarChain(Vector3 from, Vector3 to, Transform beastRoot)
		{
			//IL_0003: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			try
			{
				Material material = GetMaterial(beastRoot, RoarCore, 0.9f);
				Material material2 = GetMaterial(beastRoot, RoarGlow, 0.7f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 2; i++)
					{
						float delay = (float)i * 0.12f;
						Bolt(material, from, to, 8, 0.6f, 0.05f, 0.25f, delay);
						Bolt(material2, from, to, 8, 0.7f, 0.12f, 0.22f, delay);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static Material AimMaterial(Transform beastRoot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return GetMaterial(beastRoot, RoarCore, 0.9f);
		}

		public static void Fizzle(Vector3 origin, Transform beastRoot)
		{
			//IL_0003: 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_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarGlow, 1.6f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 5; i++)
					{
						float num = Random.Range(0.1f, 0.2f);
						Spawn((PrimitiveType)0, material, Kind.Spark, origin, Random.insideUnitSphere * 2f, new Vector3(num, num, num), 0.3f, 0f);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static void ChainLightning(Vector3 from, Vector3 to, Transform beastRoot)
		{
			//IL_0003: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0083: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 2; i++)
					{
						float delay = (float)i * 0.12f;
						Bolt(material2, from + Vector3.up * 0.5f, to, 8, 0.8f, 0.12f, 0.3f, delay);
						Bolt(material, from + Vector3.up * 0.5f, to, 8, 0.9f, 0.28f, 0.28f, delay);
					}
					Puffs(material, to, 6, 0.8f);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Chain lightning failed: " + ex.Message);
			}
		}

		private static Vector3 Flat(Vector3 v)
		{
			//IL_0024: 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_0029: 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)
			v.y = 0f;
			return (((Vector3)(ref v)).sqrMagnitude < 0.0001f) ? Vector3.forward : ((Vector3)(ref v)).normalized;
		}

		private static void Ring(Material m, Vector3 pos, float diameter, float life, float delay)
		{
			//IL_0004: 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)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			Spawn((PrimitiveType)2, m, Kind.Ring, pos + Vector3.up * 0.05f, Vector3.zero, new Vector3(diameter, 0.04f, diameter), life, delay);
		}

		private static void Puffs(Material m, Vector3 pos, int count, float size)
		{
			//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_003f: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < count; i++)
			{
				float num = 360f / (float)count * (float)i + Random.Range(-10f, 10f);
				Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward;
				Vector3 vel = val * Random.Range(3f, 5f) * size + Vector3.up * Random.Range(1f, 3f);
				float num2 = Random.Range(0.35f, 0.6f) * size;
				Spawn((PrimitiveType)0, m, Kind.Puff, pos + Vector3.up * 0.2f, vel, new Vector3(num2, num2, num2), Random.Range(0.4f, 0.6f), 0f);
			}
		}

		private static List<Vector3> Bolt(Material m, Vector3 a, Vector3 b, int segments, float jag, float thickness, float life, float delay)
		{
			//IL_0007: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3> { a };
			for (int i = 1; i < segments; i++)
			{
				float num = (float)i / (float)segments;
				float num2 = Mathf.Sin(num * (float)Math.PI);
				list.Add(Vector3.Lerp(a, b, num) + Random.insideUnitSphere * jag * num2);
			}
			list.Add(b);
			for (int j = 0; j < list.Count - 1; j++)
			{
				Vector3 val = list[j];
				Vector3 val2 = list[j + 1];
				Vector3 val3 = val2 - val;
				float magnitude = ((Vector3)(ref val3)).magnitude;
				if (!(magnitude < 0.01f))
				{
					GameObject val4 = Spawn((PrimitiveType)3, m, Kind.Bolt, (val + val2) * 0.5f, Vector3.zero, new Vector3(thickness, thickness, magnitude * 1.05f), life, delay);
					val4.transform.rotation = Quaternion.LookRotation(val3);
				}
			}
			return list;
		}

		private static GameObject Spawn(PrimitiveType type, Material m, Kind kind, Vector3 pos, Vector3 vel, Vector3 maxScale, float life, float delay)
		{
			//IL_0001: 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_005f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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)
			GameObject val = GameObject.CreatePrimitive(type);
			((Object)val).name = "AndresFx";
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = val.GetComponent<Renderer>();
			component2.sharedMaterial = m;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			val.transform.position = pos;
			val.transform.localScale = Vector3.zero;
			pieces.Add(new Piece
			{
				go = val,
				rend = component2,
				kind = kind,
				velocity = vel,
				maxScale = maxScale,
				born = Time.time + delay,
				life = life,
				spin = ((kind == Kind.Debris) ? (Random.insideUnitSphere * 720f) : Vector3.zero)
			});
			return val;
		}

		private static void AddFlash(Vector3 pos, Color color, float intensity, float range, float life)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: 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)
			GameObject val = new GameObject("AndresFlash");
			val.transform.position = pos;
			Light val2 = val.AddComponent<Light>();
			val2.type = (LightType)2;
			val2.color = color;
			val2.range = range;
			val2.intensity = intensity;
			flashes.Add(new Flash
			{
				light = val2,
				born = Time.time,
				life = life,
				peak = intensity
			});
		}

		public static void Update()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: 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_03b6: 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_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: 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_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: 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_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			float deltaTime = Time.deltaTime;
			for (int num = pieces.Count - 1; num >= 0; num--)
			{
				Piece piece = pieces[num];
				if ((Object)(object)piece.go == (Object)null)
				{
					pieces.RemoveAt(num);
				}
				else
				{
					float num2 = Time.time - piece.born;
					if (num2 < 0f)
					{
						piece.go.transform.localScale = Vector3.zero;
					}
					else
					{
						float num3 = num2 / piece.life;
						if (num3 >= 1f)
						{
							Object.Destroy((Object)(object)piece.go);
							pieces.RemoveAt(num);
						}
						else
						{
							Transform transform = piece.go.transform;
							Vector3 maxScale = piece.maxScale;
							switch (piece.kind)
							{
							case Kind.Ring:
							{
								float num6 = EaseOut(num3);
								transform.localScale = new Vector3(maxScale.x * num6, maxScale.y * (1f - num3), maxScale.z * num6);
								break;
							}
							case Kind.Puff:
							{
								float num15 = EaseOut(Mathf.Min(1f, num3 * 2.5f));
								float num16 = ((num3 > 0.6f) ? (1f - (num3 - 0.6f) / 0.4f) : 1f);
								transform.localScale = maxScale * num15 * num16;
								transform.position += piece.velocity * deltaTime;
								piece.velocity *= 1f - 4f * deltaTime;
								break;
							}
							case Kind.Debris:
							{
								piece.velocity += Physics.gravity * deltaTime;
								transform.position += piece.velocity * deltaTime;
								transform.Rotate(piece.spin * deltaTime);
								float num21 = ((num3 > 0.75f) ? (1f - (num3 - 0.75f) / 0.25f) : 1f);
								transform.localScale = maxScale * num21;
								break;
							}
							case Kind.Pillar:
							{
								float num18 = ((num3 < 0.15f) ? EaseOut(num3 / 0.15f) : (1f - (num3 - 0.15f) / 0.85f));
								transform.localScale = new Vector3(maxScale.x * num18, maxScale.y, maxScale.z * num18);
								break;
							}
							case Kind.Bolt:
							{
								piece.rend.enabled = Random.value > 0.25f;
								float num17 = ((num3 > 0.6f) ? (1f - (num3 - 0.6f) / 0.4f) : 1f);
								transform.localScale = new Vector3(maxScale.x * num17, maxScale.y * num17, maxScale.z);
								break;
							}
							case Kind.Crack:
							{
								float num11 = EaseOut(Mathf.Min(1f, num3 / 0.12f));
								float num12 = ((num3 > 0.7f) ? (1f - (num3 - 0.7f) / 0.3f) : 1f);
								transform.localScale = new Vector3(maxScale.x * num12, maxScale.y, maxScale.z * num11);
								break;
							}
							case Kind.Shock:
							{
								Vector3 dir = piece.dir;
								Vector3 val = Vector3.Cross(dir, Vector3.up);
								if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
								{
									val = Vector3.Cross(dir, Vector3.right);
								}
								val = ((Vector3)(ref val)).normalized;
								Vector3 val2 = Vector3.Cross(val, dir);
								Vector3 normalized = ((Vector3)(ref val2)).normalized;
								float num7 = EaseOut(num3);
								float num8 = Mathf.Lerp(piece.r0, piece.r1, num7);
								Vector3 val3 = piece.origin + dir * (piece.speed * piece.life * num7);
								Vector3 val4 = val * Mathf.Cos(piece.angle) + normalized * Mathf.Sin(piece.angle);
								Vector3 val5 = -val * Mathf.Sin(piece.angle) + normalized * Mathf.Cos(piece.angle);
								transform.position = val3 + val4 * num8;
								transform.rotation = Quaternion.LookRotation(val5, dir);
								float num9 = (float)Math.PI * 2f * num8 / (float)piece.segments * 1.15f;
								float num10 = maxScale.x * ((num3 < 0.7f) ? 1f : (1f - (num3 - 0.7f) / 0.3f));
								transform.localScale = new Vector3(num10, num10, num9);
								break;
							}
							case Kind.Beam:
							{
								float num19 = maxScale.y * EaseOut(Mathf.Min(1f, num3 / 0.12f));
								float num20 = ((num3 < 0.12f) ? 1f : (1f - EaseOut((num3 - 0.12f) / 0.88f)));
								transform.localScale = new Vector3(maxScale.x * num20, num19, maxScale.z * num20);
								transform.position = piece.origin + piece.dir * num19;
								break;
							}
							case Kind.Glow:
							{
								float num13 = 0.85f + 0.15f * Mathf.Sin(num2 * 40f);
								float num14 = ((num3 < 0.1f) ? (num3 / 0.1f) : (1f - (num3 - 0.1f) / 0.9f));
								transform.localScale = maxScale * num13 * num14;
								break;
							}
							case Kind.Blast:
							{
								float num4 = 0.35f + 0.65f * EaseOut(Mathf.Min(1f, num3 * 1.6f));
								float num5 = ((num3 > 0.65f) ? (1f - (num3 - 0.65f) / 0.35f) : 1f);
								transform.localScale = maxScale * num4 * num5;
								transform.position += piece.velocity * deltaTime;
								piece.velocity *= 1f - 1.2f * deltaTime;
								break;
							}
							case Kind.Spark:
								transform.position += piece.velocity * deltaTime;
								transform.localScale = maxScale * (1f - num3);
								break;
							}
						}
					}
				}
			}
			for (int num22 = flashes.Count - 1; num22 >= 0; num22--)
			{
				Flash flash = flashes[num22];
				if ((Object)(object)flash.light == (Object)null)
				{
					flashes.RemoveAt(num22);
				}
				else
				{
					float num23 = (Time.time - flash.born) / flash.life;
					if (num23 >= 1f)
					{
						Object.Destroy((Object)(object)((Component)flash.light).gameObject);
						flashes.RemoveAt(num22);
					}
					else
					{
						flash.light.intensity = flash.peak * (1f - num23) * ((Random.value > 0.3f) ? 1f : 0.35f);
					}
				}
			}
		}

		private static float EaseOut(float t)
		{
			return 1f - (1f - t) * (1f - t);
		}
	}
	internal static class Sfx
	{
		private static readonly Dictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>();

		private static AudioSource source;

		public static void Play(string name, float volume = 1f)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			try
			{
				AudioClip clip = GetClip(name);
				if (!((Object)(object)clip == (Object)null))
				{
					if ((Object)(object)source == (Object)null)
					{
						GameObject val = new GameObject("AndresSfx");
						Object.DontDestroyOnLoad((Object)(object)val);
						source = val.AddComponent<AudioSource>();
						source.spatialBlend = 0f;
						source.playOnAwake = false;
						source.volume = 1f;
					}
					source.PlayOneShot(clip, volume);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Couldn't play '" + name + "': " + ex.Message);
			}
		}

		private static AudioClip GetClip(string name)
		{
			if (clips.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			AudioClip val = null;
			string text = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UserData", "AndresSounds", name + ".wav");
			if (File.Exists(text))
			{
				val = LoadWav(text, name);
				if ((Object)(object)val != (Object)null)
				{
					MelonLogger.Msg("[Sfx] Using custom sound " + text);
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				val = LoadEmbedded(name);
			}
			if ((Object)(object)val == (Object)null)
			{
				val = (AudioClip)(name switch
				{
					"slam" => MakeThunder(name), 
					"charge" => MakeCharge(name), 
					"zap" => MakeZap(name), 
					_ => MakeBoom(name), 
				});
			}
			((Object)val).hideFlags = (HideFlags)32;
			clips[name] = val;
			return val;
		}

		private static AudioClip MakeBoom(string name)
		{
			int num = 30870;
			float[] array = new float[num];
			Random random = new Random(1234);
			double num2 = 0.0;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Lerp(140f, 35f, Mathf.Min(1f, num3 / 0.35f));
				num2 += Math.PI * 2.0 * (double)num4 / 44100.0;
				float num5 = (float)Math.Sin(num2) * Mathf.Exp((0f - num3) * 6f);
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0) * Mathf.Exp((0f - num3) * 35f) * 0.8f;
				float num7 = (num5 + num6) * 2.2f;
				array[i] = (float)Math.Tanh(num7);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeCharge(string name)
		{
			int num = 24255;
			float[] array = new float[num];
			Random random = new Random(777);
			double num2 = 0.0;
			double num3 = 0.0;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = num5 / 0.55f;
				float num7 = Mathf.Lerp(70f, 260f, num6 * num6);
				num2 += (double)(num7 / 44100f);
				num2 -= Math.Floor(num2);
				num3 += (double)(num7 * 1.01f / 44100f);
				num3 -= Math.Floor(num3);
				float num8 = (float)(num2 * 2.0 - 1.0 + (num3 * 2.0 - 1.0)) * 0.35f;
				num8 *= Mathf.Lerp(0.3f, 1f, num6);
				if (random.NextDouble() < 0.0006 + (double)num6 * 0.002)
				{
					num4 = 1f;
				}
				num4 *= 0.997f;
				float num9 = (float)(random.NextDouble() * 2.0 - 1.0) * num4 * 0.9f;
				array[i] = (float)Math.Tanh((num8 + num9) * 1.8f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeZap(string name)
		{
			int num = 19845;
			float[] array = new float[num];
			Random random = new Random(999);
			double num2 = 0.0;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Exp((0f - num3) * 7f);
				bool flag = (int)(num3 * 60f) % 3 != 2;
				float num5 = (float)(random.NextDouble() * 2.0 - 1.0);
				num2 += Math.PI * 2.0 * (double)Mathf.Lerp(1800f, 600f, num3 / 0.45f) / 44100.0;
				float num6 = (float)Math.Sin(num2) * 0.4f;
				array[i] = (float)Math.Tanh((num5 * 0.9f + num6) * num4 * (flag ? 1f : 0.2f) * 2.2f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeThunder(string name)
		{
			int num = 79380;
			float[] array = new float[num];
			Random random = new Random(4321);
			double num2 = 0.0;
			float num3 = 0f;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0);
				float num7 = num6 * Mathf.Exp((0f - num5) * 28f) * 1.2f;
				float num8 = Mathf.Lerp(110f, 30f, Mathf.Min(1f, num5 / 0.5f));
				num2 += Math.PI * 2.0 * (double)num8 / 44100.0;
				float num9 = (float)Math.Sin(num2) * Mathf.Exp((0f - num5) * 3.5f) * 1.3f;
				num3 += (num6 - num3) * 0.02f;
				num4 += (num3 - num4) * 0.05f;
				float num10 = num4 * 9f * Mathf.Exp((0f - num5) * 1.6f) * (0.7f + 0.3f * Mathf.Sin(num5 * 9f));
				array[i] = (float)Math.Tanh((num7 + num9 + num10) * 2f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip LoadEmbedded(string name)
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				using Stream stream = executingAssembly.GetManifestResourceStream("Sounds." + name + ".wav");
				if (stream == null)
				{
					return null;
				}
				MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				return ParseWav(memoryStream.ToArray(), name, "built-in " + name + ".wav");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Built-in sound '" + name + "' failed: " + ex.Message);
				return null;
			}
		}

		private static AudioClip LoadWav(string path, string name)
		{
			try
			{
				return ParseWav(File.ReadAllBytes(path), name, path);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Failed to load " + path + ": " + ex.Message);
				return null;
			}
		}

		private static AudioClip ParseWav(byte[] b, string name, string path)
		{
			try
			{
				int num = 0;
				int num2 = 0;
				int num3 = 0;
				int num4 = -1;
				int num5 = 0;
				int num6;
				for (int i = 12; i + 8 <= b.Length; i += 8 + num6 + (num6 & 1))
				{
					string text = Encoding.ASCII.GetString(b, i, 4);
					num6 = BitConverter.ToInt32(b, i + 4);
					if (text == "fmt ")
					{
						num = BitConverter.ToInt16(b, i + 10);
						num2 = BitConverter.ToInt32(b, i + 12);
						num3 = BitConverter.ToInt16(b, i + 22);
					}
					else if (text == "data")
					{
						num4 = i + 8;
						num5 = Math.Min(num6, b.Length - num4);
						break;
					}
				}
				if (num3 != 16 || num4 < 0 || num < 1)
				{
					MelonLogger.Warning("[Sfx] " + path + " must be a 16-bit PCM WAV. Using built-in sound.");
					return null;
				}
				int num7 = num5 / 2;
				float[] array = new float[num7];
				for (int j = 0; j < num7; j++)
	

Mods/Hulk-GroundSlam.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using AndresGroundSlam;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(GroundSlamMod), "Andres Ground Slam", "0.9.0", "ItzXngel", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AndresGroundSlam")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AndresGroundSlam")]
[assembly: AssemblyTitle("AndresGroundSlam")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AndresGroundSlam
{
	internal static class Beasts
	{
		private class Snapshot
		{
			public Transform root;

			public List<Rigidbody> bodies;

			public float vy;
		}

		public const string HandName = "actor_leftHand_collider";

		private static readonly string[] BlockedSceneWords = new string[12]
		{
			"menu", "lobby", "title", "load", "boot", "splash", "intro", "credits", "customi", "container",
			"crane", "truck"
		};

		private static List<string> userBlocked;

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

		private static HashSet<string> modNames;

		private static bool menuWasOpen;

		private static float menuClosedAt = -10f;

		private static int menuFrame = -1;

		private static bool menuCached;

		private const float AfterMenuDelay = 0.4f;

		private static float standHeight;

		private static bool downed;

		private static float lastDownCheck;

		private static Transform me;

		private static bool detecting;

		private static float detectStart;

		private static List<Snapshot> snapshots = new List<Snapshot>();

		private const float DetectDelay = 0.15f;

		private static bool loggedRoot;

		public static bool MenuIsOpen
		{
			get
			{
				if (menuFrame == Time.frameCount)
				{
					return menuCached;
				}
				menuFrame = Time.frameCount;
				bool result = false;
				try
				{
					if (Time.timeScale < 0.01f)
					{
						result = true;
					}
					else
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null)
						{
							GameObject currentSelectedGameObject = current.currentSelectedGameObject;
							if ((Object)(object)currentSelectedGameObject != (Object)null && currentSelectedGameObject.activeInHierarchy)
							{
								result = true;
							}
						}
					}
				}
				catch (Exception)
				{
				}
				menuCached = result;
				return result;
			}
		}

		public static bool MeDowned => downed;

		public static bool IsDetecting => detecting;

		public static bool HasMe => (Object)(object)me != (Object)null && IsBeast(me);

		private static List<string> UserBlocked()
		{
			if (userBlocked != null)
			{
				return userBlocked;
			}
			userBlocked = new List<string>();
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UserData", "AndresBlockedMaps.txt");
				if (File.Exists(path))
				{
					string[] array = File.ReadAllLines(path);
					foreach (string text in array)
					{
						string text2 = text.Trim().ToLowerInvariant();
						if (text2.Length > 0 && !text2.StartsWith("#"))
						{
							userBlocked.Add(text2);
						}
					}
					MelonLogger.Msg("[Maps] Blocked by you: " + string.Join(", ", userBlocked));
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Maps] Couldn't read AndresBlockedMaps.txt: " + ex.Message);
			}
			return userBlocked;
		}

		public static bool SceneAllowed(string sceneName)
		{
			string text = (sceneName ?? "").ToLowerInvariant();
			string[] blockedSceneWords = BlockedSceneWords;
			foreach (string value in blockedSceneWords)
			{
				if (text.Contains(value))
				{
					return false;
				}
			}
			foreach (string item in UserBlocked())
			{
				if (text.Contains(item))
				{
					return false;
				}
			}
			return true;
		}

		public static bool InMatch()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (!SceneAllowed(name))
			{
				return false;
			}
			if (moddedScenes.Contains(name))
			{
				return false;
			}
			return (Object)(object)GameObject.Find("actor_leftHand_collider") != (Object)null;
		}

		private static string Norm(string s)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string text = (s ?? "").ToLowerInvariant();
			foreach (char c in text)
			{
				if (char.IsLetterOrDigit(c))
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		private static HashSet<string> ModNames()
		{
			if (modNames != null)
			{
				return modNames;
			}
			modNames = new HashSet<string>();
			try
			{
				string path = Path.Combine(Path.GetDirectoryName(Application.dataPath), "Mods");
				if (!Directory.Exists(path))
				{
					return modNames;
				}
				List<string> list = new List<string>();
				list.AddRange(Directory.GetDirectories(path, "*", SearchOption.AllDirectories));
				string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
				foreach (string text in files)
				{
					if (!text.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
					{
						list.Add(text);
					}
				}
				foreach (string item in list)
				{
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item);
					modNames.Add(Norm(fileNameWithoutExtension));
					string[] array = fileNameWithoutExtension.Split('-', '_', '.', ' ');
					foreach (string text2 in array)
					{
						if (text2.Length >= 3)
						{
							modNames.Add(Norm(text2));
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Maps] Couldn't read Mods folder: " + ex.Message);
			}
			return modNames;
		}

		public static void CheckScene(int buildIndex, string sceneName)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(sceneName))
			{
				return;
			}
			bool flag = false;
			string text = "";
			string text2 = Norm(sceneName);
			if (text2.Length >= 3 && ModNames().Contains(text2))
			{
				flag = true;
				text = "name matches something in your Mods folder";
			}
			if (!flag)
			{
				try
				{
					Scene sceneByName = SceneManager.GetSceneByName(sceneName);
					foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref sceneByName)).GetRootGameObjects())
					{
						foreach (MonoBehaviour componentsInChild in item.GetComponentsInChildren<MonoBehaviour>(true))
						{
							if (!((Object)(object)componentsInChild == (Object)null))
							{
								string text3 = ((Object)componentsInChild).GetIl2CppType().FullName ?? "";
								if (text3.Contains("CementGB") || text3.Contains("GBMDK") || text3.Contains("Cement."))
								{
									flag = true;
									text = "contains custom-map component " + text3;
									break;
								}
							}
						}
						if (flag)
						{
							break;
						}
					}
				}
				catch (Exception)
				{
				}
			}
			if (flag)
			{
				moddedScenes.Add(sceneName);
			}
			MelonLogger.Msg("[Maps] '" + sceneName + "' (build index " + buildIndex + ") -> " + (flag ? ("CUSTOM MAP, powers off (" + text + ")") : "official map"));
		}

		public static bool CanUsePowers()
		{
			if (!InMatch())
			{
				return false;
			}
			if (MenuIsOpen)
			{
				return false;
			}
			if (Time.unscaledTime - menuClosedAt < 0.4f)
			{
				return false;
			}
			if (downed)
			{
				return false;
			}
			return true;
		}

		private static void UpdateMenuAndDowned()
		{
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			bool menuIsOpen = MenuIsOpen;
			if (menuWasOpen && !menuIsOpen)
			{
				menuClosedAt = Time.unscaledTime;
			}
			if (menuIsOpen != menuWasOpen)
			{
				string text = "";
				try
				{
					if (Time.timeScale < 0.01f)
					{
						text = "game paused";
					}
					else
					{
						EventSystem current = EventSystem.current;
						if ((Object)(object)current != (Object)null && (Object)(object)current.currentSelectedGameObject != (Object)null)
						{
							text = "menu item '" + ((Object)current.currentSelectedGameObject).name + "'";
						}
					}
				}
				catch (Exception)
				{
				}
				MelonLogger.Msg(menuIsOpen ? ("[Menu] Menu open (" + text + ") -- powers off") : "[Menu] Menu closed -- powers back on");
			}
			menuWasOpen = menuIsOpen;
			if (Time.time - lastDownCheck < 0.15f)
			{
				return;
			}
			lastDownCheck = Time.time;
			try
			{
				Transform myRoot = GetMyRoot();
				if ((Object)(object)myRoot == (Object)null)
				{
					downed = false;
					return;
				}
				List<Rigidbody> bodies = GetBodies(myRoot);
				if (bodies.Count == 0)
				{
					downed = false;
					return;
				}
				float num = float.MaxValue;
				float num2 = float.MinValue;
				bool flag = false;
				foreach (Rigidbody item in bodies)
				{
					if (!((Object)(object)item == (Object)null))
					{
						float y = item.position.y;
						if (y < num)
						{
							num = y;
						}
						if (((Object)item).name.ToLowerInvariant().Contains("head"))
						{
							num2 = y;
							flag = true;
						}
						else if (!flag && y > num2)
						{
							num2 = y;
						}
					}
				}
				float num3 = num2 - num;
				Vector3 val = AverageVelocity(bodies);
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < 3f)
				{
					standHeight = Mathf.Max(standHeight * 0.998f, num3);
				}
				bool flag2 = standHeight > 0.3f && num3 < standHeight * 0.5f && magnitude < 3f;
				if (flag2 != downed)
				{
					MelonLogger.Msg(flag2 ? "[Me] Knocked out / lying down -- powers off" : "[Me] Back up -- powers on");
				}
				downed = flag2;
			}
			catch (Exception)
			{
				downed = false;
			}
		}

		public static void ResetForScene()
		{
			standHeight = 0f;
			downed = false;
			me = null;
			detecting = false;
			snapshots.Clear();
			loggedRoot = false;
		}

		public static void OnJumpPressed()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (detecting || HasMe)
			{
				return;
			}
			try
			{
				snapshots.Clear();
				foreach (Transform item in AllBeastRoots())
				{
					List<Rigidbody> bodies = GetBodies(item);
					if (bodies.Count != 0)
					{
						snapshots.Add(new Snapshot
						{
							root = item,
							bodies = bodies,
							vy = AverageVelocity(bodies).y
						});
					}
				}
				if (snapshots.Count == 1)
				{
					LockOn(snapshots[0].root, "only beast in the match");
				}
				else if (snapshots.Count != 0)
				{
					detecting = true;
					detectStart = Time.time;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Me] Detection failed: " + ex.Message);
			}
		}

		public static void Tick()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			UpdateMenuAndDowned();
			if (!detecting || Time.time - detectStart < 0.15f)
			{
				return;
			}
			detecting = false;
			Snapshot snapshot = null;
			float num = 1.5f;
			foreach (Snapshot snapshot2 in snapshots)
			{
				if (!((Object)(object)snapshot2.root == (Object)null))
				{
					float num2 = AverageVelocity(snapshot2.bodies).y - snapshot2.vy;
					if (num2 > num)
					{
						num = num2;
						snapshot = snapshot2;
					}
				}
			}
			if (snapshot != null)
			{
				LockOn(snapshot.root, "it jumped when you pressed jump");
			}
			else
			{
				MelonLogger.Msg("[Me] Couldn't tell which beast is you yet. Press jump while standing on the ground.");
			}
			snapshots.Clear();
		}

		private static void LockOn(Transform root, string why)
		{
			me = root;
			MelonLogger.Msg("[Me] Locked onto '" + ((Object)root).name + "' (" + why + ")");
		}

		public static Transform GetMyRoot()
		{
			if (HasMe)
			{
				return me;
			}
			GameObject val = GameObject.Find("actor_leftHand_collider");
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return GetBeastRoot(val.transform);
		}

		public static List<Transform> AllBeastRoots()
		{
			List<Transform> list = new List<Transform>();
			HashSet<int> hashSet = new HashSet<int>();
			foreach (Transform item in Object.FindObjectsOfType<Transform>())
			{
				if (!((Object)(object)item == (Object)null) && !(((Object)item).name != "actor_leftHand_collider"))
				{
					Transform beastRoot = GetBeastRoot(item);
					if (hashSet.Add(((Object)beastRoot).GetInstanceID()))
					{
						list.Add(beastRoot);
					}
				}
			}
			return list;
		}

		public static Transform GetBeastRoot(Transform part)
		{
			Transform val = part;
			while ((Object)(object)val.parent != (Object)null && CountHands(val.parent) <= 1)
			{
				val = val.parent;
			}
			return val;
		}

		public static bool IsBeast(Transform root)
		{
			return (Object)(object)root != (Object)null && CountHands(root) == 1;
		}

		public static List<Rigidbody> GetBodies(Transform beastRoot)
		{
			List<Rigidbody> list = new List<Rigidbody>();
			if ((Object)(object)beastRoot == (Object)null)
			{
				return list;
			}
			foreach (Rigidbody componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Rigidbody>())
			{
				if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isKinematic && ((Object)componentsInChild).name.ToLowerInvariant().StartsWith("actor"))
				{
					list.Add(componentsInChild);
					if (list.Count >= 60)
					{
						break;
					}
				}
			}
			string text = "names";
			if (list.Count < 4)
			{
				list = JointWalk(beastRoot);
				text = "joints";
			}
			if (!loggedRoot)
			{
				loggedRoot = true;
				List<string> list2 = new List<string>();
				for (int i = 0; i < list.Count && i < 6; i++)
				{
					list2.Add(((Object)list[i]).name);
				}
				MelonLogger.Msg("[Me] Beast '" + ((Object)beastRoot).name + "' -> " + list.Count + " parts via " + text + ": " + string.Join(", ", list2));
			}
			return list;
		}

		private static List<Rigidbody> JointWalk(Transform beastRoot)
		{
			List<Rigidbody> list = new List<Rigidbody>();
			Transform val = null;
			foreach (Transform componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Transform>(true))
			{
				if (((Object)componentsInChild).name == "actor_leftHand_collider")
				{
					val = componentsInChild;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return list;
			}
			Rigidbody val2 = ((Component)val).GetComponent<Rigidbody>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((Component)val).GetComponentInParent<Rigidbody>();
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return list;
			}
			Dictionary<int, List<Rigidbody>> dictionary = new Dictionary<int, List<Rigidbody>>();
			foreach (Joint item in Object.FindObjectsOfType<Joint>())
			{
				if (!((Object)(object)item == (Object)null))
				{
					Rigidbody component = ((Component)item).GetComponent<Rigidbody>();
					Rigidbody connectedBody = item.connectedBody;
					if (!((Object)(object)component == (Object)null) && !((Object)(object)connectedBody == (Object)null))
					{
						Link(dictionary, component, connectedBody);
						Link(dictionary, connectedBody, component);
					}
				}
			}
			HashSet<int> hashSet = new HashSet<int> { ((Object)val2).GetInstanceID() };
			Queue<Rigidbody> queue = new Queue<Rigidbody>();
			queue.Enqueue(val2);
			while (queue.Count > 0 && list.Count < 60)
			{
				Rigidbody val3 = queue.Dequeue();
				if (!val3.isKinematic)
				{
					list.Add(val3);
				}
				if (!dictionary.TryGetValue(((Object)val3).GetInstanceID(), out var value))
				{
					continue;
				}
				foreach (Rigidbody item2 in value)
				{
					if (!((Object)(object)item2 == (Object)null) && ((Component)item2).transform.IsChildOf(beastRoot) && hashSet.Add(((Object)item2).GetInstanceID()))
					{
						queue.Enqueue(item2);
					}
				}
			}
			return list;
		}

		private static void Link(Dictionary<int, List<Rigidbody>> adj, Rigidbody from, Rigidbody to)
		{
			int instanceID = ((Object)from).GetInstanceID();
			if (!adj.TryGetValue(instanceID, out var value))
			{
				value = (adj[instanceID] = new List<Rigidbody>());
			}
			value.Add(to);
		}

		public static int CountHands(Transform root)
		{
			int num = 0;
			foreach (Transform componentsInChild in ((Component)root).GetComponentsInChildren<Transform>(true))
			{
				if (((Object)componentsInChild).name == "actor_leftHand_collider")
				{
					num++;
				}
			}
			return num;
		}

		public static bool IsHand(Rigidbody rb)
		{
			return ((Object)rb).name.ToLowerInvariant().Contains("hand");
		}

		public static Vector3 AverageVelocity(List<Rigidbody> list)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					val += item.velocity;
					num++;
				}
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static Vector3 AveragePosition(List<Rigidbody> list)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					val += item.position;
					num++;
				}
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static Vector3 FeetPosition(List<Rigidbody> list)
		{
			//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_002a: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = AveragePosition(list);
			float num = float.MaxValue;
			foreach (Rigidbody item in list)
			{
				if ((Object)(object)item != (Object)null && item.position.y < num)
				{
					num = item.position.y;
				}
			}
			if (num == float.MaxValue)
			{
				return val;
			}
			return new Vector3(val.x, num - 0.2f, val.z);
		}

		public static float GroundDistance(Vector3 from, Transform ignoreRoot, float maxDist = 20f)
		{
			//IL_0004: 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)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			float num = maxDist;
			foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(from, Vector3.down, maxDist))
			{
				RaycastHit current = item;
				if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !((RaycastHit)(ref current)).collider.isTrigger && (!((Object)(object)ignoreRoot != (Object)null) || !((Component)((RaycastHit)(ref current)).collider).transform.IsChildOf(ignoreRoot)) && ((RaycastHit)(ref current)).distance < num)
				{
					num = ((RaycastHit)(ref current)).distance;
				}
			}
			return num;
		}
	}
	internal static class CartoonFx
	{
		private enum Kind
		{
			Ring,
			Puff,
			Debris,
			Pillar,
			Bolt,
			Crack,
			Spark,
			Blast,
			Beam,
			Glow,
			Shock
		}

		private class Piece
		{
			public GameObject go;

			public Renderer rend;

			public Kind kind;

			public Vector3 velocity;

			public Vector3 spin;

			public Vector3 maxScale;

			public float born;

			public float life;

			public Vector3 origin;

			public Vector3 dir;

			public float angle;

			public float r0;

			public float r1;

			public float speed;

			public int segments;
		}

		private class Flash
		{
			public Light light;

			public float born;

			public float life;

			public float peak;
		}

		private static readonly Color Neon = new Color(0.12f, 0.85f, 0.12f);

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

		private static readonly Color Deep = new Color(0.03f, 0.4f, 0.06f);

		private static readonly List<Piece> pieces = new List<Piece>();

		private static readonly List<Flash> flashes = new List<Flash>();

		private static readonly Dictionary<string, Material> mats = new Dictionary<string, Material>();

		private static Shader borrowedShader;

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

		private static readonly Color RoarGlow = new Color(0.12f, 0.85f, 0.12f);

		private static readonly Color RoarDark = new Color(0.03f, 0.4f, 0.06f);

		private unsafe static Material GetMaterial(Transform beastRoot, Color color, float glow)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_014f: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			string key = ((object)(*(Color*)(&color))/*cast due to .constrained prefix*/).ToString() + glow;
			if (mats.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			if ((Object)(object)borrowedShader == (Object)null)
			{
				foreach (Renderer componentsInChild in ((Component)beastRoot).GetComponentsInChildren<Renderer>(true))
				{
					if ((Object)(object)componentsInChild != (Object)null && (Object)(object)componentsInChild.sharedMaterial != (Object)null && (Object)(object)componentsInChild.sharedMaterial.shader != (Object)null)
					{
						borrowedShader = componentsInChild.sharedMaterial.shader;
						break;
					}
				}
			}
			if ((Object)(object)borrowedShader == (Object)null)
			{
				return null;
			}
			Material val = new Material(borrowedShader);
			((Object)val).hideFlags = (HideFlags)32;
			if (val.HasProperty("_BaseMap"))
			{
				val.SetTexture("_BaseMap", (Texture)null);
			}
			if (val.HasProperty("_MainTex"))
			{
				val.SetTexture("_MainTex", (Texture)null);
			}
			if (val.HasProperty("_BaseColor"))
			{
				val.SetColor("_BaseColor", color);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			if (val.HasProperty("_EmissionColor"))
			{
				val.EnableKeyword("_EMISSION");
				val.SetColor("_EmissionColor", color * Mathf.Min(glow, 0.9f));
			}
			mats[key] = val;
			return val;
		}

		public static void Burst(Vector3 pos, Transform beastRoot, float size)
		{
			//IL_0003: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 2f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Ring(material, pos, 3.5f * size, 0.45f, 0f);
				Puffs(material, pos, Mathf.RoundToInt(8f * Mathf.Max(1f, size)), size);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Burst failed: " + ex.Message);
			}
		}

		public static void Charge(Vector3 handsPos, Transform beastRoot, float progress)
		{
			//IL_0003: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_0195: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 2.5f);
				Material material2 = GetMaterial(beastRoot, Core, 4f);
				if (!((Object)(object)material == (Object)null))
				{
					int num = ((!(progress > 0.5f)) ? 1 : 2);
					for (int i = 0; i < num; i++)
					{
						Vector3 val = Random.onUnitSphere * Random.Range(1f, 1.8f);
						float num2 = Random.Range(0.08f, 0.16f);
						Spawn((PrimitiveType)0, material, Kind.Spark, handsPos + val, -val * 4f, new Vector3(num2, num2, num2), 0.25f, 0f);
					}
					if (progress > 0.2f && Random.value < 0.6f)
					{
						Vector3 a = handsPos + Random.onUnitSphere * 1.1f;
						Vector3 b = handsPos + Random.onUnitSphere * 1.1f;
						Bolt(material2, a, b, 5, 0.3f, 0.06f, 0.12f, 0f);
						Bolt(material, a, b, 5, 0.35f, 0.14f, 0.1f, 0f);
					}
					if (progress > 0.65f && Random.value < 0.3f)
					{
						Vector3 b2 = handsPos + Flat(Random.insideUnitSphere) * 1.5f + Vector3.down * 2.5f;
						Bolt(material2, handsPos, b2, 6, 0.5f, 0.07f, 0.12f, 0f);
						Bolt(material, handsPos, b2, 6, 0.6f, 0.16f, 0.1f, 0f);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Charge failed: " + ex.Message);
			}
		}

		public static void LightningSlam(Vector3 center, Transform beastRoot, float radius, int skyBolts = 5, bool pillar = true, int arcs = 12)
		{
			//IL_0003: 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_0025: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ba: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				Material material3 = GetMaterial(beastRoot, Deep, 1.5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				for (int i = 0; i < skyBolts; i++)
				{
					float num = (float)i * 0.05f;
					Vector3 val = center + Flat(Random.insideUnitSphere) * 1.5f;
					Vector3 a = val + Vector3.up * Random.Range(12f, 18f) + Flat(Random.insideUnitSphere) * 4f;
					for (int j = 0; j < 2; j++)
					{
						float num2 = num + (float)j * 0.16f;
						List<Vector3> list = Bolt(material2, a, val, 12, 1.3f, 0.22f, 0.3f, num2);
						Bolt(material, a, val, 12, 1.6f, 0.5f, 0.28f, num2);
						for (int k = 0; k < 2; k++)
						{
							Vector3 val2 = list[Random.Range(2, list.Count - 3)];
							Vector3 b = val2 + Flat(Random.onUnitSphere) * Random.Range(2.5f, 4.5f) + Vector3.down * Random.Range(1.5f, 3.5f);
							Bolt(material2, val2, b, 6, 0.7f, 0.1f, 0.25f, num2 + 0.02f);
							Bolt(material, val2, b, 6, 0.8f, 0.22f, 0.22f, num2 + 0.02f);
						}
					}
				}
				for (int l = 0; l < arcs; l++)
				{
					Vector3 val3 = Quaternion.Euler(0f, 360f / (float)arcs * (float)l + Random.Range(-15f, 15f), 0f) * Vector3.forward;
					Vector3 b2 = center + val3 * radius * Random.Range(0.7f, 1f) + Vector3.up * 0.15f;
					Bolt(material2, center + Vector3.up * 0.15f, b2, 8, 0.6f, 0.13f, 0.45f, 0.04f);
					Bolt(material, center + Vector3.up * 0.15f, b2, 8, 0.7f, 0.3f, 0.4f, 0.04f);
				}
				if (pillar)
				{
					Spawn((PrimitiveType)2, material, Kind.Pillar, center + Vector3.up * 6f, Vector3.zero, new Vector3(2.2f, 6f, 2.2f), 0.5f, 0f);
					Spawn((PrimitiveType)2, material2, Kind.Pillar, center + Vector3.up * 6f, Vector3.zero, new Vector3(0.9f, 6f, 0.9f), 0.4f, 0f);
				}
				for (int m = 0; m < 14; m++)
				{
					Vector3 val4 = Flat(Random.onUnitSphere);
					Vector3 vel = val4 * Random.Range(3f, 7f) + Vector3.up * Random.Range(6f, 12f);
					float num3 = Random.Range(0.18f, 0.45f);
					Spawn((PrimitiveType)3, (m % 3 == 0) ? material : material3, Kind.Debris, center + Vector3.up * 0.3f, vel, new Vector3(num3, num3, num3), Random.Range(1.1f, 1.6f), 0f).transform.rotation = Random.rotation;
				}
				Puffs(material, center, 16, 2.2f);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Lightning slam failed: " + ex.Message);
			}
		}

		public static void JumpFx(Vector3 feet, Transform beastRoot, float size)
		{
			//IL_0003: 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_0041: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Puffs(material, feet, Mathf.RoundToInt(8f * Mathf.Max(1f, size)), size);
				for (int i = 0; i < 3; i++)
				{
					Vector3 val = feet + Flat(Random.insideUnitSphere) * 0.8f * size;
					Vector3 b = val + Vector3.up * Random.Range(1.8f, 3f) * size + Flat(Random.insideUnitSphere) * 0.8f * size;
					float delay = (float)i * 0.04f;
					Bolt(material2, val, b, 6, 0.35f * size, 0.06f, 0.22f, delay);
					Bolt(material, val, b, 6, 0.4f * size, 0.14f, 0.2f, delay);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Jump effect failed: " + ex.Message);
			}
		}

		public static void LightningLaunch(Vector3 feet, Transform beastRoot)
		{
			//IL_0003: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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_0191: 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_01a0: 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_01c3: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: 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_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				for (int i = 0; i < 6; i++)
				{
					Vector3 a = feet + Flat(Random.insideUnitSphere) * 0.6f;
					Vector3 b = feet + Vector3.up * Random.Range(5f, 8f) + Flat(Random.insideUnitSphere) * Random.Range(1.5f, 3f);
					for (int j = 0; j < 2; j++)
					{
						float delay = (float)i * 0.02f + (float)j * 0.12f;
						Bolt(material2, a, b, 8, 0.7f, 0.12f, 0.3f, delay);
						Bolt(material, a, b, 8, 0.8f, 0.3f, 0.28f, delay);
					}
				}
				for (int k = 0; k < 8; k++)
				{
					Vector3 val = Quaternion.Euler(0f, 45f * (float)k + Random.Range(-15f, 15f), 0f) * Vector3.forward;
					Vector3 b2 = feet + val * Random.Range(2f, 3.5f) + Vector3.up * 0.15f;
					Bolt(material2, feet + Vector3.up * 0.15f, b2, 6, 0.4f, 0.09f, 0.35f, 0f);
					Bolt(material, feet + Vector3.up * 0.15f, b2, 6, 0.5f, 0.22f, 0.3f, 0f);
				}
				Ring(material2, feet, 3f, 0.35f, 0f);
				Ring(material, feet, 4.5f, 0.45f, 0.06f);
				Puffs(material, feet, 10, 1.2f);
				for (int l = 0; l < 6; l++)
				{
					Vector3 vel = Flat(Random.onUnitSphere) * Random.Range(2f, 4f) + Vector3.up * Random.Range(4f, 8f);
					float num = Random.Range(0.12f, 0.28f);
					Spawn((PrimitiveType)3, material, Kind.Debris, feet + Vector3.up * 0.3f, vel, new Vector3(num, num, num), Random.Range(0.9f, 1.3f), 0f).transform.rotation = Random.rotation;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Launch failed: " + ex.Message);
			}
		}

		public static void Trail(Vector3 pos, Transform beastRoot)
		{
			//IL_0003: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if (!((Object)(object)material == (Object)null))
				{
					Vector3 val = Random.insideUnitSphere * 0.6f;
					float num = Random.Range(0.08f, 0.18f);
					Spawn((PrimitiveType)0, material, Kind.Spark, pos + val, Random.insideUnitSphere * 1.5f, new Vector3(num, num, num), 0.35f, 0f);
					if (Random.value < 0.15f)
					{
						Vector3 a = pos + Random.onUnitSphere * 0.8f;
						Vector3 b = pos + Random.onUnitSphere * 0.8f;
						Bolt(material2, a, b, 4, 0.3f, 0.05f, 0.1f, 0f);
						Bolt(material, a, b, 4, 0.35f, 0.12f, 0.08f, 0f);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		private static Vector3 Spread(Vector3 dir, float maxAngle)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(0f - maxAngle, maxAngle);
			float num2 = Random.Range((0f - maxAngle) * 0.35f, maxAngle * 0.35f);
			Vector3 val = Vector3.Cross(Vector3.up, dir);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = Quaternion.AngleAxis(num, Vector3.up) * Quaternion.AngleAxis(num2, normalized) * dir;
			return ((Vector3)(ref val)).normalized;
		}

		private static GameObject SpawnBeam(Material m, Vector3 origin, Vector3 dir, float length, float width, float life, float delay)
		{
			//IL_0004: 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)
			//IL_0015: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Spawn((PrimitiveType)2, m, Kind.Beam, origin, Vector3.zero, new Vector3(width, length * 0.5f, width), life, delay);
			val.transform.rotation = Quaternion.FromToRotation(Vector3.up, dir);
			Piece piece = pieces[pieces.Count - 1];
			piece.origin = origin;
			piece.dir = dir;
			return val;
		}

		private static void ShockRing(Material m, Vector3 origin, Vector3 dir, float startRadius, float endRadius, float travel, float thickness, float life, float delay, int segments = 22)
		{
			//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_001c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < segments; i++)
			{
				GameObject val = Spawn((PrimitiveType)3, m, Kind.Shock, origin, Vector3.zero, new Vector3(thickness, thickness, 0.1f), life, delay);
				Piece piece = pieces[pieces.Count - 1];
				piece.origin = origin;
				piece.dir = dir;
				piece.angle = (float)Math.PI * 2f / (float)segments * (float)i;
				piece.r0 = startRadius;
				piece.r1 = endRadius;
				piece.speed = travel / life;
				piece.segments = segments;
			}
		}

		private static void SpeedLines(Material m, Vector3 origin, Vector3 dir, int count, float spreadRadius)
		{
			//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_000c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_001f: 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_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_006b: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0117: 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)
			Vector3 val = Vector3.Cross(dir, Vector3.up);
			if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
			{
				val = Vector3.Cross(dir, Vector3.right);
			}
			val = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(val, dir);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			for (int i = 0; i < count; i++)
			{
				float num = Random.Range(0f, (float)Math.PI * 2f);
				float num2 = Random.Range(0.4f, spreadRadius);
				Vector3 pos = origin + (val * Mathf.Cos(num) + normalized * Mathf.Sin(num)) * num2 + dir * Random.Range(0f, 1.5f);
				float num3 = Random.Range(1.2f, 2.6f);
				Spawn((PrimitiveType)3, m, Kind.Spark, pos, dir * Random.Range(18f, 28f), new Vector3(0.04f, 0.04f, num3), Random.Range(0.25f, 0.4f), Random.Range(0f, 0.08f)).transform.rotation = Quaternion.LookRotation(dir);
			}
		}

		public static void RoarBurst(Vector3 origin, Vector3 dir, Transform beastRoot, float range)
		{
			//IL_0003: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_0171: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarCore, 0.9f);
				Material material2 = GetMaterial(beastRoot, RoarGlow, 0.7f);
				Material material3 = GetMaterial(beastRoot, RoarDark, 0.4f);
				if ((Object)(object)material == (Object)null)
				{
					MelonLogger.Warning("[FX] Couldn't borrow a shader, skipping effect");
					return;
				}
				Spawn((PrimitiveType)0, material2, Kind.Glow, origin, Vector3.zero, new Vector3(0.5f, 0.5f, 0.5f), 1.3f, 0f);
				Spawn((PrimitiveType)0, material, Kind.Glow, origin, Vector3.zero, new Vector3(0.25f, 0.25f, 0.25f), 1.3f, 0f);
				for (int i = 0; i < 4; i++)
				{
					float num = (float)i * 0.08f;
					float num2 = 2.6f + (float)i * 0.7f;
					float num3 = range * (0.75f + (float)i * 0.08f);
					float life = 0.5f + (float)i * 0.05f;
					float num4 = 0.2f - (float)i * 0.03f;
					ShockRing((i == 0) ? material : material2, origin, dir, 0.35f, num2, num3, num4, life, num, 28);
					ShockRing(material3, origin, dir, 0.45f, num2 * 1.12f, num3 * 0.95f, num4 * 0.7f, life, num + 0.03f, 24);
				}
				SpeedLines(material2, origin, dir, 16, 2.2f);
				SpeedLines(material, origin, dir, 6, 1.4f);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Roar burst failed: " + ex.Message);
			}
		}

		public static void RoarStream(Vector3 origin, Vector3 dir, Transform beastRoot, float range)
		{
			//IL_0003: 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_0032: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarGlow, 0.7f);
				Material material2 = GetMaterial(beastRoot, RoarDark, 0.4f);
				if (!((Object)(object)material == (Object)null))
				{
					ShockRing(material, origin, dir, 0.3f, 2.2f, range * 0.7f, 0.12f, 0.42f, 0f);
					ShockRing(material2, origin, dir, 0.4f, 2.45f, range * 0.66f, 0.08f, 0.42f, 0.03f, 18);
					SpeedLines(material, origin, dir, 5, 1.8f);
				}
			}
			catch (Exception)
			{
			}
		}

		public static void RoarChain(Vector3 from, Vector3 to, Transform beastRoot)
		{
			//IL_0003: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			try
			{
				Material material = GetMaterial(beastRoot, RoarCore, 0.9f);
				Material material2 = GetMaterial(beastRoot, RoarGlow, 0.7f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 2; i++)
					{
						float delay = (float)i * 0.12f;
						Bolt(material, from, to, 8, 0.6f, 0.05f, 0.25f, delay);
						Bolt(material2, from, to, 8, 0.7f, 0.12f, 0.22f, delay);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static Material AimMaterial(Transform beastRoot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return GetMaterial(beastRoot, RoarCore, 0.9f);
		}

		public static void Fizzle(Vector3 origin, Transform beastRoot)
		{
			//IL_0003: 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_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, RoarGlow, 1.6f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 5; i++)
					{
						float num = Random.Range(0.1f, 0.2f);
						Spawn((PrimitiveType)0, material, Kind.Spark, origin, Random.insideUnitSphere * 2f, new Vector3(num, num, num), 0.3f, 0f);
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static void ChainLightning(Vector3 from, Vector3 to, Transform beastRoot)
		{
			//IL_0003: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0083: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Material material = GetMaterial(beastRoot, Neon, 3f);
				Material material2 = GetMaterial(beastRoot, Core, 5f);
				if (!((Object)(object)material == (Object)null))
				{
					for (int i = 0; i < 2; i++)
					{
						float delay = (float)i * 0.12f;
						Bolt(material2, from + Vector3.up * 0.5f, to, 8, 0.8f, 0.12f, 0.3f, delay);
						Bolt(material, from + Vector3.up * 0.5f, to, 8, 0.9f, 0.28f, 0.28f, delay);
					}
					Puffs(material, to, 6, 0.8f);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[FX] Chain lightning failed: " + ex.Message);
			}
		}

		private static Vector3 Flat(Vector3 v)
		{
			//IL_0024: 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_0029: 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)
			v.y = 0f;
			return (((Vector3)(ref v)).sqrMagnitude < 0.0001f) ? Vector3.forward : ((Vector3)(ref v)).normalized;
		}

		private static void Ring(Material m, Vector3 pos, float diameter, float life, float delay)
		{
			//IL_0004: 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)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			Spawn((PrimitiveType)2, m, Kind.Ring, pos + Vector3.up * 0.05f, Vector3.zero, new Vector3(diameter, 0.04f, diameter), life, delay);
		}

		private static void Puffs(Material m, Vector3 pos, int count, float size)
		{
			//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_003f: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < count; i++)
			{
				float num = 360f / (float)count * (float)i + Random.Range(-10f, 10f);
				Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward;
				Vector3 vel = val * Random.Range(3f, 5f) * size + Vector3.up * Random.Range(1f, 3f);
				float num2 = Random.Range(0.35f, 0.6f) * size;
				Spawn((PrimitiveType)0, m, Kind.Puff, pos + Vector3.up * 0.2f, vel, new Vector3(num2, num2, num2), Random.Range(0.4f, 0.6f), 0f);
			}
		}

		private static List<Vector3> Bolt(Material m, Vector3 a, Vector3 b, int segments, float jag, float thickness, float life, float delay)
		{
			//IL_0007: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3> { a };
			for (int i = 1; i < segments; i++)
			{
				float num = (float)i / (float)segments;
				float num2 = Mathf.Sin(num * (float)Math.PI);
				list.Add(Vector3.Lerp(a, b, num) + Random.insideUnitSphere * jag * num2);
			}
			list.Add(b);
			for (int j = 0; j < list.Count - 1; j++)
			{
				Vector3 val = list[j];
				Vector3 val2 = list[j + 1];
				Vector3 val3 = val2 - val;
				float magnitude = ((Vector3)(ref val3)).magnitude;
				if (!(magnitude < 0.01f))
				{
					GameObject val4 = Spawn((PrimitiveType)3, m, Kind.Bolt, (val + val2) * 0.5f, Vector3.zero, new Vector3(thickness, thickness, magnitude * 1.05f), life, delay);
					val4.transform.rotation = Quaternion.LookRotation(val3);
				}
			}
			return list;
		}

		private static GameObject Spawn(PrimitiveType type, Material m, Kind kind, Vector3 pos, Vector3 vel, Vector3 maxScale, float life, float delay)
		{
			//IL_0001: 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_005f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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)
			GameObject val = GameObject.CreatePrimitive(type);
			((Object)val).name = "AndresFx";
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = val.GetComponent<Renderer>();
			component2.sharedMaterial = m;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			val.transform.position = pos;
			val.transform.localScale = Vector3.zero;
			pieces.Add(new Piece
			{
				go = val,
				rend = component2,
				kind = kind,
				velocity = vel,
				maxScale = maxScale,
				born = Time.time + delay,
				life = life,
				spin = ((kind == Kind.Debris) ? (Random.insideUnitSphere * 720f) : Vector3.zero)
			});
			return val;
		}

		private static void AddFlash(Vector3 pos, Color color, float intensity, float range, float life)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: 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)
			GameObject val = new GameObject("AndresFlash");
			val.transform.position = pos;
			Light val2 = val.AddComponent<Light>();
			val2.type = (LightType)2;
			val2.color = color;
			val2.range = range;
			val2.intensity = intensity;
			flashes.Add(new Flash
			{
				light = val2,
				born = Time.time,
				life = life,
				peak = intensity
			});
		}

		public static void Update()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: 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_03b6: 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_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: 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_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: 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_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			float deltaTime = Time.deltaTime;
			for (int num = pieces.Count - 1; num >= 0; num--)
			{
				Piece piece = pieces[num];
				if ((Object)(object)piece.go == (Object)null)
				{
					pieces.RemoveAt(num);
				}
				else
				{
					float num2 = Time.time - piece.born;
					if (num2 < 0f)
					{
						piece.go.transform.localScale = Vector3.zero;
					}
					else
					{
						float num3 = num2 / piece.life;
						if (num3 >= 1f)
						{
							Object.Destroy((Object)(object)piece.go);
							pieces.RemoveAt(num);
						}
						else
						{
							Transform transform = piece.go.transform;
							Vector3 maxScale = piece.maxScale;
							switch (piece.kind)
							{
							case Kind.Ring:
							{
								float num6 = EaseOut(num3);
								transform.localScale = new Vector3(maxScale.x * num6, maxScale.y * (1f - num3), maxScale.z * num6);
								break;
							}
							case Kind.Puff:
							{
								float num15 = EaseOut(Mathf.Min(1f, num3 * 2.5f));
								float num16 = ((num3 > 0.6f) ? (1f - (num3 - 0.6f) / 0.4f) : 1f);
								transform.localScale = maxScale * num15 * num16;
								transform.position += piece.velocity * deltaTime;
								piece.velocity *= 1f - 4f * deltaTime;
								break;
							}
							case Kind.Debris:
							{
								piece.velocity += Physics.gravity * deltaTime;
								transform.position += piece.velocity * deltaTime;
								transform.Rotate(piece.spin * deltaTime);
								float num21 = ((num3 > 0.75f) ? (1f - (num3 - 0.75f) / 0.25f) : 1f);
								transform.localScale = maxScale * num21;
								break;
							}
							case Kind.Pillar:
							{
								float num18 = ((num3 < 0.15f) ? EaseOut(num3 / 0.15f) : (1f - (num3 - 0.15f) / 0.85f));
								transform.localScale = new Vector3(maxScale.x * num18, maxScale.y, maxScale.z * num18);
								break;
							}
							case Kind.Bolt:
							{
								piece.rend.enabled = Random.value > 0.25f;
								float num17 = ((num3 > 0.6f) ? (1f - (num3 - 0.6f) / 0.4f) : 1f);
								transform.localScale = new Vector3(maxScale.x * num17, maxScale.y * num17, maxScale.z);
								break;
							}
							case Kind.Crack:
							{
								float num11 = EaseOut(Mathf.Min(1f, num3 / 0.12f));
								float num12 = ((num3 > 0.7f) ? (1f - (num3 - 0.7f) / 0.3f) : 1f);
								transform.localScale = new Vector3(maxScale.x * num12, maxScale.y, maxScale.z * num11);
								break;
							}
							case Kind.Shock:
							{
								Vector3 dir = piece.dir;
								Vector3 val = Vector3.Cross(dir, Vector3.up);
								if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
								{
									val = Vector3.Cross(dir, Vector3.right);
								}
								val = ((Vector3)(ref val)).normalized;
								Vector3 val2 = Vector3.Cross(val, dir);
								Vector3 normalized = ((Vector3)(ref val2)).normalized;
								float num7 = EaseOut(num3);
								float num8 = Mathf.Lerp(piece.r0, piece.r1, num7);
								Vector3 val3 = piece.origin + dir * (piece.speed * piece.life * num7);
								Vector3 val4 = val * Mathf.Cos(piece.angle) + normalized * Mathf.Sin(piece.angle);
								Vector3 val5 = -val * Mathf.Sin(piece.angle) + normalized * Mathf.Cos(piece.angle);
								transform.position = val3 + val4 * num8;
								transform.rotation = Quaternion.LookRotation(val5, dir);
								float num9 = (float)Math.PI * 2f * num8 / (float)piece.segments * 1.15f;
								float num10 = maxScale.x * ((num3 < 0.7f) ? 1f : (1f - (num3 - 0.7f) / 0.3f));
								transform.localScale = new Vector3(num10, num10, num9);
								break;
							}
							case Kind.Beam:
							{
								float num19 = maxScale.y * EaseOut(Mathf.Min(1f, num3 / 0.12f));
								float num20 = ((num3 < 0.12f) ? 1f : (1f - EaseOut((num3 - 0.12f) / 0.88f)));
								transform.localScale = new Vector3(maxScale.x * num20, num19, maxScale.z * num20);
								transform.position = piece.origin + piece.dir * num19;
								break;
							}
							case Kind.Glow:
							{
								float num13 = 0.85f + 0.15f * Mathf.Sin(num2 * 40f);
								float num14 = ((num3 < 0.1f) ? (num3 / 0.1f) : (1f - (num3 - 0.1f) / 0.9f));
								transform.localScale = maxScale * num13 * num14;
								break;
							}
							case Kind.Blast:
							{
								float num4 = 0.35f + 0.65f * EaseOut(Mathf.Min(1f, num3 * 1.6f));
								float num5 = ((num3 > 0.65f) ? (1f - (num3 - 0.65f) / 0.35f) : 1f);
								transform.localScale = maxScale * num4 * num5;
								transform.position += piece.velocity * deltaTime;
								piece.velocity *= 1f - 1.2f * deltaTime;
								break;
							}
							case Kind.Spark:
								transform.position += piece.velocity * deltaTime;
								transform.localScale = maxScale * (1f - num3);
								break;
							}
						}
					}
				}
			}
			for (int num22 = flashes.Count - 1; num22 >= 0; num22--)
			{
				Flash flash = flashes[num22];
				if ((Object)(object)flash.light == (Object)null)
				{
					flashes.RemoveAt(num22);
				}
				else
				{
					float num23 = (Time.time - flash.born) / flash.life;
					if (num23 >= 1f)
					{
						Object.Destroy((Object)(object)((Component)flash.light).gameObject);
						flashes.RemoveAt(num22);
					}
					else
					{
						flash.light.intensity = flash.peak * (1f - num23) * ((Random.value > 0.3f) ? 1f : 0.35f);
					}
				}
			}
		}

		private static float EaseOut(float t)
		{
			return 1f - (1f - t) * (1f - t);
		}
	}
	internal static class Sfx
	{
		private static readonly Dictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>();

		private static AudioSource source;

		public static void Play(string name, float volume = 1f)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			try
			{
				AudioClip clip = GetClip(name);
				if (!((Object)(object)clip == (Object)null))
				{
					if ((Object)(object)source == (Object)null)
					{
						GameObject val = new GameObject("AndresSfx");
						Object.DontDestroyOnLoad((Object)(object)val);
						source = val.AddComponent<AudioSource>();
						source.spatialBlend = 0f;
						source.playOnAwake = false;
						source.volume = 1f;
					}
					source.PlayOneShot(clip, volume);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Couldn't play '" + name + "': " + ex.Message);
			}
		}

		private static AudioClip GetClip(string name)
		{
			if (clips.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			AudioClip val = null;
			string text = Path.Combine(Path.GetDirectoryName(Application.dataPath), "UserData", "AndresSounds", name + ".wav");
			if (File.Exists(text))
			{
				val = LoadWav(text, name);
				if ((Object)(object)val != (Object)null)
				{
					MelonLogger.Msg("[Sfx] Using custom sound " + text);
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				val = LoadEmbedded(name);
			}
			if ((Object)(object)val == (Object)null)
			{
				val = (AudioClip)(name switch
				{
					"slam" => MakeThunder(name), 
					"charge" => MakeCharge(name), 
					"zap" => MakeZap(name), 
					_ => MakeBoom(name), 
				});
			}
			((Object)val).hideFlags = (HideFlags)32;
			clips[name] = val;
			return val;
		}

		private static AudioClip MakeBoom(string name)
		{
			int num = 30870;
			float[] array = new float[num];
			Random random = new Random(1234);
			double num2 = 0.0;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Lerp(140f, 35f, Mathf.Min(1f, num3 / 0.35f));
				num2 += Math.PI * 2.0 * (double)num4 / 44100.0;
				float num5 = (float)Math.Sin(num2) * Mathf.Exp((0f - num3) * 6f);
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0) * Mathf.Exp((0f - num3) * 35f) * 0.8f;
				float num7 = (num5 + num6) * 2.2f;
				array[i] = (float)Math.Tanh(num7);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeCharge(string name)
		{
			int num = 24255;
			float[] array = new float[num];
			Random random = new Random(777);
			double num2 = 0.0;
			double num3 = 0.0;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = num5 / 0.55f;
				float num7 = Mathf.Lerp(70f, 260f, num6 * num6);
				num2 += (double)(num7 / 44100f);
				num2 -= Math.Floor(num2);
				num3 += (double)(num7 * 1.01f / 44100f);
				num3 -= Math.Floor(num3);
				float num8 = (float)(num2 * 2.0 - 1.0 + (num3 * 2.0 - 1.0)) * 0.35f;
				num8 *= Mathf.Lerp(0.3f, 1f, num6);
				if (random.NextDouble() < 0.0006 + (double)num6 * 0.002)
				{
					num4 = 1f;
				}
				num4 *= 0.997f;
				float num9 = (float)(random.NextDouble() * 2.0 - 1.0) * num4 * 0.9f;
				array[i] = (float)Math.Tanh((num8 + num9) * 1.8f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeZap(string name)
		{
			int num = 19845;
			float[] array = new float[num];
			Random random = new Random(999);
			double num2 = 0.0;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = Mathf.Exp((0f - num3) * 7f);
				bool flag = (int)(num3 * 60f) % 3 != 2;
				float num5 = (float)(random.NextDouble() * 2.0 - 1.0);
				num2 += Math.PI * 2.0 * (double)Mathf.Lerp(1800f, 600f, num3 / 0.45f) / 44100.0;
				float num6 = (float)Math.Sin(num2) * 0.4f;
				array[i] = (float)Math.Tanh((num5 * 0.9f + num6) * num4 * (flag ? 1f : 0.2f) * 2.2f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip MakeThunder(string name)
		{
			int num = 79380;
			float[] array = new float[num];
			Random random = new Random(4321);
			double num2 = 0.0;
			float num3 = 0f;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0);
				float num7 = num6 * Mathf.Exp((0f - num5) * 28f) * 1.2f;
				float num8 = Mathf.Lerp(110f, 30f, Mathf.Min(1f, num5 / 0.5f));
				num2 += Math.PI * 2.0 * (double)num8 / 44100.0;
				float num9 = (float)Math.Sin(num2) * Mathf.Exp((0f - num5) * 3.5f) * 1.3f;
				num3 += (num6 - num3) * 0.02f;
				num4 += (num3 - num4) * 0.05f;
				float num10 = num4 * 9f * Mathf.Exp((0f - num5) * 1.6f) * (0.7f + 0.3f * Mathf.Sin(num5 * 9f));
				array[i] = (float)Math.Tanh((num7 + num9 + num10) * 2f);
			}
			AudioClip val = AudioClip.Create("Andres_" + name, num, 1, 44100, false);
			val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			return val;
		}

		private static AudioClip LoadEmbedded(string name)
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				using Stream stream = executingAssembly.GetManifestResourceStream("Sounds." + name + ".wav");
				if (stream == null)
				{
					return null;
				}
				MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				return ParseWav(memoryStream.ToArray(), name, "built-in " + name + ".wav");
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Built-in sound '" + name + "' failed: " + ex.Message);
				return null;
			}
		}

		private static AudioClip LoadWav(string path, string name)
		{
			try
			{
				return ParseWav(File.ReadAllBytes(path), name, path);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Sfx] Failed to load " + path + ": " + ex.Message);
				return null;
			}
		}

		private static AudioClip ParseWav(byte[] b, string name, string path)
		{
			try
			{
				int num = 0;
				int num2 = 0;
				int num3 = 0;
				int num4 = -1;
				int num5 = 0;
				int num6;
				for (int i = 12; i + 8 <= b.Length; i += 8 + num6 + (num6 & 1))
				{
					string text = Encoding.ASCII.GetString(b, i, 4);
					num6 = BitConverter.ToInt32(b, i + 4);
					if (text == "fmt ")
					{
						num = BitConverter.ToInt16(b, i + 10);
						num2 = BitConverter.ToInt32(b, i + 12);
						num3 = BitConverter.ToInt16(b, i + 22);
					}
					else if (text == "data")
					{
						num4 = i + 8;
						num5 = Math.Min(num6, b.Length - num4);
						break;
					}
				}
				if (num3 != 16 || num4 < 0 || num < 1)
				{
					MelonLogger.Warning("[Sfx] " + path + " must be a 16-bit PCM WAV. Using built-in sound.");
					return null;
				}
				int num7 = num5 / 2;
				float[] array = new float[num7]