Decompiled source of AllCardsCostX v1.0.3

AllCardsCostX.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.CardCosts;
using Microsoft.CodeAnalysis;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("AllCardsCostX")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Placeholder description")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AllCardsCostX")]
[assembly: AssemblyTitle("AllCardsCostX")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AllCardsCostX
{
	[BepInPlugin("tvflabs.inscryption.AllCardsCostX", "AllCardsCostX", "1.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GainConsumablesSequencer), "FullConsumablesSequence")]
		private class GainConsumablesSequencer_FullConsumablesSequence_Patch
		{
			private static IEnumerator Postfix(IEnumerator values, GainConsumablesSequencer __instance)
			{
				__instance.fullConsumablesReward = CardLoader.GetCardByName("PackRat");
				yield return values;
			}
		}

		private Harmony harmony = new Harmony("tvflabs.inscryption.AllCardsCostX");

		private const string PluginGuid = "tvflabs.inscryption.AllCardsCostX";

		private const string PluginName = "AllCardsCostX";

		private const string PluginVersion = "1.0.3";

		private const string PluginPrefix = "AllCardsCostX";

		private static ConfigEntry<bool> bloodEnabled;

		private static ConfigEntry<bool> bonesEnabled;

		private static ConfigEntry<bool> energyEnabled;

		private static ConfigEntry<bool> moxEnabled;

		private static ConfigEntry<bool> changeSigils;

		private static ConfigEntry<bool> useModifiedSp;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded AllCardsCostX!");
			bloodEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Costs", "BloodEnabled", true, "Allow cards to cost Blood");
			bonesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Costs", "BonesEnabled", true, "Allow cards to cost Bones");
			energyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Costs", "EnergyEnabled", true, "Allow cards to cost Energy");
			moxEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Costs", "MoxEnabled", true, "Allow cards to cost Mox");
			changeSigils = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "ChangeSigils", true, "Change cards' sigils to relevant ones when they're related to a disabled cost");
			useModifiedSp = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "UseModifiedSP", false, "Use a rebalanced version of the SP system, instead of the official one, for determining cards' new cost amounts");
			ModifyCards();
			harmony.PatchAll();
		}

		private void ModifyCards()
		{
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				List<CardInfo> list = new List<CardInfo>();
				foreach (CardInfo card in cards)
				{
					if ((Object)(object)card != (Object)null)
					{
						CardInfo val = SetStats(card);
						list.Add(card);
					}
				}
				return list;
			};
		}

		private CardInfo SetStats(CardInfo cardToSet)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Invalid comparison between Unknown and I4
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Invalid comparison between Unknown and I4
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Invalid comparison between Unknown and I4
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected I4, but got Unknown
			//IL_0f4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f51: Invalid comparison between Unknown and I4
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0731: Invalid comparison between Unknown and I4
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Invalid comparison between Unknown and I4
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Expected I4, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Invalid comparison between Unknown and I4
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Expected I4, but got Unknown
			//IL_0ae0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae4: Invalid comparison between Unknown and I4
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Invalid comparison between Unknown and I4
			//IL_0746: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Expected I4, but got Unknown
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Invalid comparison between Unknown and I4
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Expected I4, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Expected I4, but got Unknown
			//IL_0b78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7c: Invalid comparison between Unknown and I4
			//IL_0af9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afc: Expected I4, but got Unknown
			//IL_085d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0861: Invalid comparison between Unknown and I4
			//IL_07de: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Expected I4, but got Unknown
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Invalid comparison between Unknown and I4
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Expected I4, but got Unknown
			//IL_0fad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb3: Invalid comparison between Unknown and I4
			//IL_0c10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c14: Invalid comparison between Unknown and I4
			//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b94: Expected I4, but got Unknown
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f9: Invalid comparison between Unknown and I4
			//IL_0876: Unknown result type (might be due to invalid IL or missing references)
			//IL_0879: Expected I4, but got Unknown
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Invalid comparison between Unknown and I4
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Expected I4, but got Unknown
			//IL_0ca8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cac: Invalid comparison between Unknown and I4
			//IL_0c29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2c: Expected I4, but got Unknown
			//IL_098d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0991: Invalid comparison between Unknown and I4
			//IL_090e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Expected I4, but got Unknown
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Invalid comparison between Unknown and I4
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Expected I4, but got Unknown
			//IL_0cae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb2: Invalid comparison between Unknown and I4
			//IL_0a25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Invalid comparison between Unknown and I4
			//IL_09a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a9: Expected I4, but got Unknown
			//IL_100f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1015: Invalid comparison between Unknown and I4
			//IL_0cb4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb8: Invalid comparison between Unknown and I4
			//IL_0d4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d53: Invalid comparison between Unknown and I4
			//IL_0cd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd3: Expected I4, but got Unknown
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_069e: Expected I4, but got Unknown
			//IL_0de7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0deb: Invalid comparison between Unknown and I4
			//IL_0d68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6b: Expected I4, but got Unknown
			//IL_0a4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a51: Expected I4, but got Unknown
			//IL_0e1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e22: Invalid comparison between Unknown and I4
			//IL_0dfd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e00: Expected I4, but got Unknown
			//IL_0e55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e59: Invalid comparison between Unknown and I4
			//IL_0e34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e37: Expected I4, but got Unknown
			//IL_0e8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e90: Invalid comparison between Unknown and I4
			//IL_0e6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6e: Expected I4, but got Unknown
			//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea8: Expected I4, but got Unknown
			bool flag = !bloodEnabled.Value && !bonesEnabled.Value && !energyEnabled.Value && !moxEnabled.Value;
			int num = 0;
			if (flag)
			{
				if (cardToSet.BloodCost > 0 || cardToSet.BonesCost > 0 || cardToSet.EnergyCost > 0 || cardToSet.GemsCost.Count > 0 || CardExtensions.GetCustomCosts(cardToSet).Count > 0)
				{
					CardExtensions.SetBaseAttackAndHealth(cardToSet, (int?)0, (int?)1);
					CardExtensions.SetBloodCost(cardToSet, (int?)0);
					CardExtensions.SetBonesCost(cardToSet, (int?)0);
					CardExtensions.SetEnergyCost(cardToSet, (int?)0);
					CardExtensions.SetGemsCost(cardToSet, new List<GemType>());
					if ((int)cardToSet.SpecialStatIcon > 0)
					{
						cardToSet.specialStatIcon = (SpecialStatIcon)0;
					}
					foreach (FullCardCost customCost in CardExtensions.GetCustomCosts(cardToSet))
					{
						CardExtensions.SetCustomCost(cardToSet, customCost, 0);
					}
				}
			}
			else
			{
				bool flag2 = cardToSet.BloodCost == 0 && cardToSet.BonesCost == 0 && cardToSet.EnergyCost == 0 && cardToSet.GemsCost.Count == 0;
				if (changeSigils.Value)
				{
					foreach (Ability ability in cardToSet.Abilities)
					{
						if (!bloodEnabled.Value)
						{
							if ((int)ability == 20)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)28 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)66 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)44 });
								}
							}
							else if ((int)ability == 22)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)12 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)41 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)51 });
								}
							}
							else if ((int)ability == 103)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)41 });
								}
								else if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)12 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)51 });
								}
							}
						}
						if (!bonesEnabled.Value)
						{
							if ((int)ability == 28)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)66 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)44 });
								}
							}
							else if ((int)ability == 12)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)22 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)41 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)51 });
								}
							}
							else if ((int)ability == 101)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)40 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)66 });
								}
							}
							else if ((int)ability == 71)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)81 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)40 });
								}
							}
							else if ((int)ability == 73)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)80 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)74 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
								}
							}
							else if ((int)ability == 87 && !energyEnabled.Value)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)80 });
								}
								else if (energyEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)81 });
								}
							}
						}
						if (!energyEnabled.Value)
						{
							if ((int)ability == 66)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)77 });
								}
								else if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)28 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
								}
							}
							else if ((int)ability == 51)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)12 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)22 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)44 });
								}
							}
							else if ((int)ability == 69)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)71 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)80 });
								}
							}
							else if ((int)ability == 74)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)73 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)40 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
								}
							}
							else if ((int)ability == 81)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)71 });
								}
								else if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)40 });
								}
							}
							else if ((int)ability == 87 && !bonesEnabled.Value)
							{
								CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
								if (bloodEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
								}
								else if (bonesEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)71 });
								}
								else if (moxEnabled.Value)
								{
									CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)80 });
								}
							}
						}
						if (moxEnabled.Value)
						{
							continue;
						}
						if ((int)ability == 44)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							if (bloodEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)22 });
							}
							else if (bonesEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)12 });
							}
							else if (energyEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)66 });
							}
						}
						else if ((int)ability == 41)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							if (bloodEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
							}
							else if (bonesEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)12 });
							}
							else if (energyEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)51 });
							}
						}
						else if ((int)ability == 40)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							if (bonesEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)71 });
							}
							else if (energyEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)81 });
							}
							else if (bloodEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
							}
						}
						else if ((int)ability == 37 || (int)ability == 38 || (int)ability == 39)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							if (bloodEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
							}
							else if (bonesEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)28 });
							}
							else if (energyEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)51 });
							}
						}
						else if ((int)ability == 42)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							if (energyEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)51 });
							}
							else if (bloodEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)20 });
							}
							else if (bonesEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)12 });
							}
						}
						else if ((int)ability == 77)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)48 });
						}
						else if ((int)ability == 63)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)52 });
						}
						else if ((int)ability == 64)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)54 });
						}
						else if ((int)ability == 80)
						{
							CardExtensions.RemoveAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)(int)ability });
							if (bonesEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)73 });
							}
							else if (bloodEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)103 });
							}
							else if (energyEnabled.Value)
							{
								CardExtensions.AddAbilities(cardToSet, (Ability[])(object)new Ability[1] { (Ability)74 });
							}
						}
					}
					if (!bloodEnabled.Value && (int)cardToSet.SpecialStatIcon == 7)
					{
						if (moxEnabled.Value)
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)5);
						}
						else if (bonesEnabled.Value)
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)2);
						}
						else
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)3);
						}
					}
					if (!bonesEnabled.Value && (int)cardToSet.SpecialStatIcon == 2)
					{
						if (bloodEnabled.Value)
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)7);
						}
						else if (moxEnabled.Value)
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)5);
						}
						else
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)4);
						}
					}
					if (!moxEnabled.Value && (int)cardToSet.SpecialStatIcon == 5)
					{
						if (bloodEnabled.Value)
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)7);
						}
						else if (bonesEnabled.Value)
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)2);
						}
						else
						{
							CardExtensions.SetStatIcon(cardToSet, (SpecialStatIcon)6);
						}
					}
				}
				if (!bloodEnabled.Value && cardToSet.BloodCost > 0)
				{
					float num2 = (float)(Math.Pow(cardToSet.BloodCost, 2.0) / 2.0 + (double)(7f * ((float)cardToSet.BloodCost / 2f)) - 1.0);
					num = ((!(num2 - (float)(int)num2 < 0.5f)) ? (num + ((int)num2 + 1)) : (num + (int)num2));
					CardExtensions.SetBloodCost(cardToSet, (int?)0);
				}
				if (!bonesEnabled.Value && cardToSet.BonesCost > 0)
				{
					float num3 = (float)cardToSet.BonesCost * 6f / 5f;
					num = ((!(num3 - (float)(int)num3 < 0.5f)) ? (num + ((int)num3 + 1)) : (num + (int)num3));
					CardExtensions.SetBonesCost(cardToSet, (int?)0);
				}
				if (!energyEnabled.Value && cardToSet.EnergyCost > 0)
				{
					num += cardToSet.EnergyCost;
					CardExtensions.SetEnergyCost(cardToSet, (int?)0);
				}
				if (!moxEnabled.Value && cardToSet.GemsCost.Count > 0)
				{
					num += 2 + (cardToSet.GemsCost.Count - 1) * 3;
					CardExtensions.SetGemsCost(cardToSet, new List<GemType>());
				}
				if (num > 0)
				{
					List<string> list = new List<string>();
					if (bloodEnabled.Value)
					{
						list.Add("blood");
					}
					if (bonesEnabled.Value)
					{
						list.Add("bones");
					}
					if (energyEnabled.Value)
					{
						list.Add("energy");
					}
					if (moxEnabled.Value)
					{
						list.Add("mox");
					}
					switch (list[SeededRandom.Range(0, list.Count, ((Object)cardToSet).name.GetHashCode())])
					{
					case "blood":
						if (num <= 6)
						{
							CardExtensions.SetBloodCost(cardToSet, (int?)1);
							num -= 3;
						}
						else if (num <= 11)
						{
							CardExtensions.SetBloodCost(cardToSet, (int?)2);
							num -= 8;
						}
						else if (num <= 18)
						{
							CardExtensions.SetBloodCost(cardToSet, (int?)3);
							num -= 14;
						}
						else
						{
							CardExtensions.SetBloodCost(cardToSet, (int?)4);
							num -= 21;
						}
						break;
					case "bones":
					{
						float num4 = (float)num * 5f / 6f;
						if (num4 - (float)(int)num4 < 0.5f)
						{
							CardExtensions.SetBonesCost(cardToSet, (int?)(int)num4);
						}
						else
						{
							CardExtensions.SetBonesCost(cardToSet, (int?)((int)num4 + 1));
						}
						num = 0;
						break;
					}
					case "energy":
						if (num > 6)
						{
							CardExtensions.SetEnergyCost(cardToSet, (int?)6);
							num -= 6;
						}
						else
						{
							CardExtensions.SetEnergyCost(cardToSet, (int?)num);
							num = 0;
						}
						break;
					case "mox":
						if (num <= 3)
						{
							CardExtensions.SetGemsCost(cardToSet, GetGemColors(cardToSet, 1));
							num -= 2;
						}
						else if ((num <= 6 && !useModifiedSp.Value) || (num <= 8 && useModifiedSp.Value))
						{
							CardExtensions.SetGemsCost(cardToSet, GetGemColors(cardToSet, 2));
							num -= 5;
						}
						else
						{
							CardExtensions.SetGemsCost(cardToSet, GetGemColors(cardToSet, 3));
							num -= 8;
						}
						break;
					}
				}
			}
			return cardToSet;
		}

		private List<GemType> GetGemColors(CardInfo card, int numColors)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (numColors == 0)
			{
				return new List<GemType>();
			}
			List<GemType> list = new List<GemType>(3)
			{
				(GemType)1,
				(GemType)2,
				(GemType)0
			};
			if (numColors >= 3)
			{
				return list;
			}
			List<GemType> list2 = new List<GemType>();
			for (int i = 0; i < numColors; i++)
			{
				GemType item = list[SeededRandom.Range(0, list.Count, ((Object)card).name.GetHashCode() + i + 1)];
				list2.Add(item);
				list.Remove(item);
			}
			return list2;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AllCardsCostX";

		public const string PLUGIN_NAME = "AllCardsCostX";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}