monomod/Assembly-CSharp.APIPatcher.mm.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx.Logging;
using InscryptionAPI;
using Microsoft.CodeAnalysis;
using MonoMod;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("APIPatcher")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d56bf5bd89588fb2fb73251c71d60ea43ecc7959")]
[assembly: AssemblyProduct("APIPatcher")]
[assembly: AssemblyTitle("APIPatcher")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace APIPatcher
{
	[MonoModPatch("global::ScriptableObjectLoader`1")]
	internal class patch_ScriptableObjectLoader<T> : ScriptableObjectLoader<T> where T : Object
	{
		public static List<T> AllData
		{
			get
			{
				InscryptionAPIPlugin.InvokeSOLEvent(typeof(T));
				ScriptableObjectLoader<T>.LoadData("");
				return ScriptableObjectLoader<T>.allData;
			}
		}
	}
	[MonoModPatch("global::Singleton`1")]
	internal class patch_Singleton<T> : Singleton<T> where T : ManagedBehaviour
	{
		protected static void FindInstance()
		{
			if ((Object)(object)Singleton<T>.m_Instance == (Object)null)
			{
				T val = Object.FindObjectOfType<T>();
				if ((Object)(object)val == (Object)null)
				{
					Singleton.SingletonLogSource.LogWarning((object)("Got null in Singleton<" + typeof(T).FullName + ">.FindInstance"));
				}
				Singleton<T>.m_Instance = val;
			}
		}
	}
	internal static class Singleton
	{
		internal static readonly ManualLogSource SingletonLogSource = Logger.CreateLogSource("Singleton");
	}
}

plugins/InscryptionAPI.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI;
using InscryptionAPI.Boons;
using InscryptionAPI.Card;
using InscryptionAPI.Card.CostProperties;
using InscryptionAPI.CardCosts;
using InscryptionAPI.Dialogue;
using InscryptionAPI.Encounters;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Items;
using InscryptionAPI.Items.Extensions;
using InscryptionAPI.Masks;
using InscryptionAPI.Nodes;
using InscryptionAPI.Pelts;
using InscryptionAPI.PixelCard;
using InscryptionAPI.Regions;
using InscryptionAPI.RuleBook;
using InscryptionAPI.Saves;
using InscryptionAPI.Slots;
using InscryptionAPI.Sound;
using InscryptionAPI.TalkingCards.Animation;
using InscryptionAPI.TalkingCards.Create;
using InscryptionAPI.TalkingCards.Helpers;
using InscryptionAPI.Totems;
using InscryptionAPI.Triggers;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.Utils;
using Pixelplacement;
using Sirenix.Serialization.Utilities;
using Sirenix.Utilities;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using VolumetricFogAndMist;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Assembly-CSharp")]
[assembly: InternalsVisibleTo("Assembly-CSharp.APIPatcher.mm")]
[assembly: InternalsVisibleTo("APIPatcher")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("InscryptionAPI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.23.1.0")]
[assembly: AssemblyInformationalVersion("2.23.1+d56bf5bd89588fb2fb73251c71d60ea43ecc7959")]
[assembly: AssemblyProduct("InscryptionAPI")]
[assembly: AssemblyTitle("InscryptionAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.23.1.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]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[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;
		}
	}
	[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 APIPlugin
{
	[Obsolete("Use AbilityManager instead", true)]
	public class AbilityIdentifier
	{
		internal string guid;

		private string name;

		public Ability id;

		internal Ability realID;

		private AbilityIdentifier(string guid, string name)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			this.guid = guid;
			this.name = name;
			realID = (id = GuidManager.GetEnumValue<Ability>(guid, name));
		}

		public static AbilityIdentifier GetAbilityIdentifier(string guid, string name)
		{
			return GetID(guid, name);
		}

		public static AbilityIdentifier GetID(string guid, string name)
		{
			return new AbilityIdentifier(guid, name);
		}

		public override string ToString()
		{
			return guid + "(" + name + ")";
		}
	}
	[Obsolete("Use AbilityManager and extension methods instead", true)]
	public class AbilityInfoUtils
	{
		public static AbilityInfo CreateInfoWithDefaultSettings(string rulebookName, string rulebookDescription)
		{
			AbilityInfo obj = ScriptableObject.CreateInstance<AbilityInfo>();
			obj.powerLevel = 0;
			obj.rulebookName = rulebookName;
			obj.rulebookDescription = rulebookDescription;
			obj.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)1,
				(AbilityMetaCategory)0
			};
			return obj;
		}
	}
	[Obsolete("Use CardManager and extension methods instead", true)]
	public static class CardUtils
	{
		public static readonly Vector2 DefaultVector2 = new Vector2(0.5f, 0.5f);

		public static readonly Rect DefaultCardArtRect = new Rect(0f, 0f, 114f, 94f);

		public static readonly Rect DefaultCardPixelArtRect = new Rect(0f, 0f, 41f, 28f);

		public static Predicate<CardInfo> IsNonLivingCard = (CardInfo card) => card.traits.Exists((Trait t) => t - 12 <= 1);

		public static List<CardMetaCategory> getNormalCardMetadata = new List<CardMetaCategory>
		{
			(CardMetaCategory)0,
			(CardMetaCategory)1
		};

		public static List<CardMetaCategory> getRareCardMetadata = new List<CardMetaCategory>
		{
			(CardMetaCategory)0,
			(CardMetaCategory)1,
			(CardMetaCategory)3
		};

		public static List<CardMetaCategory> getGBCCardMetadata = new List<CardMetaCategory>
		{
			(CardMetaCategory)4,
			(CardMetaCategory)5
		};

		public static List<CardMetaCategory> getGBCRareCardMetadata = new List<CardMetaCategory>
		{
			(CardMetaCategory)4,
			(CardMetaCategory)5,
			(CardMetaCategory)3
		};

		public static List<CardMetaCategory> getAllActsCardMetadata = new List<CardMetaCategory>
		{
			(CardMetaCategory)0,
			(CardMetaCategory)3,
			(CardMetaCategory)1,
			(CardMetaCategory)3,
			(CardMetaCategory)4,
			(CardMetaCategory)5,
			(CardMetaCategory)2
		};

		public static List<Appearance> getRareAppearance = new List<Appearance> { (Appearance)7 };

		public static List<Appearance> getTerrainBackgroundAppearance = new List<Appearance> { (Appearance)2 };

		public static List<Appearance> getTerrainLayoutAppearance = new List<Appearance> { (Appearance)9 };

		public static List<Appearance> getTerrainAppearance = new List<Appearance>
		{
			(Appearance)2,
			(Appearance)9
		};

		public static List<Appearance> getHologramAppearance = new List<Appearance> { (Appearance)12 };

		public static List<Appearance> getAnimatedAppearance = new List<Appearance> { (Appearance)5 };

		public static List<Appearance> getGoldAppearance = new List<Appearance> { (Appearance)6 };

		public static List<Appearance> getBloodDecalAppearance = new List<Appearance> { (Appearance)8 };

		public static List<Appearance> getDynamicAppearance = new List<Appearance> { (Appearance)10 };

		public static byte[] ReadArtworkFileAsBytes(string nameOfCardArt)
		{
			return File.ReadAllBytes(Directory.GetFiles(Paths.PluginPath, nameOfCardArt, SearchOption.AllDirectories)[0]);
		}

		public static Texture2D getAndloadImageAsTexture(string pathCardArt)
		{
			return TextureHelper.GetImageAsTexture(pathCardArt, (FilterMode)0);
		}
	}
	[Obsolete("Use CardManager instead", true)]
	public class CustomCard
	{
		public static List<CustomCard> cards = new List<CustomCard>();

		public static Dictionary<int, List<AbilityIdentifier>> abilityIds = new Dictionary<int, List<AbilityIdentifier>>();

		public static Dictionary<int, List<SpecialAbilityIdentifier>> specialAbilityIds = new Dictionary<int, List<SpecialAbilityIdentifier>>();

		public static Dictionary<int, EvolveIdentifier> evolveIds = new Dictionary<int, EvolveIdentifier>();

		public static Dictionary<int, IceCubeIdentifier> iceCubeIds = new Dictionary<int, IceCubeIdentifier>();

		public static Dictionary<int, TailIdentifier> tailIds = new Dictionary<int, TailIdentifier>();

		public static Dictionary<string, Sprite> emissions = new Dictionary<string, Sprite>();

		public string name;

		public List<CardMetaCategory> metaCategories;

		public CardComplexity? cardComplexity;

		public CardTemple? temple;

		public string displayedName;

		public int? baseAttack;

		public int? baseHealth;

		public string description;

		public bool? hideAttackAndHealth;

		public int? cost;

		public int? bonesCost;

		public int? energyCost;

		public List<GemType> gemsCost;

		public SpecialStatIcon? specialStatIcon;

		public List<Tribe> tribes;

		public List<Trait> traits;

		public List<SpecialTriggeredAbility> specialAbilities;

		public List<Ability> abilities;

		public EvolveParams evolveParams;

		public string defaultEvolutionName;

		public TailParams tailParams;

		public IceCubeParams iceCubeParams;

		public bool? flipPortraitForStrafe;

		public bool? onePerDeck;

		public List<Appearance> appearanceBehaviour;

		[IgnoreMapping]
		public Texture2D tex;

		[IgnoreMapping]
		public Texture2D altTex;

		public Texture titleGraphic;

		[IgnoreMapping]
		public Texture2D pixelTex;

		[IgnoreMapping]
		public Texture2D emissionTex;

		public GameObject animatedPortrait;

		public List<Texture> decals;

		[IgnoreMapping]
		private List<AbilityIdentifier> abilityIdParam;

		[IgnoreMapping]
		private List<SpecialAbilityIdentifier> specialAbilityIdParam;

		[IgnoreMapping]
		private EvolveIdentifier evolveId;

		[IgnoreMapping]
		private IceCubeIdentifier iceCubeId;

		[IgnoreMapping]
		private TailIdentifier tailId;

		public CustomCard(string name, List<AbilityIdentifier> abilityIdParam = null, List<SpecialAbilityIdentifier> specialAbilityIdParam = null, EvolveIdentifier evolveId = null, IceCubeIdentifier iceCubeId = null, TailIdentifier tailId = null)
		{
			this.name = name;
			this.abilityIdParam = abilityIdParam;
			this.specialAbilityIdParam = specialAbilityIdParam;
			this.evolveId = evolveId;
			this.iceCubeId = iceCubeId;
			this.tailId = tailId;
			CardManager.ModifyCardList += delegate(List<CardInfo> cards)
			{
				CardInfo val = cards.CardByName(this.name);
				if ((Object)(object)val != (Object)null)
				{
					AdjustCard(val, cards);
				}
				return cards;
			};
		}

		public CardInfo AdjustCard(CardInfo card, List<CardInfo> cardsToSearch)
		{
			TypeMapper<CustomCard, CardInfo>.Convert(this, card);
			if (tex != null)
			{
				card.SetPortrait(tex);
			}
			if (altTex != null)
			{
				card.SetAltPortrait(altTex);
			}
			if (pixelTex != null)
			{
				card.SetPixelPortrait(pixelTex);
			}
			if (decals != null)
			{
				card.AddDecal(decals.ToArray());
			}
			if (abilityIdParam != null)
			{
				card.AddAbilities(abilityIdParam.Select((AbilityIdentifier ai) => ai.realID).ToArray());
			}
			if (specialAbilityIdParam != null)
			{
				card.AssignSpecialAbilities(specialAbilityIdParam);
			}
			if (evolveId != null)
			{
				CardInfo val = cardsToSearch.CardByName(evolveId.name);
				if ((Object)(object)val != (Object)null)
				{
					card.SetEvolve(val, evolveId.turnsToEvolve, new List<CardModificationInfo> { evolveId.mods });
				}
			}
			if (tailId != null)
			{
				CardInfo val2 = cardsToSearch.CardByName(tailId.name);
				if ((Object)(object)val2 != (Object)null)
				{
					Texture2D tailLostTex = tailId.tailLostTex;
					IEnumerable<CardModificationInfo> mods = new List<CardModificationInfo> { tailId.mods };
					card.SetTail(val2, tailLostTex, null, mods);
				}
			}
			if (iceCubeId != null)
			{
				CardInfo val3 = cardsToSearch.CardByName(iceCubeId.name);
				if ((Object)(object)val3 != (Object)null)
				{
					card.SetIceCube(val3, new List<CardModificationInfo> { iceCubeId.mods });
				}
			}
			return card;
		}
	}
	[Obsolete("Use RegionManager instead", true)]
	public class CustomRegion
	{
		public string name;

		public int? tier;

		public List<CardInfo> terrainCards;

		public List<ConsumableItemData> consumableItems;

		public List<EncounterBlueprintData> encounters;

		public List<Type> bosses;

		public List<CardInfo> likelyCards;

		public List<Tribe> dominantTribes;

		public PredefinedNodes predefinedNodes;

		public EncounterBlueprintData bossPrepEncounter;

		public StoryEventCondition bossPrepCondition;

		public List<ScarceSceneryEntry> scarceScenery;

		public List<FillerSceneryEntry> fillerScenery;

		public PredefinedScenery predefinedScenery;

		public string ambientLoopId;

		public bool? silenceCabinAmbience;

		public Color? boardLightColor;

		public Color? cardsLightColor;

		public bool? dustParticlesDisabled;

		public bool? fogEnabled;

		public VolumetricFogProfile fogProfile;

		public float? fogAlpha;

		public Texture mapAlbedo;

		public Texture mapEmission;

		public Color? mapEmissionColor;

		public List<GameObject> mapParticlesPrefabs;

		public CustomRegion(string name)
		{
			this.name = name;
			RegionManager.ModifyRegionsList += ModifyRegions;
		}

		public List<RegionData> ModifyRegions(List<RegionData> regions)
		{
			RegionData val = ((IEnumerable<RegionData>)regions).FirstOrDefault((Func<RegionData, bool>)((RegionData r) => ((Object)r).name.Equals(name)));
			if ((Object)(object)val != (Object)null)
			{
				AdjustRegion(val);
			}
			return regions;
		}

		public RegionData AdjustRegion(RegionData region)
		{
			TypeMapper<CustomRegion, RegionData>.Convert(this, region);
			return region;
		}
	}
	[Obsolete("Use CardManager and CardInfo extension methods instead", true)]
	public class EvolveIdentifier
	{
		internal string name;

		internal int turnsToEvolve;

		internal CardModificationInfo mods;

		private EvolveParams evolution;

		public EvolveParams Evolution
		{
			get
			{
				if (evolution == null)
				{
					SetParams(CardLoader.GetCardByName(name));
				}
				return evolution;
			}
		}

		public EvolveIdentifier(string name, int turnsToEvolve, CardModificationInfo mods = null)
		{
			this.name = name;
			this.turnsToEvolve = turnsToEvolve;
			this.mods = mods;
		}

		private void SetParams(CardInfo card)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			evolution = new EvolveParams();
			evolution.turnsToEvolve = turnsToEvolve;
			evolution.evolution = card;
			if (mods != null)
			{
				evolution.evolution.mods.Add(mods);
			}
		}

		public override string ToString()
		{
			return name;
		}
	}
	[Obsolete("Use CardManager and CardInfo extension methods instead", true)]
	public class IceCubeIdentifier
	{
		internal string name;

		internal CardModificationInfo mods;

		private IceCubeParams iceCube;

		public IceCubeParams IceCube
		{
			get
			{
				if (iceCube == null)
				{
					SetParams(CardLoader.GetCardByName(name));
				}
				return iceCube;
			}
		}

		public IceCubeIdentifier(string name, CardModificationInfo mods = null)
		{
			this.name = name;
			this.mods = mods;
		}

		private void SetParams(CardInfo card)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			iceCube = new IceCubeParams();
			iceCube.creatureWithin = card;
			if (mods != null)
			{
				iceCube.creatureWithin.mods.Add(mods);
			}
		}

		public override string ToString()
		{
			return name;
		}
	}
	[Obsolete("Use AbilityManager instead", true)]
	public class NewAbility
	{
		public Ability ability;

		public AbilityInfo info;

		public Type abilityBehaviour;

		public Texture tex;

		public AbilityIdentifier id;

		public NewAbility(AbilityInfo info, Type abilityBehaviour, Texture tex, AbilityIdentifier id = null)
		{
			//IL_0026: 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)
			string guid = ((id == null) ? abilityBehaviour.Namespace : id.guid);
			AbilityManager.FullAbility fullAbility = AbilityManager.Add(guid, info, abilityBehaviour, tex);
			ability = fullAbility.Id;
			this.info = fullAbility.Info;
			this.abilityBehaviour = fullAbility.AbilityBehavior;
			this.tex = fullAbility.Texture;
			this.id = AbilityIdentifier.GetID(guid, fullAbility.Info.rulebookName);
		}
	}
	[Obsolete("Use CardManager instead", true)]
	public static class NewCard
	{
		public static List<CardInfo> cards = new List<CardInfo>();

		public static Dictionary<int, List<AbilityIdentifier>> abilityIds = new Dictionary<int, List<AbilityIdentifier>>();

		public static Dictionary<int, List<SpecialAbilityIdentifier>> specialAbilityIds = new Dictionary<int, List<SpecialAbilityIdentifier>>();

		public static Dictionary<int, EvolveIdentifier> evolveIds = new Dictionary<int, EvolveIdentifier>();

		public static Dictionary<int, IceCubeIdentifier> iceCubeIds = new Dictionary<int, IceCubeIdentifier>();

		public static Dictionary<int, TailIdentifier> tailIds = new Dictionary<int, TailIdentifier>();

		public static Dictionary<string, Sprite> emissions = new Dictionary<string, Sprite>();

		public static void Add(CardInfo card, List<AbilityIdentifier> abilityIdsParam = null, List<SpecialAbilityIdentifier> specialAbilitiesIdsParam = null, EvolveIdentifier evolveId = null, IceCubeIdentifier iceCubeId = null, TailIdentifier tailId = null)
		{
			if (abilityIdsParam != null)
			{
				card.AddAbilities(abilityIdsParam.Select((AbilityIdentifier a) => a.realID).ToArray());
			}
			if (specialAbilitiesIdsParam != null)
			{
				card.AssignSpecialAbilities(specialAbilitiesIdsParam);
			}
			if (evolveId != null)
			{
				card.evolveParams = evolveId.Evolution;
			}
			if (iceCubeId != null)
			{
				card.iceCubeParams = iceCubeId.IceCube;
			}
			if (tailId != null)
			{
				card.tailParams = tailId.Tail;
			}
			CardManager.Add(card);
		}

		public static void Add(string name, string displayedName, int baseAttack, int baseHealth, List<CardMetaCategory> metaCategories, CardComplexity cardComplexity, CardTemple temple, string description = null, bool hideAttackAndHealth = false, int bloodCost = 0, int bonesCost = 0, int energyCost = 0, List<GemType> gemsCost = null, SpecialStatIcon specialStatIcon = 0, List<Tribe> tribes = null, List<Trait> traits = null, List<SpecialTriggeredAbility> specialAbilities = null, List<Ability> abilities = null, List<AbilityIdentifier> abilityIdsParam = null, List<SpecialAbilityIdentifier> specialAbilitiesIdsParam = null, EvolveParams evolveParams = null, string defaultEvolutionName = null, TailParams tailParams = null, IceCubeParams iceCubeParams = null, bool flipPortraitForStrafe = false, bool onePerDeck = false, List<Appearance> appearanceBehaviour = null, Texture2D defaultTex = null, Texture2D altTex = null, Texture titleGraphic = null, Texture2D pixelTex = null, Texture2D emissionTex = null, GameObject animatedPortrait = null, List<Texture> decals = null, EvolveIdentifier evolveId = null, IceCubeIdentifier iceCubeId = null, TailIdentifier tailId = null)
		{
			//IL_0059: 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_0061: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = ScriptableObject.CreateInstance<CardInfo>();
			val.SetOldApiCard();
			((Object)val).name = name;
			val.displayedName = displayedName;
			val.baseAttack = baseAttack;
			val.baseHealth = baseHealth;
			val.description = description;
			val.SetCost(bloodCost, bonesCost, energyCost, gemsCost);
			val.hideAttackAndHealth = hideAttackAndHealth;
			val.cardComplexity = cardComplexity;
			val.temple = temple;
			val.AddMetaCategories(metaCategories.ToArray());
			val.specialStatIcon = specialStatIcon;
			if (tribes != null)
			{
				val.AddTribes(tribes.ToArray());
			}
			if (traits != null)
			{
				val.AddTraits(traits.ToArray());
			}
			if (specialAbilities != null)
			{
				val.AddSpecialAbilities(specialAbilities.ToArray());
			}
			if (specialAbilitiesIdsParam != null)
			{
				val.AssignSpecialAbilities(specialAbilitiesIdsParam);
			}
			if (abilities != null)
			{
				val.AddAbilities(abilities.ToArray());
			}
			if (abilityIdsParam != null)
			{
				val.AddAbilities(abilityIdsParam.Select((AbilityIdentifier a) => a.realID).ToArray());
			}
			val.evolveParams = evolveParams;
			val.tailParams = tailParams;
			val.iceCubeParams = iceCubeParams;
			val.defaultEvolutionName = defaultEvolutionName;
			val.flipPortraitForStrafe = flipPortraitForStrafe;
			val.onePerDeck = onePerDeck;
			if (appearanceBehaviour != null)
			{
				val.AddAppearances(appearanceBehaviour.ToArray());
			}
			if ((Object)(object)defaultTex != (Object)null)
			{
				val.SetPortrait(defaultTex);
			}
			if ((Object)(object)altTex != (Object)null)
			{
				val.SetAltPortrait(altTex);
			}
			val.titleGraphic = titleGraphic;
			if ((Object)(object)pixelTex != (Object)null)
			{
				val.SetPixelPortrait(pixelTex);
			}
			if ((Object)(object)emissionTex != (Object)null)
			{
				val.SetEmissivePortrait(emissionTex);
			}
			val.animatedPortrait = animatedPortrait;
			if (decals != null)
			{
				val.decals = new List<Texture>(decals);
			}
			if (evolveId != null)
			{
				val.SetEvolve(evolveId.name, evolveId.turnsToEvolve, new List<CardModificationInfo> { evolveId.mods });
			}
			if (iceCubeId != null)
			{
				val.SetIceCube(iceCubeId.name, new List<CardModificationInfo> { iceCubeId.mods });
			}
			if (tailId != null)
			{
				string name2 = tailId.name;
				Texture2D tailLostTex = tailId.tailLostTex;
				IEnumerable<CardModificationInfo> mods = new List<CardModificationInfo> { tailId.mods };
				val.SetTail(name2, tailLostTex, null, mods);
			}
			CardManager.Add(val);
		}

		internal static void AssignSpecialAbilities(this CardInfo info, IEnumerable<SpecialAbilityIdentifier> ids)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			info.AddSpecialAbilities((from a in ids
				where !a.ForStatIcon
				select a.specialTriggerID).ToArray());
			SpecialAbilityIdentifier specialAbilityIdentifier = ids.FirstOrDefault((SpecialAbilityIdentifier a) => a.ForStatIcon);
			if (specialAbilityIdentifier != null)
			{
				info.specialStatIcon = specialAbilityIdentifier.statIconID;
			}
		}
	}
	[Obsolete("Use CardAppearanceBehaviourManager instead", true)]
	public class NewCardAppearanceBehaviour
	{
		public static Dictionary<Appearance, NewCardAppearanceBehaviour> behaviours = new Dictionary<Appearance, NewCardAppearanceBehaviour>();

		public static List<NewCardAppearanceBehaviour> allBehaviours = new List<NewCardAppearanceBehaviour>();

		public Appearance Appearance;

		public string Name;

		public Type Behaviour;

		public static NewCardAppearanceBehaviour AddNewBackground(Type type, string name)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			CardAppearanceBehaviourManager.FullCardAppearanceBehaviour fullCardAppearanceBehaviour = CardAppearanceBehaviourManager.Add(type.Namespace, name, type);
			return new NewCardAppearanceBehaviour
			{
				Appearance = fullCardAppearanceBehaviour.Id,
				Name = name,
				Behaviour = type
			};
		}
	}
	[Obsolete("Use EncounterManager instead", true)]
	public class NewEncounter
	{
		public static List<NewEncounter> encounters = new List<NewEncounter>();

		public string name;

		public string regionName;

		public bool regular;

		public bool bossPrep;

		public EncounterBlueprintData encounterBlueprintData;

		private List<RegionData> SyncRegion(List<RegionData> region)
		{
			EncounterBlueprintData curClone = ((IEnumerable<EncounterBlueprintData>)EncounterManager.AllEncountersCopy).FirstOrDefault((Func<EncounterBlueprintData, bool>)((EncounterBlueprintData e) => ((Object)e).name.Equals(((Object)encounterBlueprintData).name)));
			if ((Object)(object)curClone == (Object)null)
			{
				InscryptionAPIPlugin.Logger.LogDebug((object)("Could not attach encounter named " + ((Object)encounterBlueprintData).name));
				return region;
			}
			if (curClone.regionSpecific)
			{
				if (!string.IsNullOrEmpty(regionName))
				{
					RegionData val = ((IEnumerable<RegionData>)region).FirstOrDefault((Func<RegionData, bool>)((RegionData r) => ((Object)r).name.Equals(regionName)));
					if ((Object)(object)val != (Object)null)
					{
						if (!bossPrep && !val.encounters.Any((EncounterBlueprintData e) => ((Object)e).name.Equals(((Object)curClone).name)))
						{
							InscryptionAPIPlugin.Logger.LogDebug((object)("Attaching encounter named " + ((Object)encounterBlueprintData).name + " to region " + ((Object)val).name));
							val.encounters.Add(curClone);
						}
						if (bossPrep)
						{
							val.bossPrepEncounter = curClone;
						}
					}
				}
			}
			else
			{
				foreach (RegionData item in region)
				{
					if (!item.encounters.Any((EncounterBlueprintData e) => ((Object)e).name.Equals(((Object)curClone).name)))
					{
						InscryptionAPIPlugin.Logger.LogDebug((object)("Attaching encounter named " + ((Object)encounterBlueprintData).name + " to region " + ((Object)item).name));
						item.encounters.Add(curClone);
					}
				}
			}
			return region;
		}

		public NewEncounter(string name, EncounterBlueprintData encounterBlueprintData, string regionName, bool regular, bool bossPrep)
		{
			this.name = name;
			this.encounterBlueprintData = encounterBlueprintData;
			((Object)this.encounterBlueprintData).name = name;
			this.regionName = regionName;
			this.bossPrep = bossPrep;
			this.regular = regular;
			EncounterManager.Add(encounterBlueprintData);
			RegionManager.ModifyRegionsList += SyncRegion;
			RegionManager.SyncRegionList();
		}

		public static void Add(string name, string regionName, List<TurnModBlueprint> turnMods = null, List<Tribe> dominantTribes = null, List<Ability> redundantAbilities = null, List<CardInfo> unlockedCardPrerequisites = null, bool regionSpecific = true, int minDifficulty = 0, int maxDifficulty = 30, List<CardInfo> randomReplacementCards = null, List<List<CardBlueprint>> turns = null, bool regular = true, bool bossPrep = false, int oldPreviewDifficulty = 0)
		{
			EncounterBlueprintData val = ScriptableObject.CreateInstance<EncounterBlueprintData>();
			if (turnMods != null)
			{
				val.turnMods = turnMods;
			}
			if (dominantTribes != null)
			{
				val.dominantTribes = dominantTribes;
			}
			if (redundantAbilities != null)
			{
				val.redundantAbilities = redundantAbilities;
			}
			if (unlockedCardPrerequisites != null)
			{
				val.unlockedCardPrerequisites = unlockedCardPrerequisites;
			}
			val.regionSpecific = regionSpecific;
			val.minDifficulty = minDifficulty;
			val.maxDifficulty = maxDifficulty;
			if (randomReplacementCards != null)
			{
				val.randomReplacementCards = randomReplacementCards;
			}
			if (turns != null)
			{
				val.turns = turns;
			}
			val.oldPreviewDifficulty = oldPreviewDifficulty;
			new NewEncounter(name, val, regionName, regular, bossPrep);
		}
	}
	[Obsolete("Use RegionManager instead", true)]
	public class NewRegion
	{
		public NewRegion(RegionData region, int tier)
		{
			RegionManager.Add(region, tier);
		}
	}
	[Obsolete("Use SpecialTriggeredAbilityManager instead", true)]
	public class NewSpecialAbility
	{
		public static List<NewSpecialAbility> specialAbilities = new List<NewSpecialAbility>();

		public SpecialTriggeredAbility specialTriggeredAbility;

		public StatIconInfo statIconInfo;

		public Type abilityBehaviour;

		public SpecialAbilityIdentifier id;

		public NewSpecialAbility(Type abilityBehaviour, SpecialAbilityIdentifier id, StatIconInfo statIconInfo = null)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)statIconInfo == (Object)null)
			{
				SpecialTriggeredAbilityManager.FullSpecialTriggeredAbility fullSpecialTriggeredAbility = SpecialTriggeredAbilityManager.Add(id.guid, id.name, abilityBehaviour);
				specialTriggeredAbility = fullSpecialTriggeredAbility.Id;
				this.abilityBehaviour = abilityBehaviour;
				this.id = id;
			}
			if ((Object)(object)statIconInfo != (Object)null)
			{
				StatIconManager.Add(id.guid, statIconInfo, abilityBehaviour);
				id.ForStatIcon = true;
				this.statIconInfo = statIconInfo;
				this.abilityBehaviour = abilityBehaviour;
			}
		}
	}
	[Obsolete("Use SpecialTriggeredAbilityManager instead", true)]
	public class SpecialAbilityIdentifier
	{
		internal string guid;

		internal string name;

		public SpecialTriggeredAbility id;

		internal SpecialTriggeredAbility specialTriggerID;

		internal SpecialStatIcon statIconID;

		internal bool ForStatIcon;

		private SpecialAbilityIdentifier(string guid, string name)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			this.guid = guid;
			this.name = name;
			specialTriggerID = (id = GuidManager.GetEnumValue<SpecialTriggeredAbility>(guid, name));
			statIconID = GuidManager.GetEnumValue<SpecialStatIcon>(guid, name);
		}

		public static SpecialAbilityIdentifier GetID(string guid, string name)
		{
			return new SpecialAbilityIdentifier(guid, name);
		}

		public override string ToString()
		{
			return guid + "(" + name + ")";
		}
	}
	[Obsolete("Use CardManager and CardInfo extension methods", true)]
	public class TailIdentifier
	{
		internal string name;

		internal CardModificationInfo mods;

		internal Texture2D tailLostTex;

		private TailParams tail;

		public TailParams Tail
		{
			get
			{
				if (tail == null)
				{
					SetParams(CardLoader.GetCardByName(name));
				}
				return tail;
			}
		}

		public TailIdentifier(string name, Texture2D tailLostTex = null, CardModificationInfo mods = null)
		{
			this.name = name;
			this.mods = mods;
			this.tailLostTex = tailLostTex;
		}

		private void SetParams(CardInfo card)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			TailParams val = new TailParams();
			if (tailLostTex != null)
			{
				((Object)tailLostTex).name = name;
				((Texture)tailLostTex).filterMode = (FilterMode)0;
				val.tailLostPortrait = tailLostTex.ConvertTexture(TextureHelper.SpriteType.CardPortrait, (FilterMode)0);
				((Object)val.tailLostPortrait).name = name;
			}
			val.tail = card;
			if (mods != null)
			{
				val.tail.mods.Add(mods);
			}
			tail = val;
		}

		public override string ToString()
		{
			return name;
		}
	}
	[Obsolete("Unncessary", true)]
	[AttributeUsage(AttributeTargets.Field)]
	public class IgnoreMappingAttribute : Attribute
	{
	}
	[Obsolete("Unnecessary", true)]
	public static class TypeMapper<S, D> where S : class where D : class
	{
		private static Dictionary<string, MethodInfo> _accessors;

		private static Dictionary<string, MethodInfo> _setters;

		private static Dictionary<string, MethodInfo> FieldAccessors
		{
			get
			{
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: 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)
				if (_accessors == null)
				{
					_accessors = new Dictionary<string, MethodInfo>();
					foreach (FieldInfo item in from x in AccessTools.GetDeclaredFields(typeof(S))
						where !x.GetCustomAttributes(typeof(IgnoreMappingAttribute), inherit: false).Any()
						select x)
					{
						DynamicMethodDefinition val = new DynamicMethodDefinition("get_" + item.Name, typeof(object), new Type[1] { typeof(S) });
						ILProcessor iLProcessor = val.GetILProcessor();
						iLProcessor.Emit(OpCodes.Ldarg_0);
						iLProcessor.Emit(OpCodes.Ldfld, val.Module.ImportReference(item));
						if (item.FieldType.IsValueType)
						{
							Extensions.Emit(iLProcessor, OpCodes.Box, item.FieldType);
						}
						iLProcessor.Emit(OpCodes.Ret);
						_accessors.Add(item.Name, val.Generate());
					}
				}
				return _accessors;
			}
		}

		private static Dictionary<string, MethodInfo> FieldSetters
		{
			get
			{
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Expected O, but got Unknown
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				if (_setters == null)
				{
					_setters = new Dictionary<string, MethodInfo>();
					foreach (FieldInfo declaredField in AccessTools.GetDeclaredFields(typeof(D)))
					{
						DynamicMethodDefinition val = new DynamicMethodDefinition("set_" + declaredField.Name, typeof(void), new Type[2]
						{
							typeof(D),
							typeof(object)
						});
						ILProcessor iLProcessor = val.GetILProcessor();
						iLProcessor.Emit(OpCodes.Ldarg_0);
						iLProcessor.Emit(OpCodes.Ldarg_1);
						iLProcessor.Emit(OpCodes.Unbox_Any, val.Module.ImportReference(declaredField.FieldType));
						iLProcessor.Emit(OpCodes.Stfld, val.Module.ImportReference(declaredField));
						iLProcessor.Emit(OpCodes.Ret);
						_setters.Add(declaredField.Name, val.Generate());
					}
				}
				return _setters;
			}
		}

		public static D Convert(S source, D destination)
		{
			foreach (KeyValuePair<string, MethodInfo> fieldAccessor in FieldAccessors)
			{
				object obj = fieldAccessor.Value.Invoke(null, new object[1] { source });
				if (obj != null && FieldSetters.ContainsKey(fieldAccessor.Key))
				{
					FieldSetters[fieldAccessor.Key].Invoke(null, new object[2] { destination, obj });
				}
			}
			return destination;
		}
	}
}
namespace InscryptionAPI
{
	[BepInPlugin("cyantist.inscryption.api", "InscryptionAPI", "2.23.1")]
	[HarmonyPatch]
	public class InscryptionAPIPlugin : BaseUnityPlugin
	{
		public const string ModGUID = "cyantist.inscryption.api";

		public const string ModName = "InscryptionAPI";

		public const string ModVer = "2.23.1";

		public static string Directory;

		internal static ConfigEntry<bool> configOverrideArrows;

		internal static ConfigEntry<bool> configRandomChoiceOrder;

		internal static ConfigEntry<bool> configHideAct1BossScenery;

		internal static ConfigEntry<TotemManager.TotemTopState> configCustomTotemTopTypes;

		internal static ConfigEntry<ConsumableItemManager.ConsumableState> configCustomItemTypes;

		internal static ManualLogSource Logger;

		private readonly Harmony HarmonyInstance = new Harmony("cyantist.inscryption.api");

		public static event Action<Type> ScriptableObjectLoaderLoad;

		static InscryptionAPIPlugin()
		{
			Directory = "";
			AppDomain.CurrentDomain.AssemblyResolve += (object _, ResolveEventArgs e) => e.Name.StartsWith("API, Version=1") ? typeof(InscryptionAPIPlugin).Assembly : null;
		}

		internal static void InvokeSOLEvent(Type type)
		{
			InscryptionAPIPlugin.ScriptableObjectLoaderLoad?.Invoke(type);
		}

		private void OnEnable()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Directory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			HarmonyInstance.PatchAll(typeof(InscryptionAPIPlugin).Assembly);
		}

		private void OnDisable()
		{
			HarmonyInstance.UnpatchSelf();
		}

		internal static void ResyncAll()
		{
			CardManager.SyncCardList();
			CardCostManager.SyncCustomCostList();
			CardModificationInfoManager.SyncCardMods();
			AbilityManager.SyncAbilityList();
			SlotModificationManager.SyncSlotModificationList();
			EncounterManager.SyncEncounterList();
			RegionManager.SyncRegionList();
			RuleBookManager.SyncRuleBookList();
		}

		internal static void CheckForOutdatedPlugins()
		{
			string text = "";
			foreach (Assembly item in Chainloader.PluginInfos.Values.Select((PluginInfo p) => ((object)p.Instance).GetType().Assembly).Distinct())
			{
				AssemblyName[] referencedAssemblies = item.GetReferencedAssemblies();
				for (int i = 0; i < referencedAssemblies.Length; i++)
				{
					if (referencedAssemblies[i].Name.Equals("API"))
					{
						text = text + " - " + item.GetName().Name + "\n";
					}
				}
			}
			if (text != "")
			{
				Logger.LogWarning((object)("The following mods use an outdated version of the API:\n" + text + "\nThese mods may not work correctly. If problems arise, please update or disable them!"));
			}
		}

		private void Awake()
		{
			configCustomTotemTopTypes = ((BaseUnityPlugin)this).Config.Bind<TotemManager.TotemTopState>("Totems", "Top Types", TotemManager.TotemTopState.CustomTribes, "If Vanilla, don't change totem tops; if CustomTribes, added custom tribes will use custom totem tops; if AllTribes then all totem tops will use a custom top.");
			configCustomItemTypes = ((BaseUnityPlugin)this).Config.Bind<ConsumableItemManager.ConsumableState>("Items", "Types", ConsumableItemManager.ConsumableState.Custom, "If Vanilla, only vanilla items will be used; if Custom, added custom items will use custom models; if All then all items will use a custom model.");
			configOverrideArrows = ((BaseUnityPlugin)this).Config.Bind<bool>("Menus", "Override Arrows", false, "When true, forces the challenge screen arrows to appear at the top of the screen instead of the sides.");
			configRandomChoiceOrder = ((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous", "Randomise Cost Choice Order", false, "When true, randomises the order card cost choices are presented in Act 1.");
			configHideAct1BossScenery = ((BaseUnityPlugin)this).Config.Bind<bool>("Optimization", "Hide Act 1 Scenery", false, "When true bosses will not spawn their scenery. (eg: Prospector's trees) This can improve performance on low-end machines.");
		}

		private void Start()
		{
			CheckForOutdatedPlugins();
			DeathCardManager.AddCustomDeathCards();
			CardManager.ActivateEvents();
			CardManager.ResolveMissingModPrefixes();
			ResyncAll();
			CardManager.AuditCardList();
			PixelCardManager.Initialise();
			PeltManager.CreateDialogueEvents();
			DialogueManager.CustomDialogue.Exists((DialogueManager.Dialogue x) => x.DialogueEvent.id == "Hint_NotEnoughSameColourGemsHint");
			Logger.LogDebug((object)$"Inserted {DialogueManager.CustomDialogue.Count} dialogue event(s)!");
		}

		[HarmonyPatch(typeof(AscensionMenuScreens), "TransitionToGame")]
		[HarmonyPrefix]
		private static void SyncCardsAndAbilitiesWhenTransitioningToAscensionGame()
		{
			ResyncAll();
		}

		[HarmonyPatch(typeof(MenuController), "TransitionToGame")]
		[HarmonyPrefix]
		private static void SyncCardsAndAbilitiesWhenTransitioningToGame()
		{
			ResyncAll();
		}
	}
}
namespace InscryptionAPI.Triggers
{
	public static class CustomTriggerFinder
	{
		[CompilerGenerated]
		private sealed class <CustomTriggerSequence>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TriggerReceiver receiver;

			public IEnumerator triggerCoroutine;

			private GlobalTriggerHandler <self>5__2;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<self>5__2 = Singleton<GlobalTriggerHandler>.Instance;
					if ((Object)(object)<self>5__2 != (Object)null)
					{
						GlobalTriggerHandler obj2 = <self>5__2;
						obj2.NumTriggersThisBattle += 1;
						GlobalTriggerHandler obj3 = <self>5__2;
						obj3.StackSize += 1;
						receiver.Activating = true;
						<>2__current = triggerCoroutine;
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
				{
					<>1__state = -1;
					GlobalTriggerHandler obj = <self>5__2;
					obj.StackSize -= 1;
					receiver.Activating = false;
					if (receiver.DestroyAfterActivation)
					{
						receiver.Destroy();
					}
					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 <FindTriggersOnCard>d__22<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private T <>2__current;

			private int <>l__initialThreadId;

			private PlayableCard card;

			public PlayableCard <>3__card;

			private IEnumerator<T> <>7__wrap1;

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

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

			[DebuggerHidden]
			public <FindTriggersOnCard>d__22(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = card.TriggerHandler.GetAllReceivers().OfType<T>().GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						T current = <>7__wrap1.Current;
						<>2__current = current;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = 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 (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

			[DebuggerHidden]
			IEnumerator<T> IEnumerable<T>.GetEnumerator()
			{
				<FindTriggersOnCard>d__22<T> <FindTriggersOnCard>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<FindTriggersOnCard>d__ = this;
				}
				else
				{
					<FindTriggersOnCard>d__ = new <FindTriggersOnCard>d__22<T>(0);
				}
				<FindTriggersOnCard>d__.card = <>3__card;
				return <FindTriggersOnCard>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<T>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <FindTriggersOnCard>d__23<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private T <>2__current;

			private int <>l__initialThreadId;

			private CardTriggerHandler card;

			public CardTriggerHandler <>3__card;

			private IEnumerator<T> <>7__wrap1;

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

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

			[DebuggerHidden]
			public <FindTriggersOnCard>d__23(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = card.GetAllReceivers().OfType<T>().GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						T current = <>7__wrap1.Current;
						<>2__current = current;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = 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 (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

			[DebuggerHidden]
			IEnumerator<T> IEnumerable<T>.GetEnumerator()
			{
				<FindTriggersOnCard>d__23<T> <FindTriggersOnCard>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<FindTriggersOnCard>d__ = this;
				}
				else
				{
					<FindTriggersOnCard>d__ = new <FindTriggersOnCard>d__23<T>(0);
				}
				<FindTriggersOnCard>d__.card = <>3__card;
				return <FindTriggersOnCard>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<T>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <Trigger>d__2<T> : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardTriggerHandler handler;

			public Func<T, bool> respond;

			public Func<T, IEnumerator> trigger;

			private IEnumerator<T> <>7__wrap1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						IEnumerable<T> enumerable = handler.FindTriggersOnCard<T>();
						<>7__wrap1 = enumerable.GetEnumerator();
						<>1__state = -3;
						break;
					}
					case 1:
						<>1__state = -3;
						break;
					}
					while (<>7__wrap1.MoveNext())
					{
						T current = <>7__wrap1.Current;
						object obj = current;
						if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(current))
						{
							ref object reference = ref <>2__current;
							object obj2 = current;
							reference = ((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null)).CustomTriggerSequence(trigger(current));
							<>1__state = 1;
							return true;
						}
					}
					<>m__Finally1();
					<>7__wrap1 = 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 (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

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

			private object <>2__current;

			public PlayableCard card;

			public Func<T, bool> respond;

			public Func<T, IEnumerator> trigger;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = card.TriggerHandler.Trigger(respond, trigger);
					<>1__state = 1;
					return true;
				case 1:
					<>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 <TriggerAll>d__1<T> : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public bool triggerFacedown;

			public Func<T, bool> respond;

			public Func<T, IEnumerator> trigger;

			private IEnumerator<T> <>7__wrap1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						IEnumerable<T> enumerable = FindGlobalTriggers<T>(triggerFacedown);
						<>7__wrap1 = enumerable.GetEnumerator();
						<>1__state = -3;
						break;
					}
					case 1:
						<>1__state = -3;
						break;
					}
					while (<>7__wrap1.MoveNext())
					{
						T current = <>7__wrap1.Current;
						object obj = current;
						if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(current))
						{
							ref object reference = ref <>2__current;
							object obj2 = current;
							reference = ((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null)).CustomTriggerSequence(trigger(current));
							<>1__state = 1;
							return true;
						}
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					_ = triggerFacedown;
					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 (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

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

			private object <>2__current;

			public Func<T, bool> respond;

			public Func<T, IEnumerator> trigger;

			private IEnumerator<T> <>7__wrap1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						IEnumerable<T> enumerable = FindTriggersInHand<T>();
						<>7__wrap1 = enumerable.GetEnumerator();
						<>1__state = -3;
						break;
					}
					case 1:
						<>1__state = -3;
						break;
					}
					while (<>7__wrap1.MoveNext())
					{
						T current = <>7__wrap1.Current;
						object obj = current;
						if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(current))
						{
							ref object reference = ref <>2__current;
							object obj2 = current;
							reference = ((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null)).CustomTriggerSequence(trigger(current));
							<>1__state = 1;
							return true;
						}
					}
					<>m__Finally1();
					<>7__wrap1 = 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 (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

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

			private object <>2__current;

			public bool triggerFacedown;

			public Func<T, bool> respond;

			public Func<T, IEnumerator> trigger;

			private IEnumerator<T> <>7__wrap1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						IEnumerable<T> enumerable = FindTriggersOnBoard<T>(triggerFacedown);
						<>7__wrap1 = enumerable.GetEnumerator();
						<>1__state = -3;
						break;
					}
					case 1:
						<>1__state = -3;
						break;
					}
					while (<>7__wrap1.MoveNext())
					{
						T current = <>7__wrap1.Current;
						object obj = current;
						if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(current))
						{
							ref object reference = ref <>2__current;
							object obj2 = current;
							reference = ((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null)).CustomTriggerSequence(trigger(current));
							<>1__state = 1;
							return true;
						}
					}
					<>m__Finally1();
					<>7__wrap1 = 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 (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

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

		[IteratorStateMachine(typeof(<CustomTriggerSequence>d__0))]
		public static IEnumerator CustomTriggerSequence(this TriggerReceiver receiver, IEnumerator triggerCoroutine)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CustomTriggerSequence>d__0(0)
			{
				receiver = receiver,
				triggerCoroutine = triggerCoroutine
			};
		}

		[IteratorStateMachine(typeof(<TriggerAll>d__1<>))]
		public static IEnumerator TriggerAll<T>(bool triggerFacedown, Func<T, bool> respond, Func<T, IEnumerator> trigger)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TriggerAll>d__1<T>(0)
			{
				triggerFacedown = triggerFacedown,
				respond = respond,
				trigger = trigger
			};
		}

		[IteratorStateMachine(typeof(<Trigger>d__2<>))]
		public static IEnumerator Trigger<T>(this CardTriggerHandler handler, Func<T, bool> respond, Func<T, IEnumerator> trigger)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Trigger>d__2<T>(0)
			{
				handler = handler,
				respond = respond,
				trigger = trigger
			};
		}

		[IteratorStateMachine(typeof(<Trigger>d__3<>))]
		public static IEnumerator Trigger<T>(this PlayableCard card, Func<T, bool> respond, Func<T, IEnumerator> trigger)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Trigger>d__3<T>(0)
			{
				card = card,
				respond = respond,
				trigger = trigger
			};
		}

		[IteratorStateMachine(typeof(<TriggerOnBoard>d__4<>))]
		public static IEnumerator TriggerOnBoard<T>(bool triggerFacedown, Func<T, bool> respond, Func<T, IEnumerator> trigger)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TriggerOnBoard>d__4<T>(0)
			{
				triggerFacedown = triggerFacedown,
				respond = respond,
				trigger = trigger
			};
		}

		[IteratorStateMachine(typeof(<TriggerInHand>d__5<>))]
		public static IEnumerator TriggerInHand<T>(Func<T, bool> respond, Func<T, IEnumerator> trigger)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TriggerInHand>d__5<T>(0)
			{
				respond = respond,
				trigger = trigger
			};
		}

		public static List<(TriggerReceiver, T2)> CollectDataAll<T, T2>(bool collectFromFacedown, Func<T, bool> respond, Func<T, T2> collect)
		{
			List<(TriggerReceiver, T2)> list = new List<(TriggerReceiver, T2)>();
			foreach (T item in FindGlobalTriggers<T>(collectFromFacedown))
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add(((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null), collect(item)));
				}
			}
			return list;
		}

		public static List<(TriggerReceiver, T2)> CollectDataOnBoard<T, T2>(bool collectFromFacedown, Func<T, bool> respond, Func<T, T2> collect)
		{
			List<(TriggerReceiver, T2)> list = new List<(TriggerReceiver, T2)>();
			foreach (T item in FindTriggersOnBoard<T>(collectFromFacedown))
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add(((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null), collect(item)));
				}
			}
			return list;
		}

		public static List<(TriggerReceiver, T2)> CollectDataInHand<T, T2>(Func<T, bool> respond, Func<T, T2> collect)
		{
			List<(TriggerReceiver, T2)> list = new List<(TriggerReceiver, T2)>();
			foreach (T item in FindTriggersInHand<T>())
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add(((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null), collect(item)));
				}
			}
			return list;
		}

		public static List<(TriggerReceiver, T2)> CollectData<T, T2>(this PlayableCard self, Func<T, bool> respond, Func<T, T2> collect)
		{
			return self.TriggerHandler.CollectData(respond, collect);
		}

		public static List<(TriggerReceiver, T2)> CollectData<T, T2>(this CardTriggerHandler self, Func<T, bool> respond, Func<T, T2> collect)
		{
			List<(TriggerReceiver, T2)> list = new List<(TriggerReceiver, T2)>();
			foreach (T item in self.FindTriggersOnCard<T>())
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add(((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null), collect(item)));
				}
			}
			return list;
		}

		public static List<TriggerReceiver> CallAll<T>(bool triggerFacedown, Func<T, bool> respond, Action<T> call)
		{
			List<TriggerReceiver> list = new List<TriggerReceiver>();
			foreach (T item in FindGlobalTriggers<T>(triggerFacedown))
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null));
					call(item);
				}
			}
			return list;
		}

		public static List<TriggerReceiver> CallOnBoard<T>(bool triggerFacedown, Func<T, bool> respond, Action<T> call)
		{
			List<TriggerReceiver> list = new List<TriggerReceiver>();
			foreach (T item in FindTriggersOnBoard<T>(triggerFacedown))
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null));
					call(item);
				}
			}
			return list;
		}

		public static List<TriggerReceiver> CallInHand<T>(Func<T, bool> respond, Action<T> call)
		{
			List<TriggerReceiver> list = new List<TriggerReceiver>();
			foreach (T item in FindTriggersInHand<T>())
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null));
					call(item);
				}
			}
			return list;
		}

		public static List<TriggerReceiver> Call<T>(this PlayableCard self, Func<T, bool> respond, Action<T> call)
		{
			return self.TriggerHandler.Call(respond, call);
		}

		public static List<TriggerReceiver> Call<T>(this CardTriggerHandler self, Func<T, bool> respond, Action<T> call)
		{
			List<TriggerReceiver> list = new List<TriggerReceiver>();
			foreach (T item in self.FindTriggersOnCard<T>())
			{
				object obj = item;
				if ((Object)((obj is TriggerReceiver) ? obj : null) != (Object)null && respond(item))
				{
					object obj2 = item;
					list.Add((TriggerReceiver)((obj2 is TriggerReceiver) ? obj2 : null));
					call(item);
				}
			}
			return list;
		}

		public static IEnumerable<T> FindGlobalTriggers<T>(bool findFacedown, PlayableCard excluding = null)
		{
			IEnumerable<T> enumerable = Enumerable.Empty<T>();
			if (Object.op_Implicit((Object)(object)Singleton<BoardManager>.Instance))
			{
				enumerable = enumerable.Concat(FindTriggersOnBoard<T>(findFacedown));
			}
			if (Object.op_Implicit((Object)(object)Singleton<PlayerHand>.Instance))
			{
				enumerable = enumerable.Concat(FindTriggersInHandExcluding<T>(excluding));
			}
			return enumerable;
		}

		public static IEnumerable<T> FindGlobalTriggers<T>(PlayableCard excluding = null)
		{
			return FindGlobalTriggers<T>(findFacedown: true, excluding);
		}

		public static IEnumerable<T> FindTriggersInHand<T>()
		{
			return new List<PlayableCard>(Singleton<PlayerHand>.Instance.CardsInHand).Where((PlayableCard c) => (Object)(object)c != (Object)null && c.InHand).SelectMany(FindTriggersOnCard<T>);
		}

		public static IEnumerable<T> FindTriggersOnBoard<T>()
		{
			return FindTriggersOnBoard<T>(findFacedown: true);
		}

		public static IEnumerable<T> FindTriggersOnBoard<T>(bool findFacedown)
		{
			List<PlayableCard> source = new List<PlayableCard>(Singleton<BoardManager>.Instance.CardsOnBoard);
			List<NonCardTriggerReceiver> source2 = new List<NonCardTriggerReceiver>(Singleton<GlobalTriggerHandler>.Instance.nonCardReceivers);
			List<SlotModificationBehaviour> source3 = new List<SlotModificationBehaviour>(SlotModificationManager.Instance?.SlotReceivers?.Select((KeyValuePair<CardSlot, Tuple<SlotModificationManager.ModificationType, SlotModificationBehaviour>> kvp) => kvp.Value.Item2) ?? Enumerable.Empty<SlotModificationBehaviour>());
			return (from x in source2
				where !UnityExtensions.SafeIsUnityNull((Object)(object)x)
				where x.TriggerBeforeCards
				select x).OfType<T>().Concat(source3.Where((SlotModificationBehaviour x) => !UnityExtensions.SafeIsUnityNull((Object)(object)x)).OfType<T>()).Concat(source.Where((PlayableCard x) => (Object)(object)x != (Object)null && x.OnBoard && (!((Card)x).FaceDown || findFacedown)).SelectMany(FindTriggersOnCard<T>))
				.Concat((from x in source2
					where !UnityExtensions.SafeIsUnityNull((Object)(object)x)
					where !x.TriggerBeforeCards
					select x).OfType<T>())
				.Concat(from x in source.Where((PlayableCard x) => (Object)(object)x != (Object)null && x.OnBoard && ((Card)x).FaceDown && !findFacedown).SelectMany(FindTriggersOnCard<T>)
					where x is IActivateWhenFacedown && (x as IActivateWhenFacedown).ShouldTriggerCustomWhenFaceDown(typeof(T))
					select x);
		}

		public static IEnumerable<T> FindTriggersInHandExcluding<T>(PlayableCard card)
		{
			return new List<PlayableCard>(Singleton<PlayerHand>.Instance.CardsInHand).Where((PlayableCard x) => (Object)(object)x != (Object)null && x.InHand && (Object)(object)x != (Object)(object)card).SelectMany(FindTriggersOnCard<T>);
		}

		[IteratorStateMachine(typeof(<FindTriggersOnCard>d__22<>))]
		public static IEnumerable<T> FindTriggersOnCard<T>(this PlayableCard card)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FindTriggersOnCard>d__22<T>(-2)
			{
				<>3__card = card
			};
		}

		[IteratorStateMachine(typeof(<FindTriggersOnCard>d__23<>))]
		public static IEnumerable<T> FindTriggersOnCard<T>(this CardTriggerHandler card)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FindTriggersOnCard>d__23<T>(-2)
			{
				<>3__card = card
			};
		}

		public static IEnumerable<T> FindTriggersInQueue<T>()
		{
			TurnManager instance = Singleton<TurnManager>.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				Opponent opponent = instance.Opponent;
				T val = default(T);
				obj = ((opponent != null) ? (from card in opponent.Queue
					where ((Component)card).TryGetComponent<T>(ref val)
					select ((Component)card).GetComponent<T>()) : null);
			}
			if (obj == null)
			{
				obj = new T[0];
			}
			return (IEnumerable<T>)obj;
		}
	}
	[HarmonyPatch]
	internal static class CustomTriggerPatches
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0
		{
			public PlayableCard card;

			internal bool <TriggerOnAddedToHand>b__2(IOnOtherCardAddedToHand x)
			{
				return x.RespondsToOtherCardAddedToHand(card);
			}

			internal IEnumerator <TriggerOnAddedToHand>b__3(IOnOtherCardAddedToHand x)
			{
				return x.OnOtherCardAddedToHand(card);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass10_0
		{
			public PlayableCard card;

			internal bool <TriggerOnOtherCardResolveInHand>b__0(IOnOtherCardResolveInHand x)
			{
				return x.RespondsToOtherCardResolveInHand(card);
			}

			internal IEnumerator <TriggerOnOtherCardResolveInHand>b__1(IOnOtherCardResolveInHand x)
			{
				return x.OnOtherCardResolveInHand(card);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass13_0
		{
			public PlayableCard card;

			public CardSlot slot2;

			internal bool <TriggerOnOtherCardAssignedToSlotInHand>b__0(IOnCardAssignedToSlotContext x)
			{
				return x.RespondsToCardAssignedToSlotContext(card, slot2, card.Slot);
			}

			internal IEnumerator <TriggerOnOtherCardAssignedToSlotInHand>b__1(IOnCardAssignedToSlotContext x)
			{
				return x.OnCardAssignedToSlotContext(card, slot2, card.Slot);
			}

			internal bool <TriggerOnOtherCardAssignedToSlotInHand>b__2(IOnOtherCardAssignedToSlotInHand x)
			{
				return x.RespondsToOtherCardAssignedToSlotInHand(card);
			}

			internal IEnumerator <TriggerOnOtherCardAssignedToSlotInHand>b__3(IOnOtherCardAssignedToSlotInHand x)
			{
				return x.OnOtherCardAssignedToSlotInHand(card);
			}

			internal bool <TriggerOnOtherCardAssignedToSlotInHand>b__4(IOnCardAssignedToSlotNoResolve x)
			{
				return x.RespondsToCardAssignedToSlotNoResolve(card);
			}

			internal IEnumerator <TriggerOnOtherCardAssignedToSlotInHand>b__5(IOnCardAssignedToSlotNoResolve x)
			{
				return x.OnCardAssignedToSlotNoResolve(card);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass15_0
		{
			public CardSlot slotBeforeDeath;

			public bool wasSacrifice;

			public PlayableCard killer;

			public PlayableCard __instance;

			public Func<IOnOtherCardPreDeathInHand, bool> <>9__0;

			public Func<IOnOtherCardPreDeathInHand, IEnumerator> <>9__1;

			public Func<IOnOtherCardDieInHand, bool> <>9__2;

			public Func<IOnOtherCardDieInHand, IEnumerator> <>9__3;

			internal bool <TriggerDeathTriggers>b__0(IOnOtherCardPreDeathInHand x)
			{
				return x.RespondsToOtherCardPreDeathInHand(slotBeforeDeath, !wasSacrifice, killer);
			}

			internal IEnumerator <TriggerDeathTriggers>b__1(IOnOtherCardPreDeathInHand x)
			{
				return x.OnOtherCardPreDeathInHand(slotBeforeDeath, !wasSacrifice, killer);
			}

			internal bool <TriggerDeathTriggers>b__2(IOnOtherCardDieInHand x)
			{
				return x.RespondsToOtherCardDieInHand(__instance, slotBeforeDeath, !wasSacrifice, killer);
			}

			internal IEnumerator <TriggerDeathTriggers>b__3(IOnOtherCardDieInHand x)
			{
				return x.OnOtherCardDieInHand(__instance, slotBeforeDeath, !wasSacrifice, killer);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_0
		{
			public string consumableName;

			public bool itemCanBeUsed;

			public ConsumableItemSlot __instance;

			internal bool <TriggerItemUse>b__0(IItemCanBeUsed x)
			{
				return x.RespondsToItemCanBeUsed(consumableName, itemCanBeUsed);
			}

			internal bool <TriggerItemUse>b__1(IItemCanBeUsed x)
			{
				return itemCanBeUsed = x.CollectItemCanBeUsed(consumableName, itemCanBeUsed);
			}

			internal bool <TriggerItemUse>b__4(IOnPreItemUsed x)
			{
				return x.RespondsToPreItemUsed(consumableName, __instance is HammerItemSlot);
			}

			internal IEnumerator <TriggerItemUse>b__5(IOnPreItemUsed x)
			{
				return x.OnPreItemUsed(consumableName, __instance is HammerItemSlot);
			}

			internal bool <TriggerItemUse>b__2(IOnItemPreventedFromUse x)
			{
				return x.RespondsToItemPreventedFromUse(consumableName);
			}

			internal IEnumerator <TriggerItemUse>b__3(IOnItemPreventedFromUse x)
			{
				return x.OnItemPreventedFromUse(consumableName);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_1
		{
			public bool successInActivation;

			public <>c__DisplayClass16_0 CS$<>8__locals1;

			internal bool <TriggerItemUse>b__6(IOnPostItemUsed x)
			{
				return x.RespondsToPostItemUsed(CS$<>8__locals1.consumableName, successInActivation, CS$<>8__locals1.__instance is HammerItemSlot);
			}

			internal IEnumerator <TriggerItemUse>b__7(IOnPostItemUsed x)
			{
				return x.OnPostItemUsed(CS$<>8__locals1.consumableName, successInActivation, CS$<>8__locals1.__instance is HammerItemSlot);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass1_0
		{
			public bool playerIsAttacker;

			internal bool <TriggerOnBellRung>b__0(IOnBellRung x)
			{
				return x.RespondsToBellRung(playerIsAttacker);
			}

			internal IEnumerator <TriggerOnBellRung>b__1(IOnBellRung x)
			{
				return x.OnBellRung(playerIsAttacker);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public CardSlot slot;

			internal bool <TriggerOnSlotAttackSequence>b__0(IOnPreSlotAttackSequence x)
			{
				return x.RespondsToPreSlotAttackSequence(slot);
			}

			internal IEnumerator <TriggerOnSlotAttackSequence>b__1(IOnPreSlotAttackSequence x)
			{
				return x.OnPreSlotAttackSequence(slot);
			}

			internal bool <TriggerOnSlotAttackSequence>b__2(IOnPostSlotAttackSequence x)
			{
				return x.RespondsToPostSlotAttackSequence(slot);
			}

			internal IEnumerator <TriggerOnSlotAttackSequence>b__3(IOnPostSlotAttackSequence x)
			{
				return x.OnPostSlotAttackSequence(slot);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass3_0
		{
			public CardSlot attackingSlot;

			public CardSlot opposingSlot;

			internal bool <TriggerOnPostSingularSlotAttackSlot>b__0(IOnPostSingularSlotAttackSlot x)
			{
				return x.RespondsToPostSingularSlotAttackSlot(attackingSlot, opposingSlot);
			}

			internal IEnumerator <TriggerOnPostSingularSlotAttackSlot>b__1(IOnPostSingularSlotAttackSlot x)
			{
				return x.OnPostSingularSlotAttackSlot(attackingSlot, opposingSlot);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_0
		{
			public int damage;

			public int numWeights;

			public bool toPlayer;

			public int initialDamage;

			public bool initialToPlayer;

			internal bool <TriggerOnScalesChanged>b__0(IOnPreScalesChangedRef x)
			{
				return x.RespondsToPreScalesChangedRef(damage, numWeights, toPlayer);
			}

			internal int <TriggerOnScalesChanged>b__1(IOnPreScalesChangedRef x)
			{
				damage = x.CollectPreScalesChangedRef(damage, ref numWeights, ref toPlayer);
				if (damage < 0)
				{
					damage = -damage;
					toPlayer = !toPlayer;
				}
				return damage;
			}

			internal bool <TriggerOnScalesChanged>b__2(IOnPreScalesChanged x)
			{
				return x.RespondsToPreScalesChanged(damage, toPlayer, initialDamage, initialToPlayer);
			}

			internal IEnumerator <TriggerOnScalesChanged>b__3(IOnPreScalesChanged x)
			{
				return x.OnPreScalesChanged(damage, toPlayer, initialDamage, initialToPlayer);
			}

			internal bool <TriggerOnScalesChanged>b__4(IOnPostScalesChanged x)
			{
				return x.RespondsToPostScalesChanged(damage, toPlayer, initialDamage, initialToPlayer);
			}

			internal IEnumerator <TriggerOnScalesChanged>b__5(IOnPostScalesChanged x)
			{
				return x.OnPostScalesChanged(damage, toPlayer, initialDamage, initialToPlayer);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public bool playerUpkeep;

			internal bool <TriggerOnUpkeepInHand>b__0(IOnUpkeepInHand x)
			{
				return x.RespondsToUpkeepInHand(playerUpkeep);
			}

			internal IEnumerator <TriggerOnUpkeepInHand>b__1(IOnUpkeepInHand x)
			{
				return x.OnUpkeepInHand(playerUpkeep);
			}
		}

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

			private object <>2__current;

			public bool wasSacrifice;

			public PlayableCard killer;

			public PlayableCard __instance;

			public IEnumerator result;

			private <>c__DisplayClass15_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Invalid comparison between Unknown and I4
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Invalid comparison between Unknown and I4
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass15_0();
					<>8__1.wasSacrifice = wasSacrifice;
					<>8__1.killer = killer;
					<>8__1.__instance = __instance;
					<>8__1.slotBeforeDeath = <>8__1.__instance.Slot;
					break;
				case 1:
				{
					<>1__state = -1;
					if (!(result.Current.GetType() == triggerType))
					{
						break;
					}
					Trigger val = (Trigger)21;
					try
					{
						val = (Trigger)(triggerField ?? (triggerField = triggerType.GetField("trigger"))).GetValue(result.Current);
					}
					catch
					{
					}
					if ((int)val == 17)
					{
						<>2__current = CustomTriggerFinder.TriggerInHand((IOnOtherCardPreDeathInHand x) => x.RespondsToOtherCardPreDeathInHand(<>8__1.slotBeforeDeath, !<>8__1.wasSacrifice, <>8__1.killer), (IOnOtherCardPreDeathInHand x) => x.OnOtherCardPreDeathInHand(<>8__1.slotBeforeDeath, !<>8__1.wasSacrifice, <>8__1.killer));
						<>1__state = 2;
						return true;
					}
					if ((int)val == 11)
					{
						<>2__current = CustomTriggerFinder.TriggerInHand((IOnOtherCardDieInHand x) => x.RespondsToOtherCardDieInHand(<>8__1.__instance, <>8__1.slotBeforeDeath, !<>8__1.wasSacrifice, <>8__1.killer), (IOnOtherCardDieInHand x) => x.OnOtherCardDieInHand(<>8__1.__instance, <>8__1.slotBeforeDeath, !<>8__1.wasSacrifice, <>8__1.killer));
						<>1__state = 3;
						return true;
					}
					break;
				}
				case 2:
					<>1__state = -1;
					break;
				case 3:
					<>1__state = -1;
					break;
				}
				if (result.MoveNext())
				{
					<>2__current = result.Current;
					<>1__state = 1;
					return true;
				}
				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 <TriggerItemUse>d__16 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ConsumableItemSlot __instance;

			public IEnumerator result;

			private <>c__DisplayClass16_1 <>8__1;

			private Type <activationtype>5__2;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0
					{
						__instance = __instance,
						itemCanBeUsed = true
					};
					ConsumableItemSlot _instance = CS$<>8__locals0.__instance;
					object consumableName;
					if (_instance == null)
					{
						consumableName = null;
					}
					else
					{
						ConsumableItem consumable = _instance.Consumable;
						if (consumable == null)
						{
							consumableName = null;
						}
						else
						{
							ItemData data = ((Item)consumable).Data;
							consumableName = ((data != null) ? ((Object)data).name : null);
						}
					}
					CS$<>8__locals0.consumableName = (string)consumableName;
					if (!string.IsNullOrEmpty(CS$<>8__locals0.consumableName))
					{
						CustomTriggerFinder.CollectDataAll(collectFromFacedown: false, (IItemCanBeUsed x) => x.RespondsToItemCanBeUsed(CS$<>8__locals0.consumableName, CS$<>8__locals0.itemCanBeUsed), (IItemCanBeUsed x) => CS$<>8__locals0.itemCanBeUsed = x.CollectItemCanBeUsed(CS$<>8__locals0.consumableName, CS$<>8__locals0.itemCanBeUsed));
					}
					if (CS$<>8__locals0.itemCanBeUsed)
					{
						<>8__1 = new <>c__DisplayClass16_1();
						<>8__1.CS$<>8__locals1 = CS$<>8__locals0;
						<>8__1.successInActivation = false;
						<activationtype>5__2 = <>8__1.CS$<>8__locals1.__instance.Consumable.ActivateSequence().GetType();
						if (!string.IsNullOrEmpty(<>8__1.CS$<>8__locals1.consumableName))
						{
							<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPreItemUsed x) => x.RespondsToPreItemUsed(<>8__1.CS$<>8__locals1.consumableName, <>8__1.CS$<>8__locals1.__instance is HammerItemSlot), (IOnPreItemUsed x) => x.OnPreItemUsed(<>8__1.CS$<>8__locals1.consumableName, <>8__1.CS$<>8__locals1.__instance is HammerItemSlot));
							<>1__state = 1;
							return true;
						}
						goto IL_01f3;
					}
					ConsumableItemSlot _instance2 = CS$<>8__locals0.__instance;
					if (_instance2 != null)
					{
						ConsumableItem consumable2 = _instance2.Consumable;
						if (consumable2 != null)
						{
							consumable2.PlayShakeAnimation();
						}
					}
					if (!string.IsNullOrEmpty(CS$<>8__locals0.consumableName))
					{
						<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnItemPreventedFromUse x) => x.RespondsToItemPreventedFromUse(CS$<>8__locals0.consumableName), (IOnItemPreventedFromUse x) => x.OnItemPreventedFromUse(CS$<>8__locals0.consumableName));
						<>1__state = 4;
						return true;
					}
					break;
				}
				case 1:
					<>1__state = -1;
					goto IL_01f3;
				case 2:
					<>1__state = -1;
					if (result.Current.GetType() == <activationtype>5__2 && !string.IsNullOrEmpty(<>8__1.CS$<>8__locals1.consumableName) && (Object)(object)<>8__1.CS$<>8__locals1.__instance.Consumable != (Object)null)
					{
						<>8__1.successInActivation = !<>8__1.CS$<>8__locals1.__instance.Consumable.ActivationCancelled;
					}
					goto IL_01f3;
				case 3:
					<>1__state = -1;
					goto IL_0258;
				case 4:
					{
						<>1__state = -1;
						break;
					}
					IL_0258:
					<>8__1 = null;
					<activationtype>5__2 = null;
					break;
					IL_01f3:
					if (result.MoveNext())
					{
						<>2__current = result.Current;
						<>1__state = 2;
						return true;
					}
					if (!string.IsNullOrEmpty(<>8__1.CS$<>8__locals1.consumableName))
					{
						<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPostItemUsed x) => x.RespondsToPostItemUsed(<>8__1.CS$<>8__locals1.consumableName, <>8__1.successInActivation, <>8__1.CS$<>8__locals1.__instance is HammerItemSlot), (IOnPostItemUsed x) => x.OnPostItemUsed(<>8__1.CS$<>8__locals1.consumableName, <>8__1.successInActivation, <>8__1.CS$<>8__locals1.__instance is HammerItemSlot));
						<>1__state = 3;
						return true;
					}
					goto IL_0258;
				}
				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 <TriggerOnAddedToHand>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayableCard card;

			public IEnumerator result;

			private <>c__DisplayClass0_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass0_0();
					<>8__1.card = card;
					<>2__current = result;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>8__1.card.TriggerHandler.Trigger((IOnAddedToHand x) => x.RespondsToAddedToHand(), (IOnAddedToHand x) => x.OnAddedToHand());
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnOtherCardAddedToHand x) => x.RespondsToOtherCardAddedToHand(<>8__1.card), (IOnOtherCardAddedToHand x) => x.OnOtherCardAddedToHand(<>8__1.card));
					<>1__state = 3;
					return true;
				case 3:
					<>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 <TriggerOnBellRung>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public bool playerIsAttacker;

			public IEnumerator result;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0
					{
						playerIsAttacker = playerIsAttacker
					};
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnBellRung x) => x.RespondsToBellRung(CS$<>8__locals0.playerIsAttacker), (IOnBellRung x) => x.OnBellRung(CS$<>8__locals0.playerIsAttacker));
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					<>2__current = result;
					<>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();
			}
		}

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

			private object <>2__current;

			public PlayableCard card;

			public IEnumerator result;

			public bool resolveTriggers;

			private <>c__DisplayClass13_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass13_0();
					<>8__1.card = card;
					<>8__1.slot2 = <>8__1.card.Slot;
					<>2__current = result;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (resolveTriggers && (Object)(object)<>8__1.slot2 != (Object)(object)<>8__1.card.Slot)
					{
						<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnCardAssignedToSlotContext x) => x.RespondsToCardAssignedToSlotContext(<>8__1.card, <>8__1.slot2, <>8__1.card.Slot), (IOnCardAssignedToSlotContext x) => x.OnCardAssignedToSlotContext(<>8__1.card, <>8__1.slot2, <>8__1.card.Slot));
						<>1__state = 2;
						return true;
					}
					goto IL_00e5;
				case 2:
					<>1__state = -1;
					goto IL_00e5;
				case 3:
					<>1__state = -1;
					goto IL_014c;
				case 4:
					{
						<>1__state = -1;
						break;
					}
					IL_014c:
					if (resolveTriggers && (Object)(object)<>8__1.slot2 != (Object)(object)<>8__1.card.Slot && (Object)(object)<>8__1.slot2 != (Object)null)
					{
						<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnCardAssignedToSlotNoResolve x) => x.RespondsToCardAssignedToSlotNoResolve(<>8__1.card), (IOnCardAssignedToSlotNoResolve x) => x.OnCardAssignedToSlotNoResolve(<>8__1.card));
						<>1__state = 4;
						return true;
					}
					break;
					IL_00e5:
					if (resolveTriggers && (Object)(object)<>8__1.slot2 != (Object)(object)<>8__1.card.Slot)
					{
						<>2__current = CustomTriggerFinder.TriggerInHand((IOnOtherCardAssignedToSlotInHand x) => x.RespondsToOtherCardAssignedToSlotInHand(<>8__1.card), (IOnOtherCardAssignedToSlotInHand x) => x.OnOtherCardAssignedToSlotInHand(<>8__1.card));
						<>1__state = 3;
						return true;
					}
					goto IL_014c;
				}
				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 <TriggerOnOtherCardResolveInHand>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayableCard card;

			public IEnumerator result;

			public bool resolveTriggers;

			private <>c__DisplayClass10_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass10_0();
					<>8__1.card = card;
					<>2__current = result;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (resolveTriggers)
					{
						<>2__current = CustomTriggerFinder.TriggerInHand((IOnOtherCardResolveInHand x) => x.RespondsToOtherCardResolveInHand(<>8__1.card), (IOnOtherCardResolveInHand x) => x.OnOtherCardResolveInHand(<>8__1.card));
						<>1__state = 2;
						return true;
					}
					break;
				case 2:
					<>1__state = -1;
					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 <TriggerOnPostSingularSlotAttackSlot>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardSlot attackingSlot;

			public CardSlot opposingSlot;

			public IEnumerator result;

			private <>c__DisplayClass3_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass3_0();
					<>8__1.attackingSlot = attackingSlot;
					<>8__1.opposingSlot = opposingSlot;
					<>2__current = result;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPostSingularSlotAttackSlot x) => x.RespondsToPostSingularSlotAttackSlot(<>8__1.attackingSlot, <>8__1.opposingSlot), (IOnPostSingularSlotAttackSlot x) => x.OnPostSingularSlotAttackSlot(<>8__1.attackingSlot, <>8__1.opposingSlot));
					<>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();
			}
		}

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

			private object <>2__current;

			public int damage;

			public int numWeights;

			public bool toPlayer;

			public IEnumerator result;

			private <>c__DisplayClass8_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass8_0();
					<>8__1.damage = damage;
					<>8__1.numWeights = numWeights;
					<>8__1.toPlayer = toPlayer;
					<>8__1.initialDamage = <>8__1.damage;
					<>8__1.initialToPlayer = <>8__1.toPlayer;
					CustomTriggerFinder.CollectDataAll(collectFromFacedown: false, (IOnPreScalesChangedRef x) => x.RespondsToPreScalesChangedRef(<>8__1.damage, <>8__1.numWeights, <>8__1.toPlayer), delegate(IOnPreScalesChangedRef x)
					{
						<>8__1.damage = x.CollectPreScalesChangedRef(<>8__1.damage, ref <>8__1.numWeights, ref <>8__1.toPlayer);
						if (<>8__1.damage < 0)
						{
							<>8__1.damage = -<>8__1.damage;
							<>8__1.toPlayer = !<>8__1.toPlayer;
						}
						return <>8__1.damage;
					});
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPreScalesChanged x) => x.RespondsToPreScalesChanged(<>8__1.damage, <>8__1.toPlayer, <>8__1.initialDamage, <>8__1.initialToPlayer), (IOnPreScalesChanged x) => x.OnPreScalesChanged(<>8__1.damage, <>8__1.toPlayer, <>8__1.initialDamage, <>8__1.initialToPlayer));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					(scaleChangedDamage ?? (scaleChangedDamage = (scaleChangedCoroutine ?? (scaleChangedCoroutine = result?.GetType()))?.GetField("damage")))?.SetValue(result, <>8__1.damage);
					(scaleChangedToPlayer ?? (scaleChangedToPlayer = (scaleChangedCoroutine ?? (scaleChangedCoroutine = result?.GetType()))?.GetField("toPlayer")))?.SetValue(result, <>8__1.toPlayer);
					(scaleChangedNumWeights ?? (scaleChangedNumWeights = (scaleChangedCoroutine ?? (scaleChangedCoroutine = result?.GetType()))?.GetField("numWeights")))?.SetValue(result, <>8__1.numWeights);
					<>2__current = result;
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPostScalesChanged x) => x.RespondsToPostScalesChanged(<>8__1.damage, <>8__1.toPlayer, <>8__1.initialDamage, <>8__1.initialToPlayer), (IOnPostScalesChanged x) => x.OnPostScalesChanged(<>8__1.damage, <>8__1.toPlayer, <>8__1.initialDamage, <>8__1.initialToPlayer));
					<>1__state = 3;
					return true;
				case 3:
					<>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 <TriggerOnSlotAttackSequence>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardSlot slot;

			public IEnumerator result;

			private <>c__DisplayClass2_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass2_0();
					<>8__1.slot = slot;
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPreSlotAttackSequence x) => x.RespondsToPreSlotAttackSequence(<>8__1.slot), (IOnPreSlotAttackSequence x) => x.OnPreSlotAttackSequence(<>8__1.slot));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = result;
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = CustomTriggerFinder.TriggerAll(triggerFacedown: false, (IOnPostSlotAttackSequence x) => x.RespondsToPostSlotAttackSequence(<>8__1.slot), (IOnPostSlotAttackSequence x) => x.OnPostSlotAttackSequence(<>8__1.slot));
					<>1__state = 3;
					return true;
				case 3:
					<>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 <TriggerOnTurnEndInHandOpponent>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TurnManager __instance;

			public IEnumerator result;

			private bool <turnSkipped>5__2;

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

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

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

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

plugins/InscryptionCommunityPatch.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Boons;
using InscryptionAPI.Card;
using InscryptionAPI.CardCosts;
using InscryptionAPI.Dialogue;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionCommunityPatch.Card;
using InscryptionCommunityPatch.ResourceManagers;
using InscryptionCommunityPatch.Tests;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Pixelplacement;
using Pixelplacement.TweenSystem;
using Sirenix.Serialization.Utilities;
using Sirenix.Utilities;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("InscryptionCommunityPatch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.23.0.0")]
[assembly: AssemblyInformationalVersion("2.23.0+d56bf5bd89588fb2fb73251c71d60ea43ecc7959")]
[assembly: AssemblyProduct("InscryptionCommunityPatch")]
[assembly: AssemblyTitle("InscryptionCommunityPatch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.23.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 InscryptionCommunityPatch
{
	[BepInPlugin("community.inscryption.patch", "InscryptionCommunityPatch", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class PatchPlugin : BaseUnityPlugin
	{
		public const string ModGUID = "community.inscryption.patch";

		public const string ModName = "InscryptionCommunityPatch";

		public const string ModVer = "1.0.0";

		internal static PatchPlugin Instance;

		internal static ConfigEntry<bool> configEnergy;

		internal static ConfigEntry<bool> configDrone;

		internal static ConfigEntry<bool> configMox;

		internal static ConfigEntry<bool> configDroneMox;

		internal static ConfigEntry<bool> configShowSquirrelTribeOnCards;

		internal static ConfigEntry<bool> configAct3Bones;

		internal static ConfigEntry<bool> configResetEyes;

		internal static ConfigEntry<bool> undeadCatEmission;

		internal static ConfigEntry<bool> rightAct2Cost;

		internal static ConfigEntry<bool> act2CostRender;

		internal static ConfigEntry<bool> act2VanillaStyle;

		internal static ConfigEntry<bool> doubleStackSplit;

		internal static ConfigEntry<bool> act2StackIconType;

		internal static ConfigEntry<bool> configMergeOnBottom;

		internal static ConfigEntry<bool> configRemovePatches;

		internal static ConfigEntry<bool> configSmallPricetags;

		internal static ConfigEntry<bool> configMovePricetags;

		internal static ConfigEntry<bool> configTestState;

		internal static ConfigEntry<bool> configFullDebug;

		internal static ConfigEntry<bool> configDefaultDrone;

		internal static ConfigEntry<bool> act2TutorCenterRows;

		internal static ManualLogSource Logger;

		private readonly Harmony HarmonyInstance = new Harmony("community.inscryption.patch");

		private void OnEnable()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			HarmonyInstance.PatchAll(typeof(PatchPlugin).Assembly);
			SceneManager.sceneLoaded += OnSceneLoaded;
			if (configTestState.Value)
			{
				ExecuteCommunityPatchTests.PrepareForTests();
				TestCost.Init();
			}
			CommunityArtPatches.PatchCommunityArt();
		}

		private void OnDisable()
		{
			HarmonyInstance.UnpatchSelf();
		}

		private void Awake()
		{
			Instance = this;
			configEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("Energy", "Energy Refresh", true, "Max energy increases and energy refreshes at end of turn");
			configDrone = ((BaseUnityPlugin)this).Config.Bind<bool>("Energy", "Energy Drone", false, "Drone is visible to display energy (requires Energy Refresh)");
			configDefaultDrone = ((BaseUnityPlugin)this).Config.Bind<bool>("Energy", "Default Drone", false, "Drone uses the vanilla model instead of being attached to the scales (requires Energy Drone)");
			configMox = ((BaseUnityPlugin)this).Config.Bind<bool>("Mox", "Mox Refresh", true, "Mox refreshes at end of battle");
			configDroneMox = ((BaseUnityPlugin)this).Config.Bind<bool>("Mox", "Mox Drone", false, "Drone displays mox (requires Energy Drone and Mox Refresh)");
			configAct3Bones = ((BaseUnityPlugin)this).Config.Bind<bool>("Bones", "Act 3 Bones", false, "Force bones displayer to be active in Act 3");
			configShowSquirrelTribeOnCards = ((BaseUnityPlugin)this).Config.Bind<bool>("Tribes", "Show Squirrel Tribe", false, "Shows the Squirrel tribe icon on cards");
			act2CostRender = ((BaseUnityPlugin)this).Config.Bind<bool>("Card Costs", "GBC Cost render", true, "GBC Cards are able to display custom costs and hybrid costs through the API.");
			rightAct2Cost = ((BaseUnityPlugin)this).Config.Bind<bool>("Card Costs", "GBC Cost On Right", true, "GBC Cards display their costs on the top-right corner. If false, display on the top-left corner");
			act2VanillaStyle = ((BaseUnityPlugin)this).Config.Bind<bool>("Card Costs", "GBC Vanilla Render", false, "GBC cards use vanilla sprites when rendering multiple and custom costs.");
			configMergeOnBottom = ((BaseUnityPlugin)this).Config.Bind<bool>("Sigil Display", "Merge_On_Botom", false, "Makes it so if enabled, merged sigils will display on the bottom of the card instead of on the artwork. In extreme cases, this can cause some visual bugs.");
			configRemovePatches = ((BaseUnityPlugin)this).Config.Bind<bool>("Sigil Display", "Remove_Patches", false, "Makes it so if enabled, merged sigils will not have a patch behind them anymore and will instead be glowing yellow (only works with Merge_On_Bottom).");
			doubleStackSplit = ((BaseUnityPlugin)this).Config.Bind<bool>("Sigil Display", "Vanilla Stacking", false, "If enabled, cards with only two visible sigils will display each separately even if they can stack.");
			configSmallPricetags = ((BaseUnityPlugin)this).Config.Bind<bool>("Act 1", "Smaller Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be scaled down.");
			configMovePricetags = ((BaseUnityPlugin)this).Config.Bind<bool>("Act 1", "Move Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be moved to the right.");
			act2StackIconType = ((BaseUnityPlugin)this).Config.Bind<bool>("Sigil Display", "Act 2 Sigil icon type", true, "If true, stacking icons are a cream outline with a black center. If false, stacking icons are a black outline with a cream center. Act 2");
			act2TutorCenterRows = ((BaseUnityPlugin)this).Config.Bind<bool>("Act 2", "Centred Hoarder UI", true, "If true, centres displayed cards in each row during the Hoarder selection sequence.");
			configFullDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Full Debug", true, "If true, displays all debug logs in the console.");
			configTestState = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Test Mode", false, "Puts the game into test mode. This will cause (among potentially other things) a new run to spawn a number of cards into your opening deck that will demonstrate card behaviors.");
			configResetEyes = ((BaseUnityPlugin)this).Config.Bind<bool>("Act 1", "Reset Red Eyes", false, "Resets Leshy's eyes to normal if they were turned red due to a boss fight's grizzly bear sequence.");
			undeadCatEmission = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Undead Cat Emission", false, "If true, Undead Cat will have a forced red emission.");
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			EnergyDrone.TryEnableEnergy(((Scene)(ref scene)).name);
		}
	}
}
namespace InscryptionCommunityPatch.Tests
{
	public class SacrificeSquirrels : BoonBehaviour
	{
		[CompilerGenerated]
		private sealed class <OnOtherCardResolve>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SacrificeSquirrels <>4__this;

			public PlayableCard otherCard;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				int num = <>1__state;
				SacrificeSquirrels sacrificeSquirrels = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = ((BoonBehaviour)sacrificeSquirrels).PlayBoonAnimation();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					otherCard.TemporaryMods.Add(new CardModificationInfo((Ability)14));
					((Card)otherCard).RenderCard();
					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();
			}
		}

		public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
		{
			return ((Object)((Card)otherCard).Info).name.ToLowerInvariant().Equals("squirrel");
		}

		[IteratorStateMachine(typeof(<OnOtherCardResolve>d__1))]
		public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnOtherCardResolve>d__1(0)
			{
				<>4__this = this,
				otherCard = otherCard
			};
		}
	}
	[HarmonyPatch]
	public static class ExecuteCommunityPatchTests
	{
		public static Type TestBoon;

		public static void PrepareForTests()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			AbilityExtensions.AbilityByID((IEnumerable<FullAbility>)AbilityManager.BaseGameAbilities, (Ability)15).Info.canStack = true;
			AbilityExtensions.AbilityByID((IEnumerable<FullAbility>)AbilityManager.BaseGameAbilities, (Ability)34).Info.canStack = true;
			AbilityExtensions.AbilityByID((IEnumerable<FullAbility>)AbilityManager.BaseGameAbilities, (Ability)29).Info.canStack = true;
			TestBoon = BoonManager.New("community.inscryption.patch", "Sacrificial Squirrels", typeof(SacrificeSquirrels), "Squirrels are super OP now", (Texture)(object)Resources.Load<Texture2D>("art/cards/abilityicons/ability_drawcopyondeath"), (Texture)(object)Resources.Load<Texture2D>("art/cards/boons/boonportraits/boon_startinggoat"), false, true, true);
		}

		[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
		[HarmonyPostfix]
		private static void StartRunInTestMode(ref AscensionSaveData __instance)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			if (!PatchPlugin.configTestState.Value)
			{
				return;
			}
			List<Ability> list = new List<Ability>
			{
				(Ability)15,
				(Ability)83,
				(Ability)6,
				(Ability)1,
				(Ability)3,
				(Ability)4,
				(Ability)100,
				(Ability)23,
				(Ability)2
			};
			for (int i = 2; i < 4; i++)
			{
				CardInfo cardByName = CardLoader.GetCardByName("Rabbit");
				CardModificationInfo val = new CardModificationInfo();
				val.abilities = new List<Ability>(list.Take(i));
				cardByName.mods.Add(val);
				CardModificationInfo val2 = new CardModificationInfo();
				val2.abilities = new List<Ability> { list[i - 1] };
				val2.fromCardMerge = true;
				cardByName.mods.Add(val2);
				((CardCollectionInfo)__instance.currentRun.playerDeck).AddCard(cardByName);
			}
			for (int j = 1; j <= 2; j++)
			{
				CardInfo cardByName2 = CardLoader.GetCardByName("Rabbit");
				CardModificationInfo val3 = new CardModificationInfo();
				val3.abilities = new List<Ability>();
				for (int k = 0; k < j; k++)
				{
					val3.abilities.Add((Ability)15);
					val3.abilities.Add((Ability)34);
					val3.abilities.Add((Ability)29);
					val3.abilities.Add((Ability)2);
				}
				cardByName2.mods.Add(val3);
				((CardCollectionInfo)__instance.currentRun.playerDeck).AddCard(cardByName2);
			}
			__instance.currentRun.playerDeck.AddBoon(TestBoon);
		}
	}
	public class TestCost : CustomCardCost
	{
		[CompilerGenerated]
		private sealed class <OnPlayed>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int cardCost;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (cardCost > 0)
					{
						<>2__current = Singleton<ResourcesManager>.Instance.SpendEnergy(cardCost);
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					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();
			}
		}

		public override string CostName => "TestCost";

		public static void Init()
		{
			PatchPlugin.Logger.LogDebug((object)"Adding TestCost");
			CardCostManager.SetFoundAtChoiceNodes(CardCostManager.SetCanBePlayedByTurn2WithHand(CardCostManager.SetCostTier(CardCostManager.Register("cyantist.inscryption.api", "TestCost", typeof(TestCost), (Func<int, CardInfo, PlayableCard, Texture2D>)Texture3D, (Func<int, CardInfo, PlayableCard, Texture2D>)TexturePixel), (Func<int, int>)CostTier), (Func<int, CardInfo, List<CardInfo>, bool>)CanBePlayed), true, (Texture)(object)TextureHelper.GetImageAsTexture("testCost.png", typeof(TestCost).Assembly, (FilterMode)0));
		}

		public static int CostTier(int amount)
		{
			return Mathf.FloorToInt((float)amount / 2f);
		}

		public static bool CanBePlayed(int amount, CardInfo card, List<CardInfo> hand)
		{
			return amount <= 2;
		}

		public static Texture2D Texture3D(int cardCost, CardInfo cardInfo, PlayableCard playableCard)
		{
			return ReverseColours(TextureHelper.GetImageAsTexture($"energy_cost_{Mathf.Min(7, cardCost)}.png", typeof(PatchPlugin).Assembly, (FilterMode)0));
		}

		public static Texture2D TexturePixel(int cardCost, CardInfo info, PlayableCard playableCard)
		{
			return ReverseColours(Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("pixel_energy.png", typeof(PatchPlugin).Assembly, (FilterMode)0)));
		}

		private static Texture2D ReverseColours(Texture2D texToReverse)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			for (int i = 0; i < ((Texture)texToReverse).width; i++)
			{
				for (int j = 0; j < ((Texture)texToReverse).height; j++)
				{
					Color pixel = texToReverse.GetPixel(i, j);
					Color.RGBToHSV(pixel, ref num, ref num2, ref num3);
					Color val = Color.HSVToRGB((num + 0.5f) % 1f, (num2 + 0.5f) % 1f, (num3 + 0.5f) % 1f);
					val.a = pixel.a;
					texToReverse.SetPixel(i, j, val);
				}
			}
			texToReverse.Apply();
			return texToReverse;
		}

		public override bool CostSatisfied(int cardCost, PlayableCard card)
		{
			return cardCost <= Singleton<ResourcesManager>.Instance.PlayerEnergy - card.EnergyCost;
		}

		public override string CostUnsatisfiedHint(int cardCost, PlayableCard card)
		{
			return "Eat your greens aby. " + ((Card)card).Info.DisplayedNameLocalized;
		}

		[IteratorStateMachine(typeof(<OnPlayed>d__10))]
		public override IEnumerator OnPlayed(int cardCost, PlayableCard card)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnPlayed>d__10(0)
			{
				cardCost = cardCost
			};
		}
	}
}
namespace InscryptionCommunityPatch.Sequencers
{
	[HarmonyPatch]
	internal class BuyPeltsSmallTags
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(BuyPeltsSequencer), "AddPricetagToCard")]
		private static void ReducePricetagSize(SelectableCard card)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			if (!PatchPlugin.configSmallPricetags.Value && !PatchPlugin.configMovePricetags.Value)
			{
				return;
			}
			Transform val = ((Component)card).transform.Find("pricetag");
			if (!((Object)(object)val == (Object)null))
			{
				if (PatchPlugin.configSmallPricetags.Value)
				{
					val.localScale = new Vector3(0.75f, 1f, 0.75f);
				}
				if (PatchPlugin.configMovePricetags.Value)
				{
					val.localPosition = new Vector3(val.localPosition.x * -1f, val.localPosition.y, val.localPosition.z);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class ChoiceNodePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CardSingleChoicesSequencer), "GetCardbackTexture")]
		private static void CardSingleChoicesSequencer_GetCardbackTexture(ref Texture __result, CardChoice choice)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			ResourceType resourceType = choice.resourceType;
			if ((int)resourceType != 3)
			{
				if ((int)resourceType == 4)
				{
					__result = (Texture)(object)TextureHelper.GetImageAsTexture(MoxTextureName(choice.resourceAmount), typeof(ChoiceNodePatch).Assembly, (FilterMode)0);
				}
			}
			else
			{
				__result = (Texture)(object)TextureHelper.GetImageAsTexture("energyCost.png", typeof(ChoiceNodePatch).Assembly, (FilterMode)0);
			}
		}

		public static string MoxTextureName(int index)
		{
			return "moxCost" + index switch
			{
				1 => "Green", 
				2 => "Orange", 
				3 => "Blue", 
				_ => "", 
			} + ".png";
		}
	}
	[HarmonyPatch]
	internal class CardStatBoostSequencerPatch
	{
		[CompilerGenerated]
		private sealed class <NewStatBoostSequence>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardStatBoostSequencer instance;

			public bool attackMod;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Expected O, but got Unknown
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (instance.GetValidCards(attackMod).Count == 0)
					{
						if (PatchPlugin.configFullDebug.Value)
						{
							PatchPlugin.Logger.LogDebug((object)"Player has no cards that can be boosted at the campfire.");
						}
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 1;
						return true;
					}
					goto IL_00d4;
				case 1:
					<>1__state = -1;
					<>2__current = Singleton<TextDisplayer>.Instance.ShowUntilInput("You have no creatures to warm.", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					goto IL_00d4;
				case 4:
					{
						<>1__state = -1;
						return false;
					}
					IL_00d4:
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 4;
					return true;
				}
			}

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

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

		private const string name_DisplayClass = "DiskCardGame.CardStatBoostSequencer+<>c__DisplayClass12_0 <>8__1";

		private const string name_AttackMod = "System.Boolean attackMod";

		private const string name_ViewInstance = "DiskCardGame.ViewManager get_Instance()";

		private const string name_GetValidCards = "System.Collections.Generic.List`1[DiskCardGame.CardInfo] GetValidCards(Boolean)";

		private const string name_DestroyCard = "Void DestroyCard()";

		private static MethodBase TargetMethod()
		{
			return AccessTools.EnumeratorMoveNext((MethodBase)AccessTools.Method(typeof(CardStatBoostSequencer), "StatBoostSequence", (Type[])null, (Type[])null));
		}

		private static object Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Expected O, but got Unknown
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Expected O, but got Unknown
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Expected O, but got Unknown
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Expected O, but got Unknown
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Expected O, but got Unknown
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = -1;
			int num2 = -1;
			object obj = null;
			object obj2 = null;
			object obj3 = null;
			object obj4 = null;
			CodeInstruction item = null;
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldfld && list[i].operand.ToString() == "DiskCardGame.CardStatBoostSequencer+<>c__DisplayClass12_0 <>8__1" && obj == null)
				{
					obj = list[i].operand;
				}
				else if (list[i].opcode == OpCodes.Ldfld && list[i].operand.ToString() == "System.Boolean attackMod" && obj2 == null)
				{
					obj2 = list[i].operand;
				}
				else if (list[i].opcode == OpCodes.Callvirt && list[i].operand.ToString() == "System.Collections.Generic.List`1[DiskCardGame.CardInfo] GetValidCards(Boolean)" && obj3 == null)
				{
					obj3 = list[i].operand;
					obj4 = list[i + 1].operand;
				}
				else if (list[i].opcode == OpCodes.Ldc_I4_7)
				{
					num = i - 6;
				}
				else if (list[i].opcode == OpCodes.Call && list[i].operand.ToString() == "DiskCardGame.ViewManager get_Instance()" && list[i + 1].opcode == OpCodes.Ldc_I4_1 && list[i + 3].opcode == OpCodes.Ldc_I4_0)
				{
					num2 = i + 6;
				}
				else if (list[i].opcode == OpCodes.Callvirt && list[i].operand.ToString() == "Void DestroyCard()")
				{
					item = new CodeInstruction(list[i + 1]);
				}
				if (num != -1 && num2 != -1)
				{
					MethodBase methodBase = AccessTools.Method(typeof(CardStatBoostSequencerPatch), "NewStatBoostSequence", new Type[2]
					{
						typeof(CardStatBoostSequencer),
						typeof(bool)
					}, (Type[])null);
					list.RemoveAt(num2);
					list.RemoveAt(num2);
					list.Insert(num2, new CodeInstruction(OpCodes.Ldloc_1, (object)null));
					list.Insert(num2 + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(num2 + 2, new CodeInstruction(OpCodes.Ldfld, obj));
					list.Insert(num2 + 3, new CodeInstruction(OpCodes.Ldfld, obj2));
					list.Insert(num2 + 4, new CodeInstruction(OpCodes.Callvirt, (object)methodBase));
					list.Insert(num, new CodeInstruction(OpCodes.Ldloc_1, (object)null));
					list.Insert(num + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(num + 2, new CodeInstruction(OpCodes.Ldfld, obj));
					list.Insert(num + 3, new CodeInstruction(OpCodes.Ldfld, obj2));
					list.Insert(num + 4, new CodeInstruction(OpCodes.Callvirt, obj3));
					list.Insert(num + 5, new CodeInstruction(OpCodes.Callvirt, obj4));
					list.Insert(num + 6, item);
					list[num + 6].opcode = OpCodes.Brfalse_S;
					break;
				}
			}
			return list;
		}

		[IteratorStateMachine(typeof(<NewStatBoostSequence>d__7))]
		private static IEnumerator NewStatBoostSequence(CardStatBoostSequencer instance, bool attackMod)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <NewStatBoostSequence>d__7(0)
			{
				instance = instance,
				attackMod = attackMod
			};
		}
	}
	[HarmonyPatch]
	internal class LeshyResetRedEyes
	{
		[CompilerGenerated]
		private sealed class <ResetLeshyEyes>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TurnManager __instance;

			public IEnumerator enumerator;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					if (!PatchPlugin.configResetEyes.Value || !SaveManager.SaveFile.IsPart1 || (Object)(object)__instance.opponent == (Object)null)
					{
						<>2__current = enumerator;
						<>1__state = 1;
						return true;
					}
					bool flag = false;
					Opponent opponent = __instance.opponent;
					ProspectorBossOpponent val = (ProspectorBossOpponent)(object)((opponent is ProspectorBossOpponent) ? opponent : null);
					if (val != null)
					{
						flag = ((Part1BossOpponent)val).HasGrizzlyGlitchPhase(int.MinValue);
					}
					else
					{
						Opponent opponent2 = __instance.opponent;
						AnglerBossOpponent val2 = (AnglerBossOpponent)(object)((opponent2 is AnglerBossOpponent) ? opponent2 : null);
						if (val2 != null)
						{
							flag = ((Part1BossOpponent)val2).HasGrizzlyGlitchPhase(0);
						}
						else
						{
							Opponent opponent3 = __instance.opponent;
							TrapperTraderBossOpponent val3 = (TrapperTraderBossOpponent)(object)((opponent3 is TrapperTraderBossOpponent) ? opponent3 : null);
							if (val3 != null)
							{
								flag = ((Part1BossOpponent)val3).HasGrizzlyGlitchPhase(1);
							}
						}
					}
					if (flag)
					{
						LeshyAnimationController instance = LeshyAnimationController.Instance;
						if (instance != null)
						{
							instance.ResetEyesTexture();
						}
					}
					<>2__current = enumerator;
					<>1__state = 2;
					return true;
				}
				case 1:
					<>1__state = -1;
					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();
			}
		}

		[IteratorStateMachine(typeof(<ResetLeshyEyes>d__0))]
		[HarmonyPostfix]
		[HarmonyPatch(typeof(TurnManager), "CleanupPhase")]
		private static IEnumerator ResetLeshyEyes(IEnumerator enumerator, TurnManager __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResetLeshyEyes>d__0(0)
			{
				enumerator = enumerator,
				__instance = __instance
			};
		}
	}
	[HarmonyPatch]
	internal class PackRatNodeBackgroundFix
	{
		[HarmonyTranspiler]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static IEnumerable<CodeInstruction> FixRareBackground(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (!(list[i].opcode == OpCodes.Callvirt) || !(list[i].operand.ToString() == "DiskCardGame.SelectableCard GetComponent[SelectableCard]()"))
				{
					continue;
				}
				int num = i - 3;
				for (int j = i + 1; j < list.Count; j++)
				{
					if (list[j].opcode == OpCodes.Stloc_2)
					{
						list.RemoveRange(num, j - 3 - num);
						break;
					}
				}
				break;
			}
			return list;
		}
	}
	[HarmonyPatch]
	public class TradeableTalkingCardFix
	{
		[CompilerGenerated]
		private sealed class <TradeForTalkingCard>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayableCard card;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = Singleton<PlayerHand>.Instance.AddCardToHand(CardSpawner.SpawnPlayableCard(((Card)card).Info), new Vector3(0f, 0.5f, -3f), 0f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Singleton<ViewManager>.Instance.SwitchToView((View)6, false, false);
					Singleton<ViewManager>.Instance.Controller.SwitchToControlMode((ControlMode)18, false);
					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();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TradeCardsForPelts), "OnTradableSelected")]
		private static bool OnTalkingCardSelected(TradeCardsForPelts __instance, HighlightedInteractable slot, PlayableCard card)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_0125: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)card != (Object)null && (Object)(object)((Component)card).GetComponent<TalkingCard>() == (Object)null)
			{
				return true;
			}
			if (__instance.PeltInHand())
			{
				AscensionStatsData.TryIncrementStat((Type)8);
				PlayableCard pelt = Singleton<PlayerHand>.Instance.CardsInHand.Find((PlayableCard x) => ((Card)x).Info.HasTrait((Trait)13));
				Singleton<PlayerHand>.Instance.RemoveCardFromHand(pelt);
				((InteractableBase)pelt).SetEnabled(false);
				((Card)pelt).Anim.SetTrigger("fly_off");
				Tween.Position(((Component)pelt).transform, ((Component)pelt).transform.position + new Vector3(0f, 3f, 5f), 0.4f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)delegate
				{
					Object.Destroy((Object)(object)((Component)pelt).gameObject);
				}, true);
				card.UnassignFromSlot();
				Tween.Position(((Component)card).transform, ((Component)card).transform.position + new Vector3(0f, 0.25f, -5f), 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)delegate
				{
					Object.Destroy((Object)(object)((Component)card).gameObject);
				}, true);
				((MonoBehaviour)__instance).StartCoroutine(TradeForTalkingCard(card));
				((InteractableBase)slot).ClearDelegates();
				slot.HighlightCursorType = (CursorType)0;
			}
			return false;
		}

		[IteratorStateMachine(typeof(<TradeForTalkingCard>d__1))]
		public static IEnumerator TradeForTalkingCard(PlayableCard card)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TradeForTalkingCard>d__1(0)
			{
				card = card
			};
		}
	}
}
namespace InscryptionCommunityPatch.ResourceManagers
{
	[HarmonyPatch]
	public static class EnergyDrone
	{
		public class EnergyConfigInfo
		{
			public bool ConfigEnergy { get; set; } = PoolHasEnergy || PatchPlugin.configEnergy.Value;


			public bool ConfigShowDrone { get; set; } = PoolHasEnergy || PatchPlugin.configDrone.Value;


			public bool ConfigDroneMox { get; set; } = PoolHasGems || PatchPlugin.configDroneMox.Value;


			public bool ConfigMox { get; set; } = PoolHasGems || PatchPlugin.configMox.Value;


			public bool ConfigDefaultDrone { get; set; } = PatchPlugin.configDefaultDrone.Value;


			public bool ConfigDrone
			{
				get
				{
					if (!ConfigShowDrone)
					{
						return ConfigDroneMox;
					}
					return true;
				}
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (PatchPlugin.configFullDebug.Value)
					{
						PatchPlugin.Logger.LogDebug((object)$"Awaking ResourceDrone, instance exists? {(Object)(object)Singleton<ResourceDrone>.Instance != (Object)null}.");
					}
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Singleton<ResourceDrone>.Instance.Awake();
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					Singleton<ResourceDrone>.Instance.AttachGemsModule();
					if (EnergyConfig.ConfigDefaultDrone)
					{
						((Component)Singleton<ResourceDrone>.Instance).gameObject.transform.localPosition = Singleton<ResourceDrone>.Instance.boardPosition + Vector3.up * 5f;
					}
					else
					{
						AttachDroneToScale();
					}
					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 <ResourcesManager_ShowAddEnergy>d__25 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ResourcesManager __instance;

			public int amount;

			public IEnumerator result;

			private int <i>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (__instance is Part1ResourcesManager && EnergyConfig.ConfigDrone && (Object)(object)Singleton<ResourceDrone>.m_Instance != (Object)null)
					{
						<i>5__2 = __instance.PlayerEnergy - amount;
						goto IL_00a7;
					}
					goto IL_00ba;
				case 1:
					<>1__state = -1;
					<i>5__2++;
					goto IL_00a7;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_00a7:
					if (<i>5__2 < __instance.PlayerEnergy)
					{
						Singleton<ResourceDrone>.Instance.SetCellOn(<i>5__2, true, false);
						<>2__current = (object)new WaitForSeconds(0.05f);
						<>1__state = 1;
						return true;
					}
					goto IL_00ba;
					IL_00ba:
					<>2__current = result;
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public ResourcesManager __instance;

			public GemType gem;

			public IEnumerator result;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (__instance is Part1ResourcesManager && EnergyConfig.ConfigDroneMox)
					{
						__instance.SetGemOnImmediate(gem, true);
						<>2__current = (object)new WaitForSeconds(0.05f);
						<>1__state = 1;
						return true;
					}
					goto IL_006d;
				case 1:
					<>1__state = -1;
					goto IL_006d;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_006d:
					<>2__current = result;
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public ResourcesManager __instance;

			public IEnumerator result;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (__instance is Part1ResourcesManager && EnergyConfig.ConfigDrone && (Object)(object)Singleton<ResourceDrone>.m_Instance != (Object)null)
					{
						int num = __instance.PlayerMaxEnergy - 1;
						Singleton<ResourceDrone>.Instance.OpenCell(num);
						<>2__current = (object)new WaitForSeconds(0.4f);
						<>1__state = 1;
						return true;
					}
					goto IL_0081;
				case 1:
					<>1__state = -1;
					goto IL_0081;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_0081:
					<>2__current = result;
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public ResourcesManager __instance;

			public GemType gem;

			public IEnumerator result;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (__instance is Part1ResourcesManager && EnergyConfig.ConfigDroneMox)
					{
						__instance.SetGemOnImmediate(gem, false);
						<>2__current = (object)new WaitForSeconds(0.05f);
						<>1__state = 1;
						return true;
					}
					goto IL_006d;
				case 1:
					<>1__state = -1;
					goto IL_006d;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_006d:
					<>2__current = result;
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public ResourcesManager __instance;

			public int amount;

			public IEnumerator result;

			private int <i>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Expected O, but got Unknown
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (__instance is Part1ResourcesManager && EnergyConfig.ConfigDrone && (Object)(object)Singleton<ResourceDrone>.m_Instance != (Object)null)
					{
						<i>5__2 = __instance.PlayerEnergy + amount - 1;
						goto IL_0105;
					}
					goto IL_011b;
				case 1:
					<>1__state = -1;
					<i>5__2--;
					goto IL_0105;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_0105:
					if (<i>5__2 >= __instance.PlayerEnergy)
					{
						AudioController.Instance.PlaySound3D("crushBlip3", (MixerGroup)4, ((Component)__instance).transform.position, 0.4f, 0f, new Pitch(0.9f + (float)(__instance.PlayerEnergy + <i>5__2) * 0.05f), (Repetition)null, (Randomization)null, (Distortion)null, false);
						Singleton<ResourceDrone>.Instance.SetCellOn(<i>5__2, false, false);
						<>2__current = (object)new WaitForSeconds(0.05f);
						<>1__state = 1;
						return true;
					}
					goto IL_011b;
					IL_011b:
					<>2__current = result;
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public IEnumerator sequence;

			public bool playerUpkeep;

			private bool <showEnergyModule>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Expected O, but got Unknown
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = sequence;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!playerUpkeep || !CurrentSceneCanHaveEnergyDrone || !EnergyConfig.ConfigEnergy)
					{
						break;
					}
					<showEnergyModule>5__2 = !Singleton<ResourcesManager>.Instance.EnergyAtMax || Singleton<ResourcesManager>.Instance.PlayerEnergy < Singleton<ResourcesManager>.Instance.PlayerMaxEnergy;
					if (<showEnergyModule>5__2)
					{
						Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 2;
						return true;
					}
					goto IL_00ce;
				case 2:
					<>1__state = -1;
					goto IL_00ce;
				case 3:
					<>1__state = -1;
					<>2__current = Singleton<ResourcesManager>.Instance.RefreshEnergy();
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					if (<showEnergyModule>5__2)
					{
						<>2__current = (object)new WaitForSeconds(0.25f);
						<>1__state = 5;
						return true;
					}
					break;
				case 5:
					{
						<>1__state = -1;
						Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
						break;
					}
					IL_00ce:
					<>2__current = Singleton<ResourcesManager>.Instance.AddMaxEnergy(1);
					<>1__state = 3;
					return true;
				}
				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();
			}
		}

		public static Dictionary<CardTemple, EnergyConfigInfo> ZoneConfigs = new Dictionary<CardTemple, EnergyConfigInfo>
		{
			{
				(CardTemple)0,
				new EnergyConfigInfo()
			},
			{
				(CardTemple)1,
				new EnergyConfigInfo()
			},
			{
				(CardTemple)2,
				new EnergyConfigInfo()
			},
			{
				(CardTemple)3,
				new EnergyConfigInfo()
			}
		};

		public static bool CurrentSceneCanHaveEnergyDrone
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				if (string.IsNullOrEmpty(((Scene)(ref activeScene)).name))
				{
					return false;
				}
				return SceneCanHaveEnergyDrone(((Scene)(ref activeScene)).name);
			}
		}

		private static EnergyConfigInfo EnergyConfig => GetEnergyConfig();

		public static bool PoolHasEnergy { get; private set; }

		public static bool PoolHasGems { get; private set; }

		public static bool SceneCanHaveEnergyDrone(string sceneName)
		{
			string text = sceneName.ToLowerInvariant();
			if (text.Contains("part1"))
			{
				if (!text.Contains("sanctum"))
				{
					return !text.Contains("finale");
				}
				return false;
			}
			if (!text.Contains("magnificus"))
			{
				return text.Contains("grimora");
			}
			return true;
		}

		public static EnergyConfigInfo GetEnergyConfig()
		{
			if (SaveManager.SaveFile.IsPart3)
			{
				return ZoneConfigs[(CardTemple)2];
			}
			if (SaveManager.SaveFile.IsGrimora)
			{
				return ZoneConfigs[(CardTemple)1];
			}
			if (SaveManager.SaveFile.IsMagnificus)
			{
				return ZoneConfigs[(CardTemple)3];
			}
			return ZoneConfigs[(CardTemple)0];
		}

		private static bool CardIsVisible(this CardInfo info, CardTemple targetTemple)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (info.temple != targetTemple)
			{
				return false;
			}
			return CardExtensions.HasAnyOfCardMetaCategories(info, (CardMetaCategory[])(object)new CardMetaCategory[3]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1,
				(CardMetaCategory)3
			});
		}

		internal static void TryEnableEnergy(string sceneName)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (SceneCanHaveEnergyDrone(sceneName))
			{
				CardTemple targetTemple = (CardTemple)(SaveManager.SaveFile.IsGrimora ? 1 : (SaveManager.SaveFile.IsMagnificus ? 3 : 0));
				PoolHasEnergy = CardManager.AllCardsCopy.Any((CardInfo ci) => ci.energyCost > 0 && ci.CardIsVisible(targetTemple));
				PoolHasGems = CardManager.AllCardsCopy.Any((CardInfo ci) => ci.gemsCost.Count > 0 && ci.CardIsVisible(targetTemple));
				PatchPlugin.Logger.LogDebug((object)$"Card pool has Energy cards? {PoolHasEnergy}. Card pool has Gem cards? {PoolHasGems}.");
				Object.Instantiate<ResourceDrone>(Resources.Load<ResourceDrone>("prefabs/cardbattle/ResourceModules"));
				if (EnergyConfig.ConfigDrone)
				{
					((MonoBehaviour)PatchPlugin.Instance).StartCoroutine(AwakeDrone());
				}
			}
		}

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

		private static void AttachDroneToScale()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				((Behaviour)((Component)((Component)Singleton<ResourceDrone>.Instance).transform.Find("Anim")).gameObject.GetComponent<Animator>()).enabled = false;
				((Component)((Component)Singleton<ResourceDrone>.Instance).transform.Find("Anim/Module-Energy/Propellers")).gameObject.SetActive(false);
				Transform val = ((Component)Singleton<LifeManager>.Instance.Scales3D).gameObject.transform.Find("Scale");
				((Component)Singleton<ResourceDrone>.Instance).transform.SetParent(val);
				((Component)Singleton<ResourceDrone>.Instance).transform.localEulerAngles = Vector3.zero;
				((Component)Singleton<ResourceDrone>.Instance).transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
				((Component)Singleton<ResourceDrone>.Instance).transform.localPosition = new Vector3(0.02f, -0.2f, 2f);
				Singleton<ResourceDrone>.Instance.boardPosition = val.position;
			}
			catch
			{
				PatchPlugin.Logger.LogError((object)"Couldn't attach ResourceDrone to LifeManager.Scale3D!");
			}
		}

		[HarmonyPatch(typeof(ResourceDrone), "SetOnBoard")]
		[HarmonyPrefix]
		private static bool Act1ResourceDrone_SetOnBoard(ResourceDrone __instance, bool onBoard, bool immediate)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			if (!CurrentSceneCanHaveEnergyDrone)
			{
				return true;
			}
			((Component)__instance.Gems).gameObject.SetActive(EnergyConfig.ConfigDroneMox);
			if (onBoard)
			{
				((Component)__instance).gameObject.SetActive(true);
				__instance.SetAllCellsOn(false);
			}
			if (EnergyConfig.ConfigDefaultDrone)
			{
				Vector3 val = __instance.boardPosition + (onBoard ? Vector3.zero : (Vector3.up * 5f));
				if (immediate)
				{
					((Component)__instance).gameObject.transform.position = val;
					if (!onBoard)
					{
						((Component)__instance).gameObject.SetActive(false);
					}
				}
				else
				{
					Tween.Position(((Component)__instance).gameObject.transform, val, 1.5f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)delegate
					{
						//IL_0028: 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_0037: Unknown result type (might be due to invalid IL or missing references)
						if (onBoard)
						{
							Tween.Shake(((Component)__instance).gameObject.transform, ((Component)__instance).gameObject.transform.localPosition, Vector3.one * 0.15f, 0.15f, 0f, (LoopType)0, (Action)null, (Action)null, true);
						}
						((Component)__instance).gameObject.SetActive(onBoard);
					}, true);
				}
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ResourceDrone), "UpdateCellAndGemColors")]
		private static bool DisableUpdateWhenNull()
		{
			if ((Object)(object)Singleton<ResourcesManager>.m_Instance == (Object)null)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Part1ResourcesManager), "CleanUp")]
		[HarmonyPrefix]
		private static void Part1ResourcesManager_CleanUp(Part1ResourcesManager __instance)
		{
			if (EnergyConfig.ConfigEnergy)
			{
				((ResourcesManager)__instance).PlayerEnergy = 0;
				((ResourcesManager)__instance).PlayerMaxEnergy = 0;
			}
			if (EnergyConfig.ConfigDrone && (Object)(object)Singleton<ResourceDrone>.m_Instance != (Object)null)
			{
				Singleton<ResourceDrone>.Instance.CloseAllCells(false);
				Singleton<ResourceDrone>.Instance.SetOnBoard(false, false);
				if (EnergyConfig.ConfigDroneMox)
				{
					GemsModule gems = Singleton<ResourceDrone>.Instance.Gems;
					if (gems != null)
					{
						gems.SetAllGemsOn(false, false);
					}
				}
			}
			if (EnergyConfig.ConfigMox)
			{
				((ResourcesManager)__instance).gems.Clear();
			}
		}

		[HarmonyPatch(typeof(ResourcesManager), "Setup")]
		[HarmonyPrefix]
		private static void ResourcesManager_Setup(ResourcesManager __instance)
		{
			if (__instance is Part1ResourcesManager && EnergyConfig.ConfigDrone && (Object)(object)Singleton<ResourceDrone>.m_Instance != (Object)null)
			{
				Singleton<ResourceDrone>.Instance.SetOnBoard(true, false);
				if (EnergyConfig.ConfigDroneMox)
				{
					PatchPlugin.Logger.LogDebug((object)"Setting up extra drone resources.");
					Singleton<ResourceDrone>.Instance.Gems.SetAllGemsOn(false, true);
				}
			}
		}

		[IteratorStateMachine(typeof(<ResourcesManager_ShowAddMaxEnergy>d__24))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowAddMaxEnergy")]
		[HarmonyPostfix]
		private static IEnumerator ResourcesManager_ShowAddMaxEnergy(IEnumerator result, ResourcesManager __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResourcesManager_ShowAddMaxEnergy>d__24(0)
			{
				result = result,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<ResourcesManager_ShowAddEnergy>d__25))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowAddEnergy")]
		[HarmonyPostfix]
		private static IEnumerator ResourcesManager_ShowAddEnergy(IEnumerator result, int amount, ResourcesManager __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResourcesManager_ShowAddEnergy>d__25(0)
			{
				result = result,
				amount = amount,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<ResourcesManager_ShowSpendEnergy>d__26))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowSpendEnergy")]
		[HarmonyPostfix]
		private static IEnumerator ResourcesManager_ShowSpendEnergy(IEnumerator result, int amount, ResourcesManager __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResourcesManager_ShowSpendEnergy>d__26(0)
			{
				result = result,
				amount = amount,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<ResourcesManager_ShowAddGem>d__27))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowAddGem")]
		[HarmonyPostfix]
		private static IEnumerator ResourcesManager_ShowAddGem(IEnumerator result, GemType gem, ResourcesManager __instance)
		{
			//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 <ResourcesManager_ShowAddGem>d__27(0)
			{
				result = result,
				gem = gem,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<ResourcesManager_ShowLoseGem>d__28))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowLoseGem")]
		[HarmonyPostfix]
		private static IEnumerator ResourcesManager_ShowLoseGem(IEnumerator result, GemType gem, ResourcesManager __instance)
		{
			//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 <ResourcesManager_ShowLoseGem>d__28(0)
			{
				result = result,
				gem = gem,
				__instance = __instance
			};
		}

		[HarmonyPatch(typeof(ResourcesManager), "SetGemOnImmediate")]
		[HarmonyPostfix]
		private static void ResourcesManager_SetGemOnImmediate(GemType gem, bool on, ResourcesManager __instance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (__instance is Part1ResourcesManager && (Object)(object)Singleton<ResourceDrone>.m_Instance != (Object)null)
			{
				GemsModule gems = Singleton<ResourceDrone>.Instance.Gems;
				if (gems != null)
				{
					gems.SetGemOn(gem, on, false);
				}
			}
		}

		[IteratorStateMachine(typeof(<TurnManager_UpkeepPhase>d__30))]
		[HarmonyPatch(typeof(TurnManager), "DoUpkeepPhase")]
		[HarmonyPostfix]
		private static IEnumerator TurnManager_UpkeepPhase(IEnumerator sequence, bool playerUpkeep)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TurnManager_UpkeepPhase>d__30(0)
			{
				sequence = sequence,
				playerUpkeep = playerUpkeep
			};
		}
	}
	[HarmonyPatch]
	public static class Act3BonesDisplayer
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass25_0
		{
			public GameObject bolt;

			internal void <ShowAddBones_Act3>b__0()
			{
				GlitchOutBolt(bolt);
			}
		}

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

			private object <>2__current;

			public int amount;

			public CardSlot slot;

			public IEnumerator sequence;

			private int <oldBones>5__2;

			private int <i>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Expected O, but got Unknown
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Expected O, but got Unknown
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c9: Expected O, but got Unknown
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					PatchPlugin.Logger.LogDebug((object)$"Adding {amount} bones");
					if ((Object)(object)BonesTVScreen != (Object)null && amount > 0)
					{
						<oldBones>5__2 = Singleton<ResourcesManager>.Instance.PlayerBones - amount;
						<i>5__3 = <oldBones>5__2;
						goto IL_01e9;
					}
					<>2__current = sequence;
					<>1__state = 3;
					return true;
				case 1:
					<>1__state = -1;
					AudioController.Instance.PlaySound3D((Random.value > 0.5f) ? "metal_drop#3" : "metal_object_short#2", (MixerGroup)4, ((Component)slot).transform.position, 1f, 0f, new Pitch((Variation)1), (Repetition)null, (Randomization)null, (Distortion)null, false);
					goto IL_0151;
				case 2:
					<>1__state = -1;
					<i>5__3++;
					goto IL_01e9;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_0151:
					DisplayBones(<i>5__3);
					if ((Object)(object)slot == (Object)null)
					{
						AudioController.Instance.PlaySound3D("factory_chest_open", (MixerGroup)4, BonesTVScreen.transform.position, 1f, 0f, new Pitch(0.95f + (float)<i>5__3 * 0.01f), (Repetition)null, (Randomization)null, (Distortion)null, false).spatialBlend = 0.25f;
					}
					<>2__current = (object)new WaitForSeconds(0.05f);
					<>1__state = 2;
					return true;
					IL_01e9:
					if (<i>5__3 < <oldBones>5__2 + amount)
					{
						if ((Object)(object)slot != (Object)null)
						{
							CustomCoroutine.WaitThenExecute(1.25f, (Action)new <>c__DisplayClass25_0
							{
								bolt = WeightUtil.SpawnWeight(((Component)slot).transform, ((Component)slot).transform.position + Vector3.up, false, (GameObject)null)
							}.<ShowAddBones_Act3>b__0, false);
							<>2__current = (object)new WaitForSeconds(0.1f);
							<>1__state = 1;
							return true;
						}
						goto IL_0151;
					}
					DisplayBones(Singleton<ResourcesManager>.Instance.PlayerBones);
					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 <ShowSpendBones_Act3>d__26 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int amount;

			public IEnumerator sequence;

			private int <visualizedDrop>5__2;

			private int <oldBones>5__3;

			private int <i>5__4;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Expected O, but got Unknown
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					PatchPlugin.Logger.LogDebug((object)$"Spending {amount} bones");
					if ((Object)(object)BonesTVScreen != (Object)null && amount > 0)
					{
						<visualizedDrop>5__2 = Mathf.Min(20, amount);
						<oldBones>5__3 = Singleton<ResourcesManager>.Instance.PlayerBones + amount;
						<i>5__4 = <oldBones>5__3;
						goto IL_0122;
					}
					<>2__current = sequence;
					<>1__state = 2;
					return true;
				case 1:
					<>1__state = -1;
					<i>5__4--;
					goto IL_0122;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_0122:
					if (<i>5__4 > <oldBones>5__3 - <visualizedDrop>5__2)
					{
						DisplayBones(<i>5__4);
						AudioController.Instance.PlaySound3D("factory_chest_open", (MixerGroup)4, BonesTVScreen.transform.position, 0.6f, 0f, new Pitch(0.95f + (float)<i>5__4 * 0.01f), (Repetition)null, (Randomization)null, (Distortion)null, false).spatialBlend = 0.25f;
						<>2__current = (object)new WaitForSeconds(0.05f);
						<>1__state = 1;
						return true;
					}
					DisplayBones(Singleton<ResourcesManager>.Instance.PlayerBones);
					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();
			}
		}

		private static ConditionalWeakTable<ResourceDrone, GameObject> _boneTvScreen = new ConditionalWeakTable<ResourceDrone, GameObject>();

		private static ConditionalWeakTable<ResourceDrone, SpriteRenderer> _boneCountRenderer = new ConditionalWeakTable<ResourceDrone, SpriteRenderer>();

		private static Material _holoRefMaterial;

		public static bool ForceBonesDisplayActive { get; set; } = false;


		public static bool DisplayAct3Bones
		{
			get
			{
				if (!ForceBonesDisplayActive && !PoolHasBones)
				{
					return PatchPlugin.configAct3Bones.Value;
				}
				return true;
			}
		}

		public static bool PoolHasBones => CardManager.AllCardsCopy.Any((CardInfo ci) => ci.BonesCost > 0 && ci.CardIsVisible());

		public static bool SceneCanHaveBonesDisplayer
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				if (string.IsNullOrEmpty(((Scene)(ref activeScene)).name))
				{
					return false;
				}
				return ((Scene)(ref activeScene)).name.ToLowerInvariant().Contains("part3");
			}
		}

		private static GameObject BonesTVScreen
		{
			get
			{
				if (_boneTvScreen.TryGetValue(Singleton<ResourceDrone>.Instance, out var value))
				{
					return value;
				}
				return null;
			}
			set
			{
				_boneTvScreen.Add(Singleton<ResourceDrone>.Instance, value);
			}
		}

		private static SpriteRenderer BonesCountRenderer
		{
			get
			{
				if (_boneCountRenderer.TryGetValue(Singleton<ResourceDrone>.Instance, out var value))
				{
					return value;
				}
				return null;
			}
			set
			{
				_boneCountRenderer.Add(Singleton<ResourceDrone>.Instance, value);
			}
		}

		private static Material HoloRefMaterial
		{
			get
			{
				if (_holoRefMaterial == null)
				{
					_holoRefMaterial = CardLoader.GetCardByName("BridgeRailing").holoPortraitPrefab.GetComponentInChildren<Renderer>().material;
				}
				return _holoRefMaterial;
			}
		}

		private static bool CardIsVisible(this CardInfo info)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)info.temple != 2)
			{
				return false;
			}
			return info.metaCategories.Exists((CardMetaCategory x) => (int)x == 0 || (int)x == 2 || (int)x == 3);
		}

		private static GameObject MakeBoneTokenPrefab(Transform parent)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(ResourceBank.Get<GameObject>("Prefabs/CardBattle/CardBattle").GetComponentInChildren<Part1ResourcesManager>().boneTokenPrefab, parent);
			val.transform.position = parent.position + Vector3.up * 0.25f;
			Object.Destroy((Object)(object)val.GetComponent<BoneTokenInteractable>());
			Rigidbody component = val.GetComponent<Rigidbody>();
			component.angularVelocity = new Vector3(0f, 30f, 0f);
			component.maxAngularVelocity = 30f;
			component.inertiaTensor = new Vector3(0.2f, 10f, 0.2f);
			Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Material[] materials = componentsInChildren[i].materials;
				foreach (Material val2 in materials)
				{
					val2.shader = Shader.Find("SFHologram/HologramShader");
					val2.CopyPropertiesFromMaterial(HoloRefMaterial);
					val2.SetColor("_Color", Color.white);
					if (val2.HasProperty("_EmissionColor"))
					{
						val2.SetColor("_EmissionColor", Color.white);
					}
					if (val2.HasProperty("_MainColor"))
					{
						val2.SetColor("_MainColor", Color.white);
					}
					if (val2.HasProperty("_RimColor"))
					{
						val2.SetColor("_RimColor", Color.white);
					}
				}
			}
			return val;
		}

		private static void DisplayBones(int bones)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)BonesCountRenderer != (Object)null)
			{
				Texture2D item = Part3CardCostRender.GetIconifiedCostTexture(Part3CardCostRender.BoneCostIcon, bones, forceDigitDisplay: true).Item2;
				BonesCountRenderer.sprite = Sprite.Create(item, new Rect(0f, 0f, (float)((Texture)item).width, (float)((Texture)item).height), new Vector2(0.5f, 0.5f));
			}
		}

		private static void GlitchOutBolt(GameObject bolt)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			AudioController.Instance.PlaySound3D("factory_chest_open", (MixerGroup)4, bolt.transform.position, 1f, 0f, new Pitch((Variation)1), (Repetition)null, (Randomization)null, (Distortion)null, false).spatialBlend = 0.25f;
			GlitchOutAssetEffect.TryLoad3DMaterial();
			Renderer[] componentsInChildren = bolt.GetComponentsInChildren<Renderer>();
			foreach (Renderer obj in componentsInChildren)
			{
				obj.material = GlitchOutAssetEffect.glitch3DMaterial;
				obj.material.SetColor("_ASEOutlineColor", Color.white);
			}
			Tween.Shake(bolt.transform, bolt.transform.localPosition, Vector3.one * 0.2f, 0.1f, 0f, (LoopType)1, (Action)null, (Action)null, false);
			CustomCoroutine.WaitThenExecute(0.2f, (Action)delegate
			{
				if ((Object)(object)bolt != (Object)null)
				{
					Object.Destroy((Object)(object)bolt.gameObject);
				}
			}, false);
		}

		[IteratorStateMachine(typeof(<ShowAddBones_Act3>d__25))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowAddBones")]
		[HarmonyPostfix]
		private static IEnumerator ShowAddBones_Act3(IEnumerator sequence, int amount, CardSlot slot)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShowAddBones_Act3>d__25(0)
			{
				sequence = sequence,
				amount = amount,
				slot = slot
			};
		}

		[IteratorStateMachine(typeof(<ShowSpendBones_Act3>d__26))]
		[HarmonyPatch(typeof(ResourcesManager), "ShowSpendBones")]
		[HarmonyPostfix]
		private static IEnumerator ShowSpendBones_Act3(IEnumerator sequence, int amount)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShowSpendBones_Act3>d__26(0)
			{
				sequence = sequence,
				amount = amount
			};
		}

		[HarmonyPatch(typeof(ResourceDrone), "Awake")]
		[HarmonyPostfix]
		private static void AttachBonesTVScreen(ref ResourceDrone __instance)
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			if (SceneCanHaveBonesDisplayer && DisplayAct3Bones)
			{
				BonesTVScreen = Object.Instantiate<GameObject>(((Component)Singleton<SpecialNodeHandler>.Instance.buildACardSequencer.screen).gameObject, ((Component)__instance).gameObject.transform.Find("Anim"));
				Object.Destroy((Object)(object)((Component)BonesTVScreen.transform.Find("Anim/ScreenInteractables")).gameObject);
				Object.Destroy((Object)(object)((Component)BonesTVScreen.transform.Find("RenderCamera/Content/BuildACardInterface")).gameObject);
				((Component)BonesTVScreen.transform.Find("Anim/CableStart_1")).gameObject.SetActive(false);
				((Component)BonesTVScreen.transform.Find("Anim/CableStart_2")).gameObject.SetActive(false);
				((Component)BonesTVScreen.transform.Find("Anim/CableStart_3")).gameObject.SetActive(false);
				BonesTVScreen.transform.localScale = new Vector3(0.3f, 0.2f, 0.2f);
				BonesTVScreen.transform.localPosition = new Vector3(0.6f, 0.2f, -1.8f);
				BonesTVScreen.transform.localEulerAngles = new Vector3(270f, 180f, 0f);
				Renderer component = ((Component)BonesTVScreen.transform.Find("Anim/BasicScreen/Frame")).gameObject.GetComponent<Renderer>();
				component.material.EnableKeyword("_EMISSION");
				component.material.SetColor("_EmissionColor", new Color(0f, 0.085f, 0.085f, 1f));
				Renderer component2 = ((Component)BonesTVScreen.transform.Find("Anim/Pole")).gameObject.GetComponent<Renderer>();
				component2.material.EnableKeyword("_EMISSION");
				component2.material.SetColor("_EmissionColor", new Color(0f, 0.1f, 0.1f, 1f));
				component2.material.SetTexture("_EmissionMap", (Texture)(object)Texture2D.whiteTexture);
				BonesTVScreen.SetActive(true);
				((Object)BonesTVScreen).name = "Module-Bones";
				GameObject val = new GameObject("BoneCounter")
				{
					layer = LayerMask.NameToLayer("CardOffscreen")
				};
				val.transform.SetParent(BonesTVScreen.transform.Find("RenderCamera/Content"));
				val.transform.localPosition = new Vector3(-5f, -2.78f, 7.0601f);
				val.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				val.transform.localScale = new Vector3(18f, 33f, 10f);
				BonesCountRenderer = val.AddComponent<SpriteRenderer>();
				((Renderer)BonesCountRenderer).SetMaterial(Resources.Load<Material>("art/materials/sprite_coloroverlay"));
				((Renderer)BonesCountRenderer).material.SetColor("_Color", GameColors.Instance.brightBlue * 0.85f);
				((Renderer)BonesCountRenderer).material.EnableKeyword("_EMISSION");
				((Renderer)BonesCountRenderer).material.SetColor("_EmissionColor", Color.white);
				OLDTVScreen componentInChildren = BonesTVScreen.GetComponentInChildren<OLDTVScreen>();
				componentInChildren.chromaticAberrationMagnetude = 0.1f;
				componentInChildren.noiseMagnetude = 0.2f;
				componentInChildren.staticMagnetude = 0.2f;
				componentInChildren.staticVertical = 15f;
				componentInChildren.staticVerticalScroll = 0.1f;
				componentInChildren.screenSaturation = 0f;
				OLDTVTube componentInChildren2 = BonesTVScreen.GetComponentInChildren<OLDTVTube>();
				componentInChildren2.radialDistortion = 0.6f;
				componentInChildren2.reflexMagnetude = 0.2f;
				((Component)BonesTVScreen.transform.Find("RenderCamera")).transform.position = new Vector3(0f, -30f, -30f);
				DisplayBones(0);
				val.SetActive(true);
			}
		}

		[HarmonyPatch(typeof(Part3ResourcesManager), "CleanUp")]
		[HarmonyPrefix]
		private static void CleanUpPart3Bones(Part3ResourcesManager __instance)
		{
			((ResourcesManager)__instance).PlayerBones = 0;
			DisplayBones(0);
		}
	}
}
namespace InscryptionCommunityPatch.PixelTutor
{
	[HarmonyPatch]
	public static class Act2TutorFix
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass5_0
		{
			public CardInfo selectedCard;

			internal void <PixelTutorSequence>b__0(CardInfo c)
			{
				selectedCard = c;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass6_0
		{
			public PixelPlayableCard selectedCard;

			internal void <ChoosePixelCard>b__0(PixelPlayableCard x)
			{
				selectedCard = x;
			}
		}

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

			private object <>2__current;

			public Tutor __instance;

			public IEnumerator enumerator;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (SaveManager.SaveFile.IsPart2)
					{
						<>2__current = (object)new WaitForSeconds(0.15f);
						<>1__state = 1;
						return true;
					}
					goto IL_00ba;
				case 1:
					<>1__state = -1;
					if (((AbilityBehaviour)__instance).Card.OpponentCard || Singleton<CardDrawPiles>.Instance.Deck.Cards.Count == 0)
					{
						PlayableCard card = ((AbilityBehaviour)__instance).Card;
						((Card)((card is PixelPlayableCard) ? card : null)).Anim.NegationEffect(false);
						<>2__current = (object)new WaitForSeconds(0.25f);
						<>1__state = 2;
						return true;
					}
					goto IL_00ba;
				case 2:
					<>1__state = -1;
					return false;
				case 3:
					{
						<>1__state = -1;
						return false;
					}
					IL_00ba:
					<>2__current = enumerator;
					<>1__state = 3;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public Deck instance;

			private <>c__DisplayClass6_0 <>8__1;

			public Action<CardInfo> cardSelectedCallback;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0091: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass6_0();
					<>8__1.selectedCard = null;
					<>2__current = ((Component)Singleton<BoardManager>.Instance).GetComponent<PixelPlayableCardArray>().SelectPixelCardFrom(instance.cards, delegate(PixelPlayableCard x)
					{
						<>8__1.selectedCard = x;
					});
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Tween.Position(((Component)<>8__1.selectedCard).transform, ((Component)<>8__1.selectedCard).transform.position + Vector3.back * 4f, 0.1f, 0f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)<>8__1.selectedCard).gameObject, 0.1f);
					cardSelectedCallback(((Card)<>8__1.selectedCard).Info);
					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 <PixelTutorSequence>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IEnumerator enumerator;

			public Deck __instance;

			private <>c__DisplayClass5_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass5_0();
					if (!SaveManager.SaveFile.IsPart2)
					{
						<>2__current = enumerator;
						<>1__state = 1;
						return true;
					}
					if ((Object)(object)((Component)Singleton<BoardManager>.Instance).GetComponent<PixelPlayableCardArray>() == (Object)null)
					{
						<>2__current = ((CardDrawPiles)Singleton<PixelCardDrawPiles>.Instance).ChooseDraw(0);
						<>1__state = 2;
						return true;
					}
					<>8__1.selectedCard = null;
					<>2__current = ChoosePixelCard(__instance, delegate(CardInfo c)
					{
						<>8__1.selectedCard = c;
					});
					<>1__state = 3;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				case 2:
					<>1__state = -1;
					return false;
				case 3:
					<>1__state = -1;
					if ((Object)(object)<>8__1.selectedCard == (Object)null)
					{
						return false;
					}
					<>2__current = Singleton<CardSpawner>.Instance.SpawnCardToHand(<>8__1.selectedCard, 0.25f);
					<>1__state = 4;
					return true;
				case 4:
					<>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();
			}
		}

		private static bool HasComponent;

		[HarmonyPatch(typeof(BoardManager), "Initialize")]
		[HarmonyPostfix]
		private static void AddPixelSelectableArray(BoardManager __instance)
		{
			if (SaveManager.SaveFile.IsPart2 && (Object)(object)((Component)__instance).GetComponent<PixelPlayableCardArray>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<PixelPlayableCardArray>();
				HasComponent = true;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PixelPlayableCard), "ManagedUpdate")]
		private static bool DisableManagedUpdateForSelection(PixelPlayableCard __instance)
		{
			if (HasComponent && !((PlayableCard)__instance).OnBoard)
			{
				return ((PlayableCard)__instance).InHand;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayableCard), "OnCursorSelectStart")]
		[HarmonyPrefix]
		private static bool AddSelectedCardToHand(PlayableCard __instance)
		{
			PixelPlayableCard val = (PixelPlayableCard)(object)((__instance is PixelPlayableCard) ? __instance : null);
			if (val == null || __instance.OnBoard || __instance.InHand || !HasComponent)
			{
				return true;
			}
			PixelPlayableCardArray component = ((Component)Singleton<BoardManager>.Instance).GetComponent<PixelPlayableCardArray>();
			if (component.displayedCards.Contains(val))
			{
				component.selectedCard = val;
			}
			return false;
		}

		[IteratorStateMachine(typeof(<AddStartDelay>d__4))]
		[HarmonyPatch(typeof(Tutor), "OnResolveOnBoard")]
		[HarmonyPostfix]
		private static IEnumerator AddStartDelay(IEnumerator enumerator, Tutor __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AddStartDelay>d__4(0)
			{
				enumerator = enumerator,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<PixelTutorSequence>d__5))]
		[HarmonyPatch(typeof(Deck), "Tutor")]
		[HarmonyPostfix]
		private static IEnumerator PixelTutorSequence(IEnumerator enumerator, Deck __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PixelTutorSequence>d__5(0)
			{
				enumerator = enumerator,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<ChoosePixelCard>d__6))]
		public static IEnumerator ChoosePixelCard(Deck instance, Action<CardInfo> cardSelectedCallback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ChoosePixelCard>d__6(0)
			{
				instance = instance,
				cardSelectedCallback = cardSelectedCallback
			};
		}
	}
	public class PixelPlayableCardArray : ManagedBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass15_0
		{
			public Func<bool> cancelCondition;

			internal bool <DisplayUntilCancelled>b__1()
			{
				return cancelCondition();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_0
		{
			public PixelPlayableCardArray <>4__this;

			public Func<bool> cancelCondition;

			internal bool <SelectPixelCardFrom>b__1()
			{
				if (!((Object)(object)<>4__this.selectedCard != (Object)null))
				{
					if (cancelCondition != null)
					{
						return cancelCondition();
					}
					return false;
				}
				return true;
			}
		}

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

			private object <>2__current;

			public PixelPlayableCardArray <>4__this;

			public bool forwards;

			public List<CardInfo> cards;

			public bool deckReview;

			public bool forPositiveEffect;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				PixelPlayableCardArray pixelPlayableCardArray = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = pixelPlayableCardArray.CleanUpCards();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (forwards)
					{
						pixelPlayableCardArray.currentPageIndex = ((pixelPlayableCardArray.currentPageIndex + 1 < pixelPlayableCardArray.numPages) ? (pixelPlayableCardArray.currentPageIndex + 1) : 0);
					}
					else
					{
						pixelPlayableCardArray.currentPageIndex = ((pixelPlayableCardArray.currentPageIndex - 1 < 0) ? (pixelPlayableCardArray.numPages - 1) : (pixelPlayableCardArray.currentPageIndex - 1));
					}
					<>2__current = pixelPlayableCardArray.SpawnAndPlaceCards(cards, pixelPlayableCardArray.GetNumRows(cards.Count), pixelPlayableCardArray.currentPageIndex, deckReview, forPositiveEffect);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					pixelPlayableCardArray.SetCardsEnabled(enabled: true);
					pixelPlayableCardArray.EnableButtons(enable: true);
					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 <CleanUpCards>d__24 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PixelPlayableCardArray <>4__this;

			private List<PixelPlayableCard>.Enumerator <>7__wrap1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Expected O, but got Unknown
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Expected O, but got Unknown
				try
				{
					int num = <>1__state;
					PixelPlayableCardArray pixelPlayableCardArray = <>4__this;
					switch (num)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						List<PixelPlayableCard> list = new List<PixelPlayableCard>(pixelPlayableCardArray.displayedCards);
						<>7__wrap1 = list.GetEnumerator();
						<>1__state = -3;
						goto IL_00fc;
					}
					case 1:
						<>1__state = -3;
						goto IL_00fc;
					case 2:
						{
							<>1__state = -1;
							pixelPlayableCardArray.SetOverlayEnabled(enabled: false);
							pixelPlayableCardArray.SetBoardEnabled(enabled: true);
							return false;
						}
						IL_00fc:
						while (<>7__wrap1.MoveNext())
						{
							PixelPlayableCard current = <>7__wrap1.Current;
							if ((Object)(object)current != (Object)null)
							{
								Tween.Position(((Component)current).transform, ((Component)current).transform.position + pixelPlayableCardArray.offscreenPositionOffset, 0.1f, 0f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
								((Card)current).Anim.PlayQuickRiffleSound();
								Object.Destroy((Object)(object)((Component)current).gameObject, 0.1f);
								<>2__current = (object)new WaitForSeconds(CardPile.GetPauseBetweenCardTime(pixelPlayableCardArray.displayedCards.Count) * pixelPlayableCardArray.tweenDurationModifier * 0.5f);
								<>1__state = 1;
								return true;
							}
						}
						<>m__Finally1();
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 2;
						return true;
					}
				}
				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;
				((IDisposable)<>7__wrap1).Dispose();
			}

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

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

			private object <>2__current;

			public Func<bool> cancelCondition;

			public List<CardInfo> cards;

			public PixelPlayableCardArray <>4__this;

			public Action cardsPlacedCallback;

			private <>c__DisplayClass15_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Expected O, but got Unknown
				int num = <>1__state;
				PixelPlayableCardArray pixelPlayableCardArray = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass15_0();
					<>8__1.cancelCondition = cancelCondition;
					cards.RemoveAll((CardInfo x) => (Object)(object)x == (Object)null);
					pixelPlayableCardArray.currentPageIndex = 0;
					pixelPlayableCardArray.numPages = 1 + (cards.Count - 1) / (pixelPlayableCardArray.maxCardsPerRow * pixelPlayableCardArray.maxRows);
					pixelPlayableCardArray.InitializeGamepadGrid();
					<>2__current = pixelPlayableCardArray.SpawnAndPlaceCards(cards, pixelPlayableCardArray.GetNumRows(cards.Count), 0, isDeckReview: true);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					pixelPlayab