Decompiled source of StinkyCards v1.2.0

plugins/StinkyCards.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using InControl;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.Utils;
using Photon.Pun;
using RarityLib.Utils;
using SoundImplementation;
using StinkyCards.Cards;
using StinkyCards.Effects;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[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(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace StinkyCards
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.stinkybussybois.rounds.stinkycards", "Stinky Cards", "1.2.0")]
	[BepInProcess("Rounds.exe")]
	public class StinkyCardsPlugin : BaseUnityPlugin
	{
		public const string ModId = "com.stinkybussybois.rounds.stinkycards";

		public const string ModName = "Stinky Cards";

		public const string ModInitials = "STINKY";

		public const string Version = "1.2.0";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("com.stinkybussybois.rounds.stinkycards").PatchAll();
			Rarities.Register();
		}

		private void Start()
		{
			Unbound.RegisterHandshake("com.stinkybussybois.rounds.stinkycards", (Action)delegate
			{
			});
			Unbound.RegisterCredits("Stinky Cards", new string[1] { "Cards built around effects other mods barely use." }, new string[0], new string[0]);
			CustomCard.BuildCard<GhostRounds>();
			CustomCard.BuildCard<Executioner>();
			CustomCard.BuildCard<GiantSlayer>();
			CustomCard.BuildCard<Pinball>();
			CustomCard.BuildCard<LeapBlock>();
			CustomCard.BuildCard<Overgrowth>();
			CustomCard.BuildCard<ArmorPiercer>();
			CustomCard.BuildCard<StinkBomb>();
			CustomCard.BuildCard<DutchOven>();
			CustomCard.BuildCard<ShinyTurd>();
			CustomCard.BuildCard<WatchTheWorldBurn>();
			CustomCard.BuildCard<Bomb>();
			CustomCard.BuildCard<Chance>();
			CustomCard.BuildCard<DroppedTheSoap>();
			CustomCard.BuildCard<StickyBandit>();
			CustomCard.BuildCard<TacticalNuke>();
			((Component)this).gameObject.AddComponent<BombPickUI>();
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)ClearBombs);
			GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)ClearBombs);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OneShots.Clear);
			GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)OneShots.Resolve);
			GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)OneShots.Resolve);
		}

		private static IEnumerator ClearBombs(IGameModeHandler gm)
		{
			TurdNugget.ClearAll();
			StickySlick.ClearAll();
			yield break;
		}
	}
}
namespace StinkyCards.Effects
{
	public abstract class BlockTriggerEffect : MonoBehaviour
	{
		public int Stacks;

		protected Player player;

		protected virtual void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			Block block = player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(OnBlockAction));
		}

		protected virtual void OnDestroy()
		{
			if ((Object)(object)player != (Object)null)
			{
				Block block = player.data.block;
				block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, new Action<BlockTriggerType>(OnBlockAction));
			}
		}

		private void OnBlockAction(BlockTriggerType triggerType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((int)triggerType == 0)
			{
				OnBlock();
			}
		}

		protected abstract void OnBlock();

		public static void AddStack<T>(Player player) where T : BlockTriggerEffect
		{
			ExtensionMethods.GetOrAddComponent<T>(((Component)player).gameObject, false).Stacks++;
		}

		public static void RemoveStack<T>(Player player) where T : BlockTriggerEffect
		{
			T component = ((Component)player).GetComponent<T>();
			if ((Object)(object)component != (Object)null && --component.Stacks <= 0)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public static class BombPick
	{
		private static List<int> candidates = new List<int>();

		private static readonly Dictionary<int, int> slotToCard = new Dictionary<int, int>();

		public static bool Active { get; private set; }

		public static int PickerId { get; private set; } = -1;

		public static int Page { get; private set; }

		public static int PageCount => Mathf.Max(1, Mathf.CeilToInt((float)candidates.Count / (float)PageSize));

		private static CardChoice Choice => CardChoice.instance;

		public static int PageSize
		{
			get
			{
				Transform[] value = Traverse.Create((object)Choice).Field("children").GetValue<Transform[]>();
				return Mathf.Max(1, (value != null) ? value.Length : 5);
			}
		}

		public static bool IsLocalPicker
		{
			get
			{
				if (!Active)
				{
					return false;
				}
				Player player = OneShots.GetPlayer(PickerId);
				if ((Object)(object)player != (Object)null && player.data.view.IsMine)
				{
					return PlayerManager.instance.GetActionsFromPlayer(PickerId) != null;
				}
				return false;
			}
		}

		public static bool CanCycle
		{
			get
			{
				if (IsLocalPicker && PageCount > 1 && Choice.IsPicking && Choice.pickrID == PickerId)
				{
					return !Traverse.Create((object)Choice).Field("isPlaying").GetValue<bool>();
				}
				return false;
			}
		}

		public static IEnumerator Run(Player player)
		{
			int bomb = OneShots.LastIndexOf<Bomb>(player);
			if (bomb < 0)
			{
				yield break;
			}
			candidates = (from i in Enumerable.Range(0, player.data.currentCards.Count)
				where i != bomb
				select i).ToList();
			if (candidates.Count == 0)
			{
				if (OneShots.IsHost)
				{
					((MonoBehaviour)Unbound.Instance).StartCoroutine(RemoveCards(player, bomb, -1, null));
				}
				yield return (object)new WaitForSecondsRealtime(0.5f);
				yield break;
			}
			Active = true;
			PickerId = player.playerID;
			Page = 0;
			slotToCard.Clear();
			CardChoiceVisuals.instance.Show(player.playerID, true);
			yield return Choice.DoPick(1, player.playerID, (PickerType)1);
			Active = false;
			PickerId = -1;
			yield return (object)new WaitForSecondsRealtime(1f);
		}

		public static void NextPage()
		{
			if (!CanCycle)
			{
				return;
			}
			Page = (Page + 1) % PageCount;
			List<GameObject> value = Traverse.Create((object)Choice).Field("spawnedCards").GetValue<List<GameObject>>();
			foreach (GameObject item in value)
			{
				if ((Object)(object)item != (Object)null)
				{
					PhotonNetwork.Destroy(item);
				}
			}
			value.Clear();
			CardChoice choice = Choice;
			choice.picks++;
			((MonoBehaviour)Choice).StartCoroutine(SpawnPage(Choice));
		}

		internal static IEnumerator SpawnPage(CardChoice choice)
		{
			Traverse t = Traverse.Create((object)choice);
			if (choice.picks > 0)
			{
				SoundPlayerStatic.Instance.PlayPlayerBallAppear();
			}
			t.Field("isPlaying").SetValue((object)true);
			yield return (object)new WaitForSecondsRealtime(0.2f);
			if (choice.picks > 0)
			{
				List<GameObject> spawned = t.Field("spawnedCards").GetValue<List<GameObject>>();
				Transform[] slots = t.Field("children").GetValue<Transform[]>();
				List<CardInfo> cards = OneShots.GetPlayer(PickerId).data.currentCards;
				slotToCard.Clear();
				for (int slot = 0; slot < slots.Length; slot++)
				{
					int num = Page * slots.Length + slot;
					if (num < candidates.Count)
					{
						CardInfo val = cards[candidates[num]];
						GameObject val2 = PhotonNetwork.Instantiate(((Object)((Component)val).gameObject).name, slots[slot].position, slots[slot].rotation, (byte)0, (object[])null);
						val2.GetComponent<CardInfo>().sourceCard = val;
						DamagableEvent componentInChildren = val2.GetComponentInChildren<DamagableEvent>();
						Collider2D val3 = ((componentInChildren != null) ? ((Component)componentInChildren).GetComponent<Collider2D>() : null);
						if ((Object)(object)val3 != (Object)null)
						{
							((Behaviour)val3).enabled = false;
						}
						val2.AddComponent<PublicInt>().theInt = slot;
						spawned.Add(val2);
						slotToCard[slot] = candidates[num];
						yield return (object)new WaitForSecondsRealtime(0.1f);
						continue;
					}
					break;
				}
			}
			else
			{
				((Component)choice).GetComponent<PhotonView>().RPC("RPCA_DonePicking", (RpcTarget)0, Array.Empty<object>());
			}
			choice.picks--;
			t.Field("isPlaying").SetValue((object)false);
		}

		internal static void Choose(GameObject pickedCard)
		{
			PublicInt componentInParent = pickedCard.GetComponentInParent<PublicInt>();
			if (!((Object)(object)componentInParent == (Object)null) && slotToCard.TryGetValue(componentInParent.theInt, out var value))
			{
				Player player = OneShots.GetPlayer(PickerId);
				NetworkingManager.RPC(typeof(BombPick), "RPCA_Detonate", new object[3]
				{
					PickerId,
					value,
					((Object)player.data.currentCards[value]).name
				});
			}
		}

		[UnboundRPC]
		private static void RPCA_Detonate(int playerId, int cardIndex, string cardName)
		{
			if (OneShots.IsHost)
			{
				Player player = OneShots.GetPlayer(playerId);
				if (!((Object)(object)player == (Object)null))
				{
					int bombIndex = OneShots.LastIndexOf<Bomb>(player);
					((MonoBehaviour)Unbound.Instance).StartCoroutine(RemoveCards(player, bombIndex, cardIndex, cardName));
				}
			}
		}

		private static IEnumerator RemoveCards(Player player, int bombIndex, int cardIndex, string cardName)
		{
			List<CardInfo> currentCards = player.data.currentCards;
			List<CardInfo> list = new List<CardInfo>();
			for (int i = 0; i < currentCards.Count; i++)
			{
				if (i != bombIndex && (i != cardIndex || !(((Object)currentCards[i]).name == cardName)))
				{
					list.Add(currentCards[i]);
				}
			}
			yield return OneShots.SetHands(new Dictionary<Player, List<CardInfo>> { [player] = list });
		}
	}
	[HarmonyPatch(typeof(CardChoice), "ReplaceCards")]
	internal static class CardChoice_ReplaceCards_BombPatch
	{
		[HarmonyPriority(800)]
		private static bool Prefix(CardChoice __instance, ref IEnumerator __result)
		{
			if (!BombPick.Active)
			{
				return true;
			}
			__result = BombPick.SpawnPage(__instance);
			return false;
		}
	}
	[HarmonyPatch(typeof(ApplyCardStats), "Pick")]
	internal static class ApplyCardStats_Pick_BombPatch
	{
		[HarmonyPriority(800)]
		private static bool Prefix(ApplyCardStats __instance)
		{
			if (!BombPick.Active)
			{
				return true;
			}
			BombPick.Choose(((Component)__instance).gameObject);
			return false;
		}
	}
	public class BombPickUI : MonoBehaviour
	{
		private GUIStyle title;

		private GUIStyle button;

		private bool cursorWasVisible;

		private bool cursorForced;

		private void Update()
		{
			bool isLocalPicker = BombPick.IsLocalPicker;
			if (isLocalPicker && !cursorForced)
			{
				cursorWasVisible = Cursor.visible;
				Cursor.visible = true;
				cursorForced = true;
			}
			else if (!isLocalPicker && cursorForced)
			{
				Cursor.visible = cursorWasVisible;
				cursorForced = false;
			}
			if (isLocalPicker)
			{
				bool flag = PlayerManager.instance.GetActionsFromPlayer(BombPick.PickerId)?.Any((PlayerActions a) => a != null && ((OneAxisInputControl)a.Block).WasPressed) ?? false;
				if (Input.GetKeyDown((KeyCode)114) || flag)
				{
					BombPick.NextPage();
				}
			}
		}

		private void OnGUI()
		{
			//IL_0028: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			if (!BombPick.Active)
			{
				return;
			}
			float num = (float)Screen.height / 1080f;
			if (title == null)
			{
				title = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				};
				title.normal.textColor = new Color(1f, 0.55f, 0.15f);
				button = new GUIStyle(GUI.skin.button)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				};
			}
			title.fontSize = Mathf.RoundToInt(44f * num);
			button.fontSize = Mathf.RoundToInt(34f * num);
			string text = (BombPick.IsLocalPicker ? "BOMB: PICK ONE OF YOUR CARDS TO DESTROY" : "A BOMB IS BEING PLANTED...");
			GUI.Label(new Rect(0f, 30f * num, (float)Screen.width, 60f * num), text, title);
			if (BombPick.IsLocalPicker && BombPick.PageCount > 1)
			{
				float num2 = 760f * num;
				float num3 = 84f * num;
				Rect val = new Rect(((float)Screen.width - num2) / 2f, 100f * num, num2, num3);
				GUI.enabled = BombPick.CanCycle;
				string text2 = $"NEXT {BombPick.PageSize} CARDS  >>   (page {BombPick.Page + 1} of {BombPick.PageCount})   [R / Block]";
				if (GUI.Button(val, text2, button))
				{
					BombPick.NextPage();
				}
				GUI.enabled = true;
			}
		}
	}
	internal static class CardArt
	{
		private const float ArtWidth = 1100f;

		private const float ArtHeight = 865f;

		private const int ArtLayer = 10;

		public static GameObject Get(string name)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			byte[] array = ReadResource("StinkyCards.art." + name + ".png");
			if (array == null)
			{
				Debug.LogWarning("[StinkyCards] No art for '" + name + "'.");
				return null;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			GameObject val2 = new GameObject("StinkyCards_Art_" + name, new Type[1] { typeof(RectTransform) })
			{
				layer = 10
			};
			Object.DontDestroyOnLoad((Object)val2);
			((RectTransform)val2.transform).sizeDelta = new Vector2(1100f, 865f);
			Image obj = val2.AddComponent<Image>();
			obj.sprite = sprite;
			obj.preserveAspect = true;
			((Graphic)obj).raycastTarget = false;
			return val2;
		}

		private static byte[] ReadResource(string resourceName)
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				return null;
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			return memoryStream.ToArray();
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "DoDamage")]
	internal static class HealthHandler_DoDamage_Patch
	{
		[HarmonyPriority(800)]
		private static bool Prefix(HealthHandler __instance, ref Vector2 damage, Player damagingPlayer, bool ignoreBlock)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			WorldBurnEffect component = ((Component)__instance).GetComponent<WorldBurnEffect>();
			if ((Object)(object)component != (Object)null && component.Invincible)
			{
				return false;
			}
			if ((Object)(object)damagingPlayer == (Object)null || damage == Vector2.zero || (Object)(object)((Component)__instance).GetComponent<SoapEffect>() == (Object)null)
			{
				return true;
			}
			CharacterData component2 = ((Component)__instance).GetComponent<CharacterData>();
			if (component2.dead || !component2.isPlaying || (component2.block.IsBlocking() && !ignoreBlock))
			{
				return true;
			}
			float num = ((component2.aimDirection.x < 0f) ? (-1f) : 1f);
			float num2 = ((Vector2)(ref damage)).normalized.x * num;
			if (num2 > 0.3f)
			{
				__instance.Heal(((Vector2)(ref damage)).magnitude);
				return false;
			}
			if (num2 < -0.3f)
			{
				damage *= 2f;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "RPCA_Die")]
	internal static class HealthHandler_RPCA_Die_Patch
	{
		[HarmonyPriority(800)]
		private static bool Prefix(HealthHandler __instance)
		{
			WorldBurnEffect component = ((Component)__instance).GetComponent<WorldBurnEffect>();
			if (!((Object)(object)component == (Object)null))
			{
				return !component.Invincible;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "RPCA_Die_Phoenix")]
	internal static class HealthHandler_RPCA_Die_Phoenix_Patch
	{
		[HarmonyPriority(800)]
		private static bool Prefix(HealthHandler __instance)
		{
			WorldBurnEffect component = ((Component)__instance).GetComponent<WorldBurnEffect>();
			if (!((Object)(object)component == (Object)null))
			{
				return !component.Invincible;
			}
			return true;
		}
	}
	public static class OneShots
	{
		public enum Kind
		{
			Bomb,
			Chance,
			Nuke
		}

		private static readonly List<KeyValuePair<Kind, int>> Pending = new List<KeyValuePair<Kind, int>>();

		public static bool IsHost
		{
			get
			{
				if (!PhotonNetwork.OfflineMode)
				{
					return PhotonNetwork.IsMasterClient;
				}
				return true;
			}
		}

		public static void Queue(Kind kind, Player player)
		{
			Pending.Add(new KeyValuePair<Kind, int>(kind, player.playerID));
		}

		public static IEnumerator Clear(IGameModeHandler gm)
		{
			Pending.Clear();
			yield break;
		}

		public static IEnumerator Resolve(IGameModeHandler gm)
		{
			while (Pending.Count > 0)
			{
				KeyValuePair<Kind, int> keyValuePair = Pending[0];
				Pending.RemoveAt(0);
				Player player = GetPlayer(keyValuePair.Value);
				if (!((Object)(object)player == (Object)null))
				{
					switch (keyValuePair.Key)
					{
					case Kind.Bomb:
						yield return BombPick.Run(player);
						break;
					case Kind.Chance:
						yield return Announce("CHANCE! HANDS SWAPPED", new Color(1f, 0.45f, 0.85f), Chance(player));
						break;
					case Kind.Nuke:
						yield return Announce("TACTICAL NUKE! CARDS SCRAMBLED", new Color(1f, 0.3f, 0.05f), Nuke(player));
						break;
					}
				}
			}
		}

		public static Player GetPlayer(int playerId)
		{
			return ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerId));
		}

		public static int LastIndexOf<T>(Player player) where T : MonoBehaviour
		{
			return player.data.currentCards.FindLastIndex((CardInfo c) => (Object)(object)c != (Object)null && (Object)(object)((Component)c).GetComponent<T>() != (Object)null);
		}

		public static IEnumerator SetHands(Dictionary<Player, List<CardInfo>> hands)
		{
			foreach (KeyValuePair<Player, List<CardInfo>> hand in hands)
			{
				Cards.instance.RemoveAllCardsFromPlayer(hand.Key, true);
			}
			for (int i = 0; i < 20; i++)
			{
				yield return null;
			}
			foreach (KeyValuePair<Player, List<CardInfo>> hand2 in hands)
			{
				Cards.instance.AddCardsToPlayer(hand2.Key, hand2.Value.ToArray(), true, (string[])null, (float[])null, (float[])null, true);
			}
		}

		private static IEnumerator Announce(string text, Color color, IEnumerator hostAction)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			UIHandler.instance.ShowJoinGameText(text, color);
			if (IsHost)
			{
				((MonoBehaviour)Unbound.Instance).StartCoroutine(hostAction);
			}
			yield return (object)new WaitForSecondsRealtime(1.75f);
			UIHandler.instance.HideJoinGameText();
		}

		private static IEnumerator Chance(Player player)
		{
			List<CardInfo> list = player.data.currentCards.ToList();
			int num = OneShots.LastIndexOf<Chance>(player);
			if (num >= 0)
			{
				list.RemoveAt(num);
			}
			Dictionary<Player, List<CardInfo>> dictionary = new Dictionary<Player, List<CardInfo>>();
			List<Player> list2 = PlayerManager.instance.players.Where((Player p) => p.teamID != player.teamID).ToList();
			if (list2.Count == 0)
			{
				dictionary[player] = list;
			}
			else
			{
				Player val = list2[Random.Range(0, list2.Count)];
				dictionary[player] = val.data.currentCards.ToList();
				dictionary[val] = list;
			}
			yield return SetHands(dictionary);
		}

		private static IEnumerator Nuke(Player nuker)
		{
			List<Player> list = PlayerManager.instance.players.ToList();
			Dictionary<Player, int> dictionary = new Dictionary<Player, int>();
			List<CardInfo> list2 = new List<CardInfo>();
			foreach (Player item in list)
			{
				List<CardInfo> list3 = item.data.currentCards.ToList();
				if ((Object)(object)item == (Object)(object)nuker)
				{
					int num = OneShots.LastIndexOf<TacticalNuke>(item);
					if (num >= 0)
					{
						list3.RemoveAt(num);
					}
				}
				dictionary[item] = list3.Count;
				list2.AddRange(list3);
			}
			for (int num2 = list2.Count - 1; num2 > 0; num2--)
			{
				int num3 = Random.Range(0, num2 + 1);
				List<CardInfo> list4 = list2;
				int index = num2;
				int index2 = num3;
				CardInfo value = list2[num3];
				CardInfo value2 = list2[num2];
				list4[index] = value;
				list2[index2] = value2;
			}
			Dictionary<Player, List<CardInfo>> hands = list.ToDictionary((Player result) => result, (Player val) => new List<CardInfo>());
			foreach (Player p in list.OrderBy((Player _) => Random.value))
			{
				for (int num4 = 0; num4 < dictionary[p]; num4++)
				{
					int num5 = list2.FindIndex((CardInfo c) => Fits(c, hands[p]));
					if (num5 < 0)
					{
						num5 = 0;
					}
					hands[p].Add(list2[num5]);
					list2.RemoveAt(num5);
				}
			}
			yield return SetHands(hands);
		}

		private static bool Fits(CardInfo card, List<CardInfo> hand)
		{
			CardCategory[] second = (CardCategory[])(((object)card.categories) ?? ((object)new CardCategory[0]));
			CardCategory[] second2 = (CardCategory[])(((object)card.blacklistedCategories) ?? ((object)new CardCategory[0]));
			foreach (CardInfo item in hand)
			{
				if (!card.allowMultiple && item.cardName == card.cardName)
				{
					return false;
				}
				if (((IEnumerable<CardCategory>)(((object)item.blacklistedCategories) ?? ((object)new CardCategory[0]))).Intersect(second).Any())
				{
					return false;
				}
				if (((IEnumerable<CardCategory>)(((object)item.categories) ?? ((object)new CardCategory[0]))).Intersect(second2).Any())
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class Rarities
	{
		public const string UltraRareName = "Ultra Rare";

		public static Rarity Legendary => RarityUtils.GetRarity("Legendary");

		public static Rarity UltraRare => RarityUtils.GetRarity("Ultra Rare");

		public static void Register()
		{
			//IL_0019: 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)
			RarityUtils.AddRarity("Ultra Rare", 0.005f, new Color(1f, 0.3f, 0.05f), new Color(0.55f, 0.15f, 0.03f));
		}
	}
	public static class SpriteShapes
	{
		private static Sprite ring;

		private static Sprite blob;

		public static Sprite Ring => ring ?? (ring = Make(128, (float d) => Band(d, 0.78f, 0.95f)));

		public static Sprite Blob => blob ?? (blob = Make(128, (float d) => 1f - Mathf.SmoothStep(0.75f, 1f, d)));

		private static float Band(float d, float inner, float outer)
		{
			return Mathf.SmoothStep(inner - 0.12f, inner, d) * (1f - Mathf.SmoothStep(outer, outer + 0.05f, d));
		}

		private static Sprite Make(int size, Func<float, float> alpha)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Color32[] array = (Color32[])(object)new Color32[size * size];
			float num = (float)(size - 1) / 2f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float arg = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num) * ((float)i - num)) / num;
					array[i * size + j] = Color32.op_Implicit(new Color(1f, 1f, 1f, Mathf.Clamp01(alpha(arg))));
				}
			}
			val.SetPixels32(array);
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size);
		}
	}
	internal static class VanillaFx
	{
		private static GameObject toxicCloud;

		private static GameObject explosion;

		private static GameObject holder;

		public static GameObject ToxicCloud
		{
			get
			{
				if ((Object)(object)toxicCloud == (Object)null)
				{
					GameObject val = CardEffect("0 cards/Toxic cloud");
					SpawnObjects val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<SpawnObjects>() : null);
					toxicCloud = (((Object)(object)val2 != (Object)null) ? val2.objectToSpawn[0] : FindByName("E_ToxicCloud"));
				}
				return toxicCloud;
			}
		}

		public static GameObject Explosion
		{
			get
			{
				if ((Object)(object)explosion == (Object)null)
				{
					explosion = CardEffect("0 cards/Explosive bullet") ?? FindByName("A_Explosion");
				}
				return explosion;
			}
		}

		public static GameObject SpawnInactive(GameObject prefab, Vector3 position, Player spawner)
		{
			//IL_0032: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if ((Object)(object)holder == (Object)null)
			{
				holder = new GameObject("StinkyCards_FxHolder");
				holder.SetActive(false);
				Object.DontDestroyOnLoad((Object)(object)holder);
			}
			GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity, holder.transform);
			(val.GetComponent<SpawnedAttack>() ?? val.AddComponent<SpawnedAttack>()).spawner = spawner;
			return val;
		}

		public static void Activate(GameObject go)
		{
			go.transform.SetParent((Transform)null, true);
		}

		public static void Tint(GameObject go, Color a, Color b, Color ring)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			ParticleSystem[] componentsInChildren = go.GetComponentsInChildren<ParticleSystem>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				((MainModule)(ref main)).startColor = new MinMaxGradient(a, b);
			}
			LineRenderer[] componentsInChildren2 = go.GetComponentsInChildren<LineRenderer>(true);
			foreach (LineRenderer obj in componentsInChildren2)
			{
				Gradient colorGradient = obj.colorGradient;
				GradientColorKey[] array = ((IEnumerable<GradientColorKey>)colorGradient.colorKeys).Select((Func<GradientColorKey, GradientColorKey>)((GradientColorKey k) => new GradientColorKey(ring, k.time))).ToArray();
				colorGradient.SetKeys(array, colorGradient.alphaKeys);
				obj.colorGradient = colorGradient;
			}
			LineEffect[] componentsInChildren3 = go.GetComponentsInChildren<LineEffect>(true);
			for (int i = 0; i < componentsInChildren3.Length; i++)
			{
				componentsInChildren3[i].useColorOverTime = false;
			}
		}

		private static GameObject CardEffect(string resourcePath)
		{
			GameObject val = Resources.Load<GameObject>(resourcePath);
			Gun val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<Gun>() : null);
			if ((Object)(object)val2 == (Object)null || val2.objectsToSpawn == null || val2.objectsToSpawn.Length == 0)
			{
				return null;
			}
			return val2.objectsToSpawn[0].effect;
		}

		private static GameObject FindByName(string name)
		{
			GameObject? obj = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject g) => ((Object)g).name == name));
			if ((Object)(object)obj == (Object)null)
			{
				Debug.LogError("[StinkyCards] Couldn't find vanilla effect '" + name + "'.");
			}
			return obj;
		}
	}
	public class WorldBurnEffect : MonoBehaviour
	{
		private Player player;

		private bool burnedOut;

		private float sinceRevive;

		private SpriteRenderer halo;

		public bool Invincible => !burnedOut;

		private void Start()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			player = ((Component)this).GetComponent<Player>();
			HealthHandler healthHandler = player.data.healthHandler;
			healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
			halo = new GameObject("WorldBurnHalo").AddComponent<SpriteRenderer>();
			((Component)halo).transform.SetParent(((Component)this).transform, false);
			halo.sprite = SpriteShapes.Ring;
			((Renderer)halo).sortingOrder = 50;
		}

		private void OnDestroy()
		{
			if ((Object)(object)player != (Object)null)
			{
				HealthHandler healthHandler = player.data.healthHandler;
				healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
			}
			if ((Object)(object)halo != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)halo).gameObject);
			}
		}

		private void OnRevive()
		{
			burnedOut = false;
			sinceRevive = 0f;
		}

		private void Update()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			sinceRevive += TimeHandler.deltaTime;
			float num = Mathf.PerlinNoise(Time.time * 6f, 0f);
			((Renderer)halo).enabled = !burnedOut;
			halo.color = Color.Lerp(new Color(1f, 0.25f, 0.05f, 0.7f), new Color(1f, 0.75f, 0.1f, 0.9f), num);
			((Component)halo).transform.localScale = Vector3.one * (2.7f + 0.25f * num);
			if (!burnedOut && player.data.view.IsMine && !player.data.dead && player.data.isPlaying && !((Object)(object)GameManager.instance == (Object)null) && GameManager.instance.battleOngoing && !(sinceRevive < 0.5f) && (from p in PlayerManager.instance.players
				where !p.data.dead && (Object)(object)((Component)p).GetComponent<WorldBurnEffect>() == (Object)null
				select p.teamID).Distinct().Count() <= 1)
			{
				burnedOut = true;
				NetworkingManager.RPC(typeof(WorldBurnEffect), "RPCA_BurnOut", new object[1] { player.playerID });
			}
		}

		[UnboundRPC]
		private static void RPCA_BurnOut(int playerId)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Player val = OneShots.GetPlayer(playerId);
			if (!((Object)(object)val == (Object)null))
			{
				WorldBurnEffect component = ((Component)val).GetComponent<WorldBurnEffect>();
				if ((Object)(object)component != (Object)null)
				{
					component.burnedOut = true;
				}
				if (!val.data.dead)
				{
					ExtensionMethods.InvokeMethod((object)val.data.healthHandler, "RPCA_Die", new object[1] { Vector2.down });
				}
			}
		}
	}
}
namespace StinkyCards.Cards
{
	public class ArmorPiercer : StinkyCard
	{
		public const float BonusDamagePerStack = 0.5f;

		protected override string GetTitle()
		{
			return "Armor Piercer";
		}

		protected override string GetDescription()
		{
			return "The first shot after every reload is unblockable and hits harder.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)1;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "", "First shot after reload is unblockable"),
				StinkyCard.Stat(positive: true, "+50%", "DMG on that shot")
			};
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<ArmorPiercerEffect>(((Component)player).gameObject, false).Stacks++;
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ArmorPiercerEffect component = ((Component)player).GetComponent<ArmorPiercerEffect>();
			if ((Object)(object)component != (Object)null && --component.Stacks <= 0)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public class ArmorPiercerEffect : MonoBehaviour
	{
		public int Stacks;

		private Player player;

		private bool armed = true;

		private int firedFrame = -1;

		private void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			Gun gun = player.data.weaponHandler.gun;
			gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(gun.ShootPojectileAction, new Action<GameObject>(OnShoot));
			player.data.stats.OnReloadDoneAction = (Action<int>)Delegate.Combine(player.data.stats.OnReloadDoneAction, new Action<int>(OnReload));
			player.data.healthHandler.reviveAction = (Action)Delegate.Combine(player.data.healthHandler.reviveAction, new Action(Arm));
		}

		private void OnDestroy()
		{
			if (!((Object)(object)player == (Object)null))
			{
				Gun gun = player.data.weaponHandler.gun;
				gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun.ShootPojectileAction, new Action<GameObject>(OnShoot));
				player.data.stats.OnReloadDoneAction = (Action<int>)Delegate.Remove(player.data.stats.OnReloadDoneAction, new Action<int>(OnReload));
				player.data.healthHandler.reviveAction = (Action)Delegate.Remove(player.data.healthHandler.reviveAction, new Action(Arm));
			}
		}

		private void Arm()
		{
			armed = true;
		}

		private void OnReload(int bulletsReloaded)
		{
			armed = true;
		}

		private void OnShoot(GameObject bullet)
		{
			if (armed || firedFrame == Time.frameCount)
			{
				armed = false;
				firedFrame = Time.frameCount;
				ProjectileHit component = bullet.GetComponent<ProjectileHit>();
				if (!((Object)(object)component == (Object)null))
				{
					component.unblockable = true;
					component.dealDamageMultiplierr *= 1f + 0.5f * (float)Stacks;
				}
			}
		}
	}
	public abstract class OneShotCard : StinkyCard
	{
		protected abstract OneShots.Kind Kind { get; }

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			CardInfoExtension.GetAdditionalData(cardInfo).canBeReassigned = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			OneShots.Queue(Kind, player);
		}
	}
	public class Bomb : OneShotCard
	{
		protected override OneShots.Kind Kind => OneShots.Kind.Bomb;

		protected override string GetTitle()
		{
			return "Bomb";
		}

		protected override string GetDescription()
		{
			return "Pick one of your own cards and blow it up.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)1;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[1] { StinkyCard.Stat(positive: true, "", "Choose a card to remove") };
		}
	}
	public class Chance : OneShotCard
	{
		protected override OneShots.Kind Kind => OneShots.Kind.Chance;

		protected override string GetTitle()
		{
			return "Chance";
		}

		protected override string GetDescription()
		{
			return "Swap your whole hand with a random opponent's. Feeling lucky?";
		}

		protected override Rarity GetRarity()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return Rarities.Legendary;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)8;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[1] { StinkyCard.Stat(positive: true, "", "Swap all cards with a random opponent") };
		}
	}
	public class TacticalNuke : OneShotCard
	{
		protected override OneShots.Kind Kind => OneShots.Kind.Nuke;

		protected override string GetTitle()
		{
			return "Tactical Nuke";
		}

		protected override string GetDescription()
		{
			return "Every card in play is thrown in a pile and dealt back out at random.";
		}

		protected override Rarity GetRarity()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return Rarities.UltraRare;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "", "Scramble every player's cards"),
				StinkyCard.Stat(positive: true, "", "Everyone keeps their card count")
			};
		}
	}
	public class WatchTheWorldBurn : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Watch the World Burn";
		}

		protected override string GetDescription()
		{
			return "You can't win, but you get to choose who loses. You drop dead once only one rival is left standing.";
		}

		protected override Rarity GetRarity()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return Rarities.Legendary;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "", "Invincible while 2+ rivals live"),
				StinkyCard.Stat(positive: false, "", "You can never win a round")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<WorldBurnEffect>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			WorldBurnEffect component = ((Component)player).GetComponent<WorldBurnEffect>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public class DroppedTheSoap : StinkyCard
	{
		public const float FrontDamageMultiplier = 2f;

		public const float SideThreshold = 0.3f;

		protected override string GetTitle()
		{
			return "I Dropped the Soap...On Purpose";
		}

		protected override string GetDescription()
		{
			return "Face your enemies and you'll regret it. Turn around and enjoy it.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)2;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "", "Hits from behind heal you"),
				StinkyCard.Stat(positive: false, "+100%", "DMG taken from the front")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<SoapEffect>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			SoapEffect component = ((Component)player).GetComponent<SoapEffect>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public class SoapEffect : MonoBehaviour
	{
	}
	public class StinkBomb : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Stink Bomb";
		}

		protected override string GetDescription()
		{
			return "Blocking releases a cloud of toxic stink around you.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)5;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				StinkyCard.Stat(positive: true, "", "Block releases a toxic cloud"),
				StinkyCard.Stat(positive: true, "x2", "Cloud size per extra copy"),
				StinkyCard.Stat(positive: false, "+0.5s", "Block cooldown")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			block.cdAdd = 0.5f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BlockTriggerEffect.AddStack<StinkBombEffect>(player);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BlockTriggerEffect.RemoveStack<StinkBombEffect>(player);
		}
	}
	public class StinkBombEffect : BlockTriggerEffect
	{
		private const float Scale = 1.5f;

		private const float DamagePerTick = 4f;

		private const float DamagePerTickPerExtraStack = 2f;

		protected override void OnBlock()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = VanillaFx.SpawnInactive(VanillaFx.ToxicCloud, ((Component)this).transform.position, player);
			Transform transform = obj.transform;
			transform.localScale *= 1.5f * Mathf.Pow(2f, (float)(Stacks - 1));
			VanillaFx.Tint(obj, new Color(0.62f, 0.6f, 0.12f), new Color(0.7f, 0.66f, 0.18f), new Color(0.55f, 0.5f, 0.05f));
			Explosion component = obj.GetComponent<Explosion>();
			component.ignoreTeam = true;
			component.scaleDmg = false;
			component.damage = 4f + 2f * (float)(Stacks - 1);
			VanillaFx.Activate(obj);
		}
	}
	public class DutchOven : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Dutch Oven";
		}

		protected override string GetDescription()
		{
			return "Blocking smothers everyone nearby in a thick brown fog that bogs them down.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)6;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				StinkyCard.Stat(positive: true, "", "Block releases a large slowing fog"),
				StinkyCard.Stat(positive: true, "x2", "Fog size per extra copy"),
				StinkyCard.Stat(positive: false, "+0.5s", "Block cooldown")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = true;
			block.cdAdd = 0.5f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BlockTriggerEffect.AddStack<DutchOvenEffect>(player);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BlockTriggerEffect.RemoveStack<DutchOvenEffect>(player);
		}
	}
	public class DutchOvenEffect : BlockTriggerEffect
	{
		private const float Scale = 2f;

		private const float SlowPerTick = 0.6f;

		protected override void OnBlock()
		{
			//IL_000b: 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)
			//IL_0041: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = VanillaFx.SpawnInactive(VanillaFx.ToxicCloud, ((Component)this).transform.position, player);
			Transform transform = val.transform;
			transform.localScale *= 2f * Mathf.Pow(2f, (float)(Stacks - 1));
			VanillaFx.Tint(val, new Color(0.3f, 0.18f, 0.08f), new Color(0.42f, 0.26f, 0.11f), new Color(0.55f, 0.3f, 0.08f));
			ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 1.4f;
				((MainModule)(ref main)).startSpeedMultiplier = ((MainModule)(ref main)).startSpeedMultiplier * 0.5f;
			}
			Explosion component = val.GetComponent<Explosion>();
			component.ignoreTeam = true;
			component.damage = 0f;
			component.slow = 0.6f;
			component.fastSlow = false;
			component.scaleSlow = false;
			VanillaFx.Activate(val);
		}
	}
	public class ShinyTurd : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Shiny Turd";
		}

		protected override string GetDescription()
		{
			return "Blocking drops a gleaming nugget. Three seconds later it goes off. Big.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[3]
			{
				StinkyCard.Stat(positive: true, "", "Block drops a nugget that explodes after 3s"),
				StinkyCard.Stat(positive: false, "", "The blast hurts you too"),
				StinkyCard.Stat(positive: false, "+1s", "Block cooldown")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			block.cdAdd = 1f;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BlockTriggerEffect.AddStack<ShinyTurdEffect>(player);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			BlockTriggerEffect.RemoveStack<ShinyTurdEffect>(player);
		}
	}
	public class ShinyTurdEffect : BlockTriggerEffect
	{
		public const float BlastScale = 10.5f;

		public const float BlastScalePerExtraStack = 3f;

		protected override void OnBlock()
		{
			//IL_0005: 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)
			TurdNugget turdNugget = new GameObject("StinkyCards_ShinyTurd").AddComponent<TurdNugget>();
			((Component)turdNugget).transform.position = ((Component)this).transform.position;
			turdNugget.Spawner = player;
			turdNugget.BlastScale = 10.5f + 3f * (float)(Stacks - 1);
		}
	}
	public class TurdNugget : MonoBehaviour
	{
		public const float Fuse = 3f;

		private const float ColliderRadius = 0.4f;

		private static readonly List<TurdNugget> Live = new List<TurdNugget>();

		private static Sprite nuggetSprite;

		private static Sprite sparkleSprite;

		public Player Spawner;

		public float BlastScale;

		private SpriteRenderer body;

		private Transform sparkle;

		private float age;

		private static PhysicsMaterial2D slippery;

		public static void ClearAll()
		{
			TurdNugget[] array = Live.ToArray();
			foreach (TurdNugget turdNugget in array)
			{
				if ((Object)(object)turdNugget != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)turdNugget).gameObject);
				}
			}
			Live.Clear();
		}

		private void Awake()
		{
			//IL_006b: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			Live.Add(this);
			((Component)this).gameObject.layer = LayerMask.NameToLayer("Corpse");
			Rigidbody2D obj = ((Component)this).gameObject.AddComponent<Rigidbody2D>();
			obj.mass = 0.5f;
			obj.freezeRotation = true;
			obj.collisionDetectionMode = (CollisionDetectionMode2D)1;
			obj.interpolation = (RigidbodyInterpolation2D)1;
			CircleCollider2D obj2 = ((Component)this).gameObject.AddComponent<CircleCollider2D>();
			obj2.radius = 0.4f;
			((Collider2D)obj2).offset = new Vector2(0f, 0.4f);
			object obj3 = slippery;
			if (obj3 == null)
			{
				PhysicsMaterial2D val = new PhysicsMaterial2D("StinkyCards_Nugget")
				{
					friction = 0.05f,
					bounciness = 0.15f
				};
				slippery = val;
				obj3 = (object)val;
			}
			((Collider2D)obj2).sharedMaterial = (PhysicsMaterial2D)obj3;
			body = new GameObject("Body").AddComponent<SpriteRenderer>();
			((Component)body).transform.SetParent(((Component)this).transform, false);
			body.sprite = nuggetSprite ?? (nuggetSprite = MakeNuggetSprite());
			((Renderer)body).sortingOrder = 50;
			SpriteRenderer val2 = new GameObject("Sparkle").AddComponent<SpriteRenderer>();
			((Component)val2).transform.SetParent(((Component)this).transform, false);
			((Component)val2).transform.localPosition = new Vector3(-0.25f, 0.85f, -0.01f);
			val2.sprite = sparkleSprite ?? (sparkleSprite = MakeSparkleSprite());
			((Renderer)val2).sortingOrder = 51;
			sparkle = ((Component)val2).transform;
		}

		private void OnDestroy()
		{
			Live.Remove(this);
		}

		private void Update()
		{
			float deltaTime = TimeHandler.deltaTime;
			age += deltaTime;
			Animate();
			if (age >= 3f)
			{
				Detonate();
			}
		}

		private void Animate()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.6f + 0.4f * Mathf.Sin(age * 9f);
			sparkle.localScale = Vector3.one * num;
			sparkle.localRotation = Quaternion.Euler(0f, 0f, age * 90f);
			float num2 = 3f - age;
			float num3 = ((num2 > 1.5f) ? 2f : ((num2 > 0.5f) ? 6f : 14f));
			bool flag = Mathf.Repeat(age * num3, 1f) < 0.25f;
			body.color = (Color)(flag ? new Color(1f, 0.85f, 0.6f) : Color.white);
			((Component)this).transform.localScale = Vector3.one * (1f + ((num2 < 0.5f) ? ((0.5f - num2) * 0.8f) : 0f));
		}

		private void Detonate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Spawner != (Object)null && (Object)(object)VanillaFx.Explosion != (Object)null)
			{
				GameObject obj = VanillaFx.SpawnInactive(VanillaFx.Explosion, ((Component)this).transform.position + Vector3.up * 0.5f, Spawner);
				Transform transform = obj.transform;
				transform.localScale *= BlastScale;
				VanillaFx.Activate(obj);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private static Sprite MakeNuggetSprite()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Vector4[] array = (Vector4[])(object)new Vector4[4]
			{
				new Vector4(32f, 13f, 27f, 12f),
				new Vector4(32f, 28f, 20f, 10f),
				new Vector4(33f, 41f, 13f, 8f),
				new Vector4(36f, 51f, 6f, 7f)
			};
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.2f, 0.1f, 0.03f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.58f, 0.36f, 0.14f);
			Color[] array2 = (Color[])(object)new Color[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = float.MaxValue;
					Vector4 val4 = default(Vector4);
					Vector4[] array3 = array;
					foreach (Vector4 val5 in array3)
					{
						float num2 = Sq(((float)j - val5.x) / val5.z) + Sq(((float)i - val5.y) / val5.w);
						if (num2 < num)
						{
							num = num2;
							val4 = val5;
						}
					}
					Color val6 = Color.clear;
					if (num <= 1f)
					{
						float num3 = Mathf.Clamp01(0.55f + 0.35f * (val4.x - (float)j) / val4.z + 0.35f * ((float)i - val4.y) / val4.w);
						val6 = Color.Lerp(val2, val3, num3);
						if (num > 0.78f)
						{
							val6 = val2;
						}
						float num4 = ((float)j - (val4.x - val4.z * 0.35f)) / (val4.z * 0.28f);
						float num5 = ((float)i - (val4.y + val4.w * 0.35f)) / (val4.w * 0.22f);
						if (num4 * num4 + num5 * num5 < 1f)
						{
							val6 = Color.Lerp(val6, Color.white, 0.75f);
						}
						val6.a = 1f;
					}
					array2[i * 64 + j] = val6;
				}
			}
			val.SetPixels(array2);
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0f), 53.333332f);
		}

		private static Sprite MakeSparkleSprite()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Color[] array = (Color[])(object)new Color[1024];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = Mathf.Abs((float)j - 15.5f) / 15.5f;
					float num2 = Mathf.Abs((float)i - 15.5f) / 15.5f;
					float num3 = Mathf.Sqrt(num) + Mathf.Sqrt(num2);
					float num4 = Mathf.Clamp01((1f - num3) * 3f);
					array[i * 32 + j] = new Color(1f, 1f, 0.85f, num4);
				}
			}
			val.SetPixels(array);
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 53.333332f);
		}

		private static float Sq(float v)
		{
			return v * v;
		}
	}
	public class GhostRounds : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Ghost Rounds";
		}

		protected override string GetDescription()
		{
			return "Your bullets phase through walls, but lose half their punch.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)8;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "", "Bullets pass through walls"),
				StinkyCard.Stat(positive: false, "-50%", "DMG")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
			gun.ignoreWalls = true;
			gun.damage = 0.5f;
		}
	}
	public class Executioner : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Executioner";
		}

		protected override string GetDescription()
		{
			return "Every hit carves off a slice of the target's max HP.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "+10%", "of target's max HP per hit"),
				StinkyCard.Stat(positive: false, "-30%", "DMG")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			gun.percentageDamage = 0.1f;
			gun.damage = 0.7f;
		}
	}
	public class GiantSlayer : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Giant Slayer";
		}

		protected override string GetDescription()
		{
			return "The bigger they are, the harder they fall.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)1;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[1] { StinkyCard.Stat(positive: true, "+40%", "of target's max HP per hit") };
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			gun.percentageDamage = 0.4f;
		}
	}
	public class Pinball : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Pinball";
		}

		protected override string GetDescription()
		{
			return "Bullets pick up speed every time they bounce.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)0;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)3;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "+3", "Bullet bounces"),
				StinkyCard.Stat(positive: true, "+25%", "Bullet speed per bounce")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			gun.reflects = 3;
			gun.speedMOnBounce = 1.25f;
		}
	}
	public class LeapBlock : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Leap Block";
		}

		protected override string GetDescription()
		{
			return "Blocking launches you into the air.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)0;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)2;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "", "Block launches you upward"),
				StinkyCard.Stat(positive: true, "+1", "Jump")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			block.forceToAddUp = 20f;
			statModifiers.numberOfJumps = 1;
		}
	}
	public class Overgrowth : StinkyCard
	{
		protected override string GetTitle()
		{
			return "Overgrowth";
		}

		protected override string GetDescription()
		{
			return "Roots and vines slowly knit your wounds.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)1;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)6;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "+4", "HP regen per second"),
				StinkyCard.Stat(positive: false, "-15%", "Movement speed")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			statModifiers.regen = 4f;
			statModifiers.movementSpeed = 0.85f;
		}
	}
	public class StickyBandit : StinkyCard
	{
		public const float StunTime = 0.5f;

		public const float StunImmunity = 1.5f;

		public const float SlickLifetime = 5f;

		public const float SlickSlow = 0.6f;

		protected override string GetTitle()
		{
			return "The Sticky Bandit";
		}

		protected override string GetDescription()
		{
			return "Your bullets stun on contact and leave a white slick wherever they land. Don't ask what it is.";
		}

		protected override Rarity GetRarity()
		{
			return (Rarity)2;
		}

		protected override CardThemeColorType GetTheme()
		{
			return (CardThemeColorType)3;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[2]
			{
				StinkyCard.Stat(positive: true, "5s", "Slowing slick where bullets land"),
				StinkyCard.Stat(positive: true, "0.5s", "Stun on hit")
			};
		}

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
			cardInfo.allowMultiple = false;
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			ExtensionMethods.GetOrAddComponent<StickyBanditEffect>(((Component)player).gameObject, false);
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			StickyBanditEffect component = ((Component)player).GetComponent<StickyBanditEffect>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public class StickyBanditEffect : MonoBehaviour
	{
		private Player player;

		private void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			Gun gun = player.data.weaponHandler.gun;
			gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(gun.ShootPojectileAction, new Action<GameObject>(OnShoot));
		}

		private void OnDestroy()
		{
			if (!((Object)(object)player == (Object)null))
			{
				Gun gun = player.data.weaponHandler.gun;
				gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun.ShootPojectileAction, new Action<GameObject>(OnShoot));
			}
		}

		private void OnShoot(GameObject bullet)
		{
			bullet.AddComponent<StickyRound>().Owner = player;
		}
	}
	public class StickyRound : RayHitEffect
	{
		public Player Owner;

		private static readonly Dictionary<int, float> StunReadyAt = new Dictionary<int, float>();

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_00c4: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Invalid comparison between Unknown and I4
			if (!((Object)(object)hit.transform == (Object)null) && !((Object)(object)Owner == (Object)null))
			{
				Player componentInParent = ((Component)hit.transform).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					if (componentInParent.teamID != Owner.teamID && !componentInParent.data.dead && (!StunReadyAt.TryGetValue(componentInParent.playerID, out var value) || Time.time >= value))
					{
						componentInParent.data.stunHandler.AddStun(0.5f);
						StunReadyAt[componentInParent.playerID] = Time.time + 1.5f;
					}
				}
				else if ((Object)(object)hit.rigidbody == (Object)null || (int)hit.rigidbody.bodyType == 2)
				{
					StickySlick.Spawn(hit.point, hit.normal, Owner);
				}
				return (HasToReturn)1;
			}
			return (HasToReturn)1;
		}
	}
	public class StickySlick : MonoBehaviour
	{
		private const float Width = 2.6f;

		private const float Thickness = 0.4f;

		private const float MergeDistance = 0.9f;

		private const int MaxSlicks = 80;

		private const float TickInterval = 0.1f;

		private static readonly List<StickySlick> Live = new List<StickySlick>();

		private Player owner;

		private Vector2 tangent;

		private Vector2 normal;

		private SpriteRenderer sprite;

		private float age;

		private float nextTick;

		public static void Spawn(Vector2 point, Vector2 surfaceNormal, Player owner)
		{
			//IL_0029: 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)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			foreach (StickySlick item in Live)
			{
				if ((Object)(object)item.owner == (Object)(object)owner && Vector2.Distance(Vector2.op_Implicit(((Component)item).transform.position), point) < 0.9f)
				{
					item.age = 0f;
					return;
				}
			}
			if (Live.Count >= 80)
			{
				Object.Destroy((Object)(object)((Component)Live[0]).gameObject);
			}
			StickySlick stickySlick = new GameObject("StickySlick").AddComponent<StickySlick>();
			stickySlick.owner = owner;
			stickySlick.normal = ((Vector2)(ref surfaceNormal)).normalized;
			stickySlick.tangent = new Vector2(stickySlick.normal.y, 0f - stickySlick.normal.x);
			((Component)stickySlick).transform.position = Vector2.op_Implicit(point + stickySlick.normal * 0.05f);
			((Component)stickySlick).transform.rotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(stickySlick.tangent.y, stickySlick.tangent.x) * 57.29578f);
			((Component)stickySlick).transform.localScale = new Vector3(2.6f, 0.4f, 1f);
		}

		public static void ClearAll()
		{
			StickySlick[] array = Live.ToArray();
			foreach (StickySlick stickySlick in array)
			{
				if ((Object)(object)stickySlick != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)stickySlick).gameObject);
				}
			}
			Live.Clear();
		}

		private void Awake()
		{
			Live.Add(this);
			sprite = ((Component)this).gameObject.AddComponent<SpriteRenderer>();
			sprite.sprite = SpriteShapes.Blob;
			((Renderer)sprite).sortingOrder = 49;
		}

		private void OnDestroy()
		{
			Live.Remove(this);
		}

		private void Update()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			age += TimeHandler.deltaTime;
			float num = 5f - age;
			if (num <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			sprite.color = new Color(0.97f, 0.97f, 0.93f, 0.9f * Mathf.Clamp01(num));
			if (age < nextTick)
			{
				return;
			}
			nextTick = age + 0.1f;
			foreach (Player player in PlayerManager.instance.players)
			{
				if (!player.data.dead && player.data.view.IsMine && (!((Object)(object)owner != (Object)null) || player.teamID != owner.teamID))
				{
					Vector2 val = Vector2.op_Implicit(((Component)player).transform.position) - Vector2.op_Implicit(((Component)this).transform.position);
					float num2 = Vector2.Dot(val, tangent);
					float num3 = Vector2.Dot(val, normal);
					if (Mathf.Abs(num2) <= 1.5999999f && num3 >= -0.5f && num3 <= 1.6f)
					{
						player.data.stats.RPCA_AddSlow(0.6f, true);
					}
				}
			}
		}
	}
	public abstract class StinkyCard : CustomCard
	{
		protected override GameObject GetCardArt()
		{
			return CardArt.Get(((object)this).GetType().Name);
		}

		public override string GetModName()
		{
			return "STINKY";
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		protected static CardInfoStat Stat(bool positive, string amount, string stat)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			return new CardInfoStat
			{
				positive = positive,
				amount = amount,
				stat = stat,
				simepleAmount = (SimpleAmount)0
			};
		}
	}
}