Decompiled source of Root Stones v1.0.0

Root Infinity Stones.dll

Decompiled a day 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 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("0.0.0.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
	{
		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		public override IEnumerator Init()
		{
			RootCardInfo cardInfo = CardList.GetCardInfo("Gauntlet");
			CardInfo[] array = (CardInfo[])(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)cardInfo, (CardType)48, array, 0);
			yield break;
		}
	}
	internal class LoopedTime : MonoBehaviour
	{
		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)
		{
			Enabled = true;
			yield break;
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		private IEnumerator Reset(IGameModeHandler gm)
		{
			try
			{
				Enabled = false;
				timer = 0f;
				((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)0, (byte)255, (byte)0, (byte)255));
				Object.Destroy((Object)(object)_pentagram);
				stored = false;
			}
			catch (Exception val)
			{
				Core.Debug((object)val);
			}
			yield break;
		}

		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.0.0")]
	[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.0.0";

		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;
			}
		}

		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)
		{
			<>c__DisplayClass4_0 CS$<>8__locals0 = new <>c__DisplayClass4_0();
			CS$<>8__locals0.<>4__this = this;
			CS$<>8__locals0.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)lastTeamRounds.Keys);
			Enumerator<int, int> enumerator = 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)
			{
				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));
			}
			else if (Extensions.Contains(CS$<>8__locals0.gm.GetPointWinners(), player.teamID))
			{
				int num = 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(num);
				CS$<>8__locals0.gm.SetTeamScore(num, new TeamScore(teamScore.points - 1, teamScore.rounds));
			}
			yield break;
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		internal IEnumerator OnRoundEnd(IGameModeHandler gm)
		{
			<>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0();
			CS$<>8__locals0.<>4__this = this;
			CS$<>8__locals0.gm = gm;
			if (UtilityExtenions.HasCard(player, "Gauntlet") && Extensions.Contains(CS$<>8__locals0.gm.GetRoundWinners(), player.teamID))
			{
				int num = 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(num);
				CS$<>8__locals0.gm.SetTeamScore(num, new TeamScore(teamScore.points, teamScore.rounds - 1));
			}
			yield break;
		}
	}
	public class TeleportStone : MonoBehaviour
	{
		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)
			if ((int)triggerType != 0 && (int)triggerType != 4)
			{
				yield break;
			}
			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 != data.player.teamID && !p.data.dead)), (Func<Player, float>)([CompilerGenerated] (Player p) => Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(((Component)p).transform.position)))));
			if (!UtilityExtenions.HasCard(data.player, "Gauntlet"))
			{
				List<Player> obj = new List<Player>();
				obj.Add(val[0]);
				val = obj;
			}
			Enumerator<Player> enumerator = val.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					Player player = enumerator.Current;
					if ((int)triggerType == 4)
					{
						yield return new WaitForSeconds(0f);
					}
					Vector3 val2 = ((Component)player).transform.position;
					Vector3 position = ((Component)player).transform.position;
					if ((int)triggerType == 4)
					{
						position = beforePos;
					}
					else
					{
						int num = (int)distance * level.attackLevel;
						float num2 = distance * (float)level.attackLevel / (float)num;
						for (int i = 0; i < num; i++)
						{
							val2 += num2 * data.aimDirection;
							if (!Object.op_Implicit((Object)(object)Physics2D.OverlapCircle(Vector2.op_Implicit(val2), 0.5f)))
							{
								position = val2;
							}
						}
					}
					for (int j = 0; j < remainParts.Length; j++)
					{
						((Component)remainParts[j]).transform.position = ((Component)player).transform.root.position;
						remainParts[j].Play();
					}
					((Component)player).GetComponent<PlayerCollision>().IgnoreWallForFrames(2);
					((Component)player).transform.root.position = position;
					for (int k = 0; k < parts.Length; k++)
					{
						((Component)parts[k]).transform.position = position;
						parts[k].Play();
					}
					player.data.playerVel.velocity = Vector2.zero;
					player.data.sinceGrounded = 0f;
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}
	}
	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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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)
			{
				GameModeManager.RemoveHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)reapply);
				yield break;
			}
			[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
			IEnumerator reapply(IGameModeHandler gm)
			{
				CS$<>8__locals0.effect.ApplyModifiers();
				yield break;
			}
		}
	}
}
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;
		}
	}
}