Decompiled source of HollowPurple v1.8.0

BepInEx/plugins/HollowPurple/HollowPurple.dll

Decompiled 2 days ago
using System;
using System.Collections;
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 BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using HollowPurple.Abilities;
using HollowPurple.Audio;
using HollowPurple.Camera;
using HollowPurple.Cards;
using HollowPurple.Classes;
using HollowPurple.Combat;
using HollowPurple.Config;
using HollowPurple.Diagnostics;
using HollowPurple.Networking;
using HollowPurple.Projectiles;
using HollowPurple.Upgrades;
using HollowPurple.VFX;
using InControl;
using Photon.Pun;
using Photon.Realtime;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Hollow Purple for ROUNDS")]
[assembly: AssemblyDescription("Original procedural ultimate ability for the old-rounds-for-mods branch")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("1.5.0.0")]
namespace HollowPurple
{
	[BepInPlugin("fr.flofl.rounds.hollowpurple", "Hollow Purple", "1.8.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Rounds.exe")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Id = "fr.flofl.rounds.hollowpurple";

		public const string Version = "1.8.0";

		private Harmony harmony;

		public static Plugin Instance { get; private set; }

		public HollowPurpleConfig Settings { get; private set; }

		public HollowPurpleNetwork Network { get; private set; }

		public EffectPool Effects { get; private set; }

		public HollowPurpleAudioController Audio { get; private set; }

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Instance = this;
			Settings = new HollowPurpleConfig(((BaseUnityPlugin)this).Config);
			harmony = new Harmony("fr.flofl.rounds.hollowpurple");
			harmony.PatchAll(typeof(Plugin).Assembly);
		}

		private void Start()
		{
			Audio = ((Component)this).gameObject.AddComponent<HollowPurpleAudioController>();
			Audio.Initialize();
			Effects = ((Component)this).gameObject.AddComponent<EffectPool>();
			Effects.Initialize();
			Network = ((Component)this).gameObject.AddComponent<HollowPurpleNetwork>();
			GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)BattleStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)End);
			GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)End);
			GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)End);
			CustomCard.BuildCard<GojoClassCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SorcererClasses.GojoClassCard = card;
			});
			CustomCard.BuildCard<SukunaClassCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SorcererClasses.SukunaClassCard = card;
			});
			CustomCard.BuildCard<YhwachClassCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SorcererClasses.YhwachClassCard = card;
			});
			CustomCard.BuildCard<GokuClassCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SorcererClasses.GokuClassCard = card;
			});
			CustomCard.BuildCard<HollowPurpleCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				HollowPurpleCard.Registered = card;
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Carte enregistree : " + card.cardName));
			});
			CustomCard.BuildCard<HollowPurpleAmplification1>((Action<CardInfo>)delegate(CardInfo card)
			{
				HollowPurpleUpgradeCard.Register(1, card);
			});
			CustomCard.BuildCard<HollowPurpleAmplification2>((Action<CardInfo>)delegate(CardInfo card)
			{
				HollowPurpleUpgradeCard.Register(2, card);
			});
			CustomCard.BuildCard<HollowPurpleAmplification3>((Action<CardInfo>)delegate(CardInfo card)
			{
				HollowPurpleUpgradeCard.Register(3, card);
			});
			CustomCard.BuildCard<HollowPurpleAmplification4>((Action<CardInfo>)delegate(CardInfo card)
			{
				HollowPurpleUpgradeCard.Register(4, card);
			});
			CustomCard.BuildCard<HollowPurpleAmplification5>((Action<CardInfo>)delegate(CardInfo card)
			{
				HollowPurpleUpgradeCard.Register(5, card);
			});
			CustomCard.BuildCard<BlueCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GojoCard.Registered[0] = card;
			});
			CustomCard.BuildCard<RedCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GojoCard.Registered[1] = card;
			});
			CustomCard.BuildCard<InfinityCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GojoCard.Registered[2] = card;
			});
			CustomCard.BuildCard<SixEyesCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GojoCard.Registered[3] = card;
			});
			CustomCard.BuildCard<DismantleCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SukunaCard.Registered[0] = card;
			});
			CustomCard.BuildCard<CleaveCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SukunaCard.Registered[1] = card;
			});
			CustomCard.BuildCard<FireArrowCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SukunaCard.Registered[2] = card;
			});
			CustomCard.BuildCard<ShrineCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				SukunaCard.Registered[3] = card;
			});
			CustomCard.BuildCard<AlmightyCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				YhwachCard.Registered[0] = card;
			});
			CustomCard.BuildCard<AuswahlenCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				YhwachCard.Registered[1] = card;
			});
			CustomCard.BuildCard<SanktAltarCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				YhwachCard.Registered[2] = card;
			});
			CustomCard.BuildCard<HeiligPfeilCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				YhwachCard.Registered[3] = card;
			});
			CustomCard.BuildCard<SuperSaiyanCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GokuCard.Registered[0] = card;
			});
			CustomCard.BuildCard<KamehamehaCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GokuCard.Registered[1] = card;
			});
			CustomCard.BuildCard<SpiritBombCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GokuCard.Registered[2] = card;
			});
			CustomCard.BuildCard<DragonFistCard>((Action<CardInfo>)delegate(CardInfo card)
			{
				GokuCard.Registered[3] = card;
			});
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Hollow Purple 1.8.0 / Unity " + Application.unityVersion));
			SmokeTestRunner.TryStart(((Component)this).gameObject);
		}

		private IEnumerator BattleStart(IGameModeHandler handler)
		{
			Effects.Prewarm((Object.op_Implicit((Object)(object)PlayerManager.instance) ? PlayerManager.instance.players.Count : 2) + 4);
			Network.OpenBattle();
			yield break;
		}

		private IEnumerator End(IGameModeHandler handler)
		{
			Network.CloseBattle();
			Audio.StopAll();
			yield break;
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)Network) && !(GameModeManager.CurrentHandlerID != "Sandbox"))
			{
				bool flag = Object.op_Implicit((Object)(object)GameManager.instance) && GameManager.instance.isPlaying && GameManager.instance.battleOngoing && Object.op_Implicit((Object)(object)GM_Test.instance) && ((Component)GM_Test.instance).gameObject.activeInHierarchy;
				if (flag && !Network.BattleOpen)
				{
					Network.OpenBattle();
				}
				else if (!flag && Network.BattleOpen)
				{
					Network.CloseBattle();
				}
			}
		}

		public void Log(string message)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)message);
		}

		public void Warn(string message)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)message);
		}

		private void OnDestroy()
		{
			GameModeManager.RemoveHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)BattleStart);
			GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)End);
			GameModeManager.RemoveHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)End);
			GameModeManager.RemoveHook("PickStart", (Func<IGameModeHandler, IEnumerator>)End);
			if (Object.op_Implicit((Object)(object)Network))
			{
				Network.CloseBattle();
			}
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace HollowPurple.VFX
{
	public sealed class ChargeVfx
	{
		private readonly Orb blue;

		private readonly Orb red;

		private readonly Orb purple;

		private readonly SpriteRenderer ring;

		private readonly SpriteRenderer lens;

		private readonly ProceduralLightning lightning;

		public Vector3 BluePosition { get; private set; }

		public Vector3 RedPosition { get; private set; }

		public ChargeVfx(Transform root)
		{
			blue = new Orb(root, "Blue");
			red = new Orb(root, "Red");
			purple = new Orb(root, "Fusion");
			ring = VisualAssets.Sprite(root, "FusionOrbit", VisualAssets.Ring, 215);
			lens = VisualAssets.Sprite(root, "OpticalConcentration", VisualAssets.Noise, 209);
			lightning = new ProceduralLightning(root, 12);
		}

		public void Draw(float progress, float time, int seed, int arcs, float scale = 1f)
		{
			//IL_0061: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			float num = progress * 1.5f;
			float num2 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.7f, 1.19f, num));
			float num3 = Mathf.Lerp(1.35f, 0f, num2) * scale;
			float num4 = Mathf.Sin(num * 6f) * 0.3f * scale;
			BluePosition = new Vector3(0f - num3, 0.6f + num4, 0f);
			RedPosition = new Vector3(num3, 0.6f - num4, 0f);
			float num5 = Mathf.SmoothStep(0f, 1f, num / 0.3f) * (0.65f + 0.05f * Mathf.Sin(time * 34f));
			float num6 = Mathf.SmoothStep(0f, 1f, (num - 0.35f) / 0.3f) * (0.72f + 0.1f * Mathf.Pow(Mathf.Max(0f, Mathf.Sin(time * 22f)), 4f));
			float opacity = 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(1.06f, 1.25f, num));
			blue.Draw(BluePosition, num5 * (1f - num2 * 0.65f) * scale, VisualAssets.Blue, opacity, time, hot: false);
			red.Draw(RedPosition, num6 * (1f - num2 * 0.65f) * scale, VisualAssets.Red, opacity, 0f - time, hot: false);
			float num7 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(1.05f, 1.35f, num));
			float num8 = 1f + 0.3f * Mathf.Sin(Mathf.Clamp01((num - 1.13f) / 0.22f) * (float)Math.PI);
			purple.Draw(new Vector3(0f, 0.6f, 0f), (0.4f + num7 * 1.1f) * num8 * scale, VisualAssets.Purple, num7, time);
			VisualAssets.Draw(ring, new Vector3(0f, 0.6f, 0f), (1.7f + num7 * 2.5f) * scale, VisualAssets.Magenta, num7 * 0.65f, time * 120f);
			((Component)ring).transform.localScale = new Vector3(((Component)ring).transform.localScale.x, ((Component)ring).transform.localScale.y * 0.38f, 1f);
			VisualAssets.Draw(lens, new Vector3(0f, 0.6f, 0f), (4f + Mathf.Sin(time * 18f) * 0.3f) * scale, VisualAssets.Purple, num7 * 0.18f, (0f - time) * 55f);
			lightning.Draw((Vector3)((num7 > 0.5f) ? new Vector3(0f, 0.6f, 0f) : BluePosition), (0.8f + num7) * scale, (num7 > 0.5f) ? VisualAssets.Magenta : VisualAssets.Blue, 0.7f, time, seed, arcs);
		}

		public void Hide()
		{
			blue.Hide();
			red.Hide();
			purple.Hide();
			SpriteRenderer obj = ring;
			bool enabled = (((Renderer)lens).enabled = false);
			((Renderer)obj).enabled = enabled;
			lightning.Hide();
		}
	}
	public sealed class GojoVfx : MonoBehaviour
	{
		private Orb orb;

		private SpriteRenderer ring;

		private SpriteRenderer inner;

		private GojoSpell spell;

		private float burstAt = -1f;

		private bool isInfinity;

		private SpriteRenderer barrier;

		private SpriteRenderer fill;

		private static Sprite hexRingSprite;

		private static Sprite hexFillSprite;

		public void Burst(Vector2 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			burstAt = Time.realtimeSinceStartup;
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
			if (orb != null)
			{
				orb.Hide();
			}
		}

		private void Update()
		{
			//IL_0055: 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_0086: 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)
			if (!isInfinity && !(burstAt < 0f))
			{
				float num = (Time.realtimeSinceStartup - burstAt) / 0.4f;
				if (num >= 1f || !Plugin.Instance.Network.BattleOpen)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				VisualAssets.Draw(ring, Vector3.zero, Mathf.Lerp(1f, 10f, num), VisualAssets.Red, 1f - num);
				VisualAssets.Draw(inner, Vector3.zero, Mathf.Lerp(1f, 7f, num), VisualAssets.Red, (1f - num) * 0.65f);
			}
		}

		public static GojoVfx Create(Player owner, GojoSpell spell, Vector2 position)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			VisualAssets.Initialize();
			GameObject val = new GameObject("Gojo_" + spell);
			GojoVfx gojoVfx = val.AddComponent<GojoVfx>();
			gojoVfx.spell = spell;
			gojoVfx.isInfinity = spell == GojoSpell.Infinity;
			if (gojoVfx.isInfinity)
			{
				gojoVfx.CreateInfinityAura();
			}
			else
			{
				gojoVfx.orb = new Orb(val.transform, spell.ToString());
				gojoVfx.ring = VisualAssets.Sprite(val.transform, "Field", VisualAssets.Ring, 211);
				gojoVfx.inner = VisualAssets.Sprite(val.transform, "Flow", VisualAssets.Noise, 212);
			}
			int layer = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).gameObject.layer : 0);
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.layer = layer;
			}
			if (!gojoVfx.isInfinity)
			{
				gojoVfx.Draw(position, 0f, (spell == GojoSpell.Blue) ? 5f : 1f);
			}
			return gojoVfx;
		}

		private void CreateInfinityAura()
		{
			if ((Object)(object)hexRingSprite == (Object)null)
			{
				hexRingSprite = CreateHexRingTexture(128);
			}
			if ((Object)(object)hexFillSprite == (Object)null)
			{
				hexFillSprite = CreateHexFillTexture(128);
			}
			Transform transform = ((Component)this).transform;
			barrier = CreateSprite(transform, "Barrier", hexRingSprite, -10);
			fill = CreateSprite(transform, "Fill", hexFillSprite, -11);
		}

		private static SpriteRenderer CreateSprite(Transform parent, string name, Sprite sprite, int order)
		{
			//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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			((Renderer)obj).sharedMaterial = VisualAssets.AlphaMaterial;
			((Renderer)obj).sortingOrder = order;
			return obj;
		}

		public void Draw(Vector2 position, float age, float radius)
		{
			//IL_0006: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0054: 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_009e: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			Color blue = VisualAssets.Blue;
			if (!isInfinity)
			{
				if (spell == GojoSpell.Infinity)
				{
					orb.Hide();
				}
				else
				{
					orb.Draw(Vector3.zero, (spell == GojoSpell.Blue) ? 1.1f : 0.8f, blue, 1f, realtimeSinceStartup, spell == GojoSpell.Red);
				}
				float num = radius * 2f / 0.77f;
				VisualAssets.Draw(ring, Vector3.zero, num, blue, (spell == GojoSpell.Blue) ? 0.25f : 0.65f, realtimeSinceStartup * 35f);
				float num2 = ((spell == GojoSpell.Blue) ? (1f - Mathf.Repeat(age * 1.6f, 1f)) : (0.8f + 0.1f * Mathf.Sin(realtimeSinceStartup * 4f)));
				VisualAssets.Draw(inner, Vector3.zero, num * num2, blue, 0.3f, (0f - realtimeSinceStartup) * 70f);
			}
			else
			{
				float num3 = radius * 2f / 0.77f;
				float num4 = 1f + 0.04f * Mathf.Sin(realtimeSinceStartup * 3f);
				VisualAssets.Draw(fill, Vector3.zero, num3 * 1.05f * num4, blue, 0.12f);
				VisualAssets.Draw(barrier, Vector3.zero, num3 * num4, blue, 0.5f + 0.1f * Mathf.Sin(realtimeSinceStartup * 2f), realtimeSinceStartup * 12f);
			}
		}

		private static Sprite CreateHexRingTexture(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_01b4: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
			{
				name = "Gojo_HexRing",
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			Color[] array = (Color[])(object)new Color[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num = ((float)j + 0.5f) / (float)size * 2f - 1f;
					float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = Mathf.Abs(Mathf.Sin(num * 14f));
					float num5 = Mathf.Abs(Mathf.Sin((num * 0.5f + num2 * 0.866f) * 14f));
					float num6 = Mathf.Abs(Mathf.Sin((num * 0.5f - num2 * 0.866f) * 14f));
					float num7 = Mathf.Min(num4, Mathf.Min(num5, num6));
					float num8 = Mathf.Exp((0f - num7) * num7 * 200f);
					float num9 = Mathf.Abs(num3 - 0.82f);
					float num10 = Mathf.Exp((0f - num9) * num9 * 180f);
					float num11 = Mathf.Clamp01((1f - num3) * 2.5f) * Mathf.Clamp01((num3 - 0.15f) * 4f);
					float num12 = Mathf.Max(num8 * num10, num10 * 0.7f) * num11;
					array[i * size + j] = new Color(1f, 1f, 1f, num12 * 0.9f);
				}
			}
			val.SetPixels(array);
			val.Apply(false, true);
			Object.DontDestroyOnLoad((Object)(object)val);
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size);
			((Object)obj).name = "Gojo_HexRing";
			Object.DontDestroyOnLoad((Object)(object)obj);
			return obj;
		}

		private static Sprite CreateHexFillTexture(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
			{
				name = "Gojo_HexFill",
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			Color[] array = (Color[])(object)new Color[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num = ((float)j + 0.5f) / (float)size * 2f - 1f;
					float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = Mathf.Exp((0f - num3) * num3 * 2.5f);
					array[i * size + j] = new Color(1f, 1f, 1f, num4);
				}
			}
			val.SetPixels(array);
			val.Apply(false, true);
			Object.DontDestroyOnLoad((Object)(object)val);
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size);
			((Object)obj).name = "Gojo_HexFill";
			Object.DontDestroyOnLoad((Object)(object)obj);
			return obj;
		}
	}
	public sealed class GokuVfx : MonoBehaviour
	{
		private SpriteRenderer sky;

		private SpriteRenderer core;

		private SpriteRenderer rings;

		private SpriteRenderer beam;

		private SpriteRenderer[] sparks;

		private float started;

		private float duration;

		private GokuSpell spell;

		private Player owner;

		public static GokuVfx Create(Player owner, GokuSpell spell, Vector2 position, Vector2 aim, float duration)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			VisualAssets.Initialize();
			GameObject val = new GameObject("Goku_" + spell.ToString() + "_VFX");
			val.transform.position = new Vector3(position.x, position.y, -1f);
			GokuVfx gokuVfx = val.AddComponent<GokuVfx>();
			gokuVfx.owner = owner;
			gokuVfx.spell = spell;
			gokuVfx.started = Time.realtimeSinceStartup;
			gokuVfx.duration = duration;
			gokuVfx.sky = VisualAssets.Sprite(val.transform, "SaiyanSky", VisualAssets.Glow, 218);
			((Renderer)gokuVfx.sky).sharedMaterial = VisualAssets.AlphaMaterial;
			gokuVfx.core = VisualAssets.Sprite(val.transform, "SaiyanCore", VisualAssets.Core, 223);
			gokuVfx.rings = VisualAssets.Sprite(val.transform, "SaiyanRings", VisualAssets.Ring, 221);
			gokuVfx.beam = VisualAssets.Sprite(val.transform, "KamehamehaBeam", VisualAssets.Glow, 222);
			gokuVfx.sparks = (SpriteRenderer[])(object)new SpriteRenderer[32];
			for (int i = 0; i < gokuVfx.sparks.Length; i++)
			{
				gokuVfx.sparks[i] = VisualAssets.Sprite(val.transform, "SaiyanSpark_" + i, VisualAssets.Core, 220);
			}
			((Component)gokuVfx.beam).transform.localRotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(aim.y, aim.x) * 57.29578f - 90f);
			int layer = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).gameObject.layer : 0);
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			for (int j = 0; j < componentsInChildren.Length; j++)
			{
				((Component)componentsInChildren[j]).gameObject.layer = layer;
			}
			return gokuVfx;
		}

		private void Update()
		{
			//IL_0077: 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_00d4: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: 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_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Plugin.Instance) || !Plugin.Instance.Network.BattleOpen)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			float num = (Time.realtimeSinceStartup - started) / duration;
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (spell == GokuSpell.SuperSaiyan && Object.op_Implicit((Object)(object)owner))
			{
				((Component)this).transform.position = ((Component)owner).transform.position;
			}
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			float num2 = ((num < 0.08f) ? (num / 0.08f) : (1f - Mathf.InverseLerp(0.68f, 1f, num)));
			Color val = ((spell == GokuSpell.SuperSaiyan || spell == GokuSpell.DragonFist) ? new Color(1f, 0.54f, 0.025f) : new Color(0.03f, 0.72f, 1f));
			float num3 = ((spell == GokuSpell.SpiritBomb) ? 43 : ((spell == GokuSpell.Kamehameha) ? 38 : ((spell == GokuSpell.SuperSaiyan) ? 24 : 30)));
			VisualAssets.Draw(sky, Vector3.zero, num3 * 1.65f, new Color(val.r * 0.32f, val.g * 0.16f, val.b * 0.08f), num2 * 0.86f);
			VisualAssets.Draw(rings, Vector3.zero, num3 * (0.65f + 0.08f * Mathf.Sin(realtimeSinceStartup * 12f)), val, num2 * 0.82f, realtimeSinceStartup * 140f);
			VisualAssets.Draw(core, Vector3.zero, (spell == GokuSpell.SpiritBomb) ? (num3 * 0.43f) : (num3 * 0.23f), VisualAssets.White, num2);
			if (spell == GokuSpell.Kamehameha)
			{
				VisualAssets.Draw(beam, new Vector3(num3 * 0.34f, 0f, 0f), num3 * 1.15f, new Color(0.03f, 0.75f, 1f), num2);
			}
			else
			{
				((Renderer)beam).enabled = false;
			}
			for (int i = 0; i < sparks.Length; i++)
			{
				float num4 = (float)i * (float)Math.PI * 2f / (float)sparks.Length + realtimeSinceStartup * ((i % 2 == 0) ? 1.6f : (-1.2f));
				float num5 = num3 * (0.12f + (float)(i % 5) * 0.065f);
				((Component)sparks[i]).transform.localPosition = new Vector3(Mathf.Cos(num4) * num5, Mathf.Sin(num4) * num5, 0f);
				((Component)sparks[i]).transform.localScale = Vector3.one * (0.11f + (float)(i % 4) * 0.055f);
				sparks[i].color = new Color(val.r, val.g, val.b, num2 * (0.35f + 0.65f * Mathf.Abs(Mathf.Sin(realtimeSinceStartup * 11f + (float)i))));
			}
		}
	}
	public sealed class EffectPool : MonoBehaviour
	{
		private readonly List<HollowPurpleVfxController> effects = new List<HollowPurpleVfxController>(16);

		private int serial;

		public int SlotCount => effects.Count;

		public int LiveParticles
		{
			get
			{
				int num = 0;
				for (int i = 0; i < effects.Count; i++)
				{
					num += effects[i].ParticleCount;
				}
				return num;
			}
		}

		public void Initialize()
		{
			VisualAssets.Initialize();
			Prewarm(8);
		}

		public void Prewarm(int count)
		{
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			while (effects.Count < count)
			{
				GameObject val = new GameObject("HP_PooledAttack_" + effects.Count);
				val.transform.SetParent(((Component)this).transform, false);
				HollowPurpleVfxController hollowPurpleVfxController = val.AddComponent<HollowPurpleVfxController>();
				hollowPurpleVfxController.Initialize(this);
				effects.Add(hollowPurpleVfxController);
				val.SetActive(false);
			}
		}

		public HollowPurpleVfxController Acquire(int player)
		{
			HollowPurpleVfxController hollowPurpleVfxController = null;
			for (int i = 0; i < effects.Count; i++)
			{
				if (!((Component)effects[i]).gameObject.activeSelf)
				{
					hollowPurpleVfxController = effects[i];
					break;
				}
			}
			if (!Object.op_Implicit((Object)(object)hollowPurpleVfxController))
			{
				for (int j = 0; j < effects.Count; j++)
				{
					if (effects[j].Tail)
					{
						hollowPurpleVfxController = effects[j];
						hollowPurpleVfxController.Stop();
						break;
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)hollowPurpleVfxController))
			{
				Prewarm(effects.Count + 1);
				hollowPurpleVfxController = effects[effects.Count - 1];
			}
			hollowPurpleVfxController.Token = ++serial;
			((Component)hollowPurpleVfxController).gameObject.SetActive(true);
			return hollowPurpleVfxController;
		}

		public bool CanEmit()
		{
			int num = 0;
			for (int i = 0; i < effects.Count; i++)
			{
				if (((Component)effects[i]).gameObject.activeSelf)
				{
					num += effects[i].ParticleCount;
				}
			}
			return num < Plugin.Instance.Settings.ParticleBudget * 4;
		}

		public void Clear()
		{
			for (int i = 0; i < effects.Count; i++)
			{
				effects[i].Stop();
			}
		}
	}
	public sealed class HollowPurpleVfxController : MonoBehaviour
	{
		private EffectPool pool;

		private ChargeVfx charge;

		private ProjectileVfx projectile;

		private ImpactVfx impact;

		private ImpactVfx release;

		private Transform releaseRoot;

		private ParticleSystem particles;

		private Vector2 aim;

		private Vector2 releasePosition;

		private double started;

		private double launched;

		private double ended;

		private float chargeSeconds;

		private float emitRemainder;

		private float visualScale = 1f;

		private int upgradeLevel;

		private int mode;

		private int seed;

		private int audioStage;

		private uint random;

		private Renderer[] renderers;

		public int Token { get; internal set; }

		public bool Tail => mode >= 3;

		public int ParticleCount
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)particles))
				{
					return 0;
				}
				return particles.particleCount;
			}
		}

		private int Arcs => Mathf.Min(12, 2 + (int)Plugin.Instance.Settings.Quality.Value * 4 + upgradeLevel * 2);

		public void Initialize(EffectPool owner)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//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_00d5: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_01b0: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: 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_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			pool = owner;
			charge = new ChargeVfx(((Component)this).transform);
			projectile = new ProjectileVfx(((Component)this).transform);
			impact = new ImpactVfx(((Component)this).transform);
			GameObject val = new GameObject("ReleaseAtShooter");
			val.transform.SetParent(((Component)this).transform, false);
			releaseRoot = val.transform;
			release = new ImpactVfx(releaseRoot);
			GameObject val2 = new GameObject("EnergyFragments");
			val2.transform.SetParent(((Component)this).transform, false);
			particles = val2.AddComponent<ParticleSystem>();
			particles.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = particles.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.14f);
			((MainModule)(ref main)).maxParticles = 1100;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f);
			EmissionModule emission = particles.emission;
			((EmissionModule)(ref emission)).enabled = false;
			ShapeModule shape = particles.shape;
			((ShapeModule)(ref shape)).enabled = false;
			SizeOverLifetimeModule sizeOverLifetime = particles.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 0.2f),
				new Keyframe(0.15f, 1f),
				new Keyframe(1f, 0f)
			}));
			ColorOverLifetimeModule colorOverLifetime = particles.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.08f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)particles).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = VisualAssets.ParticleMaterial;
			component.renderMode = (ParticleSystemRenderMode)0;
			((Renderer)component).sortingOrder = 218;
			renderers = ((Component)this).GetComponentsInChildren<Renderer>(true);
			Hide();
		}

		public void MatchPlayerLayer(Player player)
		{
			int sortingLayerID = 0;
			int num = int.MinValue;
			Renderer[] componentsInChildren = ((Component)player).GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				int layerValueFromID = SortingLayer.GetLayerValueFromID(componentsInChildren[i].sortingLayerID);
				if (layerValueFromID > num)
				{
					num = layerValueFromID;
					sortingLayerID = componentsInChildren[i].sortingLayerID;
				}
			}
			for (int j = 0; j < renderers.Length; j++)
			{
				renderers[j].sortingLayerID = sortingLayerID;
			}
		}

		public void BeginCharge(Vector2 position, double time, float duration, int randomSeed, float scale = 1f, int level = 0)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			Hide();
			mode = 1;
			seed = randomSeed;
			random = (uint)(seed * 719 + 12345);
			started = time;
			chargeSeconds = duration;
			visualScale = Mathf.Clamp(scale, 1f, 4.5f);
			upgradeLevel = Mathf.Clamp(level, 0, 5);
			audioStage = 0;
			emitRemainder = 0f;
			SetPosition(position);
			particles.Clear();
			particles.Play();
		}

		public void Follow(Vector2 position, Vector2 direction)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SetPosition(position);
			aim = direction;
		}

		public void FollowProjectile(Vector2 position, Vector2 direction)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SetPosition(position);
			aim = direction;
		}

		private void SetPosition(Vector2 p)
		{
			//IL_0006: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = new Vector3(p.x, p.y, -1f);
		}

		public void Launch(Vector2 position, Vector2 direction, double time)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0143: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			charge.Hide();
			mode = 2;
			launched = time;
			aim = direction;
			SetPosition(position);
			releasePosition = position;
			projectile.Start(visualScale);
			Plugin.Instance.Audio.StopTag(Token, 0.035f);
			Plugin.Instance.Audio.Play("Release", Token, position, 2, loop: false, 1f, (float)Math.Max(0.0, HollowPurpleNetwork.Now - time));
			Plugin.Instance.Audio.Play("ProjectileLoop", Token, position, 1, loop: true, (upgradeLevel >= 5) ? 1.75f : 1f, 0f, (upgradeLevel >= 5) ? 0.45f : 1f);
			if (upgradeLevel >= 5)
			{
				Plugin.Instance.Audio.Play("Cataclysm", Token, position, 2, loop: false, 1.55f, 0f, 0.72f);
				Plugin.Instance.Audio.Play("Cataclysm", Token, position, 2, loop: false, 1.25f, 0f, 0.32f);
			}
			HollowPurpleCameraFeedback.Release(position, direction);
			Burst(35 + Arcs * 6, 8f, VisualAssets.Purple);
		}

		public void Impact(Vector2 position, double time)
		{
			//IL_0031: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			projectile.Hide(clearTrail: false);
			charge.Hide();
			release.Hide();
			mode = 3;
			ended = time;
			SetPosition(position);
			Plugin.Instance.Audio.StopTag(Token, 0.045f);
			Plugin.Instance.Audio.Play("Impact", Token, position, 2, loop: false, 1f, (float)Math.Max(0.0, HollowPurpleNetwork.Now - time));
			if (upgradeLevel >= 5)
			{
				Plugin.Instance.Audio.Play("Cataclysm", Token, position, 2, loop: false, 1.8f, 0f, 0.58f);
				Plugin.Instance.Audio.Play("Cataclysm", Token, position, 2, loop: false, 1.4f, 0f, 0.28f);
			}
			Plugin.Instance.Audio.Play("Aftermath", Token, position, 2, loop: false, 0.65f, (float)Math.Max(0.0, HollowPurpleNetwork.Now - time));
			HollowPurpleCameraFeedback.Impact(position);
			Burst(60 + Arcs * 10, 15f, VisualAssets.Magenta);
		}

		public void Fade(double time)
		{
			if (((Component)this).gameObject.activeSelf)
			{
				mode = 4;
				ended = time;
				charge.Hide();
				projectile.Hide(clearTrail: false);
				impact.Hide();
				release.Hide();
				Plugin.Instance.Audio.StopTag(Token, 0.08f);
			}
		}

		private void Hide()
		{
			charge.Hide();
			projectile.Hide(clearTrail: true);
			impact.Hide();
			release.Hide();
		}

		public void Stop()
		{
			if (charge != null)
			{
				Hide();
				particles.Stop(true, (ParticleSystemStopBehavior)0);
				if (Object.op_Implicit((Object)(object)Plugin.Instance) && Object.op_Implicit((Object)(object)Plugin.Instance.Audio))
				{
					Plugin.Instance.Audio.StopTag(Token, 0f);
				}
				mode = 0;
				((Component)this).gameObject.SetActive(false);
			}
		}

		private float Random01()
		{
			random ^= random << 13;
			random ^= random >> 17;
			random ^= random << 5;
			return (float)(random & 0xFFFF) / 65535f;
		}

		private Vector2 RandomDirection()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			float num = Random01() * (float)Math.PI * 2f;
			return new Vector2(Mathf.Cos(num), Mathf.Sin(num));
		}

		private void Emit(Vector2 position, Vector2 velocity, Color color, float lifetime, float size)
		{
			//IL_0027: 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_0035: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//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_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_008b: Unknown result type (might be due to invalid IL or missing references)
			if (ParticleCount < Plugin.Instance.Settings.ParticleBudget && pool.CanEmit())
			{
				EmitParams val = default(EmitParams);
				((EmitParams)(ref val)).position = new Vector3(position.x, position.y, -1f);
				((EmitParams)(ref val)).velocity = Vector2.op_Implicit(velocity);
				((EmitParams)(ref val)).startColor = Color32.op_Implicit(color);
				((EmitParams)(ref val)).startLifetime = lifetime;
				((EmitParams)(ref val)).startSize = size;
				((EmitParams)(ref val)).randomSeed = random;
				EmitParams val2 = val;
				particles.Emit(val2, 1);
			}
		}

		private void Burst(int count, float speed, Color color)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < count; i++)
			{
				Emit(Vector2.op_Implicit(((Component)this).transform.position), RandomDirection() * speed * (0.2f + Random01() * 0.8f), color, 0.2f + Random01() * 0.55f, 0.06f + Random01() * 0.28f);
			}
		}

		private void Update()
		{
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: 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_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: 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_047a: 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_048e: 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_011c: 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_023b: 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_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: 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_02ae: Unknown result type (might be due to invalid IL or missing references)
			double now = HollowPurpleNetwork.Now;
			float num = (float)(now - started);
			if (mode == 1)
			{
				float num2 = Mathf.Clamp01(num / chargeSeconds);
				float num3 = num2 * 1.5f;
				charge.Draw(num2, num, seed, Arcs, visualScale);
				int num4 = ((num3 < 0.35f) ? 1 : ((num3 < 0.7f) ? 2 : ((num3 < 1.35f) ? 3 : 4)));
				if (num4 != audioStage)
				{
					audioStage = num4;
					string clipName = num4 switch
					{
						3 => "Fusion", 
						2 => "RedCharge", 
						1 => "BlueCharge", 
						_ => "PreRelease", 
					};
					float num5 = num4 switch
					{
						3 => 0.7f, 
						2 => 0.35f, 
						1 => 0f, 
						_ => 1.35f, 
					};
					if (num4 == 4)
					{
						Plugin.Instance.Audio.StopTag(Token, 0.02f);
					}
					Plugin.Instance.Audio.Play(clipName, Token, Vector2.op_Implicit(((Component)this).transform.position), 0, loop: false, 1f, Mathf.Max(0f, num3 - num5), 1.5f / chargeSeconds);
				}
				if (num3 >= 1.45f)
				{
					Plugin.Instance.Audio.StopTag(Token, 0.01f);
				}
				float num6 = (float)(50 + Arcs * 10) * ((num3 > 0.7f) ? 1.6f : 1f) * (1f + (float)upgradeLevel * 0.18f);
				emitRemainder += Mathf.Min(Time.unscaledDeltaTime, 0.1f) * num6;
				int num7 = (int)emitRemainder;
				emitRemainder -= num7;
				for (int i = 0; i < num7; i++)
				{
					bool flag = num3 > 0.35f && Random01() > 0.5f;
					Vector2 val = Vector2.op_Implicit(((Component)this).transform.position) + Vector2.op_Implicit((Vector3)((num3 > 1.05f) ? new Vector3(0f, 0.6f) : (flag ? charge.RedPosition : charge.BluePosition)));
					Vector2 val2 = RandomDirection() * (1.2f + Random01() * 2.2f) * visualScale;
					float num8 = 0.25f + Random01() * 0.2f;
					Emit(val + val2, -val2 / num8, (num3 > 1.05f) ? VisualAssets.Purple : (flag ? VisualAssets.Red : VisualAssets.Blue), num8, (0.05f + Random01() * 0.14f) * visualScale);
				}
			}
			else if (mode == 2)
			{
				float num9 = (float)(now - launched);
				projectile.Draw(num9, aim, seed, Arcs, visualScale);
				releaseRoot.position = new Vector3(releasePosition.x, releasePosition.y, -1f);
				if (num9 < 0.35f)
				{
					release.Draw(num9, Plugin.Instance.Settings.Flash.Value, seed, Arcs, release: true, visualScale);
				}
				else
				{
					release.Hide();
				}
				Plugin.Instance.Audio.MoveTag(Token, Vector2.op_Implicit(((Component)this).transform.position));
				emitRemainder += Mathf.Min(Time.unscaledDeltaTime, 0.1f) * (float)(80 + Arcs * 15) * (1f + (float)upgradeLevel * 0.18f);
				int num10 = (int)emitRemainder;
				emitRemainder -= num10;
				for (int j = 0; j < num10; j++)
				{
					Emit(Vector2.op_Implicit(((Component)this).transform.position) + RandomDirection() * 1.1f * visualScale, -aim * (5f + Random01() * 10f) + RandomDirection() * 2f, VisualAssets.Purple, 0.3f + Random01() * 0.35f, (0.08f + Random01() * 0.18f) * visualScale);
				}
			}
			else if (mode == 3)
			{
				float num11 = (float)(now - ended);
				impact.Draw(num11, Plugin.Instance.Settings.Flash.Value, seed, Arcs, release: false, visualScale);
				if (num11 >= 0.8f)
				{
					impact.Hide();
				}
				if (num11 >= 1.6f)
				{
					Stop();
				}
			}
			else if (mode == 4 && now - ended > 0.8)
			{
				Stop();
			}
		}
	}
	public sealed class ImpactVfx
	{
		private readonly SpriteRenderer core;

		private readonly SpriteRenderer halo;

		private readonly SpriteRenderer[] rings = (SpriteRenderer[])(object)new SpriteRenderer[3];

		private readonly ProceduralLightning lightning;

		public ImpactVfx(Transform root)
		{
			core = VisualAssets.Sprite(root, "ImpactWhite", VisualAssets.Glow, 230);
			halo = VisualAssets.Sprite(root, "ImpactAtmosphere", VisualAssets.Glow, 207);
			for (int i = 0; i < rings.Length; i++)
			{
				rings[i] = VisualAssets.Sprite(root, "Shockwave" + i, VisualAssets.Ring, 217 + i);
			}
			lightning = new ProceduralLightning(root, 16);
		}

		public void Draw(float age, float flash, int seed, int arcs, bool release, float amplification = 1f)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_00f6: 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)
			float num = (release ? 0.5f : 1f) * amplification;
			float num2 = Mathf.Clamp01(1f - age / (release ? 0.35f : 0.8f));
			VisualAssets.Draw(core, Vector3.zero, (float)(release ? 4 : 9) * num2 * amplification, VisualAssets.White, Mathf.Clamp01(1f - age / 0.045f) * flash);
			VisualAssets.Draw(halo, Vector3.zero, (3f + age * 12f) * num, VisualAssets.Purple, num2 * num2 * 0.55f);
			for (int i = 0; i < rings.Length; i++)
			{
				float num3 = Mathf.Max(0f, age - (float)i * 0.045f);
				VisualAssets.Draw(rings[i], Vector3.zero, (1f + (1f - Mathf.Exp((0f - num3) * (float)(6 - i))) * (float)(12 - i * 2)) * num, (i == 0) ? VisualAssets.White : VisualAssets.Magenta, (age < (float)i * 0.045f) ? 0f : (Mathf.Clamp01(1f - num3 / 0.5f) * 0.75f), i * 24);
			}
			lightning.Draw(Vector3.zero, (1.5f + age * 8f) * num, VisualAssets.Magenta, Mathf.Clamp01(1f - age / 0.3f), age, seed, arcs);
		}

		public void Hide()
		{
			SpriteRenderer obj = core;
			bool enabled = (((Renderer)halo).enabled = false);
			((Renderer)obj).enabled = enabled;
			for (int i = 0; i < rings.Length; i++)
			{
				((Renderer)rings[i]).enabled = false;
			}
			lightning.Hide();
		}
	}
	public sealed class ProceduralLightning
	{
		private readonly LineRenderer[] lines;

		private readonly Vector3[] points = (Vector3[])(object)new Vector3[13];

		public ProceduralLightning(Transform parent, int count)
		{
			//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)
			lines = (LineRenderer[])(object)new LineRenderer[count];
			for (int i = 0; i < count; i++)
			{
				GameObject val = new GameObject("BranchedLightning_" + i);
				val.transform.SetParent(parent, false);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				val2.useWorldSpace = false;
				val2.positionCount = points.Length;
				((Renderer)val2).sharedMaterial = VisualAssets.LineMaterial;
				((Renderer)val2).sortingOrder = 220;
				val2.numCapVertices = 1;
				((Renderer)val2).enabled = false;
				lines[i] = val2;
			}
		}

		private static float Noise(int seed)
		{
			int num = seed ^ (seed << 13);
			int num2 = num ^ (num >>> 17);
			return (float)(uint)((num2 ^ (num2 << 5)) & 0xFFFF) / 32767.5f - 1f;
		}

		public void Draw(Vector3 center, float radius, Color color, float opacity, float time, int seed, int count)
		{
			//IL_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.FloorToInt(time * 22f);
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < lines.Length; i++)
			{
				LineRenderer val = lines[i];
				((Renderer)val).enabled = i < count && opacity > 0.02f;
				if (((Renderer)val).enabled)
				{
					bool flag = (i & 1) != 0;
					float num2 = Noise(seed + num * 7919 + i / 2 * 311) * (float)Math.PI;
					((Vector3)(ref val2))..ctor(Mathf.Cos(num2), Mathf.Sin(num2), 0f);
					((Vector3)(ref val3))..ctor(0f - val2.y, val2.x, 0f);
					Vector3 val4 = center + val2 * radius * (flag ? 0.65f : 0.3f);
					Vector3 val5 = center + val2 * radius * (flag ? 1f : 1.45f) + val3 * (flag ? (radius * 0.5f) : 0f);
					for (int j = 0; j < points.Length; j++)
					{
						float num3 = (float)j / (float)(points.Length - 1);
						points[j] = Vector3.Lerp(val4, val5, num3) + val3 * (Noise(seed + num * 3541 + i * 97 + j * 719) * radius * 0.17f * Mathf.Sin(num3 * (float)Math.PI));
					}
					val.SetPositions(points);
					val.startWidth = (flag ? 0.045f : 0.09f);
					val.endWidth = 0.012f;
					Color val6 = Color.Lerp(color, Color.white, flag ? 0.2f : 0.6f);
					val6.a = opacity * (1f - (time * 22f - (float)num) * 0.55f);
					val.startColor = val6;
					val6.a = 0f;
					val.endColor = val6;
				}
			}
		}

		public void Hide()
		{
			for (int i = 0; i < lines.Length; i++)
			{
				((Renderer)lines[i]).enabled = false;
			}
		}
	}
	public sealed class ProjectileVfx
	{
		private readonly Orb orb;

		private readonly SpriteRenderer ring;

		private readonly ProceduralLightning lightning;

		private readonly TrailRenderer trail;

		private readonly TrailRenderer trailCore;

		private readonly LineRenderer[] speedLines = (LineRenderer[])(object)new LineRenderer[6];

		public ProjectileVfx(Transform root)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			orb = new Orb(root, "PurpleProjectile");
			ring = VisualAssets.Sprite(root, "RotatingField", VisualAssets.Noise, 214);
			lightning = new ProceduralLightning(root, 16);
			GameObject val = new GameObject("PersistentRibbon");
			val.transform.SetParent(root, false);
			trail = val.AddComponent<TrailRenderer>();
			((Renderer)trail).sharedMaterial = VisualAssets.RibbonMaterial;
			trail.time = 0.45f;
			trail.minVertexDistance = 0.16f;
			trail.startWidth = 3.2f;
			trail.endWidth = 0.3f;
			trail.startColor = new Color(0.68f, 0.16f, 1f, 0.65f);
			trail.endColor = new Color(0.25f, 0.02f, 0.7f, 0f);
			((Renderer)trail).sortingOrder = 205;
			trail.emitting = false;
			trail.numCapVertices = 2;
			GameObject val2 = new GameObject("RibbonFilament");
			val2.transform.SetParent(root, false);
			trailCore = val2.AddComponent<TrailRenderer>();
			((Renderer)trailCore).sharedMaterial = VisualAssets.RibbonMaterial;
			trailCore.time = 0.28f;
			trailCore.minVertexDistance = 0.16f;
			trailCore.startWidth = 0.6f;
			trailCore.endWidth = 0.03f;
			trailCore.startColor = new Color(0.95f, 0.68f, 1f, 0.8f);
			trailCore.endColor = new Color(0.56f, 0.2f, 1f, 0f);
			((Renderer)trailCore).sortingOrder = 206;
			trailCore.emitting = false;
			for (int i = 0; i < speedLines.Length; i++)
			{
				GameObject val3 = new GameObject("SpeedLine");
				val3.transform.SetParent(root, false);
				LineRenderer val4 = val3.AddComponent<LineRenderer>();
				((Renderer)val4).sharedMaterial = VisualAssets.LineMaterial;
				val4.useWorldSpace = false;
				val4.positionCount = 2;
				val4.startWidth = 0.035f;
				val4.endWidth = 0f;
				((Renderer)val4).sortingOrder = 211;
				((Renderer)val4).enabled = false;
				speedLines[i] = val4;
			}
		}

		public void Start(float scale = 1f)
		{
			trail.Clear();
			trailCore.Clear();
			trail.startWidth = 3.2f * scale;
			trail.endWidth = 0.3f * scale;
			trailCore.startWidth = 0.6f * scale;
			trailCore.endWidth = 0.03f * scale;
			TrailRenderer obj = trail;
			bool emitting = (trailCore.emitting = true);
			obj.emitting = emitting;
		}

		public void Draw(float time, Vector2 direction, int seed, int arcs, float scale = 1f)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0178: 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)
			float num = 1f + Mathf.Sin(time * 26f) * 0.045f;
			orb.Draw(Vector3.zero, 2.1f * num * scale, VisualAssets.Purple, 1f, time);
			VisualAssets.Draw(ring, Vector3.zero, 3.6f * scale, VisualAssets.Magenta, 0.65f, time * 155f);
			lightning.Draw(Vector3.zero, 1.9f * scale, VisualAssets.Magenta, 0.9f, time, seed, arcs);
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f - direction.y, direction.x);
			for (int i = 0; i < speedLines.Length; i++)
			{
				LineRenderer obj = speedLines[i];
				((Renderer)obj).enabled = i < arcs;
				float num2 = Mathf.Repeat(time * 3f + (float)i * 0.17f, 1f);
				Vector2 val2 = val * ((float)((i % 2 == 0) ? 1 : (-1)) * (1.7f + (float)i * 0.2f) * scale) + direction * (1f - num2 * 4f);
				obj.startWidth = 0.035f * scale;
				obj.SetPosition(0, Vector2.op_Implicit(val2));
				obj.SetPosition(1, Vector2.op_Implicit(val2 - direction * (1.4f + num2) * scale));
				obj.startColor = new Color(0.73f, 0.35f, 1f, Mathf.Sin(num2 * (float)Math.PI) * 0.65f);
				obj.endColor = new Color(0.5f, 0.1f, 1f, 0f);
			}
		}

		public void Hide(bool clearTrail)
		{
			orb.Hide();
			((Renderer)ring).enabled = false;
			lightning.Hide();
			TrailRenderer obj = trail;
			bool emitting = (trailCore.emitting = false);
			obj.emitting = emitting;
			if (clearTrail)
			{
				trail.Clear();
				trailCore.Clear();
			}
			for (int i = 0; i < speedLines.Length; i++)
			{
				((Renderer)speedLines[i]).enabled = false;
			}
		}
	}
	public sealed class SukunaVfx : MonoBehaviour
	{
		private SpriteRenderer slash;

		private SpriteRenderer slashInner;

		private SpriteRenderer fireCorona;

		private SpriteRenderer fireTrail;

		private SukunaSpell spell;

		private float burstAt = -1f;

		private bool isShrine;

		private SpriteRenderer shrineRing;

		private SpriteRenderer shrineInner;

		private SpriteRenderer shrineAltar;

		private SpriteRenderer shrineSky;

		private SpriteRenderer shrineSeal;

		private SpriteRenderer shrineGate;

		private SpriteRenderer[] shrineBlades;

		private SpriteRenderer[] shrinePillars;

		private bool fireBurst;

		private static Sprite slashSprite;

		private float shrineRotation;

		public void Burst(Vector2 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			burstAt = Time.realtimeSinceStartup;
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
		}

		private void Update()
		{
			//IL_007c: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			if (isShrine || burstAt < 0f)
			{
				return;
			}
			float num = (Time.realtimeSinceStartup - burstAt) / 0.35f;
			if (num >= 1f || !Plugin.Instance.Network.BattleOpen)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Color val = (fireBurst ? new Color(1f, 0.34f, 0.03f) : new Color(1f, 0.04f, 0.15f));
			float num2 = (fireBurst ? Mathf.Lerp(3f, 22f, num) : Mathf.Lerp(1f, 11f, num));
			VisualAssets.Draw(slash, Vector3.zero, num2, val, 1f - num, num * 200f);
			if (Object.op_Implicit((Object)(object)slashInner))
			{
				VisualAssets.Draw(slashInner, Vector3.zero, num2 * 0.76f, Color.Lerp(val, Color.white, 0.35f), (1f - num) * 0.7f, (0f - num) * 150f);
			}
			if (Object.op_Implicit((Object)(object)fireCorona))
			{
				VisualAssets.Draw(fireCorona, Vector3.zero, num2 * 1.45f, new Color(1f, 0.08f, 0.01f), (1f - num) * 0.45f, num * 70f);
			}
		}

		public static SukunaVfx CreateSlash(Player owner, Vector2 position, Vector2 aim, bool isCleave)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_006f: 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)
			VisualAssets.Initialize();
			if ((Object)(object)slashSprite == (Object)null)
			{
				slashSprite = CreateSlashTexture(128);
			}
			GameObject val = new GameObject("Sukuna_Slash");
			SukunaVfx sukunaVfx = val.AddComponent<SukunaVfx>();
			sukunaVfx.spell = (isCleave ? SukunaSpell.Cleave : SukunaSpell.Dismantle);
			float num = Mathf.Atan2(aim.y, aim.x) * 57.29578f;
			val.transform.position = new Vector3(position.x, position.y, -1f);
			val.transform.rotation = Quaternion.Euler(0f, 0f, num);
			sukunaVfx.slash = CreateSprite(val.transform, "Arc", slashSprite, 210);
			if (isCleave)
			{
				sukunaVfx.slashInner = CreateSprite(val.transform, "Inner", VisualAssets.Noise, 211);
			}
			sukunaVfx.fireCorona = CreateSprite(val.transform, "Afterimage", VisualAssets.Ring, 209);
			int layer = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).gameObject.layer : 0);
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.layer = layer;
			}
			return sukunaVfx;
		}

		public static SukunaVfx CreateFire(Player owner, Vector2 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0024: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			VisualAssets.Initialize();
			GameObject val = new GameObject("Sukuna_Fire");
			SukunaVfx sukunaVfx = val.AddComponent<SukunaVfx>();
			sukunaVfx.spell = SukunaSpell.FireArrow;
			val.transform.position = new Vector3(position.x, position.y, -1f);
			sukunaVfx.slash = CreateSprite(val.transform, "Core", VisualAssets.Glow, 210);
			sukunaVfx.slashInner = CreateSprite(val.transform, "Halo", VisualAssets.Ring, 211);
			sukunaVfx.fireCorona = CreateSprite(val.transform, "Corona", VisualAssets.Noise, 209);
			sukunaVfx.fireTrail = CreateSprite(val.transform, "Trail", VisualAssets.Core, 208);
			int layer = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).gameObject.layer : 0);
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.layer = layer;
			}
			return sukunaVfx;
		}

		public void DrawFire(Vector2 position, float age)
		{
			//IL_0006: 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_0017: 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_003e: 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_004d: 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_0073: 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_0097: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			Color val = default(Color);
			((Color)(ref val))..ctor(1f, 0.5f, 0.05f);
			Color color = Color.Lerp(val, Color.white, 0.3f);
			float num = 2.1f + 0.25f * Mathf.Sin(realtimeSinceStartup * 18f);
			VisualAssets.Draw(slash, Vector3.zero, num, color, 0.9f, realtimeSinceStartup * 30f);
			VisualAssets.Draw(slashInner, Vector3.zero, num * 1.5f, val, 0.62f, (0f - realtimeSinceStartup) * 50f);
			VisualAssets.Draw(fireCorona, Vector3.zero, num * 2.7f, new Color(1f, 0.08f, 0.01f), 0.35f, realtimeSinceStartup * 83f);
			VisualAssets.Draw(fireTrail, new Vector3(-2.8f, 0f, 0f), 3.2f, new Color(1f, 0.22f, 0.02f), 0.48f);
		}

		public void BurstFire(Vector2 position)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			fireBurst = true;
			burstAt = Time.realtimeSinceStartup;
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
		}

		public void DrawSlash(Vector2 position, float age, float length, float width)
		{
			//IL_0006: 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_0017: 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_003f: 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_006e: 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_0084: 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_00cb: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			Color val = ((spell == SukunaSpell.Cleave) ? new Color(1f, 0.05f, 0.16f) : new Color(1f, 0.13f, 0.22f));
			((Component)slash).transform.localScale = new Vector3(length, width, 1f);
			slash.color = new Color(val.r, val.g, val.b, 0.95f);
			if (Object.op_Implicit((Object)(object)slashInner))
			{
				((Component)slashInner).transform.localScale = new Vector3(length * 1.18f, width * 2.2f, 1f);
				((Component)slashInner).transform.localRotation = Quaternion.Euler(0f, 0f, Mathf.Sin(realtimeSinceStartup * 18f) * 12f);
				slashInner.color = new Color(1f, 0.45f, 0.5f, 0.55f);
			}
			if (Object.op_Implicit((Object)(object)fireCorona))
			{
				VisualAssets.Draw(fireCorona, Vector3.zero, width * 7f + age * 3f, val, 0.38f, realtimeSinceStartup * 120f);
			}
		}

		public static SukunaVfx CreateShrine(Player owner, Vector2 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0024: 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_0035: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			VisualAssets.Initialize();
			GameObject val = new GameObject("Sukuna_Shrine");
			SukunaVfx sukunaVfx = val.AddComponent<SukunaVfx>();
			sukunaVfx.isShrine = true;
			val.transform.position = new Vector3(position.x, position.y, -1f);
			new Color(0.35f, 0.02f, 0.5f);
			new Color(0.15f, 0.01f, 0.25f);
			sukunaVfx.shrineRing = CreateSprite(val.transform, "Ring", VisualAssets.Ring, 8);
			sukunaVfx.shrineInner = CreateSprite(val.transform, "Flow", VisualAssets.Noise, 7);
			sukunaVfx.shrineAltar = CreateSprite(val.transform, "Altar", VisualAssets.Glow, 9);
			sukunaVfx.shrineSky = CreateSprite(val.transform, "BloodMoon", VisualAssets.Glow, 1);
			sukunaVfx.shrineSeal = CreateSprite(val.transform, "DomainSeal", VisualAssets.Ring, 6);
			sukunaVfx.shrineGate = CreateSprite(val.transform, "ShrineGate", VisualAssets.Core, 12);
			((Renderer)sukunaVfx.shrineAltar).sharedMaterial = VisualAssets.AlphaMaterial;
			((Renderer)sukunaVfx.shrineSky).sharedMaterial = VisualAssets.AlphaMaterial;
			((Renderer)sukunaVfx.shrineGate).sharedMaterial = VisualAssets.AlphaMaterial;
			int num = 22;
			sukunaVfx.shrineBlades = (SpriteRenderer[])(object)new SpriteRenderer[num];
			for (int i = 0; i < num; i++)
			{
				sukunaVfx.shrineBlades[i] = CreateSprite(val.transform, "Blade_" + i, VisualAssets.Core, 10);
			}
			sukunaVfx.shrinePillars = (SpriteRenderer[])(object)new SpriteRenderer[8];
			for (int j = 0; j < sukunaVfx.shrinePillars.Length; j++)
			{
				sukunaVfx.shrinePillars[j] = CreateSprite(val.transform, "Pillar_" + j, VisualAssets.Noise, 11);
			}
			int layer = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).gameObject.layer : 0);
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			for (int k = 0; k < componentsInChildren.Length; k++)
			{
				((Component)componentsInChildren[k]).gameObject.layer = layer;
			}
			return sukunaVfx;
		}

		public void Draw(Vector2 position, float age, float radius)
		{
			//IL_0006: 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_0017: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: 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_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = new Vector3(position.x, position.y, -1f);
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			Color color = default(Color);
			((Color)(ref color))..ctor(0.78f, 0.015f, 0.12f);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.16f, 0.002f, 0.018f);
			Color val = default(Color);
			((Color)(ref val))..ctor(1f, 0.22f, 0.02f);
			float num = radius * 2f / 0.77f;
			float num2 = 1f + 0.055f * Mathf.Sin(realtimeSinceStartup * 3f) + 0.025f * Mathf.Sin(realtimeSinceStartup * 11f);
			VisualAssets.Draw(shrineSky, Vector3.zero, num * 2.7f, new Color(0.16f, 0.001f, 0.006f), 0.7f);
			VisualAssets.Draw(shrineRing, Vector3.zero, num * num2, color, 0.6f + 0.12f * Mathf.Sin(realtimeSinceStartup * 2f), realtimeSinceStartup * 10f);
			VisualAssets.Draw(shrineSeal, Vector3.zero, num * 0.9f * num2, val, 0.5f, (0f - realtimeSinceStartup) * 25f);
			VisualAssets.Draw(shrineInner, Vector3.zero, num * 0.78f * num2, color2, 0.58f + 0.08f * Mathf.Sin(realtimeSinceStartup * 3.5f), (0f - realtimeSinceStartup) * 15f);
			VisualAssets.Draw(shrineAltar, Vector3.zero, num * 0.46f, color, 0.45f);
			VisualAssets.Draw(shrineGate, new Vector3(0f, radius * 0.12f, 0f), num * 0.3f, new Color(0.06f, 0.001f, 0.004f), 0.95f);
			shrineRotation += Time.deltaTime * 52f;
			float num3 = radius * 0.77f;
			for (int i = 0; i < shrineBlades.Length; i++)
			{
				float num4 = shrineRotation + (float)i * (360f / (float)shrineBlades.Length) * ((float)Math.PI / 180f);
				Vector3 localPosition = new Vector3(Mathf.Cos(num4), Mathf.Sin(num4), 0f) * num3;
				float num5 = 0.45f + 0.55f * Mathf.Sin(realtimeSinceStartup * 7f + (float)i * 1.1f);
				((Component)shrineBlades[i]).transform.localPosition = localPosition;
				((Component)shrineBlades[i]).transform.localScale = new Vector3(radius * 0.42f, 0.1f + 0.06f * num5, 1f);
				((Component)shrineBlades[i]).transform.localRotation = Quaternion.Euler(0f, 0f, num4 * 57.29578f + realtimeSinceStartup * 120f);
				shrineBlades[i].color = new Color(val.r, val.g, val.b, num5 * 0.82f);
			}
			for (int j = 0; j < shrinePillars.Length; j++)
			{
				float num6 = (float)j * (float)Math.PI * 2f / (float)shrinePillars.Length - realtimeSinceStartup * 0.13f;
				Vector3 localPosition2 = new Vector3(Mathf.Cos(num6), Mathf.Sin(num6), 0f) * radius * 0.48f;
				((Component)shrinePillars[j]).transform.localPosition = localPosition2;
				((Component)shrinePillars[j]).transform.localScale = new Vector3(0.34f, radius * 0.75f, 1f);
				((Component)shrinePillars[j]).transform.localRotation = Quaternion.Euler(0f, 0f, num6 * 57.29578f + 90f);
				shrinePillars[j].color = new Color(0.5f, 0.005f, 0.02f, 0.3f + 0.18f * Mathf.Sin(realtimeSinceStartup * 4f + (float)j));
			}
		}

		private static SpriteRenderer CreateSprite(Transform parent, string name, Sprite sprite, int order)
		{
			//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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			((Renderer)obj).sharedMaterial = VisualAssets.Additive;
			((Renderer)obj).sortingOrder = order;
			return obj;
		}

		private static Sprite CreateSlashTexture(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
			{
				name = "Sukuna_Slash",
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			Color[] array = (Color[])(object)new Color[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num = ((float)j + 0.5f) / (float)size * 2f - 1f;
					float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f;
					Mathf.Sqrt(num * num + num2 * num2);
					float num3 = Mathf.Abs(num2);
					float num4 = Mathf.Exp((0f - num3) * num3 * 80f);
					float num5 = Mathf.Clamp01((1f - num) * 2f) * Mathf.Clamp01((num + 1f) * 2f);
					array[i * size + j] = new Color(1f, 1f, 1f, num4 * num5 * 0.9f);
				}
			}
			val.SetPixels(array);
			val.Apply(false, true);
			Object.DontDestroyOnLoad((Object)(object)val);
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size);
			((Object)obj).name = "Sukuna_Slash";
			Object.DontDestroyOnLoad((Object)(object)obj);
			return obj;
		}
	}
	internal static class VisualAssets
	{
		public static readonly Color Blue = new Color(0.13f, 0.75f, 1f);

		public static readonly Color Red = new Color(1f, 0.19f, 0.36f);

		public static readonly Color Purple = new Color(0.56f, 0.21f, 1f);

		public static readonly Color Magenta = new Color(0.93f, 0.28f, 1f);

		public static readonly Color White = new Color(1f, 0.96f, 1f);

		public static Sprite Glow;

		public static Sprite Core;

		public static Sprite Ring;

		public static Sprite Noise;

		public static Material Additive;

		public static Material LineMaterial;

		public static Material ParticleMaterial;

		public static Material RibbonMaterial;

		public static Material AlphaMaterial;

		public static void Initialize()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_0175: Expected O, but got Unknown
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Glow))
			{
				return;
			}
			Glow = Texture("HP_Glow", 128, 0);
			Core = Texture("HP_Core", 128, 1);
			Ring = Texture("HP_Ring", 128, 2);
			Noise = Texture("HP_Noise", 128, 3);
			Shader val = Shader.Find("Particles/Standard Unlit");
			if (!Object.op_Implicit((Object)(object)val) || !val.isSupported)
			{
				val = Shader.Find("Particles/Additive");
			}
			if (!Object.op_Implicit((Object)(object)val) || !val.isSupported)
			{
				val = Shader.Find("Legacy Shaders/Particles/Additive");
			}
			if (!Object.op_Implicit((Object)(object)val) || !val.isSupported)
			{
				val = Shader.Find("Sprites/Default");
				Plugin.Instance.Warn("Shader additif absent : rendu alpha avec Sprites/Default.");
			}
			if (!Object.op_Implicit((Object)(object)val) || !val.isSupported)
			{
				throw new InvalidOperationException("Aucun shader 2D compatible disponible.");
			}
			Additive = new Material(val)
			{
				name = "HP_Additive",
				mainTexture = (Texture)(object)Glow.texture
			};
			LineMaterial = new Material(val)
			{
				name = "HP_Lines",
				mainTexture = (Texture)(object)Texture2D.whiteTexture
			};
			ParticleMaterial = new Material(val)
			{
				name = "HP_Particles",
				mainTexture = (Texture)(object)Glow.texture
			};
			Texture2D val2 = new Texture2D(32, 128, (TextureFormat)4, false)
			{
				name = "HP_SoftRibbon",
				wrapMode = (TextureWrapMode)1
			};
			Color[] array = (Color[])(object)new Color[4096];
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = Mathf.Abs(((float)i + 0.5f) / 128f * 2f - 1f);
					array[i * 32 + j] = new Color(1f, 1f, 1f, Mathf.Exp((0f - num) * num * 12f) * Mathf.Clamp01((1f - num) * 8f));
				}
			}
			val2.SetPixels(array);
			val2.Apply(false, true);
			Object.DontDestroyOnLoad((Object)(object)val2);
			RibbonMaterial = new Material(val)
			{
				name = "HP_Ribbon",
				mainTexture = (Texture)(object)val2
			};
			AlphaMaterial = new Material(Shader.Find("Sprites/Default"))
			{
				name = "HP_Contrast",
				mainTexture = (Texture)(object)Glow.texture
			};
			Object.DontDestroyOnLoad((Object)(object)AlphaMaterial);
			Material[] array2 = (Material[])(object)new Material[4] { Additive, LineMaterial, ParticleMaterial, RibbonMaterial };
			foreach (Material val3 in array2)
			{
				if (val3.HasProperty("_SrcBlend"))
				{
					val3.SetInt("_SrcBlend", 5);
				}
				if (val3.HasProperty("_DstBlend"))
				{
					val3.SetInt("_DstBlend", 1);
				}
				if (val3.HasProperty("_ZWrite"))
				{
					val3.SetInt("_ZWrite", 0);
				}
				if (val3.HasProperty("_Cull"))
				{
					val3.SetInt("_Cull", 0);
				}
				if (val3.HasProperty("_Color"))
				{
					val3.SetColor("_Color", Color.white);
				}
				val3.DisableKeyword("_ALPHATEST_ON");
				val3.DisableKeyword("_ALPHAPREMULTIPLY_ON");
				val3.EnableKeyword("_ALPHABLEND_ON");
				if (val3.HasProperty("_Mode"))
				{
					val3.SetFloat("_Mode", 4f);
				}
				val3.renderQueue = 3000;
			}
			Object.DontDestroyOnLoad((Object)(object)Additive);
			Object.DontDestroyOnLoad((Object)(object)LineMaterial);
			Object.DontDestroyOnLoad((Object)(object)ParticleMaterial);
			Object.DontDestroyOnLoad((Object)(object)RibbonMaterial);
			Plugin.Instance.Log("VFX shader : " + ((Object)val).name + " ; pipeline=" + (Object.op_Implicit((Object)(object)GraphicsSettings.renderPipelineAsset) ? "SRP" : "Built-in"));
		}

		private static Sprite Texture(string name, int n, int mode)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0192: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(n, n, (TextureFormat)4, false)
			{
				name = name,
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			Color[] array = (Color[])(object)new Color[n * n];
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < n; j++)
				{
					float num = ((float)j + 0.5f) / (float)n * 2f - 1f;
					float num2 = ((float)i + 0.5f) / (float)n * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = Mathf.Atan2(num2, num);
					array[i * n + j] = new Color(1f, 1f, 1f, mode switch
					{
						2 => Mathf.Exp(0f - Mathf.Pow((num3 - 0.77f) * 36f, 2f)), 
						1 => Mathf.Clamp01((0.8f - num3) * 8f), 
						0 => Mathf.Exp((0f - num3) * num3 * 5f) * Mathf.Clamp01((1f - num3) * 8f), 
						_ => Mathf.Exp(0f - Mathf.Pow((num3 - 0.6f - Mathf.Sin(num4 * 7f) * 0.06f - Mathf.Sin(num4 * 13f) * 0.02f) * 13f, 2f)), 
					});
				}
			}
			val.SetPixels(array);
			val.Apply(false, true);
			Object.DontDestroyOnLoad((Object)(object)val);
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)n, (float)n), new Vector2(0.5f, 0.5f), (float)n);
			((Object)obj).name = name;
			Object.DontDestroyOnLoad((Object)(object)obj);
			return obj;
		}

		public static SpriteRenderer Sprite(Transform parent, string name, Sprite sprite, int order)
		{
			//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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			((Renderer)obj).sharedMaterial = Additive;
			((Renderer)obj).sortingOrder = order;
			return obj;
		}

		public static void Draw(SpriteRenderer sprite, Vector3 position, float size, Color color, float opacity = 1f, float rotation = 0f)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)sprite).enabled = size > 0.001f && opacity > 0.001f;
			((Component)sprite).transform.localPosition = position;
			((Component)sprite).transform.localScale = Vector3.one * size;
			((Component)sprite).transform.localRotation = Quaternion.Euler(0f, 0f, rotation);
			color.a *= opacity;
			sprite.color = color;
		}
	}
	internal sealed class Orb
	{
		private readonly SpriteRenderer halo;

		private readonly SpriteRenderer skin;

		private readonly SpriteRenderer core;

		private readonly SpriteRenderer corona;

		private readonly SpriteRenderer inner;

		private readonly SpriteRenderer turbulence;

		private readonly SpriteRenderer contrast;

		public Orb(Transform root, string name)
		{
			contrast = VisualAssets.Sprite(root, name + "EnergyWell", VisualAssets.Glow, 208);
			((Renderer)contrast).sharedMaterial = VisualAssets.AlphaMaterial;
			halo = VisualAssets.Sprite(root, name + "Halo", VisualAssets.Glow, 210);
			skin = VisualA