Decompiled source of FecundityRework v0.0.4

FecundityRework.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
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("FecundityRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("This plugin is a BepInEx plugin made for Inscryption to Rework Fecundity sigil in Kaycee's Mod.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FecundityRework")]
[assembly: AssemblyTitle("FecundityRework")]
[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 FecundityRework
{
	[BepInPlugin("orochiumbra.inscryption.fecundityrework", "FecundityRework", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class FecundityRework : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(RuleBookController))]
		[HarmonyPatch(typeof(DrawCopy))]
		internal static class DrawCopyPatches
		{
			private static readonly SpecialTriggeredAbility globalSpellAbility = GuidManager.GetEnumValue<SpecialTriggeredAbility>("zorro.infiniscryption.sigils", "Spell (Global)");

			private static readonly SpecialTriggeredAbility instaGlobalSpellAbility = GuidManager.GetEnumValue<SpecialTriggeredAbility>("zorro.infiniscryption.sigils", "Spell (Global, Instant)");

			private static readonly SpecialTriggeredAbility targetedSpellAbility = GuidManager.GetEnumValue<SpecialTriggeredAbility>("zorro.infiniscryption.sigils", "Spell (Targeted)");

			[HarmonyPostfix]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			private static void NoCardMods(ref List<CardModificationInfo> __result, AbilityBehaviour __instance)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected I4, but got Unknown
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected I4, but got Unknown
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected I4, but got Unknown
				if (Active)
				{
					__result = (CardExtensions.HasAnyOfSpecialAbilities(__instance.Card, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[3]
					{
						(SpecialTriggeredAbility)(int)globalSpellAbility,
						(SpecialTriggeredAbility)(int)instaGlobalSpellAbility,
						(SpecialTriggeredAbility)(int)targetedSpellAbility
					}) ? __result : null);
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("RespondsToResolveOnBoard")]
			private static void DontResolveOnBoard(ref bool __result, AbilityBehaviour __instance)
			{
				//IL_019c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Expected I4, but got Unknown
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Expected I4, but got Unknown
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: Expected I4, but got Unknown
				//IL_0058: 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_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Expected I4, but got Unknown
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Expected I4, but got Unknown
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Expected I4, but got Unknown
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				if (Active)
				{
					Log.LogInfo((object)string.Format("Checking if spells are {0}", Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.spells")));
					if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.spells"))
					{
						Log.LogInfo((object)$"ID {globalSpellAbility} is global spell abilities.");
						Log.LogInfo((object)$"ID {instaGlobalSpellAbility} is insta global spell abilities.");
						Log.LogInfo((object)$"ID {targetedSpellAbility} is targeted spell abilities.");
						Log.LogInfo((object)$"Checking if Card had Played is A Spell : {CardExtensions.HasAnyOfSpecialAbilities(__instance.Card, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[3]
						{
							(SpecialTriggeredAbility)(int)globalSpellAbility,
							(SpecialTriggeredAbility)(int)instaGlobalSpellAbility,
							(SpecialTriggeredAbility)(int)targetedSpellAbility
						})}");
						Log.LogInfo((object)$"Checking if Card had Played is Global Spell : {CardExtensions.HasSpecialAbility(__instance.Card, globalSpellAbility)}");
						Log.LogInfo((object)$"Checking if Card had Played is Insta Global Spell : {CardExtensions.HasSpecialAbility(__instance.Card, instaGlobalSpellAbility)}");
						Log.LogInfo((object)$"Checking if Card had Played is Targeted Spell : {CardExtensions.HasSpecialAbility(__instance.Card, targetedSpellAbility)}");
					}
					Log.LogInfo((object)(((Object)__instance.Card).name + " Fecundity"));
					__result = CardExtensions.HasAnyOfSpecialAbilities(__instance.Card, (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[3]
					{
						(SpecialTriggeredAbility)(int)globalSpellAbility,
						(SpecialTriggeredAbility)(int)instaGlobalSpellAbility,
						(SpecialTriggeredAbility)(int)targetedSpellAbility
					});
				}
			}
		}

		public class FecundityReworkConfigManager
		{
			private static FecundityReworkConfigManager fecundityrework_Instance;

			private readonly ConfigFile FecundityReworkConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "orochiumbra.inscryption.fecundityrework.cfg"), true);

			private ConfigEntry<bool> Config_ModEnabled;

			private ConfigEntry<bool> Config_AscensionEnabled;

			public static FecundityReworkConfigManager Instance => fecundityrework_Instance ?? (fecundityrework_Instance = new FecundityReworkConfigManager());

			public bool ModEnabled => Config_ModEnabled.Value;

			public bool AscensionEnabled => Config_AscensionEnabled.Value;

			internal void BindConfig()
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				Config_ModEnabled = FecundityReworkConfigFile.Bind<bool>("Config", "Enable", false, new ConfigDescription("Enables Fecundity Rework for Part 1.", (AcceptableValueBase)null, Array.Empty<object>()));
				Config_AscensionEnabled = FecundityReworkConfigFile.Bind<bool>("Config", "Ascension Enable", true, new ConfigDescription("Enables Fecundity Rework in Kaycee's Mod.", (AcceptableValueBase)null, Array.Empty<object>()));
			}
		}

		[HarmonyPatch(typeof(RuleBookController))]
		public static class DrawCopyReworkRuleBookPage
		{
			[HarmonyPrefix]
			[HarmonyPatch("SetShown")]
			public static bool ResetAlteredDescriptions()
			{
				AbilityInfo info = AbilitiesUtil.GetInfo((Ability)9);
				if (Active)
				{
					info.rulebookDescription = "At the end of the owner's turn, [creature] creates a copy of it in the owner's hand then loses this sigil.";
				}
				else
				{
					info.rulebookDescription = AbilityManager.AllAbilities.Find((FullAbility x) => (int)x.Id == 9).BaseRulebookDescription;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(GlobalTriggerHandler), "TriggerCardsOnBoard")]
		internal static class FecundityTurnEndPatch
		{
			[CompilerGenerated]
			private sealed class <DrawCard>d__0 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public IEnumerator enumerator;

				public Trigger trigger;

				public object[] otherArgs;

				private object[] <x>5__1;

				private bool <isPlayerTurn>5__2;

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

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

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

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

				private bool MoveNext()
				{
					//IL_004b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0052: Invalid comparison between Unknown and I4
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = enumerator;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						if ((int)trigger != 13)
						{
							return false;
						}
						if (otherArgs != null)
						{
							<x>5__1 = otherArgs;
							if (<x>5__1.Length >= 1)
							{
								object obj = <x>5__1[0];
								int num;
								if (obj is bool)
								{
									<isPlayerTurn>5__2 = (bool)obj;
									num = 1;
								}
								else
								{
									num = 0;
								}
								if (num != 0)
								{
									<>2__current = (<isPlayerTurn>5__2 ? PlayerFecundity() : OpponentFecundity());
									<>1__state = 2;
									return true;
								}
							}
						}
						return false;
					case 2:
						<>1__state = -1;
						return false;
					}
				}

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

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

			[CompilerGenerated]
			private sealed class <OpponentFecundity>d__4 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				private IEnumerable<PlayableCard> <cards>5__1;

				private IEnumerator<PlayableCard> <>s__2;

				private PlayableCard <card>5__3;

				private int <drawCopyCount>5__4;

				private CardModificationInfo <negateAbility>5__5;

				private int <i>5__6;

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

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

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

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					int num = <>1__state;
					if (num == -3 || (uint)(num - 1) <= 6u)
					{
						try
						{
						}
						finally
						{
							<>m__Finally1();
						}
					}
					<cards>5__1 = null;
					<>s__2 = null;
					<card>5__3 = null;
					<negateAbility>5__5 = null;
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					//IL_0224: Unknown result type (might be due to invalid IL or missing references)
					//IL_022e: Expected O, but got Unknown
					//IL_025b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0265: Expected O, but got Unknown
					//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b8: Expected O, but got Unknown
					//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
					//IL_01e6: Expected O, but got Unknown
					try
					{
						switch (<>1__state)
						{
						default:
							return false;
						case 0:
							<>1__state = -1;
							<cards>5__1 = from slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy
								where (Object)(object)slot.Card != (Object)null && slot.Card.HasAbility((Ability)9)
								select slot.Card;
							<>s__2 = <cards>5__1.GetEnumerator();
							<>1__state = -3;
							break;
						case 1:
							<>1__state = -3;
							((Card)<card>5__3).Anim.StrongNegationEffect();
							<drawCopyCount>5__4 = <card>5__3.TriggerHandler.triggeredAbilities.Where((Tuple<Ability, AbilityBehaviour> ability) => ability.Item2 is DrawCopy).Select(delegate(Tuple<Ability, AbilityBehaviour> ability)
							{
								AbilityBehaviour item = ability.Item2;
								return (DrawCopy)(object)((item is DrawCopy) ? item : null);
							}).Count();
							<i>5__6 = 0;
							goto IL_01c4;
						case 2:
							<>1__state = -3;
							<i>5__6++;
							goto IL_01c4;
						case 3:
							<>1__state = -3;
							<>2__current = SwitchIfNotView((View)4);
							<>1__state = 4;
							return true;
						case 4:
							<>1__state = -3;
							<>2__current = (object)new WaitForSeconds(0.15f);
							<>1__state = 5;
							return true;
						case 5:
							<>1__state = -3;
							((Card)<card>5__3).Anim.PlayTransformAnimation();
							<>2__current = (object)new WaitForSeconds(0.15f);
							<>1__state = 6;
							return true;
						case 6:
							<>1__state = -3;
							NegateDrawCopy(out <negateAbility>5__5);
							if (<negateAbility>5__5 != null)
							{
								<card>5__3.AddTemporaryMod(<negateAbility>5__5);
							}
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 7;
							return true;
						case 7:
							{
								<>1__state = -3;
								<negateAbility>5__5 = null;
								<card>5__3 = null;
								break;
							}
							IL_01c4:
							if (<i>5__6 < <drawCopyCount>5__4)
							{
								<>2__current = QueueOpponentCard(<card>5__3);
								<>1__state = 2;
								return true;
							}
							<>2__current = (object)new WaitForSeconds(0.2f);
							<>1__state = 3;
							return true;
						}
						if (<>s__2.MoveNext())
						{
							<card>5__3 = <>s__2.Current;
							<>2__current = SwitchIfNotView((View)4);
							<>1__state = 1;
							return true;
						}
						<>m__Finally1();
						<>s__2 = null;
						return false;
					}
					catch
					{
						//try-fault
						((IDisposable)this).Dispose();
						throw;
					}
				}

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

				private void <>m__Finally1()
				{
					<>1__state = -1;
					if (<>s__2 != null)
					{
						<>s__2.Dispose();
					}
				}

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

			[CompilerGenerated]
			private sealed class <PlayerFecundity>d__1 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				private IEnumerable<PlayableCard> <cards>5__1;

				private IEnumerator<PlayableCard> <>s__2;

				private PlayableCard <card>5__3;

				private bool <wasSubmerge>5__4;

				private IEnumerable<DrawCopy> <receivers>5__5;

				private CardModificationInfo <negateAbility>5__6;

				private IEnumerator<DrawCopy> <>s__7;

				private DrawCopy <receiver>5__8;

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

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

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

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					int num = <>1__state;
					if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 8u)
					{
						try
						{
							if (num == -4 || (uint)(num - 2) <= 1u)
							{
								try
								{
								}
								finally
								{
									<>m__Finally2();
								}
							}
						}
						finally
						{
							<>m__Finally1();
						}
					}
					<cards>5__1 = null;
					<>s__2 = null;
					<card>5__3 = null;
					<receivers>5__5 = null;
					<negateAbility>5__6 = null;
					<>s__7 = null;
					<receiver>5__8 = null;
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
					//IL_02df: Expected O, but got Unknown
					//IL_030c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0316: Expected O, but got Unknown
					//IL_035f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0369: Expected O, but got Unknown
					//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
					//IL_03b2: Expected O, but got Unknown
					//IL_028d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0297: Expected O, but got Unknown
					try
					{
						switch (<>1__state)
						{
						default:
							return false;
						case 0:
							<>1__state = -1;
							if (!Active)
							{
								return false;
							}
							<cards>5__1 = from slot in Singleton<BoardManager>.Instance.PlayerSlotsCopy
								where (Object)(object)slot.Card != (Object)null && slot.Card.HasAbility((Ability)9)
								select slot.Card;
							<>s__2 = <cards>5__1.GetEnumerator();
							<>1__state = -3;
							break;
						case 1:
							<>1__state = -3;
							<wasSubmerge>5__4 = false;
							if (((Card)<card>5__3).FaceDown)
							{
								<wasSubmerge>5__4 = true;
								((Card)<card>5__3).SetFaceDown(false, false);
							}
							((Card)<card>5__3).Anim.StrongNegationEffect();
							<receivers>5__5 = <card>5__3.TriggerHandler.triggeredAbilities.Where((Tuple<Ability, AbilityBehaviour> ability) => ability.Item2 is DrawCopy).Select(delegate(Tuple<Ability, AbilityBehaviour> ability)
							{
								AbilityBehaviour item = ability.Item2;
								return (DrawCopy)(object)((item is DrawCopy) ? item : null);
							});
							<>s__7 = <receivers>5__5.GetEnumerator();
							<>1__state = -4;
							goto IL_0269;
						case 2:
							<>1__state = -4;
							goto IL_0261;
						case 3:
							<>1__state = -4;
							goto IL_0261;
						case 4:
							<>1__state = -3;
							<>2__current = SwitchIfNotView((View)4);
							<>1__state = 5;
							return true;
						case 5:
							<>1__state = -3;
							<>2__current = (object)new WaitForSeconds(0.15f);
							<>1__state = 6;
							return true;
						case 6:
							<>1__state = -3;
							((Card)<card>5__3).Anim.PlayTransformAnimation();
							<>2__current = (object)new WaitForSeconds(0.15f);
							<>1__state = 7;
							return true;
						case 7:
							<>1__state = -3;
							NegateDrawCopy(out <negateAbility>5__6);
							if (<negateAbility>5__6 != null)
							{
								<card>5__3.AddTemporaryMod(<negateAbility>5__6);
							}
							<>2__current = (object)new WaitForSeconds(0.3f);
							<>1__state = 8;
							return true;
						case 8:
							<>1__state = -3;
							if (<wasSubmerge>5__4)
							{
								<wasSubmerge>5__4 = false;
								((Card)<card>5__3).SetFaceDown(true, false);
							}
							<>2__current = (object)new WaitForSeconds(0.2f);
							<>1__state = 9;
							return true;
						case 9:
							{
								<>1__state = -3;
								<receivers>5__5 = null;
								<negateAbility>5__6 = null;
								<card>5__3 = null;
								break;
							}
							IL_0269:
							if (<>s__7.MoveNext())
							{
								<receiver>5__8 = <>s__7.Current;
								if (!((AbilityBehaviour)<receiver>5__8).HasLearned)
								{
									<>2__current = ((TriggerReceiver)<receiver>5__8).OnResolveOnBoard();
									<>1__state = 2;
									return true;
								}
								<>2__current = ((DrawCreatedCard)<receiver>5__8).CreateDrawnCard();
								<>1__state = 3;
								return true;
							}
							<>m__Finally2();
							<>s__7 = null;
							<>2__current = (object)new WaitForSeconds(0.2f);
							<>1__state = 4;
							return true;
							IL_0261:
							<receiver>5__8 = null;
							goto IL_0269;
						}
						if (<>s__2.MoveNext())
						{
							<card>5__3 = <>s__2.Current;
							<>2__current = SwitchIfNotView((View)4);
							<>1__state = 1;
							return true;
						}
						<>m__Finally1();
						<>s__2 = null;
						return false;
					}
					catch
					{
						//try-fault
						((IDisposable)this).Dispose();
						throw;
					}
				}

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

				private void <>m__Finally1()
				{
					<>1__state = -1;
					if (<>s__2 != null)
					{
						<>s__2.Dispose();
					}
				}

				private void <>m__Finally2()
				{
					<>1__state = -3;
					if (<>s__7 != null)
					{
						<>s__7.Dispose();
					}
				}

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

			[CompilerGenerated]
			private sealed class <QueueOpponentCard>d__5 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public PlayableCard card;

				private List<CardSlot> <openSlots>5__1;

				private List<List<CardInfo>> <turnPlan>5__2;

				private List<CardInfo> <addInfo>5__3;

				private int <randomSeed>5__4;

				private CardSlot <index>5__5;

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

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

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

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<openSlots>5__1 = null;
					<turnPlan>5__2 = null;
					<addInfo>5__3 = null;
					<index>5__5 = null;
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<openSlots>5__1 = Singleton<BoardManager>.Instance.OpponentSlotsCopy.Where((CardSlot slot) => !Singleton<TurnManager>.Instance.Opponent.QueuedSlots.Contains(slot)).ToList();
						if (<openSlots>5__1.Count == 0)
						{
							<turnPlan>5__2 = Singleton<TurnManager>.Instance.Opponent.TurnPlan;
							<addInfo>5__3 = new List<CardInfo> { ((Card)card).Info };
							<turnPlan>5__2.Add(<addInfo>5__3);
							<>2__current = Singleton<TurnManager>.Instance.Opponent.ModifyTurnPlan(<turnPlan>5__2);
							<>1__state = 1;
							return true;
						}
						<randomSeed>5__4 = SaveManager.SaveFile.GetCurrentRandomSeed();
						<index>5__5 = <openSlots>5__1[SeededRandom.Range(0, <openSlots>5__1.Count, <randomSeed>5__4 + <openSlots>5__1.Count)];
						<>2__current = Singleton<TurnManager>.Instance.Opponent.QueueCard(((Card)card).Info, <index>5__5, true, true, true);
						<>1__state = 2;
						return true;
					case 1:
						<>1__state = -1;
						<turnPlan>5__2 = null;
						<addInfo>5__3 = null;
						break;
					case 2:
						<>1__state = -1;
						<index>5__5 = null;
						break;
					}
					return false;
				}

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

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

			[CompilerGenerated]
			private sealed class <SwitchIfNotView>d__3 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public View view;

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

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

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

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

				private bool MoveNext()
				{
					//IL_0030: 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_0069: 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_0086: Expected O, but got Unknown
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					//IL_0053: Expected O, but got Unknown
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if (Singleton<ViewManager>.Instance.CurrentView == view)
						{
							return false;
						}
						<>2__current = (object)new WaitForSeconds(0.2f);
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						Singleton<ViewManager>.Instance.SwitchToView(view, false, false);
						<>2__current = (object)new WaitForSeconds(0.2f);
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -1;
						return false;
					}
				}

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

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

			[IteratorStateMachine(typeof(<DrawCard>d__0))]
			[HarmonyPostfix]
			private static IEnumerator DrawCard(IEnumerator enumerator, Trigger trigger, object[] otherArgs)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <DrawCard>d__0(0)
				{
					enumerator = enumerator,
					trigger = trigger,
					otherArgs = otherArgs
				};
			}

			[IteratorStateMachine(typeof(<PlayerFecundity>d__1))]
			private static IEnumerator PlayerFecundity()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <PlayerFecundity>d__1(0);
			}

			private static void NegateDrawCopy(out CardModificationInfo mod)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				mod = ((!Active) ? ((CardModificationInfo)null) : new CardModificationInfo
				{
					negateAbilities = new List<Ability> { (Ability)9 }
				});
			}

			[IteratorStateMachine(typeof(<SwitchIfNotView>d__3))]
			private static IEnumerator SwitchIfNotView(View view)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <SwitchIfNotView>d__3(0)
				{
					view = view
				};
			}

			[IteratorStateMachine(typeof(<OpponentFecundity>d__4))]
			private static IEnumerator OpponentFecundity()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <OpponentFecundity>d__4(0);
			}

			[IteratorStateMachine(typeof(<QueueOpponentCard>d__5))]
			private static IEnumerator QueueOpponentCard(PlayableCard card)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <QueueOpponentCard>d__5(0)
				{
					card = card
				};
			}
		}

		private readonly Harmony harmony = new Harmony("orochiumbra.inscryption.fecundityrework");

		private const string PluginGuid = "orochiumbra.inscryption.fecundityrework";

		private const string PluginName = "FecundityRework";

		private const string PluginVersion = "1.0.0";

		public static ManualLogSource Log;

		public static bool Active => SaveFile.IsAscension ? FecundityReworkConfigManager.Instance.AscensionEnabled : FecundityReworkConfigManager.Instance.ModEnabled;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			FecundityReworkConfigManager.Instance.BindConfig();
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FecundityRework";

		public const string PLUGIN_NAME = "FecundityRework";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}