Decompiled source of RandomRandomizer v1.0.0

plugins\RandomRandomizer\RoundsCardRerollMod.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnboundLib.Cards;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("RoundsCardRerollMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RoundsCardRerollMod")]
[assembly: AssemblyTitle("RoundsCardRerollMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 RoundsCardRerollMod
{
	[BepInPlugin("com.tobia.rounds.randomrandomizer", "RandomRandomizer", "1.0.0")]
	public class MegaCardsPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <Start>d__4 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public MegaCardsPlugin <>4__this;

			private int <ticks>5__2;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				MegaCardsPlugin megaCardsPlugin = <>4__this;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
				}
				else
				{
					<>1__state = -1;
					((BaseUnityPlugin)megaCardsPlugin).Logger.LogInfo((object)"RandomRandomizer loading...");
					<ticks>5__2 = 0;
				}
				if (CardVisualFactory.TryInitialize(((BaseUnityPlugin)megaCardsPlugin).Logger))
				{
					CardRegistry.RegisterAll(((BaseUnityPlugin)megaCardsPlugin).Logger);
					return false;
				}
				<ticks>5__2++;
				if (<ticks>5__2 % 300 == 0)
				{
					((BaseUnityPlugin)megaCardsPlugin).Logger.LogInfo((object)"Waiting for card templates...");
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public const string ModId = "com.tobia.rounds.randomrandomizer";

		public const string ModName = "RandomRandomizer";

		public const string ModVersion = "1.0.0";

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

		[IteratorStateMachine(typeof(<Start>d__4))]
		private IEnumerator Start()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Start>d__4(0)
			{
				<>4__this = this
			};
		}
	}
	internal static class CardRegistry
	{
		private static bool _registered;

		public static void RegisterAll(ManualLogSource logger)
		{
			if (!_registered)
			{
				MethodInfo methodInfo = typeof(CustomCard).GetMethods(BindingFlags.Static | BindingFlags.Public).First((MethodInfo m) => m.Name == "BuildCard" && m.IsGenericMethodDefinition && m.GetParameters().Length == 0);
				Type[] all = CardTypeList.All;
				foreach (Type type in all)
				{
					methodInfo.MakeGenericMethod(type).Invoke(null, null);
				}
				_registered = true;
				logger.LogInfo((object)$"Registered {CardTypeList.All.Length} custom cards.");
			}
		}
	}
	internal static class CardAvailabilityGate
	{
		public static bool IsEnabled(int index)
		{
			return true;
		}

		public static bool IsUltraRareIndex(int index)
		{
			if (index >= 131)
			{
				return index <= 180;
			}
			return false;
		}

		public static bool TryGetGeneratedIndex(GameObject cardObject, out int index)
		{
			index = -1;
			CardInfo val = (((Object)(object)cardObject != (Object)null) ? cardObject.GetComponent<CardInfo>() : null);
			string text = (((Object)(object)val != (Object)null) ? val.cardName : null);
			if (string.IsNullOrEmpty(text))
			{
				return false;
			}
			int num = text.LastIndexOf('#');
			if (num < 0 || num >= text.Length - 1)
			{
				return false;
			}
			return int.TryParse(text.Substring(num + 1).Trim(), out index);
		}
	}
	internal static class CardVisualFactory
	{
		private static bool _ready;

		private static GameObject _templateArt;

		private static GameObject _templateBase;

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

		public static GameObject CardBase => _templateBase;

		public static bool TryInitialize(ManualLogSource logger)
		{
			if (_ready)
			{
				return true;
			}
			CardInfo[] allCards = GetAllCards();
			if (allCards == null || allCards.Length == 0)
			{
				return false;
			}
			CardInfo val = ((IEnumerable<CardInfo>)allCards).FirstOrDefault((Func<CardInfo, bool>)((CardInfo c) => (Object)(object)c != (Object)null && (Object)(object)c.cardArt != (Object)null && (Object)(object)c.cardBase != (Object)null));
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			_templateArt = val.cardArt;
			_templateBase = val.cardBase;
			if ((Object)(object)_templateArt == (Object)null || (Object)(object)_templateBase == (Object)null)
			{
				return false;
			}
			_ready = true;
			logger.LogInfo((object)"Card visual templates initialized.");
			return true;
		}

		public static GameObject CreateArtVariant(int index)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (ArtCache.TryGetValue(index, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			if (!_ready || (Object)(object)_templateArt == (Object)null)
			{
				GameObject val = new GameObject($"RandomRandomizerArtFallback{index:000}");
				ArtCache[index] = val;
				return val;
			}
			GameObject val2 = Object.Instantiate<GameObject>(_templateArt);
			((Object)val2).name = $"RandomRandomizerArt_{index:000}";
			Color tint = ColorFor(index);
			TintObject(val2, tint);
			LabelObject(val2, index);
			ArtCache[index] = val2;
			return val2;
		}

		private static CardInfo[] GetAllCards()
		{
			CardInfo[] array = Resources.FindObjectsOfTypeAll<CardInfo>();
			if (array != null && array.Length != 0)
			{
				return array;
			}
			return Array.Empty<CardInfo>();
		}

		private static Color ColorFor(int index)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			return Color.HSVToRGB((float)(index % 100) / 100f, 0.35f, 1f);
		}

		private static void TintObject(GameObject root, Color tint)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Component[] componentsInChildren = root.GetComponentsInChildren<Component>(true);
			foreach (Component val in componentsInChildren)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				PropertyInfo property = ((object)val).GetType().GetProperty("color", BindingFlags.Instance | BindingFlags.Public);
				if (property != null && property.CanRead && property.CanWrite && property.PropertyType == typeof(Color))
				{
					try
					{
						Color val2 = Color.Lerp((Color)property.GetValue(val, null), tint, 0.25f);
						property.SetValue(val, val2, null);
					}
					catch
					{
					}
				}
			}
		}

		private static void LabelObject(GameObject root, int index)
		{
			Component[] componentsInChildren = root.GetComponentsInChildren<Component>(true);
			foreach (Component val in componentsInChildren)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				PropertyInfo property = ((object)val).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public);
				if (property != null && property.CanWrite && property.PropertyType == typeof(string))
				{
					try
					{
						property.SetValue(val, $"N-{index:000}", null);
						break;
					}
					catch
					{
					}
				}
			}
		}
	}
	internal static class CardTypeList
	{
		public static readonly Type[] All = new Type[210]
		{
			typeof(Card001),
			typeof(Card002),
			typeof(Card003),
			typeof(Card004),
			typeof(Card005),
			typeof(Card006),
			typeof(Card007),
			typeof(Card008),
			typeof(Card009),
			typeof(Card010),
			typeof(Card011),
			typeof(Card012),
			typeof(Card013),
			typeof(Card014),
			typeof(Card015),
			typeof(Card016),
			typeof(Card017),
			typeof(Card018),
			typeof(Card019),
			typeof(Card020),
			typeof(Card021),
			typeof(Card022),
			typeof(Card023),
			typeof(Card024),
			typeof(Card025),
			typeof(Card026),
			typeof(Card027),
			typeof(Card028),
			typeof(Card029),
			typeof(Card030),
			typeof(Card031),
			typeof(Card032),
			typeof(Card033),
			typeof(Card034),
			typeof(Card035),
			typeof(Card036),
			typeof(Card037),
			typeof(Card038),
			typeof(Card039),
			typeof(Card040),
			typeof(Card041),
			typeof(Card042),
			typeof(Card043),
			typeof(Card044),
			typeof(Card045),
			typeof(Card046),
			typeof(Card047),
			typeof(Card048),
			typeof(Card049),
			typeof(Card050),
			typeof(Card051),
			typeof(Card052),
			typeof(Card053),
			typeof(Card054),
			typeof(Card055),
			typeof(Card056),
			typeof(Card057),
			typeof(Card058),
			typeof(Card059),
			typeof(Card060),
			typeof(Card061),
			typeof(Card062),
			typeof(Card063),
			typeof(Card064),
			typeof(Card065),
			typeof(Card066),
			typeof(Card067),
			typeof(Card068),
			typeof(Card069),
			typeof(Card070),
			typeof(Card071),
			typeof(Card072),
			typeof(Card073),
			typeof(Card074),
			typeof(Card075),
			typeof(Card076),
			typeof(Card077),
			typeof(Card078),
			typeof(Card079),
			typeof(Card080),
			typeof(Card081),
			typeof(Card082),
			typeof(Card083),
			typeof(Card084),
			typeof(Card085),
			typeof(Card086),
			typeof(Card087),
			typeof(Card088),
			typeof(Card089),
			typeof(Card090),
			typeof(Card091),
			typeof(Card092),
			typeof(Card093),
			typeof(Card094),
			typeof(Card095),
			typeof(Card096),
			typeof(Card097),
			typeof(Card098),
			typeof(Card099),
			typeof(Card100),
			typeof(Card101),
			typeof(Card102),
			typeof(Card103),
			typeof(Card104),
			typeof(Card105),
			typeof(Card106),
			typeof(Card107),
			typeof(Card108),
			typeof(Card109),
			typeof(Card110),
			typeof(Card111),
			typeof(Card112),
			typeof(Card113),
			typeof(Card114),
			typeof(Card115),
			typeof(Card116),
			typeof(Card117),
			typeof(Card118),
			typeof(Card119),
			typeof(Card120),
			typeof(Card121),
			typeof(Card122),
			typeof(Card123),
			typeof(Card124),
			typeof(Card125),
			typeof(Card126),
			typeof(Card127),
			typeof(Card128),
			typeof(Card129),
			typeof(Card130),
			typeof(Card131),
			typeof(Card132),
			typeof(Card133),
			typeof(Card134),
			typeof(Card135),
			typeof(Card136),
			typeof(Card137),
			typeof(Card138),
			typeof(Card139),
			typeof(Card140),
			typeof(Card141),
			typeof(Card142),
			typeof(Card143),
			typeof(Card144),
			typeof(Card145),
			typeof(Card146),
			typeof(Card147),
			typeof(Card148),
			typeof(Card149),
			typeof(Card150),
			typeof(Card151),
			typeof(Card152),
			typeof(Card153),
			typeof(Card154),
			typeof(Card155),
			typeof(Card156),
			typeof(Card157),
			typeof(Card158),
			typeof(Card159),
			typeof(Card160),
			typeof(Card161),
			typeof(Card162),
			typeof(Card163),
			typeof(Card164),
			typeof(Card165),
			typeof(Card166),
			typeof(Card167),
			typeof(Card168),
			typeof(Card169),
			typeof(Card170),
			typeof(Card171),
			typeof(Card172),
			typeof(Card173),
			typeof(Card174),
			typeof(Card175),
			typeof(Card176),
			typeof(Card177),
			typeof(Card178),
			typeof(Card179),
			typeof(Card180),
			typeof(Card181),
			typeof(Card182),
			typeof(Card183),
			typeof(Card184),
			typeof(Card185),
			typeof(Card186),
			typeof(Card187),
			typeof(Card188),
			typeof(Card189),
			typeof(Card190),
			typeof(Card191),
			typeof(Card192),
			typeof(Card193),
			typeof(Card194),
			typeof(Card195),
			typeof(Card196),
			typeof(Card197),
			typeof(Card198),
			typeof(Card199),
			typeof(Card200),
			typeof(Card201),
			typeof(Card202),
			typeof(Card203),
			typeof(Card204),
			typeof(Card205),
			typeof(Card206),
			typeof(Card207),
			typeof(Card208),
			typeof(Card209),
			typeof(Card210)
		};
	}
	internal enum SpecialMode
	{
		None,
		CoinFlip,
		TinyBullets,
		BigBullets,
		HyperJump,
		HeavyBoots,
		StatLottery,
		GravityFlip,
		GlassOverdrive,
		TankMode,
		ChaosGift,
		VampBurst,
		MomentumRush,
		AmmoForge,
		PhaseStep,
		Reversal,
		RicochetDance,
		BerserkerCore,
		SniperStance,
		CloseQuarters,
		BlinkStep,
		Overclock,
		FrostCore,
		InfernalTrade,
		AeroGlass,
		AnchorHeart,
		DiceAmmo,
		TwinPulse,
		LastStand,
		FeatherFall,
		IronSkin,
		BloodTax,
		TurboBlock,
		StaticCharge,
		LongGame,
		WildMagic,
		QuantumFlux,
		ProbabilityStorm,
		RealityWarp,
		LuckyDraw,
		ChaoticMerge,
		OverdriveLottery,
		QuantumTangle,
		VortexSwap,
		InfinityStone,
		PrimalChaosShift,
		RocketFuse,
		BlastCore,
		WallPiercer,
		GhostRounds,
		RicochetEngine,
		PinballShells,
		PortalShot,
		BunkerBuster,
		ScatterMissiles,
		PhaseRocket,
		DrillRounds,
		SiegePayload,
		ShrapnelBurst,
		MeteorShells,
		EchoWarp,
		AegisField,
		ShockRing,
		ReloadCache,
		MedicPulse,
		WarpStepBlock,
		GravityBubble,
		MirrorShell,
		GhostScreen,
		SiegeReserve,
		ShrapnelGuard,
		OverhealDrive,
		NovaBrake,
		ForceWall,
		RicochetWard,
		PhaseBattery,
		RerollSomeAllPlayers,
		RerollSomeOwnCards,
		RerollAllOwnCards,
		RerollAllPlayersCards,
		RerollHalfOwnCards,
		RerollHalfAllPlayers,
		RerollOneEachPlayer,
		RerollTwoOwnCards,
		RerollTwoEachPlayer,
		RerollAllOthers,
		GiveSelfRandomOneToFive,
		RandomizeAllPlayersNewCards,
		GiveRandomPlayersRandomCards,
		GiveEveryoneOneToThree,
		RandomizeOthersOnly,
		GiveSelfAndOthersBurst,
		RandomizeHalfAllThenGift,
		TaxAndGiftChaos,
		PartyDraft,
		FullTableChaos
	}
	internal sealed class CardSpec
	{
		public string Title;

		public string Description;

		public Rarity Rarity;

		public CardThemeColorType Theme;

		public float DamageMult = 1f;

		public float AttackSpeedMult = 1f;

		public float ReloadTimeMult = 1f;

		public float ProjectileSpeedMult = 1f;

		public float AmmoMult = 1f;

		public float HealthMult = 1f;

		public float MoveSpeedMult = 1f;

		public float GravityMult = 1f;

		public float BlockCooldownMult = 1f;

		public SpecialMode Special;

		public bool UseDamage;

		public bool UseAttackSpeed;

		public bool UseReload;

		public bool UseProjectileSpeed;

		public bool UseAmmo;

		public bool UseHealth;

		public bool UseMoveSpeed;

		public bool UseGravity;

		public bool UseBlockCooldown;
	}
	internal static class CardSpecFactory
	{
		private static readonly string[] Prefixes = new string[20]
		{
			"Turbo", "Cursed", "Lucky", "Greedy", "Bouncy", "Sneaky", "Wild", "Spicy", "Ancient", "Chaotic",
			"Sticky", "Shiny", "Fragile", "Heavy", "Elastic", "Rocket", "Noisy", "Sleepy", "Wizard", "Glitch"
		};

		private static readonly string[] Suffixes = new string[20]
		{
			"Banana", "Anvil", "Peashooter", "Boomstick", "Sandwich", "Laser", "Socks", "Meteor", "Toaster", "Mushroom",
			"Trombone", "Cannon", "Pogo", "Pillow", "Blaster", "Pickle", "Comet", "Meme", "Duck", "Wrench"
		};

		private static readonly string[] BlockPrefixes = new string[10] { "Guard", "Ward", "Anchor", "Echo", "Bastion", "Mirror", "Pulse", "Barrier", "Vault", "Phase" };

		private static readonly string[] BlockSuffixes = new string[10] { "Core", "Shell", "Wall", "Loop", "Screen", "Field", "Node", "Burst", "Aegis", "Brake" };

		private static readonly string[] RerollPrefixes = new string[10] { "Reroll", "Shuffle", "Chaos", "Draft", "Deck", "Meta", "Spin", "Swap", "Remix", "Reset" };

		private static readonly string[] RerollSuffixes = new string[10] { "Protocol", "Engine", "Signal", "Pulse", "Matrix", "Storm", "Drive", "Circuit", "Node", "Burst" };

		private static readonly string[] RandomizerTitles = new string[10] { "Lucky Lootbox", "Global Rewrite", "Card Rain", "Table Handout", "Enemy Rewrite", "Burst Draft", "Chaos Cascade", "Tax And Gift", "Party Draft", "Total Randomizer" };

		private static readonly SpecialMode[] SpecialPool = new SpecialMode[65]
		{
			SpecialMode.None,
			SpecialMode.None,
			SpecialMode.None,
			SpecialMode.None,
			SpecialMode.None,
			SpecialMode.CoinFlip,
			SpecialMode.TinyBullets,
			SpecialMode.BigBullets,
			SpecialMode.HyperJump,
			SpecialMode.HeavyBoots,
			SpecialMode.StatLottery,
			SpecialMode.GravityFlip,
			SpecialMode.GlassOverdrive,
			SpecialMode.TankMode,
			SpecialMode.ChaosGift,
			SpecialMode.VampBurst,
			SpecialMode.MomentumRush,
			SpecialMode.AmmoForge,
			SpecialMode.PhaseStep,
			SpecialMode.Reversal,
			SpecialMode.RicochetDance,
			SpecialMode.BerserkerCore,
			SpecialMode.SniperStance,
			SpecialMode.CloseQuarters,
			SpecialMode.BlinkStep,
			SpecialMode.Overclock,
			SpecialMode.FrostCore,
			SpecialMode.InfernalTrade,
			SpecialMode.AeroGlass,
			SpecialMode.AnchorHeart,
			SpecialMode.DiceAmmo,
			SpecialMode.TwinPulse,
			SpecialMode.LastStand,
			SpecialMode.FeatherFall,
			SpecialMode.IronSkin,
			SpecialMode.BloodTax,
			SpecialMode.TurboBlock,
			SpecialMode.StaticCharge,
			SpecialMode.LongGame,
			SpecialMode.WildMagic,
			SpecialMode.QuantumFlux,
			SpecialMode.ProbabilityStorm,
			SpecialMode.RealityWarp,
			SpecialMode.LuckyDraw,
			SpecialMode.ChaoticMerge,
			SpecialMode.OverdriveLottery,
			SpecialMode.QuantumTangle,
			SpecialMode.VortexSwap,
			SpecialMode.InfinityStone,
			SpecialMode.PrimalChaosShift,
			SpecialMode.RocketFuse,
			SpecialMode.BlastCore,
			SpecialMode.WallPiercer,
			SpecialMode.GhostRounds,
			SpecialMode.RicochetEngine,
			SpecialMode.PinballShells,
			SpecialMode.PortalShot,
			SpecialMode.BunkerBuster,
			SpecialMode.ScatterMissiles,
			SpecialMode.PhaseRocket,
			SpecialMode.DrillRounds,
			SpecialMode.SiegePayload,
			SpecialMode.ShrapnelBurst,
			SpecialMode.MeteorShells,
			SpecialMode.EchoWarp
		};

		private static readonly SpecialMode[] BlockSpecialPool = new SpecialMode[20]
		{
			SpecialMode.AegisField,
			SpecialMode.ShockRing,
			SpecialMode.ReloadCache,
			SpecialMode.MedicPulse,
			SpecialMode.WarpStepBlock,
			SpecialMode.GravityBubble,
			SpecialMode.MirrorShell,
			SpecialMode.GhostScreen,
			SpecialMode.SiegeReserve,
			SpecialMode.ShrapnelGuard,
			SpecialMode.OverhealDrive,
			SpecialMode.NovaBrake,
			SpecialMode.ForceWall,
			SpecialMode.RicochetWard,
			SpecialMode.PhaseBattery,
			SpecialMode.AegisField,
			SpecialMode.ShockRing,
			SpecialMode.MirrorShell,
			SpecialMode.GhostScreen,
			SpecialMode.PhaseBattery
		};

		private static readonly SpecialMode[] RerollSpecialPool = new SpecialMode[10]
		{
			SpecialMode.RerollSomeAllPlayers,
			SpecialMode.RerollSomeOwnCards,
			SpecialMode.RerollAllOwnCards,
			SpecialMode.RerollAllPlayersCards,
			SpecialMode.RerollHalfOwnCards,
			SpecialMode.RerollHalfAllPlayers,
			SpecialMode.RerollOneEachPlayer,
			SpecialMode.RerollTwoOwnCards,
			SpecialMode.RerollTwoEachPlayer,
			SpecialMode.RerollAllOthers
		};

		private static readonly SpecialMode[] RandomizerSpecialPool = new SpecialMode[10]
		{
			SpecialMode.GiveSelfRandomOneToFive,
			SpecialMode.RandomizeAllPlayersNewCards,
			SpecialMode.GiveRandomPlayersRandomCards,
			SpecialMode.GiveEveryoneOneToThree,
			SpecialMode.RandomizeOthersOnly,
			SpecialMode.GiveSelfAndOthersBurst,
			SpecialMode.RandomizeHalfAllThenGift,
			SpecialMode.TaxAndGiftChaos,
			SpecialMode.PartyDraft,
			SpecialMode.FullTableChaos
		};

		public static CardSpec Create(int index)
		{
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_097b: Unknown result type (might be due to invalid IL or missing references)
			//IL_098b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0985: Unknown result type (might be due to invalid IL or missing references)
			//IL_0993: Unknown result type (might be due to invalid IL or missing references)
			//IL_099c: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ff: Unknown result type (might be due to invalid IL or missing references)
			int num = index - 1;
			Random random = new Random(9187 + index * 7919);
			bool flag = index >= 131 && index <= 180;
			bool flag2 = index >= 181 && index <= 200;
			bool flag3 = index >= 201 && index <= 210;
			bool flag4 = random.NextDouble() < (flag ? 0.22 : 0.38);
			float damageMult = Roll(random, flag4, flag ? 0.88f : 0.72f, flag ? 1.24f : 1.58f);
			float attackSpeedMult = Roll(random, flag4, flag ? 0.9f : 0.7f, flag ? 1.2f : 1.55f);
			float reloadTimeMult = Roll(random, flag4, flag ? 0.82f : 0.68f, flag ? 1.16f : 1.55f);
			float projectileSpeedMult = Roll(random, flag4, flag ? 0.88f : 0.72f, flag ? 1.22f : 1.58f);
			float ammoMult = Roll(random, flag4, flag ? 0.92f : 0.7f, flag ? 1.22f : 1.6f);
			float healthMult = Roll(random, flag4, flag ? 0.94f : 0.7f, flag ? 1.3f : 1.6f);
			float moveSpeedMult = Roll(random, flag4, flag ? 0.92f : 0.72f, flag ? 1.24f : 1.55f);
			float gravityMult = Roll(random, flag4, flag ? 0.82f : 0.72f, flag ? 1.18f : 1.45f);
			float blockCooldownMult = Roll(random, curse: false, flag ? 0.58f : 0.7f, flag ? 0.92f : 1.55f);
			SpecialMode specialMode = (flag3 ? RandomizerSpecialPool[index - 201] : (flag2 ? RerollSpecialPool[index - 181] : (flag ? BlockSpecialPool[random.Next(BlockSpecialPool.Length)] : SpecialPool[random.Next(SpecialPool.Length)])));
			int count = ((!flag && !flag2 && !flag3 && random.NextDouble() < 0.18) ? random.Next(4, 6) : ((random.NextDouble() < 0.7) ? 2 : 3));
			bool[] array = (flag3 ? new bool[9] : (flag2 ? PickPrimaryStats(random, 3) : (flag ? PickBlockStats(random) : PickPrimaryStats(random, count))));
			string arg = (flag3 ? RandomizerTitles[index - 201] : (flag2 ? (RerollPrefixes[num % RerollPrefixes.Length] + " " + RerollSuffixes[num / RerollPrefixes.Length % RerollSuffixes.Length]) : (flag ? (BlockPrefixes[num % BlockPrefixes.Length] + " " + BlockSuffixes[num / BlockPrefixes.Length % BlockSuffixes.Length]) : (Prefixes[num % Prefixes.Length] + " " + Suffixes[num / Prefixes.Length % Suffixes.Length]))));
			string text = (flag3 ? "Randomizer" : (flag2 ? "Reroll" : (flag ? "Block" : (flag4 ? "Curse" : "Perk"))));
			string text2 = specialMode switch
			{
				SpecialMode.CoinFlip => "Coinflip effect on pickup.", 
				SpecialMode.TinyBullets => "Tiny bullets and handling boost.", 
				SpecialMode.BigBullets => "Big bullets with heavy punch.", 
				SpecialMode.HyperJump => "Low-gravity jump style.", 
				SpecialMode.HeavyBoots => "Heavy gravity grounded style.", 
				SpecialMode.StatLottery => "Random bonus and penalty every pickup.", 
				SpecialMode.GravityFlip => "Randomly flips between moon and heavy gravity.", 
				SpecialMode.GlassOverdrive => "Huge offense at a survivability cost.", 
				SpecialMode.TankMode => "Tank burst: health up, speed down, damage up.", 
				SpecialMode.ChaosGift => "Random jackpot or tax on pickup.", 
				SpecialMode.VampBurst => "Steals bulk via hp boost plus ammo tax.", 
				SpecialMode.MomentumRush => "Each pickup rolls speed-focused or power-focused mode.", 
				SpecialMode.AmmoForge => "Converts reload rhythm into ammo pressure.", 
				SpecialMode.PhaseStep => "Block phase boost: mobility and cooldown swing.", 
				SpecialMode.Reversal => "Swaps one strong upside with one random downside.", 
				SpecialMode.RicochetDance => "Fast rounds with agile rhythm and softer hits.", 
				SpecialMode.BerserkerCore => "Aggro core: high output with fragile body.", 
				SpecialMode.SniperStance => "Slow stance, long-range precision burst.", 
				SpecialMode.CloseQuarters => "Close-fight damage and speed, weaker range.", 
				SpecialMode.BlinkStep => "Quick mobility with lighter gravity and better block pace.", 
				SpecialMode.Overclock => "Rapid fire engine, burns through magazine quality.", 
				SpecialMode.FrostCore => "Tanky chill core with heavier movement.", 
				SpecialMode.InfernalTrade => "Big damage bargain at a health cost.", 
				SpecialMode.AeroGlass => "Aerial speed and velocity for glass builds.", 
				SpecialMode.AnchorHeart => "Heavy anchor body with massive durability.", 
				SpecialMode.DiceAmmo => "Ammo pool rerolls each pickup.", 
				SpecialMode.TwinPulse => "Two random pulses buff your build.", 
				SpecialMode.LastStand => "Risky low-health high-impact setup.", 
				SpecialMode.FeatherFall => "Floaty movement with risky defense profile.", 
				SpecialMode.IronSkin => "Durable shell with slower offense.", 
				SpecialMode.BloodTax => "Power now, sustain later.", 
				SpecialMode.TurboBlock => "Aggressive block cycle with tradeoff on gun rhythm.", 
				SpecialMode.StaticCharge => "Charged shots with unstable timing.", 
				SpecialMode.LongGame => "Economy setup for longer rounds.", 
				SpecialMode.WildMagic => "Unpredictable triple-roll blessing or curse.", 
				SpecialMode.QuantumFlux => "Randomly applies 2-4 chaotic stat shifts instantly.", 
				SpecialMode.ProbabilityStorm => "50% chance each stat becomes extremely good or bad.", 
				SpecialMode.RealityWarp => "Creates extreme stat opposites for high-risk gameplay.", 
				SpecialMode.LuckyDraw => "70% excellent buffs, 30% severe penalties.", 
				SpecialMode.ChaoticMerge => "Blends 3 different special effect combinations.", 
				SpecialMode.OverdriveLottery => "Multiple random effect rolls stacked for chaos.", 
				SpecialMode.QuantumTangle => "Links stats: one rises, another falls unpredictably.", 
				SpecialMode.VortexSwap => "Randomly swaps your stat multipliers with each other.", 
				SpecialMode.InfinityStone => "Alternates between amazing and terrible every action.", 
				SpecialMode.PrimalChaosShift => "Pure random extreme shifts with wild combinations.", 
				SpecialMode.RocketFuse => "Slow rocket rounds with splash pressure.", 
				SpecialMode.BlastCore => "Direct explosive payload on every shot.", 
				SpecialMode.WallPiercer => "Shots phase through walls with lighter punch.", 
				SpecialMode.GhostRounds => "Wall-passing portal rounds with unstable damage.", 
				SpecialMode.RicochetEngine => "Ricochet bullets that bounce around the arena.", 
				SpecialMode.PinballShells => "Extra ricochets and speed for chaos angles.", 
				SpecialMode.PortalShot => "Portal-linked rounds with a tighter firing profile.", 
				SpecialMode.BunkerBuster => "Wall-breaching explosive shells for cover pressure.", 
				SpecialMode.ScatterMissiles => "Split rocket volley with reduced per-shot power.", 
				SpecialMode.PhaseRocket => "Ghost rocket that drifts through walls before bursting.", 
				SpecialMode.DrillRounds => "Long-travel drilling shots that ignore terrain.", 
				SpecialMode.SiegePayload => "Heavy siege shell with large blast and reload tax.", 
				SpecialMode.ShrapnelBurst => "Fragmenting spread that fills space with pressure.", 
				SpecialMode.MeteorShells => "Huge falling shells with chunky explosions.", 
				SpecialMode.EchoWarp => "Portal splash rounds with warped tempo.", 
				SpecialMode.AegisField => "Blocking wraps your bullets in a growing force field.", 
				SpecialMode.ShockRing => "Block releases a custom shock ring that hurts and shoves enemies.", 
				SpecialMode.ReloadCache => "Each block refills ammo and improves gun rhythm.", 
				SpecialMode.MedicPulse => "Block converts timing into instant healing.", 
				SpecialMode.WarpStepBlock => "Block launches you in your aim direction.", 
				SpecialMode.GravityBubble => "Block creates a floaty mobility bubble around you.", 
				SpecialMode.MirrorShell => "Block arms your shots with bouncing mirror shells.", 
				SpecialMode.GhostScreen => "Block charges phase shots that pass walls.", 
				SpecialMode.SiegeReserve => "Blocking stockpiles siege payload into your gun.", 
				SpecialMode.ShrapnelGuard => "Block loads fragmentation scatter into the next volleys.", 
				SpecialMode.OverhealDrive => "Block overheals your build and thickens the shell.", 
				SpecialMode.NovaBrake => "Block emits a braking nova that blasts space open.", 
				SpecialMode.ForceWall => "Block inflates a heavy force field around every bullet.", 
				SpecialMode.RicochetWard => "Block wards your gun with ricochet splash rounds.", 
				SpecialMode.PhaseBattery => "Blocking stores portal and phase energy for shots.", 
				SpecialMode.RerollSomeAllPlayers => "Rerolls some cards from every player.", 
				SpecialMode.RerollSomeOwnCards => "Rerolls some cards only from you.", 
				SpecialMode.RerollAllOwnCards => "Rerolls all your cards.", 
				SpecialMode.RerollAllPlayersCards => "Rerolls all cards from everyone.", 
				SpecialMode.RerollHalfOwnCards => "Rerolls half your cards.", 
				SpecialMode.RerollHalfAllPlayers => "Rerolls half of all players cards.", 
				SpecialMode.RerollOneEachPlayer => "Rerolls one card for each player.", 
				SpecialMode.RerollTwoOwnCards => "Rerolls two of your cards.", 
				SpecialMode.RerollTwoEachPlayer => "Rerolls two cards for each player.", 
				SpecialMode.RerollAllOthers => "Rerolls all cards for everyone except you.", 
				SpecialMode.GiveSelfRandomOneToFive => "Gives you 1-5 random cards (includes mod cards).", 
				SpecialMode.RandomizeAllPlayersNewCards => "Replaces all players cards with random new cards.", 
				SpecialMode.GiveRandomPlayersRandomCards => "Random players each receive random cards.", 
				SpecialMode.GiveEveryoneOneToThree => "Every player gets 1-3 random cards.", 
				SpecialMode.RandomizeOthersOnly => "Rerolls every other player while keeping your build.", 
				SpecialMode.GiveSelfAndOthersBurst => "You get a burst, then others get random gifts.", 
				SpecialMode.RandomizeHalfAllThenGift => "Half-rerolls everyone, then grants bonus random cards.", 
				SpecialMode.TaxAndGiftChaos => "Removes random cards from you and gifts random cards to others.", 
				SpecialMode.PartyDraft => "Draft event: each player gains 2 random cards.", 
				SpecialMode.FullTableChaos => "Full-table shuffle plus random bonus distribution.", 
				_ => "Balanced modifier set.", 
			};
			Rarity rarity = (Rarity)0;
			switch (num % 5)
			{
			case 2:
			case 3:
				rarity = (Rarity)1;
				break;
			case 4:
				rarity = (Rarity)2;
				break;
			}
			if (flag)
			{
				rarity = (Rarity)2;
			}
			else if (flag2)
			{
				rarity = (Rarity)2;
			}
			else if (flag3)
			{
				rarity = (Rarity)2;
			}
			CardThemeColorType theme = (CardThemeColorType)(flag3 ? 4 : (flag2 ? 1 : (flag ? 2 : (flag4 ? 4 : ((num % 2 == 0) ? 1 : 2)))));
			return new CardSpec
			{
				Title = $"{arg} #{index:000}",
				Description = text + ": " + text2,
				Rarity = rarity,
				Theme = theme,
				DamageMult = damageMult,
				AttackSpeedMult = attackSpeedMult,
				ReloadTimeMult = reloadTimeMult,
				ProjectileSpeedMult = projectileSpeedMult,
				AmmoMult = ammoMult,
				HealthMult = healthMult,
				MoveSpeedMult = moveSpeedMult,
				GravityMult = gravityMult,
				BlockCooldownMult = blockCooldownMult,
				Special = specialMode,
				UseDamage = array[0],
				UseAttackSpeed = array[1],
				UseReload = array[2],
				UseProjectileSpeed = array[3],
				UseAmmo = array[4],
				UseHealth = array[5],
				UseMoveSpeed = array[6],
				UseGravity = array[7],
				UseBlockCooldown = array[8]
			};
		}

		private static bool[] PickPrimaryStats(Random rng, int count)
		{
			bool[] array = new bool[9];
			foreach (int item in (from _ in Enumerable.Range(0, 9)
				orderby rng.Next()
				select _).Take(count).ToList())
			{
				array[item] = true;
			}
			return array;
		}

		private static bool[] PickBlockStats(Random rng)
		{
			bool[] array = new bool[9] { false, false, false, false, false, false, false, false, true };
			int[] source = new int[6] { 5, 6, 2, 4, 7, 0 };
			foreach (int item in Enumerable.Take(count: (rng.NextDouble() < 0.7) ? 2 : 3, source: source.OrderBy((int _) => rng.Next())))
			{
				array[item] = true;
			}
			return array;
		}

		private static float Roll(Random rng, bool curse, float min, float max)
		{
			float num = (float)rng.NextDouble();
			float num2 = Mathf.Lerp(min, max, num);
			if (curse)
			{
				if (rng.NextDouble() < 0.65)
				{
					num2 = Mathf.Min(1f, num2);
				}
			}
			else if (rng.NextDouble() < 0.65)
			{
				num2 = Mathf.Max(1f, num2);
			}
			return Mathf.Clamp((float)Math.Round(num2, 2), 0.65f, 1.65f);
		}
	}
	public abstract class GeneratedCardBase : CustomCard
	{
		private static readonly Dictionary<int, CardSpec> SpecCache = new Dictionary<int, CardSpec>();

		private static readonly object SpecCacheLock = new object();

		private static readonly Dictionary<string, FieldInfo> FieldCache = new Dictionary<string, FieldInfo>();

		private static readonly MethodInfo ApplyStatsMethod = typeof(ApplyCardStats).GetMethod("ApplyStats", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		protected abstract int CardIndex { get; }

		private CardSpec Spec => GetSpec(CardIndex);

		private static CardSpec GetSpec(int index)
		{
			lock (SpecCacheLock)
			{
				if (!SpecCache.TryGetValue(index, out var value))
				{
					value = CardSpecFactory.Create(index);
					SpecCache[index] = value;
				}
				return value;
			}
		}

		protected override string GetTitle()
		{
			return Spec.Title;
		}

		protected override string GetDescription()
		{
			return Spec.Description;
		}

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

		protected override CardThemeColorType GetTheme()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Spec.Theme;
		}

		protected override GameObject GetCardArt()
		{
			return CardVisualFactory.CreateArtVariant(CardIndex);
		}

		protected override GameObject GetCardBase()
		{
			return CardVisualFactory.CardBase;
		}

		public override bool GetEnabled()
		{
			return CardAvailabilityGate.IsEnabled(CardIndex);
		}

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

		protected override CardInfoStat[] GetStats()
		{
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			List<CardInfoStat> source = new List<CardInfoStat>
			{
				Stat("Damage", Spec.DamageMult, Spec.UseDamage),
				Stat("Attack Speed", Spec.AttackSpeedMult, Spec.UseAttackSpeed),
				Stat("Reload", Spec.ReloadTimeMult, Spec.UseReload),
				Stat("Projectile Speed", Spec.ProjectileSpeedMult, Spec.UseProjectileSpeed),
				Stat("Ammo", Spec.AmmoMult, Spec.UseAmmo),
				Stat("Health", Spec.HealthMult, Spec.UseHealth),
				Stat("Move Speed", Spec.MoveSpeedMult, Spec.UseMoveSpeed),
				Stat("Gravity", Spec.GravityMult, Spec.UseGravity),
				Stat("Block Cooldown", Spec.BlockCooldownMult, Spec.UseBlockCooldown)
			};
			source = source.Where((CardInfoStat s) => s != null).ToList();
			if (Spec.Special != 0)
			{
				source.Add(new CardInfoStat
				{
					stat = "Extra",
					amount = Spec.Special.ToString(),
					positive = true,
					simepleAmount = (SimpleAmount)2
				});
			}
			return source.ToArray();
		}

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

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			EnsureBlockPowerTracker(player)?.Register(Spec.Special);
			if (Spec.Special == SpecialMode.CoinFlip)
			{
				float multiplier = ((Random.value > 0.5f) ? 1.3f : 0.8f);
				TryScaleFloat(gun, new string[1] { "damage" }, multiplier);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, multiplier);
			}
			else if (Spec.Special == SpecialMode.TinyBullets)
			{
				TryScaleFloat(gun, new string[3] { "projectileSize", "bulletSize", "size" }, 0.75f);
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 1.12f);
			}
			else if (Spec.Special == SpecialMode.BigBullets)
			{
				TryScaleFloat(gun, new string[3] { "projectileSize", "bulletSize", "size" }, 1.35f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.15f);
			}
			else if (Spec.Special == SpecialMode.HyperJump)
			{
				TryScaleFloat(characterStats, new string[3] { "jump", "jumpImpulse", "jumpPower" }, 1.35f);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 0.82f);
			}
			else if (Spec.Special == SpecialMode.HeavyBoots)
			{
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 1.25f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.9f);
			}
			else if (Spec.Special == SpecialMode.StatLottery)
			{
				ApplyLottery(gun, characterStats, block);
			}
			else if (Spec.Special == SpecialMode.GravityFlip)
			{
				float multiplier2 = ((Random.value > 0.5f) ? 0.65f : 1.45f);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, multiplier2);
			}
			else if (Spec.Special == SpecialMode.GlassOverdrive)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, 1.45f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.2f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.75f);
			}
			else if (Spec.Special == SpecialMode.TankMode)
			{
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.35f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.8f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.15f);
			}
			else if (Spec.Special == SpecialMode.ChaosGift)
			{
				float value = Random.value;
				if (value < 0.2f)
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 1.7f);
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.25f);
				}
				else if (value < 0.4f)
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 0.72f);
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.78f);
				}
			}
			else if (Spec.Special == SpecialMode.VampBurst)
			{
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.18f);
				TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, 0.85f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.1f);
			}
			else if (Spec.Special == SpecialMode.MomentumRush)
			{
				if (Random.value > 0.5f)
				{
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.3f);
					TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.2f);
				}
				else
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 1.25f);
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.88f);
				}
			}
			else if (Spec.Special == SpecialMode.AmmoForge)
			{
				TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, 1.25f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.15f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.PhaseStep)
			{
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, 0.8f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.15f);
			}
			else if (Spec.Special == SpecialMode.Reversal)
			{
				int num = Random.Range(0, 3);
				int num2 = Random.Range(0, 3);
				if (num == 0)
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 1.35f);
				}
				if (num == 1)
				{
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.25f);
				}
				if (num == 2)
				{
					TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.75f);
				}
				if (num2 == 0)
				{
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.82f);
				}
				if (num2 == 1)
				{
					TryScaleFloat(characterStats, new string[1] { "gravity" }, 1.2f);
				}
				if (num2 == 2)
				{
					TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, 0.85f);
				}
			}
			else if (Spec.Special == SpecialMode.RicochetDance)
			{
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.28f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.88f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.92f);
			}
			else if (Spec.Special == SpecialMode.BerserkerCore)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, 1.35f);
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 1.2f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.78f);
			}
			else if (Spec.Special == SpecialMode.SniperStance)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, 1.4f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.35f);
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 0.8f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.88f);
			}
			else if (Spec.Special == SpecialMode.CloseQuarters)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, 1.22f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.18f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 0.85f);
			}
			else if (Spec.Special == SpecialMode.BlinkStep)
			{
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.2f);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 0.8f);
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, 0.85f);
			}
			else if (Spec.Special == SpecialMode.Overclock)
			{
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 1.28f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.82f);
				TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, 0.86f);
			}
			else if (Spec.Special == SpecialMode.FrostCore)
			{
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.26f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.86f);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 1.12f);
			}
			else if (Spec.Special == SpecialMode.InfernalTrade)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, 1.45f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.15f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.74f);
			}
			else if (Spec.Special == SpecialMode.AeroGlass)
			{
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.24f);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 0.78f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.2f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.82f);
			}
			else if (Spec.Special == SpecialMode.AnchorHeart)
			{
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.34f);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 1.2f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.82f);
			}
			else if (Spec.Special == SpecialMode.DiceAmmo)
			{
				float multiplier3 = ((Random.value > 0.5f) ? 1.45f : 0.7f);
				TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, multiplier3);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.TwinPulse)
			{
				int pulse = Random.Range(0, 4);
				int pulse2 = Random.Range(0, 4);
				ApplyPulse(pulse, gun, characterStats, block);
				ApplyPulse(pulse2, gun, characterStats, block);
			}
			else if (Spec.Special == SpecialMode.LastStand)
			{
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.72f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.38f);
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, 0.88f);
			}
			else if (Spec.Special == SpecialMode.FeatherFall)
			{
				TryScaleFloat(characterStats, new string[1] { "gravity" }, 0.68f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.16f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.86f);
			}
			else if (Spec.Special == SpecialMode.IronSkin)
			{
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.32f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.84f);
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 0.9f);
			}
			else if (Spec.Special == SpecialMode.BloodTax)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, 1.28f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.82f);
				TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, 0.88f);
			}
			else if (Spec.Special == SpecialMode.TurboBlock)
			{
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, 0.72f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.12f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.12f);
			}
			else if (Spec.Special == SpecialMode.StaticCharge)
			{
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.22f);
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 1.12f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.1f);
			}
			else if (Spec.Special == SpecialMode.LongGame)
			{
				TryScaleFloat(gunAmmo, new string[2] { "maxAmmo", "ammo" }, 1.35f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.92f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.94f);
			}
			else if (Spec.Special == SpecialMode.WildMagic)
			{
				for (int i = 0; i < 3; i++)
				{
					ApplyPulse(Random.Range(0, 6), gun, characterStats, block);
				}
			}
			else if (Spec.Special == SpecialMode.QuantumFlux)
			{
				int num3 = Random.Range(2, 5);
				for (int j = 0; j < num3; j++)
				{
					ApplyPulse(Random.Range(0, 6), gun, characterStats, block);
				}
			}
			else if (Spec.Special == SpecialMode.ProbabilityStorm)
			{
				if (Random.value > 0.5f)
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 1.5f);
				}
				else
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 0.65f);
				}
				if (Random.value > 0.5f)
				{
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.45f);
				}
				else
				{
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 0.7f);
				}
				if (Random.value > 0.5f)
				{
					TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.72f);
				}
				else
				{
					TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.38f);
				}
				if (Random.value > 0.5f)
				{
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.48f);
				}
				else
				{
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.68f);
				}
			}
			else if (Spec.Special == SpecialMode.RealityWarp)
			{
				float num4 = ((Random.value > 0.5f) ? 1.55f : 0.68f);
				TryScaleFloat(gun, new string[1] { "damage" }, num4);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, (num4 > 1f) ? 0.72f : 1.48f);
				float num5 = ((Random.value > 0.5f) ? 1.5f : 0.7f);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, num5);
				TryScaleFloat(characterStats, new string[1] { "gravity" }, (num5 > 1f) ? 1.3f : 0.78f);
			}
			else if (Spec.Special == SpecialMode.LuckyDraw)
			{
				if (Random.value < 0.7f)
				{
					ApplyPulse(0, gun, characterStats, block);
					ApplyPulse(2, gun, characterStats, block);
					return;
				}
				TryScaleFloat(gun, new string[1] { "damage" }, 0.65f);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.7f);
			}
			else if (Spec.Special == SpecialMode.ChaoticMerge)
			{
				int pulse3 = Random.Range(0, 6);
				int pulse4 = Random.Range(0, 6);
				int pulse5 = Random.Range(0, 6);
				ApplyPulse(pulse3, gun, characterStats, block);
				ApplyPulse(pulse4, gun, characterStats, block);
				ApplyPulse(pulse5, gun, characterStats, block);
			}
			else if (Spec.Special == SpecialMode.OverdriveLottery)
			{
				ApplyLottery(gun, characterStats, block);
				if (Random.value > 0.5f)
				{
					ApplyLottery(gun, characterStats, block);
				}
			}
			else if (Spec.Special == SpecialMode.QuantumTangle)
			{
				int num6 = Random.Range(0, 3);
				float num7 = ((Random.value > 0.5f) ? 1.3f : 0.77f);
				switch (num6)
				{
				case 0:
					TryScaleFloat(gun, new string[1] { "damage" }, num7);
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, (num7 > 1f) ? 0.8f : 1.25f);
					break;
				case 1:
					TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, num7);
					TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, (num7 > 1f) ? 0.85f : 1.2f);
					break;
				default:
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, num7);
					TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, (num7 > 1f) ? 1.15f : 0.88f);
					break;
				}
			}
			else if (Spec.Special == SpecialMode.VortexSwap)
			{
				float[] array = new float[6] { 1.35f, 0.75f, 1.25f, 0.8f, 1.4f, 0.7f };
				float multiplier4 = array[Random.Range(0, array.Length)];
				float multiplier5 = array[Random.Range(0, array.Length)];
				TryScaleFloat(gun, new string[1] { "damage" }, multiplier4);
				TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, multiplier5);
				TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, array[Random.Range(0, array.Length)]);
			}
			else if (Spec.Special == SpecialMode.InfinityStone)
			{
				if (Random.value > 0.5f)
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 1.6f);
					TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.5f);
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 1.55f);
				}
				else
				{
					TryScaleFloat(gun, new string[1] { "damage" }, 0.62f);
					TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.65f);
					TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.4f);
				}
			}
			else if (Spec.Special == SpecialMode.PrimalChaosShift)
			{
				for (int k = 0; k < 2; k++)
				{
					if (Random.value > 0.5f)
					{
						TryScaleFloat(gun, new string[1] { "damage" }, 1.4f);
						TryScaleFloat(characterStats, new string[2] { "health", "maxHealth" }, 0.75f);
					}
					else
					{
						TryScaleFloat(characterStats, new string[1] { "movementSpeed" }, 1.38f);
						TryScaleFloat(characterStats, new string[1] { "gravity" }, 0.8f);
					}
				}
			}
			else if (Spec.Special == SpecialMode.RocketFuse)
			{
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 0.8f);
				TryScaleFloat(gun, new string[3] { "projectileSize", "bulletSize", "size" }, 1.15f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 0.85f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.38f);
			}
			else if (Spec.Special == SpecialMode.BlastCore)
			{
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 1.1f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.48f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.WallPiercer)
			{
				TrySetBool(gun, new string[1] { "ignoreWalls" }, value: true);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.94f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.GhostRounds)
			{
				TrySetBool(gun, new string[1] { "ignoreWalls" }, value: true);
				TryAddInt(gun, new string[1] { "bulletPortal" }, 1);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.9f);
			}
			else if (Spec.Special == SpecialMode.RicochetEngine)
			{
				TryAddInt(gun, new string[1] { "reflects" }, 2);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.93f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.PinballShells)
			{
				TryAddInt(gun, new string[1] { "reflects" }, 3);
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, 1.08f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.86f);
			}
			else if (Spec.Special == SpecialMode.PortalShot)
			{
				TryAddInt(gun, new string[1] { "bulletPortal" }, 1);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 0.92f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.BunkerBuster)
			{
				TrySetBool(gun, new string[1] { "ignoreWalls" }, value: true);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 0.95f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.44f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.14f);
				TryScaleFloat(gun, new string[1] { "damage" }, 1.08f);
			}
			else if (Spec.Special == SpecialMode.ScatterMissiles)
			{
				TryAddInt(gun, new string[1] { "numberOfProjectiles" }, 1);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 0.65f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.26f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 0.84f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.82f);
			}
			else if (Spec.Special == SpecialMode.PhaseRocket)
			{
				TrySetBool(gun, new string[1] { "ignoreWalls" }, value: true);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 0.75f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.3f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 0.88f);
			}
			else if (Spec.Special == SpecialMode.DrillRounds)
			{
				TrySetBool(gun, new string[1] { "ignoreWalls" }, value: true);
				TrySetFloat(gun, new string[1] { "destroyBulletAfter" }, 6f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.1f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.92f);
			}
			else if (Spec.Special == SpecialMode.SiegePayload)
			{
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 1.3f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.55f);
				TryScaleFloat(gun, new string[3] { "projectileSize", "bulletSize", "size" }, 1.24f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.18f);
			}
			else if (Spec.Special == SpecialMode.ShrapnelBurst)
			{
				TryAddInt(gun, new string[1] { "numberOfProjectiles" }, 2);
				TryScaleFloat(gun, new string[3] { "projectileSize", "bulletSize", "size" }, 0.86f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.8f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.06f);
			}
			else if (Spec.Special == SpecialMode.MeteorShells)
			{
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 1.45f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.62f);
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 0.72f);
				TryScaleFloat(gun, new string[3] { "projectileSize", "bulletSize", "size" }, 1.3f);
			}
			else if (Spec.Special == SpecialMode.EchoWarp)
			{
				TryAddInt(gun, new string[1] { "bulletPortal" }, 1);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyRange" }, 0.8f);
				TrySetFloat(gun, new string[1] { "explodeNearEnemyDamage" }, 0.32f);
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 1.1f);
			}
			else if (Spec.Special == SpecialMode.RerollSomeAllPlayers)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: false, 0.35f, 0);
			}
			else if (Spec.Special == SpecialMode.RerollSomeOwnCards)
			{
				RerollCards(player, includeSelf: true, includeOthers: false, rerollAll: false, 0.45f, 0);
			}
			else if (Spec.Special == SpecialMode.RerollAllOwnCards)
			{
				RerollCards(player, includeSelf: true, includeOthers: false, rerollAll: true, 1f, 0);
			}
			else if (Spec.Special == SpecialMode.RerollAllPlayersCards)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: true, 1f, 0);
			}
			else if (Spec.Special == SpecialMode.RerollHalfOwnCards)
			{
				RerollCards(player, includeSelf: true, includeOthers: false, rerollAll: false, 0.5f, 0);
			}
			else if (Spec.Special == SpecialMode.RerollHalfAllPlayers)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: false, 0.5f, 0);
			}
			else if (Spec.Special == SpecialMode.RerollOneEachPlayer)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: false, 0f, 1);
			}
			else if (Spec.Special == SpecialMode.RerollTwoOwnCards)
			{
				RerollCards(player, includeSelf: true, includeOthers: false, rerollAll: false, 0f, 2);
			}
			else if (Spec.Special == SpecialMode.RerollTwoEachPlayer)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: false, 0f, 2);
			}
			else if (Spec.Special == SpecialMode.RerollAllOthers)
			{
				RerollCards(player, includeSelf: false, includeOthers: true, rerollAll: true, 1f, 0);
			}
			else if (Spec.Special == SpecialMode.GiveSelfRandomOneToFive)
			{
				GiveRandomCards(player, Random.Range(1, 6));
			}
			else if (Spec.Special == SpecialMode.RandomizeAllPlayersNewCards)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: true, 1f, 0);
			}
			else if (Spec.Special == SpecialMode.GiveRandomPlayersRandomCards)
			{
				GiveRandomCardsToRandomPlayers(player, 1, 3, 1, 3, includeSelf: true);
			}
			else if (Spec.Special == SpecialMode.GiveEveryoneOneToThree)
			{
				GiveEveryoneRandomCards(1, 3, includeSelf: true, player);
			}
			else if (Spec.Special == SpecialMode.RandomizeOthersOnly)
			{
				RerollCards(player, includeSelf: false, includeOthers: true, rerollAll: true, 1f, 0);
			}
			else if (Spec.Special == SpecialMode.GiveSelfAndOthersBurst)
			{
				GiveRandomCards(player, Random.Range(2, 5));
				GiveRandomCardsToRandomPlayers(player, 1, 3, 1, 2, includeSelf: false);
			}
			else if (Spec.Special == SpecialMode.RandomizeHalfAllThenGift)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: false, 0.5f, 0);
				GiveRandomCardsToRandomPlayers(player, 2, 4, 1, 2, includeSelf: true);
			}
			else if (Spec.Special == SpecialMode.TaxAndGiftChaos)
			{
				RemoveRandomOwnCards(player, Random.Range(1, 3));
				GiveRandomCardsToRandomPlayers(player, 1, 4, 1, 2, includeSelf: false);
			}
			else if (Spec.Special == SpecialMode.PartyDraft)
			{
				GiveEveryoneRandomCards(2, 2, includeSelf: true, player);
			}
			else if (Spec.Special == SpecialMode.FullTableChaos)
			{
				RerollCards(player, includeSelf: true, includeOthers: true, rerollAll: true, 1f, 0);
				GiveEveryoneRandomCards(1, 2, includeSelf: true, player);
			}
		}

		private static BlockPowerTracker EnsureBlockPowerTracker(Player player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return null;
			}
			BlockPowerTracker blockPowerTracker = ((Component)player).gameObject.GetComponent<BlockPowerTracker>();
			if ((Object)(object)blockPowerTracker == (Object)null)
			{
				blockPowerTracker = ((Component)player).gameObject.AddComponent<BlockPowerTracker>();
			}
			return blockPowerTracker;
		}

		private static void RerollCards(Player source, bool includeSelf, bool includeOthers, bool rerollAll, float fraction, int fixedCount)
		{
			CardInfo[] cardPool = GetCardPool();
			if (cardPool == null || cardPool.Length == 0)
			{
				return;
			}
			List<Player> activePlayers = GetActivePlayers();
			bool flag = false;
			foreach (Player item in activePlayers)
			{
				bool flag2 = (Object)(object)source != (Object)null && item.playerID == source.playerID;
				if ((flag2 && !includeSelf) || (!flag2 && !includeOthers))
				{
					continue;
				}
				List<CardInfo> currentCards = item.data.currentCards;
				if (currentCards == null || currentCards.Count == 0)
				{
					continue;
				}
				int count = (rerollAll ? currentCards.Count : ((fixedCount > 0) ? Mathf.Min(fixedCount, currentCards.Count) : Mathf.Clamp(Mathf.RoundToInt((float)currentCards.Count * fraction), 1, currentCards.Count)));
				foreach (int item2 in (from _ in Enumerable.Range(0, currentCards.Count)
					orderby Random.value
					select _).Take(count).ToList())
				{
					CardInfo current3 = currentCards[item2];
					CardInfo randomReplacement = GetRandomReplacement(cardPool, current3);
					if ((Object)(object)randomReplacement != (Object)null)
					{
						currentCards[item2] = randomReplacement;
						flag = true;
					}
				}
			}
			if (flag)
			{
				RefreshCards(activePlayers);
			}
		}

		private static void GiveRandomCards(Player target, int count)
		{
			if ((Object)(object)target == (Object)null || (Object)(object)target.data == (Object)null)
			{
				return;
			}
			CardInfo[] cardPool = GetCardPool();
			if (cardPool == null || cardPool.Length == 0)
			{
				return;
			}
			List<CardInfo> currentCards = target.data.currentCards;
			if (currentCards == null)
			{
				return;
			}
			int num = Mathf.Clamp(count, 1, 5);
			for (int i = 0; i < num; i++)
			{
				CardInfo randomReplacement = GetRandomReplacement(cardPool, null);
				if ((Object)(object)randomReplacement != (Object)null)
				{
					currentCards.Add(randomReplacement);
				}
			}
			RefreshCards(GetActivePlayers());
		}

		private static void GiveEveryoneRandomCards(int minCards, int maxCards, bool includeSelf, Player source)
		{
			CardInfo[] cardPool = GetCardPool();
			if (cardPool == null || cardPool.Length == 0)
			{
				return;
			}
			List<Player> activePlayers = GetActivePlayers();
			bool flag = false;
			foreach (Player item in activePlayers)
			{
				bool flag2 = (Object)(object)source != (Object)null && item.playerID == source.playerID;
				if (!includeSelf && flag2)
				{
					continue;
				}
				List<CardInfo> currentCards = item.data.currentCards;
				if (currentCards == null)
				{
					continue;
				}
				int num = Random.Range(minCards, maxCards + 1);
				for (int i = 0; i < num; i++)
				{
					CardInfo randomReplacement = GetRandomReplacement(cardPool, null);
					if ((Object)(object)randomReplacement != (Object)null)
					{
						currentCards.Add(randomReplacement);
						flag = true;
					}
				}
			}
			if (flag)
			{
				RefreshCards(activePlayers);
			}
		}

		private static void GiveRandomCardsToRandomPlayers(Player source, int minTargets, int maxTargets, int minCards, int maxCards, bool includeSelf)
		{
			CardInfo[] cardPool = GetCardPool();
			if (cardPool == null || cardPool.Length == 0)
			{
				return;
			}
			List<Player> activePlayers = GetActivePlayers();
			List<Player> list = (from p in activePlayers
				where includeSelf || (Object)(object)source == (Object)null || p.playerID != source.playerID
				select p into _
				orderby Random.value
				select _).ToList();
			if (list.Count == 0)
			{
				return;
			}
			int count = Mathf.Clamp(Random.Range(minTargets, maxTargets + 1), 1, list.Count);
			bool flag = false;
			foreach (Player item in list.Take(count))
			{
				List<CardInfo> currentCards = item.data.currentCards;
				if (currentCards == null)
				{
					continue;
				}
				int num = Random.Range(minCards, maxCards + 1);
				for (int i = 0; i < num; i++)
				{
					CardInfo randomReplacement = GetRandomReplacement(cardPool, null);
					if ((Object)(object)randomReplacement != (Object)null)
					{
						currentCards.Add(randomReplacement);
						flag = true;
					}
				}
			}
			if (flag)
			{
				RefreshCards(activePlayers);
			}
		}

		private static void RemoveRandomOwnCards(Player player, int removeCount)
		{
			if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.currentCards == null)
			{
				return;
			}
			List<CardInfo> currentCards = player.data.currentCards;
			if (currentCards.Count <= 1)
			{
				return;
			}
			int count = Mathf.Clamp(removeCount, 1, Mathf.Max(1, currentCards.Count - 1));
			foreach (int item in (from i in (from _ in Enumerable.Range(0, currentCards.Count)
					orderby Random.value
					select _).Take(count)
				orderby i descending
				select i).ToList())
			{
				if (item >= 0 && item < currentCards.Count)
				{
					currentCards.RemoveAt(item);
				}
			}
			RefreshCards(GetActivePlayers());
		}

		private static CardInfo[] GetCardPool()
		{
			if (!((Object)(object)CardChoice.instance != (Object)null))
			{
				return null;
			}
			return CardChoice.instance.cards;
		}

		private static List<Player> GetActivePlayers()
		{
			return (from p in Object.FindObjectsOfType<Player>()
				where (Object)(object)p != (Object)null && (Object)(object)p.data != (Object)null && !p.data.dead && p.data.currentCards != null
				select p).ToList();
		}

		private static void RefreshCards(List<Player> players)
		{
			if (players == null || players.Count == 0)
			{
				return;
			}
			foreach (Player player in players)
			{
				ApplyCardStats componentInChildren = ((Component)player).GetComponentInChildren<ApplyCardStats>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					ApplyStatsMethod?.Invoke(componentInChildren, null);
				}
			}
			if ((Object)(object)CardBarHandler.instance == (Object)null)
			{
				return;
			}
			CardBarHandler.instance.ResetCardBards();
			foreach (Player player2 in players)
			{
				foreach (CardInfo currentCard in player2.data.currentCards)
				{
					if ((Object)(object)currentCard != (Object)null)
					{
						CardBarHandler.instance.AddCard(player2.teamID, currentCard);
					}
				}
			}
		}

		private static CardInfo GetRandomReplacement(CardInfo[] cardPool, CardInfo current)
		{
			for (int i = 0; i < 24; i++)
			{
				CardInfo val = cardPool[Random.Range(0, cardPool.Length)];
				if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)current)
				{
					return val;
				}
			}
			return current;
		}

		private static void ApplyPulse(int pulse, Gun gun, CharacterStatModifiers stats, Block block)
		{
			switch (pulse)
			{
			case 0:
				TryScaleFloat(gun, new string[1] { "damage" }, 1.18f);
				break;
			case 1:
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.85f);
				break;
			case 2:
				TryScaleFloat(stats, new string[1] { "movementSpeed" }, 1.15f);
				break;
			case 3:
				TryScaleFloat(stats, new string[2] { "health", "maxHealth" }, 1.12f);
				break;
			case 4:
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, 0.9f);
				break;
			default:
				TryScaleFloat(stats, new string[1] { "gravity" }, (Random.value > 0.5f) ? 0.86f : 1.16f);
				break;
			}
		}

		private static CardInfoStat Stat(string label, float mult, bool enabled)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			if (!enabled)
			{
				return null;
			}
			if (Mathf.Abs(mult - 1f) < 0.06f)
			{
				return null;
			}
			float num = (mult - 1f) * 100f;
			bool flag = num >= 0f;
			string amount = (flag ? "+" : "-") + Mathf.Abs(Mathf.RoundToInt(num)) + "%";
			return new CardInfoStat
			{
				stat = label,
				amount = amount,
				positive = flag,
				simepleAmount = (SimpleAmount)(flag ? 2 : 6)
			};
		}

		private static void ApplyLottery(Gun gun, CharacterStatModifiers stats, Block block)
		{
			switch (Random.Range(0, 4))
			{
			case 0:
				TryScaleFloat(gun, new string[1] { "damage" }, 1.25f);
				TryScaleFloat(stats, new string[1] { "movementSpeed" }, 0.9f);
				break;
			case 1:
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, 0.8f);
				TryScaleFloat(gun, new string[1] { "damage" }, 0.9f);
				break;
			case 2:
				TryScaleFloat(stats, new string[2] { "health", "maxHealth" }, 1.2f);
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, 1.15f);
				break;
			default:
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, 1.25f);
				TryScaleFloat(stats, new string[1] { "gravity" }, 1.12f);
				break;
			}
		}

		private static void ApplyCore(Gun gun, CharacterStatModifiers stats, Block block, CardSpec spec)
		{
			if (spec.UseDamage)
			{
				TryScaleFloat(gun, new string[1] { "damage" }, spec.DamageMult);
			}
			if (spec.UseAttackSpeed)
			{
				TryScaleFloat(gun, new string[2] { "attackSpeed", "timeBetweenBullets" }, spec.AttackSpeedMult);
			}
			if (spec.UseReload)
			{
				TryScaleFloat(gun, new string[2] { "reloadTime", "reloadTimeAdd" }, spec.ReloadTimeMult);
			}
			if (spec.UseProjectileSpeed)
			{
				TryScaleFloat(gun, new string[2] { "projectileSpeed", "bulletSpeed" }, spec.ProjectileSpeedMult);
			}
			if (spec.UseAmmo)
			{
				TryScaleFloat(gun, new string[2] { "ammo", "numberOfProjectiles" }, spec.AmmoMult);
			}
			if (spec.UseHealth)
			{
				TryScaleFloat(stats, new string[2] { "health", "maxHealth" }, spec.HealthMult);
			}
			if (spec.UseMoveSpeed)
			{
				TryScaleFloat(stats, new string[2] { "movementSpeed", "runSpeed" }, spec.MoveSpeedMult);
			}
			if (spec.UseGravity)
			{
				TryScaleFloat(stats, new string[1] { "gravity" }, spec.GravityMult);
			}
			if (spec.UseBlockCooldown)
			{
				TryScaleFloat(block, new string[3] { "cdMultiplier", "cooldownMultiplier", "cooldown" }, spec.BlockCooldownMult);
			}
		}

		private static bool TryScaleFloat(object target, IEnumerable<string> names, float multiplier)
		{
			if (target == null)
			{
				return false;
			}
			foreach (string name in names)
			{
				FieldInfo fieldInfo = FindFieldCached(target.GetType(), name);
				if (fieldInfo != null && fieldInfo.FieldType == typeof(float))
				{
					float num = (float)fieldInfo.GetValue(target);
					fieldInfo.SetValue(target, num * multiplier);
					return true;
				}
				if (fieldInfo != null && fieldInfo.FieldType == typeof(int))
				{
					int num2 = (int)fieldInfo.GetValue(target);
					fieldInfo.SetValue(target, Mathf.Max(1, Mathf.RoundToInt((float)num2 * multiplier)));
					return true;
				}
			}
			return false;
		}

		private static bool TrySetFloat(object target, IEnumerable<string> names, float value)
		{
			if (target == null)
			{
				return false;
			}
			foreach (string name in names)
			{
				FieldInfo fieldInfo = FindFieldCached(target.GetType(), name);
				if (fieldInfo != null && fieldInfo.FieldType == typeof(float))
				{
					fieldInfo.SetValue(target, value);
					return true;
				}
			}
			return false;
		}

		private static bool TrySetBool(object target, IEnumerable<string> names, bool value)
		{
			if (target == null)
			{
				return false;
			}
			foreach (string name in names)
			{
				FieldInfo fieldInfo = FindFieldCached(target.GetType(), name);
				if (fieldInfo != null && fieldInfo.FieldType == typeof(bool))
				{
					fieldInfo.SetValue(target, value);
					return true;
				}
			}
			return false;
		}

		private static bool TryAddInt(object target, IEnumerable<string> names, int delta)
		{
			if (target == null)
			{
				return false;
			}
			foreach (string name in names)
			{
				FieldInfo fieldInfo = FindFieldCached(target.GetType(), name);
				if (fieldInfo != null && fieldInfo.FieldType == typeof(int))
				{
					int num = (int)fieldInfo.GetValue(target);
					fieldInfo.SetValue(target, Mathf.Max(0, num + delta));
					return true;
				}
			}
			return false;
		}

		private static FieldInfo FindFieldCached(Type type, string name)
		{
			if (type == null || string.IsNullOrEmpty(name))
			{
				return null;
			}
			string key = type.AssemblyQualifiedName + "|" + name;
			lock (FieldCache)
			{
				if (FieldCache.TryGetValue(key, out var value))
				{
					return value;
				}
				value = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldCache[key] = value;
				return value;
			}
		}
	}
	internal sealed class BlockPowerTracker : MonoBehaviour
	{
		private static readonly Dictionary<string, FieldInfo> FieldCache = new Dictionary<string, FieldInfo>();

		private int _aegisField;

		private int _shockRing;

		private int _reloadCache;

		private int _medicPulse;

		private int _warpStepBlock;

		private int _gravityBubble;

		private int _mirrorShell;

		private int _ghostScreen;

		private int _siegeReserve;

		private int _shrapnelGuard;

		private int _overhealDrive;

		private int _novaBrake;

		private int _forceWall;

		private int _ricochetWard;

		private int _phaseBattery;

		public void Register(SpecialMode special)
		{
			switch (special)
			{
			case SpecialMode.AegisField:
				_aegisField++;
				break;
			case SpecialMode.ShockRing:
				_shockRing++;
				break;
			case SpecialMode.ReloadCache:
				_reloadCache++;
				break;
			case SpecialMode.MedicPulse:
				_medicPulse++;
				break;
			case SpecialMode.WarpStepBlock:
				_warpStepBlock++;
				break;
			case SpecialMode.GravityBubble:
				_gravityBubble++;
				break;
			case SpecialMode.MirrorShell:
				_mirrorShell++;
				break;
			case SpecialMode.GhostScreen:
				_ghostScreen++;
				break;
			case SpecialMode.SiegeReserve:
				_siegeReserve++;
				break;
			case SpecialMode.ShrapnelGuard:
				_shrapnelGuard++;
				break;
			case SpecialMode.OverhealDrive:
				_overhealDrive++;
				break;
			case SpecialMode.NovaBrake:
				_novaBrake++;
				break;
			case SpecialMode.ForceWall:
				_forceWall++;
				break;
			case SpecialMode.RicochetWard:
				_ricochetWard++;
				break;
			case SpecialMode.PhaseBattery:
				_phaseBattery++;
				break;
			}
		}

		public void Trigger(Block block)
		{
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = ReadField<CharacterData>(block, "data");
			if ((Object)(object)block == (Object)null || (Object)(object)val == (Object)null)
			{
				return;
			}
			Player player = val.player;
			Gun val2 = (((Object)(object)val.weaponHandler != (Object)null) ? val.weaponHandler.gun : null);
			GunAmmo val3 = ReadField<GunAmmo>(val2, "gunAmmo");
			CharacterStatModifiers stats = val.stats;
			HealthHandler healthHandler = val.healthHandler;
			PlayerVelocity playerVel = val.playerVel;
			if (_aegisField > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.projectileSize = Mathf.Max(val2.projectileSize, 1.18f + 0.08f * (float)_aegisField);
				val2.explodeNearEnemyRange = Mathf.Max(val2.explodeNearEnemyRange, 0.22f + 0.08f * (float)_aegisField);
				val2.explodeNearEnemyDamage = Mathf.Max(val2.explodeNearEnemyDamage, 0.12f + 0.05f * (float)_aegisField);
				val2.reflects = Mathf.Max(val2.reflects, Mathf.Min(4, _aegisField / 2));
			}
			if (_shockRing > 0)
			{
				PulseNearby(player, 3.2f + 0.4f * (float)_shockRing, 12f * (float)_shockRing, 16f + 4f * (float)_shockRing);
			}
			if (_reloadCache > 0 && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null)
			{
				WriteField(val3, "currentAmmo", val3.maxAmmo);
				val2.reloadTime = Mathf.Max(0.12f, val2.reloadTime * Mathf.Pow(0.97f, (float)_reloadCache));
			}
			if (_medicPulse > 0 && (Object)(object)healthHandler != (Object)null)
			{
				healthHandler.Heal(14f * (float)_medicPulse);
			}
			if (_warpStepBlock > 0 && (Object)(object)playerVel != (Object)null)
			{
				? val4;
				if (!(((Vector3)(ref val.aimDirection)).sqrMagnitude > 0.001f))
				{
					val4 = new Vector2((player.teamID == 0) ? 1f : (-1f), 0f);
				}
				else
				{
					Vector2 val5 = Vector2.op_Implicit(val.aimDirection);
					val4 = ((Vector2)(ref val5)).normalized;
				}
				Vector2 val6 = (Vector2)val4;
				AddVelocity(playerVel, val6 * (14f + 4f * (float)_warpStepBlock) + Vector2.up * (3f + (float)_warpStepBlock));
			}
			if (_gravityBubble > 0 && (Object)(object)stats != (Object)null)
			{
				stats.gravity = Mathf.Min(stats.gravity, Mathf.Max(0.5f, 0.9f - 0.04f * (float)_gravityBubble));
				stats.movementSpeed = Mathf.Max(stats.movementSpeed, 1.08f + 0.05f * (float)_gravityBubble);
			}
			if (_mirrorShell > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.reflects = Mathf.Max(val2.reflects, Mathf.Min(6, 1 + _mirrorShell));
				val2.projectileSpeed = Mathf.Max(val2.projectileSpeed, 1.06f + 0.06f * (float)_mirrorShell);
			}
			if (_ghostScreen > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.ignoreWalls = true;
				val2.bulletPortal = Mathf.Max(val2.bulletPortal, 1 + _ghostScreen / 2);
			}
			if (_siegeReserve > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.explodeNearEnemyRange = Mathf.Max(val2.explodeNearEnemyRange, 0.4f + 0.14f * (float)_siegeReserve);
				val2.explodeNearEnemyDamage = Mathf.Max(val2.explodeNearEnemyDamage, 0.2f + 0.08f * (float)_siegeReserve);
				val2.projectileSize = Mathf.Max(val2.projectileSize, 1.08f + 0.05f * (float)_siegeReserve);
			}
			if (_shrapnelGuard > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.numberOfProjectiles = Mathf.Clamp(Mathf.Max(val2.numberOfProjectiles, 1 + _shrapnelGuard), 1, 6);
				val2.projectileSize = Mathf.Max(val2.projectileSize, 1.04f + 0.02f * (float)_shrapnelGuard);
			}
			if (_overhealDrive > 0 && (Object)(object)stats != (Object)null && (Object)(object)healthHandler != (Object)null)
			{
				stats.health = Mathf.Max(stats.health, 1.06f + 0.05f * (float)_overhealDrive);
				healthHandler.Heal(10f * (float)_overhealDrive);
			}
			if (_novaBrake > 0)
			{
				PulseNearby(player, 3f + 0.35f * (float)_novaBrake, 8f * (float)_novaBrake, 20f + 5f * (float)_novaBrake);
			}
			if (_forceWall > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.projectileSize = Mathf.Max(val2.projectileSize, 1.3f + 0.08f * (float)_forceWall);
				val2.explodeNearEnemyRange = Mathf.Max(val2.explodeNearEnemyRange, 0.3f + 0.08f * (float)_forceWall);
				val2.projectileSpeed = Mathf.Max(val2.projectileSpeed, 0.92f);
			}
			if (_ricochetWard > 0 && (Object)(object)val2 != (Object)null)
			{
				val2.reflects = Mathf.Max(val2.reflects, Mathf.Min(7, 2 + _ricochetWard));
				val2.explodeNearEnemyDamage = Mathf.Max(val2.explodeNearEnemyDamage, 0.14f + 0.05f * (float)_ricochetWard);
			}
			if (_phaseBattery > 0 && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null)
			{
				val2.ignoreWalls = true;
				val2.bulletPortal = Mathf.Max(val2.bulletPortal, 1 + _phaseBattery);
				WriteField(val3, "currentAmmo", val3.maxAmmo);
			}
		}

		private static void PulseNearby(Player source, float radius, float damage, float force)
		{
			//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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)source == (Object)null)
			{
				return;
			}
			Vector3 position = ((Component)source).transform.position;
			Player[] array = Object.FindObjectsOfType<Player>();
			foreach (Player val in array)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)source || val.teamID == source.teamID || (Object)(object)val.data == (Object)null || val.data.dead)
				{
					continue;
				}
				Vector2 val2 = Vector2.op_Implicit(((Component)val).transform.position - position);
				if (!(((Vector2)(ref val2)).magnitude > radius))
				{
					((Damagable)val.data.healthHandler).CallTakeDamage(Vector2.one * damage, Vector2.op_Implicit(((Component)val).transform.position), ((Component)source).gameObject, source, false);
					if ((Object)(object)val.data.playerVel != (Object)null)
					{
						Vector2 val3 = ((((Vector2)(ref val2)).sqrMagnitude > 0.001f) ? ((Vector2)(ref val2)).normalized : Vector2.up);
						AddVelocity(val.data.playerVel, val3 * force);
					}
				}
			}
		}

		private static void AddVelocity(PlayerVelocity velocity, Vector2 add)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = ReadField<Vector2>(velocity, "velocity");
			WriteField(velocity, "velocity", val + add);
		}

		internal static T ReadField<T>(object target, string name)
		{
			if (target == null)
			{
				return default(T);
			}
			FieldInfo fieldInfo = FindFieldCached(target.GetType(), name);
			if (fieldInfo == null)
			{
				return default(T);
			}
			object value = fieldInfo.GetValue(target);
			if (value is T)
			{
				return (T)value;
			}
			return default(T);
		}

		private static void WriteField(object target, string name, object value)
		{
			if (target != null)
			{
				FieldInfo fieldInfo = FindFieldCached(target.GetType(), name);
				if (fieldInfo != null)
				{
					fieldInfo.SetValue(target, value);
				}
			}
		}

		private static FieldInfo FindFieldCached(Type type, string name)
		{
			if (type == null || string.IsNullOrEmpty(name))
			{
				return null;
			}
			string key = type.AssemblyQualifiedName + "|" + name;
			lock (FieldCache)
			{
				if (FieldCache.TryGetValue(key, out var value))
				{
					return value;
				}
				value = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldCache[key] = value;
				return value;
			}
		}
	}
	[HarmonyPatch(typeof(Block), "DoBlockAtPosition")]
	internal static class BlockPowerPatch
	{
		private static void Postfix(Block __instance)
		{
			Player val = BlockPowerTracker.ReadField<CharacterData>(__instance, "data")?.player;
			if (!((Object)(object)val == (Object)null))
			{
				((Component)val).gameObject.GetComponent<BlockPowerTracker>()?.Trigger(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(CardChoice), "GetRanomCard")]
	internal static class UltraRareRollPatch
	{
		private const float UltraRareKeepChance = 0.0015f;

		private static bool _suppress;

		private static readonly MethodInfo GetRandomCardMethod = AccessTools.Method(typeof(CardChoice), "GetRanomCard", (Type[])null, (Type[])null);

		private static void Postfix(CardChoice __instance, ref GameObject __result)
		{
			if (_suppress || (Object)(object)__result == (Object)null || !CardAvailabilityGate.TryGetGeneratedIndex(__result, out var index) || !CardAvailabilityGate.IsUltraRareIndex(index) || Random.value <= 0.0015f)
			{
				return;
			}
			for (int i = 0; i < 40; i++)
			{
				_suppress = true;
				object? obj = GetRandomCardMethod?.Invoke(__instance, null);
				GameObject val = (GameObject)((obj is GameObject) ? obj : null);
				_suppress = false;
				if (!((Object)(object)val == (Object)null))
				{
					if (!CardAvailabilityGate.TryGetGeneratedIndex(val, out var index2) || !CardAvailabilityGate.IsUltraRareIndex(index2))
					{
						__result = val;
						break;
					}
					if (Random.value <= 0.0015f)
					{
						__result = val;
						break;
					}
				}
			}
		}
	}
	public class Card001 : GeneratedCardBase
	{
		protected override int CardIndex => 1;
	}
	public class Card002 : GeneratedCardBase
	{
		protected override int CardIndex => 2;
	}
	public class Card003 : GeneratedCardBase
	{
		protected override int CardIndex => 3;
	}
	public class Card004 : GeneratedCardBase
	{
		protected override int CardIndex => 4;
	}
	public class Card005 : GeneratedCardBase
	{
		protected override int CardIndex => 5;
	}
	public class Card006 : GeneratedCardBase
	{
		protected override int CardIndex => 6;
	}
	public class Card007 : GeneratedCardBase
	{
		protected override int CardIndex => 7;
	}
	public class Card008 : GeneratedCardBase
	{
		protected override int CardIndex => 8;
	}
	public class Card009 : GeneratedCardBase
	{
		protected override int CardIndex => 9;
	}
	public class Card010 : GeneratedCardBase
	{
		protected override int CardIndex => 10;
	}
	public class Card011 : GeneratedCardBase
	{
		protected override int CardIndex => 11;
	}
	public class Card012 : GeneratedCardBase
	{
		protected override int CardIndex => 12;
	}
	public class Card013 : GeneratedCardBase
	{
		protected override int CardIndex => 13;
	}
	public class Card014 : GeneratedCardBase
	{
		protected override int CardIndex => 14;
	}
	public class Card015 : GeneratedCardBase
	{
		protected override int CardIndex => 15;
	}
	public class Card016 : GeneratedCardBase
	{
		protected override int CardIndex => 16;
	}
	public class Card017 : GeneratedCardBase
	{
		protected override int CardIndex => 17;
	}
	public class Card018 : GeneratedCardBase
	{
		protected override int CardIndex => 18;
	}
	public class Card019 : GeneratedCardBase
	{
		protected override int CardIndex => 19;
	}
	public class Card020 : GeneratedCardBase
	{
		protected override int CardIndex => 20;
	}
	public class Card021 : GeneratedCardBase
	{
		protected override int CardIndex => 21;
	}
	public class Card022 : GeneratedCardBase
	{
		protected override int CardIndex => 22;
	}
	public class Card023 : GeneratedCardBase
	{
		protected override int CardIndex => 23;
	}
	public class Card024 : GeneratedCardBase
	{
		protected override int CardIndex => 24;
	}
	public class Card025 : GeneratedCardBase
	{
		protected override int CardIndex => 25;
	}
	public class Card026 : GeneratedCardBase
	{
		protected override int CardIndex => 26;
	}
	public class Card027 : GeneratedCardBase
	{
		protected override int CardIndex => 27;
	}
	public class Card028 : GeneratedCardBase
	{
		protected override int CardIndex => 28;
	}
	public class Card029 : GeneratedCardBase
	{
		protected override int CardIndex => 29;
	}
	public class Card030 : GeneratedCardBase
	{
		protected override int CardIndex => 30;
	}
	public class Card031 : GeneratedCardBase
	{
		protected override int CardIndex => 31;
	}
	public class Card032 : GeneratedCardBase
	{
		protected override int CardIndex => 32;
	}
	public class Card033 : GeneratedCardBase
	{
		protected override int CardIndex => 33;
	}
	public class Card034 : GeneratedCardBase
	{
		protected override int CardIndex => 34;
	}
	public class Card035 : GeneratedCardBase
	{
		protected override int CardIndex => 35;
	}
	public class Card036 : GeneratedCardBase
	{
		protected override int CardIndex => 36;
	}
	public class Card037 : GeneratedCardBase
	{
		protected override int CardIndex => 37;
	}
	public class Card038 : GeneratedCardBase
	{
		protected override int CardIndex => 38;
	}
	public class Card039 : GeneratedCardBase
	{
		protected override int CardIndex => 39;
	}
	public class Card040 : GeneratedCardBase
	{
		protected override int CardIndex => 40;
	}
	public class Card041 : GeneratedCardBase
	{
		protected override int CardIndex => 41;
	}
	public class Card042 : GeneratedCardBase
	{
		protected override int CardIndex => 42;
	}
	public class Card043 : GeneratedCardBase
	{
		protected override int CardIndex => 43;
	}
	public class Card044 : GeneratedCardBase
	{
		protected override int CardIndex => 44;
	}
	public class Card045 : GeneratedCardBase
	{
		protected override int CardIndex => 45;
	}
	public class Card046 : GeneratedCardBase
	{
		protected override int CardIndex => 46;
	}
	public class Card047 : GeneratedCardBase
	{
		protected override int CardIndex => 47;
	}
	public class Card048 : GeneratedCardBase
	{
		protected override int CardIndex => 48;
	}
	public class Card049 : GeneratedCardBase
	{
		protected override int CardIndex => 49;
	}
	public class Card050 : GeneratedCardBase
	{
		protected override int CardIndex => 50;
	}
	public class Card051 : GeneratedCardBase
	{
		protected override int CardIndex => 51;
	}
	public class Card052 : GeneratedCardBase
	{
		protected override int CardIndex => 52;
	}
	public class Card053 : GeneratedCardBase
	{
		protected override int CardIndex => 53;
	}
	public class Card054 : GeneratedCardBase
	{
		protected override int CardIndex => 54;
	}
	public class Card055 : GeneratedCardBase
	{
		protected override int CardIndex => 55;
	}
	public class Card056 : GeneratedCardBase
	{
		protected override int CardIndex => 56;
	}
	public class Card057 : GeneratedCardBase
	{
		protected override int CardIndex => 57;
	}
	public class Card058 : GeneratedCardBase
	{
		protected override int CardIndex => 58;
	}
	public class Card059 : GeneratedCardBase
	{
		protected override int CardIndex => 59;
	}
	public class Card060 : GeneratedCardBase
	{
		protected override int CardIndex => 60;
	}
	public class Card061 : GeneratedCardBase
	{
		protected override int CardIndex => 61;
	}
	public class Card062 : GeneratedCardBase
	{
		protected override int CardIndex => 62;
	}
	public class Card063 : GeneratedCardBase
	{
		protected override int CardIndex => 63;
	}
	public class Card064 : GeneratedCardBase
	{
		protected override int CardIndex => 64;
	}
	public class Card065 : GeneratedCardBase
	{
		protected override int CardIndex => 65;
	}
	public class Card066 : GeneratedCardBase
	{
		protected override int CardIndex => 66;
	}
	public class Card067 : GeneratedCardBase
	{
		protected override int CardIndex => 67;
	}
	public class Card068 : GeneratedCardBase
	{
		protected override int CardIndex => 68;
	}
	public class Card069 : GeneratedCardBase
	{
		protected override int CardIndex => 69;
	}
	public class Card070 : GeneratedCardBase
	{
		protected override int CardIndex => 70;
	}
	public class Card071 : GeneratedCardBase
	{
		protected override int CardIndex => 71;
	}
	public class Card072 : GeneratedCardBase
	{
		protected override int CardIndex => 72;
	}
	public class Card073 : GeneratedCardBase
	{
		protected override int CardIndex => 73;
	}
	public class Card074 : GeneratedCardBase
	{
		protected override int CardIndex => 74;
	}
	public class Card075 : GeneratedCardBase
	{
		protected override int CardIndex => 75;
	}
	public class Card076 : GeneratedCardBase
	{
		protected override int CardIndex => 76;
	}
	public class Card077 : GeneratedCardBase
	{
		protected override int CardIndex => 77;
	}
	public class Card078 : GeneratedCardBase
	{
		protected override int CardIndex => 78;
	}
	public class Card079 : GeneratedCardBase
	{
		protected override int CardIndex => 79;
	}
	public class Card080 : GeneratedCardBase
	{
		protected override int CardIndex => 80;
	}
	public class Card081 : GeneratedCardBase
	{
		protected override int CardIndex => 81;
	}
	public class Card082 : GeneratedCardBase
	{
		protected override int CardIndex => 82;
	}
	public class Card083 : GeneratedCardBase
	{
		protected override int CardIndex => 83;
	}
	public class Card084 : GeneratedCardBase
	{
		protected override int CardIndex => 84;
	}
	public class Card085 : GeneratedCardBase
	{
		protected override int CardIndex => 85;
	}
	public class Card086 : GeneratedCardBase
	{
		protected override int CardIndex => 86;
	}
	public class Card087 : GeneratedCardBase
	{
		protected override int CardIndex => 87;
	}
	public class Card088 : GeneratedCardBase
	{
		protected override int CardIndex => 88;
	}
	public class Card089 : GeneratedCardBase
	{
		protected override int CardIndex => 89;
	}
	public class Card090 : GeneratedCardBase
	{
		protected override int CardIndex => 90;
	}
	public class Card091 : GeneratedCardBase
	{
		protected override int CardIndex => 91;
	}
	public class Card092 : GeneratedCardBase
	{
		protected override int CardIndex => 92;
	}
	public class Card093 : GeneratedCardBase
	{
		protected override int CardIndex => 93;
	}
	public class Card094 : GeneratedCardBase
	{
		protected override int CardIndex => 94;
	}
	public class Card095 : GeneratedCardBase
	{
		protected override int CardIndex => 95;
	}
	public class Card096 : GeneratedCardBase
	{
		protected override int CardIndex => 96;
	}
	public class Card097 : GeneratedCardBase
	{
		protected override int CardIndex => 97;
	}
	public class Card098 : GeneratedCardBase
	{
		protected override int CardIndex => 98;
	}
	public class Card099 : GeneratedCardBase
	{
		protected override int CardIndex => 99;
	}
	public class Card100 : GeneratedCardBase
	{
		protected override int CardIndex => 100;
	}
	public class Card101 : GeneratedCardBase
	{
		protected override int CardIndex => 101;
	}
	public class Card102 : GeneratedCardBase
	{
		protected override int CardIndex => 102;
	}
	public class Card103 : GeneratedCardBase
	{
		protected override int CardIndex => 103;
	}
	public class Card104 : GeneratedCardBase
	{
		protected override int CardIndex => 104;
	}
	public class Card105 : GeneratedCardBase
	{
		protected override int CardIndex => 105;
	}
	public class Card106 : GeneratedCardBase
	{
		protected override int CardIndex => 106;
	}
	public class Card107 : GeneratedCardBase
	{
		protected override int CardIndex => 107;
	}
	public class Card108 : GeneratedCardBase
	{
		protected override int CardIndex => 108;
	}
	public class Card109 : GeneratedCardBase
	{
		protected override int CardIndex => 109;
	}
	public class Card110 : GeneratedCardBase
	{
		protected override int CardIndex => 110;
	}
	public class Card111 : GeneratedCardBase
	{
		protected override int CardIndex => 111;
	}
	public class Card112 : GeneratedCardBase
	{
		protected override int CardIndex => 112;
	}
	public class Card113 : GeneratedCardBase
	{
		protected override int CardIndex => 113;
	}
	public class Card114 : GeneratedCardBase
	{
		protected override int CardIndex => 114;
	}
	public class Card115 : GeneratedCardBase
	{
		protected override int CardIndex => 115;
	}
	public class Card116 : GeneratedCardBase
	{
		protected override int CardIndex => 116;
	}
	public class Card117 : GeneratedCardBase
	{
		protected override int CardIndex => 117;
	}
	public class Card118 : GeneratedCardBase
	{
		protected override int CardIndex => 118;
	}
	public class Card119 : GeneratedCardBase
	{
		protected override int CardIndex => 119;
	}
	public class Card120 : GeneratedCardBase
	{
		protected override int CardIndex => 120;
	}
	public class Card121 : GeneratedCardBase
	{
		protected override int CardIndex => 121;
	}
	public class Card122 : GeneratedCardBase
	{
		protected override int CardIndex => 122;
	}
	public class Card123 : GeneratedCardBase
	{
		protected override int CardIndex => 123;
	}
	public class Card124 : GeneratedCardBase
	{
		protected override int CardIndex => 124;
	}
	public class Card125 : GeneratedCardBase
	{
		protected override int CardIndex => 125;
	}
	public class Card126 : GeneratedCardBase
	{
		protected override int CardIndex => 126;
	}
	public class Card127 : GeneratedCardBase
	{
		protected override int CardIndex => 127;
	}
	public class Card128 : GeneratedCardBase
	{
		protected override int CardIndex => 128;
	}
	public class Card129 : GeneratedCardBase
	{
		protected override int CardIndex => 129;
	}
	public class Card130 : GeneratedCardBase
	{
		protected override int CardIndex => 130;
	}
	public class Card131 : GeneratedCardBase
	{
		protected override int CardIndex => 131;
	}
	public class Card132 : GeneratedCardBase
	{
		protected override int CardIndex => 132;
	}
	public class Card133 : GeneratedCardBase
	{
		protected override int CardIndex => 133;
	}
	public class Card134 : GeneratedCardBase
	{
		protected override int CardIndex => 134;
	}
	public class Card135 : GeneratedCardBase
	{
		protected override int CardIndex => 135;
	}
	public class Card136 : GeneratedCardBase
	{
		protected override int CardIndex => 136;
	}
	public class Card137 : GeneratedCardBase
	{
		protected override int CardIndex => 137;
	}
	public class Card138 : GeneratedCardBase
	{
		protected override int CardIndex => 138;
	}
	public class Card139 : GeneratedCardBase
	{
		protected override int CardIndex => 139;
	}
	public class Card140 : GeneratedCardBase
	{
		protected override int CardIndex => 140;
	}
	public class Card141 : GeneratedCardBase
	{
		protected override int CardIndex => 141;
	}
	public class Card142 : GeneratedCardBase
	{
		protected override int CardIndex => 142;
	}
	public class Card143 : GeneratedCardBase
	{
		protected override int CardIndex => 143;
	}
	public class Card144 : GeneratedCardBase
	{
		protected override int CardIndex => 144;
	}
	public class Card145 : GeneratedCardBase
	{
		protected override int CardIndex => 145;
	}
	public class Card146 : GeneratedCardBase
	{
		protected override int CardIndex => 146;
	}
	public class Card147 : GeneratedCardBase
	{
		protected override int CardIndex => 147;
	}
	public class Card148 : GeneratedCardBase
	{
		protected override int CardIndex => 148;
	}
	public class Card149 : GeneratedCardBase
	{
		protected override int CardIndex => 149;
	}
	public class Card150 : GeneratedCardBase
	{
		protected override int CardIndex => 150;
	}
	public class Card151 : GeneratedCardBase
	{
		protected override int CardIndex => 151;
	}
	public class Card152 : GeneratedCardBase
	{
		protected override int CardIndex => 152;
	}
	public class Card153 : GeneratedCardBase
	{
		protected override int CardIndex => 153;
	}
	public class Card154 : GeneratedCardBase
	{
		protected override int CardIndex => 154;
	}
	public class Card155 : GeneratedCardBase
	{
		protected override int CardIndex => 155;
	}
	public class Card156 : GeneratedCardBase
	{
		protected override int CardIndex => 156;
	}
	public class Card157 : GeneratedCardBase
	{
		protected override int CardIndex => 157;
	}
	public class Card158 : GeneratedCardBase
	{
		protected override int C