Decompiled source of Root Stones v1.2.1

Root Infinity Stones.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using CardChoiceSpawnUniqueCardPatch;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using ClassesManagerReborn;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using Photon.Pun;
using Photon.Realtime;
using RarityBundle;
using RarityLib.Utils;
using RootCore;
using RootCore.CardConditions;
using UnboundLib;
using UnboundLib.GameModes;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UI.ProceduralImage;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RootStones
{
	public class Gauntlet : ClassHandler
	{
		[CompilerGenerated]
		private sealed class <Init>d__1 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Init>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				Gauntlet.stones = (RootCardInfo[])(object)new RootCardInfo[6]
				{
					CardList.GetCardInfo("Time_Stone"),
					CardList.GetCardInfo("Mind_Stone"),
					CardList.GetCardInfo("Reality_Stone"),
					CardList.GetCardInfo("Space_Stone"),
					CardList.GetCardInfo("Soul_Stone"),
					CardList.GetCardInfo("Power_Stone")
				};
				ClassesRegistry.Register((CardInfo)(object)CardList.GetCardInfo("Quest"), (CardType)1, 0);
				RootCardInfo[] stones = Gauntlet.stones;
				for (int i = 0; i < stones.Length; i++)
				{
					ClassesRegistry.Register((CardInfo)(object)stones[i], (CardType)16, (CardInfo)(object)CardList.GetCardInfo("Quest"), 0);
				}
				RootCardInfo cardInfo = CardList.GetCardInfo("Gauntlet");
				CardInfo[] stones2 = (CardInfo[])(object)Gauntlet.stones;
				ClassesRegistry.Register((CardInfo)(object)cardInfo, (CardType)16, stones2, 0);
				return false;
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		public static RootCardInfo[] stones;

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		public override IEnumerator Init()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <Init>d__1(0);
		}
	}
	internal class LoopedTime : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Enable>d__27 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoopedTime <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Enable>d__27(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				LoopedTime loopedTime = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				loopedTime.Enabled = true;
				return false;
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <Reset>d__28 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoopedTime <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Reset>d__28(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0066: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				LoopedTime loopedTime = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				try
				{
					loopedTime.Enabled = false;
					loopedTime.timer = 0f;
					((Graphic)loopedTime.outerRing).color = Color32.op_Implicit(new Color32((byte)0, (byte)255, (byte)0, (byte)255));
					Object.Destroy((Object)(object)loopedTime._pentagram);
					loopedTime.stored = false;
				}
				catch (Exception val)
				{
					Core.Debug((object)val);
				}
				return false;
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		private float timer;

		private bool stored;

		private Vector3 playerPos;

		private float playerHealth;

		private int playerAmmo;

		private bool playerIsRelaoding;

		private float playerReloadCounter;

		private float playerFreeReloadCounter;

		private float playerBlockCounter;

		private int extraLives;

		public Player player;

		public GunAmmo gunAmmo;

		public Gun gun;

		public Block block;

		[Range(0f, 1f)]
		public float counter;

		public float timeToFill = 5f;

		public float timeToEmpty;

		public float duration = 1f;

		public ProceduralImage outerRing;

		public ProceduralImage fill;

		public Transform rotator;

		public Transform still;

		public GameObject pentagram;

		private GameObject _pentagram;

		public bool Enabled;

		public void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			player = ((Component)this).GetComponentInParent<Player>();
			gun = player.data.weaponHandler.gun;
			gunAmmo = ((Component)gun).GetComponentInChildren<GunAmmo>();
			block = ((Component)this).GetComponentInParent<Block>();
			((Component)this).gameObject.AddComponent<FollowPlayer>().target = (Target)0;
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 5, (Action)([CompilerGenerated] () =>
			{
				((Component)this).transform.SetParent((Transform)null);
			}));
		}

		public void Start()
		{
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Reset);
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Enable);
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		private IEnumerator Enable(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <Enable>d__27(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		private IEnumerator Reset(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <Reset>d__28(0)
			{
				<>4__this = this
			};
		}

		public void OnDestroy()
		{
			GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Reset);
			GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Enable);
			Object.Destroy((Object)(object)_pentagram);
		}

		public void Update()
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			if (Enabled && (Object)(object)player != (Object)null && !player.data.healthHandler.isRespawning && (!player.data.dead || UtilityExtenions.HasCard(player, "Gauntlet")))
			{
				timer += Time.deltaTime;
				counter = timer / 5f;
				((Image)outerRing).fillAmount = counter;
				((Image)fill).fillAmount = counter;
				((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
				if ((double)timer > 1.5 && timer < 2f)
				{
					if (player.data.view.IsMine)
					{
						if (((Graphic)outerRing).color.r == 0f)
						{
							((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)255, (byte)150, (byte)0, (byte)255));
							((Graphic)((Component)rotator).gameObject.GetComponentInChildren<ProceduralImage>()).color = ((Graphic)outerRing).color;
						}
						else
						{
							((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)150, (byte)255, (byte)0, (byte)255));
							((Graphic)((Component)rotator).gameObject.GetComponentInChildren<ProceduralImage>()).color = ((Graphic)outerRing).color;
						}
					}
				}
				else if (!stored && timer >= 2f)
				{
					if (player.data.view.IsMine)
					{
						((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)255, (byte)0, (byte)0, (byte)255));
						((Graphic)((Component)rotator).gameObject.GetComponentInChildren<ProceduralImage>()).color = ((Graphic)outerRing).color;
					}
					playerPos = ((Component)player).transform.position;
					playerHealth = player.data.health;
					playerAmmo = gunAmmo.currentAmmo;
					playerIsRelaoding = gun.isReloading;
					playerReloadCounter = gunAmmo.reloadCounter;
					playerFreeReloadCounter = gunAmmo.freeReloadCounter;
					playerBlockCounter = block.counter;
					extraLives = player.data.stats.remainingRespawns;
					stored = true;
					if (player.data.view.IsMine)
					{
						_pentagram = Object.Instantiate<GameObject>(pentagram, playerPos, Quaternion.identity);
						ExtensionMethods.GetOrAddComponent<Canvas>(_pentagram, false).sortingOrder = 10000;
						_pentagram.transform.localScale = Vector3.one * 0.1f;
					}
					((MonoBehaviour)Core.instance).StartCoroutine(GameModeManager.TriggerHook(String.Concat("TimeLoop-", ((Int32)(ref player.playerID)).ToString(), "-Save")));
				}
				else if (stored && timer <= 5f)
				{
					if (player.data.view.IsMine)
					{
						_pentagram.transform.localScale = Vector3.one * ((1f - (timer - 2f) / 3f) * 0.15f);
					}
				}
				else
				{
					if (!(timer >= 5f))
					{
						return;
					}
					if (player.data.view.IsMine)
					{
						((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)0, (byte)255, (byte)0, (byte)255));
						((Graphic)((Component)rotator).gameObject.GetComponentInChildren<ProceduralImage>()).color = ((Graphic)outerRing).color;
					}
					timer = 0f;
					stored = false;
					block.counter = playerBlockCounter;
					((Component)player).GetComponentInParent<PlayerCollision>().IgnoreWallForFrames(2);
					((Component)player).transform.position = playerPos;
					if (UtilityExtenions.HasCard(player, "Gauntlet"))
					{
						player.data.stats.remainingRespawns = extraLives;
						if (player.data.dead)
						{
							player.data.dead = false;
							player.data.healthHandler.isRespawning = false;
							((Component)player).gameObject.SetActive(true);
						}
					}
					player.data.health = playerHealth;
					gunAmmo.currentAmmo = playerAmmo;
					gun.isReloading = playerIsRelaoding;
					gunAmmo.reloadCounter = playerReloadCounter;
					gunAmmo.freeReloadCounter = playerFreeReloadCounter;
					for (int num = ((Component)gunAmmo.populate).transform.childCount - 1; num >= 0; num--)
					{
						if (((Component)((Component)gunAmmo.populate).transform.GetChild(num)).gameObject.activeSelf)
						{
							Object.Destroy((Object)(object)((Component)((Component)gunAmmo.populate).transform.GetChild(num)).gameObject);
						}
					}
					gunAmmo.populate.times = gunAmmo.currentAmmo;
					gunAmmo.populate.DoPopulate();
					gunAmmo.SetActiveBullets(true);
					((MonoBehaviour)Core.instance).StartCoroutine(GameModeManager.TriggerHook(String.Concat("TimeLoop-", ((Int32)(ref player.playerID)).ToString(), "-Load")));
					if (player.data.view.IsMine)
					{
						Object.Destroy((Object)(object)_pentagram);
					}
				}
			}
			else
			{
				((Image)outerRing).fillAmount = 0f;
				((Image)fill).fillAmount = 0f;
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Systems.R00t.InfinityStones", "Root Stones", "1.2.1")]
	[BepInProcess("Rounds.exe")]
	public class Main : BaseUnityPlugin
	{
		private const string ModId = "Systems.R00t.InfinityStones";

		private const string ModName = "Root Stones";

		public const string Version = "1.2.1";

		public static AssetBundle Assets;

		public static List<string> Stones;

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("Systems.R00t.InfinityStones").PatchAll();
			Assets = AssetUtils.LoadAssetBundleFromResources("stoneassets", typeof(Main).Assembly);
			Core.RegesterCards(Assets.LoadAsset<GameObject>("Stone").GetComponent<CardList>(), false);
		}

		private void Start()
		{
			TabInfoRegesterer.RegesterInfo(TabInfoRegesterer.cat, "Stones", (Func<Player, bool>)HasStones, (Func<Player, string>)GetStoneString, 6);
		}

		private bool HasStones(Player player)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			Enumerator<string> enumerator = Stones.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					string current = enumerator.Current;
					if (UtilityExtenions.HasCard(player, current))
					{
						return true;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			return false;
		}

		private string GetStoneString(Player player)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return "ERROR";
			}
			int num = 0;
			Enumerator<string> enumerator = Stones.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					string current = enumerator.Current;
					if (UtilityExtenions.HasCard(player, current))
					{
						num++;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			if (num == 6 && UtilityExtenions.HasCard(player, "Gauntlet"))
			{
				return "Empowered";
			}
			return String.Format("{0}/6", (object)num);
		}

		static Main()
		{
			List<string> obj = new List<string>();
			obj.Add("Time_Stone");
			obj.Add("Mind_Stone");
			obj.Add("Reality_Stone");
			obj.Add("Space_Stone");
			obj.Add("Soul_Stone");
			obj.Add("Power_Stone");
			Stones = obj;
		}
	}
	public class PointErasure : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass4_0 : Object
		{
			public PointErasure <>4__this;

			public IGameModeHandler gm;

			internal bool <OnPointEnd>b__3(int id)
			{
				return id != <>4__this.player.teamID;
			}

			internal int <OnPointEnd>b__4(int id)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return gm.GetTeamScore(id).points;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass5_0 : Object
		{
			public PointErasure <>4__this;

			public IGameModeHandler gm;

			internal bool <OnRoundEnd>b__1(int id)
			{
				return id != <>4__this.player.teamID;
			}

			internal int <OnRoundEnd>b__2(int id)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return gm.GetTeamScore(id).rounds;
			}
		}

		[CompilerGenerated]
		private sealed class <OnPointEnd>d__4 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PointErasure <>4__this;

			public IGameModeHandler gm;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <OnPointEnd>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				PointErasure pointErasure = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>c__DisplayClass4_0 CS$<>8__locals0 = new <>c__DisplayClass4_0
				{
					<>4__this = <>4__this,
					gm = gm
				};
				Dictionary<int, int> val = (Dictionary<int, int>)ExtensionMethods.GetFieldValue((object)GameModeManager.CurrentHandler.GameMode, "teamRounds");
				bool flag = Enumerable.Count<int>((IEnumerable<int>)(object)val.Keys) != Enumerable.Count<int>((IEnumerable<int>)(object)pointErasure.lastTeamRounds.Keys);
				Enumerator<int, int> enumerator = pointErasure.lastTeamRounds.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<int, int> current = enumerator.Current;
						if (!val.ContainsKey(current.Key) || val[current.Key] != current.Value)
						{
							flag = true;
						}
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
				if (flag)
				{
					pointErasure.lastTeamRounds = Enumerable.ToDictionary<KeyValuePair<int, int>, int, int>((IEnumerable<KeyValuePair<int, int>>)(object)val, (Func<KeyValuePair<int, int>, int>)((KeyValuePair<int, int> entry) => entry.Key), (Func<KeyValuePair<int, int>, int>)((KeyValuePair<int, int> entry) => entry.Value));
					return false;
				}
				if (!Extensions.Contains(CS$<>8__locals0.gm.GetPointWinners(), pointErasure.player.teamID))
				{
					return false;
				}
				int num2 = Enumerable.Last<int>((IEnumerable<int>)(object)Enumerable.OrderBy<int, int>(Enumerable.Where<int>(Enumerable.Distinct<int>(Enumerable.Select<Player, int>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, int>)((Player p) => p.teamID))), (Func<int, bool>)((int id) => id != CS$<>8__locals0.<>4__this.player.teamID)), (Func<int, int>)((int id) => CS$<>8__locals0.gm.GetTeamScore(id).points)));
				TeamScore teamScore = CS$<>8__locals0.gm.GetTeamScore(num2);
				CS$<>8__locals0.gm.SetTeamScore(num2, new TeamScore(teamScore.points - 1, teamScore.rounds));
				return false;
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <OnRoundEnd>d__5 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PointErasure <>4__this;

			public IGameModeHandler gm;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <OnRoundEnd>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				PointErasure pointErasure = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0
				{
					<>4__this = <>4__this,
					gm = gm
				};
				if (!UtilityExtenions.HasCard(pointErasure.player, "Gauntlet"))
				{
					return false;
				}
				if (!Extensions.Contains(CS$<>8__locals0.gm.GetRoundWinners(), pointErasure.player.teamID))
				{
					return false;
				}
				int num2 = Enumerable.Last<int>((IEnumerable<int>)(object)Enumerable.OrderBy<int, int>(Enumerable.Where<int>(Enumerable.Distinct<int>(Enumerable.Select<Player, int>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, int>)((Player p) => p.teamID))), (Func<int, bool>)((int id) => id != CS$<>8__locals0.<>4__this.player.teamID)), (Func<int, int>)((int id) => CS$<>8__locals0.gm.GetTeamScore(id).rounds)));
				TeamScore teamScore = CS$<>8__locals0.gm.GetTeamScore(num2);
				CS$<>8__locals0.gm.SetTeamScore(num2, new TeamScore(teamScore.points, teamScore.rounds - 1));
				return false;
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		private Player player;

		private Dictionary<int, int> lastTeamRounds = new Dictionary<int, int>();

		private void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)OnPointEnd);
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd);
			lastTeamRounds = Enumerable.ToDictionary<KeyValuePair<int, int>, int, int>((IEnumerable<KeyValuePair<int, int>>)(object)(Dictionary<int, int>)ExtensionMethods.GetFieldValue((object)GameModeManager.CurrentHandler.GameMode, "teamRounds"), (Func<KeyValuePair<int, int>, int>)((KeyValuePair<int, int> entry) => entry.Key), (Func<KeyValuePair<int, int>, int>)((KeyValuePair<int, int> entry) => entry.Value));
		}

		private void OnDestroy()
		{
			GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)OnPointEnd);
			GameModeManager.RemoveHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd);
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		internal IEnumerator OnPointEnd(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <OnPointEnd>d__4(0)
			{
				<>4__this = this,
				gm = gm
			};
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		internal IEnumerator OnRoundEnd(IGameModeHandler gm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <OnRoundEnd>d__5(0)
			{
				<>4__this = this,
				gm = gm
			};
		}
	}
	public class Stone : OnAddEffect
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0 : Object
		{
			public Player player;

			public Rarity rarity;

			internal int <OnAdd>b__1(RootCardInfo stone)
			{
				return UtilityExtenions.HasCard(player, (CardInfo)(object)stone) ? 1 : 0;
			}

			internal void <OnAdd>b__0(RootCardInfo stone)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				((CardInfo)stone).rarity = rarity;
			}
		}

		public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
			CS$<>8__locals0.player = player;
			CS$<>8__locals0.rarity = RarityBundle.Divine;
			switch (Enumerable.Sum(Enumerable.Select<RootCardInfo, int>((IEnumerable<RootCardInfo>)(object)Gauntlet.stones, (Func<RootCardInfo, int>)((RootCardInfo stone) => UtilityExtenions.HasCard(CS$<>8__locals0.player, (CardInfo)(object)stone) ? 1 : 0))))
			{
			case 1:
				CS$<>8__locals0.rarity = RarityBundle.Mythical;
				break;
			case 2:
				CS$<>8__locals0.rarity = RarityBundle.Legendary;
				break;
			case 3:
				CS$<>8__locals0.rarity = RarityBundle.Epic;
				break;
			case 4:
				CS$<>8__locals0.rarity = RarityBundle.Rare;
				break;
			case 5:
				CS$<>8__locals0.rarity = RarityBundle.Exotic;
				break;
			}
			Enumerable.ToList<RootCardInfo>((IEnumerable<RootCardInfo>)(object)Gauntlet.stones).ForEach((Action<RootCardInfo>)delegate(RootCardInfo stone)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				((CardInfo)stone).rarity = CS$<>8__locals0.rarity;
			});
		}
	}
	public class TeleportStone : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayMove>d__16 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BlockTriggerType triggerType;

			public TeleportStone <>4__this;

			public Vector3 beforePos;

			private Enumerator<Player> <>7__wrap1;

			private Player <player>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayMove>d__16(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<player>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Invalid comparison between Unknown and I4
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Invalid comparison between Unknown and I4
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Invalid comparison between Unknown and I4
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Expected O, but got Unknown
				//IL_015d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					int num = <>1__state;
					TeleportStone CS$<>8__locals0 = <>4__this;
					if (num != 0)
					{
						if (num != 1)
						{
							return false;
						}
						<>1__state = -3;
						goto IL_00f3;
					}
					<>1__state = -1;
					if ((int)triggerType != 0 && (int)triggerType != 4)
					{
						return false;
					}
					List<Player> val = Enumerable.ToList<Player>((IEnumerable<Player>)(object)Enumerable.OrderBy<Player, float>(Enumerable.Where<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)([CompilerGenerated] (Player p) => p.teamID != CS$<>8__locals0.data.player.teamID && !p.data.dead)), (Func<Player, float>)([CompilerGenerated] (Player p) => Vector2.Distance(Vector2.op_Implicit(((Component)CS$<>8__locals0).transform.position), Vector2.op_Implicit(((Component)p).transform.position)))));
					if (!UtilityExtenions.HasCard(CS$<>8__locals0.data.player, "Gauntlet"))
					{
						List<Player> obj = new List<Player>();
						obj.Add(val[0]);
						val = obj;
					}
					<>7__wrap1 = val.GetEnumerator();
					<>1__state = -3;
					goto IL_0285;
					IL_0285:
					if (<>7__wrap1.MoveNext())
					{
						<player>5__3 = <>7__wrap1.Current;
						if ((int)triggerType == 4)
						{
							<>2__current = (object)new WaitForSeconds(0f);
							<>1__state = 1;
							return true;
						}
						goto IL_00f3;
					}
					<>m__Finally1();
					return false;
					IL_00f3:
					Vector3 val2 = ((Component)<player>5__3).transform.position;
					Vector3 position = ((Component)<player>5__3).transform.position;
					if ((int)triggerType == 4)
					{
						position = beforePos;
					}
					else
					{
						int num2 = (int)CS$<>8__locals0.distance * CS$<>8__locals0.level.attackLevel;
						float num3 = CS$<>8__locals0.distance * (float)CS$<>8__locals0.level.attackLevel / (float)num2;
						for (int i = 0; i < num2; i++)
						{
							val2 += num3 * CS$<>8__locals0.data.aimDirection;
							if (!Object.op_Implicit((Object)(object)Physics2D.OverlapCircle(Vector2.op_Implicit(val2), 0.5f)))
							{
								position = val2;
							}
						}
					}
					for (int j = 0; j < CS$<>8__locals0.remainParts.Length; j++)
					{
						((Component)CS$<>8__locals0.remainParts[j]).transform.position = ((Component)<player>5__3).transform.root.position;
						CS$<>8__locals0.remainParts[j].Play();
					}
					((Component)<player>5__3).GetComponent<PlayerCollision>().IgnoreWallForFrames(2);
					((Component)<player>5__3).transform.root.position = position;
					for (int k = 0; k < CS$<>8__locals0.parts.Length; k++)
					{
						((Component)CS$<>8__locals0.parts[k]).transform.position = position;
						CS$<>8__locals0.parts[k].Play();
					}
					<player>5__3.data.playerVel.velocity = Vector2.zero;
					<player>5__3.data.sinceGrounded = 0f;
					<player>5__3 = null;
					goto IL_0285;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>7__wrap1).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		public ParticleSystem[] parts;

		public ParticleSystem[] remainParts;

		public float distance = 10f;

		public float softCooldown;

		public float hardCooldown;

		public float delay;

		internal int delayStacks;

		internal float cooldownTimer;

		public LayerMask mask;

		private CharacterData data;

		private AttackLevel level;

		private float GetHardCooldown()
		{
			if (!UtilityExtenions.HasCard(data.player, "Gauntlet"))
			{
				return hardCooldown;
			}
			return softCooldown;
		}

		private void Start()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			parts = ((Component)this).GetComponentsInChildren<ParticleSystem>();
			data = ((Component)this).GetComponentInParent<CharacterData>();
			level = ((Component)this).GetComponentInParent<AttackLevel>();
			Block componentInParent = ((Component)this).GetComponentInParent<Block>();
			componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)(object)Delegate.Combine((Delegate)(object)componentInParent.SuperFirstBlockAction, (Delegate)(object)new Action<BlockTriggerType>(Go));
			cooldownTimer = GetHardCooldown();
			delayStacks = 0;
			Transform obj = ((Component)this).transform.parent.Find("Limbs/ArmStuff/ShieldStone/Canvas/Image");
			obj.localScale *= 1.2f;
			((Graphic)((Component)((Component)this).transform.parent.Find("Limbs/ArmStuff/ShieldStone/Canvas/Image")).GetComponent<Image>()).color = new Color(0.3f, 0.6f, 1f);
		}

		private void Update()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (cooldownTimer < GetHardCooldown())
			{
				cooldownTimer += Time.deltaTime;
				return;
			}
			delayStacks = 0;
			((Graphic)((Component)((Component)this).transform.parent.Find("Limbs/ArmStuff/ShieldStone/Canvas/Image")).GetComponent<Image>()).color = new Color(0.3f, 0.6f, 1f);
		}

		private void OnDestroy()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Block componentInParent = ((Component)this).GetComponentInParent<Block>();
			componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)(object)Delegate.Remove((Delegate)(object)componentInParent.SuperFirstBlockAction, (Delegate)(object)new Action<BlockTriggerType>(Go));
			((Graphic)((Component)((Component)this).transform.parent.Find("Limbs/ArmStuff/ShieldStone/Canvas/Image")).GetComponent<Image>()).color = new Color(0.8f, 0.8f, 0.8f);
			Transform obj = ((Component)this).transform.parent.Find("Limbs/ArmStuff/ShieldStone/Canvas/Image");
			obj.localScale /= 1.2f;
		}

		public void Go(BlockTriggerType triggerType)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if (!(cooldownTimer < softCooldown))
			{
				((MonoBehaviour)this).StartCoroutine(DelayMove(triggerType, ((Component)this).transform.position));
				if (cooldownTimer < GetHardCooldown())
				{
					delayStacks++;
				}
				cooldownTimer = (0f - delay) * (float)delayStacks;
				((Graphic)((Component)((Component)this).transform.parent.Find("Limbs/ArmStuff/ShieldStone/Canvas/Image")).GetComponent<Image>()).color = new Color(0.8f, 0.8f, 0.8f);
			}
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		private IEnumerator DelayMove(BlockTriggerType triggerType, Vector3 beforePos)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <DelayMove>d__16(0)
			{
				<>4__this = this,
				triggerType = triggerType,
				beforePos = beforePos
			};
		}
	}
	public class TitanHandler : MonoBehaviour
	{
		private Image hpSheild;

		private Player player;

		private void Start()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			player = ((Component)this).GetComponentInParent<Player>();
			Image hp = ((Component)((Component)this).transform.parent).gameObject.GetComponentInChildren<HealthBar>().hp;
			hpSheild = Object.Instantiate<Image>(hp, ((Component)hp).transform.parent);
			((Graphic)hpSheild).color = new Color(0.449f, 0f, 0.597f);
		}

		private void Update()
		{
			float num = player.data.health - (CharacterStatModifiersExtension.GetRootData(player).damageCap * player.data.maxHealth - CharacterStatModifiersExtension.GetRootData(player).damageCapFilled);
			hpSheild.fillAmount = Mathf.Clamp(0f, num / player.data.maxHealth, 1f);
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)hpSheild);
		}
	}
}
namespace RootStones.Patches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class CardSpawnPatch : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0 : Object
		{
			public Player player;

			public List<CardInfo> PlayerCards;

			public Func<CardInfo, int> <>9__6;

			internal bool <Postfix>b__0(CardInfo c)
			{
				if (Cards.instance.PlayerIsAllowedCard(player, c) && !Enumerable.Any<CardCategory>(Enumerable.Intersect<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, (IEnumerable<CardCategory>)(object)new CardCategory[2]
				{
					CustomCardCategories.instance.CardCategory("GearUp_Card-Shuffle"),
					CustomCardCategories.instance.CardCategory("NoPreGamePick")
				})))
				{
					return !UtilityExtenions.IsHiddenCard(c);
				}
				return false;
			}

			internal bool <Postfix>b__1(CardInfo card)
			{
				<>c__DisplayClass0_2 CS$<>8__locals0 = new <>c__DisplayClass0_2
				{
					card = card
				};
				return Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)PlayerCards, (Func<CardInfo, bool>)((CardInfo card1) => (Object)(object)card1 == (Object)(object)CS$<>8__locals0.card)) == Enumerable.Max<CardInfo>((IEnumerable<CardInfo>)(object)PlayerCards, (Func<CardInfo, int>)delegate(CardInfo c)
				{
					<>c__DisplayClass0_3 CS$<>8__locals1 = new <>c__DisplayClass0_3
					{
						c = c
					};
					return Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)PlayerCards, (Func<CardInfo, bool>)((CardInfo c1) => (Object)(object)c1 == (Object)(object)CS$<>8__locals1.c));
				});
			}

			internal int <Postfix>b__6(CardInfo c)
			{
				<>c__DisplayClass0_3 CS$<>8__locals0 = new <>c__DisplayClass0_3
				{
					c = c
				};
				return Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)PlayerCards, (Func<CardInfo, bool>)((CardInfo c1) => (Object)(object)c1 == (Object)(object)CS$<>8__locals0.c));
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_1 : Object
		{
			public float raity;

			internal bool <Postfix>b__4(CardInfo card)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return RarityUtils.GetRarityData(card.rarity).relativeRarity == raity;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_2 : Object
		{
			public CardInfo card;

			internal bool <Postfix>b__5(CardInfo card1)
			{
				return (Object)(object)card1 == (Object)(object)card;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_3 : Object
		{
			public CardInfo c;

			internal bool <Postfix>b__7(CardInfo c1)
			{
				return (Object)(object)c1 == (Object)(object)c;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass1_0 : Object
		{
			public GameObject old;

			internal void <ReplaceCard>b__0()
			{
				PhotonNetwork.Destroy(old);
			}
		}

		private static void Postfix(List<GameObject> ___spawnedCards, int ___pickrID, ref GameObject __result)
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
			CS$<>8__locals0.player = GetPlayerWithID(___pickrID);
			if ((Object)(object)CS$<>8__locals0.player == (Object)null || !UtilityExtenions.HasCard(CS$<>8__locals0.player, "Mind_Stone"))
			{
				return;
			}
			int num = ((!((Object)(object)CharacterStatModifiersExtension.GetRootData(CS$<>8__locals0.player).perpetualCard == (Object)null)) ? 1 : 0);
			List<CardInfo> val = new List<CardInfo>();
			CS$<>8__locals0.PlayerCards = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards, (Func<CardInfo, bool>)((CardInfo c) => Cards.instance.PlayerIsAllowedCard(CS$<>8__locals0.player, c) && !Enumerable.Any<CardCategory>(Enumerable.Intersect<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, (IEnumerable<CardCategory>)(object)new CardCategory[2]
			{
				CustomCardCategories.instance.CardCategory("GearUp_Card-Shuffle"),
				CustomCardCategories.instance.CardCategory("NoPreGamePick")
			})) && !UtilityExtenions.IsHiddenCard(c))));
			if (___spawnedCards.Count == num)
			{
				val = Enumerable.ToList<CardInfo>(Enumerable.Distinct<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards));
				ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
				val.Add((CardInfo)typeof(CardChoiceSpawnUniqueCardPatch).GetField("NullCard", (BindingFlags)40).GetValue((object)null));
				ReplaceCard(ref __result, val[0]);
			}
			if (!UtilityExtenions.HasCard(CS$<>8__locals0.player, "Gauntlet"))
			{
				return;
			}
			if (___spawnedCards.Count == num + 1)
			{
				<>c__DisplayClass0_1 CS$<>8__locals1 = new <>c__DisplayClass0_1();
				CS$<>8__locals1.raity = Enumerable.Min<Rarity>(Enumerable.Select<CardInfo, Rarity>((IEnumerable<CardInfo>)(object)Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards), (Func<CardInfo, Rarity>)((CardInfo c) => c.rarity)), (Func<Rarity, float>)((Rarity r) => RarityUtils.GetRarityData(r).relativeRarity));
				val = Enumerable.ToList<CardInfo>(Enumerable.Distinct<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards), (Func<CardInfo, bool>)((CardInfo card) => RarityUtils.GetRarityData(card.rarity).relativeRarity == CS$<>8__locals1.raity))));
				ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
				val.Add((CardInfo)typeof(CardChoiceSpawnUniqueCardPatch).GetField("NullCard", (BindingFlags)40).GetValue((object)null));
				ReplaceCard(ref __result, val[0]);
			}
			else
			{
				if (___spawnedCards.Count != num + 2)
				{
					return;
				}
				val = Enumerable.ToList<CardInfo>(Enumerable.Distinct<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards), (Func<CardInfo, bool>)delegate(CardInfo card)
				{
					<>c__DisplayClass0_2 CS$<>8__locals2 = new <>c__DisplayClass0_2
					{
						card = card
					};
					return Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards, (Func<CardInfo, bool>)((CardInfo card1) => (Object)(object)card1 == (Object)(object)CS$<>8__locals2.card)) == Enumerable.Max<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards, (Func<CardInfo, int>)delegate(CardInfo c)
					{
						<>c__DisplayClass0_3 CS$<>8__locals3 = new <>c__DisplayClass0_3
						{
							c = c
						};
						return Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.PlayerCards, (Func<CardInfo, bool>)((CardInfo c1) => (Object)(object)c1 == (Object)(object)CS$<>8__locals3.c));
					});
				})));
				ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
				val.Add((CardInfo)typeof(CardChoiceSpawnUniqueCardPatch).GetField("NullCard", (BindingFlags)40).GetValue((object)null));
				ReplaceCard(ref __result, val[0]);
			}
		}

		internal static void ReplaceCard(ref GameObject __result, CardInfo card)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0033: 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)
			<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
			CS$<>8__locals0.old = __result;
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 3, (Action)delegate
			{
				PhotonNetwork.Destroy(CS$<>8__locals0.old);
			});
			__result = PhotonNetwork.Instantiate(((Object)card).name, __result.transform.position, __result.transform.rotation, (byte)0, (object[])null);
		}

		internal static Player GetPlayerWithID(int playerID)
		{
			for (int i = 0; i < PlayerManager.instance.players.Count; i++)
			{
				if (PlayerManager.instance.players[i].playerID == playerID)
				{
					return PlayerManager.instance.players[i];
				}
			}
			return null;
		}
	}
	[Serializable]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class HealthHandlerPatchDie : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0 : Object
		{
			public ReversibleEffect effect;
		}

		[HarmonyPostfix]
		[HarmonyPriority(0)]
		[HarmonyPatch("RPCA_Die")]
		[HarmonyPatch("RPCA_Die_Phoenix")]
		private static void RPCA_Die(HealthHandler __instance, CharacterData ___data, Player ___player)
		{
			Player lastSourceOfDamage = ___data.lastSourceOfDamage;
			<>c__DisplayClass0_0 CS$<>8__locals0;
			if ((Object)(object)__instance != (Object)null && (Object)(object)lastSourceOfDamage != (Object)null && (Object)(object)lastSourceOfDamage != (Object)(object)___player && UtilityExtenions.HasCard(lastSourceOfDamage, "Soul_Stone"))
			{
				if (UtilityExtenions.HasCard(lastSourceOfDamage, "Gauntlet"))
				{
					CS$<>8__locals0 = new <>c__DisplayClass0_0();
					CS$<>8__locals0.effect = ((Component)lastSourceOfDamage).gameObject.AddComponent<ReversibleEffect>();
					CS$<>8__locals0.effect.SetLivesToEffect(999999999);
					CS$<>8__locals0.effect.characterStatModifiersModifier.respawns_add = 1;
					CS$<>8__locals0.effect.applyImmediately = true;
					GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)reapply, 0);
					GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)disable);
				}
				else
				{
					CharacterStatModifiers stats = lastSourceOfDamage.data.stats;
					stats.remainingRespawns++;
				}
				___data.lastSourceOfDamage = null;
			}
			[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
			IEnumerator disable(IGameModeHandler gm)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return (IEnumerator)(object)new <>c__DisplayClass0_0.<<RPCA_Die>g__disable|1>d(0)
				{
					<>4__this = CS$<>8__locals0
				};
			}
			[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
			IEnumerator reapply(IGameModeHandler gm)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return (IEnumerator)(object)new <>c__DisplayClass0_0.<<RPCA_Die>g__reapply|0>d(0)
				{
					<>4__this = CS$<>8__locals0
				};
			}
		}
	}
}
namespace RootStones.CardConditions
{
	public class InsightCondition : CardCondition
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0 : Object
		{
			public Player player;

			internal bool <IsPlayerAllowedCard>b__0(CardInfo c)
			{
				if ((Object)(object)c != (Object)(object)CardList.GetCardInfo("Mind_Stone") && Cards.instance.PlayerIsAllowedCard(player, c) && !Enumerable.Any<CardCategory>(Enumerable.Intersect<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, (IEnumerable<CardCategory>)(object)new CardCategory[2]
				{
					CustomCardCategories.instance.CardCategory("GearUp_Card-Shuffle"),
					CustomCardCategories.instance.CardCategory("NoPreGamePick")
				})))
				{
					return !UtilityExtenions.IsHiddenCard(c);
				}
				return false;
			}
		}

		public override bool IsPlayerAllowedCard(Player player)
		{
			<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
			CS$<>8__locals0.player = player;
			return Enumerable.Count<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards, (Func<CardInfo, bool>)((CardInfo c) => (Object)(object)c != (Object)(object)CardList.GetCardInfo("Mind_Stone") && Cards.instance.PlayerIsAllowedCard(CS$<>8__locals0.player, c) && !Enumerable.Any<CardCategory>(Enumerable.Intersect<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, (IEnumerable<CardCategory>)(object)new CardCategory[2]
			{
				CustomCardCategories.instance.CardCategory("GearUp_Card-Shuffle"),
				CustomCardCategories.instance.CardCategory("NoPreGamePick")
			})) && !UtilityExtenions.IsHiddenCard(c)))) > 3;
		}
	}
}