Decompiled source of KraftsCardBalancer v0.9.0

KraftsCardBalancer.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RarityLib.Utils;
using TMPro;
using UnboundLib;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("KraftsCardBalancer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KraftsCardBalancer")]
[assembly: AssemblyTitle("KraftsCardBalancer")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace CardBalance
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Card.Balance", "Card Balance", "0.9.0")]
	[BepInProcess("Rounds.exe")]
	public class CardBalance : BaseUnityPlugin
	{
		private const string ModId = "Card.Balance";

		private const string ModName = "Card Balance";

		public const string Version = "0.9.0";

		public static bool isDebug = false;

		private static Dictionary<string, List<CardInfoStat>> OriginalStats = new Dictionary<string, List<CardInfoStat>>();

		private static Dictionary<string, string> OriginalDescriptions = new Dictionary<string, string>();

		public static Dictionary<string, ConfigEntry<string>> CardRarities = new Dictionary<string, ConfigEntry<string>>();

		public static Dictionary<string, Rarity> DefaultRarities = new Dictionary<string, Rarity>();

		public static Dictionary<string, TextMeshProUGUI> CardRaritysTexts = new Dictionary<string, TextMeshProUGUI>();

		public static Dictionary<string, List<CardInfo>> ModCards = new Dictionary<string, List<CardInfo>>();

		private static readonly Dictionary<string, Action<CardInfo>> CardModifiers = new Dictionary<string, Action<CardInfo>>(StringComparer.InvariantCultureIgnoreCase)
		{
			["BARRAGE"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 2, false, "DMG", "-40%");
				Gun componentInChildren23 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren23.bulletDamageMultiplier *= 2f;
			},
			["BOMBS AWAY"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Health", "60%");
				CharacterStatModifiers componentInChildren22 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren22.health *= 1.23f;
			},
			["BOUNCY"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Bullet Bounces", "+3");
				Gun componentInChildren21 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren21.reflects++;
			},
			["BUCKSHOT"] = delegate(CardInfo card)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				ModifyInfoStat(card, card.cardStats.ToList(), 2, true, "", "");
				Gun componentInChildren20 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren20.bulletDamageMultiplier *= 2.5f;
				card.rarity = (Rarity)2;
			},
			["BURST"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 2, false, "DMG", "-20%");
				Gun componentInChildren19 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren19.bulletDamageMultiplier *= 2f;
			},
			["CHASE"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), -1, true, "Speed", "+25%");
				CharacterStatModifiers componentInChildren18 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren18.movementSpeed *= 1.25f;
			},
			["CHILLING PRESENCE"] = delegate(CardInfo card)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)1;
			},
			["DECAY"] = delegate(CardInfo card)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)2;
			},
			["DEFENDER"] = delegate(CardInfo card)
			{
				Block componentInChildren17 = ((Component)card).GetComponentInChildren<Block>();
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Block cooldown", "-70%");
				componentInChildren17.cdMultiplier = 0.3f;
				card.allowMultiple = false;
			},
			["Demonic pact"] = delegate(CardInfo card)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)1;
			},
			["EMP"] = delegate(CardInfo card)
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Block cooldown", "-30%");
				ModifyInfoStat(card, card.cardStats.ToList(), 1, true, "HP", "+30%");
				((Component)card).GetComponentInChildren<Block>().cdMultiplier = 0.7f;
				card.rarity = (Rarity)0;
			},
			["EMPOWER"] = delegate(CardInfo card)
			{
				card.cardDestription = "Blocking empowers the next shot.";
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Movement Speed", "+35%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, true, "DMG", "+35%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Block cooldown", "+0.25s");
				CharacterStatModifiers componentInChildren15 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren15.movementSpeed *= 1.35f;
				Gun componentInChildren16 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren16.damage *= 1.35f;
				card.allowMultiple = false;
			},
			["Frost slam"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "HP", "+50%");
				CharacterStatModifiers componentInChildren14 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren14.health *= 1.15f;
				card.allowMultiple = false;
			},
			["GROW"] = delegate(CardInfo card)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)2;
				card.allowMultiple = false;
			},
			["Healing field"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Block cooldown", "-30%");
				ModifyInfoStat(card, card.cardStats.ToList(), 1, true, "HP", "+30%");
				((Component)card).GetComponentInChildren<Block>().cdMultiplier = 0.7f;
				((Component)card).GetComponentInChildren<Block>().cdAdd = 0f;
			},
			["HOMING"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "DMG", "+25%");
				((Component)card).GetComponentInChildren<Gun>().damage = 1.25f;
			},
			["HUGE"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "HP", "+100%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Size", "+25%");
				CharacterStatModifiers componentInChildren12 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren12.health *= 1.11f;
				CharacterStatModifiers componentInChildren13 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren13.sizeMultiplier *= 1.125f;
			},
			["IMPLODE"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 1, true, "DMG", "+50%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Block cooldown", "+0.25s");
				Gun componentInChildren11 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren11.damage *= 1.5f;
			},
			["LIFESTEAL"] = delegate(CardInfo card)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)1;
			},
			["PARASITE"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 2, true, "DMG", "+100%");
				((Component)card).GetComponentInChildren<Gun>().damage = 2f;
			},
			["PHOENIX"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, false, "HP", "-95%");
				CharacterStatModifiers componentInChildren9 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren9.health *= 0.077f;
				CharacterStatModifiers componentInChildren10 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren10.sizeMultiplier *= 1.75f;
				card.allowMultiple = false;
			},
			["POISON"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 2, false, "Bullets", "-2");
				((Component)card).GetComponentInChildren<Gun>().ammo = -2;
			},
			["Radar shot"] = delegate(CardInfo card)
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Block cooldown", "-30%");
				ModifyInfoStat(card, card.cardStats.ToList(), 1, true, "HP", "+30%");
				((Component)card).GetComponentInChildren<Block>().cdMultiplier = 0.7f;
				card.rarity = (Rarity)0;
			},
			["Radiance"] = delegate(CardInfo card)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)1;
			},
			["Refresh"] = delegate(CardInfo card)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)0;
			},
			["Remote"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "HP", "+100%");
				ModifyInfoStat(card, card.cardStats.ToList(), 1, false, "Bullet Speed", "-40%");
				CharacterStatModifiers componentInChildren8 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren8.health *= 2f;
				((Component)card).GetComponentInChildren<Gun>().reloadTimeAdd = 0f;
			},
			["Riccochet"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 1, true, "DMG", "+60%");
				Gun componentInChildren7 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren7.damage *= 1.6f;
				((Component)card).GetComponentInChildren<Gun>().attackSpeed = 1f;
			},
			["Scavenger"] = delegate(CardInfo card)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				card.rarity = (Rarity)2;
				card.allowMultiple = false;
			},
			["Shield Charge"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "HP", "+40%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Block cooldown", "+0.25s");
				CharacterStatModifiers componentInChildren6 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren6.health *= 1.4f;
			},
			["Shields Up"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "HP", "+50%");
				ModifyInfoStat(card, card.cardStats.ToList(), 1, false, "Reload time", "+0.5s");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Block cooldown", "+0.5s");
				CharacterStatModifiers componentInChildren5 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren5.health *= 1.5f;
			},
			["Shockwave"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 1, true, "Movement Speed", "+50%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Block cooldown", "+0.25s");
				CharacterStatModifiers componentInChildren4 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren4.movementSpeed *= 1.5f;
			},
			["Sneaky"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "DMG", "+80%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Reload time", "+0.25s");
				Gun componentInChildren3 = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren3.damage *= 1.8f;
			},
			["Tactical Reload"] = delegate(CardInfo card)
			{
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Movement Speed", "+50%");
				ModifyInfoStat(card, card.cardStats.ToList(), -1, false, "Block cooldown", "+0.25s");
				CharacterStatModifiers componentInChildren2 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
				componentInChildren2.movementSpeed *= 1.5f;
			},
			["Teleport"] = delegate(CardInfo card)
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Block cooldown", "-50%");
				((Component)card).GetComponentInChildren<Block>().cdMultiplier = 0.5f;
				card.rarity = (Rarity)1;
				card.allowMultiple = false;
			},
			["Actual Bullets"] = delegate(CardInfo card)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				ModifyInfoStat(card, card.cardStats.ToList(), 0, true, "Bullet Speed", "+1200%");
				card.rarity = (Rarity)1;
				card.allowMultiple = false;
			},
			["Atomic Rounds"] = delegate(CardInfo card)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				Gun componentInChildren = ((Component)card).GetComponentInChildren<Gun>();
				componentInChildren.projectileColor = Color.white;
				componentInChildren.explodeNearEnemyRange = 0f;
				componentInChildren.percentageDamage = 0f;
				componentInChildren.reloadTimeAdd = 0f;
				componentInChildren.projectileSpeed = 1f;
				componentInChildren.attackSpeed = 1f;
				componentInChildren.recoilMuiltiplier = 1f;
				componentInChildren.damage = 1f;
				componentInChildren.defaultCooldown = 1f;
				componentInChildren.dontAllowAutoFire = false;
			}
		};

		private static readonly Regex sanitizeRegex = new Regex("[\\n\\t\\\\\"'\\[\\]]+", RegexOptions.Compiled);

		public static List<CardInfo> allCards
		{
			get
			{
				List<CardInfo> list = CardManager.cards.Values.Select((Card v) => v.cardInfo).ToList();
				list.Sort((CardInfo c1, CardInfo c2) => c1.cardName.CompareTo(c2.cardName));
				return list;
			}
			set
			{
			}
		}

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

		public void Start()
		{
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 60, (Action)delegate
			{
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_0169: Unknown result type (might be due to invalid IL or missing references)
				foreach (CardInfo card in allCards)
				{
					if (!OriginalStats.ContainsKey(card.cardName))
					{
						OriginalStats[card.cardName] = card.cardStats.ToList();
						OriginalDescriptions[card.cardName] = card.cardDestription;
					}
					string category = CardManager.cards.Values.First((Card c) => (Object)(object)c.cardInfo == (Object)(object)card).category;
					string text = SanitizeText(((Object)card).name);
					UpdateCardStats(card);
					CardRarities[text] = ((BaseUnityPlugin)this).Config.Bind<string>("Card.Balance", text, "DEFAULT", "Rarity value of card " + card.cardName + " from " + category);
					DefaultRarities[text] = card.rarity;
					Rarity val = RarityUtils.GetRarity(CardRarities[text].Value);
					if ((int)val == 0 && CardRarities[text].Value != "Common")
					{
						val = DefaultRarities[text];
						CardRarities[text].Value = "DEFAULT";
					}
					card.rarity = val;
					if (!ModCards.ContainsKey(category))
					{
						ModCards.Add(category, new List<CardInfo>());
					}
					ModCards[category].Add(card);
				}
			});
		}

		public static void UpdateCardStats(CardInfo card)
		{
			if (OriginalStats.ContainsKey(card.cardName))
			{
				card.cardStats = OriginalStats[card.cardName].ToList().ToArray();
			}
			else
			{
				card.cardStats = card.cardStats.ToList().ToArray();
			}
			card.cardDestription = (OriginalDescriptions.ContainsKey(card.cardName) ? OriginalDescriptions[card.cardName] : card.cardDestription);
			if (CardModifiers.TryGetValue(card.cardName, out Action<CardInfo> value))
			{
				value(card);
			}
			if (isDebug)
			{
				displayStatChanges(card);
			}
		}

		private static bool AreEqual(object obj1, object obj2)
		{
			if (obj1 is Array array && obj2 is Array array2)
			{
				return array.Length == array2.Length && array.Cast<object>().SequenceEqual(array2.Cast<object>());
			}
			if (obj1 is IEnumerable<object> first && obj2 is IEnumerable<object> second)
			{
				return first.SequenceEqual(second);
			}
			return obj1.Equals(obj2);
		}

		public static void displayStatChanges(CardInfo card)
		{
			CardInfo val = ((IEnumerable<CardInfo>)allCards).FirstOrDefault((Func<CardInfo, bool>)((CardInfo c) => c.cardName == "QUICK RELOAD"));
			Gun componentInChildren = ((Component)card).GetComponentInChildren<Gun>();
			Gun componentInChildren2 = ((Component)val).GetComponentInChildren<Gun>();
			componentInChildren2.reloadTime = 1f;
			CharacterStatModifiers componentInChildren3 = ((Component)card).GetComponentInChildren<CharacterStatModifiers>();
			CharacterStatModifiers componentInChildren4 = ((Component)val).GetComponentInChildren<CharacterStatModifiers>();
			Gun componentInChildren5 = ((Component)card).GetComponentInChildren<Gun>();
			Gun componentInChildren6 = ((Component)val).GetComponentInChildren<Gun>();
			Debug.Log((object)("\n--------------- Card: " + card.cardName + "-------------------------\n"));
			if ((Object)(object)componentInChildren5 != (Object)null)
			{
				FieldInfo[] fields = ((object)componentInChildren5).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo[] array = fields;
				foreach (FieldInfo fieldInfo in array)
				{
					object value = fieldInfo.GetValue(componentInChildren5);
					object value2 = fieldInfo.GetValue(componentInChildren6);
					if (value != null && value2 != null && !AreEqual(value, value2))
					{
						Debug.Log((object)$"Gun Stat: {fieldInfo.Name} = {value} Default = {value2}");
					}
				}
			}
			else
			{
				Debug.Log((object)"No component found on this card.");
			}
		}

		public static void ModifyInfoStat(CardInfo card, List<CardInfoStat> stats, int index, bool? isPositive = null, string stat = null, string amount = null)
		{
			//IL_007e: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			if (stat == "" || amount == "")
			{
				stats.RemoveAt(index);
			}
			else if (index == -1)
			{
				stats.Add(new CardInfoStat
				{
					positive = (isPositive ?? true),
					stat = stat,
					amount = amount,
					simepleAmount = (SimpleAmount)0
				});
			}
			else
			{
				stats[index] = new CardInfoStat
				{
					positive = (isPositive ?? stats[index].positive),
					stat = (stat ?? stats[index].stat),
					amount = (amount ?? stats[index].amount),
					simepleAmount = (SimpleAmount)0
				};
			}
			card.cardStats = stats.ToArray();
		}

		internal static string SanitizeText(string text)
		{
			return sanitizeRegex.Replace(text, "");
		}
	}
	[HarmonyPatch(typeof(Block), "Cooldown")]
	public class Block_Cooldown_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref float __result, Block __instance)
		{
			__result = __instance.cooldown * __instance.cdMultiplier + __instance.cdAdd;
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(ToggleCardsMenuHandler), "UpdateVisualsCardObj")]
	public class Patch
	{
		public static void Prefix(GameObject cardObject)
		{
			GameObject cardObject2 = cardObject;
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 15, (Action)delegate
			{
				//IL_0093: 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_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Expected O, but got Unknown
				if (ToggleCardsMenuHandler.cardMenuCanvas.gameObject.activeSelf)
				{
					string text = ((Object)cardObject2.GetComponentInChildren<CardInfo>()).name.Substring(0, ((Object)cardObject2.GetComponentInChildren<CardInfo>()).name.Length - 7);
					string key = CardBalance.SanitizeText(text);
					CardInfo componentInChildren = cardObject2.GetComponentInChildren<CardInfo>();
					componentInChildren.rarity = ((CardBalance.CardRarities[key].Value != "DEFAULT") ? RarityUtils.GetRarity(CardBalance.CardRarities[key].Value) : CardBalance.DefaultRarities[key]);
					List<CardInfoStat> list = new List<CardInfoStat>(componentInChildren.cardStats);
					CardBalance.UpdateCardStats(componentInChildren);
					cardObject2.GetComponentsInChildren<CardRarityColor>().ToList().ForEach(delegate(CardRarityColor r)
					{
						r.Toggle(true);
					});
					if (list.Count > 0)
					{
						CardInfoDisplayer componentInChildren2 = cardObject2.GetComponentInChildren<CardInfoDisplayer>();
						if ((Object)(object)componentInChildren2 != (Object)null && componentInChildren.cardStats != null)
						{
							foreach (Transform item in componentInChildren2.grid.transform)
							{
								Transform val = item;
								if ((Object)(object)val != (Object)(object)((TMP_Text)componentInChildren2.effectText).transform)
								{
									Object.Destroy((Object)(object)((Component)val).gameObject);
								}
							}
							componentInChildren2.DrawCard(componentInChildren.cardStats, componentInChildren.cardName, componentInChildren.cardDestription, componentInChildren.sprite, false);
						}
					}
				}
			});
		}
	}
}