Decompiled source of Root Beta v1.1.8

Root Beta.dll

Decompiled 4 days 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 ClassesManagerReborn;
using ExitGames.Client.Photon;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using Photon.Pun;
using Photon.Realtime;
using RWF;
using RWF.Algorithms;
using RarityBundle;
using Rarity_Bundle;
using RootCore;
using RootCore.CardConditions;
using UnboundLib;
using UnboundLib.Extensions;
using UnboundLib.GameModes;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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.1.8.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;
		}
	}
}
public class GildPapperGainClass : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <Go>d__1 : Object, IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public GildPapperGainClass <>4__this;

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

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

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

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

		private unsafe bool MoveNext()
		{
			int num = <>1__state;
			GildPapperGainClass gildPapperGainClass = <>4__this;
			if (num != 0)
			{
				return false;
			}
			<>1__state = -1;
			Player componentInParent = ((Component)gildPapperGainClass).GetComponentInParent<Player>();
			if (componentInParent != null)
			{
				List<CardInfo> val = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos((CardType)1, false), new Func<CardInfo, bool>((object)componentInParent, (System.IntPtr)(nint)(delegate*<Player, CardInfo, bool>)(&UtilityExtenions.IsAllowedCard))));
				ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
				if (val.Count > 0)
				{
					UtilityExtenions.GiveCard(componentInParent, val[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 void Start()
	{
		GameModeManager.AddOnceHook("PickStart", (Func<IGameModeHandler, IEnumerator>)Go);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator Go(IGameModeHandler _)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return (IEnumerator)(object)new <Go>d__1(0)
		{
			<>4__this = this
		};
	}
}
public class GuildPapaerCondition : CardCondition
{
	public int requiredclasses;

	public unsafe override bool IsPlayerAllowedCard(Player player)
	{
		return Enumerable.Count<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos((CardType)1, false), new Func<CardInfo, bool>((object)player, (System.IntPtr)(nint)(delegate*<Player, CardInfo, bool>)(&UtilityExtenions.IsAllowedCard)))) >= requiredclasses;
	}
}
namespace RootCore
{
	[RequireComponent(/*Could not decode attribute arguments.*/)]
	public class SetColourToPlayer : MonoBehaviour
	{
		public bool HueOnly;

		public void Start()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Player spawner = ((Component)this).GetComponentInParent<SpawnedAttack>().spawner;
			SpriteRenderer component = ((Component)this).GetComponent<SpriteRenderer>();
			if (HueOnly)
			{
				float num = default(float);
				float num2 = default(float);
				float num3 = default(float);
				Color.RGBToHSV(spawner.GetTeamColors().color, ref num, ref num2, ref num3);
				component.color = Color.HSVToRGB(num, 1f, 1f);
			}
			else
			{
				component.color = spawner.GetTeamColors().color;
			}
		}
	}
}
namespace RootCurses
{
	public class Tempted : OnAddEffect
	{
		public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			CardInfo val = player.data.currentCards.Find((Predicate<CardInfo>)((CardInfo c) => c.rarity == RarityBundle.Unique));
			if ((Object)(object)val != (Object)null)
			{
				Cards.instance.ReplaceCard(player, val, (CardInfo)(object)CardList.GetCardInfo("Forbidden_Knowledge"), "", 0f, 0f, (SelectionType)0, true);
				CardBarUtils.instance.ShowAtEndOfPhase(player, val);
				CardBarUtils.instance.ShowAtEndOfPhase(player, (CardInfo)(object)CardList.GetCardInfo("Forbidden_Knowledge"));
			}
			else
			{
				UtilityExtenions.GiveCard(player, "Forbidden_Knowledge");
			}
		}
	}
	public class uwu : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Start>d__1 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public uwu <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Expected O, but got Unknown
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Expected O, but got Unknown
				int num = <>1__state;
				uwu uwu2 = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					uwu2.owner = ((Component)uwu2).GetComponentInParent<Player>();
					if (!uwu2.owner.data.view.IsMine)
					{
						return false;
					}
					<>2__current = (object)new WaitForSecondsRealtime(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					((Component)MenuControllerHandler.instance).GetComponent<DevConsole>().Send("uwu");
					break;
				}
				<>2__current = (object)new WaitForSecondsRealtime(Random.value * 120f);
				<>1__state = 2;
				return true;
			}

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

		private Player owner;

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		public IEnumerator Start()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <Start>d__1(0)
			{
				<>4__this = this
			};
		}
	}
}
namespace RootCurses.CardConditions
{
	public class TemptConditin : CardCondition
	{
		public override bool IsPlayerAllowedCard(Player player)
		{
			return !UtilityExtenions.HasCard(player, "Forbidden_Knowledge");
		}
	}
}
namespace RootCurses.Effects
{
	public class RainbowCard : MonoBehaviour
	{
		private CardVisuals visuals;

		private List<CardThemeColor> cardThemeColors;

		private Random random = new Random();

		public void Start()
		{
			visuals = ((Component)this).GetComponentInChildren<CardVisuals>();
			cardThemeColors = Enumerable.ToList<CardThemeColor>((IEnumerable<CardThemeColor>)(object)CardChoice.instance.cardThemes);
		}

		public void Update()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			Color color = ((Component)((Component)this).GetComponentInChildren<UniqueRarityColor>()).gameObject.GetComponent<CanvasRenderer>().GetColor();
			if (visuals.isSelected)
			{
				visuals.defaultColor = color;
				visuals.chillColor = visuals.defaultColor;
				for (int i = 0; i < visuals.images.Length; i++)
				{
					((Graphic)visuals.images[i]).color = color;
				}
				((Graphic)visuals.nameText).color = visuals.defaultColor;
			}
		}
	}
}
namespace RootBeta
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Systems.R00t.Unstable", "Root Cards BETA", "1.1.8")]
	[BepInProcess("Rounds.exe")]
	public class Main : BaseUnityPlugin
	{
		private const string ModId = "Systems.R00t.Unstable";

		private const string ModName = "Root Cards BETA";

		public const string Version = "1.1.8";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("Systems.R00t.Unstable").PatchAll();
			Core.RegesterCards(AssetUtils.LoadAssetBundleFromResources("betaassets", typeof(Main).Assembly).LoadAsset<GameObject>("Beta").GetComponent<CardList>(), true);
		}
	}
}
namespace RootStandardCards.Patches
{
	[Serializable]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class CardChoicePatchStartPick : Object
	{
		public static void Prefix(CardChoice __instance, ref int picksToSet, int pickerIDToSet)
		{
			if (UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickerIDToSet), "Omniscience"))
			{
				picksToSet += 2;
			}
			if (UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickerIDToSet), "Leftovers"))
			{
				picksToSet = -999;
			}
		}
	}
	[HarmonyPriority(800)]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class EthralBullets : Object
	{
		public static bool Prefix(HitInfo hit, ProjectileHit __instance)
		{
			if (Object.op_Implicit((Object)(object)hit.transform) && UtilityExtenions.HasCard(__instance.ownPlayer, "Ethral"))
			{
				HealthHandler component = ((Component)hit.transform).GetComponent<HealthHandler>();
				if ((Object)(object)component == (Object)null)
				{
					return false;
				}
				return component.player.teamID != __instance.ownPlayer.teamID;
			}
			return true;
		}
	}
}
namespace RootAdvancedCards
{
	public class Mitosis : MonoBehaviour
	{
		public const string MitosisID = "MitosisPlayerSpawnInstance";

		private LobbyCharacter player;

		private Player Owner;

		private void Awake()
		{
			Owner = ((Component)this).GetComponentInParent<Player>();
			if (!Owner.data.view.IsMine)
			{
				Object.DestroyImmediate((Object)(object)this);
			}
		}

		private void Start()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			InputDevice device = ((PlayerActionSet)Owner.data.playerActions).Device;
			int count = PlayerManager.instance.players.Count;
			Vector3 position = ((Component)Owner).transform.position;
			CharacterData component = PhotonNetwork.Instantiate(((Object)PlayerAssigner.instance.playerPrefab).name, position, Quaternion.identity, (byte)0, (object[])(object)new Object[4]
			{
				(Object)"MitosisPlayerSpawnInstance",
				(object)Owner.teamID,
				(object)count,
				(object)PlayerExtensions.colorID(Owner)
			}).GetComponent<CharacterData>();
			if (device != null)
			{
				component.input.inputType = (InputType)0;
				component.playerActions = PlayerActions.CreateWithControllerBindings();
			}
			else
			{
				component.input.inputType = (InputType)1;
				component.playerActions = PlayerActions.CreateWithKeyboardBindings();
			}
			((PlayerActionSet)component.playerActions).Device = device;
			PlayerAssigner.instance.players.Add(component);
			Player val = component.player;
			PlayerManager.RegisterPlayer(val);
			int num = (val.teamID = Owner.teamID);
			val.playerID = count;
			if (!PhotonNetwork.OfflineMode)
			{
				Hashtable customProperties = val.data.view.Owner.CustomProperties;
				if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PlayerID"))
				{
					customProperties[(object)"PlayerID"] = count;
				}
				else
				{
					((Dictionary<object, object>)(object)customProperties).Add((object)"PlayerID", (object)count);
				}
				if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"TeamID"))
				{
					customProperties[(object)"TeamID"] = num;
				}
				else
				{
					((Dictionary<object, object>)(object)customProperties).Add((object)"TeamID", (object)num);
				}
				val.data.view.Owner.SetCustomProperties(customProperties, (Hashtable)null, (WebFlags)null);
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class MitosisPlayerAssigner : Object
	{
		public static void Postfix()
		{
			ExtensionMethods.GetOrAddComponent<MitosisTracker>(PlayerAssigner.instance.playerPrefab, false);
		}
	}
	public class MitosisTracker : MonoBehaviour, IPunInstantiateMagicCallback
	{
		[CompilerGenerated]
		private sealed class <cleanup>d__1 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MitosisTracker <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				MitosisTracker mitosisTracker = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				Player component = ((Component)mitosisTracker).GetComponent<Player>();
				PlayerManager.instance.RemovePlayer(component);
				return false;
			}

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

		public void OnPhotonInstantiate(PhotonMessageInfo info)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected I4, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected I4, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected I4, but got Unknown
			Debug.Log((object)"MitosisScriptRun");
			object[] instantiationData = info.photonView.InstantiationData;
			if (instantiationData != null && Enumerable.Count<object>((IEnumerable<object>)(object)instantiationData) == 4)
			{
				object obj = instantiationData[0];
				string text = (string)((obj is String) ? obj : null);
				if (text != null && text == "MitosisPlayerSpawnInstance")
				{
					Debug.Log((object)String.Format("[{0},{1},{2},{3}]", (object[])(object)new Object[4]
					{
						instantiationData[0],
						instantiationData[1],
						instantiationData[2],
						instantiationData[3]
					}));
					Player component = ((Component)this).GetComponent<Player>();
					component.teamID = (int)(Int32)instantiationData[1];
					component.playerID = (int)(Int32)instantiationData[2];
					PlayerExtensions.AssignColorID(component, (int)(Int32)instantiationData[3]);
					PlayerManager.RegisterPlayer(component);
					GameModeManager.AddOnceHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)cleanup, 800);
				}
			}
			Debug.Log((object)"MitosisScriptRan");
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		private IEnumerator cleanup(IGameModeHandler _)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <cleanup>d__1(0)
			{
				<>4__this = this
			};
		}
	}
	internal class T0986 : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DoDeSpawn>d__11 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public T0986 <>4__this;

			private float <y>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				T0986 t = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<y>5__2 = ((Component)t).transform.position.y;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<y>5__2 < ((Component)t).transform.position.y + 1f)
				{
					Transform transform = ((Component)t).transform;
					transform.position += Vector3.down * (TimeHandler.deltaTime / t.duration);
					Transform transform2 = ((Component)t).transform;
					transform2.position += Vector3.left * (Random.value - 0.5f) / 50f;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				SpriteRenderer[] componentsInChildren = ((Component)t).GetComponentsInChildren<SpriteRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Renderer)componentsInChildren[i]).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 <DoSpawn>d__8 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public T0986 <>4__this;

			public Vector3 start;

			public Vector3 tartget;

			public float speed;

			private float <duration>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				T0986 t = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<duration>5__2 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (((Component)t).transform.position != tartget)
				{
					((Component)t).transform.position = Vector3.Lerp(start, tartget, <duration>5__2);
					<duration>5__2 += TimeHandler.deltaTime * speed;
					t.counter = 0f;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				return false;
			}

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

		public int lights = -1;

		public float counter;

		public float duration = 3f;

		public bool active;

		public Player player;

		public void Start()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			player = ((Component)this).GetComponentInParent<SpawnedAttack>().spawner;
			SceneManager.MoveGameObjectToScene(((Component)this).gameObject, MapManager.instance.currentMap.Scene);
		}

		public void Update()
		{
			if (player.data.dead || !player.data.playerVel.simulated)
			{
				return;
			}
			counter += TimeHandler.deltaTime;
			if (counter >= duration)
			{
				counter = 0f;
				switch (lights)
				{
				case -1:
					Spawn();
					break;
				case 0:
				case 1:
				case 2:
				case 3:
					Lights();
					break;
				case 4:
					Train();
					lights = -1;
					break;
				}
			}
		}

		public void Spawn()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 4; i++)
			{
				((Component)((Component)this).transform.GetChild(0).GetChild(i)).gameObject.SetActive(false);
			}
			SpriteRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<SpriteRenderer>();
			for (int j = 0; j < componentsInChildren.Length; j++)
			{
				((Renderer)componentsInChildren[j]).enabled = true;
			}
			Vector3 val = Vector2.op_Implicit(GeneralizedSpawnPositions.RandomValidPosition());
			((MonoBehaviour)this).StartCoroutine(DoSpawn(val + Vector3.down, val, 0.25f));
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		public IEnumerator DoSpawn(Vector3 start, Vector3 tartget, float speed)
		{
			//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 <DoSpawn>d__8(0)
			{
				<>4__this = this,
				start = start,
				tartget = tartget,
				speed = speed
			};
		}

		public void Lights()
		{
			((Component)((Component)this).transform.GetChild(0).GetChild(lights++)).gameObject.SetActive(false);
		}

		public void Use()
		{
			counter = 0f;
			lights = -1;
			((MonoBehaviour)this).StartCoroutine(DoDeSpawn(0.15f));
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		public IEnumerator DoDeSpawn(float Duration)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <DoDeSpawn>d__11(0)
			{
				<>4__this = this
			};
		}

		public void Train()
		{
		}
	}
}
namespace RootAdvancedCards.CardConditions
{
	public class MitosisCondion : CardCondition
	{
		public override bool IsPlayerAllowedCard(Player player)
		{
			return PlayerManager.instance.players.Count < 15;
		}
	}
}
namespace RootAdvancedCards.GunEffects
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class GunBulletinitPatchPortalGun : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0 : Object
		{
			public GameObject bullet;

			internal void <Prefix>b__0()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				bullet.GetComponentInChildren<SpawnedAttack>().SetColor(Color.cyan);
			}
		}

		public static Dictionary<Player, GameObject> Bulets = new Dictionary<Player, GameObject>();

		public static Dictionary<Player, List<GameObject>> Bulet2 = new Dictionary<Player, List<GameObject>>();

		public static void Prefix(Gun __instance, GameObject bullet)
		{
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
			CS$<>8__locals0.bullet = bullet;
			if (!Bulets.ContainsKey(__instance.player))
			{
				Bulets[__instance.player] = null;
			}
			if (!Bulet2.ContainsKey(__instance.player))
			{
				Bulet2[__instance.player] = new List<GameObject>();
			}
			if ((Object)(object)((Weapon)__instance).holdable == (Object)null)
			{
				return;
			}
			if ((Object)(object)__instance.player != (Object)null && UtilityExtenions.HasCard(__instance.player, "Unstable_Portal"))
			{
				GameObject val = Bulets[__instance.player];
				if ((Object)(object)val != (Object)null)
				{
					Vector3 val2 = ((Component)MainCam.instance).GetComponent<Camera>().WorldToScreenPoint(val.transform.position);
					val2.x /= Screen.width;
					val2.y /= Screen.height;
					((Vector3)(ref val2))..ctor(Mathf.Clamp(val2.x, 0f, 1f), Mathf.Clamp(val2.y, 0f, 1f), val2.z);
					if (val2.x > 0f && val2.x < 1f && val2.y < 1f && val2.y > 0f)
					{
						Transform transform = CS$<>8__locals0.bullet.transform;
						Vector3 position = val.transform.position;
						Quaternion rotation = val.transform.rotation;
						Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
						transform.position = position - ((Vector3)(ref eulerAngles)).normalized * 0.3f;
					}
					val.GetComponentInChildren<SpawnedAttack>().SetColor(Color.red);
				}
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 2, (Action)delegate
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					CS$<>8__locals0.bullet.GetComponentInChildren<SpawnedAttack>().SetColor(Color.cyan);
				});
				Bulets[__instance.player] = CS$<>8__locals0.bullet;
			}
			Bulet2[__instance.player].Add(CS$<>8__locals0.bullet);
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class PreventColition : Object
	{
		[HarmonyPriority(800)]
		public static bool Prefix(ProjectileCollision __instance, ref float dmg)
		{
			ProjectileHit componentInParent = ((Component)__instance).GetComponentInParent<ProjectileHit>();
			if (componentInParent != null && (Object)(object)componentInParent.ownPlayer != (Object)null && UtilityExtenions.HasCard(componentInParent.ownPlayer, "Unstable_Portal"))
			{
				dmg = 0f;
				return false;
			}
			return true;
		}
	}
}
namespace RootAdvancedCards.Patches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class ApplyCardStatsPatches : Object
	{
		[HarmonyPatch("RPCA_Pick")]
		[HarmonyPrefix]
		public static void RPCA_Pick(ref int[] actorIDs, ApplyCardStats __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			List<int> val = Enumerable.ToList<int>((IEnumerable<int>)(object)actorIDs);
			Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					Player current = enumerator.Current;
					if (UtilityExtenions.HasCard(current, "Manifest_Destiny") && !val.Contains(current.data.view.ControllerActorNr) && Enumerable.Contains<int>((IEnumerable<int>)(object)GameModeManager.CurrentHandler.GetRoundWinners(), current.teamID) && UtilityExtenions.IsAllowedCard(current, ((Component)__instance).GetComponent<CardInfo>()))
					{
						val.Add(current.data.view.ControllerActorNr);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			actorIDs = val.ToArray();
		}

		[HarmonyPatch("OFFLINE_Pick")]
		[HarmonyPrefix]
		public static void OFFLINE_Pick(ref Player[] players, ApplyCardStats __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			List<Player> val = Enumerable.ToList<Player>((IEnumerable<Player>)(object)players);
			Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					Player current = enumerator.Current;
					if (UtilityExtenions.HasCard(current, "Manifest_Destiny") && !val.Contains(current) && Enumerable.Contains<int>((IEnumerable<int>)(object)GameModeManager.CurrentHandler.GetRoundWinners(), current.teamID) && UtilityExtenions.IsAllowedCard(current, ((Component)__instance).GetComponent<CardInfo>()))
					{
						val.Add(current);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			players = val.ToArray();
		}
	}
	[Serializable]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class DamagePatch : Object
	{
		[HarmonyPatch("CallTakeDamage")]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch("DoDamage")]
		[HarmonyPatch("TakeDamageOverTime")]
		[HarmonyPriority(2147483647)]
		private static void Prefix(HealthHandler __instance, ref Player damagingPlayer)
		{
			if ((Object)(object)damagingPlayer != (Object)null && UtilityExtenions.HasCard(__instance.player, "Sanitization"))
			{
				damagingPlayer = null;
			}
		}
	}
	[Serializable]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class SharedPick : Object
	{
		[CompilerGenerated]
		private sealed class <SinglePick>d__5 : Object, IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject pickedCard;

			public CardChoice __instance;

			public int theInt;

			private Vector3 <startPos>5__2;

			private Vector3 <endPos>5__3;

			private float <c2>5__4;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: 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_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: 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_011d: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_034c: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<startPos>5__2 = pickedCard.transform.position;
					<endPos>5__3 = ((Component)CardChoiceVisuals.instance).transform.position;
					<c2>5__4 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<c2>5__4 < 1f)
				{
					CardChoiceVisuals.instance.framesToSnap = 1;
					Vector3 position = Vector3.LerpUnclamped(<startPos>5__2, <endPos>5__3, __instance.curve.Evaluate(<c2>5__4));
					pickedCard.transform.position = position;
					((Component)__instance).transform.GetChild(theInt).position = position;
					<c2>5__4 += Time.deltaTime * __instance.speed;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				Vector3 val = <startPos>5__2 - <endPos>5__3;
				GamefeelManager.GameFeel(Vector2.op_Implicit(((Vector3)(ref val)).normalized * 2f));
				pickedCard.GetComponentInChildren<CardVisuals>().Leave();
				Player val2 = Enumerable.First<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player player) => UtilityExtenions.HasCard(player, "Leftovers")));
				__instance.pickrID = val2.playerID;
				for (int i = 0; i < __instance.spawnedCards.Count; i++)
				{
					if ((Object)(object)__instance.spawnedCards[i] == (Object)(object)pickedCard)
					{
						((Component)__instance).transform.GetChild(theInt).position = <startPos>5__2;
						if (val2.data.view.IsMine)
						{
							__instance.spawnedCards[i] = __instance.Spawn(((Component)CardChoiceSpawnUniqueCardPatch.NullCard).gameObject, __instance.children[i].position, __instance.children[i].rotation);
						}
					}
				}
				for (int j = 0; j < __instance.spawnedCards.Count; j++)
				{
					if (!UtilityExtenions.IsAllowedCard(val2, __instance.spawnedCards[j].GetComponentInChildren<CardInfo>()))
					{
						Object.Destroy((Object)(object)__instance.spawnedCards[j]);
						if (val2.data.view.IsMine)
						{
							__instance.spawnedCards[j] = __instance.Spawn(((Component)CardChoiceSpawnUniqueCardPatch.NullCard).gameObject, __instance.children[j].position, __instance.children[j].rotation);
						}
					}
				}
				for (int k = 0; k < __instance.spawnedCards.Count; k++)
				{
					ExtensionMethods.GetOrAddComponent<PublicInt>(__instance.spawnedCards[k], false).theInt = k;
				}
				UIHandler.instance.ShowPicker(__instance.pickrID, __instance.pickerType);
				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 int Picker = -1;

		public static bool eaten = false;

		public static bool eating = false;

		public static bool Prefix(CardChoice __instance, GameObject pickedCard, int theInt, int pickId, ref IEnumerator __result)
		{
			Debug.Log((object)String.Format("{0} {1} {2}", (object)pickedCard, (object)theInt, (object)pickId));
			if (Picker == pickId)
			{
				eaten = true;
			}
			if (!UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickId), "Leftovers"))
			{
				Picker = pickId;
			}
			Debug.Log((object)String.Format("{0}", (object)Picker));
			Debug.Log((object)String.Format("{0} {1} {2}", (object)eaten, (object)UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickId), "Leftovers"), (object)(!Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player player) => UtilityExtenions.HasCard(player, "Leftovers"))))));
			if (eaten || UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickId), "Leftovers") || !Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player player) => UtilityExtenions.HasCard(player, "Leftovers"))))
			{
				__instance.pickrID = Picker;
				Picker = -1;
				eaten = false;
				eating = false;
				UIHandler.instance.StopShowPicker();
				return true;
			}
			eating = true;
			__result = SinglePick(__instance, pickedCard, theInt, pickId);
			return false;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void Reset(int pickerID)
		{
			if (eating && Picker != -1)
			{
				CardChoice.instance.pickrID = Picker;
				Debug.Log((object)"Eaten!!");
				eaten = true;
			}
		}

		[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
		public static IEnumerator SinglePick(CardChoice __instance, GameObject pickedCard, int theInt = 0, int pickId = -1)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return (IEnumerator)(object)new <SinglePick>d__5(0)
			{
				__instance = __instance,
				pickedCard = pickedCard,
				theInt = theInt
			};
		}
	}
}