Decompiled source of Supercharged Tarots v1.0.3

plugins/SuperchargedTarots/SuperchargedTarots.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using COTL_API.CustomTarotCard;
using HarmonyLib;
using Lamb.UI;
using Microsoft.CodeAnalysis;
using SuperchargedTarots.Tarots;
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("SuperchargedTarots")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ed7681969805c8b5e05c6eefc5edb73ea1a14f83")]
[assembly: AssemblyProduct("SuperchargedTarots")]
[assembly: AssemblyTitle("SuperchargedTarots")]
[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 SuperchargedTarots
{
	[BepInPlugin("InfernoDragon0.cotl.SuperchargedTarots", "SuperchargedTarots", "1.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "InfernoDragon0.cotl.SuperchargedTarots";

		public const string PluginName = "SuperchargedTarots";

		public const string PluginVer = "1.0.3";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("InfernoDragon0.cotl.SuperchargedTarots");

		internal static string PluginPath;

		public static Card perfectCurseX;

		public static Card speedX;

		public static Card speedRunX;

		public static Card heartsX;

		public static Card damageX;

		public static Card curseDamageX;

		public static Card sunX;

		public static Card critX;

		public static Card ammoX;

		public static Card relicChargeX;

		public static Card blunderBusterX;

		public static Card gunslingerX;

		public static Card resilientGunnerX;

		public static Card multishotX;

		internal static ConfigEntry<float> ammoConfig;

		internal static ConfigEntry<float> curseDamageConfig;

		internal static ConfigEntry<float> damageConfig;

		internal static ConfigEntry<float> heartsConfig;

		internal static ConfigEntry<float> relicChargeConfig;

		internal static ConfigEntry<float> speedConfig;

		internal static ConfigEntry<float> speedRunConfig;

		internal static ConfigEntry<float> sunConfig;

		internal static ConfigEntry<float> moonConfig;

		internal static ConfigEntry<bool> shouldAddCardConfig;

		internal static ConfigEntry<bool> enableGunslingerCard;

		private void Awake()
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: 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_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			ammoConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "Ammo", 66f, "Fervor Use Discount (higher the lesser, but dont go over 100)");
			curseDamageConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "CurseDamage", 3f, "Curse Damage Multiplier");
			damageConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "Damage", 1f, "Damage Multiplier");
			heartsConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "Hearts", 20f, "Black Hearts, 2 per full heart");
			relicChargeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "RelicCharge", 30f, "Relic Charge Multiplier");
			speedConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "AttackSpeed", 5f, "Attack Speed Multiplier");
			speedRunConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "SpeedRun", 3f, "Move Speed Multiplier (should not go over 10, or you will move too fast)");
			sunConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "Sun", 2f, "Sun Damage Multiplier");
			moonConfig = ((BaseUnityPlugin)this).Config.Bind<float>("SuperchargedTarots", "Moon", 3f, "Moon Damage Multiplier");
			shouldAddCardConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarots", "AddCards", false, "Set to true if tarots are not being added when collecting them. (Fix for double tarot bug)");
			enableGunslingerCard = ((BaseUnityPlugin)this).Config.Bind<bool>("SuperchargedTarots", "EnableGunslingerCard", true, "Set to false to disable Gunslinger Tarot Card");
			ammoX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_AmmoX());
			critX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_CritX());
			curseDamageX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_CurseDamageX());
			damageX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_DamageX());
			heartsX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_HeartsX());
			speedX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_SpeedX());
			speedRunX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_SpeedRunX());
			sunX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_SunX());
			perfectCurseX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_PerfectCurseX());
			relicChargeX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_RelicChargeX());
			blunderBusterX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_BlunderBusterX());
			if (enableGunslingerCard.Value)
			{
				gunslingerX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_GunslingerX());
			}
			resilientGunnerX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_ResilientGunnerX());
			multishotX = CustomTarotCardManager.Add((CustomTarotCard)(object)new Tarot_MultishotX());
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded SuperchargedTarots!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded SuperchargedTarots!");
		}
	}
}
namespace SuperchargedTarots.Tarots
{
	internal class Tarot_AmmoX : CustomTarotCard
	{
		public override string InternalName => "TAROT_AMMO_X";

		public override string Skin => "Trinkets/AmmoEfficient";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Shadow Quiver</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "Near Infinite Curse Casting.";
		}

		public override float GetAmmoEfficiency(TarotCard card)
		{
			return Plugin.ammoConfig.Value;
		}
	}
	internal class Tarot_BlunderBusterX : CustomTarotCard
	{
		public override string InternalName => "TAROT_BLUNDERBUSTER_X";

		public override string Skin => "Trinkets/EyeOfWeakness";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Blunder Buster</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "Infinite Ammo for Blunderbuss.";
		}
	}
	internal class Tarot_CritX : CustomTarotCard
	{
		public override string InternalName => "TAROT_CRIT_X";

		public override string Skin => "Trinkets/EyeOfWeakness";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Deadeye</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "Always Crit.";
		}

		public override float GetWeaponCritChanceIncrease(TarotCard card)
		{
			return 1f;
		}
	}
	internal class Tarot_CurseDamageX : CustomTarotCard
	{
		public override string InternalName => "TAROT_CURSEDAMAGE_X";

		public override string Skin => "Trinkets/Potion";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Supernova</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return Plugin.curseDamageConfig.Value + "x more Curse Damage.";
		}

		public override float GetCurseDamageMultiplerIncrease(TarotCard card)
		{
			return Plugin.curseDamageConfig.Value;
		}
	}
	internal class Tarot_DamageX : CustomTarotCard
	{
		public override string InternalName => "TAROT_DAMAGE_X";

		public override string Skin => "Trinkets/IncreasedDamage";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Ruinous Strike</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return Plugin.damageConfig.Value + "x more Damage.";
		}

		public override float GetWeaponDamageMultiplerIncrease(TarotCard card)
		{
			return Plugin.damageConfig.Value;
		}
	}
	internal class Tarot_GunslingerX : CustomTarotCard
	{
		public override string InternalName => "TAROT_GUNSLINGER_X";

		public override string Skin => "Trinkets/EyeOfWeakness";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">The Gunslinger</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "All weapon choices are now Blunderbuss only.";
		}
	}
	internal class Tarot_HeartsX : CustomTarotCard
	{
		public override string InternalName => "TAROT_HEARTS_X";

		public override string Skin => "Trinkets/DiseasedHeart";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Ace of Hearts</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "Grants you " + Plugin.heartsConfig.Value + " Black Hearts";
		}

		public override void ApplyInstantEffects(TarotCard card)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			HealthPlayer component = ((Component)PlayerFarming.Instance).GetComponent<HealthPlayer>();
			((Health)component).BlackHearts = ((Health)component).BlackHearts + Plugin.heartsConfig.Value;
			Vector3 position = PlayerFarming.Instance.CameraBone.transform.position;
			BiomeConstants.Instance.EmitHeartPickUpVFX(position, 0f, "red", "burst_big", true);
		}
	}
	internal class Tarot_MultishotX : CustomTarotCard
	{
		public override string InternalName => "TAROT_MULTISHOT_X";

		public override string Skin => "Trinkets/EyeOfWeakness";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Multishot</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "Blunderbuss attacks will shoot in all 4 directions.";
		}
	}
	public class Tarot_PerfectCurseX : CustomTarotCard
	{
		public override string InternalName => "TAROT_PERFECT_CURSE_X";

		public override string Skin => "Trinkets/AmmoEfficient";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Curse Perfected</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "Always Perfect Curse Casting.";
		}
	}
	internal class Tarot_RelicChargeX : CustomTarotCard
	{
		public override string InternalName => "TAROT_RELICCHARGE_X";

		public override string Skin => "Trinkets/DecreaseRelicCharge";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Relic Overdrive</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return Plugin.relicChargeConfig.Value + "x Relic Charge Speed.";
		}

		public override float GetRelicChargeMultiplier(TarotCard card)
		{
			return Plugin.relicChargeConfig.Value;
		}
	}
	internal class Tarot_ResilientGunnerX : CustomTarotCard
	{
		public override string InternalName => "TAROT_RESILIENTGUNNER_X";

		public override string Skin => "Trinkets/EyeOfWeakness";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Resilient Gunner</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return "No Recoil when using Blunderbuss.";
		}
	}
	internal class Tarot_SpeedRunX : CustomTarotCard
	{
		public override string InternalName => "TAROT_SPEEDRUN_X";

		public override string Skin => "Trinkets/MovementSpeed";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Speedrunner</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return Plugin.speedRunConfig.Value + "x Movement Speed.";
		}

		public override float GetMovementSpeedMultiplier(TarotCard card)
		{
			return Plugin.speedRunConfig.Value;
		}
	}
	internal class Tarot_SpeedX : CustomTarotCard
	{
		public override string InternalName => "TAROT_SPEED_X";

		public override string Skin => "Trinkets/AttackRate";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">Sonic Surge</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return Plugin.speedConfig.Value + "x Attack Speed.";
		}

		public override float GetAttackRateMultiplier(TarotCard card)
		{
			return Plugin.speedConfig.Value;
		}
	}
	internal class Tarot_SunX : CustomTarotCard
	{
		public override string InternalName => "TAROT_SUN_X";

		public override string Skin => "Trinkets/Sun";

		public override string LocalisedName(int upgradeIndex)
		{
			return "<color=\"red\">The Solunar Eclipse</color>";
		}

		public override string LocalisedLore()
		{
			return "<color=\"yellow\">[Supercharged Series]</color>";
		}

		public override string LocalisedDescription(int upgradeIndex)
		{
			return Plugin.sunConfig.Value + "x Damage during the day, " + Plugin.moonConfig.Value + "x Damage during the night.";
		}

		public override float GetWeaponDamageMultiplerIncrease(TarotCard card)
		{
			return (!TimeManager.IsDay) ? Plugin.moonConfig.Value : Plugin.sunConfig.Value;
		}
	}
}
namespace SuperchargedTarots.Patches
{
	[HarmonyPatch]
	internal class AmmoPatch
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static bool PlayerSpells_AmmoCost(PlayerSpells __instance, ref int __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (TrinketManager.HasTrinket(Plugin.ammoX))
			{
				__result = 1;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(BlunderAmmo), "UseAmmo")]
		[HarmonyPrefix]
		public static bool BlunderAmmo_UseAmmo(BlunderAmmo __instance, ref bool __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (TrinketManager.HasTrinket(Plugin.blunderBusterX))
			{
				__result = true;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Interaction_WeaponSelectionPodium), "SetWeapon")]
		[HarmonyPrefix]
		public static bool Interaction_WeaponSelectionPodium_SetWeapon(Interaction_WeaponSelectionPodium __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (TrinketManager.HasTrinket(Plugin.gunslingerX))
			{
				__instance.TypeOfWeapon = (EquipmentType)450;
				__instance.PrevEquipment = __instance.TypeOfWeapon;
				__instance.WeaponLevel = DataManager.Instance.CurrentRunWeaponLevel + 1;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerWeapon), "DoBlunderbussAttack")]
		[HarmonyPostfix]
		public static void PlayerWeapon_DoBlunderbussAttack(PlayerWeapon __instance, AttackTypes attackType, ref bool __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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)
			if (TrinketManager.HasTrinket(Plugin.multishotX))
			{
				Plugin.Log.LogInfo((object)"shooting 4 directions");
				for (int i = 0; i < 3; i++)
				{
					float num = __instance.state.facingAngle + (float)((i + 1) * 90);
					Swipe component = ((Component)Object.Instantiate<Swipe>(__instance.blunderAmmo.swipe)).GetComponent<Swipe>();
					Vector3 val = ((Component)__instance).transform.position + new Vector3(__instance.playerFarming.CurrentWeaponInfo.WeaponData.Combos[__instance.CurrentCombo].RangeRadius * __instance.playerFarming.CurrentWeaponInfo.RangeMultiplier * Mathf.Cos(__instance.state.facingAngle * (MathF.PI / 180f)), __instance.playerFarming.CurrentWeaponInfo.WeaponData.Combos[__instance.CurrentCombo].RangeRadius * __instance.playerFarming.CurrentWeaponInfo.RangeMultiplier * Mathf.Sin(__instance.state.facingAngle * (MathF.PI / 180f)), -0.5f);
					AttackFlags val2 = (AttackFlags)0;
					component.destroyAfterDuration = true;
					component.Init(val, num, __instance.overrideTeam.HasValue ? __instance.overrideTeam.Value : __instance.health.team, __instance.health, (Action<Health, AttackTypes, AttackFlags, float>)__instance.BlunderBussEnemyCallBack, __instance.playerFarming.CurrentWeaponInfo.WeaponData.Combos[__instance.CurrentCombo].RangeRadius * __instance.playerFarming.CurrentWeaponInfo.RangeMultiplier, 0f, __instance.GetCritChance(), attackType, val2);
					((Component)component).gameObject.transform.localScale = Vector3.one;
				}
			}
			if (TrinketManager.HasTrinket(Plugin.resilientGunnerX))
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch]
	internal class PerfectCastPatch
	{
		[HarmonyPatch(typeof(UITarotChoiceOverlayController), "Show")]
		[HarmonyPrefix]
		public static bool UITarotChoiceOverlayController_Show(UITarotChoiceOverlayController __instance, TarotCard card1, TarotCard card2, bool instant)
		{
			Plugin.Log.LogInfo((object)("Removing " + ((object)(Card)(ref card1.CardType)).ToString() + " and " + ((object)(Card)(ref card2.CardType)).ToString()));
			__instance._card1 = GetCard();
			__instance._card2 = GetCard(customFirst: false);
			__instance._uiCard1.Play(__instance._card1);
			__instance._uiCard2.Play(__instance._card2);
			__instance.OnTarotCardSelected = (Action<TarotCard>)Delegate.Combine(__instance.OnTarotCardSelected, (Action<TarotCard>)delegate(TarotCard card)
			{
				Plugin.Log.LogInfo((object)("keeping " + ((object)(Card)(ref card.CardType)).ToString()));
			});
			((UIMenuBase)__instance).Show(instant);
			return false;
		}

		private static TarotCard GetCard(bool customFirst = true)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			TarotCard val = null;
			bool flag = false;
			if (customFirst)
			{
				Card val2 = CustomTarotCardManager.CustomTarotCardList.Keys.ElementAt(Random.Range(0, CustomTarotCardManager.CustomTarotCardList.Count));
				val = new TarotCard(val2, 0);
			}
			if (DataManager.Instance.PlayerRunTrinketsContains(val, PlayerFarming.Instance))
			{
				Plugin.Log.LogInfo((object)"custom already taken");
				flag = true;
			}
			if (PlayerFarming.playersCount > 1 && DataManager.Instance.PlayerRunTrinketsContains(val, PlayerFarming.players[1]))
			{
				Plugin.Log.LogInfo((object)"custom already taken by other player");
				flag = true;
			}
			if (flag || val == null)
			{
				if (!DataManager.Instance.FirstTarot && TarotCards.DrawRandomCard(PlayerFarming.Instance, true) != null)
				{
					DataManager.Instance.FirstTarot = true;
					val = new TarotCard((Card)3, 0);
				}
				else
				{
					val = TarotCards.DrawRandomCard(PlayerFarming.Instance, true);
				}
			}
			return val;
		}

		[HarmonyPatch(typeof(PlayerFarming), "CorrectProjectileChargeRelease")]
		[HarmonyPrefix]
		public static bool PlayerFarming_CorrectProjectileChargeRelease(ref bool __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (TrinketManager.HasTrinket(Plugin.perfectCurseX))
			{
				Plugin.Log.LogInfo((object)"Performing perfect cast");
				__result = true;
				return false;
			}
			return true;
		}
	}
}