Decompiled source of Zips Ultimate Abilities v0.7.2

BepInEx/plugins/ZipsUltimates/ZipsUltimates.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using InControl;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("ZipsUltimateProbe")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ZipsUltimates")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.7.2.0")]
[assembly: AssemblyInformationalVersion("0.7.2")]
[assembly: AssemblyProduct("ZipsUltimates")]
[assembly: AssemblyTitle("ZipsUltimates")]
[assembly: AssemblyVersion("0.7.2.0")]
namespace ZipsUltimates;

internal static class ArsenalAudio
{
	private static AudioSource[] voices;

	private static AudioClip[] shots;

	private static int next;

	internal static void Prepare()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		if (voices == null || !((Object)(object)voices[0] != (Object)null))
		{
			GameObject val = new GameObject("Zip's rifle transients");
			Object.DontDestroyOnLoad((Object)(object)val);
			voices = (AudioSource[])(object)new AudioSource[12];
			shots = (AudioClip[])(object)new AudioClip[4];
			for (int i = 0; i < voices.Length; i++)
			{
				voices[i] = val.AddComponent<AudioSource>();
				voices[i].playOnAwake = false;
				voices[i].spatialBlend = 0f;
			}
			for (int j = 0; j < 4; j++)
			{
				shots[j] = RecordedAudio.Clip("rifle-" + j);
			}
		}
	}

	internal static void Shot(Vector2 p, int seed)
	{
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		Prepare();
		AudioSource obj = voices[next++ % voices.Length];
		obj.Stop();
		obj.clip = shots[(seed & 0x7FFFFFFF) % 4];
		obj.volume = 0.62f;
		obj.pitch = 0.97f + UMath.Noise(seed) * 0.06f;
		Camera val = (((Object)(object)MainCam.instance != (Object)null) ? MainCam.instance.cam : Camera.main);
		obj.panStereo = (((Object)(object)val != (Object)null) ? Mathf.Clamp((val.WorldToViewportPoint(Vector2.op_Implicit(p)).x - 0.5f) * 1.3f, -0.7f, 0.7f) : 0f);
		obj.Play();
	}
}
public sealed class RealFuckingGun : UltimateCard
{
	public override string AbilityId => "real-fucking-gun";

	protected override string GetTitle()
	{
		return "Real fucking gun";
	}

	protected override string GetDescription()
	{
		return "Ultimate ability. Physics props offer no cover.";
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)0;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)3;
	}

	protected override GameObject GetCardArt()
	{
		return UltimateArtTemplate.Arsenal(rocket: false);
	}

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Expected O, but got Unknown
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00bf: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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)
		//IL_00e4: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[6]
		{
			new CardInfoStat
			{
				positive = true,
				amount = "30",
				stat = "Rifle rounds"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "10/s",
				stat = "Automatic fire"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "500%",
				stat = "Basic bullet speed / straight"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "7.5%",
				stat = "Target max HP per bullet"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "1 body width",
				stat = "Static material penetration"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "120%",
				stat = "Charge gain"
			}
		};
	}
}
public sealed class KaboomBitch : UltimateUpgradeCard
{
	public override string RequiredAbilityId => "real-fucking-gun";

	protected override string GetTitle()
	{
		return "Kaboom bitch";
	}

	protected override string GetDescription()
	{
		return "Ultimate ability upgrade. Three loud arguments.";
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)1;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)0;
	}

	protected override GameObject GetCardArt()
	{
		return UltimateArtTemplate.Arsenal(rocket: true);
	}

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Expected O, but got Unknown
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00bf: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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)
		//IL_00e4: Expected O, but got Unknown
		//IL_00e6: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[7]
		{
			new CardInfoStat
			{
				positive = true,
				amount = "3",
				stat = "Unguided rockets"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "1/s",
				stat = "Fire rate"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "300%",
				stat = "Searching missile speed"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "+50%",
				stat = "Missile blast radius"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "20–70%",
				stat = "Target max HP blast damage"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "Yes",
				stat = "Laser sight"
			},
			new CardInfoStat
			{
				positive = true,
				amount = "125%",
				stat = "Charge gain"
			}
		};
	}

	public override void SetupCard(CardInfo c, Gun g, ApplyCardStats a, CharacterStatModifiers s, Block b)
	{
		c.allowMultiple = false;
	}
}
internal static class UltimatePainter
{
	private static readonly Pigment GunMetal = new Pigment(0.13f, 0.17f, 0.18f);

	private static readonly Pigment GunEdge = new Pigment(0.42f, 0.51f, 0.51f);

	private static readonly Pigment GunOlive = new Pigment(0.24f, 0.3f, 0.17f);

	private static readonly Pigment Jade = new Pigment(0.25f, 0.67f, 0.39f);

	private static readonly Pigment Mint = new Pigment(0.7f, 0.88f, 0.61f);

	private static readonly Pigment InkBlue = new Pigment(0.025f, 0.065f, 0.1f);

	private static readonly Pigment Teal = new Pigment(0.08f, 0.3f, 0.35f);

	private static readonly Pigment PeekPink = new Pigment(0.92f, 0.08f, 0.57f);

	private static readonly Pigment Cyan = new Pigment(0.18f, 0.86f, 0.94f);

	private static readonly Pigment Ice = new Pigment(0.82f, 0.97f, 1f);

	private static readonly Pigment Graphite = new Pigment(0.16f, 0.22f, 0.24f);

	internal static readonly Pigment Dark = new Pigment(0.055f, 0.045f, 0.065f);

	internal static readonly Pigment Plate = new Pigment(0.15f, 0.105f, 0.13f);

	internal static readonly Pigment Red = new Pigment(0.97f, 0.12f, 0.055f);

	internal static readonly Pigment Orange = new Pigment(1f, 0.39f, 0.08f);

	internal static readonly Pigment Gold = new Pigment(0.98f, 0.69f, 0.25f);

	internal static readonly Pigment Cream = new Pigment(1f, 0.94f, 0.76f);

	internal static readonly Pigment Brass = new Pigment(0.46f, 0.31f, 0.23f);

	internal static readonly Pigment Smoke = new Pigment(0.13f, 0.12f, 0.15f);

	internal static void RifleModel(ArtMesh m, float bolt = 0f)
	{
		m.Clear();
		m.Rect(-0.62f, 0.09f, 0.3f, 0.055f, GunEdge);
		m.Polygon(GunMetal, -0.9f, -0.05f, -0.63f, -0.05f, -0.48f, 0.19f, -0.9f, 0.17f);
		m.Rect(-0.93f, -0.08f, 0.055f, 0.28f, GunEdge);
		m.Polygon(GunMetal, -0.38f, -0.05f, 0.34f, -0.05f, 0.43f, 0.19f, -0.3f, 0.22f);
		m.Rect(-0.31f, 0.2f, 0.6f, 0.07f, GunEdge);
		m.Rect(-0.19f, 0.24f, 0.06f, 0.15f, GunMetal);
		m.Rect(0.2f, 0.24f, 0.06f, 0.15f, GunMetal);
		m.Rect(-0.19f, 0.35f, 0.45f, 0.055f, GunMetal);
		m.Rect(0.3f, 0.04f, 0.64f, 0.19f, GunOlive);
		for (int i = 0; i < 6; i++)
		{
			m.Rect(0.36f + (float)i * 0.095f, 0.08f, 0.045f, 0.11f, Dark);
		}
		m.Line(0.33f, 0.24f, 0.92f, 0.24f, 0.035f, GunEdge);
		m.Rect(0.92f, 0.115f, 0.48f, 0.055f, GunEdge);
		m.Rect(1.38f, 0.095f, 0.12f, 0.095f, GunMetal);
		m.Polygon(GunMetal, 1.07f, 0.15f, 1.14f, 0.37f, 1.22f, 0.15f);
		m.Rect(1.11f, 0.34f, 0.065f, 0.05f, GunEdge);
		m.Polygon(GunMetal, -0.24f, -0.05f, -0.1f, -0.06f, -0.18f, -0.35f, -0.32f, -0.29f);
		m.Ring(0.01f, -0.11f, 0.1f, 0.024f, GunEdge, 3.2f, 3.1f, 24);
		m.Polygon(GunMetal, 0.12f, -0.04f, 0.3f, -0.05f, 0.35f, -0.29f, 0.24f, -0.5f, 0.09f, -0.45f, 0.17f, -0.27f);
		m.Line(0.18f, -0.11f, 0.23f, -0.28f, 0.014f, GunEdge);
		m.Line(0.24f, -0.3f, 0.17f, -0.42f, 0.013f, GunEdge);
		m.Rect(-0.05f + bolt * 0.06f, 0.075f, 0.2f, 0.06f, Dark);
		m.Rect(-0.05f + bolt * 0.06f, 0.075f, 0.06f, 0.06f, Cream);
		m.Line(-0.27f, 0.015f, 0.26f, 0.015f, 0.017f, GunEdge);
	}

	internal static void LauncherModel(ArtMesh m)
	{
		m.Clear();
		m.Rect(-0.86f, 0.005f, 1.92f, 0.32f, GunOlive);
		m.Disc(-0.86f, 0.165f, 0.11f, 0.16f, GunMetal, 32);
		m.Disc(1.06f, 0.165f, 0.1f, 0.16f, GunEdge, 32);
		m.Rect(-0.84f, 0.24f, 1.87f, 0.045f, new Pigment(0.42f, 0.48f, 0.29f));
		m.Rect(-0.47f, -0.04f, 0.12f, 0.41f, GunMetal);
		m.Rect(0.74f, -0.04f, 0.12f, 0.41f, GunMetal);
		m.Polygon(GunMetal, -0.12f, 0.01f, 0.04f, 0.01f, -0.02f, -0.29f, -0.17f, -0.25f);
		m.Rect(-0.01f, 0.32f, 0.08f, 0.15f, GunMetal);
		m.Rect(-0.09f, 0.43f, 0.29f, 0.1f, GunEdge);
		m.Disc(0.2f, 0.48f, 0.035f, 0.05f, Red, 16);
		m.Rect(0.31f, 0.085f, 0.24f, 0.1f, Dark);
		m.Polygon(Cream, 0.39f, 0.1f, 0.47f, 0.1f, 0.43f, 0.17f);
	}

	internal static void ArsenalCard(ArtMesh m, float w, float h, float time, bool rocket)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = w / h;
		float num2 = time % 3f;
		ArtMesh artMesh = new ArtMesh();
		m.Rect((0f - num) / 2f, -0.5f, num, 1f, rocket ? new Pigment(0.13f, 0.055f, 0.035f) : new Pigment(0.045f, 0.075f, 0.09f));
		if (!rocket)
		{
			for (int i = -3; i < 5; i++)
			{
				Pigment c = new Pigment(0.075f, 0.13f, 0.15f);
				float[] obj = new float[8] { 0f, -0.55f, 0f, -0.55f, 0f, 0.55f, 0f, 0.55f };
				obj[0] = (float)i * 0.28f;
				obj[2] = (float)i * 0.28f + 0.1f;
				obj[4] = (float)i * 0.28f + 0.6f;
				obj[6] = (float)i * 0.28f + 0.5f;
				m.Polygon(c, obj);
			}
			for (int j = 0; j < 2; j++)
			{
				for (int k = 0; k < 10; k++)
				{
					m.Line(-0.48f + (float)k * 0.065f, -0.33f - (float)j * 0.07f, -0.48f + (float)k * 0.065f, -0.29f - (float)j * 0.07f, 0.02f, new Pigment(0.36f, 0.32f, 0.21f));
				}
			}
			float num3 = ((num2 > 0.86f && num2 < 1.35f) ? ((float)Math.Pow(Math.Max(0.0, Math.Sin((double)(num2 - 0.86f) * Math.PI * 18.0)), 10.0)) : 0f);
			RifleModel(artMesh, num3);
			m.Append(artMesh, -0.14f - num3 * 0.018f, 0.13f, 0.43f, 0f, 0f, 0.43f);
			if (num3 > 0.05f)
			{
				m.Polygon(Cream, 0.5f, 0.2f, 0.68f, 0.24f, 0.55f, 0.17f, 0.7f, 0.12f, 0.5f, 0.15f);
				m.Line(0.56f, 0.18f, 0.83f, 0.18f, 0.008f, Gold);
			}
			for (int l = 0; l < 3; l++)
			{
				float num4 = num2 - 0.92f - (float)l * 0.13f;
				if (num4 > 0f && num4 < 0.65f)
				{
					float num5 = 0.03f + num4 * 0.22f;
					float num6 = 0.2f + num4 * 0.65f - num4 * num4 * 0.7f;
					m.Line(num5, num6, num5 + 0.032f, num6 + 0.02f, 0.013f, Gold);
				}
			}
		}
		else
		{
			for (int n = 0; n < 7; n++)
			{
				m.Rect((0f - num) / 2f, -0.47f + (float)n * 0.16f, num, 0.045f, new Pigment(0.23f, 0.1f, 0.065f));
			}
			LauncherModel(artMesh);
			m.Append(artMesh, 0.15f, -0.06f, -0.47f, 0.22f, 0.22f, 0.47f);
			float a = UMath.Smooth((num2 - 0.48f) / 0.25f) * (1f - UMath.Smooth((num2 - 2.1f) / 0.3f));
			m.Line(-0.3f, 0.16f, (0f - num) / 2f, 0.42f, 0.005f, Red.Alpha(a));
			for (int num7 = 0; num7 < 3; num7++)
			{
				m.Rect(0.29f + (float)num7 * 0.065f, -0.4f, 0.035f, 0.11f, (num7 == 0 && num2 > 0.9f) ? GunMetal : Gold);
			}
			if (UMath.Sat(1f - Math.Abs(num2 - 0.84f) / 0.09f) > 0f)
			{
				m.Polygon(Cream, -0.4f, 0.2f, -0.62f, 0.4f, -0.4f, 0.31f, -0.34f, 0.48f, -0.34f, 0.29f, -0.2f, 0.33f);
			}
			if (num2 > 1f && num2 < 1.55f)
			{
				float num8 = (num2 - 1f) / 0.55f;
				m.Ring(-0.45f, 0.32f, 0.03f + num8 * 0.2f, 0.02f * (1f - num8), Orange.Alpha(1f - num8), 0f, (float)Math.PI * 2f, 36);
			}
		}
		float num9 = UMath.Smooth((num2 - 2.35f) / 0.25f) * (1f - UMath.Smooth((num2 - 2.72f) / 0.28f));
		if (num9 > 0f)
		{
			m.Rect((0f - num) / 2f, -0.5f, num * num9, 1f, rocket ? new Pigment(0.13f, 0.055f, 0.035f) : new Pigment(0.045f, 0.075f, 0.09f));
		}
	}

	internal static void ArsenalIcon(ArtMesh m, float width, bool rocket)
	{
		ArtMesh artMesh = new ArtMesh();
		if (rocket)
		{
			LauncherModel(artMesh);
		}
		else
		{
			RifleModel(artMesh);
		}
		float num = (0f - width) / 2f + 54f;
		m.Disc(num, 0f, 28f, 28f, Plate);
		m.Append(artMesh, num - 3f, 0f, 20f, 0f, 0f, 20f);
	}

	internal static void MuzzleFan(ArtMesh m, float x, float y, float dx, float dy, float power)
	{
		if (!(power <= 0f))
		{
			float num = 0f - dy;
			m.Polygon(Orange.Alpha(power), x + num * 0.12f, y + dx * 0.12f, x + dx * 0.54f, y + dy * 0.54f, x - num * 0.12f, y - dx * 0.12f);
			m.Polygon(Cream.Alpha(power), x + num * 0.06f, y + dx * 0.06f, x + dx * 0.36f, y + dy * 0.36f, x - num * 0.06f, y - dx * 0.06f);
		}
	}

	internal static void FlightSmoke(ArtMesh m, float x, float y, float dx, float dy, float age, float life, int seed, bool missile)
	{
		if (age < 0f || age >= life)
		{
			return;
		}
		float num = age / life;
		float num2 = UMath.Noise(seed);
		float num3 = (float)Math.Sin(age * 5.5f + num2 * 6.28f);
		float num4 = 0f - dy;
		float num5 = age * (missile ? 0.18f : 0.07f) * num3;
		x += num4 * num5;
		y += dx * num5 + age * age * (missile ? 0.19f : 0.1f);
		float num6 = (missile ? 0.13f : 0.025f) + (missile ? 0.6f : 0.19f) * (float)Math.Sqrt(num);
		float num7 = (1f - num) * (missile ? ((1f - num) * 0.28f) : 0.32f);
		Pigment pigment = new Pigment(0.55f, 0.58f, 0.61f, num7 * 0.38f);
		Pigment pigment2 = new Pigment(0.76f, 0.78f, 0.77f, num7);
		for (int i = 0; i < 2; i++)
		{
			float num8 = num6 * ((i == 0) ? 1.45f : 0.85f);
			float[] array = new float[20];
			for (int j = 0; j < 10; j++)
			{
				float num9 = (float)j * ((float)Math.PI * 2f) / 10f;
				float num10 = 0.84f + 0.16f * UMath.Noise(seed + j * 197 + i * 17);
				float num11 = (float)Math.Cos(num9) * num8 * num10 * (missile ? 1.45f : 2.3f);
				float num12 = (float)Math.Sin(num9) * num8 * num10;
				array[j * 2] = x + dx * num11 + num4 * num12;
				array[j * 2 + 1] = y + dy * num11 + dx * num12;
			}
			m.Polygon((i == 0) ? pigment : pigment2, array);
		}
		if (!missile && age < 0.045f)
		{
			m.Line(x - dx * 0.12f, y - dy * 0.12f, x + dx * 0.12f, y + dy * 0.12f, 0.018f, Cream.Alpha((1f - age / 0.045f) * 0.7f));
		}
	}

	internal static void RifleSurface(ArtMesh m, float x, float y, float dx, float dy, float age, int seed, bool exit)
	{
		if (!(age < 0f) && !(age > 0.55f))
		{
			float num = 1f - age / 0.55f;
			float num2 = UMath.Sat(1f - age / 0.065f);
			float num3 = 0f - dy;
			if (num2 > 0f)
			{
				m.Disc(x, y, 0.1f + age * 3f, 0.08f + age * 2f, Cream.Alpha(num2), 12);
				m.Line(x - dy * 0.2f, y + dx * 0.2f, x + dy * 0.2f, y - dx * 0.2f, 0.035f, Gold.Alpha(num2));
			}
			int num4 = (exit ? 9 : 6);
			for (int i = 0; i < num4; i++)
			{
				float num5 = (UMath.Noise(seed + i * 83) - 0.5f) * (exit ? 1.4f : 2.2f);
				float num6 = (exit ? 3.8f : 2.3f) + UMath.Noise(seed + i * 197) * 3f;
				float num7 = (dx + num3 * num5) * num6;
				float num8 = (dy + dx * num5) * num6;
				float num9 = x + num7 * age;
				float num10 = y + num8 * age - 5f * age * age;
				m.Line(num9 - num7 * 0.017f, num10 - num8 * 0.017f, num9, num10, 0.025f + (float)(i % 3) * 0.012f, ((i % 3 == 0) ? Gold : Cream).Alpha(num * ((i % 3 == 0) ? 0.85f : 0.48f)));
			}
			FlightSmoke(m, x + dx * age, y + dy * age, dx, dy, age, 0.55f, seed, missile: true);
		}
	}

	private static void Quill(ArtMesh m, float x, float y, float angle, float length, float width, Pigment a, Pigment b)
	{
		float num = C(angle);
		float num2 = S(angle);
		float num3 = (0f - num2) * width;
		float num4 = num * width;
		m.Polygon(a, x + num3, y + num4, x + num * length, y + num2 * length, x - num3, y - num4);
		m.Polygon(b, x, y, x + num * length, y + num2 * length, x - num3, y - num4);
	}

	private static void GuardFace(ArtMesh m, float x, float y, float r, float blink, bool armored)
	{
		m.Disc(x, y, r, r, armored ? new Pigment(0.055f, 0.18f, 0.15f) : Jade, 60);
		if (armored)
		{
			m.Polygon(Mint, x - r * 0.8f, y + r * 0.25f, x + r * 0.7f, y + r * 0.5f, x + r * 0.75f, y + r * 0.26f, x - r * 0.75f, y + r * 0.03f);
			m.Line(x - r * 0.4f, y - r * 0.03f, x - r * 0.12f, y + r * 0.02f, r * 0.06f, Gold);
			m.Line(x + r * 0.1f, y + r * 0.05f, x + r * 0.38f, y + r * 0.1f, r * 0.06f, Gold);
			Curve(m, x - r * 0.14f, y - r * 0.36f, x + r * 0.08f, y - r * 0.42f, x + r * 0.3f, y - r * 0.26f, r * 0.035f, Mint);
		}
		else
		{
			float num = 0.08f * (1f - blink) + 0.008f;
			m.Disc(x - r * 0.29f, y + r * 0.12f, r * 0.12f, r * num, Cream, 24);
			m.Disc(x + r * 0.28f, y + r * 0.12f, r * 0.12f, r * num, Cream, 24);
			Curve(m, x - r * 0.15f, y - r * 0.3f, x + r * 0.12f, y - r * 0.45f, x + r * 0.37f, y - r * 0.18f, r * 0.045f, Dark);
		}
	}

	internal static void GuardVeilCard(ArtMesh m, float w, float h, float time, int variant)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = w / h;
		float num2 = time % 3f;
		if (variant <= 2)
		{
			bool flag = variant == 2;
			Pigment c = (flag ? InkBlue : new Pigment(0.075f, 0.12f, 0.055f));
			m.Rect((0f - num) / 2f, -0.5f, num, 1f, c);
			for (int i = -2; i < 5; i++)
			{
				for (int j = -4; j < 5; j++)
				{
					float num3 = (float)j * 0.23f + (float)i * 0.11f;
					float num4 = (float)i * 0.23f;
					if (flag)
					{
						m.Polygon(new Pigment(0.045f, 0.11f, 0.13f), num3, num4, num3 + 0.15f, num4 + 0.1f, num3 + 0.3f, num4, num3 + 0.15f, num4 - 0.1f);
					}
					else
					{
						m.Ring(num3 + 0.018f * S(num2 * ((float)Math.PI * 2f) / 3f), num4, 0.115f, 0.035f, new Pigment(0.14f, 0.23f, 0.09f), 0.1f, (float)Math.PI * 4f / 5f, 26);
					}
				}
			}
			float num5 = UMath.Smooth((num2 - 0.55f) / 0.4f) * (1f - UMath.Smooth((num2 - 1.85f) / 0.65f));
			float num6 = (flag ? (-0.19f) : 0.17f);
			float num7 = (flag ? (-0.27f) : (-0.17f));
			float num8 = (flag ? 0.43f : 0.19f);
			int num9 = (flag ? 10 : 9);
			int num10 = 0;
			while (!flag && num10 < num9)
			{
				float num11 = (flag ? (0.08f + (float)num10 * 0.34f) : (0.35f + (float)num10 * 0.3f));
				float num12 = UMath.Smooth((num2 - 0.55f - (float)num10 * 0.018f) / 0.28f) * (1f - UMath.Smooth((num2 - 1.85f) / 0.65f));
				float length = (flag ? (0.19f + num5 * 0.06f) : (0.1f + num12 * (0.22f + 0.04f * (float)(num10 % 3))));
				Quill(m, num6 + C(num11) * num8 * 0.85f, num7 + S(num11) * num8 * 0.85f, num11, length, flag ? 0.07f : 0.045f, Mint, flag ? Jade : new Pigment(0.36f, 0.52f, 0.25f));
				num10++;
			}
			GuardFace(m, num6, num7, num8, UMath.Smooth((num2 - 1.42f) / 0.06f) * (1f - UMath.Smooth((num2 - 1.53f) / 0.07f)), flag);
			if (flag)
			{
				m.Ring(num6, num7, num8 + 0.025f, 0.015f, Mint, 0.05f, 2.6f, 56);
				m.Ring(num6, num7, num8 + 0.047f, 0.008f, Jade, 0.4f, 2.25f, 48);
				for (int k = 0; k < 3; k++)
				{
					float num13 = UMath.Smooth((num2 - 0.56f - (float)k * 0.08f) / 0.3f) * (1f - UMath.Smooth((num2 - 1.8f - (float)k * 0.07f) / 0.4f));
					float x = 0.66f - num13 * (0.37f + (float)k * 0.03f);
					float y = 0.31f - (float)k * 0.18f;
					Quill(m, x, y, -2.8f, 0.11f, 0.022f, Red, Orange);
				}
			}
		}
		else if (variant == 3)
		{
			m.Rect((0f - num) / 2f, -0.5f, num, 1f, InkBlue);
			for (int l = -5; l < 7; l++)
			{
				m.Line((float)l * 0.18f - 0.5f, -0.55f, (float)l * 0.18f + 0.5f, 0.55f, 0.01f, new Pigment(0.055f, 0.13f, 0.18f));
			}
			float num14 = UMath.Smooth((num2 - 0.5f) / 0.45f) * (1f - UMath.Smooth((num2 - 1.65f) / 0.7f));
			float num15 = 0.12f;
			float num16 = 0.03f;
			m.Ring(num15, num16, 0.255f, 0.009f, new Pigment(0.56f, 0.88f, 0.9f).Alpha(num14), 0.3f, 5.152212f, 64);
			m.Ring(num15 - 0.075f, num16 + 0.04f, 0.055f, 0.008f, Cream.Alpha(num14), 0.15f, 2.5f, 24);
			m.Disc(num15 + 0.08f, num16 + 0.05f, 0.021f, 0.038f, Cream.Alpha(num14), 24);
			Curve(m, num15 - 0.06f, num16 - 0.1f, num15 + 0.03f, num16 - 0.16f, num15 + 0.13f, num16 - 0.08f, 0.008f, Cream.Alpha(num14));
			float num17 = 0.1f * S(num2 * ((float)Math.PI * 2f) / 3f);
			for (int n = -2; n < 3; n++)
			{
				float num18 = (float)n * 0.4f + num17 + ((n % 2 == 0) ? ((0f - num14) * 0.13f) : (num14 * 0.13f));
				Pigment teal = Teal;
				float[] obj = new float[8] { 0f, -0.6f, 0f, -0.6f, 0f, 0.6f, 0f, 0.6f };
				obj[0] = num18 - 0.39f;
				obj[2] = num18 - 0.17f;
				obj[4] = num18 + 0.34f;
				obj[6] = num18 + 0.12f;
				m.Polygon(teal, obj);
				m.Line(num18 - 0.17f, -0.6f, num18 + 0.34f, 0.6f, 0.008f, new Pigment(0.16f, 0.43f, 0.46f));
			}
		}
		else
		{
			m.Rect((0f - num) / 2f, -0.5f, num, 1f, new Pigment(0.055f, 0.045f, 0.13f));
			for (int num19 = -4; num19 < 6; num19++)
			{
				float num20 = (float)num19 * 0.22f;
				m.Line(num20, -0.6f, num20 + 0.5f, 0.6f, 0.018f, new Pigment(0.11f, 0.09f, 0.23f));
			}
			float num21 = ((num2 < 0.78f) ? num2 : ((num2 < 1.8f) ? 0.78f : (0.78f * (1f - UMath.Smooth((num2 - 1.8f) / 1.2f)))));
			float num22 = -0.21f;
			float num23 = 0.21f;
			float num24 = 0.4f;
			m.Disc(num22, num23, num24, num24, Cream, 80);
			m.Disc(num22, num23, num24 * 0.87f, num24 * 0.87f, new Pigment(0.17f, 0.16f, 0.28f), 72);
			for (int num25 = 0; num25 < 12; num25++)
			{
				float a = (float)num25 * ((float)Math.PI * 2f) / 12f;
				m.Line(num22 + C(a) * num24 * 0.73f, num23 + S(a) * num24 * 0.73f, num22 + C(a) * num24 * 0.83f, num23 + S(a) * num24 * 0.83f, 0.011f, Cream);
			}
			float num26 = num21 * 2.8f + 0.25f;
			m.Line(num22, num23, num22 + C(num26) * num24 * 0.63f, num23 + S(num26) * num24 * 0.63f, 0.024f, Cream);
			m.Line(num22, num23, num22 + C((0f - num26) * 0.27f) * num24 * 0.42f, num23 + S((0f - num26) * 0.27f) * num24 * 0.42f, 0.035f, Cream);
			m.Disc(num22, num23, 0.029f, 0.029f, PeekPink, 26);
			float a2 = 0.7f + num21 * 1.4f;
			float num27 = 0.21f + C(a2) * 0.15f;
			float num28 = -0.26f + S(a2) * 0.12f;
			m.Line(num27 - 0.1f, num28 - 0.055f, num27 + 0.1f, num28 + 0.055f, 0.065f, PeekPink);
			m.Disc(num27 + 0.1f, num28 + 0.055f, 0.035f, 0.035f, Cream, 24);
			if (num2 > 0.88f && num2 < 1.8f)
			{
				float num29 = (num2 - 0.88f) / 0.92f;
				m.Line(-0.65f + num29 * 0.9f, -0.43f, -0.42f + num29 * 0.9f, -0.43f, 0.019f, PeekPink);
			}
			float num30 = UMath.Smooth((num2 - 2.4f) / 0.25f) * (1f - UMath.Smooth((num2 - 2.8f) / 0.2f));
			if (num30 > 0f)
			{
				m.Disc(-0.2f, 0.2f, num30 * 1.6f, num30 * 1.6f, InkBlue, 80);
			}
		}
	}

	internal static void GuardVeilIcon(ArtMesh m, float width, int variant)
	{
		float num = (0f - width) / 2f + 54f;
		m.Disc(num, 0f, 27f, 27f, Plate);
		switch (variant)
		{
		case 1:
		{
			for (int i = 0; i < 8; i++)
			{
				Quill(m, num + C((float)i * ((float)Math.PI * 2f) / 8f) * 13f, S((float)i * ((float)Math.PI * 2f) / 8f) * 13f, (float)i * ((float)Math.PI * 2f) / 8f, 11f, 4f, Mint, Jade);
			}
			m.Disc(num, 0f, 14f, 14f, Jade, 32);
			break;
		}
		case 2:
			m.Disc(num, 0f, 20f, 20f, Jade);
			m.Ring(num, 0f, 23f, 2f, Mint, 0f, (float)Math.PI * 2f, 48);
			m.Line(num - 12f, 6f, num + 12f, 6f, 4f, Mint);
			break;
		case 3:
			m.Ring(num, 0f, 19f, 2f, new Pigment(0.6f, 0.9f, 0.94f), 0.35f, 5.0265484f, 48);
			m.Disc(num - 6f, 3f, 2f, 4f, Cream, 16);
			m.Disc(num + 6f, 3f, 2f, 4f, Cream, 16);
			break;
		default:
			m.Ring(num, 0f, 20f, 2f, Cream, 0f, (float)Math.PI * 2f, 48);
			m.Line(num, 0f, num - 1f, 13f, 2f, Cream);
			m.Line(num, 0f, num + 10f, -6f, 2f, PeekPink);
			break;
		}
	}

	internal static void SpikeCorona(ArtMesh m, float radius, float time, bool fortress)
	{
		m.Clear();
		float num = radius * 1.12f;
		for (int i = 0; i < 12; i++)
		{
			float num2 = (float)i * ((float)Math.PI * 2f) / 12f;
			Quill(m, C(num2) * num, S(num2) * num, num2, num * (fortress ? 0.44f : 0.3f), num * 0.11f, Mint, fortress ? Cream : Jade);
		}
		m.Ring(0f, 0f, num, 0.035f, Jade.Alpha(0.55f), 0f, (float)Math.PI * 2f, 72);
	}

	internal static void VeilOutline(ArtMesh m, float rx, float ry)
	{
		m.Clear();
		int num = 64;
		for (int i = 0; i < num; i++)
		{
			float a = (float)i * ((float)Math.PI * 2f) / (float)num;
			float a2 = (float)(i + 1) * ((float)Math.PI * 2f) / (float)num;
			m.Line(C(a) * rx, S(a) * ry, C(a2) * rx, S(a2) * ry, 0.025f, new Pigment(0.6f, 0.87f, 0.94f, 0.65f));
		}
	}

	internal static void FortressShell(ArtMesh m, float radius, float time)
	{
		m.Clear();
		float num = radius * 1.1f;
		m.Ring(0f, 0f, num, 0.035f, Mint.Alpha(0.72f), 0.15f, 4.9008846f, 72);
		m.Ring(0f, 0f, num * 1.06f, 0.018f, Jade.Alpha(0.5f), 3.5f, 2.5f, 48);
	}

	internal static void FrozenField(ArtMesh m, float left, float right, float bottom, float top, float seconds)
	{
		m.Clear();
		m.Rect(left, bottom, right - left, top - bottom, new Pigment(0.11f, 0.09f, 0.24f, 0.12f));
		float num = (left + right) / 2f;
		float num2 = (bottom + top) / 2f;
		float num3 = (top - bottom) * 0.48f;
		m.Ring(num, num2, num3, 0.055f, new Pigment(0.63f, 0.67f, 0.9f, 0.12f), 0.3f, 4.523894f, 96);
		for (int i = 0; i < 32; i++)
		{
			float a = (float)i * ((float)Math.PI * 2f) / 32f;
			m.Line(num + C(a) * num3, num2 + S(a) * num3, num + C(a) * (num3 - 0.25f), num2 + S(a) * (num3 - 0.25f), 0.04f, Cream.Alpha(0.22f));
		}
		float num4 = UMath.Sat(seconds / 7f);
		m.Ring(num, num2, num3 + 0.35f, 0.07f, PeekPink.Alpha(0.3f), 1.57f, (float)Math.PI * -2f * num4, 96);
	}

	private static void Curve(ArtMesh m, float x0, float y0, float cx, float cy, float x1, float y1, float width, Pigment color)
	{
		float x2 = x0;
		float y2 = y0;
		for (int i = 1; i <= 16; i++)
		{
			float num = (float)i / 16f;
			float num2 = 1f - num;
			float num3 = num2 * num2 * x0 + 2f * num2 * num * cx + num * num * x1;
			float num4 = num2 * num2 * y0 + 2f * num2 * num * cy + num * num * y1;
			m.Line(x2, y2, num3, num4, width, color);
			m.Disc(num3, num4, width * 0.5f, width * 0.5f, color, 10);
			x2 = num3;
			y2 = num4;
		}
	}

	private static void PeekFace(ArtMesh m, float x, float y, float r, bool boom, float gaze)
	{
		Pigment c = (boom ? Orange : PeekPink);
		m.Disc(x, y, r, r, c, 64);
		m.Disc(x - r * 0.32f, y + r * 0.17f, r * 0.17f, r * 0.23f, Cream, 28);
		m.Disc(x + r * 0.31f, y + r * 0.17f, r * 0.17f, r * 0.23f, Cream, 28);
		m.Disc(x - r * 0.32f + gaze * r, y + r * 0.17f, r * 0.064f, r * 0.09f, Dark, 18);
		m.Disc(x + r * 0.31f + gaze * r, y + r * 0.17f, r * 0.064f, r * 0.09f, Dark, 18);
		if (boom)
		{
			m.Disc(x + r * 0.05f, y - r * 0.38f, r * 0.31f, r * 0.19f, Dark, 32);
			for (int i = 0; i < 3; i++)
			{
				m.Rect(x - r * 0.15f + (float)i * r * 0.15f, y - r * 0.3f, r * 0.12f, r * 0.08f, Cream);
			}
			Curve(m, x - r * 0.48f, y + r * 0.48f, x - r * 0.28f, y + r * 0.66f, x - r * 0.13f, y + r * 0.51f, r * 0.055f, Dark);
			Curve(m, x + r * 0.12f, y + r * 0.55f, x + r * 0.34f, y + r * 0.7f, x + r * 0.49f, y + r * 0.47f, r * 0.055f, Dark);
		}
		else
		{
			Curve(m, x - r * 0.22f, y - r * 0.35f, x + r * 0.02f, y - r * 0.56f, x + r * 0.29f, y - r * 0.27f, r * 0.055f, Dark);
		}
	}

	internal static void PeekCard(ArtMesh m, float w, float h, float time, bool boom)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = w / h;
		float num2 = time % 3f;
		float num3 = UMath.Smooth((num2 - 0.6f) / 0.28f) * (1f - UMath.Smooth((num2 - 1.9f) / 0.8f));
		m.Rect((0f - num) / 2f, -0.5f, num, 1f, boom ? new Pigment(0.15f, 0.035f, 0.04f) : new Pigment(0.1f, 0.025f, 0.13f));
		if (boom)
		{
			for (int i = 0; i < 11; i++)
			{
				float num4 = (float)i * ((float)Math.PI * 2f) / 11f;
				float num5 = 0.5f + UMath.Noise(i * 89) * 0.6f;
				m.Polygon(new Pigment(0.29f, 0.065f, 0.06f), 0.23f, -0.15f, 0.23f + C(num4) * num5, -0.15f + S(num4) * num5, 0.23f + C(num4 + 0.21f) * num5, -0.15f + S(num4 + 0.21f) * num5);
			}
			for (int j = 0; j < 8; j++)
			{
				float num6 = (float)j * ((float)Math.PI * 2f) / 8f;
				float num7 = 0.35f + num3 * 0.35f;
				m.Polygon(Cream.Alpha(num3 * 0.7f), 0.23f + C(num6) * 0.27f, -0.15f + S(num6) * 0.27f, 0.23f + C(num6) * num7, -0.15f + S(num6) * num7, 0.23f + C(num6 + 0.1f) * num7, -0.15f + S(num6 + 0.1f) * num7);
			}
			float num8 = 0.065f + num3 * 0.36f;
			float x = -0.33f + num3 * 0.48f;
			float y = -0.26f + num3 * 0.25f;
			m.Ring(x, y, num8 + 0.04f, 0.012f, PeekPink.Alpha(1f - num3), 0f, (float)Math.PI * 2f, 48);
			PeekFace(m, x, y, num8, boom: true, 0.025f * S(num2 * ((float)Math.PI * 2f) / 3f));
			return;
		}
		for (int k = 0; k < 4; k++)
		{
			for (int l = 0; l < 6; l++)
			{
				m.Ring((0f - num) / 2f + (float)l * 0.28f + (float)(k % 2) * 0.14f, -0.46f + (float)k * 0.3f, 0.1f, 0.035f, new Pigment(0.23f, 0.055f, 0.25f), 0.2f, 5.340708f, 32);
			}
		}
		float num9 = 0.1f + num3 * 0.3f;
		Curve(m, -0.2f, -0.16f, -0.49f, -0.02f, 0f - num9, 0.09f, 0.019f, PeekPink);
		Curve(m, 0.2f, -0.16f, 0.49f, -0.02f, num9, 0.09f, 0.019f, PeekPink);
		for (int n = 0; n < 2; n++)
		{
			m.Ring(0f, -0.03f, 0.31f + num3 * (0.11f + (float)n * 0.12f), 0.012f, Cream.Alpha(num3 * 0.3f), 0.1f + (float)n, 4.2097344f, 56);
		}
		PeekFace(m, 0f, -0.03f, 0.285f, boom: false, 0.055f * S(num2 * ((float)Math.PI * 2f) / 3f));
		m.Disc(0f - num9, 0.09f, 0.1f, 0.16f, Cream, 36);
		m.Disc(num9, 0.09f, 0.1f, 0.16f, Cream, 36);
		m.Disc(0f - num9 + 0.045f, -0.005f, 0.055f, 0.07f, Cream, 24);
		m.Disc(num9 - 0.045f, -0.005f, 0.055f, 0.07f, Cream, 24);
	}

	internal static void PeekIcon(ArtMesh m, float width, bool boom)
	{
		float x = (0f - width) / 2f + 54f;
		m.Disc(x, 0f, 24f, 24f, Plate);
		PeekFace(m, x, 0f, 19f, boom, 0f);
	}

	internal static void PeekArrival(ArtMesh m, float time, bool boom, bool departure)
	{
		m.Clear();
		float num = UMath.Sat(time / 0.6f);
		float num2 = (departure ? (1.2f * (1f - num)) : (0.8f + UMath.Out(num) * (boom ? 2.2f : 1.2f)));
		m.Ring(0f, 0f, num2, 0.08f * (1f - num) + 0.01f, (boom ? Orange : PeekPink).Alpha(1f - num), num * 2f, 5.215044f, 64);
		m.Ring(0f, 0f, num2 * 0.8f, 0.035f, Cream.Alpha((1f - num) * 0.6f), (0f - num) * 3f, 4.08407f, 56);
		if (boom && !departure)
		{
			MissileBlast(m, 0f, 0f, 3f, time, 7919);
		}
	}

	internal static void MissileWarning(ArtMesh m, float x, float y, float nx, float ny, float age, float launchAt)
	{
		if (!(age >= launchAt))
		{
			x += nx * 1.5f;
			y += ny * 1.5f;
			m.Polygon(Red, x, y + 0.8f, x - 0.75f, y - 0.55f, x + 0.75f, y - 0.55f);
			m.Line(x, y + 0.43f, x, y - 0.04f, 0.12f, Cream);
			m.Disc(x, y - 0.29f, 0.075f, 0.075f, Cream, 18);
			float a = 0.55f + 0.45f * S(age * 16f);
			for (int i = 0; i < 2; i++)
			{
				float num = 1.2f + (float)i * 0.55f;
				float num2 = x + nx * num;
				float num3 = y + ny * num;
				m.Line(num2 - nx * 0.2f - ny * 0.2f, num3 - ny * 0.2f + nx * 0.2f, num2, num3, 0.07f, Red.Alpha(a));
				m.Line(num2, num3, num2 - nx * 0.2f + ny * 0.2f, num3 - ny * 0.2f - nx * 0.2f, 0.07f, Red.Alpha(a));
			}
		}
	}

	internal static void RainFlyingBullet(ArtMesh m, float x, float y, float size, bool upgraded, float vx, float vy)
	{
		int count = m.Vertices.Count;
		RainBullet(m, 0f, 0f, size, upgraded, bright: true);
		float num = UMath.Sqrt(vx * vx + vy * vy);
		if (num < 0.001f)
		{
			num = 1f;
		}
		float num2 = vx / num;
		float num3 = vy / num;
		for (int i = count; i < m.Vertices.Count; i++)
		{
			ArtVertex value = m.Vertices[i];
			float x2 = value.X;
			float y2 = value.Y;
			value.X = x - num3 * x2 - num2 * y2;
			value.Y = y + num2 * x2 - num3 * y2;
			m.Vertices[i] = value;
		}
	}

	internal static void RainCast(ArtMesh m, float time, bool upgraded)
	{
		m.Clear();
		float num = UMath.Sat(time / 0.5f);
		float num2 = UMath.Smooth(num);
		Pigment c = (upgraded ? Orange : Gold);
		float num3 = 2.3f - num2 * 0.6f;
		m.Ring(0f, 0f, num3, 0.055f, c.Alpha(0.75f), num * 3f, 4.523894f, 64);
		m.Ring(0f, 0f, num3 + 0.17f, 0.025f, c.Alpha(0.35f), (0f - num) * 4f, (float)Math.PI * 4f / 5f, 48);
		for (int i = 0; i < 3; i++)
		{
			float num4 = (float)(i - 1) * 0.7f;
			float num5 = 2.5f + (0.5f - 0.5f * C(num * ((float)Math.PI * 2f))) * 0.6f - num2 * 0.45f;
			m.Line(num4 - 0.25f, num5 + 0.25f, num4, num5, 0.09f, c);
			m.Line(num4, num5, num4 + 0.25f, num5 + 0.25f, 0.09f, c);
			m.Line(num4, num5 + 0.75f, num4, num5 + 0.4f, 0.035f, Cream.Alpha(num));
		}
		if (num > 0.8f)
		{
			float num6 = (num - 0.8f) * 5f;
			m.Ring(0f, 0f, 1.2f + num6 * 0.6f, 0.06f, Cream.Alpha(1f - num6 * 0.5f), 0f, (float)Math.PI * 2f, 64);
		}
	}

	internal static void RainBullet(ArtMesh m, float x, float y, float size, bool upgraded, bool bright = false)
	{
		Pigment c = ((upgraded && !bright) ? Orange : Cream);
		Pigment c2 = ((!upgraded) ? Gold : (bright ? Orange : Red));
		m.Line(x, y + size * 0.4f, x, y + size * 5f, size * 0.18f, c2.Alpha(0.25f));
		m.Line(x, y + size * 0.4f, x, y + size * 3.5f, size * 0.065f, c.Alpha(0.7f));
		m.Rect(x - size * 0.22f, y, size * 0.44f, size * 1.25f, c2);
		if (upgraded)
		{
			m.Polygon(c, x - size * 0.23f, y, x, y - size * 0.6f, x + size * 0.23f, y);
			for (int i = 0; i < 3; i++)
			{
				m.Line(x - size * 0.2f, y + size * (0.3f + (float)i * 0.28f), x + size * 0.2f, y + size * (0.15f + (float)i * 0.28f), size * 0.09f, c);
			}
		}
		else
		{
			m.Disc(x, y, size * 0.22f, size * 0.35f, c, 16);
		}
	}

	internal static void RainImpact(ArtMesh m, float x, float y, float age, bool upgraded, float scale = 1f)
	{
		float num = UMath.Sat(age / 0.45f);
		float num2 = (upgraded ? 3.5f : 0.8f) * UMath.Out(num) * scale;
		m.Ring(x, y, num2, (0.025f + (1f - num) * 0.08f) * scale, (upgraded ? Orange : Gold).Alpha(1f - num), 0f, (float)Math.PI * 2f, 48);
		if (upgraded)
		{
			for (int i = 0; i < 6; i++)
			{
				float a = (float)i * ((float)Math.PI * 2f) / 6f;
				m.Disc(x + C(a) * num2 * 0.28f, y + S(a) * num2 * 0.28f, num2 * 0.22f, num2 * 0.22f, Red.Alpha((1f - num) * 0.5f), 18);
			}
		}
		if (upgraded)
		{
			m.Ring(x, y, num2 * 0.7f, (0.07f * (1f - num) + 0.015f) * scale, Cream.Alpha((1f - num) * 0.75f), 0.3f, 4.775221f, 48);
			for (int j = 0; j < 8; j++)
			{
				float a2 = (float)j * ((float)Math.PI * 2f) / 8f + 0.17f;
				m.Line(x + C(a2) * num2 * 0.55f, y + S(a2) * num2 * 0.55f, x + C(a2) * num2 * 0.95f, y + S(a2) * num2 * 0.95f, (0.045f * (1f - num) + 0.012f) * scale, Orange.Alpha(1f - num));
			}
		}
		m.Disc(x, y, num2 * 0.2f, num2 * 0.2f, Cream.Alpha(1f - UMath.Sat(age / 0.2f)), 20);
		for (int k = 0; k < 5; k++)
		{
			float a3 = (float)k * ((float)Math.PI * 2f) / 5f;
			m.Line(x + C(a3) * num2 * 0.4f, y + S(a3) * num2 * 0.4f, x + C(a3) * num2 * 0.7f, y + S(a3) * num2 * 0.7f, 0.025f, Cream.Alpha(1f - num));
		}
	}

	internal static void RainIcon(ArtMesh m, float width, bool upgraded)
	{
		float num = (0f - width) / 2f + 54f;
		m.Disc(num, 0f, 24f, 24f, Plate);
		for (int i = 0; i < 3; i++)
		{
			RainBullet(m, num + (float)((i - 1) * 12), -7 + i % 2 * 8, 4f, upgraded);
		}
	}

	internal static void DecayGlow(ArtMesh m, float radius, float time)
	{
		m.Clear();
		m.Space(0f, 0f, radius, radius);
		Pigment violet = SupernovaPalette.Violet;
		float num = 0.5f + 0.5f * S(time * 9f);
		m.Disc(0f, 0f, 1.15f, 1.15f, violet.Alpha(0.035f + 0.035f * num), 48);
		m.Ring(0f, 0f, 1.05f + 0.04f * num, 0.035f, violet.Alpha(0.15f + 0.15f * num), 0f, (float)Math.PI * 2f, 64);
		for (int i = 0; i < 4; i++)
		{
			float a = time * 1.7f + (float)i * ((float)Math.PI * 2f) / 4f;
			m.Disc(C(a) * 1.1f, S(a) * 1.1f, 0.025f, 0.025f, SupernovaPalette.Pink.Alpha(0.6f), 12);
		}
	}

	internal static void RainCard(ArtMesh m, float w, float h, float time, bool upgraded)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = time % 3f;
		float num2 = w / h;
		Pigment pigment = (upgraded ? new Pigment(0.25f, 0.09f, 0.07f) : new Pigment(0.12f, 0.19f, 0.21f));
		Pigment c = (upgraded ? Red : Gold);
		m.Rect((0f - num2) / 2f, -0.5f, num2, 1f, Dark);
		for (int i = 0; i < 9; i++)
		{
			float num3 = (0f - num2) / 2f + (float)i * num2 / 8f;
			Pigment c2 = pigment.Alpha(0.7f);
			float[] obj = new float[8] { 0f, -0.5f, 0f, -0.5f, 0f, 0.5f, 0f, 0.5f };
			obj[0] = num3 - 0.07f;
			obj[2] = num3 - 0.025f;
			obj[4] = num3 + 0.13f;
			obj[6] = num3 + 0.075f;
			m.Polygon(c2, obj);
			for (int j = 0; j < 5; j++)
			{
				m.Line(num3 + 0.01f, -0.45f + (float)j * 0.23f, num3 + 0.035f, -0.4f + (float)j * 0.23f, 0.004f, c.Alpha(0.13f));
			}
		}
		for (int k = 0; k < 3; k++)
		{
			float num4 = num - (float)k * 0.16f;
			float num5 = ((k == 1) ? 0.24f : 0.16f);
			float num6 = 0.34f - UMath.Smooth((num4 + 0.12f) / 1.8f) * 1.17f;
			float num7 = (0f - num2) * 0.34f + (float)k * num2 * 0.34f;
			if (num6 > -0.75f)
			{
				RainBullet(m, num7, num6, num5, upgraded);
				m.Rect(num7 - num5 * 0.14f, num6 + num5 * 0.25f, num5 * 0.055f, num5 * 0.85f, Cream.Alpha(0.6f));
				m.Line(num7 - num5 * 0.3f, num6 + num5 * 1.08f, num7 + num5 * 0.3f, num6 + num5 * 1.08f, num5 * 0.09f, c);
				m.Line(num7 - num5 * 0.3f, num6 + num5 * 1.3f, num7 + num5 * 0.3f, num6 + num5 * 1.3f, num5 * 0.1f, Cream.Alpha(0.75f));
			}
		}
		Pigment c3 = pigment;
		float[] obj2 = new float[8] { 0f, 0.5f, 0f, 0.5f, 0f, 0.23f, 0f, 0.4f };
		obj2[0] = (0f - num2) / 2f;
		obj2[2] = num2 / 2f;
		obj2[4] = num2 / 2f;
		obj2[6] = (0f - num2) / 2f;
		m.Polygon(c3, obj2);
		m.Line((0f - num2) / 2f, 0.38f, num2 / 2f, 0.21f, 0.008f, upgraded ? Red : Gold);
		for (int l = 0; l < 8; l++)
		{
			float num8 = num - (float)l * 0.11f;
			if (!(num8 < 0f) && !(num8 > 1.15f))
			{
				float x = (0f - num2) / 2f + 0.08f + (float)l * (num2 - 0.16f) / 7f;
				float y = 0.62f - num8 * 1.1f;
				RainBullet(m, x, y, (l % 3 == 0) ? 0.045f : 0.022f, upgraded);
			}
		}
		if (num > 1.1f && num < 2.5f)
		{
			float num9 = (num - 1.1f) / 1.4f;
			if (upgraded)
			{
				RainImpact(m, num2 * 0.25f, -0.3f, num9 * 0.45f, upgraded: true, 0.1f);
			}
			else
			{
				for (int n = 0; n < 3; n++)
				{
					m.Ring((0f - num2) * 0.2f + (float)n * 0.22f, -0.32f, 0.05f + num9 * 0.1f, 0.005f, Gold.Alpha(1f - num9), 0f, (float)Math.PI * 2f, 40);
				}
			}
			m.Polygon(pigment.Alpha(1f - num9), (0f - num2) / 2f, -0.5f, num2 / 2f, -0.5f, num2 / 2f, -0.43f + num9 * 0.12f, (0f - num2) / 2f, -0.28f - num9 * 0.1f);
			m.Line((0f - num2) / 2f, -0.28f - num9 * 0.1f, num2 / 2f, -0.43f + num9 * 0.12f, 0.006f, c.Alpha(1f - num9));
		}
		float num10 = Math.Max(1f - UMath.Smooth(num / 0.18f), UMath.Smooth((num - 2.5f) / 0.5f));
		m.Rect((0f - num2) / 2f, -0.5f, num2 * num10, 1f, Dark);
		m.Rect((0f - num2) / 2f + 0.05f, -0.46f, 0.12f, 0.008f, upgraded ? Red : Gold);
	}

	internal static void Missile(ArtMesh m, float x, float y, float size, float angle, bool locked, float time)
	{
		float co = C(angle);
		float si = S(angle);
		Action<Pigment, float[]> action = delegate(Pigment color, float[] p)
		{
			float[] array = new float[p.Length];
			for (int i = 0; i < p.Length; i += 2)
			{
				array[i] = x + size * (p[i] * co - p[i + 1] * si);
				array[i + 1] = y + size * (p[i] * si + p[i + 1] * co);
			}
			m.Polygon(color, array);
		};
		float num = (locked ? 1.4f : 0.75f) * (0.85f + 0.15f * S(time * 47f));
		Pigment arg = Orange.Alpha(0.65f);
		float[] obj = new float[6] { -0.65f, -0.15f, -0.65f, 0.15f, 0f, 0f };
		obj[4] = -0.75f - num;
		action(arg, obj);
		Pigment cream = Cream;
		float[] obj2 = new float[6] { -0.7f, -0.07f, -0.7f, 0.07f, 0f, 0f };
		obj2[4] = -0.7f - num * 0.65f;
		action(cream, obj2);
		action(Graphite, new float[8] { -0.65f, 0.16f, -1.02f, 0.57f, -0.9f, 0.14f, -0.15f, 0.1f });
		action(Graphite, new float[8] { -0.65f, -0.16f, -1.02f, -0.57f, -0.9f, -0.14f, -0.15f, -0.1f });
		action(new Pigment(0.35f, 0.43f, 0.44f), new float[10] { -0.8f, -0.2f, 0.48f, -0.2f, 0.91f, 0f, 0.48f, 0.2f, -0.8f, 0.2f });
		action(Graphite, new float[8] { -0.8f, -0.2f, 0.48f, -0.2f, 0.91f, 0f, -0.8f, 0f });
		action(Orange, new float[8] { -0.48f, -0.2f, -0.28f, -0.2f, -0.28f, 0.2f, -0.48f, 0.2f });
		action(locked ? Cream : Red, new float[8] { 0.48f, -0.19f, 0.91f, 0f, 0.48f, 0.19f, 0.35f, 0f });
		action(Cream.Alpha(0.75f), new float[8] { -0.15f, 0.11f, 0.32f, 0.11f, 0.47f, 0.065f, -0.15f, 0.065f });
	}

	internal static void TargetReticle(ArtMesh m, float x, float y, float time, bool valid, bool orbital)
	{
		Pigment c = ((!valid) ? Red : (orbital ? Cyan : Gold));
		float r = 1.05f + 0.06f * S(time * 6f);
		for (int i = 0; i < 4; i++)
		{
			float num = (float)i * ((float)Math.PI * 2f) / 4f + 0.15f;
			m.Ring(x, y, r, 0.055f, c, num, 0.87964594f, 40);
			m.Line(x + C(num) * 1.3f, y + S(num) * 1.3f, x + C(num) * 1.7f, y + S(num) * 1.7f, 0.045f, c);
		}
		m.Disc(x, y, 0.08f, 0.08f, Cream, 16);
	}

	internal static void MissileBlast(ArtMesh m, float x, float y, float radius, float time, int seed)
	{
		float num = UMath.Sat(time / 0.65f);
		float num2 = radius * UMath.Out(num);
		float num3 = 1f - UMath.Sat(time / 1.1f);
		m.Ring(x, y, num2, 0.035f + 0.2f * (1f - num), Cream.Alpha((1f - num) * 0.8f), 0.1f, 5.2778754f, 72);
		m.Ring(x, y, num2 * 0.86f, 0.08f, Orange.Alpha(num3 * 0.6f), 1.2f, 4.523894f, 64);
		for (int i = 0; i < 9; i++)
		{
			float a = (float)i * ((float)Math.PI * 2f) / 9f;
			float num4 = 0.6f + UMath.Noise(seed + i * 17) * 0.5f;
			float x2 = x + C(a) * num2 * 0.35f * num4;
			float num5 = y + S(a) * num2 * 0.35f + time * 0.6f;
			m.Disc(x2, num5, num2 * 0.19f, num2 * 0.16f, Smoke.Alpha(num3 * 0.7f), 20);
			m.Disc(x2, num5 - 0.1f, num2 * 0.14f, num2 * 0.1f, Red.Alpha(num3 * 0.45f), 18);
			float num6 = num2 * (0.65f + UMath.Noise(seed + i * 43) * 0.4f);
			m.Line(x + C(a) * num6 * 0.78f, y + S(a) * num6 * 0.78f, x + C(a) * num6, y + S(a) * num6, 0.035f, Cream.Alpha(num3));
		}
		float num7 = 1f - UMath.Sat(time / 0.22f);
		m.Disc(x, y, radius * 0.25f * num7, radius * 0.25f * num7, Cream.Alpha(num7), 32);
	}

	internal static void OrbitalBeam(ArtMesh m, float left, float right, float bottom, float top, float x, float y, float age)
	{
		float num = (right - left) * 0.2f;
		float num2 = (right - left) * 0.0012f;
		if (age < 0.5f)
		{
			float num3 = UMath.Sat(age / 0.5f);
			float num4 = UMath.Smooth(age / 0.08f);
			m.Rect(x - num / 2f, bottom, num, top - bottom, Cyan.Alpha((0.045f + 0.06f * num3) * num4));
			for (int i = -1; i <= 1; i += 2)
			{
				m.Line(x + (float)i * num / 2f, bottom, x + (float)i * num / 2f, top, num2, Cyan.Alpha(0.7f * num4));
			}
			for (int j = 0; j < 10; j++)
			{
				float num5 = bottom + (top - bottom) * ((float)j + 0.5f) / 10f;
				m.Line(x - num * 0.45f, num5, x - num * 0.25f, num5 + (top - bottom) * 0.025f, num2, Cyan.Alpha(0.35f * num4));
				m.Line(x + num * 0.45f, num5, x + num * 0.25f, num5 + (top - bottom) * 0.025f, num2, Cyan.Alpha(0.35f * num4));
			}
			float r = num * 0.22f * (1f - num3 * 0.35f);
			m.Ring(x, y, r, num2, Cream.Alpha(0.75f * num4), age * 4f, 5.0265484f, 48);
			return;
		}
		StrikeRules.Band(age, bottom, top, out var low, out var high);
		if (high <= low)
		{
			return;
		}
		float num6 = high - low;
		m.Rect(x - num * 0.54f, low, num * 1.08f, num6, Cyan.Alpha(0.08f));
		m.Rect(x - num / 2f, low, num, num6, Cyan.Alpha(0.16f));
		for (int k = 0; k < 24; k++)
		{
			float num7 = low + num6 * (float)k / 24f;
			float num8 = low + num6 * (float)(k + 1) / 24f;
			float num9 = x + S(num7 / (top - bottom) * 28f + age * 17f) * num * 0.035f;
			float num10 = x + S(num8 / (top - bottom) * 28f + age * 17f) * num * 0.035f;
			float num11 = num * (0.1f + 0.015f * S(age * 31f + (float)k * 0.8f));
			float num12 = num * (0.1f + 0.015f * S(age * 31f + (float)(k + 1) * 0.8f));
			m.Polygon(Ice.Alpha(0.78f), num9 - num11, num7, num9 + num11, num7, num10 + num12, num8, num10 - num12, num8);
		}
		m.Line(x - num / 2f, low, x - num / 2f, high, num2 * 1.8f, Ice.Alpha(0.8f));
		m.Line(x + num / 2f, low, x + num / 2f, high, num2 * 1.8f, Ice.Alpha(0.8f));
		for (int l = 0; l < 9; l++)
		{
			float num13 = UMath.Frac((float)l / 9f - age * 0.63f);
			float num14 = bottom + num13 * (top - bottom);
			if (!(num14 < low) && !(num14 > high))
			{
				float num15 = x + (UMath.Noise(l * 31 + (int)(age * 12f)) - 0.5f) * num * 0.65f;
				float y2 = Math.Max(low, num14 - (top - bottom) * 0.035f);
				float yy = Math.Min(high, num14 + (top - bottom) * 0.04f);
				m.Line(num15, y2, x + num * 0.08f, num14, num2 * 0.65f, Ice.Alpha(0.8f));
				m.Line(x + num * 0.08f, num14, num15 - num * 0.07f, yy, num2 * 0.65f, Ice.Alpha(0.8f));
				float y3 = Math.Max(low, num14 - (top - bottom) * 0.055f);
				m.Line(x + num * 0.32f, y3, x + num * 0.32f, num14, num2 * 1.4f, Cyan.Alpha(0.8f));
			}
		}
		float num16 = ((age < 1f) ? low : high);
		m.Rect(x - num * 0.54f, num16 - num2 * 2f, num * 1.08f, num2 * 4f, Ice.Alpha(0.85f));
	}

	internal static void StrikeIcon(ArtMesh m, float width, bool orbital)
	{
		float num = (0f - width) / 2f + 54f;
		m.Disc(num, 0f, 24f, 24f, Plate);
		if (orbital)
		{
			m.Rect(num - 4f, -21f, 8f, 36f, Cyan);
			m.Ring(num, 12f, 17f, 4f, Ice, 0.15f, 5.0265484f, 40);
		}
		else
		{
			Missile(m, num, 0f, 17f, 0.5f, locked: true, 0f);
		}
	}

	internal static void HeatCard(ArtMesh m, float w, float h, float time)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = w / h;
		float num2 = time % 3f;
		m.Rect((0f - num) / 2f, -0.5f, num, 1f, new Pigment(0.07f, 0.115f, 0.13f));
		for (int i = 0; i < 8; i++)
		{
			m.Ring((0f - num) * 0.36f, 0.37f, 0.12f + (float)i * 0.105f, 0.004f, new Pigment(0.19f, 0.29f, 0.3f), 0.4f + (float)i * 0.06f, 4.3982296f, 52);
		}
		for (int j = 0; j < 5; j++)
		{
			m.Line((0f - num) / 2f + (float)j * 0.3f, -0.5f, (0f - num) / 2f + (float)j * 0.3f + 0.13f, 0.5f, 0.006f, Graphite.Alpha(0.8f));
		}
		float num3 = ((num2 < 1.7f) ? (UMath.Smooth((num2 - 0.9f) / 0.7f) * num * 1.8f) : 0f);
		float num4 = ((num2 < 1.7f) ? (UMath.Smooth((num2 - 1.1f) / 0.65f) * num * 1.8f) : 0f);
		Missile(m, (0f - num) * 0.3f + num4, -0.27f + num4 * 0.18f, 0.19f, 0.27f, num2 > 0.8f && num2 < 1.7f, num2 * ((float)Math.PI * 2f) * 2f / 47f);
		Missile(m, -0.03f + num3, 0.04f + num3 * 0.3f, 0.44f, 0.28f, num2 > 0.7f && num2 < 1.7f, num2 * ((float)Math.PI * 2f) * 2f / 47f);
		float num5 = UMath.Smooth((num2 - 0.6f) / 0.22f) * (1f - UMath.Smooth((num2 - 1f) / 0.15f));
		if (num5 > 0f)
		{
			m.Ring(0.39f, 0.17f, 0.11f, 0.005f, Red.Alpha(num5), 0f, 4.9008846f, 40);
			m.Line(0.28f, 0.17f, 0.5f, 0.17f, 0.004f, Cream.Alpha(num5));
		}
		float num6 = UMath.Smooth((num2 - 1.35f) / 0.35f) * (1f - UMath.Smooth((num2 - 2.05f) / 0.65f));
		m.Rect((0f - num) / 2f, -0.5f, num * num6, 1f, Dark);
		m.Line((0f - num) / 2f + num * num6, -0.5f, (0f - num) / 2f + num * num6, 0.5f, 0.009f, Orange.Alpha(num6));
	}

	internal static void OrbitalCard(ArtMesh m, float w, float h, float time)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = w / h;
		float num2 = time % 3f;
		m.Rect((0f - num) / 2f, -0.5f, num, 1f, new Pigment(0.025f, 0.07f, 0.14f));
		for (int i = 0; i < 5; i++)
		{
			float num3 = (0f - num) / 2f + (float)i * 0.3f;
			m.Line(num3, -0.5f, num3 + 0.4f, 0.5f, 0.003f, new Pigment(0.1f, 0.18f, 0.26f));
		}
		m.Ring((0f - num) * 0.4f, 0.1f, 0.65f, 0.02f, new Pigment(0.05f, 0.13f, 0.22f), -0.6f, 3.6f, 64);
		float age = ((num2 < 0.55f) ? (num2 / 0.55f * 0.5f) : ((num2 < 0.8f) ? (0.5f + (num2 - 0.55f) / 0.25f * 0.5f) : ((num2 < 1.85f) ? (1f + (num2 - 0.8f) / 1.05f * 3f) : ((num2 < 2.2f) ? (4f + (num2 - 1.85f) / 0.35f * 0.5f) : 5f))));
		OrbitalBeam(m, (0f - num) / 2f, num / 2f, -0.46f, 0.31f, 0.15f, -0.2f, age);
		Pigment graphite = Graphite;
		float[] obj = new float[12]
		{
			0f, -0.5f, 0f, -0.5f, 0f, -0.43f, 0.1f, -0.45f, -0.2f, -0.39f,
			0f, -0.41f
		};
		obj[0] = (0f - num) / 2f;
		obj[2] = num / 2f;
		obj[4] = num / 2f;
		obj[10] = (0f - num) / 2f;
		m.Polygon(graphite, obj);
		float num4 = UMath.Smooth(num2 / 0.55f) * (1f - UMath.Smooth((num2 - 2.2f) / 0.8f));
		m.Ring(0.15f, 0.34f, 0.26f, 0.065f, Graphite, 0.05f + num4 * 0.12f, 5.152212f, 56);
		m.Ring(0.15f, 0.34f, 0.2f, 0.018f, Cyan.Alpha(0.7f), 0.2f - num4 * 0.2f, 4.712389f, 56);
		m.Rect(0.11f, 0.27f, 0.08f, 0.11f, Ice);
		m.Polygon(Graphite, -0.05f, 0.5f, 0.35f, 0.5f, 0.3f, 0.39f, 0.02f, 0.39f);
	}

	internal static void TintSupernova(ArtMesh mesh)
	{
		for (int i = 0; i < mesh.Vertices.Count; i++)
		{
			ArtVertex value = mesh.Vertices[i];
			Pigment color = value.Color;
			if (color.R > color.G + 0.12f && color.G > color.B + 0.06f)
			{
				value.Color = new Pigment(color.R * 0.72f, color.R * 0.25f, color.R, color.A);
				mesh.Vertices[i] = value;
			}
		}
	}

	internal static void SupernovaCard(ArtMesh m, float w, float h, float time)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = time % 4f;
		float num2 = w / h;
		Pigment violet = SupernovaPalette.Violet;
		Pigment pink = SupernovaPalette.Pink;
		Pigment white = SupernovaPalette.White;
		Pigment ink = SupernovaPalette.Ink;
		m.Rect((0f - num2) / 2f, -0.5f, num2, 1f, ink);
		for (int i = -4; i < 5; i++)
		{
			float num3 = (float)i * 0.21f;
			Pigment c = new Pigment(0.15f, 0.09f, 0.23f);
			float[] obj = new float[8] { 0f, -0.5f, 0f, -0.5f, 0f, 0.5f, 0f, 0.5f };
			obj[0] = num3 - 0.3f;
			obj[2] = num3 - 0.2f;
			obj[4] = num3 + 0.34f;
			obj[6] = num3 + 0.18f;
			m.Polygon(c, obj);
		}
		float num4 = UMath.Smooth((num - 0.7f) / 0.9f) * (1f - UMath.Smooth((num - 2.6f) / 1.4f));
		float num5 = ((num >= 1.6f && num < 2.5f) ? (1f - UMath.Smooth((num - 1.6f) / 0.9f)) : 0f);
		float num6 = 0.04f;
		m.Disc(0.02f, num6, 0.32f + num4 * 0.04f, 0.32f + num4 * 0.04f, Dark);
		for (int j = 0; j < 9; j++)
		{
			float num7 = (float)j * ((float)Math.PI * 2f) / 9f + 0.14f * UMath.Sin(num * ((float)Math.PI * 2f) / 4f);
			float num8 = 0.4f - num4 * 0.2f;
			m.Polygon((j % 3 == 0) ? pink : violet, C(num7) * num8, num6 + S(num7) * num8, C(num7 - 0.07f) * (num8 + 0.07f), num6 + S(num7 - 0.07f) * (num8 + 0.07f), C(num7 + 0.1f) * (num8 + 0.04f), num6 + S(num7 + 0.1f) * (num8 + 0.04f));
		}
		for (int k = 0; k < 3; k++)
		{
			m.Ring(0.02f, num6, 0.34f + (float)k * 0.045f - num4 * 0.06f, 0.004f, (k == 0) ? pink : new Pigment(0.36f, 0.23f, 0.49f), (float)(k * 2) + num * 0.15f * (1f - num4), 2.8f);
		}
		m.Disc(0.02f, num6, 0.16f + num4 * 0.06f, 0.16f + num4 * 0.06f, ink);
		if (num5 > 0f)
		{
			float num9 = UMath.Out((num - 1.6f) / 0.9f);
			for (int l = 0; l < 8; l++)
			{
				float num10 = (float)l * ((float)Math.PI * 2f) / 8f;
				m.Polygon(white.Alpha(num5), 0.02f, num6, C(num10 - 0.03f) * (0.18f + num9 * 0.7f), num6 + S(num10 - 0.03f) * (0.18f + num9 * 0.7f), C(num10 + 0.03f) * (0.18f + num9 * 0.7f), num6 + S(num10 + 0.03f) * (0.18f + num9 * 0.7f));
			}
			m.Ring(0.02f, num6, 0.06f + num9 * 0.65f, 0.012f, white.Alpha(num5));
			m.Disc(0.02f, num6, 0.045f + num5 * 0.08f, 0.045f + num5 * 0.08f, white);
		}
		else
		{
			m.Disc(0.02f, num6, 0.018f, 0.018f, pink);
		}
		m.Line((0f - num2) / 2f + 0.05f, -0.43f, (0f - num2) / 2f + 0.19f, -0.43f, 0.007f, violet);
		m.Line(num2 / 2f - 0.2f, -0.43f, num2 / 2f - 0.05f, -0.43f, 0.003f, pink);
	}

	internal static void SupernovaWarning(ArtMesh m, float radius, float progress)
	{
		m.Clear();
		m.Space(0f, 0f, radius, radius);
		float num = UMath.Sat(progress);
		Pigment violet = SupernovaPalette.Violet;
		Pigment pink = SupernovaPalette.Pink;
		m.Disc(0f, 0f, 1f, 1f, violet.Alpha(0.05f + 0.08f * num), 96);
		m.Ring(0f, 0f, 1f, 0.008f, violet, 0f, (float)Math.PI * 2f, 128);
		m.Ring(0f, 0f, 0.98f, 0.012f, pink, (float)Math.PI / 2f, (float)Math.PI * -2f * num, 128);
		for (int i = 0; i < 6; i++)
		{
			float num2 = (float)i * ((float)Math.PI * 2f) / 6f + num * num * 2.6f;
			float r = 0.72f * (1f - UMath.Frac(num * 1.5f + (float)i / 6f)) + 0.12f;
			m.Ring(0f, 0f, r, 0.008f, violet.Alpha(0.5f), num2, 1.3f);
			m.Line(C(num2) * 0.75f, S(num2) * 0.75f, C(num2 + 0.27f) * (0.22f + 0.05f * C(num * 20f)), S(num2 + 0.27f) * (0.22f + 0.05f * C(num * 20f)), 0.005f, pink.Alpha(num * 0.65f));
		}
		m.Disc(0f, 0f, 0.15f + 0.03f * num, 0.15f + 0.03f * num, violet.Alpha(0.13f + 0.15f * num));
		m.Ring(0f, 0f, 0.12f, 0.012f, pink.Alpha(0.6f + 0.4f * num));
		m.Disc(0f, 0f, 0.075f + 0.01f * S(num * 36f), 0.075f + 0.01f * S(num * 36f), SupernovaPalette.Ink);
		for (int j = 0; j < 12; j++)
		{
			float num3 = (float)j * ((float)Math.PI * 2f) / 12f;
			m.Polygon(violet.Alpha(0.5f), C(num3) * 0.92f, S(num3) * 0.92f, C(num3 - 0.02f) * 0.96f, S(num3 - 0.02f) * 0.96f, C(num3 + 0.02f) * 0.96f, S(num3 + 0.02f) * 0.96f);
		}
	}

	internal static void SupernovaBlast(ArtMesh m, float radius, float age, int seed)
	{
		m.Clear();
		m.Space(0f, 0f, radius, radius);
		float num = 1f - UMath.Smooth((age - 1f) / 1.7f);
		Pigment violet = SupernovaPalette.Violet;
		Pigment pink = SupernovaPalette.Pink;
		Pigment white = SupernovaPalette.White;
		if (age > 2.8f)
		{
			return;
		}
		float num2 = UMath.Out(age / 0.6f);
		float num3 = 1f - UMath.Sat(age / 0.18f);
		float num4 = 1f - UMath.Smooth((age - 0.18f) / 0.8f);
		m.Disc(0f, 0f, 0.22f + num2 * 0.28f, 0.22f + num2 * 0.28f, violet.Alpha(num4 * 0.11f), 72);
		for (int i = 0; i < 7; i++)
		{
			float num5 = (float)i * ((float)Math.PI * 2f) / 7f + UMath.Noise(seed + i * 37) * 0.25f;
			float num6 = 0.12f + num2 * 0.31f;
			float num7 = 0.055f + UMath.Noise(seed + i * 71) * 0.065f;
			float x = C(num5) * num6;
			float y = S(num5) * num6;
			m.Disc(x, y, num7 * 1.7f, num7 * 1.7f, violet.Alpha(num4 * 0.16f), 28);
			m.Disc(x, y, num7, num7, Pigment.Blend(pink, white, 0.35f).Alpha(num4 * 0.7f), 28);
			m.Ring(x, y, num7 * 1.12f, 0.009f, white.Alpha(num4 * 0.8f), num5, 2.8f);
		}
		for (int j = 0; j < 4; j++)
		{
			float num8 = UMath.Out((age - (float)j * 0.035f) / (0.65f + (float)j * 0.08f));
			m.Ring(0f, 0f, 0.02f + num8 * (1.03f + (float)j * 0.055f), 0.008f + 0.022f * (1f - num8), ((j % 2 == 0) ? white : violet).Alpha((1f - num8) * 0.85f), 0f, (float)Math.PI * 2f, 128);
		}
		for (int k = 0; k < 16; k++)
		{
			float num9 = (float)k * ((float)Math.PI * 2f) / 16f + UMath.Noise(seed + k) * 0.12f;
			float num10 = (0.3f + UMath.Noise(seed + k * 91) * 0.75f) * num2;
			m.Polygon(violet.Alpha(num * 0.55f), 0f, 0f, C(num9 - 0.04f) * num10, S(num9 - 0.04f) * num10, C(num9) * num10 * 1.15f, S(num9) * num10 * 1.15f, C(num9 + 0.04f) * num10, S(num9 + 0.04f) * num10);
			float x2 = 0f;
			float y2 = 0f;
			for (int l = 1; l <= 5; l++)
			{
				float num11 = (float)l / 5f;
				float num12 = (UMath.Noise(seed + k * 33 + l) - 0.5f) * 0.12f * num11;
				float num13 = C(num9) * num10 * num11 - S(num9) * num12;
				float num14 = S(num9) * num10 * num11 + C(num9) * num12;
				m.Line(x2, y2, num13, num14, 0.003f + (1f - num11) * 0.005f, ((k % 3 == 0) ? white : pink).Alpha(num * (1f - UMath.Sat(age / 1.4f))));
				x2 = num13;
				y2 = num14;
			}
		}
		for (int n = 0; n < 42; n++)
		{
			float a = UMath.Noise(seed + n * 713) * ((float)Math.PI * 2f);
			float num15 = (0.2f + UMath.Noise(seed + n * 97) * 0.8f) * (age + 0.05f);
			float x3 = C(a) * num15;
			float y3 = S(a) * num15;
			m.Line(x3, y3, C(a) * (num15 - 0.025f), S(a) * (num15 - 0.025f), 0.004f, ((n % 3 == 0) ? white : violet).Alpha(num));
		}
		m.Ring(0f, 0f, 0.18f + num2 * 0.2f, 0.04f * (1f - UMath.Sat(age / 1.5f)), violet.Alpha(num));
		m.Disc(0f, 0f, 0.16f + 0.12f * num3, 0.16f + 0.12f * num3, pink.Alpha(1f - UMath.Sat(age / 0.7f)));
		m.Disc(0f, 0f, 0.1f + 0.16f * num3, 0.1f + 0.16f * num3, white.Alpha(1f - UMath.Sat(age / 0.35f)));
	}

	private static float C(float a)
	{
		return UMath.Cos(a);
	}

	private static float S(float a)
	{
		return UMath.Sin(a);
	}

	internal static void Trefoil(ArtMesh m, float x, float y, float radius, Pigment color, float rotation = 0f)
	{
		for (int i = 0; i < 3; i++)
		{
			m.Ring(x, y, radius, radius * 0.62f, color, rotation + (float)i * ((float)Math.PI * 2f) / 3f + 0.2f, (float)Math.PI / 3f, 60);
		}
		m.Disc(x, y, radius * 0.23f, radius * 0.23f, color, 24);
	}

	internal static void Card(ArtMesh m, float w, float h, float time)
	{
		m.Clear();
		m.Space(0f, 0f, h, h);
		float num = w / h;
		float num2 = time % 3f * 3.2f;
		m.Rect((0f - num) / 2f, -0.5f, num, 1f, Dark);
		for (int i = -7; i <= 7; i++)
		{
			float num3 = (float)i * 0.19f;
			Pigment c = Plate.Alpha(0.6f);
			float[] obj = new float[8] { 0f, -0.6f, 0f, -0.6f, 0f, 0.6f, 0f, 0.6f };
			obj[0] = num3 - 0.35f;
			obj[2] = num3 - 0.28f;
			obj[4] = num3 + 0.25f;
			obj[6] = num3 + 0.18f;
			m.Polygon(c, obj);
		}
		for (int j = 0; j < 16; j++)
		{
			float a = (float)j * ((float)Math.PI * 2f) / 16f;
			float num4 = 0.46f;
			m.Line(C(a) * num4, 0.04f + S(a) * num4, C(a) * (num4 + 0.025f), 0.04f + S(a) * (num4 + 0.025f), 0.004f, Brass.Alpha(0.5f));
		}
		float num5 = UMath.Smooth((num2 - 3.2f) / 0.7f) * (1f - UMath.Smooth((num2 - 7.4f) / 2.2f));
		float num6 = UMath.Smooth((num2 - 2.2f) / 1f) * (1f - num5);
		float num7 = UMath.Sat((num2 - 3.9f) / 0.6f);
		float num8 = ((num2 >= 3.9f && num2 < 4.5f) ? (1f - num7) : 0f);
		float num9 = 0.045f;
		float num10 = 0.12f * S(num2 * ((float)Math.PI * 2f) / 9.6f);
		m.Ring(0f, num9, 0.4f, 0.003f, Brass, -0.5f, 4.6f);
		m.Ring(0f, num9, 0.375f, 0.014f, Plate, 1.5f, 4.5f);
		m.Ring(0f, num9, 0.36f - num6 * 0.014f, 0.008f, Orange.Alpha(0.75f), num10);
		m.Disc(0f, num9, 0.333f, 0.333f, new Pigment(0.025f, 0.028f, 0.04f));
		m.Ring(0f, num9, 0.322f, 0.021f, Brass.Alpha(0.45f));
		for (int k = 0; k < 28; k++)
		{
			float a2 = (float)k * ((float)Math.PI * 2f) / 28f;
			m.Line(C(a2) * 0.3f, num9 + S(a2) * 0.3f, C(a2) * 0.285f, num9 + S(a2) * 0.285f, 0.003f, ((k % 7 == 0) ? Gold : Brass).Alpha(0.8f));
		}
		m.Disc(0f, num9, 0.1f + num5 * 0.045f + num8 * 0.045f, 0.1f + num5 * 0.045f + num8 * 0.045f, Red);
		m.Disc(0f, num9, 0.06f + num5 * 0.05f, 0.06f + num5 * 0.05f, Orange);
		m.Disc(0f, num9, 0.022f + num5 * 0.04f + num8 * 0.06f, 0.022f + num5 * 0.04f + num8 * 0.06f, Cream);
		for (int l = 0; l < 3; l++)
		{
			float num11 = (float)l * ((float)Math.PI * 2f) / 3f + 0.45f;
			float num12 = num5 * 0.11f;
			float num13 = C(num11) * num12;
			float num14 = num9 + S(num11) * num12;
			float a3 = num11 - 0.48f;
			float a4 = num11 + 0.48f;
			m.Polygon(new Pigment(0.25f, 0.18f, 0.18f), num13 + C(a3) * 0.14f, num14 + S(a3) * 0.14f, num13 + C(a3) * 0.27f, num14 + S(a3) * 0.27f, num13 + C(a4) * 0.27f, num14 + S(a4) * 0.27f, num13 + C(a4) * 0.14f, num14 + S(a4) * 0.14f);
			m.Line(num13 + C(a3) * 0.14f, num14 + S(a3) * 0.14f, num13 + C(a4) * 0.14f, num14 + S(a4) * 0.14f, 0.008f, Gold);
			m.Ring(num13, num14, 0.252f, 0.045f, Red, num11 - 0.33f, 0.66f, 60);
			m.Ring(num13, num14, 0.238f, 0.008f, Orange, num11 - 0.33f, 0.66f, 60);
		}
		Trefoil(m, 0f, num9, 0.108f, Dark.Alpha(1f - num5));
		if (num8 > 0f)
		{
			m.Ring(0f, num9, 0.17f + num7 * 0.55f, 0.018f * (1f - num7) + 0.002f, Cream.Alpha(num8));
			m.Line((0f - num) / 2f, num9, num / 2f, num9, 0.006f * num8, Cream.Alpha(num8 * 0.8f));
		}
		m.Ring(0f, num9, 0.42f, 0.004f, Gold.Alpha(0.75f), -0.7f + num10, 0.45f);
		m.Ring(0f, num9, 0.42f, 0.004f, Brass, 2.3f - num10, 0.85f);
		m.Rect((0f - num) / 2f + 0.06f, -0.43f, 0.12f, 0.009f, Red);
		m.Rect((0f - num) / 2f + 0.06f, -0.45f, 0.065f, 0.004f, Brass);
		m.Rect(num / 2f - 0.19f, -0.43f, 0.13f, 0.004f, Brass);
	}

	internal static void Warning(ArtMesh m, float radius, float progress)
	{
		m.Clear();
		m.Space(0f, 0f, radius, radius);
		float num = UMath.Sat(progress);
		m.Disc(0f, 0f, 1f, 1f, Red.Alpha(0.065f + num * 0.07f), 96);
		m.Ring(0f, 0f, 1f, 0.008f, Red.Alpha(0.9f), 0f, (float)Math.PI * 2f, 128);
		m.Ring(0f, 0f, 0.972f, 0.012f, Gold.Alpha(0.8f), (float)Math.PI / 2f, (0f - num) * ((float)Math.PI * 2f), 128);
		for (int i = 0; i < 3; i++)
		{
			float num2 = 0.18f + 0.77f * (1f - UMath.Frac(num * 1.45f + (float)i / 3f));
			m.Ring(0f, 0f, num2, 0.008f, Red.Alpha(0.1f + 0.18f * num2), (float)(i * 2) + num * 0.3f, 1.15f);
		}
		for (int j = 0; j < 24; j++)
		{
			float num3 = (float)j * ((float)Math.PI * 2f) / 24f;
			float num4 = 0.915f;
			float num5 = 0.018f + 0.025f * num;
			m.Polygon(Red.Alpha(0.4f + 0.4f * num), C(num3) * (num4 - num5), S(num3) * (num4 - num5), C(num3 - 0.018f) * num4, S(num3 - 0.018f) * num4, C(num3 + 0.018f) * num4, S(num3 + 0.018f) * num4);
		}
		m.Ring(0f, 0f, 0.15f - 0.04f * num, 0.006f, Cream.Alpha(0.5f + 0.4f * num));
		Trefoil(m, 0f, 0f, 0.075f, Red.Alpha(0.8f));
	}

	internal static void Explosion(ArtMesh m, float radius, float age, int seed)
	{
		m.Clear();
		m.Space(0f, 0f, radius, radius);
		float num = Math.Max(0f, age);
		float num2 = 1f - UMath.Smooth((num - 1.15f) / 1.9f);
		if (num >= 3.2f)
		{
			return;
		}
		for (int i = 0; i < 3; i++)
		{
			float num3 = num - (float)i * 0.07f;
			if (!(num3 < 0f) && !(num3 > 0.9f))
			{
				float num4 = UMath.Out(num3 / 0.9f);
				float num5 = (1f - num4) * 0.9f;
				m.Ring(0f, 0f, 0.04f + num4 * (1.05f + (float)i * 0.12f), 0.012f + 0.035f * (1f - num4), ((i == 0) ? Cream : Orange).Alpha(num5), 0f, (float)Math.PI * 2f, 128);
				for (int j = 0; j < 8; j++)
				{
					m.Ring(0f, 0f, 0.12f + num4 * 1.18f, 0.012f * (1f - num4) + 0.002f, Gold.Alpha(num5 * 0.7f), (float)j * ((float)Math.PI * 2f) / 8f + (float)i * 0.2f, 0.23f);
				}
			}
		}
		float num6 = UMath.Out(num / 0.13f);
		float num7 = 1f - UMath.Smooth((num - 0.14f) / 0.7f);
		if (num7 > 0f)
		{
			for (int k = 0; k < 18; k++)
			{
				float num8 = (float)k * ((float)Math.PI * 2f) / 18f + UMath.Noise(seed + k) * 0.12f;
				float num9 = (0.36f + UMath.Noise(seed + k * 43) * 0.38f) * num6;
				m.Polygon(Red.Alpha(num7 * 0.85f), 0f, 0f, C(num8 - 0.13f) * num9 * 0.55f, S(num8 - 0.13f) * num9 * 0.55f, C(num8) * num9, S(num8) * num9, C(num8 + 0.13f) * num9 * 0.55f, S(num8 + 0.13f) * num9 * 0.55f);
			}
			for (int l = 0; l < 7; l++)
			{
				float a = (float)l * ((float)Math.PI * 2f) / 7f;
				float num10 = UMath.Noise(seed + 62 + l);
				float x = C(a) * 0.16f * num6;
				float y = S(a) * 0.15f * num6;
				m.Disc(x, y, (0.17f + num10 * 0.06f) * num6, (0.15f + num10 * 0.06f) * num6, Orange.Alpha(num7 * 0.88f), 28);
			}
			m.Disc(0f, 0f, 0.24f * num6, 0.21f * num6, Gold.Alpha(num7));
			m.Disc(0f, 0f, 0.16f * num6, 0.14f * num6, Cream.Alpha(num7));
		}
		for (int n = 0; n < 14; n++)
		{
			float num11 = ((n % 2 != 0) ? 1 : (-1));
			float num12 = UMath.Noise(seed + 110 + n * 13);
			float x2 = num11 * (0.08f + UMath.Out(num / 1.4f) * (0.25f + num12 * 0.56f));
			float y2 = -0.05f + S((float)n * 3.1f) * 0.055f + num * 0.03f;
			m.Disc(x2, y2, (0.075f + num12 * 0.075f) * UMath.Out(num / 0.22f), 0.035f + num12 * 0.06f, Pigment.Blend(Orange, Smoke, UMath.Sat(num * 1.25f + num12 * 0.3f)).Alpha(num2 * 0.68f), 24);
		}
		float num13 = UMath.Out((num - 0.08f) / 1.3f);
		float num14 = UMath.Out((num - 0.1f) / 0.32f);
		float num15 = 0.12f + 0.69f * num13;
		m.Polygon(Pigment.Blend(Orange, Smoke, UMath.Sat(num * 0.65f)).Alpha(num2 * num14), -0.15f * num14, 0f, -0.11f * num14, num15 * 0.44f, -0.2f * num14, num15, 0.21f * num14, num15, 0.1f * num14, num15 * 0.41f, 0.15f * num14, 0f);
		for (int num16 = 0; num16 < 5; num16++)
		{
			float num17 = ((float)num16 + 0.5f) / 5f;
			float num18 = UMath.Noise(seed + 400 + num16);
			float num19 = S((float)num16 * 3.4f + num * 1.6f) * (0.025f + 0.05f * num13);
			float num20 = num17 * num15;
			float num21 = (0.12f + num18 * 0.055f) * num14;
			m.Disc(num19, num20, num21, num21 * 1.12f, Pigment.Blend(Gold, Smoke, UMath.Sat(num * 0.66f + num17 * 0.08f + num18 * 0.16f)).Alpha(num2 * 0.86f), 28);
			m.Disc(num19 - num21 * 0.23f, num20 - num21 * 0.15f, num21 * 0.47f, num21 * 0.68f, Orange.Alpha((1f - UMath.Sat(num / 1.3f)) * num2 * 0.45f), 24);
		}
		float num22 = 0.13f + 0.64f * num13;
		float num23 = (0.22f + 0.37f * num13) * num14;
		for (int num24 = 0; num24 < 7; num24++)
		{
			float num25 = (float)(num24 - 3) / 3f;
			float num26 = UMath.Noise(seed + 800 + num24 * 37);
			float a2 = num * 0.75f + (float)num24 * 2.1f;
			float num27 = num25 * num23 + S(a2) * 0.018f * num13;
			float num28 = num22 + UMath.Sqrt(1f - num25 * num25) * 0.16f + num26 * 0.055f;
			float num29 = (0.14f + num26 * 0.1f) * num14;
			m.Disc(num27, num28, num29, num29 * (0.85f + num26 * 0.2f), Pigment.Blend(Red, Smoke, UMath.Sat(num * 0.6f + num26 * 0.2f)).Alpha(num2 * 0.95f), 32);
			m.Disc(num27 - num29 * 0.23f, num28 - num29 * 0.3f, num29 * 0.67f, num29 * 0.5f, Orange.Alpha(num2 * Math.Max(0f, 1f - num / 1.6f) * 0.75f), 28);
		}
		for (int num30 = 0; num30 < 9; num30++)
		{
			float num31 = (float)(num30 - 4) / 4f;
			float num32 = UMath.Noise(seed + 1500 + num30 * 71);
			float x3 = num31 * num23;
			float y3 = num22 - 0.035f + S((float)num30 * 2.7f + num * 1.4f) * 0.03f;
			float num33 = (0.08f + num32 * 0.08f) * num14;
			m.Disc(x3, y3, num33 * 1.12f, num33 * 0.7f, Pigment.Blend(Orange, Smoke, UMath.Sat(num * 0.65f + num32 * 0.2f)).Alpha(num2 * 0.9f), 28);
			m.Ring(x3, y3, num33 * 0.83f, num33 * 0.1f, Gold.Alpha(num2 * Math.Max(0f, 1f - num / 1.4f) * 0.65f), 3.1f + num32 * 0.3f, 2.1f, 40);
		}
		for (int num34 = 0; num34 < 46; num34++)
		{
			float num35 = UMath.Noise(seed + num34 * 173);
			float a3 = UMath.Noise(seed + num34 * 31 + 90) * ((float)Math.PI * 2f);
			float num36 = 0.25f + num35 * 0.72f;
			float num37 = C(a3) * num36;
			float num38 = Math.Abs(S(a3)) * num36 + 0.12f;
			float num39 = 0.65f + UMath.Noise(seed + num34 * 83) * 1.45f;
			if (!(num > num39))
			{
				float num40 = num37 * num;
				float num41 = num38 * num - 0.32f * num * num;
				float num42 = Math.Min(num, 0.11f);
				Pigment c = ((num34 % 4 == 0) ? Smoke : ((num34 % 3 == 0) ? Gold : Orange)).Alpha((1f - num / num39) * 0.9f);
				m.Line(num40, num41, num37 * (num - num42), num38 * (num - num42) - 0.32f * (num - num42) * (num - num42), 0.003f + num35 * 0.006f, c);
				if (num34 % 4 == 0)
				{
					m.Polygon(c, num40 - 0.009f, num41, num40, num41 + 0.014f, num40 + 0.013f, num41, num40, num41 - 0.01f);
				}
			}
		}
		float num43 = 1f - UMath.Sat(num / 0.13f);
		m.Disc(0f, 0f, 0.08f + 0.24f * (1f - num43), 0.08f + 0.22f * (1f - num43), Cream.Alpha(num43), 64);
	}

	internal static void Hud(ArtMesh m, float w, float h, float charge, bool ready, float casting, float time)
	{
		m.Clear();
		m.Space(0f, 0f, 1f, 1f);
		float num = (0f - w) / 2f;
		float num2 = (0f - h) / 2f;
		m.Polygon(new Pigment(0.055f, 0.05f, 0.065f, 0.95f), num + 11f, num2, num + w - 15f, num2, num + w, num2 + 15f, num + w, num2 + h - 10f, num + w - 10f, num2 + h, num + 11f, num2 + h, num, num2 + h - 11f, num, num2 + 11f);
		Pigment pigment = (ready ? Gold : Brass);
		m.Line(num + 14f, num2 + h - 1f, num + w - 12f, num2 + h - 1f, 1f, pigment.Alpha(0.55f));
		m.Line(num + 14f, num2 + 1f, num + w - 16f, num2 + 1f, 1f, pigment.Alpha(0.35f));
		float num3 = num + 54f;
		float y = 0f;
		float r = 36f;
		m.Disc(num3, y, 31f, 31f, Plate);
		m.Ring(num3, y, r, 3.5f, Brass.Alpha(0.45f), 0f, (float)Math.PI * 2f, 100);
		float num4 = (ready ? 1f : UMath.Sat(charge / 100f));
		m.Ring(num3, y, r, 3.5f, ready ? Gold : Orange, (float)Math.PI / 2f, (float)Math.PI * -2f * num4, 100);
		for (int i = 0; i < 24; i++)
		{
			float a = (float)i * ((float)Math.PI * 2f) / 24f;
			m.Line(num3 + C(a) * 41f, S(a) * 41f, num3 + C(a) * (float)((i % 6 == 0) ? 46 : 44), S(a) * (float)((i % 6 == 0) ? 46 : 44), 1f, Brass.Alpha(0.65f));
		}
		Trefoil(m, num3, y, 20f, ready ? Cream : Orange.Alpha(0.65f + num4 * 0.35f), -0.1f);
		if (ready)
		{
			float num5 = 0.5f + 0.5f * S(time * 3.2f);
			m.Ring(num3, y, 48f + num5, 1f, Gold.Alpha(0.2f + 0.25f * num5));
			m.Ring(num3, y, 43f, 1.4f, Cream, time * 0.65f, 0.55f);
			m.Polygon(Gold, num + w - 20f, num2 + h - 16f, num + w - 13f, num2 + h - 16f, num + w - 13f, num2 + h - 9f);
		}
		if (casting > 0f)
		{
			m.Ring(num3, y, 29f, 4f, Red, (float)Math.PI / 2f, (float)Math.PI * -2f * UMath.Sat(casting), 100);
		}
		m.Line(num + 108f, num2 + 20f, num + 108f, num2 + h - 20f, 1f, Brass.Alpha(0.6f));
		m.Rect(num + 122f, num2 + 17f, 20f, 2f, ready ? Gold : Red);
	}

	internal static void HealthReady(ArtMesh m, float w, float h, float time)
	{
		m.Clear();
		m.Space(0f, 0f, 1f, 1f);
		float num = Math.Max(0.001f, h);
		float a = 0.72f + 0.28f * S(time * 5.2f);
		float num2 = num * 1f;
		float num3 = num * 0.17f;
		int[] array = new int[2] { -1, 1 };
		foreach (int num4 in array)
		{
			float num5 = (float)num4 * (w * 0.5f + num * 0.65f);
			m.Line(num5, 0f - num2, num5, num2, num3, Gold.Alpha(a));
			m.Line(num5, num2, num5 - (float)num4 * num * 0.9f, num2, num3, Gold.Alpha(a));
			m.Line(num5, 0f - num2, num5 - (float)num4 * num * 0.9f, 0f - num2, num3, Gold.Alpha(a));
			m.Line(num5 + (float)num4 * num * 0.65f, (0f - num) * 0.5f, num5 + (float)num4 * num * 1.05f, 0f, num3, Cream.Alpha(a));
			m.Line(num5 + (float)num4 * num * 1.05f, 0f, num5 + (float)num4 * num * 0.65f, num * 0.5f, num3, Cream.Alpha(a));
		}
		m.Line((0f - w) * 0.5f, 0f - num2, w * 0.5f, 0f - num2, num3 * 0.65f, Gold.Alpha(0.7f));
		float num6 = (0f - w) * 0.5f + UMath.Frac(time * 0.75f) * w;
		m.Line(num6 - w * 0.07f, num2, num6 + w * 0.07f, num2, num3 * 1.2f, Cream.Alpha(a));
		float num7 = num * 2.45f;
		float num8 = num * 0.12f * S(time * 5.2f);
		m.Polygon(new Pigment(0.08f, 0.08f, 0.1f), 0f, num7 + num * 1.4f + num8, num * 1.25f, num7 + num8, 0f, num7 - num * 1.4f + num8, (0f - num) * 1.25f, num7 + num8);
		m.Polygon(Gold, num * 0.22f, num7 + num * 1.1f + num8, (0f - num) * 0.72f, num7 - num * 0.04f + num8, (0f - num) * 0.08f, num7 - num * 0.04f + num8, (0f - num) * 0.3f, num7 - num * 1.05f + num8, num * 0.74f, num7 + num * 0.23f + num8, num * 0.11f, num7 + num * 0.23f + num8);
		m.Line((0f - num) * 0.8f, num7 - num * 1f + num8, (0f - num) * 1.25f, num7 + num8, num3 * 0.7f, Cream.Alpha(a));
	}
}
[DefaultExecutionOrder(31500)]
public sealed class ArsenalPresentation : MaskableGraphic
{
	internal struct WeaponPose
	{
		internal Vector2 Grip;

		internal Vector2 Aim;

		internal Vector2 Up;

		internal Vector2 Muzzle;

		internal float Scale;
	}

	private static readonly Dictionary<UltimateController, ArsenalPresentation> views = new Dictionary<UltimateController, ArsenalPresentation>();

	private readonly Dictionary<Renderer, bool> hidden = new Dictionary<Renderer, bool>();

	private readonly Dictionary<Graphic, bool> hiddenUI = new Dictionary<Graphic, bool>();

	private UltimateController owner;

	private readonly ArtMesh mesh = new ArtMesh();

	private readonly ArtMesh model = new ArtMesh();

	internal static WeaponPose Pose(UltimateController c)
	{
		//IL_0029: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: 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_0104: 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)
		//IL_010f: 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_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = ((((Vector2)(ref c.Arsenal.Aim)).sqrMagnitude > 0.01f) ? ((Vector2)(ref c.Arsenal.Aim)).normalized : Vector2.right);
		Vector2 val2 = new Vector2(0f - val.y, val.x) * (float)((!(val.x < 0f)) ? 1 : (-1));
		float num = Mathf.Max(0.6f, ((Component)c.Data).transform.localScale.x) * 0.72f;
		Vector2 val3 = (((Object)(object)c.Data.hand != (Object)null) ? Vector2.op_Implicit(c.Data.hand.position) : Vector2.op_Implicit(((Component)c.Data).transform.position));
		return new WeaponPose
		{
			Grip = val3,
			Aim = val,
			Up = val2,
			Scale = num,
			Muzzle = val3 + val * (c.Arsenal.Rocket ? 1.17f : 1.51f) * num + val2 * 0.15f * num
		};
	}

	internal static Vector2 SafeMuzzle(UltimateController c, Vector2 muzzle)
	{
		//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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Vector2.op_Implicit(c.Data.hand.position);
		Vector2 val2 = muzzle - val;
		foreach (RaycastHit2D item in from x in Physics2D.RaycastAll(val, val2, ((Vector2)(ref val2)).magnitude)
			orderby ((RaycastHit2D)(ref x)).distance
			select x)
		{
			RaycastHit2D current = item;
			if (StaticMaterial.Solid(((RaycastHit2D)(ref current)).collider))
			{
				return ((RaycastHit2D)(ref current)).point - ((Vector2)(ref val2)).normalized * 0.015f;
			}
		}
		return muzzle;
	}

	internal static void Ensure(UltimateController c)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		if (!views.TryGetValue(c, out var value) || !((Object)(object)value != (Object)null))
		{
			GameObject val = new GameObject("Ultimate equipped weapon", new Type[2]
			{
				typeof(RectTransform),
				typeof(Canvas)
			});
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(250f, 200f);
			Canvas component = val.GetComponent<Canvas>();
			component.renderMode = (RenderMode)2;
			component.sortingOrder = 35;
			SpriteRenderer componentInChildren = ((Component)c.Data).GetComponentInChildren<SpriteRenderer>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				component.sortingLayerID = ((Renderer)componentInChildren).sortingLayerID;
				component.sortingOrder = ((Renderer)componentInChildren).sortingOrder + 35;
			}
			GameObject val2 = new GameObject("M4 / launcher overlay", new Type[2]
			{
				typeof(RectTransform),
				typeof(ArsenalPresentation)
			});
			val2.transform.SetParent(val.transform, false);
			Transform transform = val2.transform;
			UltimateArtTemplate.Stretch((RectTransform)(object)((transform is RectTransform) ? transform : null));
			value = val2.GetComponent<ArsenalPresentation>();
			value.owner = c;
			views[c] = value;
			value.HidePistol();
		}
	}

	private void HidePistol()
	{
		Gun gun = owner.Data.weaponHandler.gun;
		Renderer[] componentsInChildren = ((Component)gun).GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val in componentsInChildren)
		{
			if (!((Object)(object)((Component)val).GetComponentInParent<ProjectileHit>() != (Object)null))
			{
				if (!hidden.ContainsKey(val))
				{
					hidden[val] = val.enabled;
				}
				val.enabled = false;
			}
		}
		Graphic[] componentsInChildren2 = ((Component)gun).GetComponentsInChildren<Graphic>(true);
		foreach (Graphic val2 in componentsInChildren2)
		{
			if (!((Object)(object)((Component)val2).GetComponentInParent<ProjectileHit>() != (Object)null))
			{
				if (!hiddenUI.ContainsKey(val2))
				{
					hiddenUI[val2] = ((Behaviour)val2).enabled;
				}
				((Behaviour)val2).enabled = false;
			}
		}
	}

	internal static void Restore(UltimateController c)
	{
		if (!views.TryGetValue(c, out var value))
		{
			return;
		}
		if ((Object)(object)value != (Object)null)
		{
			foreach (KeyValuePair<Renderer, bool> item in value.hidden)
			{
				if ((Object)(object)item.Key != (Object)null)
				{
					item.Key.enabled = item.Value;
				}
			}
			foreach (KeyValuePair<Graphic, bool> item2 in value.hiddenUI)
			{
				if ((Object)(object)item2.Key != (Object)null)
				{
					((Behaviour)item2.Key).enabled = item2.Value;
				}
			}
			Object.Destroy((Object)(object)((Component)((Component)value).transform.parent).gameObject);
		}
		views.Remove(c);
	}

	internal static void Flash(UltimateController c, bool rocket, int seed)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		c.Arsenal.Flash = (rocket ? 0.1f : 0.07f);
		if (!rocket)
		{
			ArsenalAudio.Shot(Vector2.op_Implicit(c.Data.hand.position), seed);
		}
	}

	protected override void Awake()
	{
		((UIBehaviour)this).Awake();
		((Graphic)this).raycastTarget = false;
	}

	private void LateUpdate()
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)owner == (Object)null || !owner.Arsenal.Active)
		{
			Object.Destroy((Object)(object)((Component)((Component)this).transform.parent).gameObject);
			return;
		}
		HidePistol();
		((Component)this).transform.parent.position = Vector3.zero;
		((Graphic)this).SetVerticesDirty();
	}

	protected override void OnPopulateMesh(VertexHelper vh)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: 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_022f: 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_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: 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_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0129: 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_013e: 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_0170: 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_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_037f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_0396: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: 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_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: 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_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		vh.Clear();
		mesh.Clear();
		if ((Object)(object)owner == (Object)null || !owner.Arsenal.Active)
		{
			return;
		}
		WeaponPose weaponPose = Pose(owner);
		if (owner.Arsenal.Rocket)
		{
			Vector2 val = weaponPose.Muzzle + weaponPose.Aim * 160f;
			foreach (RaycastHit2D item in from x in Physics2D.RaycastAll(weaponPose.Muzzle, weaponPose.Aim, 160f)
				orderby ((RaycastHit2D)(ref x)).distance
				select x)
			{
				RaycastHit2D current = item;
				Collider2D collider = ((RaycastHit2D)(ref current)).collider;
				if (!((Object)(object)collider == (Object)null) && !collider.isTrigger && !((Object)(object)WorldFreeze.Character((Component)(object)collider) == (Object)(object)owner.Data) && !((Object)(object)((Component)collider).GetComponentInParent<ProjectileHit>() != (Object)null))
				{
					val = ((RaycastHit2D)(ref current)).point;
					break;
				}
			}
			mesh.Line(weaponPose.Muzzle.x, weaponPose.Muzzle.y, val.x, val.y, 0.035f, UltimatePainter.Red.Alpha(0.22f));
			mesh.Line(weaponPose.Muzzle.x, weaponPose.Muzzle.y, val.x, val.y, 0.01f, UltimatePainter.Red.Alpha(0.85f));
			mesh.Disc(val.x, val.y, 0.05f, 0.05f, UltimatePainter.Red, 16);
			UltimatePainter.LauncherModel(model);
		}
		else
		{
			UltimatePainter.RifleModel(model, owner.Arsenal.Flash / 0.07f);
		}
		Vector2 val2 = weaponPose.Grip - weaponPose.Aim * (owner.Arsenal.Flash * 0.8f);
		mesh.Append(model, val2.x, val2.y, weaponPose.Aim.x * weaponPose.Scale, weaponPose.Aim.y * weaponPose.Scale, weaponPose.Up.x * weaponPose.Scale, weaponPose.Up.y * weaponPose.Scale);
		mesh.Disc(weaponPose.Grip.x, weaponPose.Grip.y - 0.05f * weaponPose.Scale, 0.075f * weaponPose.Scale, 0.075f * weaponPose.Scale, UltimatePainter.Cream, 20);
		UltimatePainter.MuzzleFan(mesh, weaponPose.Muzzle.x, weaponPose.Muzzle.y, weaponPose.Aim.x, weaponPose.Aim.y, Mathf.Clamp01(owner.Arsenal.Flash / 0.07f));
		int num = (owner.Arsenal.Rocket ? 3 : 30);
		float num2 = (owner.Arsenal.Rocket ? 0.5f : 1.35f);
		float num3 = num2 / (float)num;
		for (int num4 = 0; num4 < num; num4++)
		{
			Vector2 val3 = weaponPose.Grip + weaponPose.Up * (0.66f * weaponPose.Scale) + new Vector2((float)num4 * num3 - num2 * 0.5f, 0f);
			mesh.Rect(val3.x, val3.y, num3 * 0.6f, 0.075f, (num4 < owner.Arsenal.Ammo) ? UltimatePainter.Cream : UltimatePainter.Smoke);
		}
		foreach (ArtVertex vertex in mesh.Vertices)
		{
			vh.AddVert(new Vector3(vertex.X, vertex.Y), Color32.op_Implicit(new Color(vertex.Color.R, vertex.Color.G, vertex.Color.B, vertex.Color.A)), Vector2.zero);
		}
		for (int num5 = 0; num5 < mesh.Indices.Count; num5 += 3)
		{
			vh.AddTriangle(mesh.Indices[num5], mesh.Indices[num5 + 1], mesh.Indices[num5 + 2]);
		}
	}
}
internal static class StaticMaterial
{
	internal static bool PhysicsProp(Collider2D c)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Invalid comparison between Unknown and I4
		if (!((Object)(object)((Component)c).GetComponentInParent<NetworkPhysicsObject>() != (Object)null))
		{
			if ((Object)(object)c.attachedRigidbody != (Object)null)
			{
				return (int)c.attachedRigidbody.bodyType == 0;
			}
			return false;
		}
		return true;
	}

	internal static bool Surface(Collider2D c)
	{
		if ((Object)(object)c != (Object)null && ((Behaviour)c).enabled && !c.isTrigger && (Object)(object)WorldFreeze.Character((Component)(object)c) == (Object)null && (Object)(object)((Component)c).GetComponentInParent<ProjectileHit>() == (Object)null)
		{
			return (Object)(object)((Component)c).GetComponentInParent<RocketHull>() == (Object)null;
		}
		return false;
	}

	internal static bool Inside(Vector2 p)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		return Physics2D.OverlapPointAll(p).Any(Surface);
	}

	internal static bool Solid(Collider2D c)
	{
		if ((Object)(object)c != (Object)null && ((Behaviour)c).enabled && !c.isTrigger && (Object)(object)((Component)c).GetComponentInParent<CharacterData>() == (Object)null && (Object)(object)((Component)c).GetComponentInParent<Holdable>() == (Object)null && (Object)(object)((Component)c).GetComponentInParent<ProjectileHit>() == (Object)null)
		{
			return !PhysicsProp(c);
		}
		return false;
	}

	private static float Cross(Vector2 a, Vector2 b)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		return a.x * b.y - a.y * b.x;
	}

	internal static List<ArsenalRules.MaterialSpan> Spans(Collider2D c, Vector2 from, Vector2 direction, float distance)
	{
		//IL_0134: 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_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_0179: 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_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: 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_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		List<float> list = new List<float> { 0f, distance };
		PolygonCollider2D val = (PolygonCollider2D)(object)((c is PolygonCollider2D) ? c : null);
		if ((Object)(object)val != (Object)null)
		{
			for (int i = 0; i < val.pathCount; i++)
			{
				Vector2[] path = val.GetPath(i);
				for (int j = 0; j < path.Length; j++)
				{
					Vector2 val2 = Vector2.op_Implicit(((Component)val).transform.TransformPoint(Vector2.op_Implicit(path[j] + ((Collider2D)val).offset)));
					Vector2 b = Vector2.op_Implicit(((Component)val).transform.TransformPoint(Vector2.op_Implicit(path[(j + 1) % path.Length] + ((Collider2D)val).offset))) - val2;
					float num = Cross(direction, b);
					if (!(Mathf.Abs(num) < 1E-06f))
					{
						float num2 = Cross(val2 - from, b) / num;
						float num3 = Cross(val2 - from, direction) / num;
						if (num2 > 0f && num2 < distance && num3 >= 0f && num3 <= 1f)
						{
							list.Add(num2);
						}
					}
				}
			}
		}
		else
		{
			RaycastHit2D[] array = Physics2D.RaycastAll(from, direction, distance);
			for (int k = 0; k < array.Length; k++)
			{
				RaycastHit2D val3 = array[k];
				if ((Object)(object)((RaycastHit2D)(ref val3)).collider == (Object)(object)c)
				{
					list.Add(((RaycastHit2D)(ref val3)).distance);
				}
			}
			array = Physics2D.RaycastAll(from + direction * distance, -direction, distance);
			for (int k = 0; k < array.Length; k++)
			{
				RaycastHit2D val4 = array[k];
				if ((Object)(object)((RaycastHit2D)(ref val4)).collider == (Object)(object)c)
				{
					list.Add(distance - ((RaycastHit2D)(ref val4)).distance);
				}
			}
		}
		list = list.OrderBy((float x) => x).Distinct().ToList();
		List<ArsenalRules.MaterialSpan> list2 = new List<ArsenalRules.MaterialSpan>();
		for (int num4 = 0; num4 < list.Count - 1; num4++)
		{
			if (c.OverlapPoint(from + direction * ((list[num4] + list[num4 + 1]) * 0.5f)))
			{
				list2.Add(new ArsenalRules.MaterialSpan(list[num4], list[num4 + 1]));
			}
		}
		if (c is EdgeCollider2D)
		{
			RaycastHit2D[] array = Physics2D.RaycastAll(from, direction, distance);
			for (int k = 0; k < array.Length; k++)
			{
				RaycastHit2D val5 = array[k];
				if ((Object)(object)((RaycastHit2D)(ref val5)).collider == (Object)(object)c)
				{
					list2.Add(new ArsenalRules.MaterialSpan(((RaycastHit2D)(ref val5)).distance, Mathf.Min(distance, ((RaycastHit2D)(ref val5)).distance + 0.025f)));
				}
			}
		}
		return list2;
	}
}
public sealed class ArsenalProjectiles : MaskableGraphic
{
	internal sealed class SurfaceBurst
	{
		internal Vector2 Position;

		internal Vector2 Direction;

		internal int Seed;

		internal bool Exit;

		internal float Age;
	}

	internal sealed class Shot
	{
		internal UltimateController Source;

		internal Player Owner;

		internal int Id;

		internal int Revision;

		internal int LastRevision;

		internal Vector2 Position;

		internal Vector2 Direction;

		internal float Speed;

		internal float Budget;

		internal float Age;

		internal float DeadAt = -1f;

		internal int SkipPlayer = -1;

		internal float SkipUntil;

		internal bool Alive = true;

		internal bool InMaterial;

		internal int SurfaceSerial;

		internal readonly List<SmokeStamp> Trail = new List<SmokeStamp>();
	}

	internal static readonly List<Shot> Shots = new List<Shot>();

	internal static readonly List<SurfaceBurst> Impacts = new List<SurfaceBurst>();

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

	private static ArsenalProjectiles instance;

	private readonly ArtMesh mesh = new ArtMesh();

	internal static Shot Spawn(UltimateController owner, int id, Vector2 from, Vector2 aim, float speed, float budget, float age)
	{
		//IL_0082: 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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: 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)