Decompiled source of TournamentEdition v2.4.7

plugins/Tournament Edition.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Chaos.AnimatorExtensions;
using Chaos.ListExtensions;
using Chaos.VectorExtensions;
using CustomPalettes;
using IL;
using LegendAPI;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Mythical;
using On;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public static class Utils
{
	public static T LoadFromEmbeddedJson<T>(string jsn)
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		string name = "Mythical." + jsn;
		string text;
		using (Stream stream = executingAssembly.GetManifestResourceStream(name))
		{
			using StreamReader streamReader = new StreamReader(stream);
			text = streamReader.ReadToEnd();
		}
		return JsonUtility.FromJson<T>(text);
	}
}
public static class Extensions
{
	public static ItemInfo loadSprite(this ItemInfo info, string name)
	{
		Sprite val = ImgHandler.LoadSprite(name);
		info.icon = (((Object)(object)val != (Object)null) ? val : null);
		return info;
	}

	public static Sprite loadSprite(string name)
	{
		Sprite val = ImgHandler.LoadSprite(name);
		return ((Object)(object)val != (Object)null) ? val : null;
	}
}
public class HeadgearDef
{
	public Sprite[] sprites = (Sprite[])(object)new Sprite[0];
}
public class WindowIconTools
{
	private class IconCache
	{
		private IntPtr bitmap = IntPtr.Zero;

		private IntPtr icon = IntPtr.Zero;

		public IntPtr update(byte[] bgra, int width, int height, bool topRowFirst = false)
		{
			IntPtr intPtr = CreateBitmap(width, height, 1u, 32u, null);
			IntPtr dC = GetDC(IntPtr.Zero);
			BITMAPINFOHEADER lpbmi = default(BITMAPINFOHEADER);
			lpbmi.Init();
			lpbmi.biWidth = width;
			lpbmi.biHeight = (topRowFirst ? (-height) : height);
			lpbmi.biPlanes = 1;
			lpbmi.biBitCount = 32;
			SetDIBits(dC, intPtr, 0u, (uint)height, bgra, ref lpbmi, 0u);
			ReleaseDC(IntPtr.Zero, dC);
			ICONINFO piconinfo = default(ICONINFO);
			piconinfo.IsIcon = true;
			piconinfo.ColorBitmap = intPtr;
			piconinfo.MaskBitmap = intPtr;
			IntPtr intPtr2 = CreateIconIndirect(ref piconinfo);
			if (intPtr2 == IntPtr.Zero)
			{
				DeleteObject(intPtr);
				return IntPtr.Zero;
			}
			if (bitmap != IntPtr.Zero)
			{
				DeleteObject(bitmap);
			}
			bitmap = intPtr;
			if (icon != IntPtr.Zero)
			{
				DestroyIcon(icon);
			}
			icon = intPtr2;
			return intPtr2;
		}
	}

	private struct BITMAPINFOHEADER
	{
		public uint biSize;

		public int biWidth;

		public int biHeight;

		public ushort biPlanes;

		public ushort biBitCount;

		public BitmapCompressionMode biCompression;

		public uint biSizeImage;

		public int biXPelsPerMeter;

		public int biYPelsPerMeter;

		public uint biClrUsed;

		public uint biClrImportant;

		public void Init()
		{
			biSize = (uint)Marshal.SizeOf((object)this);
		}
	}

	private enum BitmapCompressionMode : uint
	{
		BI_RGB,
		BI_RLE8,
		BI_RLE4,
		BI_BITFIELDS,
		BI_JPEG,
		BI_PNG
	}

	private struct ICONINFO
	{
		public bool IsIcon;

		public int xHotspot;

		public int yHotspot;

		public IntPtr MaskBitmap;

		public IntPtr ColorBitmap;
	}

	[ComImport]
	[Guid("c43dc798-95d1-4bea-9030-bb99e2983a1a")]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	private interface ITaskbarList4
	{
		[PreserveSig]
		void HrInit();

		[PreserveSig]
		void AddTab(IntPtr hwnd);

		[PreserveSig]
		void DeleteTab(IntPtr hwnd);

		[PreserveSig]
		void ActivateTab(IntPtr hwnd);

		[PreserveSig]
		void SetActiveAlt(IntPtr hwnd);

		[PreserveSig]
		void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);

		[PreserveSig]
		void SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal);

		[PreserveSig]
		void SetProgressState(IntPtr hwnd, TaskbarProgressBarState tbpFlags);

		[PreserveSig]
		void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI);

		[PreserveSig]
		void UnregisterTab(IntPtr hwndTab);

		[PreserveSig]
		void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore);

		[PreserveSig]
		void SetTabActive(IntPtr hwndTab, IntPtr hwndInsertBefore, uint dwReserved);

		[PreserveSig]
		int ThumbBarAddButtons(IntPtr hwnd, uint cButtons, IntPtr pButtons);

		[PreserveSig]
		int ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, IntPtr pButtons);

		[PreserveSig]
		void ThumbBarSetImageList(IntPtr hwnd, IntPtr himl);

		[PreserveSig]
		void SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription);

		[PreserveSig]
		void SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip);

		[PreserveSig]
		void SetThumbnailClip(IntPtr hwnd, IntPtr prcClip);
	}

	[ComImport]
	[Guid("56fdf344-fd6d-11d0-958a-006097c9a090")]
	[ClassInterface(ClassInterfaceType.None)]
	private class CTaskbarList
	{
	}

	private static IntPtr[] _SetIcon_baseIcon = new IntPtr[2];

	private static bool[] _SetIcon_hasBaseIcon = new bool[2];

	private static IconCache[] _SetIcon_cache = new IconCache[2]
	{
		new IconCache(),
		new IconCache()
	};

	private static IconCache _SetOverlayIcon_cache = new IconCache();

	private static object _initLock = new object();

	private static ITaskbarList4 _taskbarList;

	private static bool _taskbarListReady = false;

	private static IntPtr _mainWindow = IntPtr.Zero;

	private static ITaskbarList4 taskbarList
	{
		get
		{
			if (!_taskbarListReady)
			{
				lock (_initLock)
				{
					if (!_taskbarListReady)
					{
						try
						{
							_taskbarList = (ITaskbarList4)new CTaskbarList();
							_taskbarList.HrInit();
						}
						catch (Exception)
						{
							Debug.LogError((object)"ITaskbarList4 init failed! Go to Build Settings > Player Settings > Standalone > Other Settings, and set Api Compatibility Level to 4.x");
						}
						_taskbarListReady = true;
					}
				}
			}
			return _taskbarList;
		}
	}

	private static IntPtr mainWindow
	{
		get
		{
			if (_mainWindow == IntPtr.Zero)
			{
				lock (_initLock)
				{
					if (!(_mainWindow == IntPtr.Zero))
					{
					}
				}
			}
			return _mainWindow;
		}
	}

	public static bool SetIcon(Texture2D tex, WindowIconKind kind)
	{
		IntPtr intPtr = mainWindow;
		if (intPtr == IntPtr.Zero)
		{
			return false;
		}
		IntPtr intPtr2;
		if ((Object)(object)tex != (Object)null)
		{
			intPtr2 = _SetIcon_cache[(int)kind].update(new byte[0], ((Texture)tex).width, ((Texture)tex).height);
			if (intPtr2 == IntPtr.Zero)
			{
				return false;
			}
			if (!_SetIcon_hasBaseIcon[(int)kind])
			{
				_SetIcon_hasBaseIcon[(int)kind] = true;
				_SetIcon_baseIcon[(int)kind] = SendMessage(intPtr, 127, (int)kind, IntPtr.Zero);
			}
		}
		else
		{
			if (!_SetIcon_hasBaseIcon[(int)kind])
			{
				return true;
			}
			intPtr2 = _SetIcon_baseIcon[(int)kind];
		}
		SendMessage(intPtr, 128, (int)kind, intPtr2);
		return true;
	}

	public static bool SetIcon(byte[] bgra, int width, int height, WindowIconKind kind, bool topRowFirst = false)
	{
		IntPtr intPtr = mainWindow;
		if (intPtr == IntPtr.Zero)
		{
			return false;
		}
		IntPtr intPtr2;
		if (bgra != null)
		{
			intPtr2 = _SetIcon_cache[(int)kind].update(bgra, width, height, topRowFirst);
			if (intPtr2 == IntPtr.Zero)
			{
				return false;
			}
			if (!_SetIcon_hasBaseIcon[(int)kind])
			{
				_SetIcon_hasBaseIcon[(int)kind] = true;
				_SetIcon_baseIcon[(int)kind] = SendMessage(intPtr, 127, (int)kind, IntPtr.Zero);
			}
		}
		else
		{
			if (!_SetIcon_hasBaseIcon[(int)kind])
			{
				return true;
			}
			intPtr2 = _SetIcon_baseIcon[(int)kind];
		}
		SendMessage(intPtr, 128, (int)kind, intPtr2);
		return true;
	}

	public static bool SetOverlayIcon(Texture2D tex, string description = "")
	{
		IntPtr intPtr = mainWindow;
		if (intPtr == IntPtr.Zero)
		{
			return false;
		}
		if (!((Object)(object)tex != (Object)null))
		{
			taskbarList.SetOverlayIcon(intPtr, IntPtr.Zero, description);
		}
		return true;
	}

	public static bool SetProgress(TaskbarProgressBarState state, ulong completed, ulong total)
	{
		IntPtr intPtr = mainWindow;
		if (intPtr == IntPtr.Zero)
		{
			return false;
		}
		ITaskbarList4 taskbarList = WindowIconTools.taskbarList;
		taskbarList.SetProgressState(intPtr, state);
		taskbarList.SetProgressValue(intPtr, completed, total);
		return true;
	}

	public static bool SetProgressState(TaskbarProgressBarState state)
	{
		IntPtr intPtr = mainWindow;
		if (intPtr == IntPtr.Zero)
		{
			return false;
		}
		taskbarList.SetProgressState(intPtr, state);
		return true;
	}

	public static bool SetProgressValue(ulong completed, ulong total)
	{
		IntPtr intPtr = mainWindow;
		if (intPtr == IntPtr.Zero)
		{
			return false;
		}
		taskbarList.SetProgressValue(intPtr, completed, total);
		return true;
	}

	[DllImport("gdi32.dll")]
	[return: MarshalAs(UnmanagedType.Bool)]
	private static extern bool DeleteObject([In] IntPtr hObject);

	[DllImport("user32.dll", SetLastError = true)]
	private static extern bool DestroyIcon(IntPtr hIcon);

	[DllImport("gdi32.dll")]
	private static extern IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, [MarshalAs(UnmanagedType.LPArray)] byte[] lpvBits);

	[DllImport("gdi32.dll")]
	private static extern int SetDIBits(IntPtr hDC, IntPtr hBitmap, uint start, uint clines, byte[] lpvBits, ref BITMAPINFOHEADER lpbmi, uint colorUse);

	[DllImport("user32.dll")]
	private static extern IntPtr GetDC(IntPtr hWnd);

	[DllImport("user32.dll")]
	private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);

	[DllImport("user32.dll")]
	private static extern IntPtr CreateIconIndirect([In] ref ICONINFO piconinfo);

	[DllImport("user32.dll", CharSet = CharSet.Auto)]
	public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, IntPtr lParam);

	[DllImport("user32.dll")]
	private static extern IntPtr GetActiveWindow();
}
public enum WindowIconKind
{
	Small,
	Big
}
public enum TaskbarProgressBarState
{
	NoProgress = 0,
	Indeterminate = 1,
	Normal = 2,
	Error = 4,
	Paused = 8
}
namespace Mythical;

public class AirChannelDashGood : BaseDashState
{
	public static string staticID = "AirChannelDash";

	private WindBurst currentWB;

	private AirChannel currentAC;

	private Vector2 spawnPosition;

	private float burstScale = 1.75f;

	private ParticleSystemOverride implosionOverride = new ParticleSystemOverride
	{
		startSize = 5.5f,
		startLifetime = 0.7f
	};

	private ParticleSystemOverride implosionOverrideLarge = new ParticleSystemOverride
	{
		startSize = 6.5f,
		startLifetime = 0.6f
	};

	public AirChannelDashGood(FSM fsm, Player parentPlayer)
		: base("AirChannelDashGood", fsm, parentPlayer)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0037: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Expected O, but got Unknown
		((SkillState)this).applyStopElementStatus = true;
		((SkillState)this).InitChargeSkillSettings(2, 0f, ((SkillState)this).skillData, (SkillState)(object)this);
	}

	public override void SetEmpowered(bool givenStatus, BoolVarStatMod givenMod)
	{
		((SkillState)this).SetEmpowered(givenStatus, givenMod);
		burstScale = ((!((SkillState)this).IsEmpowered) ? 1.75f : 2f);
	}

	public override void OnEnter()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_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_00d0: 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_00dc: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
		((BaseDashState)this).OnEnter();
		if (base.cooldownReady)
		{
			spawnPosition = Vector2.op_Implicit(((State<Player>)this).parent.attackOriginTrans.position);
			CreateImplosion();
			SoundManager.PlayAudioWithDistance("StandardHeavySwing", (Vector2?)Vector2.op_Implicit(((Component)((State<Player>)this).parent).transform.position), (Transform)null, 24f, -1f, 1.4f, false);
			PoolManager.GetPoolItem<SectionedTrailEmitter>("WindTrail").Emit(spawnPosition, spawnPosition + ((SkillState)this).inputVector * 5f, -1, false, -1f, true, 0.3f, 0.15f, (Color32?)null, true, (Vector3?)null, (string)null);
			PoolManager.GetPoolItem<SectionedTrailEmitter>("WindTrail").Emit(spawnPosition, spawnPosition + ((SkillState)this).inputVector * 5f, -1, false, -1f, true, 0.4f, 0.15f, (Color32?)null, true, (Vector3?)null, (string)null);
		}
	}

	public override void OnExit()
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		if (base.cooldownReady && !((State<Player>)this).fsm.nextStateName.Contains("Hurt") && !((State<Player>)this).fsm.nextStateName.Contains("Dead"))
		{
			CreateAirChannel();
			if (((SkillState)this).IsEmpowered)
			{
				spawnPosition = Vector2.op_Implicit(((State<Player>)this).parent.attackOriginTrans.position);
				CreateImplosion();
			}
		}
		((BaseDashState)this).OnExit();
	}

	private void CreateImplosion()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: 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_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		currentWB = WindBurst.CreateBurst(Vector2.op_Implicit(spawnPosition), ((Entity)((State<Player>)this).parent).skillCategory, ((SkillState)this).skillID, 1, burstScale);
		currentWB.emitParticles = false;
		PoolManager.GetPoolItem<ParticleEffect>("WindBurstEffect").Emit((int?)3, (Vector3?)Vector2.op_Implicit(spawnPosition), (ParticleSystemOverride)null, (Vector3?)null, 0f, (float?)null, (Transform)null);
		PoolManager.GetPoolItem<ParticleEffect>("AirVortex").Emit((int?)1, (Vector3?)Vector2.op_Implicit(spawnPosition), implosionOverride, (Vector3?)new Vector3(0f, 0f, Random.Range(0f, 33f)), 0f, (float?)null, (Transform)null);
		PoolManager.GetPoolItem<ParticleEffect>("AirVortex").Emit((int?)1, (Vector3?)Vector2.op_Implicit(spawnPosition), implosionOverride, (Vector3?)new Vector3(0f, 0f, Random.Range(180f, 213f)), 0f, (float?)null, (Transform)null);
		PoolManager.GetPoolItem<ParticleEffect>("AirVortex").Emit((int?)1, (Vector3?)Vector2.op_Implicit(spawnPosition), implosionOverride, (Vector3?)new Vector3(0f, 0f, Random.Range(0f, 360f)), 0f, (float?)null, (Transform)null);
		PoolManager.GetPoolItem<ParticleEffect>("AirVortex").Emit((int?)1, (Vector3?)Vector2.op_Implicit(spawnPosition), implosionOverrideLarge, (Vector3?)new Vector3(0f, 0f, Random.Range(0f, 360f)), 0f, (float?)null, (Transform)null);
		DustEmitter poolItem = PoolManager.GetPoolItem<DustEmitter>();
		int num = 150;
		float num2 = 1.5f;
		Vector3? val = Vector2.op_Implicit(spawnPosition);
		poolItem.EmitCircle(num, num2, -8f, -1f, val, (Vector3?)null);
	}

	private void CreateAirChannel()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		currentAC = ((SkillState)this).ChaosInst<AirChannel>(AirChannel.Prefab, (Vector2?)spawnPosition, (Quaternion?)Globals.GetRotationQuaternion(((SkillState)this).inputVector), (Transform)null);
		currentAC.attack.SetAttackInfo(((Entity)((State<Player>)this).parent).skillCategory, ((SkillState)this).skillID, 2, false);
		currentAC.attack.knockbackOverwriteVector = ((SkillState)this).inputVector;
		currentAC.targetVector = ((SkillState)this).inputVector;
	}
}
public class FireBurstDash : BaseDashState
{
	public static string staticID = "Mythical::RadiantStorm";

	private Vector2 spawnPosition;

	public FireBurstDash(FSM fsm, Player parentPlayer)
		: base(staticID, fsm, parentPlayer)
	{
		((SkillState)this).applyStopElementStatus = true;
		((SkillState)this).isDash = true;
		((SkillState)this).InitChargeSkillSettings(2, 0f, ((SkillState)this).skillData, (SkillState)(object)this);
	}

	public override void SetEmpowered(bool givenStatus, BoolVarStatMod givenMod)
	{
		((SkillState)this).SetEmpowered(givenStatus, givenMod);
	}

	public override void OnEnter()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: 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)
		((BaseDashState)this).OnEnter();
		if (base.cooldownReady)
		{
			spawnPosition = Vector2.op_Implicit(((State<Player>)this).parent.attackOriginTrans.position);
			CreateExplosion(FlameBurst.burnSkillID, spawnPosition);
			SoundManager.PlayAudioWithDistance("StandardHeavySwing", (Vector2?)Vector2.op_Implicit(((Component)((State<Player>)this).parent).transform.position), (Transform)null, 24f, -1f, 1.4f, false);
			PoolManager.GetPoolItem<SectionedTrailEmitter>("FloorRift").Emit(spawnPosition, spawnPosition + ((SkillState)this).inputVector * 5f, -1, false, -1f, true, 0.3f, 0.15f, (Color32?)null, true, (Vector3?)null, (string)null);
			PoolManager.GetPoolItem<SectionedTrailEmitter>("FloorRift").Emit(spawnPosition, spawnPosition + ((SkillState)this).inputVector * 5f, -1, false, -1f, true, 0.4f, 0.15f, (Color32?)null, true, (Vector3?)null, (string)null);
		}
	}

	public override void OnExit()
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		if (base.cooldownReady && !((State<Player>)this).fsm.nextStateName.Contains("Hurt") && !((State<Player>)this).fsm.nextStateName.Contains("Dead") && ((SkillState)this).IsEmpowered)
		{
			spawnPosition = Vector2.op_Implicit(((State<Player>)this).parent.attackOriginTrans.position);
			CreateExplosion(FlameBurst.burnSkillID, spawnPosition);
		}
		Debug.Log((object)"Doing the thing");
		((BaseDashState)this).OnExit();
	}

	public void CreateExplosion(string skillID, Vector2 givenPosition, bool empower = false)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		FlameBurst.CreateBurst(Vector2.op_Implicit(givenPosition), ((Entity)((State<Player>)this).parent).skillCategory, skillID, 1, 2.5f * (empower ? 1.25f : 1f), true);
		SoundManager.PlayWithDistAndSPR("BlazingBlitzEnd", givenPosition, 1f);
		PoolManager.GetPoolItem<ParticleEffect>("SmokeEmitter").Emit((int?)6, (Vector3?)Vector2.op_Implicit(givenPosition), (ParticleSystemOverride)null, (Vector3?)null, 0f, (float?)null, (Transform)null);
		CameraController.ShakeCamera(0.25f, false);
	}
}
public class UseWindDefenseNerfed : UseBuffSkill
{
	public static string staticID = "UseWindDefenseNerfed";

	public static ParticleSystemOverride evadeEffectOverride = new ParticleSystemOverride
	{
		radius = 0.75f,
		startColor = Color32.op_Implicit(new Color(1f, 1f, 1f, 0.33f))
	};

	private static GameObject _effectPrefab;

	private static BoolVarStatMod fallMod = new BoolVarStatMod(UseWindDefense.staticID, true, 10);

	private static NumVarStatMod evadeMod = new NumVarStatMod(UseWindDefense.staticID, 1f, 0, (VarStatModType)0, false);

	private static NumVarStatMod moveMod = new NumVarStatMod(UseWindDefense.staticID, 0.4f, 10, (VarStatModType)2, false);

	private ParticleEffect currentEffect;

	private bool evadeStatus;

	private bool empStatus;

	private SkillState checkState;

	public static GameObject EffectPrefab
	{
		get
		{
			if ((Object)(object)UseWindDefense._effectPrefab == (Object)null)
			{
				UseWindDefense._effectPrefab = ChaosBundle.Get("Assets/Prefabs/Effects/Air/WindBallSmallEffect.prefab");
			}
			return UseWindDefense._effectPrefab;
		}
	}

	private bool ParentIsMoving
	{
		get
		{
			ref SkillState reference = ref checkState;
			IState currentState = ((State<Player>)this).fsm.currentState;
			reference = (SkillState)(object)((currentState is SkillState) ? currentState : null);
			return (checkState != null && (checkState.isBasic || checkState.isMovementSkill)) || (((State<Player>)this).fsm != null && (((State<Player>)this).fsm.currentStateName == ((State<Player>)this).name || ((State<Player>)this).fsm.currentStateName == "Run" || ((State<Player>)this).fsm.currentStateName == SlideState.staticID));
		}
	}

	public UseWindDefenseNerfed(FSM parentFSM, Player parentEntity)
		: base(staticID, parentFSM, parentEntity)
	{
		base.whileStopwatch.SetDelay(0.125f, false, false);
	}

	public override void SetBuffStatus(bool givenStatus)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		((UseBuffSkill)this).SetBuffStatus(givenStatus);
		evadeStatus = false;
		if (givenStatus)
		{
			empStatus = ((SkillState)this).IsEmpowered;
			((State<Player>)this).parent.overheadPrompt.PlayShakeAnalog(2f);
			SoundManager.PlayAudioWithDistance("WindArrowStart", (Vector2?)base.currentPosition, (Transform)null, 24f, -1f, 0.6f, false);
			string text = "TornadoEnd";
			Vector2? val = base.currentPosition;
			float num = Random.Range(0.75f, 0.85f);
			SoundManager.PlayAudioWithDistance(text, val, (Transform)null, 24f, -1f, num, false);
			DustEmitter poolItem = PoolManager.GetPoolItem<DustEmitter>();
			int num2 = 100;
			num = 0.5f;
			Vector3? val2 = Vector2.op_Implicit(base.currentPosition);
			poolItem.EmitCircle(num2, num, -1f, -1f, val2, (Vector3?)null);
			PoolManager.GetPoolItem<ParticleEffect>("WindBurstEffect").Emit((int?)5, (Vector3?)Vector2.op_Implicit(base.attackPosition), ParticleEffectOverrides.StartSpeed1p5, (Vector3?)null, 0f, (float?)null, (Transform)null);
			return;
		}
		ToggleMods(givenStatus: false, givenEmpStatus: true);
		((State<Player>)this).parent.overheadPrompt.HidePrompt(string.Empty);
		if ((Object)(object)currentEffect != (Object)null)
		{
			currentEffect.Stop();
			if ((Object)(object)((Component)currentEffect).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)currentEffect).gameObject, 1f);
			}
			currentEffect = null;
		}
		PoolManager.GetPoolItem<ParticleEffect>("WindBurstEffect").Emit((int?)6, (Vector3?)Vector2.op_Implicit(base.attackPosition), (ParticleSystemOverride)null, (Vector3?)null, 0f, (float?)null, (Transform)null);
		string text2 = "TornadoEnd";
		Vector2? val3 = base.currentPosition;
		float num3 = Random.Range(0.75f, 0.85f);
		SoundManager.PlayAudioWithDistance(text2, val3, (Transform)null, 24f, -1f, num3, false);
	}

	public override void WhileBuffActive()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		((UseBuffSkill)this).WhileBuffActive();
		if (evadeStatus)
		{
			string text = "WindCircle";
			Vector2? val = Vector2.op_Implicit(((Component)((State<Player>)this).parent).transform.position);
			float num = Random.Range(0.9f, 1.1f);
			SoundManager.PlayAudioWithDistance(text, val, (Transform)null, 24f, -1f, num, false);
			if (!ParentIsMoving)
			{
				evadeStatus = false;
				ToggleMods(givenStatus: false, empStatus);
			}
		}
		else if (ParentIsMoving)
		{
			evadeStatus = true;
			ToggleMods(givenStatus: true, empStatus);
		}
	}

	private void ToggleMods(bool givenStatus, bool givenEmpStatus)
	{
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)((Entity)((State<Player>)this).parent).health != (Object)null)
		{
			((VarStat<float>)(object)((Entity)((State<Player>)this).parent).health.evadeStat).Modify((VarStatMod<float>)(object)UseWindDefense.evadeMod, givenStatus);
		}
		if (givenEmpStatus)
		{
			if ((Object)(object)((Entity)((State<Player>)this).parent).movement != (Object)null)
			{
				((VarStat<float>)(object)((Entity)((State<Player>)this).parent).movement.moveSpeedStat).Modify((VarStatMod<float>)(object)UseWindDefense.moveMod, givenStatus);
			}
			((VarStat<bool>)(object)((Entity)((State<Player>)this).parent).fall.ignoreFall).Modify((VarStatMod<bool>)(object)UseWindDefense.fallMod, givenStatus);
			((Entity)((State<Player>)this).parent).TogglePreventFallCollider(!givenStatus);
		}
		else
		{
			if ((Object)(object)((Entity)((State<Player>)this).parent).movement != (Object)null)
			{
				((VarStat<float>)(object)((Entity)((State<Player>)this).parent).movement.moveSpeedStat).Modify((VarStatMod<float>)(object)UseWindDefense.moveMod, false);
			}
			((VarStat<bool>)(object)((Entity)((State<Player>)this).parent).fall.ignoreFall).Modify((VarStatMod<bool>)(object)UseWindDefense.fallMod, false);
			((Entity)((State<Player>)this).parent).TogglePreventFallCollider(true);
		}
		((State<Player>)this).parent.ToggleEnemyFloorCollisions(!givenStatus);
		if ((Object)(object)currentEffect == (Object)null)
		{
			currentEffect = Globals.ChaosInst<ParticleEffect>(UseWindDefense.EffectPrefab, (Transform)null, (Vector3?)((Entity)((State<Player>)this).parent).hurtBoxTransform.position, (Quaternion?)null);
		}
		if (givenStatus)
		{
			ParticleEffect val = currentEffect;
			int? num = 30;
			ParticleSystemOverride val2 = UseWindDefense.evadeEffectOverride;
			val.Emit(num, (Vector3?)null, val2, (Vector3?)null, 0f, (float?)null, (Transform)null);
			currentEffect.followTransform = ((Entity)((State<Player>)this).parent).hurtBoxTransform;
			ParticleEffect val3 = currentEffect;
			val2 = UseWindDefense.evadeEffectOverride;
			val3.Play((float?)null, (Vector3?)null, val2, (float?)null, (Transform)null, (Vector3?)null, 0f, true);
		}
		else
		{
			currentEffect.Stop();
		}
	}
}
internal class AllOrNothing : Item
{
	public static string staticID = "allOrNothing";

	public override string ExtraInfo => ((Item)this).PercentToStr(0.5f, "+-");

	public AllOrNothing()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		base.category = (Category)0;
		base.ID = staticID;
		base.isCursed = true;
	}

	public override void Activate()
	{
		SetModStatus(givenStatus: true);
	}

	public override void Deactivate()
	{
		SetModStatus(givenStatus: false);
	}

	public virtual void SetModStatus(bool givenStatus)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		if (givenStatus)
		{
			Health.TakeDamage += new hook_TakeDamage(AllNothing);
		}
		else
		{
			Health.TakeDamage -= new hook_TakeDamage(AllNothing);
		}
	}

	public bool AllNothing(orig_TakeDamage orig, Health self, AttackInfo info, Entity attackEntity, bool crit)
	{
		Entity entityScript = ((ComponentBase)self).entityScript;
		if (Random.value < 0.5f)
		{
			info.damage *= 3;
		}
		else
		{
			info.freezeChance = 0f;
			info.burnChance = 0f;
			info.chaosChance = 0f;
			info.critHitChance = 0f;
			info.poisonChance = 0f;
			info.rootChance = 0f;
			info.shockChance = 0f;
			info.shakeCamera = false;
			info.slowChance = 0f;
			info.knockbackMultiplier = 0f;
			_ = info.damage;
			info.damage = 0;
		}
		return orig.Invoke(self, info, attackEntity, crit);
	}
}
internal class AssetRedirector
{
}
internal class AttackInfoHolderMythical
{
}
internal class AttackSpeedUpItem : Item
{
	public static string staticID = "attackSpeedUpItem";

	public static NumVarStatMod atkSpeed;

	public override string ExtraInfo => ((Item)this).PercentToStr(0.1f, "+");

	public AttackSpeedUpItem()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		base.ID = staticID;
		base.category = (Category)0;
		atkSpeed = new NumVarStatMod(base.ID, 0.1f, 11, (VarStatModType)2, false);
	}

	public override void Activate()
	{
		SetModStatus(givenStatus: true);
	}

	public override void Deactivate()
	{
		SetModStatus(givenStatus: false);
	}

	public virtual void SetModStatus(bool givenStatus)
	{
		if (base.parentEntity.animSpeedHandler != null && atkSpeed != null)
		{
			base.parentEntity.animSpeedHandler.Modify(atkSpeed, givenStatus);
		}
	}
}
public class Behemoth : Item
{
	public static string staticID = "BrilliantBehemoth";

	protected NumVarStatMod damageMod;

	public float explosionRadius = 1.5f;

	public override string ExtraInfo => ((Item)this).PercentToStr(damageMod, "-");

	public Behemoth()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		base.ID = staticID;
		base.category = (Category)0;
		base.isCursed = true;
		damageMod = new NumVarStatMod(base.ID, -0.3f, 10, (VarStatModType)2, false);
	}

	public override void Activate()
	{
		SetModStatus(givenStatus: true);
	}

	public override void Deactivate()
	{
		SetModStatus(givenStatus: false);
	}

	public virtual void SetModStatus(bool givenStatus)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		StatManager.ModifyAllStatData(damageMod, base.parentSkillCategory, StatData.damageStr, new ModApplyConditional(base.IgnoreStatusConditional), givenStatus);
		if (givenStatus)
		{
			Health.TakeDamage += new hook_TakeDamage(ExplosionDamage);
		}
		else
		{
			Health.TakeDamage -= new hook_TakeDamage(ExplosionDamage);
		}
	}

	public void EnemyKillHeal(orig_OnEnemyKill orig, Player self, Entity givenEntity)
	{
		orig.Invoke(self, givenEntity);
		((Entity)self).health.RestoreHealth(3, true, true, false, true);
	}

	public bool ExplosionDamage(orig_TakeDamage orig, Health self, AttackInfo attackInfo, Entity attackEntity, bool crit)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if (Random.value < 0.25f)
		{
			CreateExplosion(FlameBurst.burnSkillID, Vector2.op_Implicit(((Component)self).transform.position));
		}
		return orig.Invoke(self, attackInfo, attackEntity, crit);
	}

	public void CreateExplosion(string skillID, Vector2 givenPosition)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		FlameBurst.CreateBurst(Vector2.op_Implicit(givenPosition), base.parentSkillCategory, skillID, 1, explosionRadius, true);
		SoundManager.PlayWithDistAndSPR("BlazingBlitzEnd", givenPosition, 1f);
		PoolManager.GetPoolItem<ParticleEffect>("SmokeEmitter").Emit((int?)6, (Vector3?)Vector2.op_Implicit(givenPosition), (ParticleSystemOverride)null, (Vector3?)null, 0f, (float?)null, (Transform)null);
		CameraController.ShakeCamera(0.25f, false);
	}
}
public static class ChaosArenaChanges
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_SetStageLayout <>9__11_0;

		public static hook_LoadNextLevel <>9__11_1;

		public static hook_Update <>9__11_2;

		public static hook_OnTriggerStay2D <>9__11_3;

		public static hook_OnTriggerExit2D <>9__11_4;

		public static hook_IsValidIndex <>9__11_5;

		public static hook_DisplayDialog <>9__11_6;

		internal void <Init>b__11_0(orig_SetStageLayout orig, PvpController self)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			orig.Invoke(self);
			if (!ContentLoader.StageEffects)
			{
				self.forceEmpowerDrop = false;
			}
			Debug.Log((object)"Layout hook");
			if (PvpController.selectedRoomName == "DefaultRoom" || PvpController.selectedRoomName == "Neutral")
			{
				MeshRenderer[] componentsInChildren = ((Component)self.selectedRoom).GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val in componentsInChildren)
				{
					if (((Object)((Renderer)val).material).name.ToLower().Contains("plazatile"))
					{
						if ((Object)(object)arenaTextureCarbonCopy == (Object)null)
						{
							arenaTextureCarbonCopy = new Texture2D(((Texture)arenaTextureReference).width, ((Texture)arenaTextureReference).height);
							((Texture)arenaTextureCarbonCopy).filterMode = (FilterMode)0;
							arenaTextureCarbonCopy.SetPixels32(arenaTextureReference.GetPixels32());
							arenaTextureCarbonCopy.Apply();
						}
						((Renderer)val).material.mainTexture = (Texture)(object)arenaTextureCarbonCopy;
					}
				}
			}
			if (arenaTileID >= 0)
			{
				Debug.Log((object)"Setting Tileset");
				if ((Object)(object)tilesets[arenaTileID].tileset != (Object)null)
				{
					arenaTextureCarbonCopy.SetPixels32(tilesets[arenaTileID].tileset.GetPixels32());
					arenaTextureCarbonCopy.Apply();
				}
				EditStage();
				Pathfinder.GenerateNodeMap(self.selectedRoom.tileGrid);
				if (!ContentLoader.StageEffects)
				{
					return;
				}
				string name = tilesets[arenaTileID].name;
				string text = name;
				if (!(text == "Domicile"))
				{
					if (text == "Dorm")
					{
						((Component)self).gameObject.AddComponent<ContestantAssault>().self = self;
					}
				}
				else
				{
					((Component)self).gameObject.AddComponent<UltraCouncilChallenge>().self = self;
				}
			}
			else
			{
				ResetTileSet();
			}
		}

		internal void <Init>b__11_1(orig_LoadNextLevel orig, PvpStageLoader self)
		{
			if (((Object)((Component)self).gameObject).name == "CUSTOMLOADER")
			{
				arenaTileID = tilesets.IndexOf(portalDict[((Component)self).gameObject]);
			}
			else
			{
				arenaTileID = -1;
			}
			orig.Invoke(self);
		}

		internal void <Init>b__11_2(orig_Update orig, PvpStageLoader self)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_0119: Expected O, but got Unknown
			if ((Object)(object)((NextLevelLoader)self).player == (Object)null || ((NextLevelLoader)self).portalEntered)
			{
				return;
			}
			if (((NextLevelLoader)self).player.IsDead || Vector2.Distance(Vector2.op_Implicit(((Component)((NextLevelLoader)self).player).transform.position), Vector2.op_Implicit(((Component)self).transform.position)) > 2f)
			{
				((NextLevelLoader)self).player = null;
				((NextLevelLoader)self).CurrentOverheadPrompt = null;
				if ((Object)(object)((NextLevelLoader)self).exitPortal != (Object)null)
				{
					((NextLevelLoader)self).exitPortal.Deactivate();
				}
			}
			else if (((NextLevelLoader)self).player.IsAvailable && ((NextLevelLoader)self).player.inputDevice.GetButtonDown("Interact"))
			{
				((NextLevelLoader)self).CurrentOverheadPrompt = null;
				Player[] activePlayers = GameController.activePlayers;
				foreach (Player val in activePlayers)
				{
					((Component)val).transform.position = ((Component)self).transform.position;
					((VarStat<bool>)(object)((Entity)val).fall.ignoreFall).AddMod((VarStatMod<bool>)new BoolVarStatMod("LevelLoad", true, 0));
					val.hurtBoxObj.SetActive(false);
				}
				if ((Object)(object)((NextLevelLoader)self).exitPortal != (Object)null)
				{
					((NextLevelLoader)self).exitPortal.Deactivate();
					((NextLevelLoader)self).exitPortal.Close();
				}
				else
				{
					((NextLevelLoader)self).LoadNextLevel();
				}
				((NextLevelLoader)self).portalEntered = true;
			}
		}

		internal void <Init>b__11_3(orig_OnTriggerStay2D orig, PvpStageLoader self, Collider2D c)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!((NextLevelLoader)self).forceTriggerExit && !((NextLevelLoader)self).portalEntered && (Object)(object)((NextLevelLoader)self).player == (Object)null)
			{
				((NextLevelLoader)self).player = Player.CheckForPlayer(c);
				if ((Object)(object)((NextLevelLoader)self).player != (Object)null && ((NextLevelLoader)self).player.IsAvailable)
				{
					((NextLevelLoader)self).CurrentOverheadPrompt.Initialize(((Component)self).transform, ((NextLevelLoader)self).player.inputDevice.inputScheme, ((NextLevelLoader)self).overheadPromptHeight, 0f);
					((NextLevelLoader)self).CurrentOverheadPrompt.DisplayPrompt("Interact", false, false);
					((NextLevelLoader)self).exitPortal.Prepare();
				}
			}
		}

		internal void <Init>b__11_4(orig_OnTriggerExit2D orig, PvpStageLoader self, Collider2D c)
		{
			bool flag = Object.op_Implicit((Object)(object)Player.CheckForPlayer(c));
			if (((NextLevelLoader)self).forceTriggerExit && flag)
			{
				((NextLevelLoader)self).forceTriggerExit = false;
			}
			if (flag && (Object)(object)((NextLevelLoader)self).player != (Object)null && ((NextLevelLoader)self).player.IsAvailable)
			{
				((NextLevelLoader)self).CurrentOverheadPrompt = null;
				((NextLevelLoader)self).player = null;
				if ((Object)(object)((NextLevelLoader)self).exitPortal != (Object)null)
				{
					((NextLevelLoader)self).exitPortal.Deactivate();
				}
			}
		}

		internal bool <Init>b__11_5(orig_IsValidIndex orig, DialogEntry self, int i, bool b)
		{
			if (self.messages == null)
			{
				return true;
			}
			return orig.Invoke(self, i, b);
		}

		internal bool <Init>b__11_6(orig_DisplayDialog orig, DialogManager self, string dialogID, int overrideIndex, string playerIDOverride, string leftIDOverride, string rightIDOverride, bool isSign, bool skipGhostWriter)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			if (!addedDialogues)
			{
				addedDialogues = true;
				foreach (ArenaDef tileset in tilesets)
				{
					Debug.Log((object)("Adding " + tileset.name));
					DialogSpeakerInfo value = new DialogSpeakerInfo("WOL-TEDS-" + tileset.name, tileset.name, "", (Color?)null, "", "", (Color?)null, "", "", (Color?)null, 0);
					DialogMessage val = new DialogMessage(DialogManager.dialogDict["PvP-Statue-Default"].messages[0]);
					val.message = tileset.description;
					val.leftSpeakerID = "WOL-TEDS-" + tileset.name;
					DialogEntry val2 = new DialogEntry(0);
					val2.currentIndex = 0;
					val2.ID = "WOL-TED-" + tileset.name;
					val2.messages = (DialogMessage[])(object)new DialogMessage[1] { val };
					DialogManager.dialogDict["WOL-TED-" + tileset.name] = val2;
					DialogManager.speakerDict["WOL-TEDS-" + tileset.name] = value;
				}
			}
			DialogMessage val3 = null;
			if (MaliceAdditions.MaliceActive && MaliceAdditions.maliceDialog.ContainsKey(dialogID))
			{
				if (!MaliceAdditions.maliceDialog.ContainsKey(dialogID))
				{
					return false;
				}
				MaliceAdditions.maliceDialog[dialogID].CurrentIndex = overrideIndex;
				if (MaliceAdditions.maliceDialog[dialogID].ScriptEnd)
				{
					MaliceAdditions.maliceDialog[dialogID].Reset();
					return false;
				}
				val3 = new DialogMessage(MaliceAdditions.maliceDialog[dialogID].GetMessage());
			}
			else
			{
				if (!DialogManager.dialogDict.ContainsKey(dialogID))
				{
					return false;
				}
				DialogManager.dialogDict[dialogID].CurrentIndex = overrideIndex;
				if (DialogManager.dialogDict[dialogID].ScriptEnd)
				{
					DialogManager.dialogDict[dialogID].Reset();
					return false;
				}
				val3 = new DialogMessage(DialogManager.dialogDict[dialogID].GetMessage());
			}
			if (DialogManager.speakerDict.ContainsKey(leftIDOverride))
			{
				val3.OverwriteSpeaker(leftIDOverride, true);
			}
			if (DialogManager.speakerDict.ContainsKey(rightIDOverride))
			{
				val3.OverwriteSpeaker(leftIDOverride, false);
			}
			if (val3.leftSpeakerID != null && val3.leftSpeakerID.Contains("Player"))
			{
				if (DialogManager.speakerDict.ContainsKey(playerIDOverride))
				{
					val3.OverwriteSpeaker(playerIDOverride, true);
				}
				else
				{
					if (GameController.activePlayers == null || !((Object)(object)GameController.activePlayers[0] != (Object)null))
					{
						return false;
					}
					val3.OverwriteSpeaker(val3.leftSpeakerID = DialogManager.speakerDict[((Entity)GameController.activePlayers[0]).skillCategory].speakerID, true);
				}
			}
			if (val3.rightSpeakerID != null && val3.rightSpeakerID.Contains("Player"))
			{
				if (DialogManager.speakerDict.ContainsKey(playerIDOverride))
				{
					val3.rightSpeakerID = playerIDOverride;
				}
				else
				{
					if (GameController.activePlayers == null || GameController.activePlayers.Length == 0 || !((Object)(object)GameController.activePlayers[0] != (Object)null))
					{
						return false;
					}
					val3.rightSpeakerID = DialogManager.speakerDict[((Entity)GameController.activePlayers[0]).skillCategory].speakerID;
				}
			}
			val3.message = self.ParseMessage(val3);
			self.Activate(val3, isSign, skipGhostWriter);
			DialogManager.dialogInProgress = true;
			DialogManager.currentDialogID = dialogID;
			return true;
		}
	}

	public static List<Texture2D> arenas = new List<Texture2D>();

	public static List<ArenaDef> tilesets = new List<ArenaDef>();

	public static Texture2D chosenArena = null;

	public static Texture2D arenaTextureReference = null;

	public static Texture2D arenaTextureCarbonCopy = null;

	public static Vector3 offset = new Vector3(25f, -22f, 0f);

	private static int arenaCount = 3;

	private static int customTilesetCount = 1;

	private static bool soloPortals = true;

	public static int arenaTileID = 0;

	public static Material mainMaterial;

	private static bool addedDialogues = false;

	private static Dictionary<GameObject, ArenaDef> portalDict = new Dictionary<GameObject, ArenaDef>();

	public static void Init()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Expected O, but got Unknown
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Expected O, but got Unknown
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Expected O, but got Unknown
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Expected O, but got Unknown
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Expected O, but got Unknown
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Expected O, but got Unknown
		//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_018b: Expected O, but got Unknown
		arenaTextureReference = ImgHandler.LoadTex2D("tilesetMain", pointFilter: true);
		tilesets.Add(new ArenaDef
		{
			name = "Dorm",
			description = "Face the Contestant Assault!",
			position = new Vector3(-19f, -6.5f, 0f),
			layout = ImgHandler.LoadTex2D("Arenas/arena1"),
			id = 0
		});
		tilesets.Add(new ArenaDef
		{
			name = "Domicile",
			description = "Face the Ultra Council Challenge!",
			position = new Vector3(20f, -6.5f, 0f),
			layout = ImgHandler.LoadTex2D("Arenas/arena2"),
			element = (ElementType)0,
			id = 1
		});
		object obj = <>c.<>9__11_0;
		if (obj == null)
		{
			hook_SetStageLayout val = delegate(orig_SetStageLayout orig, PvpController self)
			{
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Expected O, but got Unknown
				orig.Invoke(self);
				if (!ContentLoader.StageEffects)
				{
					self.forceEmpowerDrop = false;
				}
				Debug.Log((object)"Layout hook");
				if (PvpController.selectedRoomName == "DefaultRoom" || PvpController.selectedRoomName == "Neutral")
				{
					MeshRenderer[] componentsInChildren = ((Component)self.selectedRoom).GetComponentsInChildren<MeshRenderer>();
					foreach (MeshRenderer val12 in componentsInChildren)
					{
						if (((Object)((Renderer)val12).material).name.ToLower().Contains("plazatile"))
						{
							if ((Object)(object)arenaTextureCarbonCopy == (Object)null)
							{
								arenaTextureCarbonCopy = new Texture2D(((Texture)arenaTextureReference).width, ((Texture)arenaTextureReference).height);
								((Texture)arenaTextureCarbonCopy).filterMode = (FilterMode)0;
								arenaTextureCarbonCopy.SetPixels32(arenaTextureReference.GetPixels32());
								arenaTextureCarbonCopy.Apply();
							}
							((Renderer)val12).material.mainTexture = (Texture)(object)arenaTextureCarbonCopy;
						}
					}
				}
				if (arenaTileID >= 0)
				{
					Debug.Log((object)"Setting Tileset");
					if ((Object)(object)tilesets[arenaTileID].tileset != (Object)null)
					{
						arenaTextureCarbonCopy.SetPixels32(tilesets[arenaTileID].tileset.GetPixels32());
						arenaTextureCarbonCopy.Apply();
					}
					EditStage();
					Pathfinder.GenerateNodeMap(self.selectedRoom.tileGrid);
					if (ContentLoader.StageEffects)
					{
						string name = tilesets[arenaTileID].name;
						string text = name;
						if (!(text == "Domicile"))
						{
							if (text == "Dorm")
							{
								((Component)self).gameObject.AddComponent<ContestantAssault>().self = self;
							}
						}
						else
						{
							((Component)self).gameObject.AddComponent<UltraCouncilChallenge>().self = self;
						}
					}
				}
				else
				{
					ResetTileSet();
				}
			};
			<>c.<>9__11_0 = val;
			obj = (object)val;
		}
		PvpController.SetStageLayout += (hook_SetStageLayout)obj;
		object obj2 = <>c.<>9__11_1;
		if (obj2 == null)
		{
			hook_LoadNextLevel val2 = delegate(orig_LoadNextLevel orig, PvpStageLoader self)
			{
				if (((Object)((Component)self).gameObject).name == "CUSTOMLOADER")
				{
					arenaTileID = tilesets.IndexOf(portalDict[((Component)self).gameObject]);
				}
				else
				{
					arenaTileID = -1;
				}
				orig.Invoke(self);
			};
			<>c.<>9__11_1 = val2;
			obj2 = (object)val2;
		}
		PvpStageLoader.LoadNextLevel += (hook_LoadNextLevel)obj2;
		if (soloPortals)
		{
			object obj3 = <>c.<>9__11_2;
			if (obj3 == null)
			{
				hook_Update val3 = delegate(orig_Update orig, PvpStageLoader self)
				{
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f1: 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_0119: Expected O, but got Unknown
					if (!((Object)(object)((NextLevelLoader)self).player == (Object)null) && !((NextLevelLoader)self).portalEntered)
					{
						if (((NextLevelLoader)self).player.IsDead || Vector2.Distance(Vector2.op_Implicit(((Component)((NextLevelLoader)self).player).transform.position), Vector2.op_Implicit(((Component)self).transform.position)) > 2f)
						{
							((NextLevelLoader)self).player = null;
							((NextLevelLoader)self).CurrentOverheadPrompt = null;
							if ((Object)(object)((NextLevelLoader)self).exitPortal != (Object)null)
							{
								((NextLevelLoader)self).exitPortal.Deactivate();
							}
						}
						else if (((NextLevelLoader)self).player.IsAvailable && ((NextLevelLoader)self).player.inputDevice.GetButtonDown("Interact"))
						{
							((NextLevelLoader)self).CurrentOverheadPrompt = null;
							Player[] activePlayers = GameController.activePlayers;
							foreach (Player val11 in activePlayers)
							{
								((Component)val11).transform.position = ((Component)self).transform.position;
								((VarStat<bool>)(object)((Entity)val11).fall.ignoreFall).AddMod((VarStatMod<bool>)new BoolVarStatMod("LevelLoad", true, 0));
								val11.hurtBoxObj.SetActive(false);
							}
							if ((Object)(object)((NextLevelLoader)self).exitPortal != (Object)null)
							{
								((NextLevelLoader)self).exitPortal.Deactivate();
								((NextLevelLoader)self).exitPortal.Close();
							}
							else
							{
								((NextLevelLoader)self).LoadNextLevel();
							}
							((NextLevelLoader)self).portalEntered = true;
						}
					}
				};
				<>c.<>9__11_2 = val3;
				obj3 = (object)val3;
			}
			PvpStageLoader.Update += (hook_Update)obj3;
			object obj4 = <>c.<>9__11_3;
			if (obj4 == null)
			{
				hook_OnTriggerStay2D val4 = delegate(orig_OnTriggerStay2D orig, PvpStageLoader self, Collider2D c)
				{
					//IL_0071: Unknown result type (might be due to invalid IL or missing references)
					if (!((NextLevelLoader)self).forceTriggerExit && !((NextLevelLoader)self).portalEntered && (Object)(object)((NextLevelLoader)self).player == (Object)null)
					{
						((NextLevelLoader)self).player = Player.CheckForPlayer(c);
						if ((Object)(object)((NextLevelLoader)self).player != (Object)null && ((NextLevelLoader)self).player.IsAvailable)
						{
							((NextLevelLoader)self).CurrentOverheadPrompt.Initialize(((Component)self).transform, ((NextLevelLoader)self).player.inputDevice.inputScheme, ((NextLevelLoader)self).overheadPromptHeight, 0f);
							((NextLevelLoader)self).CurrentOverheadPrompt.DisplayPrompt("Interact", false, false);
							((NextLevelLoader)self).exitPortal.Prepare();
						}
					}
				};
				<>c.<>9__11_3 = val4;
				obj4 = (object)val4;
			}
			PvpStageLoader.OnTriggerStay2D += (hook_OnTriggerStay2D)obj4;
			object obj5 = <>c.<>9__11_4;
			if (obj5 == null)
			{
				hook_OnTriggerExit2D val5 = delegate(orig_OnTriggerExit2D orig, PvpStageLoader self, Collider2D c)
				{
					bool flag = Object.op_Implicit((Object)(object)Player.CheckForPlayer(c));
					if (((NextLevelLoader)self).forceTriggerExit && flag)
					{
						((NextLevelLoader)self).forceTriggerExit = false;
					}
					if (flag && (Object)(object)((NextLevelLoader)self).player != (Object)null && ((NextLevelLoader)self).player.IsAvailable)
					{
						((NextLevelLoader)self).CurrentOverheadPrompt = null;
						((NextLevelLoader)self).player = null;
						if ((Object)(object)((NextLevelLoader)self).exitPortal != (Object)null)
						{
							((NextLevelLoader)self).exitPortal.Deactivate();
						}
					}
				};
				<>c.<>9__11_4 = val5;
				obj5 = (object)val5;
			}
			PvpStageLoader.OnTriggerExit2D += (hook_OnTriggerExit2D)obj5;
		}
		object obj6 = <>c.<>9__11_5;
		if (obj6 == null)
		{
			hook_IsValidIndex val6 = (orig_IsValidIndex orig, DialogEntry self, int i, bool b) => self.messages == null || orig.Invoke(self, i, b);
			<>c.<>9__11_5 = val6;
			obj6 = (object)val6;
		}
		DialogEntry.IsValidIndex += (hook_IsValidIndex)obj6;
		object obj7 = <>c.<>9__11_6;
		if (obj7 == null)
		{
			hook_DisplayDialog val7 = delegate(orig_DisplayDialog orig, DialogManager self, string dialogID, int overrideIndex, string playerIDOverride, string leftIDOverride, string rightIDOverride, bool isSign, bool skipGhostWriter)
			{
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Expected O, but got Unknown
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Expected O, but got Unknown
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Expected O, but got Unknown
				//IL_0277: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Expected O, but got Unknown
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Expected O, but got Unknown
				if (!addedDialogues)
				{
					addedDialogues = true;
					foreach (ArenaDef tileset in tilesets)
					{
						Debug.Log((object)("Adding " + tileset.name));
						DialogSpeakerInfo value = new DialogSpeakerInfo("WOL-TEDS-" + tileset.name, tileset.name, "", (Color?)null, "", "", (Color?)null, "", "", (Color?)null, 0);
						DialogMessage val8 = new DialogMessage(DialogManager.dialogDict["PvP-Statue-Default"].messages[0]);
						val8.message = tileset.description;
						val8.leftSpeakerID = "WOL-TEDS-" + tileset.name;
						DialogEntry val9 = new DialogEntry(0);
						val9.currentIndex = 0;
						val9.ID = "WOL-TED-" + tileset.name;
						val9.messages = (DialogMessage[])(object)new DialogMessage[1] { val8 };
						DialogManager.dialogDict["WOL-TED-" + tileset.name] = val9;
						DialogManager.speakerDict["WOL-TEDS-" + tileset.name] = value;
					}
				}
				DialogMessage val10 = null;
				if (MaliceAdditions.MaliceActive && MaliceAdditions.maliceDialog.ContainsKey(dialogID))
				{
					if (!MaliceAdditions.maliceDialog.ContainsKey(dialogID))
					{
						return false;
					}
					MaliceAdditions.maliceDialog[dialogID].CurrentIndex = overrideIndex;
					if (MaliceAdditions.maliceDialog[dialogID].ScriptEnd)
					{
						MaliceAdditions.maliceDialog[dialogID].Reset();
						return false;
					}
					val10 = new DialogMessage(MaliceAdditions.maliceDialog[dialogID].GetMessage());
				}
				else
				{
					if (!DialogManager.dialogDict.ContainsKey(dialogID))
					{
						return false;
					}
					DialogManager.dialogDict[dialogID].CurrentIndex = overrideIndex;
					if (DialogManager.dialogDict[dialogID].ScriptEnd)
					{
						DialogManager.dialogDict[dialogID].Reset();
						return false;
					}
					val10 = new DialogMessage(DialogManager.dialogDict[dialogID].GetMessage());
				}
				if (DialogManager.speakerDict.ContainsKey(leftIDOverride))
				{
					val10.OverwriteSpeaker(leftIDOverride, true);
				}
				if (DialogManager.speakerDict.ContainsKey(rightIDOverride))
				{
					val10.OverwriteSpeaker(leftIDOverride, false);
				}
				if (val10.leftSpeakerID != null && val10.leftSpeakerID.Contains("Player"))
				{
					if (DialogManager.speakerDict.ContainsKey(playerIDOverride))
					{
						val10.OverwriteSpeaker(playerIDOverride, true);
					}
					else
					{
						if (GameController.activePlayers == null || !((Object)(object)GameController.activePlayers[0] != (Object)null))
						{
							return false;
						}
						val10.OverwriteSpeaker(val10.leftSpeakerID = DialogManager.speakerDict[((Entity)GameController.activePlayers[0]).skillCategory].speakerID, true);
					}
				}
				if (val10.rightSpeakerID != null && val10.rightSpeakerID.Contains("Player"))
				{
					if (DialogManager.speakerDict.ContainsKey(playerIDOverride))
					{
						val10.rightSpeakerID = playerIDOverride;
					}
					else
					{
						if (GameController.activePlayers == null || GameController.activePlayers.Length == 0 || !((Object)(object)GameController.activePlayers[0] != (Object)null))
						{
							return false;
						}
						val10.rightSpeakerID = DialogManager.speakerDict[((Entity)GameController.activePlayers[0]).skillCategory].speakerID;
					}
				}
				val10.message = self.ParseMessage(val10);
				self.Activate(val10, isSign, skipGhostWriter);
				DialogManager.dialogInProgress = true;
				DialogManager.currentDialogID = dialogID;
				return true;
			};
			<>c.<>9__11_6 = val7;
			obj7 = (object)val7;
		}
		DialogManager.DisplayDialog += (hook_DisplayDialog)obj7;
	}

	public static void ResetTileSet()
	{
		if (Object.op_Implicit((Object)(object)arenaTextureCarbonCopy) && Object.op_Implicit((Object)(object)arenaTextureReference))
		{
			arenaTextureCarbonCopy.SetPixels32(arenaTextureReference.GetPixels32());
			arenaTextureCarbonCopy.Apply();
		}
	}

	public static void AddCustomArenaPortals()
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ((Component)Object.FindObjectOfType<ExitPortal>()).gameObject;
		GameObject gameObject2 = ((Component)Object.FindObjectOfType<MuseumPlacard>()).gameObject;
		GameObject val = GameObject.Find("DefaultStatue");
		Vector3 val2 = default(Vector3);
		foreach (ArenaDef tileset in tilesets)
		{
			Debug.Log((object)("Adding portal for " + tileset.name));
			((Vector3)(ref val2))..ctor(0f, 15f, 0f);
			GameObject val3 = Object.Instantiate<GameObject>(gameObject, val2 + tileset.position, gameObject.transform.rotation);
			Object.Instantiate<GameObject>(val, val2 + tileset.position + Vector3.up * 1.5f, val.transform.rotation);
			ExitPortal component = val3.GetComponent<ExitPortal>();
			component.nextLevelLoader = ((Component)((Component)component).transform.Find("NextLevelTrigger")).GetComponent<NextLevelLoader>();
			((Object)component.nextLevelLoader).name = "CUSTOMLOADER";
			((PvpStageLoader)component.nextLevelLoader).pvpRoomName = "DefaultRoom";
			portalDict[((Component)component.nextLevelLoader).gameObject] = tileset;
			GameObject val4 = Object.Instantiate<GameObject>(gameObject2, val2 + tileset.position + new Vector3(0f, -0.25f, 0f), gameObject2.transform.rotation);
			MuseumPlacard component2 = val4.GetComponent<MuseumPlacard>();
			component2.dialogID = "WOL-TED-" + tileset.name;
			((Object)component2).name = "WOL-TED-" + tileset.name;
			component2.useObjectNameAsDialogID = false;
		}
	}

	public static void EditStage()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		chosenArena = tilesets[arenaTileID].layout;
		ElementalSpriteSelector[] array = Object.FindObjectsOfType<ElementalSpriteSelector>();
		foreach (ElementalSpriteSelector val in array)
		{
			val.SetElement(tilesets[arenaTileID].element);
		}
		GameObject val2 = null;
		List<string> list = new List<string> { "enemy", "statue" };
		GameObject[] array2 = Object.FindObjectsOfType<GameObject>();
		foreach (GameObject val3 in array2)
		{
			foreach (string item in list)
			{
				if ((Object)(object)val2 == (Object)null && ((Object)val3).name.ToLower() == "wizardstatue" && Object.op_Implicit((Object)(object)val3.GetComponentInChildren<Collider2D>()))
				{
					Debug.Log((object)"Assigned a Statue for duplication");
					val2 = val3;
					Collider2D[] componentsInChildren = val2.GetComponentsInChildren<Collider2D>();
					foreach (Collider2D val4 in componentsInChildren)
					{
						((Behaviour)val4).enabled = true;
					}
				}
				if (((Object)val3).name.ToLower().Contains(item) && ((Object)(object)val2 == (Object)null || ((Object)(object)val3 != (Object)(object)val2 && (Object)(object)val3.transform.parent != (Object)(object)val2)))
				{
					Object.Destroy((Object)(object)val3);
				}
			}
		}
		Vector3 val5 = default(Vector3);
		for (int l = 0; l < ((Texture)chosenArena).width; l++)
		{
			for (int m = 0; m < ((Texture)chosenArena).height; m++)
			{
				((Vector3)(ref val5))..ctor((float)(l * 2 - ((Texture)chosenArena).width), (float)(m * 2 - ((Texture)chosenArena).height), 0f);
				Color pixel = chosenArena.GetPixel(l, m);
				if (((Color)(ref pixel)).maxColorComponent < 0.01f)
				{
					GameObject val6 = Object.Instantiate<GameObject>(val2, val5 + offset, Quaternion.identity);
					Statue component = val6.GetComponent<Statue>();
					component.element = tilesets[arenaTileID].element;
					if (component.randomizeSprite)
					{
						component.statueRenderer.sprite = component.statueVars.GetElementalSprite(component.element);
						component.baseRenderer.sprite = component.baseVars.GetElementalSprite(component.element);
						component.floorRenderer.sprite = component.floorVars.GetElementalSprite(component.element);
					}
					SortSpriteLayer[] componentsInChildren2 = ((Component)component).GetComponentsInChildren<SortSpriteLayer>();
					foreach (SortSpriteLayer val7 in componentsInChildren2)
					{
						((Behaviour)val7).enabled = true;
					}
				}
			}
		}
		Object.Destroy((Object)(object)val2);
	}
}
public class ArenaDef
{
	public string name = "Arena";

	public string description = "No Special Effects...";

	public Vector3 position = Vector3.zero;

	public Texture2D tileset;

	public Texture2D layout;

	public ElementType element = (ElementType)5;

	public int id = -1;
}
public static class ContestantChanges
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Start <>9__3_1;

		public static hook_OnEnter <>9__3_2;

		public static hook_Update <>9__3_3;

		public static hook_Update <>9__3_4;

		public static hook_OnEnter <>9__3_5;

		public static hook_LoadEnemySkills <>9__3_0;

		internal void <Init>b__3_0(orig_LoadEnemySkills orig, string s)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			orig.Invoke(s);
			CreateFSM("ContestantSummonTornado", s);
			CreateFSM("ConFireball", s);
			CreateFSM("ConThrow", s);
			if (hasLoadedChanges)
			{
				return;
			}
			hasLoadedChanges = true;
			object obj = <>9__3_1;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig2, Contestant self)
				{
					orig2.Invoke(self);
					((Entity)self).skillCategory = "Enemy";
					skill++;
					skill %= 3;
					int[] array = new int[3] { 24, 49, 65 };
					Material material = ((Renderer)((Entity)self).spriteRenderer).material;
					material.SetFloat("_PaletteIndex", (float)array[skill]);
					switch (skill)
					{
					case 0:
						break;
					case 1:
						((Entity)self).fsm.ReplaceState("Tornado", (IState)(object)new ContestantAirShieldState("Tornado", ((Entity)self).fsm, self));
						((Entity)self).fsm.ReplaceState("Fireball", (IState)(object)new ContestantIonSpreadState("Fireball", ((Entity)self).fsm, self));
						break;
					case 2:
						((Entity)self).fsm.ReplaceState("Fireball", (IState)(object)new ContestantAquaBeamState("Fireball", ((Entity)self).fsm, (Enemy)(object)self));
						break;
					}
				};
				<>9__3_1 = val;
				obj = (object)val;
			}
			Contestant.Start += (hook_Start)obj;
			object obj2 = <>9__3_2;
			if (obj2 == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig2, TornadoState self)
				{
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0060: Unknown result type (might be due to invalid IL or missing references)
					((Entity)((State<Contestant>)(object)self).parent).movement.EndMovement();
					AnimationExtension.PlayDirectional(((Entity)((State<Contestant>)(object)self).parent).anim, "Cast" + ((object)(FacingDirection)(ref ((Entity)((State<Contestant>)(object)self).parent).facingDirection)).ToString(), -1, 0f);
					self.tornadoScript = Object.Instantiate<GameObject>(self.tornadoPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Quaternion.identity).GetComponent<Tornado>();
					self.tornadoScript.attackBox.SetAttackInfo("EnemyScaled", "ContestantSummonTornado", 1, false);
				};
				<>9__3_2 = val2;
				obj2 = (object)val2;
			}
			TornadoState.OnEnter += (hook_OnEnter)obj2;
			object obj3 = <>9__3_3;
			if (obj3 == null)
			{
				hook_Update val3 = delegate(orig_Update orig2, FireballState self)
				{
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_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)
					if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.2f) && !self.fireballCreated)
					{
						self.fireballScript = (Projectile)(object)Object.Instantiate<GameObject>(self.fireballPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Globals.GetRotationQuaternion(self.targetVector)).GetComponent<Fireball>();
						((Object)((Component)self.fireballScript).gameObject).name = ((Entity)((State<Contestant>)(object)self).parent).skillCategory + "Fireball";
						self.fireballScript.parentObject = ((Component)((State<Contestant>)(object)self).parent).gameObject;
						self.fireballScript.moveVector = self.targetVector;
						self.fireballScript.attackBox.SetAttackInfo("EnemyScaled", "ConFireball", 1, false);
						self.fireballCreated = true;
					}
					else if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.9f))
					{
						((Enemy)((State<Contestant>)(object)self).parent).HandleExitTransitions(false);
					}
				};
				<>9__3_3 = val3;
				obj3 = (object)val3;
			}
			FireballState.Update += (hook_Update)obj3;
			object obj4 = <>9__3_4;
			if (obj4 == null)
			{
				hook_Update val4 = delegate(orig_Update orig2, SwordThrowState self)
				{
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_007b: 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_00be: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
					if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.2f) && !self.swordThrown)
					{
						self.swordThrown = true;
						self.swordThrowScript = Object.Instantiate<GameObject>(self.swordThrowPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Quaternion.identity).GetComponent<SwordThrowProjectile>();
						((Projectile)self.swordThrowScript).parentObject = ((Component)((State<Contestant>)(object)self).parent).gameObject;
						((Projectile)self.swordThrowScript).moveVector = self.targetVector;
						((Projectile)self.swordThrowScript).destroyOnDisable = true;
						((Projectile)self.swordThrowScript).attackBox.SetAttackInfo("EnemyScaled", "ConThrow", 1, false);
						SoundManager.PlayAudioWithDistance("WindBoomerang", (Vector2?)Vector2.op_Implicit(((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position), (Transform)null, 24f, -1f, 1f, false);
					}
					else if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.9f))
					{
						((Enemy)((State<Contestant>)(object)self).parent).HandleExitTransitions(false);
					}
				};
				<>9__3_4 = val4;
				obj4 = (object)val4;
			}
			SwordThrowState.Update += (hook_Update)obj4;
			object obj5 = <>9__3_5;
			if (obj5 == null)
			{
				hook_OnEnter val5 = delegate(orig_OnEnter orig2, AttackState self)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0088: Unknown result type (might be due to invalid IL or missing references)
					//IL_008f: Unknown result type (might be due to invalid IL or missing references)
					//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
					((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo = Entity.GetClosestTarget(((Enemy)((State<Contestant>)(object)self).parent).targetGroup, ((Component)((State<Contestant>)(object)self).parent).transform.position, ((Enemy)((State<Contestant>)(object)self).parent).escapeRadius, ((Enemy)((State<Contestant>)(object)self).parent).onlyTargetPlayers, (List<GameObject>)null, (GameObject)null, false, 0);
					if (((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo == null)
					{
						((State<Contestant>)(object)self).fsm.ChangeState("GoBack", false);
					}
					else
					{
						self.slash1 = false;
						((Entity)((State<Contestant>)(object)self).parent).FaceTarget(((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo.position, 4, false);
						AnimationExtension.PlayDirectional(((Entity)((State<Contestant>)(object)self).parent).anim, "Slash1" + ((object)(FacingDirection)(ref ((Entity)((State<Contestant>)(object)self).parent).facingDirection)).ToString(), -1, 0f);
						SoundManager.PlayAudioWithDistance("LightSlash", (Vector2?)Vector2.op_Implicit(((Component)((State<Contestant>)(object)self).parent).transform.position), (Transform)null, 24f, -1f, 1f, false);
						((Entity)((State<Contestant>)(object)self).parent).attack.SetAttackInfo("EnemyScaled", "NeutralKnightAttack", 2, false);
						((Entity)((State<Contestant>)(object)self).parent).movement.EndMovement();
					}
				};
				<>9__3_5 = val5;
				obj5 = (object)val5;
			}
			AttackState.OnEnter += (hook_OnEnter)obj5;
		}

		internal void <Init>b__3_1(orig_Start orig2, Contestant self)
		{
			orig2.Invoke(self);
			((Entity)self).skillCategory = "Enemy";
			skill++;
			skill %= 3;
			int[] array = new int[3] { 24, 49, 65 };
			Material material = ((Renderer)((Entity)self).spriteRenderer).material;
			material.SetFloat("_PaletteIndex", (float)array[skill]);
			switch (skill)
			{
			case 0:
				break;
			case 1:
				((Entity)self).fsm.ReplaceState("Tornado", (IState)(object)new ContestantAirShieldState("Tornado", ((Entity)self).fsm, self));
				((Entity)self).fsm.ReplaceState("Fireball", (IState)(object)new ContestantIonSpreadState("Fireball", ((Entity)self).fsm, self));
				break;
			case 2:
				((Entity)self).fsm.ReplaceState("Fireball", (IState)(object)new ContestantAquaBeamState("Fireball", ((Entity)self).fsm, (Enemy)(object)self));
				break;
			}
		}

		internal void <Init>b__3_2(orig_OnEnter orig2, TornadoState self)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			((Entity)((State<Contestant>)(object)self).parent).movement.EndMovement();
			AnimationExtension.PlayDirectional(((Entity)((State<Contestant>)(object)self).parent).anim, "Cast" + ((object)(FacingDirection)(ref ((Entity)((State<Contestant>)(object)self).parent).facingDirection)).ToString(), -1, 0f);
			self.tornadoScript = Object.Instantiate<GameObject>(self.tornadoPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Quaternion.identity).GetComponent<Tornado>();
			self.tornadoScript.attackBox.SetAttackInfo("EnemyScaled", "ContestantSummonTornado", 1, false);
		}

		internal void <Init>b__3_3(orig_Update orig2, FireballState self)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.2f) && !self.fireballCreated)
			{
				self.fireballScript = (Projectile)(object)Object.Instantiate<GameObject>(self.fireballPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Globals.GetRotationQuaternion(self.targetVector)).GetComponent<Fireball>();
				((Object)((Component)self.fireballScript).gameObject).name = ((Entity)((State<Contestant>)(object)self).parent).skillCategory + "Fireball";
				self.fireballScript.parentObject = ((Component)((State<Contestant>)(object)self).parent).gameObject;
				self.fireballScript.moveVector = self.targetVector;
				self.fireballScript.attackBox.SetAttackInfo("EnemyScaled", "ConFireball", 1, false);
				self.fireballCreated = true;
			}
			else if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.9f))
			{
				((Enemy)((State<Contestant>)(object)self).parent).HandleExitTransitions(false);
			}
		}

		internal void <Init>b__3_4(orig_Update orig2, SwordThrowState self)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.2f) && !self.swordThrown)
			{
				self.swordThrown = true;
				self.swordThrowScript = Object.Instantiate<GameObject>(self.swordThrowPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Quaternion.identity).GetComponent<SwordThrowProjectile>();
				((Projectile)self.swordThrowScript).parentObject = ((Component)((State<Contestant>)(object)self).parent).gameObject;
				((Projectile)self.swordThrowScript).moveVector = self.targetVector;
				((Projectile)self.swordThrowScript).destroyOnDisable = true;
				((Projectile)self.swordThrowScript).attackBox.SetAttackInfo("EnemyScaled", "ConThrow", 1, false);
				SoundManager.PlayAudioWithDistance("WindBoomerang", (Vector2?)Vector2.op_Implicit(((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position), (Transform)null, 24f, -1f, 1f, false);
			}
			else if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.9f))
			{
				((Enemy)((State<Contestant>)(object)self).parent).HandleExitTransitions(false);
			}
		}

		internal void <Init>b__3_5(orig_OnEnter orig2, AttackState self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo = Entity.GetClosestTarget(((Enemy)((State<Contestant>)(object)self).parent).targetGroup, ((Component)((State<Contestant>)(object)self).parent).transform.position, ((Enemy)((State<Contestant>)(object)self).parent).escapeRadius, ((Enemy)((State<Contestant>)(object)self).parent).onlyTargetPlayers, (List<GameObject>)null, (GameObject)null, false, 0);
			if (((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo == null)
			{
				((State<Contestant>)(object)self).fsm.ChangeState("GoBack", false);
				return;
			}
			self.slash1 = false;
			((Entity)((State<Contestant>)(object)self).parent).FaceTarget(((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo.position, 4, false);
			AnimationExtension.PlayDirectional(((Entity)((State<Contestant>)(object)self).parent).anim, "Slash1" + ((object)(FacingDirection)(ref ((Entity)((State<Contestant>)(object)self).parent).facingDirection)).ToString(), -1, 0f);
			SoundManager.PlayAudioWithDistance("LightSlash", (Vector2?)Vector2.op_Implicit(((Component)((State<Contestant>)(object)self).parent).transform.position), (Transform)null, 24f, -1f, 1f, false);
			((Entity)((State<Contestant>)(object)self).parent).attack.SetAttackInfo("EnemyScaled", "NeutralKnightAttack", 2, false);
			((Entity)((State<Contestant>)(object)self).parent).movement.EndMovement();
		}
	}

	public static StatData tornadoData;

	public static bool hasLoadedChanges;

	public static int skill;

	public static void Init()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		object obj = <>c.<>9__3_0;
		if (obj == null)
		{
			hook_LoadEnemySkills val = delegate(orig_LoadEnemySkills orig, string s)
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Expected O, but got Unknown
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Expected O, but got Unknown
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Expected O, but got Unknown
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Expected O, but got Unknown
				orig.Invoke(s);
				CreateFSM("ContestantSummonTornado", s);
				CreateFSM("ConFireball", s);
				CreateFSM("ConThrow", s);
				if (!hasLoadedChanges)
				{
					hasLoadedChanges = true;
					object obj2 = <>c.<>9__3_1;
					if (obj2 == null)
					{
						hook_Start val2 = delegate(orig_Start orig2, Contestant self)
						{
							orig2.Invoke(self);
							((Entity)self).skillCategory = "Enemy";
							skill++;
							skill %= 3;
							int[] array = new int[3] { 24, 49, 65 };
							Material material = ((Renderer)((Entity)self).spriteRenderer).material;
							material.SetFloat("_PaletteIndex", (float)array[skill]);
							switch (skill)
							{
							case 0:
								break;
							case 1:
								((Entity)self).fsm.ReplaceState("Tornado", (IState)(object)new ContestantAirShieldState("Tornado", ((Entity)self).fsm, self));
								((Entity)self).fsm.ReplaceState("Fireball", (IState)(object)new ContestantIonSpreadState("Fireball", ((Entity)self).fsm, self));
								break;
							case 2:
								((Entity)self).fsm.ReplaceState("Fireball", (IState)(object)new ContestantAquaBeamState("Fireball", ((Entity)self).fsm, (Enemy)(object)self));
								break;
							}
						};
						<>c.<>9__3_1 = val2;
						obj2 = (object)val2;
					}
					Contestant.Start += (hook_Start)obj2;
					object obj3 = <>c.<>9__3_2;
					if (obj3 == null)
					{
						hook_OnEnter val3 = delegate(orig_OnEnter orig2, TornadoState self)
						{
							//IL_005b: Unknown result type (might be due to invalid IL or missing references)
							//IL_0060: Unknown result type (might be due to invalid IL or missing references)
							((Entity)((State<Contestant>)(object)self).parent).movement.EndMovement();
							AnimationExtension.PlayDirectional(((Entity)((State<Contestant>)(object)self).parent).anim, "Cast" + ((object)(FacingDirection)(ref ((Entity)((State<Contestant>)(object)self).parent).facingDirection)).ToString(), -1, 0f);
							self.tornadoScript = Object.Instantiate<GameObject>(self.tornadoPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Quaternion.identity).GetComponent<Tornado>();
							self.tornadoScript.attackBox.SetAttackInfo("EnemyScaled", "ContestantSummonTornado", 1, false);
						};
						<>c.<>9__3_2 = val3;
						obj3 = (object)val3;
					}
					TornadoState.OnEnter += (hook_OnEnter)obj3;
					object obj4 = <>c.<>9__3_3;
					if (obj4 == null)
					{
						hook_Update val4 = delegate(orig_Update orig2, FireballState self)
						{
							//IL_003e: Unknown result type (might be due to invalid IL or missing references)
							//IL_0044: Unknown result type (might be due to invalid IL or missing references)
							//IL_0049: Unknown result type (might be due to invalid IL or missing references)
							//IL_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)
							if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.2f) && !self.fireballCreated)
							{
								self.fireballScript = (Projectile)(object)Object.Instantiate<GameObject>(self.fireballPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Globals.GetRotationQuaternion(self.targetVector)).GetComponent<Fireball>();
								((Object)((Component)self.fireballScript).gameObject).name = ((Entity)((State<Contestant>)(object)self).parent).skillCategory + "Fireball";
								self.fireballScript.parentObject = ((Component)((State<Contestant>)(object)self).parent).gameObject;
								self.fireballScript.moveVector = self.targetVector;
								self.fireballScript.attackBox.SetAttackInfo("EnemyScaled", "ConFireball", 1, false);
								self.fireballCreated = true;
							}
							else if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.9f))
							{
								((Enemy)((State<Contestant>)(object)self).parent).HandleExitTransitions(false);
							}
						};
						<>c.<>9__3_3 = val4;
						obj4 = (object)val4;
					}
					FireballState.Update += (hook_Update)obj4;
					object obj5 = <>c.<>9__3_4;
					if (obj5 == null)
					{
						hook_Update val5 = delegate(orig_Update orig2, SwordThrowState self)
						{
							//IL_0045: Unknown result type (might be due to invalid IL or missing references)
							//IL_004a: Unknown result type (might be due to invalid IL or missing references)
							//IL_007b: 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_00be: Unknown result type (might be due to invalid IL or missing references)
							//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
							if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.2f) && !self.swordThrown)
							{
								self.swordThrown = true;
								self.swordThrowScript = Object.Instantiate<GameObject>(self.swordThrowPrefab, ((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position, Quaternion.identity).GetComponent<SwordThrowProjectile>();
								((Projectile)self.swordThrowScript).parentObject = ((Component)((State<Contestant>)(object)self).parent).gameObject;
								((Projectile)self.swordThrowScript).moveVector = self.targetVector;
								((Projectile)self.swordThrowScript).destroyOnDisable = true;
								((Projectile)self.swordThrowScript).attackBox.SetAttackInfo("EnemyScaled", "ConThrow", 1, false);
								SoundManager.PlayAudioWithDistance("WindBoomerang", (Vector2?)Vector2.op_Implicit(((Entity)((State<Contestant>)(object)self).parent).hurtBoxTransform.position), (Transform)null, 24f, -1f, 1f, false);
							}
							else if (AnimationExtension.AnimPlayed(((Entity)((State<Contestant>)(object)self).parent).anim, 0.9f))
							{
								((Enemy)((State<Contestant>)(object)self).parent).HandleExitTransitions(false);
							}
						};
						<>c.<>9__3_4 = val5;
						obj5 = (object)val5;
					}
					SwordThrowState.Update += (hook_Update)obj5;
					object obj6 = <>c.<>9__3_5;
					if (obj6 == null)
					{
						hook_OnEnter val6 = delegate(orig_OnEnter orig2, AttackState self)
						{
							//IL_001d: Unknown result type (might be due to invalid IL or missing references)
							//IL_0088: Unknown result type (might be due to invalid IL or missing references)
							//IL_008f: Unknown result type (might be due to invalid IL or missing references)
							//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
							//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
							((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo = Entity.GetClosestTarget(((Enemy)((State<Contestant>)(object)self).parent).targetGroup, ((Component)((State<Contestant>)(object)self).parent).transform.position, ((Enemy)((State<Contestant>)(object)self).parent).escapeRadius, ((Enemy)((State<Contestant>)(object)self).parent).onlyTargetPlayers, (List<GameObject>)null, (GameObject)null, false, 0);
							if (((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo == null)
							{
								((State<Contestant>)(object)self).fsm.ChangeState("GoBack", false);
							}
							else
							{
								self.slash1 = false;
								((Entity)((State<Contestant>)(object)self).parent).FaceTarget(((Enemy)((State<Contestant>)(object)self).parent).closestTargetInfo.position, 4, false);
								AnimationExtension.PlayDirectional(((Entity)((State<Contestant>)(object)self).parent).anim, "Slash1" + ((object)(FacingDirection)(ref ((Entity)((State<Contestant>)(object)self).parent).facingDirection)).ToString(), -1, 0f);
								SoundManager.PlayAudioWithDistance("LightSlash", (Vector2?)Vector2.op_Implicit(((Component)((State<Contestant>)(object)self).parent).transform.position), (Transform)null, 24f, -1f, 1f, false);
								((Entity)((State<Contestant>)(object)self).parent).attack.SetAttackInfo("EnemyScaled", "NeutralKnightAttack", 2, false);
								((Entity)((State<Contestant>)(object)self).parent).movement.EndMovement();
							}
						};
						<>c.<>9__3_5 = val6;
						obj6 = (object)val6;
					}
					AttackState.OnEnter += (hook_OnEnter)obj6;
				}
			};
			<>c.<>9__3_0 = val;
			obj = (object)val;
		}
		StatManager.LoadEnemySkills += (hook_LoadEnemySkills)obj;
	}

	public static void CreateFSM(string id, string s)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		SkillStats val = Utils.LoadFromEmbeddedJson<SkillStats>(id + ".json");
		val.Initialize();
		tornadoData = new StatData(val, "Enemy" + s);
		FSMUtils.ApplyStateModifiers(s, tornadoData);
		StatManager.data["Skills"]["Enemy" + s][id] = tornadoData;
	}
}
public static class FSMUtils
{
	public static void ReplaceState(this FSM fsm, string stateName, IState newState)
	{
		fsm.states.Remove(stateName);
		fsm.AddState(newState);
	}

	public static void ApplyStateModifiers(string categoryModifier, StatData statData)
	{
		List<string> value = statData.GetValue<List<string>>("targetNames", -1);
		if (value.Contains(Globals.allyHBStr) || value.Contains(Globals.enemyHBStr))
		{
			value.Add(Globals.ffaHBStr);
		}
		if (value.Contains(Globals.allyFCStr) || value.Contains(Globals.enemyFCStr))
		{
			value.Add(Globals.ffaFCStr);
		}
		bool flag = true;
		switch (categoryModifier)
		{
		case "Only":
			if (value.Contains(Globals.allyHBStr))
			{
				value.Remove(Globals.allyHBStr);
				value.Add(Globals.enemyHBStr);
			}
			if (value.Contains(Globals.allyFCStr))
			{
				value.Remove(Globals.allyFCStr);
				value.Add(Globals.enemyFCStr);
			}
			break;
		case "FFA":
			if (value.Contains(Globals.allyHBStr))
			{
				value.Add(Globals.enemyHBStr);
			}
			if (value.Contains(Globals.allyFCStr))
			{
				value.Add(Globals.enemyFCStr);
			}
			break;
		case "AsAlly":
			value.Remove(Globals.ffaHBStr);
			value.Remove(Globals.ffaFCStr);
			break;
		}
		statData.currentLevel = 1;
	}
}
public class ContestantAirShieldState : SkillState
{
	private Contestant c;

	private ChaosQuickStopwatch durationStopwatch = new ChaosQuickStopwatch(4f);

	private ChaosQuickStopwatch audioStopwatch = new ChaosQuickStopwatch(0.25f);

	private NumVarStatMod evadeMod;

	private bool evadeActive;

	private ParticleEffect currentEffect;

	public ContestantAirShieldState(string newName, FSM newFSM, Contestant newEnt)
		: base(newName, newFSM, (Enemy)(object)newEnt, 1, 1, 1f, 1f, 5f, false)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		((State<Enemy>)this).parent = (Enemy)(object)newEnt;
		base.requireLineOfSight = false;
		evadeMod = new NumVarStatMod(base.skillID, 1f, 10, (VarStatModType)0, false);
		c = newEnt;
	}

	public override bool IsReady()
	{
		return ((SkillState)this).IsReady() && !evadeActive;
	}

	public override void OnEnter()
	{
		((SkillState)this).OnEnter();
		((Entity)((State<Enemy>)this).parent).movement.EndMovement();
		((Entity)((State<Enemy>)this).parent).anim.Play("ChargeAlt", -1, 0f);
		evadeActive = false;
	}

	public override void WindupUpdate()
	{
		((SkillState)this).WindupUpdate();
		((Entity)((State<Enemy>)this).parent).anim.Play("ChargeAlt", -1, 0f);
	}

	public override void OnExit()
	{
		((SkillState)this).OnExit();
		if (!((SkillState)this).WindupCheck)
		{
			BreakShield();
		}
		c.tornadoReady = false;
		c.tornadoStopwatchID = ChaosStopwatch.Begin(c.tornadoCooldown, false, 0f, 0, 0);
	}

	public override void ExecuteSkill()
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		((SkillState)this).ExecuteSkill();
		((Entity)((State<Enemy>)this).parent).anim.Play("ChargeAlt", -1, 0.5f);
		((SkillState)this).DeactivatePowerUpEffect(false);
		PoolManager.GetPoolItem<ParticleEffect>("WindBurstEffect").Emit((int?)5, (Vector3?)((Entity)((State<Enemy>)this).parent).hurtBoxTransform.position, ParticleEffectOverrides.StartSpeed1p5, (Vector3?)null, 0f, (float?)null, (Transform)null);
		DustEmitter poolItem = PoolManager.GetPoolItem<DustEmitter>();
		int num = 100;
		float num2 = 0.5f;
		Vector3? val = ((Component)((State<Enemy>)this).parent).transform.position;
		poolItem.EmitCircle(num, num2, -1f, -1f, val, (Vector3?)null);
		CameraController.ShakeCamera(0.3f, false);
		SoundManager.PlayAudioWithDistance("WindArrowStart", (Vector2?)Vector2.op_Implicit(((Component)((State<Enemy>)this).parent).transform.position), (Transform)null, 24f, -1f, 0.6f, false);
		string text = "TornadoEnd";
		Vector2? val2 = Vector2.op_Implicit(((Component)((State<Enemy>)this).parent).transform.position);
		num2 = Random.Range(0.75f, 0.85f);
		SoundManager.PlayAudioWithDistance(text, val2, (Transform)null, 24f, -1f, num2, false);
		((MonoBehaviour)((State<Enemy>)this).parent).StartCoroutine(EvadeOn());
	}

	private void OnEvade()
	{
		//IL_001c: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Expected O, but got Unknown
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		PoolManager.GetPoolItem<ParticleEffect>("WindBurstEffect").Emit((int?)6, (Vector3?)((Entity)((State<Enemy>)this).parent).hurtBoxTransform.position, (ParticleSystemOverride)nu