Decompiled source of WillsWackyCards v1.11.26

WillsWackyCards.dll

Decompiled a month ago
using System;
using System.ArrayExtensions;
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.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using CardThemeLib;
using ClassesManagerReborn;
using ClassesManagerReborn.Util;
using DrawNCards;
using GunChargePatch.Extensions;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using LocalZoom;
using LocalZoom.Extensions;
using Microsoft.CodeAnalysis;
using ModdingUtils.AIMinion;
using ModdingUtils.AIMinion.Extensions;
using ModdingUtils.Extensions;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Patches;
using ModdingUtils.RoundsEffects;
using ModdingUtils.Utils;
using Nullmanager;
using Photon.Pun;
using PlayerTimeScale;
using RarityLib.Utils;
using Sirenix.OdinInspector;
using Sirenix.Serialization;
using Sonigon;
using Sonigon.Internal;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.UI.ProceduralImage;
using WWC.Cards;
using WWC.Cards.Curses;
using WWC.Cards.Testing;
using WWC.Extensions;
using WWC.Interfaces;
using WWC.MonoBehaviours;
using WWC.UI;
using WillsWackyManagers;
using WillsWackyManagers.Extensions;
using WillsWackyManagers.MonoBehaviours;
using WillsWackyManagers.UnityTools;
using WillsWackyManagers.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 System
{
	public static class ObjectExtensions
	{
		private static readonly MethodInfo CloneMethod = typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic);

		public static bool IsPrimitive(this Type type)
		{
			if (type == typeof(string))
			{
				return true;
			}
			return type.IsValueType & type.IsPrimitive;
		}

		public static object Copy(this object originalObject)
		{
			return InternalCopy(originalObject, new Dictionary<object, object>(new ReferenceEqualityComparer()));
		}

		private static object InternalCopy(object originalObject, IDictionary<object, object> visited)
		{
			if (originalObject == null)
			{
				return null;
			}
			Type type = originalObject.GetType();
			if (type.IsPrimitive())
			{
				return originalObject;
			}
			if (visited.ContainsKey(originalObject))
			{
				return visited[originalObject];
			}
			if (typeof(Delegate).IsAssignableFrom(type))
			{
				return null;
			}
			object obj = CloneMethod.Invoke(originalObject, null);
			if (type.IsArray)
			{
				Type elementType = type.GetElementType();
				if (!elementType.IsPrimitive())
				{
					Array clonedArray = (Array)obj;
					clonedArray.ForEach(delegate(Array array, int[] indices)
					{
						array.SetValue(InternalCopy(clonedArray.GetValue(indices), visited), indices);
					});
				}
			}
			visited.Add(originalObject, obj);
			CopyFields(originalObject, visited, obj, type);
			RecursiveCopyBaseTypePrivateFields(originalObject, visited, obj, type);
			return obj;
		}

		private static void RecursiveCopyBaseTypePrivateFields(object originalObject, IDictionary<object, object> visited, object cloneObject, Type typeToReflect)
		{
			if (typeToReflect.BaseType != null)
			{
				RecursiveCopyBaseTypePrivateFields(originalObject, visited, cloneObject, typeToReflect.BaseType);
				CopyFields(originalObject, visited, cloneObject, typeToReflect.BaseType, BindingFlags.Instance | BindingFlags.NonPublic, (FieldInfo info) => info.IsPrivate);
			}
		}

		private static void CopyFields(object originalObject, IDictionary<object, object> visited, object cloneObject, Type typeToReflect, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, Func<FieldInfo, bool> filter = null)
		{
			FieldInfo[] fields = typeToReflect.GetFields(bindingFlags);
			foreach (FieldInfo fieldInfo in fields)
			{
				if ((filter == null || filter(fieldInfo)) && !fieldInfo.FieldType.IsPrimitive())
				{
					object value = fieldInfo.GetValue(originalObject);
					object value2 = InternalCopy(value, visited);
					fieldInfo.SetValue(cloneObject, value2);
				}
			}
		}

		public static T Copy<T>(this T original)
		{
			return (T)((object)original).Copy();
		}
	}
	public class ReferenceEqualityComparer : EqualityComparer<object>
	{
		public override bool Equals(object x, object y)
		{
			return x == y;
		}

		public override int GetHashCode(object obj)
		{
			return obj?.GetHashCode() ?? 0;
		}
	}
}
namespace System.ArrayExtensions
{
	public static class ArrayExtensions
	{
		public static void ForEach(this Array array, Action<Array, int[]> action)
		{
			if (array.LongLength != 0)
			{
				ArrayTraverse arrayTraverse = new ArrayTraverse(array);
				do
				{
					action(array, arrayTraverse.Position);
				}
				while (arrayTraverse.Step());
			}
		}
	}
	internal class ArrayTraverse
	{
		public int[] Position;

		private int[] maxLengths;

		public ArrayTraverse(Array array)
		{
			maxLengths = new int[array.Rank];
			for (int i = 0; i < array.Rank; i++)
			{
				maxLengths[i] = array.GetLength(i) - 1;
			}
			Position = new int[array.Rank];
		}

		public bool Step()
		{
			for (int i = 0; i < Position.Length; i++)
			{
				if (Position[i] < maxLengths[i])
				{
					Position[i]++;
					for (int j = 0; j < i; j++)
					{
						Position[j] = 0;
					}
					return true;
				}
			}
			return false;
		}
	}
}
namespace WWC
{
	public static class RandomKilling
	{
		private static Coroutine killRoutine;

		public static void StartKilling()
		{
			if (Object.op_Implicit((Object)(object)PlayerManager.instance) && PlayerManager.instance.players.Count > 0 && PlayerManager.instance.players.Any((Player p) => !p.data.dead))
			{
				killRoutine = ((MonoBehaviour)Unbound.Instance).StartCoroutine(IKill());
			}
		}

		public static IEnumerator IKill()
		{
			List<Player> playersToKill = PlayerManager.instance.players.Where((Player p) => !p.data.dead).ToList();
			while (playersToKill.Count > 0)
			{
				float wait = Random.Range(15f, 60f);
				yield return (object)new WaitForSeconds(wait);
				int i = Random.Range(0, playersToKill.Count);
				Player p2 = playersToKill[i];
				playersToKill.RemoveAt(i);
				if (!p2.data.dead)
				{
					p2.data.view.RPC("RPCA_Die", (RpcTarget)0, new object[1] { Vector2.up });
				}
			}
		}
	}
	public static class TRTCardCategories
	{
		public static readonly CardCategory TRT_Traitor = CustomCardCategories.instance.CardCategory("TRT_Traitor");

		public static readonly CardCategory TRT_Detective = CustomCardCategories.instance.CardCategory("TRT_Detective");

		public static readonly CardCategory TRT_Zombie = CustomCardCategories.instance.CardCategory("TRT_Zombie");

		public static readonly CardCategory TRT_Slot_0 = CustomCardCategories.instance.CardCategory("TRT_Slot_0");

		public static readonly CardCategory TRT_Slot_1 = CustomCardCategories.instance.CardCategory("TRT_Slot_1");

		public static readonly CardCategory TRT_Slot_2 = CustomCardCategories.instance.CardCategory("TRT_Slot_2");

		public static readonly CardCategory TRT_Slot_3 = CustomCardCategories.instance.CardCategory("TRT_Slot_3");

		public static readonly CardCategory TRT_Slot_4 = CustomCardCategories.instance.CardCategory("TRT_Slot_4");

		public static readonly CardCategory TRT_Slot_5 = CustomCardCategories.instance.CardCategory("TRT_Slot_5");

		public static readonly CardCategory TRT_CanSpawnNaturally = CustomCardCategories.instance.CardCategory("TRT_CanSpawnNaturally");

		public static readonly CardCategory TRT_DoNotDropOnDeath = CustomCardCategories.instance.CardCategory("TRT_DoNotDropOnDeath");

		public static readonly CardCategory IgnoreMaxCardsCategory = CustomCardCategories.instance.CardCategory("CardItem_IgnoreMaxCards");

		public static readonly CardCategory CannotDiscard = CustomCardCategories.instance.CardCategory("CardItem_CannotDiscard");
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.willuwontu.rounds.cards", "Will's Wacky Cards", "1.11.26")]
	[BepInProcess("Rounds.exe")]
	public class WillsWackyCards : BaseUnityPlugin
	{
		public static class WaitFor
		{
			public static IEnumerator Frames(int frameCount)
			{
				if (frameCount <= 0)
				{
					throw new ArgumentOutOfRangeException("frameCount", "Cannot wait for less that 1 frame");
				}
				while (frameCount > 0)
				{
					frameCount--;
					yield return null;
				}
			}
		}

		public class CardRemover : MonoBehaviour
		{
			public void DelayedRemoveCard(Player player, string cardName, int frames = 10, bool silent = false)
			{
				((MonoBehaviour)this).StartCoroutine(RemoveCard(player, cardName, frames, silent));
			}

			private IEnumerator RemoveCard(Player player, string cardName, int frames = 10, bool silent = false)
			{
				yield return ((MonoBehaviour)this).StartCoroutine(WaitFor.Frames(frames));
				for (int i = player.data.currentCards.Count - 1; i >= 0; i--)
				{
					if (player.data.currentCards[i].cardName == cardName)
					{
						if (silent)
						{
							NetworkingManager.RPC(typeof(CardRemover), "SilentRemove", new object[2] { player.playerID, i });
						}
						else
						{
							Cards.instance.RemoveCardFromPlayer(player, i);
						}
						break;
					}
				}
			}

			[UnboundRPC]
			public static void SilentRemove(int playerId, int cardId)
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Expected O, but got Unknown
				Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == playerId);
				CardInfo val2 = val.data.currentCards[cardId];
				val.data.currentCards.RemoveAt(cardId);
				CardBar val3 = CardBarUtils.instance.PlayersCardBar(val);
				for (int num = ((Component)val3).transform.childCount - 1; num >= 0; num--)
				{
					if ((Object)(CardInfo)ExtensionMethods.GetFieldValue((object)((Component)((Component)val3).transform.GetChild(num)).gameObject.GetComponent<CardBarButton>(), "card") == (Object)(object)val2)
					{
						Object.Destroy((Object)(object)((Component)((Component)val3).transform.GetChild(num)).gameObject);
						break;
					}
				}
			}
		}

		private const string ModId = "com.willuwontu.rounds.cards";

		private const string ModName = "Will's Wacky Cards";

		public const string Version = "1.11.26";

		public const string ModInitials = "WWC";

		public const string CurseInitials = "Curse";

		public const string TestingInitials = "Testing";

		public static CardCategory TestCardCategory;

		public static CardRemover remover;

		public static bool battleStarted;

		private bool debug = false;

		public static WillsWackyCards instance { get; private set; }

		public AssetBundle WWCAssets { get; private set; }

		public CardThemeColorType PumpkinOrange => CardThemeLib.instance.CreateOrGetType("Pumpkin Orange", new CardThemeColor
		{
			bgColor = Color32.op_Implicit(new Color32((byte)229, (byte)127, (byte)0, (byte)200)),
			targetColor = Color32.op_Implicit(new Color32((byte)171, (byte)95, (byte)0, (byte)200))
		});

		public CardThemeColorType FieryOrange => CardThemeLib.instance.CreateOrGetType("Fiery Orange", new CardThemeColor
		{
			bgColor = Color32.op_Implicit(new Color32((byte)229, (byte)74, (byte)0, (byte)200)),
			targetColor = Color32.op_Implicit(new Color32((byte)171, (byte)37, (byte)0, (byte)200))
		});

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			instance = this;
			WWCAssets = AssetUtils.LoadAssetBundleFromResources("wwcstuff", typeof(WillsWackyCards).Assembly);
			Harmony val = new Harmony("com.willuwontu.rounds.cards");
			val.PatchAll();
			Unbound.RegisterCredits("Will's Wacky Cards", new string[1] { "willuwontu" }, new string[2] { "github", "Ko-Fi" }, new string[2] { "https://github.com/willuwontu/wills-wacky-cards", "https://ko-fi.com/willuwontu" });
			remover = ((Component)this).gameObject.AddComponent<CardRemover>();
			((Component)this).gameObject.AddComponent<InterfaceGameModeHooksManager>();
		}

		private void Start()
		{
			Mechanic.cardBase = WillsWackyManagers.instance.WWMAssets.LoadAsset<GameObject>("MechanicCardBase");
			GameObject val = WWCAssets.LoadAsset<GameObject>("WWC CardManager");
			CardBuilder[] componentsInChildren = val.GetComponentsInChildren<CardBuilder>();
			foreach (CardBuilder val2 in componentsInChildren)
			{
				val2.BuildCards();
			}
			NullManager.instance.RegesterOnAddCallback((Action<NullCardInfo, Player>)OnNullAdd);
			if (debug)
			{
				TestCardCategory = CustomCardCategories.instance.CardCategory("Testing Cards");
				CustomCard.BuildCard<RemoveAll>();
				CustomCard.BuildCard<RemoveTestingCards>();
				CustomCard.BuildCard<RemoveLast>();
				CustomCard.BuildCard<RemoveFirst>();
				CustomCard.BuildCard<DoRoundStart>();
				CustomCard.BuildCard<DoGameStart>();
				CustomCard.BuildCard<DoBattleStart>();
				CustomCard.BuildCard<DoPointStart>();
				CustomCard.BuildCard<DoPickStart>();
				CustomCard.BuildCard<DoPlayerPickStart>();
				CustomCard.BuildCard<DoRoundEnd>();
				CustomCard.BuildCard<DoGameEnd>();
				CustomCard.BuildCard<DoPointEnd>();
				CustomCard.BuildCard<DoPickEnd>();
				CustomCard.BuildCard<DoPlayerPickEnd>();
				CustomCard.BuildCard<DoInitStart>();
				CustomCard.BuildCard<DoInitEnd>();
				CustomCard.BuildCard<SimulateRoundStart>();
				CustomCard.BuildCard<SimulateRoundEnd>();
				CustomCard.BuildCard<SimulateRound>();
				CustomCard.BuildCard<SimulatePickPhase>();
			}
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)this, 0.4f, (Action)delegate
			{
				((MonoBehaviour)this).StartCoroutine(BuildMomentumCards());
			});
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)this, 0.4f, (Action)ChangeCards);
			GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)GameEnd);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
			GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)BattleStart);
			GameModeManager.AddHook("PlayerPickStart", (Func<IGameModeHandler, IEnumerator>)PlayerPickStart);
			GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)PlayerPickEnd);
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
			GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)PickStart);
			GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)PickEnd);
			GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)RoundStart);
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)RoundEnd);
			Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)OnlyUnstoppableOrImmovable);
		}

		private void OnNullAdd(NullCardInfo card, Player player)
		{
			Debug.Log((object)$"Null Added, {PlayerExtensions.GetNullCount(player, (Rarity)(-1))} null cards");
			CharacterStatModifiers stats = player.data.stats;
			WWCNullData nullData = stats.GetAdditionalData().nullData;
			int nullCount = PlayerExtensions.GetNullCount(player, (Rarity)(-1));
			if (nullData.damageRedCards > 0)
			{
				stats.GetAdditionalData().DamageReduction += 0.5f * Mathf.Log10((float)(nullData.damageRedCards * nullCount + 1)) - 0.5f * Mathf.Log10((float)(nullData.damageRedCards * (nullCount - 1) + 1));
			}
			stats.GetAdditionalData().poisonResistance *= nullData.poisonResMult;
			stats.GetAdditionalData().willpower *= nullData.willPowerMult;
			UpdateNullStatsForPlayer(player);
		}

		public static void UpdateNullStatsForPlayer(Player player)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_004b: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			WWCNullData nullData = player.data.stats.GetAdditionalData().nullData;
			int nullCount = PlayerExtensions.GetNullCount(player, (Rarity)(-1));
			List<CardInfoStat> list = new List<CardInfoStat>();
			if (nullData.damageRedCards > 0)
			{
				list.Add(new CardInfoStat
				{
					positive = true,
					stat = "Damage Reduction",
					amount = $"+{(int)((0.5f * Mathf.Log10((float)(nullData.damageRedCards * (nullCount + 1) + 1)) - 0.5f * Mathf.Log10((float)(nullData.damageRedCards * nullCount + 1))) * 100f)}%",
					simepleAmount = (SimpleAmount)0
				});
			}
			if (nullData.poisonResMult != 1f)
			{
				list.Add(new CardInfoStat
				{
					positive = true,
					stat = "Poison Resistance",
					amount = $"+{(int)((1f - nullData.poisonResMult) * 100f)}%",
					simepleAmount = (SimpleAmount)0
				});
			}
			if (nullData.willPowerMult != 1f)
			{
				list.Add(new CardInfoStat
				{
					positive = true,
					stat = "Willpower",
					amount = $"+{(int)((nullData.willPowerMult - 1f) * 100f)}%",
					simepleAmount = (SimpleAmount)0
				});
			}
			NullManager.instance.SetAdditionalNullStats(player, "WWC", list.ToArray());
		}

		private bool OnlyUnstoppableOrImmovable(Player player, CardInfo card)
		{
			if ((Object)(object)card != (Object)(object)ImmovableObject.card || (Object)(object)card != (Object)(object)UnstoppableForce.card)
			{
				return true;
			}
			if (((List<GameObject>)ExtensionMethods.GetFieldValue((object)CardChoice.instance, "spawnedCards")).Select((GameObject obj) => obj.GetComponent<CardInfo>()).Any((CardInfo c) => (Object)(object)c == (Object)(object)ImmovableObject.card || (Object)(object)c == (Object)(object)UnstoppableForce.card))
			{
				return false;
			}
			return true;
		}

		private void OnJoinedRoomAction()
		{
		}

		private void OnLeftRoomAction()
		{
		}

		public void DebugLog(object message)
		{
			if (debug)
			{
				Debug.Log(message);
			}
		}

		public static void SendDebugLog(object message, bool masterClientOnly = false)
		{
			if (masterClientOnly && !PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode)
			{
				NetworkingManager.RPC(typeof(WillsWackyCards), "URPCA_DebugLog", new object[1] { message });
			}
		}

		[UnboundRPC]
		public static void URPCA_DebugLog(object message)
		{
			instance.DebugLog(message);
		}

		public static void AddCardToPlayer(Player player, CardInfo card)
		{
			if (player != null && card != null)
			{
				string name = ((Object)((Component)card).gameObject).name;
				int playerID = player.playerID;
				NetworkingManager.RPC(typeof(WillsWackyCards), "URPCA_AddCardToPlayer", new object[2] { playerID, name });
			}
		}

		[UnboundRPC]
		public static void URPCA_AddCardToPlayer(int playerId, string cardName)
		{
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(playerId);
			CardInfo val = (from c in CardManager.cards.Values
				select c.cardInfo into c
				where ((Object)((Component)c).gameObject).name == cardName
				select c).First();
			if (Object.op_Implicit((Object)(object)val))
			{
				Cards.instance.AddCardToPlayer(playerWithID, val, false, "", 0f, 0f, true);
			}
		}

		public void TriggerGameModeHook(string key)
		{
			((MonoBehaviour)this).StartCoroutine(ITriggerGameModeHook(key));
		}

		private IEnumerator ITriggerGameModeHook(string key)
		{
			yield return GameModeManager.TriggerHook(key);
		}

		private IEnumerator BuildMomentumCards()
		{
			int stacks = 0;
			bool buildingCard = false;
			yield return ((MonoBehaviour)this).StartCoroutine(WaitFor.Frames(7));
			for (; stacks <= 21; stacks++)
			{
				MomentumTracker.stacks = stacks;
				buildingCard = true;
				CustomCard.BuildCard<BuildImmovableObject>((Action<CardInfo>)delegate(CardInfo cardInfo)
				{
					MomentumTracker.createdDefenseCards.Add(stacks, cardInfo);
					Cards.instance.AddHiddenCard(cardInfo);
					cardInfo.cardName = ImmovableObject.card.cardName;
				});
				CustomCard.BuildCard<BuildUnstoppableForce>((Action<CardInfo>)delegate(CardInfo cardInfo)
				{
					MomentumTracker.createdOffenseCards.Add(stacks, cardInfo);
					Cards.instance.AddHiddenCard(cardInfo);
					cardInfo.cardName = UnstoppableForce.card.cardName;
					buildingCard = false;
				});
				yield return (object)new WaitUntil((Func<bool>)(() => !buildingCard));
				yield return WaitFor.Frames(2);
			}
			yield return ((MonoBehaviour)this).StartCoroutine(WaitFor.Frames(7));
			MomentumTracker.stacks = 0;
		}

		private IEnumerator RoundStart(IGameModeHandler gm)
		{
			yield break;
		}

		private IEnumerator RoundEnd(IGameModeHandler gm)
		{
			yield break;
		}

		private IEnumerator PointStart(IGameModeHandler gm)
		{
			yield break;
		}

		private IEnumerator PointEnd(IGameModeHandler gm)
		{
			battleStarted = false;
			yield break;
		}

		private IEnumerator PlayerPickStart(IGameModeHandler gm)
		{
			RarityUtils.AjustCardRarityModifier(ImmovableObject.card, 0.25f, 0f);
			RarityUtils.AjustCardRarityModifier(UnstoppableForce.card, 0.25f, 0f);
			MomentumTracker.rarityBuff += 0.25f;
			yield break;
		}

		private IEnumerator PlayerPickEnd(IGameModeHandler gm)
		{
			MomentumTracker.offenseFlag = false;
			MomentumTracker.defenseFlag = false;
			yield break;
		}

		private IEnumerator PickStart(IGameModeHandler gm)
		{
			yield break;
		}

		private IEnumerator PickEnd(IGameModeHandler gm)
		{
			yield break;
		}

		private IEnumerator BattleStart(IGameModeHandler gm)
		{
			battleStarted = true;
			foreach (Player player in PlayerManager.instance.players)
			{
				Minigun_Mono minigun = ((Component)player).gameObject.GetComponent<Minigun_Mono>();
				if (Object.op_Implicit((Object)(object)minigun))
				{
					minigun.heat = 0f;
					minigun.overheated = false;
					player.data.weaponHandler.gun.GetAdditionalData().overHeated = false;
					GunAmmo gunAmmo = ((Component)player.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>();
					gunAmmo.ReloadAmmo(true);
				}
			}
			yield break;
		}

		private IEnumerator GameStart(IGameModeHandler gm)
		{
			MomentumTracker.stacks = 0;
			MomentumTracker.rarityBuff = 0f;
			MissedOpportunities.cardsSeen = new Dictionary<int, List<CardInfo>>();
			foreach (Player player in PlayerManager.instance.players)
			{
				if (!CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Contains(Minigun.componentCategory))
				{
					CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Add(Minigun.componentCategory);
				}
				if (!CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Contains(TestCardCategory))
				{
					CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Add(TestCardCategory);
				}
			}
			yield break;
		}

		private IEnumerator GameEnd(IGameModeHandler gm)
		{
			DestroyAll<Minigun_Mono>();
			DestroyAll<Vampirism_Mono>();
			DestroyAll<Gatling_Mono>();
			yield break;
		}

		private void DestroyAll<T>() where T : Object
		{
			T[] array = Object.FindObjectsOfType<T>();
			for (int num = array.Length - 1; num >= 0; num--)
			{
				Debug.Log((object)$"Attempting to Destroy {((object)array[num]).GetType().Name} number {num}");
				Object.Destroy((Object)(object)array[num]);
			}
		}

		private static void ChangeCards()
		{
			instance.DebugLog("[WWC] Modifying Cards");
			Card[] array = CardManager.cards.Values.ToArray();
			foreach (Card val in array)
			{
				switch (val.cardInfo.cardName.ToUpper())
				{
				case "FLAMETHROWER":
					instance.DebugLog("[WWC] Found Flamethrower");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int n = 0; n < val.cardInfo.categories.Length; n++)
						{
							list.Add(val.cardInfo.categories[n]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num = 0; num < val.cardInfo.blacklistedCategories.Length; num++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Flamethrower");
					break;
				case "FIRE HYDRANT":
					instance.DebugLog("[WWC] Found Fire Hydrant");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num18 = 0; num18 < val.cardInfo.categories.Length; num18++)
						{
							list.Add(val.cardInfo.categories[num18]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num19 = 0; num19 < val.cardInfo.blacklistedCategories.Length; num19++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num19]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Fire Hydrant");
					break;
				case "PONG":
					instance.DebugLog("[WWC] Found Pong");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num16 = 0; num16 < val.cardInfo.categories.Length; num16++)
						{
							list.Add(val.cardInfo.categories[num16]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num17 = 0; num17 < val.cardInfo.blacklistedCategories.Length; num17++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num17]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Pong");
					break;
				case "COMB":
					instance.DebugLog("[WWC] Found Comb");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int l = 0; l < val.cardInfo.categories.Length; l++)
						{
							list.Add(val.cardInfo.categories[l]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int m = 0; m < val.cardInfo.blacklistedCategories.Length; m++)
						{
							list.Add(val.cardInfo.blacklistedCategories[m]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Comb");
					break;
				case "STAR":
					instance.DebugLog("[WWC] Found Star");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num4 = 0; num4 < val.cardInfo.categories.Length; num4++)
						{
							list.Add(val.cardInfo.categories[num4]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("No Minigun"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num5 = 0; num5 < val.cardInfo.blacklistedCategories.Length; num5++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num5]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("No Minigun"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("No Minigun") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("No Minigun") };
					}
					instance.DebugLog("[WWC] Modified Star");
					break;
				case "HAWK":
					instance.DebugLog("[WWC] Found Hawk");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num14 = 0; num14 < val.cardInfo.categories.Length; num14++)
						{
							list.Add(val.cardInfo.categories[num14]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num15 = 0; num15 < val.cardInfo.blacklistedCategories.Length; num15++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num15]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Hawk");
					break;
				case "ROLLING THUNDER":
					instance.DebugLog("[WWC] Found Rolling Thunder");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num6 = 0; num6 < val.cardInfo.categories.Length; num6++)
						{
							list.Add(val.cardInfo.categories[num6]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num7 = 0; num7 < val.cardInfo.blacklistedCategories.Length; num7++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num7]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Rolling Thunder");
					break;
				case "LASER":
					instance.DebugLog("[WWC] Found Laser");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num8 = 0; num8 < val.cardInfo.categories.Length; num8++)
						{
							list.Add(val.cardInfo.categories[num8]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num9 = 0; num9 < val.cardInfo.blacklistedCategories.Length; num9++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num9]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Laserr");
					break;
				case "FRAGMENTATION":
					instance.DebugLog("[WWC] Found Fragmentation");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num10 = 0; num10 < val.cardInfo.categories.Length; num10++)
						{
							list.Add(val.cardInfo.categories[num10]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num11 = 0; num11 < val.cardInfo.blacklistedCategories.Length; num11++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num11]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Fragmentation");
					break;
				case "FIREWORKS":
					instance.DebugLog("[WWC] Found Fireworks");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num2 = 0; num2 < val.cardInfo.categories.Length; num2++)
						{
							list.Add(val.cardInfo.categories[num2]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num3 = 0; num3 < val.cardInfo.blacklistedCategories.Length; num3++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num3]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Fireworks");
					break;
				case "SPLITTING ROUNDS":
					instance.DebugLog("[WWC] Found Splitting Rounds");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int num12 = 0; num12 < val.cardInfo.categories.Length; num12++)
						{
							list.Add(val.cardInfo.categories[num12]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("No Minigun"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int num13 = 0; num13 < val.cardInfo.blacklistedCategories.Length; num13++)
						{
							list.Add(val.cardInfo.blacklistedCategories[num13]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("No Minigun"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("No Minigun") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("No Minigun") };
					}
					instance.DebugLog("[WWC] Modified Splitting Rounds");
					break;
				case "EMPOWER":
					instance.DebugLog("[WWC] Found Empower");
					if (val.cardInfo.categories != null)
					{
						List<CardCategory> list = new List<CardCategory>();
						for (int j = 0; j < val.cardInfo.categories.Length; j++)
						{
							list.Add(val.cardInfo.categories[j]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("GunType"));
						val.cardInfo.categories = list.ToArray();
						list = new List<CardCategory>();
						for (int k = 0; k < val.cardInfo.blacklistedCategories.Length; k++)
						{
							list.Add(val.cardInfo.blacklistedCategories[k]);
						}
						list.Add(CustomCardCategories.instance.CardCategory("WWC Gun Type"));
						val.cardInfo.blacklistedCategories = list.ToArray();
					}
					else
					{
						val.cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("GunType") };
						val.cardInfo.blacklistedCategories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("WWC Gun Type") };
					}
					instance.DebugLog("[WWC] Modified Empower");
					break;
				}
			}
			instance.DebugLog("[WWC] Cards Modified");
		}
	}
}
namespace WWC.UnityTools
{
	[Serializable]
	public class CardCardList
	{
		[AssetsOnly]
		[ShowInInspector]
		[SerializeField]
		public GameObject card;

		[AssetsOnly]
		[ShowInInspector]
		[SerializeField]
		public GameObject[] cards;
	}
	[Serializable]
	public class CardReq
	{
		[AssetsOnly]
		[ShowInInspector]
		[SerializeField]
		public GameObject[] cards;
	}
	[Serializable]
	public class ClassCardBuilder : CardBuilder
	{
		[SerializeField]
		public string className;

		[NonSerialized]
		[AssetsOnly]
		[ShowInInspector]
		[SerializeField]
		[OdinSerialize]
		[Searchable]
		public ClassCardRegistrationInfo[] cardsToRegister = new ClassCardRegistrationInfo[0];

		[NonSerialized]
		[AssetsOnly]
		[ShowInInspector]
		[OdinSerialize]
		[Searchable]
		public CardCardList[] blackList = new CardCardList[0];

		[NonSerialized]
		[AssetsOnly]
		[ShowInInspector]
		[OdinSerialize]
		[Searchable]
		public CardCardList[] whiteList = new CardCardList[0];

		public override void BuildCards()
		{
			//IL_007d: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < cardsToRegister.Length; i++)
			{
				CustomClassCard component = cardsToRegister[i].card.GetComponent<CustomClassCard>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				component.BuildUnityClassCard((Action<CardInfo>)((CardBuilder)this).StandardCallback);
				CardInfo component2 = ((Component)component).GetComponent<CardInfo>();
				switch (cardsToRegister[i].requirementType)
				{
				case RequirementsType.None:
					ClassesRegistry.Register(component2, cardsToRegister[i].cardType, cardsToRegister[i].maxAllowed);
					break;
				case RequirementsType.Single:
					ClassesRegistry.Register(component2, cardsToRegister[i].cardType, cardsToRegister[i].singleReq.GetComponent<CardInfo>(), cardsToRegister[i].maxAllowed);
					break;
				case RequirementsType.List:
					ClassesRegistry.Register(component2, cardsToRegister[i].cardType, cardsToRegister[i].listReq.Select((GameObject c) => c.GetComponent<CardInfo>()).ToArray(), cardsToRegister[i].maxAllowed);
					break;
				case RequirementsType.MultiList:
					ClassesRegistry.Register(component2, cardsToRegister[i].cardType, cardsToRegister[i].multilistReq.Select((CardReq con) => con.cards.Select((GameObject c) => c.GetComponent<CardInfo>()).ToArray()).ToArray(), cardsToRegister[i].maxAllowed);
					break;
				}
			}
			for (int j = 0; j < blackList.Length; j++)
			{
				CardInfo component3 = blackList[j].card.GetComponent<CardInfo>();
				for (int k = 0; k < blackList[j].cards.Length; k++)
				{
					CardInfo component4 = blackList[j].cards[k].GetComponent<CardInfo>();
					if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component4))
					{
						ClassesRegistry.Get(component3).Blacklist(component4);
					}
				}
			}
			for (int l = 0; l < whiteList.Length; l++)
			{
				CardInfo component5 = whiteList[l].card.GetComponent<CardInfo>();
				for (int m = 0; m < whiteList[l].cards.Length; m++)
				{
					CardInfo component6 = whiteList[l].cards[m].GetComponent<CardInfo>();
					if (Object.op_Implicit((Object)(object)component5) && Object.op_Implicit((Object)(object)component6))
					{
						ClassesRegistry.Get(component5).Whitelist(component6);
					}
				}
			}
		}
	}
	[Serializable]
	public class ClassCardRegistrationInfo
	{
		[AssetsOnly]
		[ShowInInspector]
		[SerializeField]
		public GameObject card;

		[EnumToggleButtons]
		[ShowInInspector]
		[SerializeField]
		public CardType cardType = (CardType)16;

		public int maxAllowed = 0;

		[EnumToggleButtons]
		[ShowInInspector]
		public RequirementsType requirementType = RequirementsType.Single;

		[AssetsOnly]
		[ShowIf("requirementType", RequirementsType.Single, true)]
		public GameObject singleReq;

		[AssetsOnly]
		[ShowIf("requirementType", RequirementsType.List, true)]
		public GameObject[] listReq;

		[AssetsOnly]
		[ShowIf("requirementType", RequirementsType.MultiList, true)]
		public CardReq[] multilistReq;
	}
	[Serializable]
	public enum RequirementsType
	{
		None,
		Single,
		List,
		MultiList
	}
}
namespace WWC.UI
{
	internal static class PlayerSpotlight
	{
		internal static float SpotlightSizeMult = 1f;

		private static bool fadeInProgress = false;

		private static Coroutine FadeCoroutine;

		private const int layer = 30;

		private const float MaxShadowOpacity = 1f;

		public const float DefaultFadeInTime = 0.5f;

		public const float DefaultFadeInDelay = 0f;

		public const float DefaultFadeOutTime = 1f;

		public const float DefaultFadeOutDelay = 0f;

		private static GameObject _Cam = null;

		private static GameObject _Group = null;

		private static GameObject _BG = null;

		private static GameObject _Spot = null;

		public static bool FadeInProgress => fadeInProgress;

		public static GameObject Cam
		{
			get
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				if ((Object)(object)_Cam != (Object)null)
				{
					return _Cam;
				}
				_Cam = new GameObject("SpotlightCam", new Type[1] { typeof(Camera) });
				_Cam.transform.SetParent(GameObject.Find("/Game/Visual/Rendering ").transform);
				_Cam.GetComponent<Camera>().CopyFrom(MainCam.instance.cam);
				_Cam.GetComponent<Camera>().depth = 4f;
				_Cam.GetComponent<Camera>().cullingMask = 1073741824;
				ExtensionMethods.InvokeMethod((object)GameObject.Find("/Game/Visual/Rendering ").gameObject.GetComponent<CameraZoomHandler>(), "Start", Array.Empty<object>());
				return _Cam;
			}
		}

		public static GameObject Group
		{
			get
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_Group != (Object)null)
				{
					return _Group;
				}
				_Group = new GameObject("SpotlightGroup", new Type[1] { typeof(SortingGroup) });
				_Group.SetActive(true);
				_Group.transform.localScale = Vector3.one;
				_Group.GetComponent<SortingGroup>().sortingOrder = 10;
				_Group.layer = 30;
				return _Group;
			}
		}

		public static GameObject BG
		{
			get
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_0073: 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_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Expected O, but got Unknown
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_BG != (Object)null)
				{
					return _BG;
				}
				_BG = new GameObject("SpotlightShadow", new Type[1] { typeof(SpriteRenderer) });
				_BG.transform.SetParent(_Group.transform);
				_BG.SetActive(false);
				_BG.transform.localScale = 100f * Vector3.one;
				_BG.GetComponent<SpriteRenderer>().sprite = Sprite.Create(new Texture2D(1920, 1080), new Rect(0f, 0f, 1920f, 1080f), new Vector2(0.5f, 0.5f));
				_BG.GetComponent<SpriteRenderer>().color = Color.black;
				((Renderer)_BG.GetComponent<SpriteRenderer>()).sortingOrder = 0;
				_BG.GetComponent<SpriteRenderer>().maskInteraction = (SpriteMaskInteraction)2;
				_BG.layer = 30;
				return _BG;
			}
		}

		public static GameObject Spot
		{
			get
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Expected O, but got Unknown
				if ((Object)(object)_Spot != (Object)null)
				{
					return _Spot;
				}
				GameObject val = GameObject.Find("Game/UI/UI_MainMenu/Canvas/ListSelector/CharacterSelect");
				GameObject gameObject = ((Component)val.GetComponentInChildren<CharacterCreatorPortrait>(true)).gameObject;
				GameObject gameObject2 = ((Component)gameObject.transform.GetChild(2).GetChild(0)).gameObject;
				_Spot = new GameObject("Spotlight", new Type[1] { typeof(SpriteMask) });
				Object.DontDestroyOnLoad((Object)(object)_Spot);
				ExtensionMethods.GetOrAddComponent<SpriteMask>(_Spot, false).sprite = gameObject2.GetComponent<SpriteRenderer>().sprite;
				((Renderer)ExtensionMethods.GetOrAddComponent<SpriteMask>(_Spot, false)).sortingOrder = 1;
				_Spot.layer = 30;
				_Spot.SetActive(false);
				return _Spot;
			}
		}

		private static float GetShadowOpacity()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return BG.GetComponent<SpriteRenderer>().color.a;
		}

		private static void SetShadowOpacity(float a)
		{
			//IL_000b: 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_001b: 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_0027: 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)
			Color color = BG.GetComponent<SpriteRenderer>().color;
			BG.GetComponent<SpriteRenderer>().color = new Color(color.r, color.g, color.b, a);
		}

		public static void FadeIn(float time = 0.5f, float delay = 0f)
		{
			CancelFade();
			BG.SetActive(true);
			FadeCoroutine = ((MonoBehaviour)WillsWackyCards.instance).StartCoroutine(FadeToCoroutine(1f, time, delay));
		}

		public static void FadeOut(float time = 1f, float delay = 0f)
		{
			CancelFade();
			FadeCoroutine = ((MonoBehaviour)WillsWackyCards.instance).StartCoroutine(FadeToCoroutine(0f, time, delay, disableWhenComplete: true));
		}

		private static IEnumerator FadeToCoroutine(float a, float time, float delay = 0f, bool disableWhenComplete = false)
		{
			if (!(time <= 0f) && !fadeInProgress)
			{
				fadeInProgress = true;
				if (delay > 0f)
				{
					yield return (object)new WaitForSecondsRealtime(delay);
				}
				float a2 = GetShadowOpacity();
				float totalTime = time;
				while (time > 0f)
				{
					SetShadowOpacity(Mathf.Lerp(a, a2, time / totalTime));
					time -= Time.deltaTime;
					yield return null;
				}
				SetShadowOpacity(a);
				if (disableWhenComplete)
				{
					BG.SetActive(false);
				}
				fadeInProgress = false;
			}
		}

		public static void AddSpotToPlayer(Player player)
		{
			//IL_003f: 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)
			GameObject cam = Cam;
			GameObject group = Group;
			GameObject val = Object.Instantiate<GameObject>(Spot, group.transform);
			ExtensionMethods.GetOrAddComponent<FollowPlayer>(val, false).SetPlayer(player);
			val.SetActive(true);
			val.transform.localScale = 25f * Vector3.one;
		}

		public static IEnumerator FadeInHook(float time = 0.5f, float delay = 0f)
		{
			FadeIn(time, delay);
			yield break;
		}

		public static IEnumerator FadeOutHook(float time = 1f, float delay = 0f)
		{
			FadeOut(time, delay);
			yield break;
		}

		public static IEnumerator BattleStartFailsafe()
		{
			CancelFade(disable_shadow: true);
			yield break;
		}

		public static void CancelFade(bool disable_shadow = false)
		{
			if (FadeCoroutine != null)
			{
				((MonoBehaviour)WillsWackyCards.instance).StopCoroutine(FadeCoroutine);
			}
			fadeInProgress = false;
			if (disable_shadow)
			{
				SetShadowOpacity(0f);
				BG.SetActive(false);
			}
		}

		public static IEnumerator CancelFadeHook(bool disable_shadow = false)
		{
			CancelFade(disable_shadow);
			yield break;
		}
	}
	public class FollowPlayer : MonoBehaviour
	{
		public Player player { get; private set; }

		public void SetPlayer(Player player)
		{
			this.player = player;
		}

		private void Start()
		{
			if ((Object)(object)player == (Object)null)
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void Update()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				Object.Destroy((Object)(object)this);
			}
			((Renderer)((Component)this).GetComponent<SpriteMask>()).enabled = !player.data.dead;
			((Component)this).transform.position = ((Component)player).gameObject.transform.position;
			((Component)this).transform.localScale = ((Component)player).transform.localScale.x / 1.25f * PlayerSpotlight.SpotlightSizeMult * Vector3.one;
		}
	}
}
namespace WWC.Interfaces
{
	public class InterfaceGameModeHooksManager : MonoBehaviour
	{
		private List<IGameStartHookHandler> gameStartHooks = new List<IGameStartHookHandler>();

		private List<IGameEndHookHandler> gameEndHooks = new List<IGameEndHookHandler>();

		private List<IPlayerPickEndHookHandler> playerPickEndHooks = new List<IPlayerPickEndHookHandler>();

		private List<IPlayerPickStartHookHandler> playerPickStartHooks = new List<IPlayerPickStartHookHandler>();

		private List<IPickStartHookHandler> pickStartHooks = new List<IPickStartHookHandler>();

		private List<IPickEndHookHandler> pickEndHooks = new List<IPickEndHookHandler>();

		private List<IPointStartHookHandler> pointStartHooks = new List<IPointStartHookHandler>();

		private List<IPointEndHookHandler> pointEndHooks = new List<IPointEndHookHandler>();

		private List<IRoundStartHookHandler> roundStartHooks = new List<IRoundStartHookHandler>();

		private List<IRoundEndHookHandler> roundEndHooks = new List<IRoundEndHookHandler>();

		private List<IBattleStartHookHandler> battleStartHooks = new List<IBattleStartHookHandler>();

		public static InterfaceGameModeHooksManager instance { get; private set; }

		private void Start()
		{
			if ((Object)(object)instance != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)this);
				return;
			}
			instance = this;
			GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)GameEnd);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
			GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)BattleStart);
			GameModeManager.AddHook("PlayerPickStart", (Func<IGameModeHandler, IEnumerator>)PlayerPickStart);
			GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)PlayerPickEnd);
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
			GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)PickStart);
			GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)PickEnd);
			GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)RoundStart);
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)RoundEnd);
		}

		public void RegisterHooks(object obj)
		{
			if (obj is IGameEndHookHandler item)
			{
				gameEndHooks.Add(item);
			}
			if (obj is IGameStartHookHandler item2)
			{
				gameStartHooks.Add(item2);
			}
			if (obj is IRoundEndHookHandler item3)
			{
				roundEndHooks.Add(item3);
			}
			if (obj is IRoundStartHookHandler item4)
			{
				roundStartHooks.Add(item4);
			}
			if (obj is IPointStartHookHandler item5)
			{
				pointStartHooks.Add(item5);
			}
			if (obj is IPointEndHookHandler item6)
			{
				pointEndHooks.Add(item6);
			}
			if (obj is IBattleStartHookHandler item7)
			{
				battleStartHooks.Add(item7);
			}
			if (obj is IPickStartHookHandler item8)
			{
				pickStartHooks.Add(item8);
			}
			if (obj is IPickEndHookHandler item9)
			{
				pickEndHooks.Add(item9);
			}
			if (obj is IPlayerPickStartHookHandler item10)
			{
				playerPickStartHooks.Add(item10);
			}
			if (obj is IPlayerPickEndHookHandler item11)
			{
				playerPickEndHooks.Add(item11);
			}
		}

		public void RemoveHooks(object obj)
		{
			if (obj is IGameEndHookHandler item)
			{
				gameEndHooks.Remove(item);
			}
			if (obj is IGameStartHookHandler item2)
			{
				gameStartHooks.Remove(item2);
			}
			if (obj is IRoundEndHookHandler item3)
			{
				roundEndHooks.Remove(item3);
			}
			if (obj is IRoundStartHookHandler item4)
			{
				roundStartHooks.Remove(item4);
			}
			if (obj is IPointStartHookHandler item5)
			{
				pointStartHooks.Remove(item5);
			}
			if (obj is IPointEndHookHandler item6)
			{
				pointEndHooks.Remove(item6);
			}
			if (obj is IBattleStartHookHandler item7)
			{
				battleStartHooks.Remove(item7);
			}
			if (obj is IPickStartHookHandler item8)
			{
				pickStartHooks.Remove(item8);
			}
			if (obj is IPickEndHookHandler item9)
			{
				pickEndHooks.Remove(item9);
			}
			if (obj is IPlayerPickStartHookHandler item10)
			{
				playerPickStartHooks.Remove(item10);
			}
			if (obj is IPlayerPickEndHookHandler item11)
			{
				playerPickEndHooks.Remove(item11);
			}
		}

		private IEnumerator GameStart(IGameModeHandler gm)
		{
			foreach (IGameStartHookHandler hook in gameStartHooks)
			{
				try
				{
					hook.OnGameStart();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator GameEnd(IGameModeHandler gm)
		{
			foreach (IGameEndHookHandler hook in gameEndHooks)
			{
				try
				{
					hook.OnGameEnd();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator RoundStart(IGameModeHandler gm)
		{
			foreach (IRoundStartHookHandler hook in roundStartHooks)
			{
				try
				{
					hook.OnRoundStart();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator RoundEnd(IGameModeHandler gm)
		{
			foreach (IRoundEndHookHandler hook in roundEndHooks)
			{
				try
				{
					hook.OnRoundEnd();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator PointStart(IGameModeHandler gm)
		{
			foreach (IPointStartHookHandler hook in pointStartHooks)
			{
				try
				{
					hook.OnPointStart();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator PointEnd(IGameModeHandler gm)
		{
			foreach (IPointEndHookHandler hook in pointEndHooks)
			{
				try
				{
					hook.OnPointEnd();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator BattleStart(IGameModeHandler gm)
		{
			foreach (IBattleStartHookHandler hook in battleStartHooks)
			{
				try
				{
					hook.OnBattleStart();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator PickStart(IGameModeHandler gm)
		{
			foreach (IPickStartHookHandler hook in pickStartHooks)
			{
				try
				{
					hook.OnPickStart();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator PickEnd(IGameModeHandler gm)
		{
			foreach (IPickEndHookHandler hook in pickEndHooks)
			{
				try
				{
					hook.OnPickEnd();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator PlayerPickStart(IGameModeHandler gm)
		{
			foreach (IPlayerPickStartHookHandler hook in playerPickStartHooks)
			{
				try
				{
					hook.OnPlayerPickStart();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}

		private IEnumerator PlayerPickEnd(IGameModeHandler gm)
		{
			foreach (IPlayerPickEndHookHandler hook in playerPickEndHooks)
			{
				try
				{
					hook.OnPlayerPickEnd();
				}
				catch (Exception e)
				{
					Debug.LogException(e);
				}
			}
			yield break;
		}
	}
	public interface IGameStartHookHandler
	{
		void OnGameStart();
	}
	public interface IGameEndHookHandler
	{
		void OnGameEnd();
	}
	public interface IPlayerPickStartHookHandler
	{
		void OnPlayerPickStart();
	}
	public interface IPlayerPickEndHookHandler
	{
		void OnPlayerPickEnd();
	}
	public interface IPointEndHookHandler
	{
		void OnPointEnd();
	}
	public interface IPointStartHookHandler
	{
		void OnPointStart();
	}
	public interface IRoundEndHookHandler
	{
		void OnRoundEnd();
	}
	public interface IRoundStartHookHandler
	{
		void OnRoundStart();
	}
	public interface IPickStartHookHandler
	{
		void OnPickStart();
	}
	public interface IPickEndHookHandler
	{
		void OnPickEnd();
	}
	public interface IBattleStartHookHandler
	{
		void OnBattleStart();
	}
}
namespace WWC.Extensions
{
	public static class BlockExtension
	{
		public static void UpdateParticleDuration(this Block block)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			float simulationSpeed = 1f / ((0.3f + ((Component)block).GetComponent<CharacterStatModifiers>().GetAdditionalData().extraBlockTime) / 0.3f);
			MainModule main = block.particle.main;
			((MainModule)(ref main)).simulationSpeed = simulationSpeed;
		}

		public static float BlocksPerSecond(this Block block)
		{
			int num = Mathf.Max(1, block.additionalBlocks + 1);
			return (float)num / block.Cooldown();
		}
	}
	[Serializable]
	public class CharacterStatModifiersAdditionalData
	{
		public bool Vampire;

		public float MassModifier;

		public float Bleed;

		public float DamageReduction;

		public bool isBanished;

		public float willpower;

		public float extraBlockTime;

		public bool useNewRespawnTime;

		public float newRespawnTime;

		public float poisonResistance;

		public float poisonDurationModifier;

		public float poisonBurstModifier;

		public float dealtDoTBurstModifier;

		public WWCNullData nullData;

		public CharacterStatModifiersAdditionalData()
		{
			Vampire = false;
			MassModifier = 1f;
			Bleed = 0f;
			DamageReduction = 0f;
			isBanished = false;
			willpower = 1f;
			extraBlockTime = 0f;
			useNewRespawnTime = false;
			newRespawnTime = 0f;
			poisonResistance = 1f;
			poisonBurstModifier = 1f;
			dealtDoTBurstModifier = 1f;
			poisonDurationModifier = 1f;
			nullData = new WWCNullData();
		}
	}
	public static class CharacterStatModifiersExtension
	{
		public static readonly ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersAdditionalData> data = new ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersAdditionalData>();

		public static CharacterStatModifiersAdditionalData GetAdditionalData(this CharacterStatModifiers statModifiers)
		{
			return data.GetOrCreateValue(statModifiers);
		}

		public static void AddData(this CharacterStatModifiers statModifiers, CharacterStatModifiersAdditionalData value)
		{
			try
			{
				data.Add(statModifiers, value);
			}
			catch (Exception)
			{
			}
		}
	}
	public class WWCNullData
	{
		public float willPowerMult = 1f;

		public float poisonResMult = 1f;

		public int damageRedCards = 0;
	}
	[HarmonyPatch(typeof(CharacterStatModifiers), "ResetStats")]
	internal class CharacterStatModifiersPatchResetStats
	{
		private static void Prefix(CharacterStatModifiers __instance)
		{
			__instance.GetAdditionalData().Vampire = false;
			__instance.GetAdditionalData().MassModifier = 1f;
			__instance.GetAdditionalData().Bleed = 0f;
			__instance.GetAdditionalData().DamageReduction = 0f;
			__instance.GetAdditionalData().isBanished = false;
			__instance.GetAdditionalData().willpower = 1f;
			__instance.GetAdditionalData().extraBlockTime = 0f;
			__instance.GetAdditionalData().useNewRespawnTime = false;
			__instance.GetAdditionalData().newRespawnTime = 0f;
			__instance.GetAdditionalData().poisonResistance = 1f;
			__instance.GetAdditionalData().poisonBurstModifier = 1f;
			__instance.GetAdditionalData().dealtDoTBurstModifier = 1f;
			__instance.GetAdditionalData().poisonDurationModifier = 1f;
			__instance.GetAdditionalData().nullData = new WWCNullData();
		}
	}
	[Serializable]
	public class GunAdditionalData
	{
		public bool useForcedAttackSpeed;

		public float forcedReloadSpeed;

		public bool useForcedReloadSpeed;

		public bool useAttacksPerAttack;

		public int attacksPerAttack;

		public bool shotgun;

		public float minimumAttackSpeed;

		public float minimumReloadSpeed;

		public float speedDamageMultiplier;

		public bool overHeated;

		public Minigun_Mono minigun;

		public bool useMinimumReloadSpeed;

		public bool useMinimumAttackSpeed;

		public float frequency;

		public float amplitude;

		public GunAdditionalData()
		{
			useForcedAttackSpeed = false;
			forcedReloadSpeed = 0f;
			useForcedReloadSpeed = false;
			attacksPerAttack = 1;
			useAttacksPerAttack = false;
			shotgun = false;
			speedDamageMultiplier = 1f;
			overHeated = false;
			minigun = null;
			useMinimumAttackSpeed = false;
			useMinimumReloadSpeed = false;
			minimumAttackSpeed = 1f;
			minimumReloadSpeed = 1f;
			frequency = 0.5f;
			amplitude = 0.5f;
		}
	}
	public static class GunExtension
	{
		public static readonly ConditionalWeakTable<Gun, GunAdditionalData> data = new ConditionalWeakTable<Gun, GunAdditionalData>();

		public static GunAdditionalData GetAdditionalData(this Gun gun)
		{
			return data.GetOrCreateValue(gun);
		}

		public static void AddData(this Gun gun, GunAdditionalData value)
		{
			try
			{
				data.Add(gun, value);
			}
			catch (Exception)
			{
			}
		}

		public static float BulletsPerSecond(this Gun gun, GunAmmo gunAmmo = null)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			int numberOfProjectiles = gun.numberOfProjectiles;
			int num = ((gun.bursts <= 0) ? 1 : gun.bursts);
			int num2 = numberOfProjectiles * num;
			float num3 = (float)(num - 1) * gun.timeBetweenBullets;
			float num4 = 0f;
			GunAmmo val = (GunAmmo)(((Object)(object)gunAmmo != (Object)null) ? ((object)gunAmmo) : ((object)(GunAmmo)Traverse.Create((object)gun).Field("gunAmmo").GetValue()));
			if ((Object)(object)val != (Object)null)
			{
				num4 = (val.reloadTime + val.reloadTimeAdd) * val.reloadTimeMultiplier;
			}
			float num5 = (float)num2 / Time.deltaTime;
			if (gun.attackSpeed == 0f && num4 == 0f && gun.timeBetweenBullets == 0f)
			{
				return num5;
			}
			return (!(gun.timeBetweenBullets > num4) && !(gun.attackSpeed > num4)) ? Mathf.Min((float)num2 / (num3 + gun.attackSpeed + num4), num5) : Mathf.Min((float)num2 / (num3 + gun.attackSpeed), num5);
		}
	}
	[HarmonyPatch(typeof(Gun), "ResetStats")]
	internal class GunPatchResetStats
	{
		private static void Prefix(Gun __instance)
		{
			__instance.GetAdditionalData().useForcedAttackSpeed = false;
			__instance.GetAdditionalData().useForcedReloadSpeed = false;
			__instance.GetAdditionalData().forcedReloadSpeed = 0f;
			__instance.GetAdditionalData().useAttacksPerAttack = false;
			__instance.GetAdditionalData().attacksPerAttack = 1;
			__instance.GetAdditionalData().shotgun = false;
			__instance.GetAdditionalData().speedDamageMultiplier = 1f;
			__instance.GetAdditionalData().overHeated = false;
			__instance.GetAdditionalData().minigun = null;
			__instance.GetAdditionalData().useMinimumReloadSpeed = false;
			__instance.GetAdditionalData().useMinimumAttackSpeed = false;
			__instance.GetAdditionalData().minimumAttackSpeed = 1f;
			__instance.GetAdditionalData().minimumReloadSpeed = 1f;
			__instance.GetAdditionalData().frequency = 0.5f;
			__instance.GetAdditionalData().amplitude = 0.5f;
		}
	}
	public static class FindInterfaces
	{
		public static List<T> Find<T>()
		{
			//IL_000d: 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)
			List<T> list = new List<T>();
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
				GameObject[] array = rootGameObjects;
				foreach (GameObject val in array)
				{
					T[] componentsInChildren = val.GetComponentsInChildren<T>();
					list.AddRange(componentsInChildren);
				}
			}
			return list;
		}
	}
	public static class LineEffectExtension
	{
		public static float GetRadius(this LineEffect lineEffect)
		{
			return (float)typeof(LineEffect).InvokeMember("GetRadius", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, lineEffect, new object[0]);
		}
	}
	public static class PlayerManagerExtension
	{
		public static Player GetRandomEnemy(this PlayerManager playerManager, Player player)
		{
			if (playerManager.players.Count == 1)
			{
				return null;
			}
			List<Player> list = new List<Player>(playerManager.players);
			Player[] playersInTeam = playerManager.GetPlayersInTeam(player.teamID);
			foreach (Player item in playersInTeam)
			{
				list.Remove(item);
			}
			return list[Random.Range(0, list.Count)];
		}

		public static Player GetPlayerWithID(this PlayerManager playerManager, int playerID)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			return (Player)typeof(PlayerManager).InvokeMember("GetPlayerWithID", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, playerManager, new object[1] { playerID });
		}
	}
	public static class PlayerVelocityExtension
	{
		public static void AddForce(this PlayerVelocity playerVelocity, Vector2 force, ForceMode2D forceMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_001b: 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_000a: 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_0015: 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_003f: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			force = (((int)forceMode != 0) ? (force * 1f) : (force * 0.02f));
			ExtensionMethods.SetFieldValue((object)playerVelocity, "velocity", (object)((Vector2)ExtensionMethods.GetFieldValue((object)playerVelocity, "velocity") + force / (float)ExtensionMethods.GetFieldValue((object)playerVelocity, "mass")));
		}
	}
}
namespace WWC.Patches
{
	[HarmonyPatch(typeof(DynamicParticles))]
	internal class DynamicParticles_Patch
	{
		[HarmonyPrefix]
		[HarmonyPriority(800)]
		[HarmonyPatch("PlayBulletHit")]
		private static bool NoSurfaceHitEffect(DynamicParticles __instance, float damage, Transform spawnerTransform, HitInfo hit, Color projectielColor, ref int ___spawnsThisFrame, out int __state)
		{
			__state = ___spawnsThisFrame;
			ShadowMovement_BulletMono component = ((Component)spawnerTransform).gameObject.GetComponent<ShadowMovement_BulletMono>();
			if (Object.op_Implicit((Object)(object)component))
			{
				___spawnsThisFrame = 100;
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPriority(800)]
		[HarmonyPatch("PlayBulletHit")]
		private static void NoSurfaceHitEffectTwo(DynamicParticles __instance, float damage, Transform spawnerTransform, HitInfo hit, Color projectielColor, ref int ___spawnsThisFrame, int __state)
		{
			___spawnsThisFrame = __state;
		}
	}
	[HarmonyPatch(typeof(Block))]
	internal class RunicWardsBlock_Patch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void RunicWardsRecoverSpeed(Block __instance)
		{
			if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<RunicWardsSpeedRecovery_Mono>()))
			{
				__instance.sinceBlock += TimeHandler.deltaTime;
				__instance.counter += TimeHandler.deltaTime;
			}
		}
	}
	[HarmonyPatch(typeof(ProjectileHit))]
	internal class ProjectileHitPatchRPCA_DoHit
	{
		[HarmonyPatch("RPCA_DoHit")]
		[HarmonyPriority(0)]
		[HarmonyPrefix]
		private static void RunicWardAutoBlock(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, Vector2 vel, int viewID, int colliderID, ref bool wasBlocked)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0008: 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_000f: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			HitInfo val = new HitInfo();
			val.point = hitPoint;
			val.normal = hitNormal;
			val.collider = null;
			if (viewID != -1)
			{
				PhotonView photonView = PhotonNetwork.GetPhotonView(viewID);
				val.collider = ((Component)photonView).GetComponentInChildren<Collider2D>();
				val.transform = ((Component)photonView).transform;
			}
			else if (colliderID != -1)
			{
				val.collider = ((Component)MapManager.instance.currentMap.Map).GetComponentsInChildren<Collider2D>()[colliderID];
				val.transform = ((Component)val.collider).transform;
			}
			HealthHandler val2 = null;
			if (Object.op_Implicit((Object)(object)val.transform))
			{
				val2 = ((Component)val.transform).GetComponent<HealthHandler>();
			}
			if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)((Component)val2).GetComponent<CharacterData>()) || !Object.op_Implicit((Object)(object)((Component)val2).GetComponent<Block>()))
			{
				return;
			}
			RunicWardsBlock_Mono component = ((Component)val2).GetComponent<RunicWardsBlock_Mono>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Block component2 = ((Component)val2).GetComponent<Block>();
			CharacterData component3 = ((Component)val2).GetComponent<CharacterData>();
			if (component.shields > 0 && component2.counter >= component2.Cooldown() && !component2.IsBlocking() && !component3.isSilenced && !component3.isStunned)
			{
				wasBlocked = true;
				component.shields--;
				((Component)component3).gameObject.AddComponent<RunicWardsSpeedRecovery_Mono>();
				if (component3.view.IsMine)
				{
					component2.CallDoBlock(true, false, (BlockTriggerType)0, default(Vector3), false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ApplyCardStats), "ApplyStats")]
	internal class ApplyCardStats_Patch
	{
		private static void Prefix(Player ___playerToUpgrade, Gun ___myGunStats, CharacterStatModifiers ___myPlayerStats)
		{
			if (___playerToUpgrade.data.currentCards.Contains(Gluttony.card))
			{
				if (___playerToUpgrade.data.stats.lifeSteal > 0f)
				{
					___playerToUpgrade.data.stats.lifeSteal = 0f - Mathf.Abs(___playerToUpgrade.data.stats.lifeSteal);
				}
				CharacterStatModifiers stats = ___playerToUpgrade.data.stats;
				stats.lifeSteal -= 2f * Mathf.Abs(___myPlayerStats.lifeSteal);
			}
			Gun component = ((Component)((Component)___playerToUpgrade).GetComponent<Holding>().holdable).GetComponent<Gun>();
			CharacterStatModifiers component2 = ((Component)___playerToUpgrade).GetComponent<CharacterStatModifiers>();
			if (Object.op_Implicit((Object)(object)___myGunStats))
			{
				if (___myGunStats.GetAdditionalData().useMinimumReloadSpeed)
				{
					component.GetAdditionalData().useMinimumReloadSpeed = ___myGunStats.GetAdditionalData().useMinimumReloadSpeed;
					component.GetAdditionalData().minimumReloadSpeed = ___myGunStats.GetAdditionalData().minimumReloadSpeed;
				}
				if (___myGunStats.GetAdditionalData().useForcedAttackSpeed)
				{
					component.GetAdditionalData().useForcedAttackSpeed = ___myGunStats.GetAdditionalData().useForcedAttackSpeed;
					component.defaultCooldown = ___myGunStats.forceSpecificAttackSpeed;
				}
				if (___myGunStats.GetAdditionalData().useForcedReloadSpeed)
				{
					component.GetAdditionalData().useForcedReloadSpeed = ___myGunStats.GetAdditionalData().useForcedReloadSpeed;
					component.GetAdditionalData().forcedReloadSpeed = ___myGunStats.GetAdditionalData().forcedReloadSpeed;
				}
				if (___myGunStats.GetAdditionalData().useAttacksPerAttack)
				{
					component.GetAdditionalData().attacksPerAttack = Mathf.Clamp(___myGunStats.GetAdditionalData().attacksPerAttack, 1, 10);
					component.GetAdditionalData().useAttacksPerAttack = ___myGunStats.GetAdditionalData().useAttacksPerAttack;
				}
				component.GetAdditionalData().speedDamageMultiplier *= ___myGunStats.GetAdditionalData().speedDamageMultiplier;
			}
			if (Object.op_Implicit((Object)(object)___myPlayerStats) && ___myPlayerStats.GetAdditionalData().MassModifier != 1f)
			{
				component2.GetAdditionalData().MassModifier *= ___myPlayerStats.GetAdditionalData().MassModifier;
			}
		}

		private static void Postfix(Player ___playerToUpgrade)
		{
			Player component = ((Component)___playerToUpgrade).GetComponent<Player>();
			Gun component2 = ((Component)((Component)___playerToUpgrade).GetComponent<Holding>().holdable).GetComponent<Gun>();
			GunAmmo componentInChildren = ((Component)component2).GetComponentInChildren<GunAmmo>();
			HealthHandler component3 = ((Component)___playerToUpgrade).GetComponent<HealthHandler>();
			CharacterStatModifiers component4 = ((Component)component).GetComponent<CharacterStatModifiers>();
			CharacterData component5 = ((Component)___playerToUpgrade).GetComponent<CharacterData>();
			if (component2.attackSpeed * component2.attackSpeedMultiplier < component2.GetAdditionalData().minimumAttackSpeed && component2.GetAdditionalData().useMinimumAttackSpeed && !component2.GetAdditionalData().useForcedAttackSpeed)
			{
				component2.attackSpeed = component2.GetAdditionalData().minimumAttackSpeed;
				component2.attackSpeedMultiplier = 1f;
			}
			if ((componentInChildren.reloadTime + componentInChildren.reloadTimeAdd) * componentInChildren.reloadTimeMultiplier < component2.GetAdditionalData().minimumReloadSpeed && component2.GetAdditionalData().useMinimumReloadSpeed && !component2.GetAdditionalData().useForcedReloadSpeed)
			{
				component2.reloadTime = 1f;
				component2.reloadTimeAdd = 0f;
				componentInChildren.reloadTimeMultiplier = 1f;
				componentInChildren.reloadTime = 2f;
				componentInChildren.reloadTimeAdd = component2.GetAdditionalData().minimumReloadSpeed - componentInChildren.reloadTime;
			}
			if (component2.GetAdditionalData().useForcedAttackSpeed)
			{
				component2.attackSpeed = component2.defaultCooldown;
				component2.attackSpeedMultiplier = 1f;
			}
			if (component4.GetAdditionalData().Vampire)
			{
				component3.regeneration = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(Block))]
	internal class Block_Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch("IsBlocking")]
		private static void IncreasedBlockTime(Block __instance, ref bool __result, CharacterData ___data)
		{
			if ((double)__instance.sinceBlock < 0.3 + (double)___data.stats.GetAdditionalData().extraBlockTime)
			{
				__instance.ShowStatusEffectBlock();
			}
			__result = __result || (double)__instance.sinceBlock < 0.3 + (double)___data.stats.GetAdditionalData().extraBlockTime;
		}

		[HarmonyPrefix]
		[HarmonyPriority(int.MaxValue)]
		[HarmonyPatch("RPCA_DoBlock")]
		private static bool StoppedByStunAndSilence(Block __instance, CharacterData ___data)
		{
			if (___data.view.IsMine && (___data.isStunned || ___data.isSilenced))
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPriority(int.MaxValue)]
		[HarmonyPatch("TryBlock")]
		private static bool TryStoppedByStunAndSilence(Block __instance, CharacterData ___data)
		{
			if (___data.view.IsMine && (___data.isStunned || ___data.isSilenced))
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CardChoice))]
	internal class CardChoice_Patch
	{
		private class SimpleEnumerator : IEnumerable
		{
			public IEnumerator enumerator;

			public Action prefixAction;

			public Action postfixAction;

			public Action<object> preItemAction;

			public Action<object> postItemAction;

			public Func<object, object> itemAction;

			IEnumerator IEnumerable.GetEnumerator()
			{
				return GetEnumerator();
			}

			public IEnumerator GetEnumerator()
			{
				prefixAction();
				while (enumerator.MoveNext())
				{
					object item = enumerator.Current;
					preItemAction(item);
					yield return itemAction(item);
					postItemAction(item);
				}
				postfixAction();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("StartPick")]
		private static void GreedPicks(CardChoice __instance, int pickerIDToSet)
		{
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(pickerIDToSet);
			Debug.Log((object)$"Checking Player {playerWithID.playerID} for Greed. CursePick is {CurseManager.instance.CursePick}");
			if ((Object)(object)playerWithID != (Object)null && playerWithID.data.currentCards.Contains(Greed.card) && !CurseManager.instance.CursePick)
			{
				CurseManager.instance.AddCursedPick(playerWithID);
			}
			else
			{
				Debug.Log((object)"In a cursed pick, not adding a pick.");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DoPlayerSelect")]
		[HarmonyPriority(0)]
		public static void SlothRightOnlyPre(CardChoice __instance, PickerType ___pickerType, int ___currentlySelectedCard, List<GameObject> ___spawnedCards, out int __state)
		{
			__state = ___currentlySelectedCard;
		}

		[HarmonyPostfix]
		[HarmonyPatch("DoPlayerSelect")]
		[HarmonyPriority(0)]
		public static void SlothRightOnlyPost(CardChoice __instance, PickerType ___pickerType, int __state, ref int ___currentlySelectedCard, List<GameObject> ___spawnedCards)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)___pickerType != 0 && (int)___pickerType == 1)
			{
				Player playerWithID = PlayerManager.instance.GetPlayerWithID(__instance.pickrID);
				if (playerWithID.data.currentCards.Contains(Sloth.card) && playerWithID.data.view.IsMine && ___currentlySelectedCard < __state)
				{
					Debug.Log((object)$"Keeping Player {playerWithID.playerID} from moving backwards since they have sloth.");
					___currentlySelectedCard = Mathf.Clamp(__state, 0, ___spawnedCards.Count - 1);
					ExtensionMethods.InvokeMethod((object)CardChoiceVisuals.instance, "SetCurrentSelected", new object[1] { ___currentlySelectedCard });
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("StartPick")]
		private static void FutureSightNulls(int pickerIDToSet)
		{
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(pickerIDToSet);
			if ((Object)(object)playerWithID != (Object)null && playerWithID.data.currentCards.Contains(FutureSight.card))
			{
				CharacterStatModifiersExtension.AjustNulls(playerWithID.data.stats, 4 * playerWithID.data.currentCards.Where((CardInfo c) => (Object)(object)c == (Object)(object)FutureSight.card).Count());
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ReplaceCards")]
		private static void GetSpawnedCards(CardChoice __instance, List<GameObject> ___spawnedCards, ref IEnumerator __result)
		{
			Action prefixAction = delegate
			{
			};
			Action<object> preItemAction = delegate
			{
			};
			Action<object> postItemAction = delegate
			{
			};
			Func<object, object> itemAction = (object item) => item;
			Action postfixAction = delegate
			{
				List<string> list = new List<string>();
				foreach (GameObject ___spawnedCard in ___spawnedCards)
				{
					CardInfo component = ___spawnedCard.GetComponent<CardInfo>();
					if (Object.op_Implicit((Object)(object)component))
					{
						list.Add(((Object)___spawnedCard).name.Replace("(Clone)", ""));
					}
				}
				NetworkingManager.RPC(typeof(MissedOpportunities), "URPCA_CardsSeen", new object[2]
				{
					__instance.pickrID,
					list.ToArray()
				});
			};
			SimpleEnumerator simpleEnumerator = new SimpleEnumerator
			{
				enumerator = __result,
				prefixAction = prefixAction,
				postfixAction = postfixAction,
				preItemAction = preItemAction,
				postItemAction = postItemAction,
				itemAction = itemAction
			};
			__result = simpleEnumerator.GetEnumerator();
		}

		[HarmonyPostfix]
		[HarmonyPatch("IDoEndPick")]
		private static void GetPickedCard(CardChoice __instance, GameObject pickedCard, ref IEnumerator __result)
		{
			Action prefixAction = delegate
			{
				if (YardSale.yardSaleActive && (Object)(object)pickedCard != (Object)null && (Object.op_Implicit((Object)(object)pickedCard.GetComponent<CardInfo>()) & (PlayerManager.instance.GetPlayerWithID(CardChoice.instance.pickrID).data.view.IsMine || PhotonNetwork.OfflineMode)))
				{
					NetworkingManager.RPC(typeof(YardSale), "URPCA_AddToListOfCardsToRemove", new object[2]
					{
						YardSale.yardSalePlayer.playerID,
						((Object)pickedCard).name.Replace("(Clone)", "")
					});
				}
			};
			Action<object> preItemAction = delegate
			{
			};
			Action<object> postItemAction = delegate
			{
			};
			Func<object, object> itemAction = (object item) => item;
			Action postfixAction = delegate
			{
			};
			SimpleEnumerator simpleEnumerator = new SimpleEnumerator
			{
				enumerator = __result,
				prefixAction = prefixAction,
				postfixAction = postfixAction,
				preItemAction = preItemAction,
				postItemAction = postItemAction,
				itemAction = itemAction
			};
			__result = simpleEnumerator.GetEnumerator();
		}

		[HarmonyPostfix]
		[HarmonyPatch("ReplaceCards")]
		private static void OnlyModifyCardsGeneratedDuringPick(CardChoice __instance, GameObject pickedCard, ref IEnumerator __result)
		{
			Action prefixAction = delegate
			{
				if (YardSale.yardSaleActive)
				{
					YardSale.generatingCardsDuringYardSale = true;
				}
			};
			Action<object> preItemAction = delegate
			{
			};
			Action<object> postItemAction = delegate
			{
			};
			Func<object, object> itemAction = (object item) => item;
			Action postfixAction = delegate
			{
				if (YardSale.yardSaleActive)
				{
					YardSale.generatingCardsDuringYardSale = false;
				}
			};
			SimpleEnumerator simpleEnumerator = new SimpleEnumerator
			{
				enumerator = __result,
				prefixAction = prefixAction,
				postfixAction = postfixAction,
				preItemAction = preItemAction,
				postItemAction = postItemAction,
				itemAction = itemAction
			};
			__result = simpleEnumerator.GetEnumerator();
		}

		[HarmonyPostfix]
		[HarmonyPriority(800)]
		[HarmonyPatch("SpawnUniqueCard")]
		private static void MomentumReplace(CardChoice __instance, ref GameObject __result, Vector3 pos, Quaternion rot)
		{
			//IL_00e3: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01bc: Expected O, but got Unknown
			CardInfo component = __result.GetComponent<CardInfo>();
			if (!((Object)(object)component.sourceCard == (Object)(object)ImmovableObject.card) && !((Object)(object)component.sourceCard == (Object)(object)UnstoppableForce.card))
			{
				return;
			}
			if (PlayerManager.instance.GetPlayerWithID(__instance.pickrID).data.view.IsMine)
			{
				NetworkingManager.RPC_Others(typeof(CardChoice_Patch), "URPCA_IncrementMomentum", Array.Empty<object>());
				MomentumTracker.stacks++;
			}
			if ((Object)(object)component.sourceCard == (Object)(object)ImmovableObject.card)
			{
				GameObject temp2 = __result;
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)WillsWackyCards.instance, 5, (Action)delegate
				{
					PhotonNetwork.Destroy(temp2);
				});
				CardInfo defensecard = MomentumTracker.GetDefensecard();
				__result = (GameObject)ExtensionMethods.InvokeMethod((object)__instance, "Spawn", new object[3]
				{
					((Component)defensecard).gameObject,
					pos,
					rot
				});
				__result.GetComponent<CardInfo>().sourceCard = defensecard;
				((Behaviour)((Component)__result.GetComponentInChildren<DamagableEvent>()).GetComponent<Collider2D>()).enabled = false;
				((Object)__result).name = ((Object)((Component)ImmovableObject.card).gameObject).name;
				MomentumTracker.defenseFlag = true;
			}
			if ((Object)(object)component.sourceCard == (Object)(object)UnstoppableForce.card)
			{
				GameObject temp = __result;
				ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)WillsWackyCards.instance, 5, (Action)delegate
				{
					PhotonNetwork.Destroy(temp);
				});
				CardInfo offensecard = MomentumTracker.GetOffensecard();
				__result = (GameObject)ExtensionMethods.InvokeMethod((object)__instance, "Spawn", new object[3]
				{
					((Component)offensecard).gameObject,
					pos,
					rot
				});
				__result.GetComponent<CardInfo>().sourceCard = offensecard;
				((Behaviour)((Component)__result.GetComponentInChildren<DamagableEvent>()).GetComponent<Collider2D>()).enabled = false;
				((Object)__result).name = ((Object)((Component)UnstoppableForce.card).gameObject).name;
				MomentumTracker.offenseFlag = true;
			}
		}

		[UnboundRPC]
		internal static void URPCA_IncrementMomentum()
		{
			MomentumTracker.stacks++;
		}
	}
	[HarmonyPatch(typeof(Cards))]
	[HarmonyPriority(0)]
	internal class Cards_Patch
	{
		[HarmonyPrefix]
		[HarmonyPatch("AddCardToPlayer", new Type[]
		{
			typeof(Player),
			typeof(CardInfo),
			typeof(bool),
			typeof(string),
			typeof(float),
			typeof(float),
			typeof(bool)
		})]
		private static void MomentumCorrection(Player player, ref CardInfo card, bool reassign = false, string twoLetterCode = "", float forceDisplay = 0f, float forceDisplayDelay = 0f, bool addToCardBar = true)
		{
			if (PhotonNetwork.IsMasterClient && ((Object)(object)card == (Object)(object)ImmovableObject.card || (Object)(object)card == (Object)(object)UnstoppableForce.card))
			{
				NetworkingManager.RPC_Others(typeof(CardChoice_Patch), "URPCA_IncrementMomentum", Array.Empty<object>());
				MomentumTracker.stacks++;
				if ((Object)(object)card == (Object)(object)ImmovableObject.card)
				{
					card = MomentumTracker.GetDefensecard(1);
				}
				if ((Object)(object)card == (Object)(object)UnstoppableForce.card)
				{
					card = MomentumTracker.GetOffensecard(1);
				}
				MomentumTracker.stacks /= 4;
			}
		}
	}
	[HarmonyPatch(typeof(CharacterStatModifiers))]
	internal class CharacterStatModifiers_Patch
	{
		[HarmonyPostfix]
		[HarmonyPriority(800)]
		[HarmonyPatch("ConfigureMassAndSize")]
		private static void MassAdjustment(CharacterStatModifiers __instance, CharacterData ___data)
		{
			if (__instance.GetAdditionalData().MassModifier != 1f)
			{
				float num = (float)ExtensionMethods.GetFieldValue((object)___data.playerVel, "mass");
				float massModifier = __instance.GetAdditionalData().MassModifier;
				float num2 = num * massModifier;
				ExtensionMethods.SetFieldValue((object)___data.playerVel, "mass", (object)num2);
			}
		}
	}
	[HarmonyPatch(typeof(DamageOverTime))]
	internal class DamageOverTime_Patch
	{
		[HarmonyPrefix]
		[HarmonyPatch("TakeDamageOverTime")]
		private static void DurationChange(DamageOverTime __instance, Vector2 damage, Vector2 position, ref float time, float interval, Player damagingPlayer, CharacterData ___data)
		{
			Player player = ___data.player;
			if (player.data.stats.GetAdditionalData().poisonDurationModifier != 1f)
			{
				time *= player.data.stats.GetAdditionalData().poisonDurationModifier;
			}
		}

		[HarmonyPrefix]
		[HarmonyPriority(0)]
		[HarmonyPatch("TakeDamageOverTime")]
		private static bool RevertToBurst(DamageOverTime __instance, ref Vector2 damage, Vector2 position, float time, float interval, Color color, GameObject damagingWeapon, Player damagingPlayer, bool lethal, CharacterData ___data)
		{
			//IL_00df: 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_00eb: 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_011d: 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)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			Player player = ___data.player;
			float num = 1f;
			if (player.data.stats.GetAdditionalData().poisonBurstModifier != 1f)
			{
				num *= player.data.stats.GetAdditionalData().poisonBurstModifier;
			}
			if (Object.op_Implicit((Object)(object)damagingPlayer) && damagingPlayer.data.stats.GetAdditionalData().dealtDoTBurstModifier != 1f)
			{
				num *= damagingPlayer.data.stats.GetAdditionalData().dealtDoTBurstModifier;
			}
			if (num < 1f)
			{
				float magnitude = ((Vector2)(ref damage)).magnitude;
				float num2 = magnitude * (1f - Mathf.Clamp(num, 0f, 1f));
				player.data.healthHandler.DoDamage(((Vector2)(ref damage)).normalized * num2, position, color, damagingWeapon, damagingPlayer, false, lethal, true);
				float num3 = magnitude - num2;
				if (num3 <= 0f)
				{
					return false;
				}
				damage = ((Vector2)(ref damage)).normalized * num3;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("TakeDamageOverTime")]
		private static void DoTDamageReduction(DamageOverTime __instance, ref Vector2 damage, Vector2 position, float time, float interval, Player damagingPlayer, CharacterData ___data)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_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)
			Player player = ___data.player;
			if (player.data.stats.GetAdditionalData().poisonResistance != 1f)
			{
				float magnitude = ((Vector2)(ref damage)).magnitude;
				magnitude *= player.data.stats.GetAdditionalData().poisonResistance;
				Vector2 normalized = ((Vector2)(ref damage)).normalized;
				damage = normalized * magnitude;
			}
		}
	}
	[HarmonyPatch(typeof(DeathEffect))]
	internal class DeathEffect_Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch("PlayDeath")]
		private static void AdjustedRespawnTime(DeathEffect __instance, Color color, PlayerVelocity playerRig, Vector2 vel, int playerIDToRevive)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			if (playerIDToRevive == -1)
			{
				return;
			}
			Player player = ((CharacterData)ExtensionMethods.GetFieldValue((object)playerRig, "data")).player;
			if (player.data.stats.GetAdditionalData().useNewRespawnTime)
			{
				float newRespawnTime = player.data.stats.GetAdditionalData().newRespawnTime;
				ExtensionMethods.SetFieldValue((object)__instance, "respawnTime", (object)newRespawnTime);
				ParticleSystem[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<ParticleSystem>();
				ParticleSystem[] array = componentsInChildren;
				foreach (ParticleSystem val in array)
				{
					val.playbackSpeed = 2.53f / newRespawnTime;
					MainModule main = val.main;
					((MainModule)(ref main)).simulationSpeed = 2.53f / newRespawnTime;
				}
				((Component)__instance).gameObject.GetComponent<RemoveAfterSeconds>().seconds = 2f * newRespawnTime;
			}
		}
	}
	[HarmonyPatch]
	internal class Egg_Patch
	{
		private static void EggRarity(ref Rarity __result)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected I4, but got Unknown
			__result = (Rarity)(int)RarityUtils.GetRarity("E G G");
		}
	}
	[HarmonyPatch(typeof(Gun))]
	internal class Gun_Patch
	{
		[HarmonyPrefix]
		[HarmonyPatch("DoAttacks")]
		private static void SetAttacks(Gun __instance, ref int attacks)
		{
			if (__instance.GetAdditionalData().useAttacksPerAttack)
			{
				attacks = __instance.GetAdditionalData().attacksPerAttack;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ApplyProjectileStats")]
		private static void SpeedDamageIncrease(Gun __instance, ref GameObject obj, float ___projectileSpeed, int ___reflects, float ___projectielSimulatonSpeed)
		{
			if (__instance.GetAdditionalData().speedDamageMultiplier != 0f)
			{
				ProjectileHit component = obj.GetComponent<ProjectileHit>();
				float num = ___projectileSpeed * (__instance.useCharge ? (ProjectileHitExtensions.GetBulletCharge(component) * __instance.chargeSpeedTo) : 1f);
				float num2 = 1f + (num - 1f) * (__instance.GetAdditionalData().speedDamageMultiplier - 1f);
				float num3 = 1f + (___projectielSimulatonSpeed - 1f) * (__instance.GetAdditionalData().speedDamageMultiplier - 1f);
				component.damage *= num2 * num3;
			}
			if (___reflects > 0)
			{
				RayHitReflect component2 = obj.GetComponent<RayHitReflect>();
				component2.dmgM *= 1f + (component2.speedM - 1f) * (__instance.GetAdditionalData().speedDamageMultiplier - 1f);
			}
		}
	}
	[HarmonyPatch(typeof(GunAmmo))]
	internal class GunAmmo_Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ReloadTime")]
		private static void ChangedReloadTime(ref float __result, Gun ___gun)
		{
			if (___gun.GetAdditionalData().useMinimumReloadSpeed && __result < ___gun.GetAdditionalData().minimumReloadSpeed)
			{
				__result = ___gun.GetAdditionalData().minimumReloadSpeed;
			}
			if (___gun.GetAdditionalData().useForcedReloadSpeed && __result != ___gun.GetAdditionalData().forcedReloadSpeed)
			{
				__result = ___gun.GetAdditionalData().forcedReloadSpeed;
			}
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	internal class HealthHandler_Patch
	{
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		[HarmonyPatch("Heal")]
		private static void NoHeal(Player ___player, ref float healAmount)
		{
			SavageWoundsDamage_Mono component = ((Component)___player).GetComponent<SavageWoundsDamage_Mono>();
			if (Object.op_Implicit((Object)(object)component))
			{
				healAmount = 0f;
			}
		}

		[HarmonyPrefix]
		[HarmonyPriority(0)]
		[HarmonyPatch("DoDamage")]
		[HarmonyPatch("TakeDamage", new Type[]
		{
			typeof(Vector2),
			typeof(Vector2),
			typeof(Color),
			typeof(GameObject),
			typeof(Player),
			typeof(bool),
			typeof(bool)
		})]
		private static void WrathEffect(HealthHandler __instance, ref bool ignoreBlock, Player ___player)
		{
			if (___player.data.currentCards.Contains(Wrath.card))
			{
				ignoreBlock = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPriority(0)]
		[HarmonyPatch("CallTakeDamage")]
		private static void BleedEffect(HealthHandler __instance, Vector2 damage, Vector2 position, Player damagingPlayer, Player ___player)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			if (PlayerStatus.PlayerAliveAndSimulated(___player))
			{
				float bleed = ___player.data.stats.GetAdditionalData().Bleed;
				if (bleed > 0f)
				{
					__instance.TakeDamageOverTime(damage * bleed, position, 2.875f + bleed / 4f, 0.25f, Color.red, (GameObject)null, damagingPlayer, true);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DoDamage")]
		private static void ApplyDamageReduction(HealthHandler __instance, ref Vector2 damage, Player ___player)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result