Decompiled source of Root Cards v1.6.1

Root_Cards.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using CardThemeLib;
using ClassesManagerReborn;
using DrawNCards;
using HarmonyLib;
using InControl;
using ItemShops;
using ItemShops.Extensions;
using ItemShops.Utils;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.RoundsEffects;
using ModdingUtils.Utils;
using Nullmanager;
using Photon.Pun;
using PickNCards;
using PlayerTimeScale;
using RarityLib.Utils;
using SoundImplementation;
using Steamworks;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine.UI.ProceduralImage;
using WillsWackyManagers.Utils;

[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: AssemblyVersion("0.0.0.0")]
[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 CardTypeGraber : MonoBehaviour
{
	public static Dictionary<CardCategory, string> map;

	private void Awake()
	{
		if (map == null)
		{
			Dictionary<CardCategory, string> obj = new Dictionary<CardCategory, string>();
			obj.Add(CurseManager.instance.curseCategory, "Curse");
			obj.Add(CustomCardCategories.instance.CardCategory("ProjectileAugment"), "Projectile Augment");
			obj.Add(CustomCardCategories.instance.CardCategory("GivesNulls"), "Distillery");
			map = obj;
		}
	}

	private void Start()
	{
		TextMeshProUGUI component = ((Component)this).GetComponent<TextMeshProUGUI>();
		CardInfo componentInParent = ((Component)this).GetComponentInParent<CardInfo>();
		if (componentInParent != null && Enumerable.Any<CardCategory>(Enumerable.Intersect<CardCategory>((IEnumerable<CardCategory>)(object)componentInParent.categories, (IEnumerable<CardCategory>)(object)map.Keys)))
		{
			((TMP_Text)component).text = map[Enumerable.First<CardCategory>((IEnumerable<CardCategory>)(object)componentInParent.categories, (Func<CardCategory, bool>)((CardCategory c) => Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)map.Keys, c)))];
		}
		else
		{
			((TMP_Text)component).text = "";
		}
	}
}
public class PhyrexianText : MonoBehaviour
{
	public static char[] Codes;

	public int count;

	public int min;

	public int max;

	public float changetime;

	private float time;

	private string target;

	private void Start()
	{
		((TMP_Text)((Component)this).GetComponent<TextMeshPro>()).text = GenerateStrings(count, min, max);
		((Component)this).GetComponent<Renderer>().sortingLayerName = "MostFront";
		target = GenerateStrings(count, min, max);
		time = 0f;
	}

	private void Update()
	{
		time += Time.deltaTime;
		((TMP_Text)((Component)this).GetComponent<TextMeshPro>()).text = LarpTexts(count, ((TMP_Text)((Component)this).GetComponent<TextMeshPro>()).text, target, time / changetime);
		if (time >= changetime)
		{
			time = 0f;
			target = GenerateStrings(count, min, max);
		}
	}

	public static string LarpTexts(int count, string start, string end, float part)
	{
		part = Mathf.Clamp01(part);
		count++;
		int num = Mathf.RoundToInt((float)start.Length * part);
		char[] array = start.ToCharArray();
		for (int i = 0; i < count; i++)
		{
			for (int j = 0; j < start.Length / count; j++)
			{
				if (i * count + j < num)
				{
					array[j * count + count - 2 - i] = end[j * count + count - 2 - i];
				}
			}
		}
		return TMPro_ExtensionMethods.ArrayToString(array);
	}

	public static string GenerateStrings(int count, int minLangth, int maxLangth)
	{
		List<string> val = new List<string>();
		for (int i = 0; i < count; i++)
		{
			int num = Random.Range(minLangth, maxLangth + 1);
			string text = "|";
			for (int j = 0; j < num; j++)
			{
				text = String.Concat(text, ((Char)(ref Codes[Random.Range(0, Codes.Length)])).ToString());
			}
			text = String.Concat(text, ".");
			for (int k = num; k < maxLangth; k++)
			{
				text = String.Concat(text, " ");
			}
			val.Add(text);
		}
		string text2 = "";
		for (int l = 0; l < maxLangth + 2; l++)
		{
			char c;
			for (int m = 0; m < val.Count; m++)
			{
				string text3 = text2;
				c = val[m][l];
				text2 = String.Concat(text3, ((Char)(ref c)).ToString());
			}
			string text4 = text2;
			c = Convert.ToChar(10);
			text2 = String.Concat(text4, ((Char)(ref c)).ToString());
		}
		return text2;
	}

	static PhyrexianText()
	{
		Char[] array = new Char[49];
		RuntimeHelpers.InitializeArray((Array)(object)array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
		Codes = (char[])(object)array;
	}
}
public class BotPewPew : MonoBehaviour
{
	private Player player;

	public Gun gun;

	public SoundUnityEventPlayer sound;

	public float cooldown;

	public float range;

	private float timeout;

	private void Awake()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		timeout = 99f;
		((Component)gun).gameObject.AddComponent<Holdable>().holder = player.data;
	}

	private void Start()
	{
		timeout = 0f;
	}

	private void Update()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		if (player.data.dead || (int)(Boolean)ExtensionMethods.GetFieldValue((object)player.data.playerVel, "simulated") == 0)
		{
			return;
		}
		if (timeout > 0f)
		{
			timeout -= Time.deltaTime;
			return;
		}
		try
		{
			Player val = Enumerable.First<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 != player.teamID && Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position) <= range && PlayerManager.instance.CanSeePlayer(Vector2.op_Implicit(((Component)this).transform.position), player).canSee)), (Func<Player, float>)([CompilerGenerated] (Player p) => Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position))));
			if (!((Object)(object)val == (Object)null))
			{
				ExtensionMethods.SetFieldValue((object)gun, "forceShootDir", (object)(((Component)val).transform.position - ((Component)this).transform.position));
				gun.shootPosition = ((Component)this).transform;
				((Weapon)gun).Attack(gun.currentCharge, true, 1f, 1f, true);
				sound.PlayStart();
			}
		}
		catch (Object)
		{
		}
	}
}
public class FollowPlayer : MonoBehaviour
{
	public float followSpeed;

	public float Distance;

	private Player ownPlayer;

	private void Awake()
	{
		ownPlayer = ((Component)this).GetComponentInParent<Player>();
	}

	private void Start()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Expected O, but got Unknown
		ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 2, (Action)([CompilerGenerated] () =>
		{
			((Component)this).transform.SetParent((Transform)null);
		}));
	}

	private void Update()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)((Component)this).transform.parent != (Object)null))
		{
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(((Component)ownPlayer).gameObject.activeSelf);
			Vector3 val = ((Component)ownPlayer).transform.position + Vector3.right * Distance + Vector3.up * 0.2f;
			Vector3 val2 = ((Component)ownPlayer).transform.position + Vector3.left * Distance + Vector3.up * 0.2f;
			if (Vector3.Distance(((Component)this).transform.position, val) > Vector3.Distance(((Component)this).transform.position, val2))
			{
				((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, followSpeed * Time.deltaTime);
			}
			else
			{
				((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val2, followSpeed * Time.deltaTime);
			}
		}
	}
}
public class CardResgester : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass2_0 : Object
	{
		public RootCardInfo card;

		internal void <Regester>b__0()
		{
			((Collection<CardInfo>)(object)(ObservableCollection<CardInfo>)typeof(CardManager).GetField("activeCards", (BindingFlags)40).GetValue((object)null)).Add((CardInfo)(object)card);
		}
	}

	public RootCardInfo[] cards;

	internal static Dictionary<string, RootCardInfo> ModCards;

	public void Regester()
	{
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Expected O, but got Unknown
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Expected O, but got Unknown
		ModCards = new Dictionary<string, RootCardInfo>();
		RootCardInfo[] array = cards;
		for (int i = 0; i < array.Length; i++)
		{
			<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
			CS$<>8__locals0.card = array[i];
			if ((Object)(object)CS$<>8__locals0.card == (Object)null)
			{
				continue;
			}
			((Object)CS$<>8__locals0.card).name = String.Concat((string[])(object)new String[5]
			{
				"Root-Card  ",
				CS$<>8__locals0.card.Key,
				" (",
				CS$<>8__locals0.card.Tag,
				")"
			});
			ModCards.Add(CS$<>8__locals0.card.Key, CS$<>8__locals0.card);
			PhotonNetwork.PrefabPool.RegisterPrefab(((Object)CS$<>8__locals0.card).name, ((Component)CS$<>8__locals0.card).gameObject);
			if (CS$<>8__locals0.card.Hidden)
			{
				Cards.instance.AddHiddenCard((CardInfo)(object)CS$<>8__locals0.card);
				CustomCardCategories.instance.UpdateAndPullCategoriesFromCard((CardInfo)(object)CS$<>8__locals0.card);
			}
			else if (CS$<>8__locals0.card.Restricted)
			{
				Cards.instance.AddHiddenCard((CardInfo)(object)CS$<>8__locals0.card);
				CustomCardCategories.instance.UpdateAndPullCategoriesFromCard((CardInfo)(object)CS$<>8__locals0.card);
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)RootCards.instance, 15, (Action)delegate
				{
					((Collection<CardInfo>)(object)(ObservableCollection<CardInfo>)typeof(CardManager).GetField("activeCards", (BindingFlags)40).GetValue((object)null)).Add((CardInfo)(object)CS$<>8__locals0.card);
				});
			}
			else
			{
				CardManager.cards.Add(((Object)CS$<>8__locals0.card).name, new Card(CS$<>8__locals0.card.Tag, Unbound.config.Bind<bool>(String.Concat("Cards: ", CS$<>8__locals0.card.Tag), ((Object)CS$<>8__locals0.card).name, true, (ConfigDescription)null), (CardInfo)(object)CS$<>8__locals0.card));
			}
			if (Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)((CardInfo)CS$<>8__locals0.card).categories, CustomCardCategories.instance.CardCategory("SkipReroleCard")))
			{
				RerollManager.instance.cardsSkippedForRerolls.Add((CardInfo)(object)CS$<>8__locals0.card);
			}
			CS$<>8__locals0.card.Setup();
		}
	}
}
[Serializable]
public class CharacterStatModifiersRootData : Object
{
	public class NullData : Object
	{
		public float Health_multiplier;

		public float MovmentSpeed_multiplier;

		public float Damage_multiplier;

		public int gun_Reflects;

		public int gun_Ammo;

		public float Lifesteal;

		public float block_cdMultiplier;

		public int Revives;

		public NullData()
		{
			Health_multiplier = 1f;
			MovmentSpeed_multiplier = 1f;
			Damage_multiplier = 1f;
			Lifesteal = 0f;
			block_cdMultiplier = 1f;
			gun_Reflects = 0;
			gun_Ammo = 0;
			Revives = 0;
		}
	}

	public float shieldEfectiveness;

	public int freeCards;

	public int ammoCap;

	public int bulletCap;

	public int trueMaxAmmo;

	public CardInfo lockedCard;

	public float witchTimeDuration;

	public bool stillShoping;

	public int knowledge;

	public float hpCulling;

	public int nullsPerPoint;

	public NullData nullData;

	public bool simple;

	public CardInfo perpetualCard;

	public CardInfo DelayedCard;

	internal string SteamID;

	public CharacterStatModifiersRootData()
	{
		reset();
		knowledge = 0;
		SteamID = "";
		stillShoping = false;
	}

	public void reset()
	{
		shieldEfectiveness = 1f;
		freeCards = 0;
		ammoCap = -1;
		bulletCap = -1;
		trueMaxAmmo = 3;
		lockedCard = null;
		witchTimeDuration = 0f;
		hpCulling = 0f;
		nullsPerPoint = 0;
		nullData = new NullData();
		simple = false;
		perpetualCard = null;
		DelayedCard = null;
	}
}
public static class CharacterStatModifiersExtension : Object
{
	public static readonly ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersRootData> data = new ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersRootData>();

	public static CharacterStatModifiersRootData GetRootData(this CharacterStatModifiers characterstats)
	{
		return data.GetOrCreateValue(characterstats);
	}

	public static void AddData(this CharacterStatModifiers characterstats, CharacterStatModifiersRootData value)
	{
		try
		{
			data.Add(characterstats, value);
		}
		catch (Exception)
		{
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class CharacterStatModifiersPatchResetStats : Object
{
	private static void Prefix(CharacterStatModifiers __instance)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		__instance.GetRootData().reset();
		Transform[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<Transform>();
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)((Component)val).gameObject).name == "ShieldStone")
			{
				val.localScale = new Vector3(0.05f, 0.05f, 0.05f);
			}
		}
	}
}
public class ContractPath : ClassHandler
{
	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public override IEnumerator Init()
	{
		ClassesRegistry.Register((CardInfo)(object)CardResgester.ModCards["Lilith_Deal"], (CardType)33, 0);
		ClassesRegistry.Register((CardInfo)(object)CardResgester.ModCards["Contract"], (CardType)40, (CardInfo)(object)CardResgester.ModCards["Lilith_Deal"], 0);
		ClassesRegistry.Register((CardInfo)(object)CardResgester.ModCards["Dark_Queen"], (CardType)48, (CardInfo)(object)CardResgester.ModCards["Contract"], 0);
		yield break;
	}
}
public class dewish : CustomCard
{
	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
	}

	public override void OnReassignCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		PlayerExtension.GetAdditionalData(player).bankAccount.Deposit("Wish", -1);
	}

	protected override GameObject GetCardArt()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotImplementedException();
	}

	protected override string GetDescription()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotImplementedException();
	}

	protected override Rarity GetRarity()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotImplementedException();
	}

	protected override CardInfoStat[] GetStats()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotImplementedException();
	}

	protected override CardThemeColorType GetTheme()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotImplementedException();
	}

	protected override string GetTitle()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotImplementedException();
	}
}
public class Curseed : MonoBehaviour
{
	private Player player;

	private void Awake()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Curse);
	}

	private void OnDestroy()
	{
		GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Curse);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator Curse(IGameModeHandler _)
	{
		CurseManager.instance.CursePlayer(player, (Func<CardInfo, Player, bool>)((CardInfo c, Player p) => !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("KindCurse"))));
		yield break;
	}
}
public class EndlessAdd : OnAddEffect
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0 : Object
	{
		public Player player;

		public CardInfo card;

		internal bool <LockCard>b__0()
		{
			if ((Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)card)
			{
				return (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)CardResgester.ModCards["Genie_Endless"];
			}
			return false;
		}
	}

	public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		((MonoBehaviour)RootCards.instance).StartCoroutine(LockCard(player));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public static IEnumerator LockCard(Player player)
	{
		<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
		CS$<>8__locals0.player = player;
		CS$<>8__locals0.card = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
		yield return new WaitUntil((Func<bool>)(() => (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CS$<>8__locals0.card && (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CardResgester.ModCards["Genie_Endless"]));
		CS$<>8__locals0.player.data.stats.GetRootData().perpetualCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
		Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards).sourceCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
	}
}
public class EternityAdd : OnAddEffect
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0 : Object
	{
		public Player player;

		public CardInfo card;

		internal bool <LockCard>b__0()
		{
			if ((Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)card)
			{
				return (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)CardResgester.ModCards["Genie_Eternity"];
			}
			return false;
		}
	}

	public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		((MonoBehaviour)RootCards.instance).StartCoroutine(LockCard(player));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public static IEnumerator LockCard(Player player)
	{
		<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
		CS$<>8__locals0.player = player;
		CS$<>8__locals0.card = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
		yield return new WaitUntil((Func<bool>)(() => (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CS$<>8__locals0.card && (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CardResgester.ModCards["Genie_Eternity"]));
		CS$<>8__locals0.player.data.stats.GetRootData().lockedCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
		Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards).sourceCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
	}
}
public class Genie : Object
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass3_0 : Object
	{
		public Player player;

		public List<CardInfo> newCards;

		internal void <GenieRerollAction>b__1()
		{
			Cards.instance.AddCardsToPlayer(player, newCards.ToArray(), true, (string[])null, (float[])null, (float[])null, true);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass6_0 : Object
	{
		public bool done;

		internal void <WaitTillShopDone>b__0(Player p)
		{
			if (PlayerExtension.GetAdditionalData(p).bankAccount.HasFunds(wishes))
			{
				Genie_Shop.Show(p);
				done = false;
			}
		}

		internal void <WaitTillShopDone>b__1(Player p)
		{
			if (ShopManager.instance.PlayerIsInShop(p))
			{
				done = false;
			}
		}
	}

	public static Shop Genie_Shop;

	public static string ShopID = "Root_Genie_Shop";

	public static Dictionary<string, int> wishes = new Dictionary<string, int>();

	internal static void GenieRerollAction(Player player, CardInfo[] originalCards)
	{
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Expected O, but got Unknown
		<>c__DisplayClass3_0 CS$<>8__locals0 = new <>c__DisplayClass3_0();
		CS$<>8__locals0.player = player;
		List<CardInfo> val = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)originalCards, (Func<CardInfo, bool>)((CardInfo c) => Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("GenieOutcome")))));
		if (val.Count != 0)
		{
			CS$<>8__locals0.newCards = new List<CardInfo>();
			List<CardInfo> val2 = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
			while (val2.Count < val.Count)
			{
				val.RemoveAt(Random.Range(0, val.Count));
			}
			for (int i = 0; i < val.Count; i++)
			{
				CS$<>8__locals0.newCards.Add(val[i]);
				CS$<>8__locals0.newCards.Add(val2[i]);
			}
			val2.RemoveRange(0, val.Count);
			CS$<>8__locals0.newCards.AddRange((IEnumerable<CardInfo>)(object)val2);
			Cards.instance.RemoveAllCardsFromPlayer(CS$<>8__locals0.player, true);
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)RootCards.instance, 2, (Action)delegate
			{
				Cards.instance.AddCardsToPlayer(CS$<>8__locals0.player, CS$<>8__locals0.newCards.ToArray(), true, (string[])null, (float[])null, (float[])null, true);
			});
		}
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	internal static IEnumerator Wish()
	{
		wishes = new Dictionary<string, int>();
		wishes.Add("Wish", 1);
		if ((Object)(object)Genie_Shop != (Object)null)
		{
			ShopManager.instance.RemoveShop(Genie_Shop);
		}
		Genie_Shop = ShopManager.instance.CreateShop(ShopID);
		Genie_Shop.UpdateMoneyColumnName("Wishes");
		Genie_Shop.UpdateTitle("Be Carful What You Wish For");
		((MonoBehaviour)RootCards.instance).StartCoroutine(SetUpShop());
		yield break;
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	internal static IEnumerator SetUpShop()
	{
		List<Card> obj = Enumerable.ToList<Card>((IEnumerable<Card>)(object)CardManager.cards.Values);
		List<CardItem> val = new List<CardItem>();
		Enumerator<Card> enumerator = obj.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				Card current = enumerator.Current;
				if (current != null && (Object)(object)current.cardInfo != (Object)(object)CardResgester.ModCards["Genie"] && (Object)(object)current.cardInfo != (Object)(object)CardResgester.ModCards["Cake_Divine"] && CardManager.IsCardActive(current.cardInfo) && ((Object)current.cardInfo).name != "Half Ass Copy Cat" && (!(current.cardInfo is RootCardInfo rootCardInfo) || !rootCardInfo.Restricted || !rootCardInfo.Key.StartsWith("Cake_") || CardManager.IsCardActive((CardInfo)(object)CardResgester.ModCards["Cake_Toggle"])))
				{
					val.Add(new CardItem(current));
				}
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		Shop genie_Shop = Genie_Shop;
		string[] array = Enumerable.ToArray<string>(Enumerable.Select<CardItem, string>((IEnumerable<CardItem>)(object)val, (Func<CardItem, string>)((CardItem c) => String.Concat(c.Card.cardInfo.cardName, ((Object)c.Card.cardInfo).name))));
		Purchasable[] array2 = (Purchasable[])(object)val.ToArray();
		genie_Shop.AddItems(array, array2);
		yield break;
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	internal static IEnumerator WaitTillShopDone()
	{
		<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0
		{
			done = true
		};
		GameObject gameObject = null;
		GameObject timer = null;
		float time = 120f;
		PlayerManager.instance.players.ForEach((Action<Player>)delegate(Player p)
		{
			if (PlayerExtension.GetAdditionalData(p).bankAccount.HasFunds(wishes))
			{
				Genie_Shop.Show(p);
				CS$<>8__locals0.done = false;
			}
		});
		int num;
		if (!CS$<>8__locals0.done)
		{
			gameObject = new GameObject();
			gameObject.AddComponent<Canvas>().sortingLayerName = "MostFront";
			((TMP_Text)gameObject.AddComponent<TextMeshProUGUI>()).text = "Waiting For Players In Wish Menu";
			Color magenta = Color.magenta;
			magenta.a = 0.85f;
			((Graphic)gameObject.GetComponent<TextMeshProUGUI>()).color = magenta;
			gameObject.transform.localScale = new Vector3(0.2f, 0.2f);
			gameObject.transform.localPosition = new Vector3(0f, 5f);
			timer = new GameObject();
			timer.AddComponent<Canvas>().sortingLayerName = "MostFront";
			timer.transform.localScale = new Vector3(0.2f, 0.2f);
			timer.transform.localPosition = new Vector3(0f, 16f);
			((Graphic)timer.AddComponent<TextMeshProUGUI>()).color = magenta;
			int i = 0;
			while (i < 5)
			{
				TextMeshProUGUI component = timer.GetComponent<TextMeshProUGUI>();
				num = (int)time;
				((TMP_Text)component).text = ((Int32)(ref num)).ToString();
				yield return new WaitForSecondsRealtime(1f);
				time -= 1f;
				num = i++;
			}
		}
		while (!CS$<>8__locals0.done)
		{
			TextMeshProUGUI component2 = timer.GetComponent<TextMeshProUGUI>();
			num = (int)time;
			((TMP_Text)component2).text = ((Int32)(ref num)).ToString();
			CS$<>8__locals0.done = true;
			yield return new WaitForSecondsRealtime(0.2f);
			time -= 0.2f;
			PlayerManager.instance.players.ForEach((Action<Player>)delegate(Player p)
			{
				if (ShopManager.instance.PlayerIsInShop(p))
				{
					CS$<>8__locals0.done = false;
				}
			});
			if (time <= 0f)
			{
				ShopManager.instance.HideAllShops();
				CS$<>8__locals0.done = true;
			}
		}
		Object.Destroy((Object)(object)gameObject);
		Object.Destroy((Object)(object)timer);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	internal static IEnumerator RestCardLock()
	{
		Player[] array = PlayerManager.instance.players.ToArray();
		for (int i = 0; i < array.Length; i++)
		{
			array[i].data.stats.GetRootData().lockedCard = null;
		}
		yield break;
	}
}
internal class CardItem : Purchasable
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass12_0 : Object
	{
		public Player player;

		public bool can_eternity;

		public CardItem <>4__this;

		public CardInfo card;

		public float max;

		public Action<Player> <>9__3;

		internal bool <DoGenieWish>b__0(RootCardInfo c)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)((CardInfo)c).categories, CustomCardCategories.instance.CardCategory("GenieOutcome")) && (((CardInfo)c).allowMultiple || !player.data.currentCards.Contains((CardInfo)(object)c)) && (c.Key != "Genie_Debt" || GameModeManager.CurrentHandler.GetTeamScore(player.teamID).rounds > 0) && (can_eternity || c.Key != "Genie_Eternity"))
			{
				return <>4__this.GetDistance(((CardInfo)c).rarity, card.rarity) < 6f;
			}
			return false;
		}

		internal float <DoGenieWish>b__1(float f)
		{
			return Mathf.Abs(f - max);
		}

		internal void <DoGenieWish>b__3(Player p)
		{
			if (p.playerID != player.playerID)
			{
				Cards.instance.AddCardToPlayer(p, card, false, "", 2f, 2f, true);
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass15_0 : Object
	{
		public GameObject cardObj;

		internal void <GetCardVisuals>b__0()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			CardRarityColor[] componentsInChildren = cardObj.GetComponentsInChildren<CardRarityColor>();
			foreach (CardRarityColor val in componentsInChildren)
			{
				try
				{
					val.Toggle(true);
				}
				catch (Object)
				{
				}
			}
			TextMeshProUGUI component = FindObjectInChildren(cardObj, "Text_Name").GetComponent<TextMeshProUGUI>();
			if (((Graphic)component).color.r < 0.18f && ((Graphic)component).color.g < 0.18f && ((Graphic)component).color.b < 0.18f)
			{
				((Graphic)component).color = Color32.op_Implicit(new Color32((byte)200, (byte)200, (byte)200, (byte)255));
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass16_0 : Object
	{
		public string gameObjectName;

		internal bool <FindObjectInChildren>b__0(Transform item)
		{
			return ((Object)item).name == gameObjectName;
		}
	}

	internal Card Card;

	private Dictionary<string, int> cost = new Dictionary<string, int>();

	public override string Name => Card.cardInfo.cardName;

	public override Dictionary<string, int> Cost => cost;

	public override Tag[] Tags => (Tag[])(object)new Tag[2]
	{
		new Tag(((Object)(Rarity)(ref Card.cardInfo.rarity)).ToString()),
		new Tag(Card.category)
	};

	public CardItem(Card card)
	{
		Card = card;
		cost.Add("Wish", 1);
	}

	public override bool CanPurchase(Player player)
	{
		return true;
	}

	public override GameObject CreateItem(GameObject parent)
	{
		//IL_00e1: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = null;
		GameObject val2 = null;
		try
		{
			val = Object.Instantiate<GameObject>(ItemShops.instance.assets.LoadAsset<GameObject>("Card Container"));
		}
		catch (Exception)
		{
			Debug.Log((object)"Issue with creating the card container");
		}
		try
		{
			val2 = ((Component)val.transform.Find("Card Holder")).gameObject;
		}
		catch (Exception)
		{
			Debug.Log((object)"Issue with getting the Card Holder");
			val2 = ((Component)val.transform.GetChild(0)).gameObject;
		}
		val2.transform.localPosition = new Vector3(0f, -100f, 0f);
		val2.transform.localScale = new Vector3(0.125f, 0.125f, 1f);
		val2.transform.Rotate(0f, 180f, 0f);
		try
		{
			GetCardVisuals(Card.cardInfo, val2);
		}
		catch (Exception val5)
		{
			Debug.Log((object)"Issue with getting card visuals");
			Debug.LogError((object)val5);
		}
		val.transform.SetParent(parent.transform);
		return val;
	}

	private float GetDistance(Rarity r1, Rarity r2)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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_0031: Unknown result type (might be due to invalid IL or missing references)
		float relativeRarity = RarityUtils.GetRarityData(r2).relativeRarity;
		float relativeRarity2 = RarityUtils.GetRarityData(r1).relativeRarity;
		relativeRarity2 = ((!(relativeRarity2 > relativeRarity)) ? (relativeRarity / relativeRarity2) : (relativeRarity2 / relativeRarity));
		Debug.Log((object)String.Format("{0},{1} : {2}", (object)r1, (object)r2, (object)relativeRarity2));
		return relativeRarity2 - 1f;
	}

	private void DoGenieWish(Player player, CardInfo card)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		<>c__DisplayClass12_0 CS$<>8__locals0 = new <>c__DisplayClass12_0();
		CS$<>8__locals0.player = player;
		CS$<>8__locals0.<>4__this = this;
		CS$<>8__locals0.card = card;
		Random val = new Random();
		CS$<>8__locals0.can_eternity = !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)CS$<>8__locals0.card.categories, CustomCardCategories.instance.CardCategory("CardManipulation")) && !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)CS$<>8__locals0.card.categories, CustomCardCategories.instance.CardCategory("cantEternity"));
		List<RootCardInfo> val2 = Enumerable.ToList<RootCardInfo>(Enumerable.Where<RootCardInfo>((IEnumerable<RootCardInfo>)(object)CardResgester.ModCards.Values, (Func<RootCardInfo, bool>)((RootCardInfo c) => Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)((CardInfo)c).categories, CustomCardCategories.instance.CardCategory("GenieOutcome")) && (((CardInfo)c).allowMultiple || !CS$<>8__locals0.player.data.currentCards.Contains((CardInfo)(object)c)) && (c.Key != "Genie_Debt" || GameModeManager.CurrentHandler.GetTeamScore(CS$<>8__locals0.player.teamID).rounds > 0) && (CS$<>8__locals0.can_eternity || c.Key != "Genie_Eternity") && CS$<>8__locals0.<>4__this.GetDistance(((CardInfo)c).rarity, CS$<>8__locals0.card.rarity) < 6f)));
		if (val.Next(100) >= 98 || val2.Count == 0)
		{
			Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, (CardInfo)(object)CardResgester.ModCards["Empty_Lamp"], false, "", 2f, 2f, true);
			return;
		}
		Debug.Log((object)val2.Count);
		List<float> val3 = new List<float>();
		_ = RarityUtils.GetRarityData(CS$<>8__locals0.card.rarity).relativeRarity;
		for (int i = 0; i < val2.Count; i++)
		{
			val3.Add(GetDistance(((CardInfo)val2[i]).rarity, CS$<>8__locals0.card.rarity));
		}
		CS$<>8__locals0.max = Enumerable.Max((IEnumerable<float>)(object)val3);
		val3 = Enumerable.ToList<float>(Enumerable.Select<float, float>((IEnumerable<float>)(object)val3, (Func<float, float>)((float f) => Mathf.Abs(f - CS$<>8__locals0.max))));
		float num = Enumerable.Sum((IEnumerable<float>)(object)val3);
		float num2 = Random.Range(0f, num);
		Debug.Log((object)String.Format("Rolled:{0} out of {1}", (object)num2, (object)num));
		for (int j = 0; j < val2.Count; j++)
		{
			num2 -= val3[j];
			Debug.Log((object)val3[j]);
			if (!(num2 <= 0f))
			{
				continue;
			}
			RootCardInfo rootCardInfo = val2[j];
			if (rootCardInfo.Key == "Genie_Greed")
			{
				Cards.instance.RemoveAllCardsFromPlayer(CS$<>8__locals0.player, true);
			}
			Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, (CardInfo)(object)rootCardInfo, false, "", 2f, 2f, true);
			if (rootCardInfo.Key == "Genie_Smiles")
			{
				Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, CS$<>8__locals0.card, false, "", 2f, 2f, true);
			}
			if (rootCardInfo.Key == "Genie_Gift")
			{
				Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, Cards.instance.GetRandomCardWithCondition(CS$<>8__locals0.player, CS$<>8__locals0.player.data.weaponHandler.gun, ((Component)CS$<>8__locals0.player.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>(), CS$<>8__locals0.player.data, CS$<>8__locals0.player.data.healthHandler, ((Component)CS$<>8__locals0.player).GetComponent<Gravity>(), CS$<>8__locals0.player.data.block, CS$<>8__locals0.player.data.stats, (Func<CardInfo, Player, Gun, GunAmmo, CharacterData, HealthHandler, Gravity, Block, CharacterStatModifiers, bool>)((CardInfo cardInfo, Player _0, Gun _1, GunAmmo _2, CharacterData _3, HealthHandler _4, Gravity _5, Block _6, CharacterStatModifiers _7) => (int)cardInfo.rarity == 0), 0), false, "", 2f, 2f, true);
			}
			if (rootCardInfo.Key == "Genie_Shared")
			{
				PlayerManager.instance.players.ForEach((Action<Player>)delegate(Player p)
				{
					if (p.playerID != CS$<>8__locals0.player.playerID)
					{
						Cards.instance.AddCardToPlayer(p, CS$<>8__locals0.card, false, "", 2f, 2f, true);
					}
				});
			}
			if (rootCardInfo.Key == "Genie_Defective")
			{
				Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, (CardInfo)(object)NullManager.instance.GetNullCardInfo(((Object)CS$<>8__locals0.card).name, CS$<>8__locals0.player), false, "", 2f, 2f, true);
				return;
			}
			if (!(rootCardInfo.Key == "Genie_Delayed"))
			{
				break;
			}
			CS$<>8__locals0.player.data.stats.GetRootData().DelayedCard = CS$<>8__locals0.card;
			return;
		}
		Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, CS$<>8__locals0.card, false, "", 2f, 2f, true);
	}

	public override void OnPurchase(Player player, Purchasable item)
	{
		CardInfo cardInfo = ((CardItem)(object)item).Card.cardInfo;
		DoGenieWish(player, cardInfo);
		((MonoBehaviour)RootCards.instance).StartCoroutine(ShowCard(player, cardInfo));
		if (player.data.view.IsMine && !PlayerExtension.GetAdditionalData(player).bankAccount.HasFunds(Genie.wishes))
		{
			Genie.Genie_Shop.Hide();
		}
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public static IEnumerator ShowCard(Player player, CardInfo card)
	{
		yield return CardBarUtils.instance.ShowImmediate(player, card, new Nullable<float>(2f));
	}

	private GameObject GetCardVisuals(CardInfo card, GameObject parent)
	{
		//IL_0051: 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_0061: 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_0077: 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_0096: 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_011a: Expected O, but got Unknown
		<>c__DisplayClass15_0 CS$<>8__locals0 = new <>c__DisplayClass15_0();
		CS$<>8__locals0.cardObj = Object.Instantiate<GameObject>(((Component)card).gameObject, parent.gameObject.transform);
		CS$<>8__locals0.cardObj.SetActive(true);
		CS$<>8__locals0.cardObj.GetComponentInChildren<CardVisuals>().firstValueToSet = true;
		RectTransform orAddComponent = ExtensionMethods.GetOrAddComponent<RectTransform>(CS$<>8__locals0.cardObj, false);
		((Transform)orAddComponent).localScale = 100f * Vector3.one;
		orAddComponent.anchorMin = Vector2.zero;
		orAddComponent.anchorMax = Vector2.one;
		orAddComponent.offsetMin = Vector2.zero;
		orAddComponent.offsetMax = Vector2.zero;
		orAddComponent.pivot = new Vector2(0.5f, 0.5f);
		GameObject val = FindObjectInChildren(CS$<>8__locals0.cardObj, "Back");
		try
		{
			Object.Destroy((Object)(object)val);
		}
		catch (Object)
		{
		}
		GameObject obj = FindObjectInChildren(CS$<>8__locals0.cardObj, "BlockFront");
		if (obj != null)
		{
			obj.SetActive(false);
		}
		CanvasGroup[] componentsInChildren = CS$<>8__locals0.cardObj.GetComponentsInChildren<CanvasGroup>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].alpha = 1f;
		}
		ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)ItemShops.instance, 0.2f, (Action)delegate
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			CardRarityColor[] componentsInChildren2 = CS$<>8__locals0.cardObj.GetComponentsInChildren<CardRarityColor>();
			foreach (CardRarityColor val3 in componentsInChildren2)
			{
				try
				{
					val3.Toggle(true);
				}
				catch (Object)
				{
				}
			}
			TextMeshProUGUI component = FindObjectInChildren(CS$<>8__locals0.cardObj, "Text_Name").GetComponent<TextMeshProUGUI>();
			if (((Graphic)component).color.r < 0.18f && ((Graphic)component).color.g < 0.18f && ((Graphic)component).color.b < 0.18f)
			{
				((Graphic)component).color = Color32.op_Implicit(new Color32((byte)200, (byte)200, (byte)200, (byte)255));
			}
		});
		return CS$<>8__locals0.cardObj;
	}

	private static GameObject FindObjectInChildren(GameObject gameObject, string gameObjectName)
	{
		<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
		CS$<>8__locals0.gameObjectName = gameObjectName;
		return Enumerable.FirstOrDefault<GameObject>(Enumerable.Select<Transform, GameObject>(Enumerable.Where<Transform>((IEnumerable<Transform>)(object)gameObject.GetComponentsInChildren<Transform>(true), (Func<Transform, bool>)((Transform item) => ((Object)item).name == CS$<>8__locals0.gameObjectName)), (Func<Transform, GameObject>)((Transform item) => ((Component)item).gameObject)));
	}
}
public class MortalityTimer : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass16_0 : Object
	{
		public int playerId;

		internal bool <Kill>b__0(Player p)
		{
			return p.playerID == playerId;
		}
	}

	private float timer;

	public Player player;

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

	public float timeToFill = 30f;

	public float timeToEmpty;

	public float duration = 1f;

	public ProceduralImage outerRing;

	public ProceduralImage fill;

	public Transform rotator;

	public Transform still;

	public GameObject Scythe;

	public bool Enabled;

	public void Awake()
	{
		player = ((Component)this).GetComponentInParent<Player>();
	}

	private void Start()
	{
		//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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Pause);
		GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)Reset);
		GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Enable);
		((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)106, (byte)33, (byte)145, (byte)255));
		((Graphic)fill).color = Color32.op_Implicit(new Color32((byte)255, (byte)0, (byte)64, (byte)150));
		counter = 0f;
		((Image)outerRing).fillAmount = counter;
		((Image)fill).fillAmount = counter;
		((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
	}

	private void OnDestroy()
	{
		GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Pause);
		GameModeManager.RemoveHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)Reset);
		GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Enable);
	}

	private void Update()
	{
		//IL_008d: 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_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		if (!Enabled || player.data.dead)
		{
			return;
		}
		timer += Time.deltaTime;
		counter = timer / timeToFill;
		((Image)outerRing).fillAmount = counter;
		((Image)fill).fillAmount = counter;
		((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
		if (counter > 1f && !player.data.dead && player.data.view.IsMine)
		{
			NetworkingManager.RPC(typeof(MortalityTimer), "Kill", (object[])(object)new Object[1] { (object)player.playerID });
			if (player.data.stats.remainingRespawns > 0)
			{
				player.data.view.RPC("RPCA_Die_Phoenix", (RpcTarget)0, (object[])(object)new Object[1] { (object)(Vector2.down * 1000f) });
			}
			else
			{
				player.data.view.RPC("RPCA_Die", (RpcTarget)0, (object[])(object)new Object[1] { (object)(Vector2.down * 1000f) });
			}
		}
	}

	[UnboundRPC]
	public static void Kill(int playerId)
	{
		//IL_003a: 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_0055: 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)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
		CS$<>8__locals0.playerId = playerId;
		MortalityTimer componentInChildren = ((Component)PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.playerId))).GetComponentInChildren<MortalityTimer>();
		GameObject obj = Object.Instantiate<GameObject>(componentInChildren.Scythe, ((Component)componentInChildren).transform.position + ((Component)componentInChildren).transform.up * ((Component)componentInChildren).transform.parent.localScale.y / 3f, Quaternion.identity);
		((Behaviour)obj.GetComponent<Animator>()).enabled = true;
		Object.Destroy((Object)(object)obj, 15f);
		componentInChildren.counter = 1.5f;
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator Pause(IGameModeHandler gm)
	{
		Enabled = false;
		yield break;
	}

	[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;
			counter = 0f;
			((Image)outerRing).fillAmount = counter;
			((Image)fill).fillAmount = counter;
			((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
		}
		catch (Exception val)
		{
			RootCards.Debug((object)val);
		}
		yield break;
	}
}
public class NoBlock : MonoBehaviour
{
	private void Start()
	{
		((Behaviour)((Component)this).GetComponentInParent<Player>().data.block).enabled = false;
		((Component)((Component)((Component)this).GetComponentInParent<Player>()).transform.Find("Limbs/ArmStuff/ShieldStone")).gameObject.SetActive(false);
	}

	private void OnDestroy()
	{
		((Behaviour)((Component)this).GetComponentInParent<Player>().data.block).enabled = true;
		((Component)((Component)((Component)this).GetComponentInParent<Player>()).transform.Find("Limbs/ArmStuff/ShieldStone")).gameObject.SetActive(true);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public static IEnumerator HideChocieBlock()
	{
		while (!CardChoice.instance.IsPicking)
		{
			yield return null;
		}
		((Component)((Component)CardChoiceVisuals.instance).transform.Find("Card Choice Face/ArmStuff/ShieldStone")).gameObject.SetActive(!PlayerManager.instance.players.Find((Predicate<Player>)((Player player) => CardChoice.instance.pickrID == player.playerID)).data.currentCards.Contains((CardInfo)(object)CardResgester.ModCards["Genie_Exposed"]));
	}
}
public class PointReduction : MonoBehaviour
{
	private Player player;

	private void Awake()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)ReducePoints);
	}

	private void OnDestroy()
	{
		GameModeManager.RemoveHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)ReducePoints);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator ReducePoints(IGameModeHandler gameModeHandler)
	{
		TeamScore teamScore = gameModeHandler.GetTeamScore(player.teamID);
		TeamScore val = default(TeamScore);
		((TeamScore)(ref val))..ctor(teamScore.points - (int)(((Component)this).GetComponent<AttackLevel>().LevelScale() - 1f), teamScore.rounds);
		gameModeHandler.SetTeamScore(player.teamID, val);
		yield break;
	}
}
public class Predestination : MonoBehaviour
{
	private Player player;

	private int OldDraws;

	private void Awake()
	{
		player = ((Component)this).GetComponentInParent<Player>();
		OldDraws = DrawNCards.GetPickerDraws(player.playerID);
	}

	private void Update()
	{
		if ((Object)(object)player != (Object)null && DrawNCards.GetPickerDraws(player.playerID) != 1)
		{
			DrawNCards.SetPickerDraws(player.playerID, 1);
		}
	}

	private void OnDestroy()
	{
		DrawNCards.SetPickerDraws(player.playerID, OldDraws);
	}
}
internal class RoundDeath : MonoBehaviour
{
	public void Start()
	{
		GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)Kill);
	}

	public void OnDestroy()
	{
		GameModeManager.RemoveHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)Kill);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator Kill(IGameModeHandler gm)
	{
		GameModeManager.AddOnceHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)Die);
		yield break;
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private IEnumerator Die(IGameModeHandler gm)
	{
		((Component)this).GetComponentInParent<Player>().data.view.RPC("RPCA_Die", (RpcTarget)0, (object[])(object)new Object[1] { (object)new Vector2(0f, 1f) });
		yield break;
	}
}
public class RoundLoss : MonoBehaviour
{
	public int cost;

	private void Start()
	{
		//IL_0021: 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)
		GameModeManager.CurrentHandler.SetTeamScore(((Component)this).GetComponentInParent<Player>().teamID, new TeamScore(0, GameModeManager.CurrentHandler.GetTeamScore(((Component)this).GetComponentInParent<Player>().teamID).rounds - cost));
	}

	private void OnDestroy()
	{
		//IL_0021: 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)
		GameModeManager.CurrentHandler.SetTeamScore(((Component)this).GetComponentInParent<Player>().teamID, new TeamScore(0, GameModeManager.CurrentHandler.GetTeamScore(((Component)this).GetComponentInParent<Player>().teamID).rounds + cost));
	}
}
public class Trade : OnAddEffect
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0 : Object
	{
		public Player player;

		public CardInfo card;

		public IEnumerable<CardInfo> cards;

		internal bool <TradeCard>b__0()
		{
			if ((Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)card)
			{
				return (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)CardResgester.ModCards["Genie_Traded"];
			}
			return false;
		}

		internal bool <TradeCard>b__1(CardInfo c)
		{
			if (c.cardName != "Genie" && c.cardName != Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards).cardName)
			{
				return !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("GenieOutcome"));
			}
			return false;
		}

		internal bool <TradeCard>b__2(CardInfo cardi)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return RarityUtils.GetRarityData(cardi.rarity).relativeRarity == Enumerable.Min<CardInfo>(cards, (Func<CardInfo, float>)((CardInfo c) => RarityUtils.GetRarityData(c.rarity).relativeRarity));
		}
	}

	public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		((MonoBehaviour)RootCards.instance).StartCoroutine(TradeCard(player));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public static IEnumerator TradeCard(Player player)
	{
		<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
		CS$<>8__locals0.player = player;
		CS$<>8__locals0.card = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
		yield return new WaitUntil((Func<bool>)(() => (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CS$<>8__locals0.card && (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CardResgester.ModCards["Genie_Traded"]));
		for (int _ = 0; _ < 60; _++)
		{
			yield return null;
		}
		CS$<>8__locals0.cards = Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards, (Func<CardInfo, bool>)((CardInfo c) => c.cardName != "Genie" && c.cardName != Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards).cardName && !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("GenieOutcome"))));
		CardInfo[] array = Enumerable.ToArray<CardInfo>(Enumerable.Where<CardInfo>(CS$<>8__locals0.cards, (Func<CardInfo, bool>)((CardInfo cardi) => RarityUtils.GetRarityData(cardi.rarity).relativeRarity == Enumerable.Min<CardInfo>(CS$<>8__locals0.cards, (Func<CardInfo, float>)((CardInfo c) => RarityUtils.GetRarityData(c.rarity).relativeRarity)))));
		CardInfo val = array[Random.Range(0, Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)array))];
		Cards.instance.RemoveCardFromPlayer(CS$<>8__locals0.player, val, (SelectionType)0, true);
	}
}
internal class Devourer : DealtDamageEffect
{
	public Hunger hunger;

	public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer = null)
	{
		//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)
		RootCards.Debug(hunger);
		((ReversibleEffect)hunger).gunStatModifier.projectileColor = Color.white;
		hunger.hungerLevel = 1;
	}
}
public class Garlic : DealtDamageEffect
{
	public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer = null)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)damagedPlayer != (Object)null)
		{
			float num = ((Vector2)(ref damage)).magnitude;
			num *= damagedPlayer.data.stats.lifeSteal;
			num += damagedPlayer.data.stats.regen / damagedPlayer.data.maxHealth;
			((Damagable)damagedPlayer.data.healthHandler).TakeDamage(((Vector2)(ref damage)).normalized * num, Vector2.op_Implicit(((Component)damagedPlayer).transform.position), (GameObject)null, (Player)null, true, true);
		}
	}
}
public class HealthCurse : MonoBehaviour
{
	private float _Health;

	private Player _player;

	public void Awake()
	{
		if ((Object)(object)_player == (Object)null)
		{
			_player = ((Component)this).gameObject.GetComponent<Player>();
		}
		GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler gm) => reset()));
	}

	public void Cull(float HP)
	{
		if ((Object)(object)_player == (Object)null)
		{
			_player = ((Component)this).gameObject.GetComponent<Player>();
		}
		if (PlayerStatus.PlayerAliveAndSimulated(_player))
		{
			CharacterData data = _player.data;
			data.maxHealth += _Health;
			_Health = Mathf.Min(_Health + HP, _player.data.maxHealth - 1f);
			CharacterData data2 = _player.data;
			data2.maxHealth -= _Health;
		}
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator reset()
	{
		CharacterData data = _player.data;
		data.maxHealth += _Health;
		_Health = 0f;
		yield break;
	}
}
internal class Hunger : ReversibleEffect
{
	internal int hungerLevel = 1;

	internal int hungerGrowth;

	internal int hungerMax = 30;

	public void AttackAction()
	{
		hungerLevel += hungerGrowth;
	}

	public override void OnAwake()
	{
		Hunger componentInChildren = ((Component)((Component)this).transform.parent).GetComponentInChildren<Hunger>();
		componentInChildren.hungerGrowth++;
		if ((Object)(object)componentInChildren != (Object)(object)this)
		{
			Object.DestroyImmediate((Object)(object)((Component)this).gameObject);
		}
	}

	public override void OnStart()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		base.gunStatModifier.projectileColor = Color.white;
		((ReversibleEffect)this).SetLivesToEffect(2147483647);
		base.gun.AddAttackAction(new Action(AttackAction));
	}

	public override void OnOnDestroy()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		ExtensionMethods.InvokeMethod((object)base.gun, "RemoveAttackAction", (object[])(object)new Object[1] { (Object)new Action(AttackAction) });
	}

	public override void OnUpdate()
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		if ((float)hungerLevel != base.gunStatModifier.damage_mult)
		{
			hungerLevel = Mathf.Clamp(hungerLevel, 1, hungerMax);
			float num = 1f - Mathf.Clamp((float)hungerLevel / (float)hungerMax, 0f, 1f);
			base.gunStatModifier.projectileColor = new Color(1f, num, num);
			((ReversibleEffect)this).ClearModifiers(true);
			base.gunStatModifier.damage_mult = hungerLevel;
			((ReversibleEffect)this).ApplyModifiers();
		}
	}

	public override void OnOnDisable()
	{
		hungerLevel = 1;
	}
}
internal class LethalAttacks : HitEffect
{
	public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer)
	{
		damagedPlayer.data.health = -100000f;
	}
}
internal class PainfullAttacks : DealtDamageEffect
{
	public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		if (!selfDamage && !((Object)(object)damagedPlayer == (Object)null))
		{
			((Component)this).gameObject.GetComponentInParent<Player>().data.healthHandler.DoDamage(damage, damagedPlayer.data.playerVel.position, Color.magenta, (GameObject)null, ((Component)this).gameObject.GetComponentInParent<Player>(), false, true, true);
		}
	}
}
public class ProjectileAdder : MonoBehaviour
{
	public ProjectilesToSpawn[] projectiles;

	public void Start()
	{
		Gun gun = ((Component)this).GetComponentInParent<WeaponHandler>().gun;
		List<ProjectilesToSpawn> val = Enumerable.ToList<ProjectilesToSpawn>((IEnumerable<ProjectilesToSpawn>)(object)gun.projectiles);
		val.AddRange((IEnumerable<ProjectilesToSpawn>)(object)projectiles);
		gun.projectiles = val.ToArray();
	}

	public void OnDestroy()
	{
		Gun gun = ((Component)this).GetComponentInParent<WeaponHandler>().gun;
		List<ProjectilesToSpawn> val = Enumerable.ToList<ProjectilesToSpawn>((IEnumerable<ProjectilesToSpawn>)(object)gun.projectiles);
		ProjectilesToSpawn[] array = projectiles;
		foreach (ProjectilesToSpawn val2 in array)
		{
			val.Remove(val2);
		}
		gun.projectiles = val.ToArray();
	}
}
public class ShotBustBullet : MonoBehaviour
{
	public static int count;

	private int id;

	private void Awake()
	{
		//IL_0021: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		id = count++;
		((Component)this).transform.rotation = getShootRotation(id, 6);
		Transform transform = ((Component)this).transform;
		transform.position += ((Component)this).transform.forward;
		if (count == 6)
		{
			count = 0;
		}
	}

	private void LateUpdate()
	{
		if (((Component)this).GetComponent<MoveTransform>().distanceTravelled > 9f)
		{
			PhotonNetwork.Destroy(((Component)this).gameObject);
		}
	}

	private Quaternion getShootRotation(int bulletID, int numOfProj)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		Vector3 forward = ((Component)this).transform.forward;
		float num = (float)numOfProj * 0.05f;
		float num2 = (float)bulletID * (num * 2f / (float)(numOfProj - 1)) - num;
		return Quaternion.LookRotation(forward + Vector3.Cross(forward, Vector3.forward) * num2);
	}
}
public class StunHit : ProjectileHit
{
	public override void Hit(HitInfo hit, bool forceCall = false)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: 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_010b: Expected O, but got Unknown
		List<HealthHandler> val = (List<HealthHandler>)ExtensionMethods.GetFieldValue((object)this, "playersHit");
		MoveTransform val2 = (MoveTransform)ExtensionMethods.GetFieldValue((object)this, "move");
		int num = -1;
		if (Object.op_Implicit((Object)(object)hit.transform))
		{
			PhotonView component = ((Component)hit.transform.root).GetComponent<PhotonView>();
			if (Object.op_Implicit((Object)(object)component))
			{
				num = component.ViewID;
			}
		}
		int num2 = -1;
		if (num == -1)
		{
			Collider2D[] componentsInChildren = ((Component)MapManager.instance.currentMap.Map).GetComponentsInChildren<Collider2D>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if ((Object)(object)componentsInChildren[i] == (Object)(object)hit.collider)
				{
					num2 = i;
				}
			}
		}
		HealthHandler val3 = null;
		if (Object.op_Implicit((Object)(object)hit.transform))
		{
			val3 = ((Component)hit.transform).GetComponent<HealthHandler>();
		}
		bool flag = false;
		if (Object.op_Implicit((Object)(object)val3))
		{
			if (val.Contains(val3))
			{
				return;
			}
			if (base.view.IsMine && ((Component)val3).GetComponent<Block>().IsBlocking())
			{
				flag = true;
			}
			((MonoBehaviour)this).StartCoroutine((IEnumerator)ExtensionMethods.InvokeMethod((object)this, "HoldPlayer", (object[])(object)new Object[1] { (Object)val3 }));
		}
		if (base.view.IsMine || forceCall)
		{
			if (base.sendCollisions)
			{
				base.view.RPC("RPCA_DoStunHit", (RpcTarget)0, (object[])(object)new Object[6]
				{
					(object)hit.point,
					(object)hit.normal,
					(object)Vector2.op_Implicit(val2.velocity),
					(object)num,
					(object)num2,
					(object)flag
				});
			}
			else
			{
				RPCA_DoStunHit(hit.point, hit.normal, Vector2.op_Implicit(val2.velocity), num, num2, flag);
			}
		}
	}

	[PunRPC]
	public void RPCA_DoStunHit(Vector2 hitPoint, Vector2 hitNormal, Vector2 vel, int viewID = -1, int colliderID = -1, bool wasBlocked = false)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: 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_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Invalid comparison between Unknown and I4
		MoveTransform val = (MoveTransform)ExtensionMethods.GetFieldValue((object)this, "move");
		HitInfo val2 = new HitInfo();
		if (Object.op_Implicit((Object)(object)val))
		{
			val.velocity = Vector2.op_Implicit(vel);
		}
		val2.point = hitPoint;
		val2.normal = hitNormal;
		val2.collider = null;
		if (viewID != -1)
		{
			PhotonView photonView = PhotonNetwork.GetPhotonView(viewID);
			val2.collider = ((Component)photonView).GetComponentInChildren<Collider2D>();
			val2.transform = ((Component)photonView).transform;
		}
		else if (colliderID != -1)
		{
			val2.collider = ((Component)MapManager.instance.currentMap.Map).GetComponentsInChildren<Collider2D>()[colliderID];
			val2.transform = ((Component)val2.collider).transform;
		}
		HealthHandler val3 = null;
		if (Object.op_Implicit((Object)(object)val2.transform))
		{
			val3 = ((Component)val2.transform).GetComponent<HealthHandler>();
		}
		if (base.isAllowedToSpawnObjects)
		{
			((Component)this).transform.position = Vector2.op_Implicit(val2.point);
		}
		if (Object.op_Implicit((Object)(object)val2.collider))
		{
			ProjectileHitSurface component = ((Component)val2.collider).GetComponent<ProjectileHitSurface>();
			if (Object.op_Implicit((Object)(object)component) && (int)component.HitSurface(val2, ((Component)this).gameObject) == 0)
			{
				return;
			}
		}
		if (Object.op_Implicit((Object)(object)val3))
		{
			Block component2 = ((Component)val3).GetComponent<Block>();
			if (wasBlocked)
			{
				component2.DoBlock(((Component)this).gameObject, ((Component)this).transform.forward, Vector2.op_Implicit(val2.point));
				if (base.destroyOnBlock)
				{
					ExtensionMethods.InvokeMethod((object)this, "DestroyMe", Array.Empty<object>());
				}
				base.sinceReflect = 0f;
				return;
			}
			CharacterStatModifiers component3 = ((Component)val3).GetComponent<CharacterStatModifiers>();
			if (base.movementSlow != 0f && !wasBlocked)
			{
				component3.RPCA_AddSlow(base.movementSlow, false);
			}
		}
		if (Object.op_Implicit((Object)(object)val2.transform))
		{
			((Component)val2.transform).GetComponentInParent<PlayerVelocity>();
		}
		if (Object.op_Implicit((Object)(object)val2.collider))
		{
			StunHandler componentInParent = ((Component)val2.collider).GetComponentInParent<StunHandler>();
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				if (Object.op_Implicit((Object)(object)val3) && base.percentageDamage != 0f)
				{
					base.damage += ((Component)val3).GetComponent<CharacterData>().maxHealth * base.percentageDamage;
				}
				componentInParent.AddStun(base.damage * base.dealDamageMultiplierr * 0.01f + ((Component)componentInParent).GetComponent<CharacterData>().stunTime);
			}
		}
		bool flag = false;
		if (base.effects != null && base.effects.Count != 0)
		{
			for (int i = 0; i < base.effects.Count; i++)
			{
				HasToReturn val4 = base.effects[i].DoHitEffect(val2);
				if ((int)val4 == 0)
				{
					flag = true;
				}
				if ((int)val4 == 2)
				{
					return;
				}
			}
		}
		if (!flag)
		{
			base.deathEvent.Invoke();
			ExtensionMethods.InvokeMethod((object)this, "DestroyMe", Array.Empty<object>());
		}
	}
}
public class DeNuller : OnAddEffect
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass0_0 : Object
	{
		public CharacterData data;

		public DeNuller <>4__this;

		public Player player;

		internal void <OnAdd>b__0()
		{
			List<CardInfo> currentCards = data.currentCards;
			List<int> val = new List<int>();
			List<CardInfo> val2 = new List<CardInfo>();
			for (int i = 0; i < currentCards.Count; i++)
			{
				CardInfo obj = currentCards[i];
				NullCardInfo val3 = (NullCardInfo)(object)((obj is NullCardInfo) ? obj : null);
				if (val3 != null)
				{
					val.Add(i);
					val2.Add(val3.NulledSorce);
				}
			}
			((MonoBehaviour)Unbound.Instance).StartCoroutine(<>4__this.ReplaceCards(player, val.ToArray(), val2.ToArray()));
		}
	}

	public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
		CS$<>8__locals0.data = data;
		CS$<>8__locals0.<>4__this = this;
		CS$<>8__locals0.player = player;
		ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)RootCards.instance, 2, (Action)delegate
		{
			List<CardInfo> currentCards = CS$<>8__locals0.data.currentCards;
			List<int> val = new List<int>();
			List<CardInfo> val2 = new List<CardInfo>();
			for (int i = 0; i < currentCards.Count; i++)
			{
				CardInfo obj = currentCards[i];
				NullCardInfo val3 = (NullCardInfo)(object)((obj is NullCardInfo) ? obj : null);
				if (val3 != null)
				{
					val.Add(i);
					val2.Add(val3.NulledSorce);
				}
			}
			((MonoBehaviour)Unbound.Instance).StartCoroutine(CS$<>8__locals0.<>4__this.ReplaceCards(CS$<>8__locals0.player, val.ToArray(), val2.ToArray()));
		});
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator ReplaceCards(Player player, int[] indeces, CardInfo[] newCards, string[] twoLetterCodes = null, bool editCardBar = true)
	{
		if (twoLetterCodes == null)
		{
			twoLetterCodes = (string[])(object)new String[indeces.Length];
			for (int i = 0; i < twoLetterCodes.Length; i++)
			{
				twoLetterCodes[i] = "";
			}
		}
		List<bool> reassign = new List<bool>();
		List<CardInfo> val = new List<CardInfo>();
		Enumerator<CardInfo> enumerator = player.data.currentCards.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				CardInfo current = enumerator.Current;
				val.Add(current);
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		List<CardInfo> newCardsToAssign = new List<CardInfo>();
		List<string> twoLetterCodesToAssign = new List<string>();
		int num = 0;
		for (int j = 0; j < val.Count; j++)
		{
			if (!Enumerable.Contains<int>((IEnumerable<int>)(object)indeces, j))
			{
				newCardsToAssign.Add(val[j]);
				twoLetterCodesToAssign.Add("");
				reassign.Add(true);
			}
			else if ((Object)(object)newCards[num] == (Object)null)
			{
				newCardsToAssign.Add(val[j]);
				twoLetterCodesToAssign.Add("");
				num++;
				reassign.Add(true);
			}
			else
			{
				newCardsToAssign.Add(newCards[num]);
				twoLetterCodesToAssign.Add(twoLetterCodes[num]);
				num++;
				reassign.Add(false);
			}
		}
		Cards.instance.RemoveAllCardsFromPlayer(player, editCardBar);
		yield return new WaitForSecondsRealtime(0.1f);
		if (editCardBar)
		{
			CardBarUtils.instance.ClearCardBar(player);
		}
		Cards.instance.AddCardsToPlayer(player, newCardsToAssign.ToArray(), reassign.ToArray(), twoLetterCodesToAssign.ToArray(), (float[])null, (float[])null, editCardBar);
	}
}
public class DistillAcquisition : MonoBehaviour
{
}
public class PowerDistillation : OnAddEffect
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0 : Object
	{
		public Player player;
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_1 : Object
	{
		public float time;

		public int cardCount;

		public CardInfo randomCard;

		public <>c__DisplayClass1_0 CS$<>8__locals1;

		internal bool <addRandomCards>b__0()
		{
			time += Time.deltaTime;
			if (CS$<>8__locals1.player.data.currentCards.Count <= cardCount && !((Object)(object)CS$<>8__locals1.player.data.currentCards[CS$<>8__locals1.player.data.currentCards.Count - 1] == (Object)(object)randomCard))
			{
				return time > 5f;
			}
			return true;
		}
	}

	public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		((MonoBehaviour)RootCards.instance).StartCoroutine(addRandomCards(player, gun, gunAmmo, data, health, gravity, block, characterStats));
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	public IEnumerator addRandomCards(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		<>c__DisplayClass1_0 cS$<>8__locals = new <>c__DisplayClass1_0
		{
			player = player
		};
		yield return null;
		for (int i = 0; i < 2; i++)
		{
			<>c__DisplayClass1_1 CS$<>8__locals0 = new <>c__DisplayClass1_1();
			CS$<>8__locals0.CS$<>8__locals1 = cS$<>8__locals;
			CS$<>8__locals0.randomCard = Cards.instance.NORARITY_GetRandomCardWithCondition(CS$<>8__locals0.CS$<>8__locals1.player, gun, gunAmmo, data, health, gravity, block, characterStats, (Func<CardInfo, Player, Gun, GunAmmo, CharacterData, HealthHandler, Gravity, Block, CharacterStatModifiers, bool>)condition, 1000);
			if ((Object)(object)CS$<>8__locals0.randomCard == (Object)null)
			{
				CardInfo[] array = Enumerable.ToArray<CardInfo>(Enumerable.Concat<CardInfo>((IEnumerable<CardInfo>)(object)Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)(ObservableCollection<CardInfo>)typeof(CardManager).GetField("activeCards", (BindingFlags)40).GetValue((object)null)), (IEnumerable<CardInfo>)(object)(List<CardInfo>)typeof(CardManager).GetField("inactiveCards", (BindingFlags)40).GetValue((object)null)));
				CS$<>8__locals0.randomCard = Cards.instance.DrawRandomCardWithCondition(array, CS$<>8__locals0.CS$<>8__locals1.player, (Gun)null, (GunAmmo)null, (CharacterData)null, (HealthHandler)null, (Gravity)null, (Block)null, (CharacterStatModifiers)null, (Func<CardInfo, Player, Gun, GunAmmo, CharacterData, HealthHandler, Gravity, Block, CharacterStatModifiers, bool>)condition, 1000);
			}
			CS$<>8__locals0.cardCount = Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.CS$<>8__locals1.player.data.currentCards);
			Cards.instance.AddCardToPlayer(CS$<>8__locals0.CS$<>8__locals1.player, CS$<>8__locals0.randomCard, false, "", 0f, 0f, true);
			CS$<>8__locals0.time = 0f;
			yield return new WaitUntil((Func<bool>)delegate
			{
				CS$<>8__locals0.time += Time.deltaTime;
				return CS$<>8__locals0.CS$<>8__locals1.player.data.currentCards.Count > CS$<>8__locals0.cardCount || (Object)(object)CS$<>8__locals0.CS$<>8__locals1.player.data.currentCards[CS$<>8__locals0.CS$<>8__locals1.player.data.currentCards.Count - 1] == (Object)(object)CS$<>8__locals0.randomCard || CS$<>8__locals0.time > 5f;
			});
			CardBarUtils.instance.ShowAtEndOfPhase(CS$<>8__locals0.CS$<>8__locals1.player, CS$<>8__locals0.randomCard);
		}
	}

	public bool condition(CardInfo card, Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		if ((int)card.rarity == 2)
		{
			return !Enumerable.Any<CardCategory>(Enumerable.Intersect<CardCategory>((IEnumerable<CardCategory>)(object)card.categories, (IEnumerable<CardCategory>)(object)RootCards.noLotteryCategories));
		}
		return false;
	}
}
public abstract class OnAddEffect : MonoBehaviour
{
	public void Run(Player player)
	{
		Gun component = ((Component)((Component)player).GetComponent<Holding>().holdable).GetComponent<Gun>();
		GunAmmo componentInChildren = ((Component)component).GetComponentInChildren<GunAmmo>();
		CharacterData component2 = ((Component)player).GetComponent<CharacterData>();
		HealthHandler component3 = ((Component)player).GetComponent<HealthHandler>();
		Gravity component4 = ((Component)player).GetComponent<Gravity>();
		Block component5 = ((Component)player).GetComponent<Block>();
		CharacterStatModifiers component6 = ((Component)player).GetComponent<CharacterStatModifiers>();
		OnAdd(player, component, componentInChildren, component2, component3, component4, component5, component6);
	}

	public abstract void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats);
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class CardChoicePatchIDoEndPick : Object
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass0_0 : Object
	{
		public CardChoice __instance;

		internal bool <Prefix>b__0(Player p)
		{
			return p.playerID == __instance.pickrID;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0 : Object
	{
		public CardChoice __instance;

		internal bool <GrabCard>b__0(Player p)
		{
			return p.playerID == __instance.pickrID;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass2_0 : Object
	{
		public int playerID;

		internal bool <GiveNulls>b__0(Player p)
		{
			return p.playerID == playerID;
		}
	}

	public static void Prefix(CardChoice __instance, ref List<GameObject> ___spawnedCards, ref GameObject pickedCard, ref float ___speed)
	{
		<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
		CS$<>8__locals0.__instance = __instance;
		if ((Object)(object)pickedCard == (Object)null || !((Object)(object)pickedCard.GetComponent<DistillAcquisition>() != (Object)null))
		{
			return;
		}
		for (int i = 0; i < ___spawnedCards.Count; i++)
		{
			if (Object.op_Implicit((Object)(object)___spawnedCards[i]) && (Object)(object)___spawnedCards[i].gameObject != (Object)(object)pickedCard)
			{
				((MonoBehaviour)CS$<>8__locals0.__instance).StartCoroutine(GrabCard(___spawnedCards[i], ___speed, CS$<>8__locals0.__instance));
			}
		}
		if (PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.__instance.pickrID)).data.view.IsMine)
		{
			NetworkingManager.RPC(typeof(CardChoicePatchIDoEndPick), "GiveNulls", (object[])(object)new Object[2]
			{
				(object)CS$<>8__locals0.__instance.pickrID,
				(object)(___spawnedCards.Count - 1)
			});
		}
		___spawnedCards.Clear();
		___spawnedCards.Add(pickedCard);
	}

	[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
	private static IEnumerator GrabCard(GameObject card, float speed, CardChoice __instance)
	{
		<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0
		{
			__instance = __instance
		};
		if (PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.__instance.pickrID)).data.view.IsMine)
		{
			card.GetComponentInChildren<ApplyCardStats>().Pick(CS$<>8__locals0.__instance.pickrID, false, (PickerType)ExtensionMethods.GetFieldValue((object)CS$<>8__locals0.__instance, "pickerType"));
		}
		Vector3 startPos = card.transform.position;
		Vector3 endPos = ((Component)CardChoiceVisuals.instance).transform.position;
		float c2 = 0f;
		while (c2 < 1f)
		{
			CardChoiceVisuals.instance.framesToSnap = 1;
			Vector3 position = Vector3.LerpUnclamped(startPos, endPos, CS$<>8__locals0.__instance.curve.Evaluate(c2));
			card.transform.position = position;
			c2 += Time.deltaTime * speed;
			yield return null;
		}
		Vector3 val = startPos - endPos;
		GamefeelManager.GameFeel(Vector2.op_Implicit(((Vector3)(ref val)).normalized * 2f));
		card.GetComponentInChildren<CardVisuals>().Leave();
		card.GetComponentInChildren<CardVisuals>().Pick();
	}

	[UnboundRPC]
	public static void GiveNulls(int playerID, int amount)
	{
		<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
		CS$<>8__locals0.playerID = playerID;
		CharacterStatModifiersExtension.AjustNulls(PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.playerID)).data.stats, (int)((float)amount * 3.5f));
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class ApplyCardStatsPatch : Object
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass0_0 : Object
	{
		public Player ___playerToUpgrade;

		internal void <Postfix>b__0(OnAddEffect effect)
		{
			effect.Run(___playerToUpgrade);
		}
	}

	private static void Postfix(ApplyCardStats __instance, Player ___playerToUpgrade)
	{
		//IL_0090: 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.___playerToUpgrade = ___playerToUpgrade;
		if (CS$<>8__locals0.___playerToUpgrade.data.stats.GetRootData().knowledge > 0)
		{
			if (((Component)__instance).GetComponent<CardInfo>().sourceCard is NullCardInfo || ((Component)__instance).GetComponent<CardInfo>() is NullCardInfo)
			{
				CS$<>8__locals0.___playerToUpgrade.data.stats.GetRootData().knowledge--;
			}
			else
			{
				CharacterStatModifiersExtension.AjustNulls(CS$<>8__locals0.___playerToUpgrade.data.stats, (int)Mathf.Ceil(0.5f + (float)NullManager.instance.GetNullValue(((Component)__instance).GetComponent<CardInfo>().rarity) * 1.5f));
			}
		}
		RootStatModifiers component = ((Component)__instance).GetComponent<RootStatModifiers>();
		if ((Object)(object)component != (Object)null)
		{
			component.Apply(CS$<>8__locals0.___playerToUpgrade);
		}
		Enumerable.ToList<OnAddEffect>((IEnumerable<OnAddEffect>)(object)((Component)__instance).GetComponents<OnAddEffect>()).ForEach((Action<OnAddEffect>)delegate(OnAddEffect effect)
		{
			effect.Run(CS$<>8__locals0.___playerToUpgrade);
		});
	}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class BlockPatchblocked : Object
{
	private static void Prefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: 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_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: 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)
		bool flag = false;
		ProjectileHit component = projectile.GetComponent<ProjectileHit>();
		HealthHandler val = (HealthHandler)Traverse.Create((object)__instance).Field("health").GetValue();
		Player val2 = (Player)Traverse.Create((object)val).Field("player").GetValue();
		if (val2.data.stats.GetRootData().witchTimeDuration > 0f && component.ownPlayer.teamID != val2.teamID)
		{
			ExtensionMethods.GetOrAddComponent<WitchTime>(((Component)val2).gameObject, false).time_remaning = val2.data.stats.GetRootData().witchTimeDuration;
		}
		if (val2.data.stats.GetRootData().shieldEfectiveness < 1f)
		{
			Vector2 val3 = Vector2.op_Implicit(((component.bulletCanDealDeamage ? component.damage : 1f) - (component.bulletCanDealDeamage ? component.damage : 1f) * val2.data.stats.GetRootData().shieldEfectiveness) * ((Vector3)(ref forward)).normalized);
			((Damagable)val).TakeDamage(val3, Vector2.op_Implicit(hitPos), component.projectileColor, component.ownWeapon, component.ownPlayer, true, true);
			flag = true;
		}
		if (flag)
		{
			Object.Destroy((Object)(object)projectile);
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class CardSpawnPatch : Object
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass0_0 : Object
	{
		public GameObject old;

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

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

		internal void <Postfix>b__1()
		{
			PhotonNetwork.Destroy(old);
		}
	}

	private static void Postfix(List<GameObject> ___spawnedCards, Transform[] ___children, int ___pickrID, ref GameObject __result)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_007f: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		Player playerWithID = GetPlayerWithID(___pickrID);
		if ((Object)(object)playerWithID != (Object)null && ___spawnedCards.Count == 0 && (Object)(object)playerWithID.data.stats.GetRootData().perpetualCard != (Object)null)
		{
			<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
			CS$<>8__locals0.old = __result;
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)RootCards.instance, 3, (Action)delegate
			{
				PhotonNetwork.Destroy(CS$<>8__locals0.old);
			});
			__result = PhotonNetwork.Instantiate(((Object)playerWithID.data.stats.GetRootData().perpetualCard).name, __result.transform.position, __result.transform.rotation, (byte)0, (object[])null);
		}
		if ((Object)(object)playerWithID != (Object)null && ___spawnedCards.Count == ___children.Length - 1 && (Object)(object)playerWithID.data.stats.GetRootData().DelayedCard != (Object)null)
		{
			<>c__DisplayClass0_1 CS$<>8__locals1 = new <>c__DisplayClass0_1();
			CS$<>8__locals1.old = __result;
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)RootCards.instance, 3, (Action)delegate
			{
				PhotonNetwork.Destroy(CS$<>8__locals1.old);
			});
			__result = PhotonNetwork.Instantiate(((Object)playerWithID.data.stats.GetRootData().DelayedCard).name, __result.transform.position, __result.transform.rotation, (byte)0, (object[])null);
			playerWithID.data.stats.GetRootData().DelayedCard = 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;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class DoDamagePatch : Object
{
	private static void Postfix(HealthHandler __instance, Vector2 damage, Player damagingPlayer)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)damagingPlayer == (Object)null) && !(damagingPlayer.data.stats.GetRootData().hpCulling <= 0f))
		{
			ExtensionMethods.GetOrAddComponent<HealthCurse>(((Component)(Player)Traverse.Create((object)__instance).Field("player").GetValue()).gameObject, false).Cull(((Vector2)(ref damage)).magnitude * damagingPlayer.data.stats.GetRootData().hpCulling);
		}
	}
}
[HarmonyPatch]
public class EternityPatch : Object
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass0_0 : Object
	{
		public ApplyCardStats __instance;

		internal void <PickCardOffline>b__1(Player player)
		{
			Debug.Log((object)player.data.stats.GetRootData().lockedCard);
			if ((Object)(object)player.data.stats.GetRootData().lockedCard != (Object)null && (Object)(object)player.data.stats.GetRootData().lockedCard != (Object)(object)((Component)__instance).GetComponent<CardInfo>().sourceCard)
			{
				Cards.instance.AddCardToPlayer(player, player.data.stats.GetRootData().lockedCard, false, "", 0f, 0f, true);
			}
			else
			{
				Cards.instance.AddCardToPlayer(player, ((Component)__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0 : Object
	{
		public ApplyCardStats __instance;

		internal void <PickCard>b__2(Player player)
		{
			Debug.Log((object)player.data.stats.GetRootData().lockedCard);
			if ((Object)(object)player.data.stats.GetRootData().lockedCard != (Object)null && (Object)(object)player.data.stats.GetRootData().lockedCard != (Object)(object)((Component)__instance).GetComponent<CardInfo>().sourceCard)
			{
				Cards.instance.AddCardToPlayer(player, player.data.stats.GetRootData().lockedCard, false, "", 0f, 0f, true);
			}
			else
			{
				Cards.instance.AddCardToPlayer(player, ((Component)__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	public static bool PickCardOffline(ApplyCardStats __instance, Player[] players)
	{
		<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
		CS$<>8__locals0.__instance = __instance;
		List<Player> val = Enumerable.ToList<Player>((IEnumerable<Player>)(object)players);
		if (Enumerable.Any<Player>((IEnumerable<Player>)(object)val, (Func<Player, bool>)((Player p) => (Object)(object)p.data.stats.GetRootData().lockedCard != (Object)null)))
		{
			val.ForEach((Action<Player>)delegate(Player player)
			{
				Debug.Log((object)player.data.stats.GetRootData().lockedCard);
				if ((Object)(object)player.data.stats.GetRootData().lockedCard != (Object)null && (Object)(object)player.data.stats.GetRootData().lockedCard != (Object)(object)((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard)
				{
					Cards.instance.AddCardToPlayer(player, player.data.stats.GetRootData().lockedCard, false, "", 0f, 0f, true);
				}
				else
				{
					Cards.instance.AddCardToPlayer(player, ((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
				}
			});
			return false;
		}
		return true;
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	public static bool PickCard(ApplyCardStats __instance, int[] actorIDs)
	{
		<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
		CS$<>8__locals0.__instance = __instance;
		List<Player> val = Enumerable.ToList<Player>(Enumerable.Select<int, Player>((IEnumerable<int>)(object)actorIDs, (Func<int, Player>)((int id) => (Player)ExtensionMethods.InvokeMethod((object)PlayerManager.instance, "GetPlayerWithActorID", (object[])(object)new Object[1] { (object)id }))));
		if (Enumerable.Any<Player>((IEnumerable<Player>)(object)val, (Func<Player, bool>)((Player p) => (Object)(object)p.data.stats.GetRootData().lockedCard != (Object)null)))
		{
			val.ForEach((Action<Player>)delegate(Player player)
			{
				Debug.Log((object)player.data.stats.GetRootData().lockedCard);
				if ((Object)(object)player.data.stats.GetRootData().lockedCard != (Object)null && (Object)(object)player.data.stats.GetRootData().lockedCard != (Object)(object)((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard)
				{
					Cards.instance.AddCardToPlayer(player, player.data.stats.GetRootData().lockedCard, false, "", 0f, 0f, true);
				}
				else
				{
					Cards.instance.AddCardToPlayer(player, ((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
				}
			});
			return false;
		}
		return true;
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	public static void Add(Player player, ref CardInfo card)
	{
		if ((Object)(object)player.data.stats.GetRootData().lockedCard != (Object)null)
		{
			card = player.data.stats.GetRootData().lockedCard;
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class GeneralInputPatchUpdate : Object
{
	public static float vel = 10f;

	private static void Postfix(GeneralInput __instance)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			CharacterData component = ((Component)__instance).GetComponent<CharacterData>();
			Dark_Queen componentInChildren = ((Component)__instance).GetComponentInChildren<Dark_Queen>();
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				if (((OneAxisInputControl)component.playerActions.Up).IsPressed)
				{
					Transform transform = ((Component)__instance).transform;
					transform.position += Vector3.up * vel * component.stats.movementSpeed * TimeHandler.deltaTime;
				}
				if (((OneAxisInputControl)component.playerActions.Down).IsPressed)
				{
					Transform transform2 = ((Component)__instance).transform;
					transform2.position += Vector3.down * vel * component.stats.movementSpeed * TimeHandler.deltaTime;
				}
				if (((OneAxisInputControl)component.playerActions.Left).IsPressed)
				{
					Transform transform3 = ((Component)__instance).transform;
					transform3.position += Vector3.left * vel * component.stats.movementSpeed * TimeHandler.deltaTime;
				}
				if (((OneAxisInputControl)component.playerActions.Right).IsPressed)
				{
					Transform transform4 = ((Component)__instance).transform;
					transform4.position += Vector3.right * vel * component.stats.movementSpeed * TimeHandler.deltaTime;
				}
				if (((OneAxisInputControl)component.playerActions.Fire).WasPressed)
				{
					componentInChildren.Telleport();
				}
				__instance.shootIsPressed = false;
				__instance.shootWasPressed = false;
				__instance.shootWasReleased = false;
			}
		}
		catch (Object)
		{
		}
	}
}
public class LockPlayerSize : MonoBehaviour
{
	private void FixedUpdate()
	{
		((Component)this).GetComponentInParent<Player>().data.maxHealth = 0.1f;
		((Component)this).GetComponentInParent<Player>().data.health = 0f;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class PlayerSizePatch : Object
{
	public static void Postfix(CharacterStatModifiers __instance)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)__instance).GetComponentInChildren<LockPlayerSize>() != null)
		{
			((Component)__instance).transform.loca

Root_Cards_DC_Compat.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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: AssemblyVersion("0.0.0.0")]
[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;
		}
	}
}
[Serializable]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("root.DeckCustomizationCompat", "DeckCustomizationCompat", "1.0.0")]
[BepInProcess("Rounds.exe")]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class DeckCustomizationCompat : BaseUnityPlugin
{
	public void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("root.DeckCustomizationCompat").PatchAll();
	}

	public static void Postfix(ref List<CardInfo> __result)
	{
		__result.RemoveAll((Predicate<CardInfo>)((CardInfo card) => ((RootCardInfo)(((card is RootCardInfo) ? card : null)?)).Restricted ?? false));
	}
}