Decompiled source of Endless Mode v0.4.6

EndlessMode.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AddWatermark;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EndlessMode.Cards;
using EndlessMode.Exhibits;
using EndlessMode.JadeBoxes;
using HarmonyLib;
using JetBrains.Annotations;
using LBoL.Base;
using LBoL.Base.Extensions;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Battle.Interactions;
using LBoL.Core.Cards;
using LBoL.Core.GapOptions;
using LBoL.Core.Stations;
using LBoL.Core.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.EnemyUnits.Normal;
using LBoL.EntityLib.Exhibits.Adventure;
using LBoL.EntityLib.Exhibits.Common;
using LBoL.EntityLib.Stages.NormalStages;
using LBoL.EntityLib.StatusEffects.Enemy;
using LBoL.EntityLib.StatusEffects.Enemy.Seija;
using LBoL.Presentation;
using LBoL.Presentation.UI;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.UI.Widgets;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
using NoMetaScaling.Core.API;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("LBoL.Base")]
[assembly: IgnoresAccessChecksTo("LBoL.ConfigData")]
[assembly: IgnoresAccessChecksTo("LBoL.Core")]
[assembly: IgnoresAccessChecksTo("LBoL.EntityLib")]
[assembly: IgnoresAccessChecksTo("LBoL.Presentation")]
[assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")]
[assembly: AssemblyCompany("EndlessMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EndlessMode")]
[assembly: AssemblyTitle("EndlessMode")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace EndlessMode
{
	[BepInPlugin("intoxicatedkid.endlessmode", "Endless Mode", "0.4.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("LBoL.exe")]
	public class BepinexPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(UiManager), "EnterGameRun")]
		private class UiManager_EnterGameRun_Patch
		{
			private static void Postfix(UiManager __instance, ref GameRunController gameRun)
			{
				if (gameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					CardConfig.FromId("EndlessModeTeleportGap").IsPooled = true;
				}
				else
				{
					CardConfig.FromId("EndlessModeTeleportGap").IsPooled = false;
				}
			}
		}

		[HarmonyPatch(typeof(StatusEffect), "ClampMax")]
		private class StatusEffect_ClampMax_Patch
		{
			private static bool Prefix(StatusEffect __instance)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class StatusEffect_set_Count_Patch
		{
			private static bool Prefix(StatusEffect __instance, ref int value)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					if (!__instance.HasCount)
					{
						throw new InvalidOperationException("<" + ((GameEntity)__instance).DebugName + "> has no count");
					}
					if (value < 0)
					{
						throw new ArgumentException($"Negative count '{value}' for {((GameEntity)__instance).DebugName}");
					}
					int num = value;
					if (__instance._count == num)
					{
						return false;
					}
					__instance._count = num;
					((GameEntity)__instance).NotifyChanged();
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class StatusEffect_set_Duration_Patch
		{
			private static bool Prefix(StatusEffect __instance, ref int value)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					if (!__instance.HasDuration)
					{
						throw new InvalidOperationException("<" + ((GameEntity)__instance).DebugName + "> has no duration");
					}
					if (value < 0)
					{
						throw new ArgumentException($"Negative duration '{value}' for {((GameEntity)__instance).DebugName}");
					}
					int num = value;
					if (__instance._duration == num)
					{
						return false;
					}
					__instance._duration = num;
					((GameEntity)__instance).NotifyChanged();
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class StatusEffect_set_Level_Patch
		{
			private static bool Prefix(StatusEffect __instance, ref int value)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					if (!__instance.HasLevel)
					{
						throw new InvalidOperationException("<" + ((GameEntity)__instance).DebugName + "> has no level");
					}
					if (value < 0)
					{
						throw new ArgumentException($"Negative level '{value}' for {((GameEntity)__instance).DebugName}");
					}
					int num = value;
					if (__instance._level == num)
					{
						return false;
					}
					__instance._level = num;
					((GameEntity)__instance).NotifyChanged();
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(GameMap), "SetAdjacentNodesStatus")]
		private class GameMap_SetAdjacentNodesStatus_Patch
		{
			private static bool Prefix(GameMap __instance)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>() && EndlessModeJadeBox.wait)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(StatusEffect), "Stack")]
		private class StatusEffect_Stack_Patch
		{
			private static int EndlessModeCheck()
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox j) => j is EndlessModeJadeBox))
				{
					return int.MaxValue;
				}
				return 999;
			}

			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_002b: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)999, (string)null)
				}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(StatusEffect_Stack_Patch), "EndlessModeCheck", (Type[])null, (Type[])null)).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)999, (string)null)
				})
					.Set(OpCodes.Call, (object)AccessTools.Method(typeof(StatusEffect_Stack_Patch), "EndlessModeCheck", (Type[])null, (Type[])null))
					.MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
					{
						new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)999, (string)null)
					})
					.Set(OpCodes.Call, (object)AccessTools.Method(typeof(StatusEffect_Stack_Patch), "EndlessModeCheck", (Type[])null, (Type[])null))
					.InstructionEnumeration();
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class ApplyStatusEffectAction_Patch
		{
			private static int EndlessModeCheck()
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox j) => j is EndlessModeJadeBox))
				{
					return int.MaxValue;
				}
				return 9999;
			}

			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_002b: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)9999, (string)null)
				}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(ApplyStatusEffectAction_Patch), "EndlessModeCheck", (Type[])null, (Type[])null)).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)9999, (string)null)
				})
					.Set(OpCodes.Call, (object)AccessTools.Method(typeof(ApplyStatusEffectAction_Patch), "EndlessModeCheck", (Type[])null, (Type[])null))
					.MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
					{
						new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)9999, (string)null)
					})
					.Set(OpCodes.Call, (object)AccessTools.Method(typeof(ApplyStatusEffectAction_Patch), "EndlessModeCheck", (Type[])null, (Type[])null))
					.InstructionEnumeration();
			}
		}

		[HarmonyPatch(typeof(Baota), "OnAdded")]
		private class Baota_OnAdded_Patch
		{
			private static bool Prefix(Baota __instance)
			{
				((Exhibit)__instance).HandleGameRunEvent<StationEventArgs>(((GameEntity)__instance).GameRun.GapOptionsGenerating, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0102: Unknown result type (might be due to invalid IL or missing references)
					if (!((GapStation)args.Station).GapOptions.Any((GapOption g) => g is UpgradeBaota) && Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Where((Exhibit e) => e is Baota).Sum((Exhibit e) => e.Counter) < Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Where((Exhibit e) => e is Baota).Sum((Exhibit e) => e.Value1))
					{
						((GapStation)args.Station).GapOptions.Add((GapOption)(object)Library.CreateGapOption<UpgradeBaota>());
					}
				});
				return false;
			}
		}

		[HarmonyPatch(typeof(Saiqianxiang), "OnAdded")]
		private class Saiqianxiang_OnAdded_Patch
		{
			private static bool Prefix(Saiqianxiang __instance)
			{
				((Exhibit)__instance).HandleGameRunEvent<StationEventArgs>(((GameEntity)__instance).GameRun.GapOptionsGenerating, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0052: Unknown result type (might be due to invalid IL or missing references)
					//IL_0058: Expected O, but got Unknown
					if (!((GapStation)args.Station).GapOptions.Any((GapOption g) => g is GetMoney))
					{
						((Exhibit)__instance).NotifyActivating();
						GapStation val = (GapStation)args.Station;
						GetMoney val2 = Library.CreateGapOption<GetMoney>();
						val2.Value = Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Where((Exhibit e) => e is Saiqianxiang).Sum((Exhibit e) => e.Value1);
						val.GapOptions.Add((GapOption)(object)val2);
					}
				});
				GameRunController gameRun = ((GameEntity)__instance).GameRun;
				gameRun.RewardCardAbandonMoney += ((Exhibit)__instance).Value2;
				return false;
			}
		}

		[HarmonyPatch(typeof(ShanliangDengpao), "OnAdded")]
		private class ShanliangDengpao_OnAdded_Patch
		{
			private static bool Prefix(ShanliangDengpao __instance)
			{
				((Exhibit)__instance).HandleGameRunEvent<StationEventArgs>(((GameEntity)__instance).GameRun.GapOptionsGenerating, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0052: Unknown result type (might be due to invalid IL or missing references)
					//IL_0058: Expected O, but got Unknown
					if (!((GapStation)args.Station).GapOptions.Any((GapOption g) => g is GetRareCard))
					{
						((Exhibit)__instance).NotifyActivating();
						GapStation val = (GapStation)args.Station;
						GetRareCard val2 = Library.CreateGapOption<GetRareCard>();
						val2.Value = Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Where((Exhibit e) => e is ShanliangDengpao).Sum((Exhibit e) => e.Value1);
						val.GapOptions.Add((GapOption)(object)val2);
					}
				});
				return false;
			}
		}

		[HarmonyPatch(typeof(ShoushiYubi), "OnAdded")]
		private class ShoushiYubi_OnAdded_Patch
		{
			private static bool Prefix(ShoushiYubi __instance)
			{
				((Exhibit)__instance).HandleGameRunEvent<StationEventArgs>(((GameEntity)__instance).GameRun.GapOptionsGenerating, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
				{
					//IL_0007: 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)
					if (!((GapStation)args.Station).GapOptions.Any((GapOption g) => g is RemoveCard))
					{
						((Exhibit)__instance).NotifyActivating();
						((GapStation)args.Station).GapOptions.Add((GapOption)(object)Library.CreateGapOption<RemoveCard>());
					}
				});
				return false;
			}
		}

		[HarmonyPatch(typeof(GapOptionsPanel), "RemoveCard")]
		private class GapOptionsPanel_RemoveCard_Patch
		{
			private static IEnumerator coroutine(GapOptionsPanel __instance)
			{
				List<Card> list = Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeckWithOutUnremovable.ToList();
				if (list.Count > 0)
				{
					SelectCardInteraction interaction = new SelectCardInteraction(1, Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count((Exhibit e) => e is ShoushiYubi), (IEnumerable<Card>)list, (SelectedCardHandling)0)
					{
						CanCancel = true
					};
					yield return Singleton<GameMaster>.Instance.CurrentGameRun.InteractionViewer.View((Interaction)(object)interaction);
					if (!((Interaction)interaction).IsCanceled)
					{
						Singleton<GameMaster>.Instance.CurrentGameRun.RemoveDeckCards((IEnumerable<Card>)interaction.SelectedCards, true);
						__instance.SelectedAndHide();
						AudioManager.PlayUi("Jingshen", false);
					}
				}
			}

			private static bool Prefix(GapOptionsPanel __instance)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(coroutine(__instance));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Xunlongchi), "OnAdded")]
		private class Xunlongchi_OnAdded_Patch
		{
			private static bool Prefix(Xunlongchi __instance)
			{
				((Exhibit)__instance).HandleGameRunEvent<StationEventArgs>(((GameEntity)__instance).GameRun.GapOptionsGenerating, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
				{
					//IL_0007: 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)
					if (!((GapStation)args.Station).GapOptions.Any((GapOption g) => g is FindExhibit))
					{
						((Exhibit)__instance).NotifyActivating();
						((GapStation)args.Station).GapOptions.Add((GapOption)(object)Library.CreateGapOption<FindExhibit>());
					}
				});
				return false;
			}
		}

		[HarmonyPatch(typeof(GapStation), "FindExhibitRunner")]
		private class GapStation_FindExhibitRunner_Patch
		{
			private static bool Prefix(GapStation __instance)
			{
				//IL_005c: 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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Expected O, but got Unknown
				int num = __instance.GapOptions.FindIndex((GapOption o) => o is FindExhibit);
				if (num >= 0)
				{
					for (int i = 0; i < Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count((Exhibit e) => e is Xunlongchi); i++)
					{
						((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(((Station)__instance).GameRun.GainExhibitRunner(((Station)__instance).GameRun.CurrentStage.GetEliteEnemyExhibit(), true, new VisualSourceData
						{
							SourceType = (VisualSourceType)4,
							Index = num
						}));
					}
				}
				else
				{
					Debug.LogError((object)"[GapStation] Cannot FindExhibit without a FindExhibit gap option");
				}
				return false;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class GameRunController_ShopPriceMultiplier_Getter_Patch
		{
			private static void Postfix(GameRunController __instance, ref float __result)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					__result = Math.Max(__result, 0.48f);
				}
			}
		}

		[HarmonyPatch(typeof(Unit), "SetMaxHp")]
		private class Unit_SetMaxHp_Patch
		{
			private static int EndlessModeCheck()
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox j) => j is EndlessModeJadeBox))
				{
					return int.MaxValue;
				}
				return 9999;
			}

			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_002b: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)9999, (string)null)
				}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(Unit_SetMaxHp_Patch), "EndlessModeCheck", (Type[])null, (Type[])null)).InstructionEnumeration();
			}
		}

		[HarmonyPatch(typeof(Unit), "GainBlockShield")]
		private class Unit_GainBlockShield_Patch
		{
			private static int EndlessModeCheck()
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox j) => j is EndlessModeJadeBox))
				{
					return int.MaxValue;
				}
				return 9999;
			}

			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0003: 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_002b: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				return new CodeMatcher(instructions, (ILGenerator)null).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)9999, (string)null)
				}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(Unit_GainBlockShield_Patch), "EndlessModeCheck", (Type[])null, (Type[])null)).MatchEndForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)9999, (string)null)
				})
					.Set(OpCodes.Call, (object)AccessTools.Method(typeof(Unit_GainBlockShield_Patch), "EndlessModeCheck", (Type[])null, (Type[])null))
					.InstructionEnumeration();
			}
		}

		private static readonly Harmony harmony = PInfo.harmony;

		internal static ManualLogSource log;

		internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);

		internal static IResourceSource embeddedSource = (IResourceSource)new EmbeddedSource(Assembly.GetExecutingAssembly());

		internal static DirectorySource directorySource = new DirectorySource("intoxicatedkid.endlessmode", "");

		internal static BatchLocalization cardLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(CardTemplate), false);

		internal static BatchLocalization exhibitLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(ExhibitTemplate), false);

		internal static BatchLocalization jadeBoxLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(JadeBoxTemplate), false);

		internal static BatchLocalization statusEffectLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(StatusEffectTemplate), false);

		public static ConfigEntry<bool> EnableCurse;

		public static ConfigEntry<bool> EnableFinalAct;

		public static ConfigEntry<bool> EndlessExhibits;

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			EnableCurse = ((BaseUnityPlugin)this).Config.Bind<bool>("EnableCurse", "Enable Curse", true, "Enables the effect of Curses. When disabled, enemy scaling will be non-linear.\n저주 효과를 활성화합니다. 비활성화하면 적 스케일링이 비선형이 됩니다.\n启用诅咒效果。禁用后,敌人的缩放将呈非线性。\n呪いの効果を有効にします。無効にすると、敵のスケーリングは非線形になります。");
			EnableFinalAct = ((BaseUnityPlugin)this).Config.Bind<bool>("EnableFinalAct", "Enable Final Act", false, "Add Act 4 to Endless Mode. Can be toggled mid-run.\n무한 모드에 4막을 추가합니다. 중간에 토글할 수 있습니다.\n将第 4 幕添加到无尽模式。可以在中途切换。\nエンドレス モードに Act 4 を追加します。実行中に切り替えられます。");
			EndlessExhibits = ((BaseUnityPlugin)this).Config.Bind<bool>("EndlessExhibits", "Endless Exhibits", true, "Acquired exhibits will appear again.\n획득한 전시물이 다시 등장합니다.\n获得的作品将会再次出现。\n獲得した展示品が再び登場します。");
			EntityManager.RegisterSelf();
			harmony.PatchAll();
			if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
			{
				WatermarkWrapper.ActivateWatermark();
			}
			cardLoc.DiscoverAndLoadLocFiles("Card");
			exhibitLoc.DiscoverAndLoadLocFiles("Exhibit");
			jadeBoxLoc.DiscoverAndLoadLocFiles("JadeBox");
			statusEffectLoc.DiscoverAndLoadLocFiles("StatusEffect");
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public class NoMetaScalinAPIWrap
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		public static void InteractWithNoMetaScaling()
		{
			if (NoMetaScalinAPI.GetCancelEnnabled(Singleton<GameMaster>.Instance.CurrentGameRun))
			{
				NoMetaScalinAPI.SetCancelEnnabled(Singleton<GameMaster>.Instance.CurrentGameRun, false);
			}
		}
	}
	public static class PInfo
	{
		public const string GUID = "intoxicatedkid.endlessmode";

		public const string Name = "Endless Mode";

		public const string version = "0.4.6";

		public static readonly Harmony harmony = new Harmony("intoxicatedkid.endlessmode");
	}
	internal class WatermarkWrapper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void ActivateWatermark()
		{
			API.ActivateWatermark();
		}
	}
}
namespace EndlessMode.StatusEffects
{
	public sealed class EndlessModeCurseSeDef : StatusEffectTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseSeDef))]
		public sealed class EndlessModeCurseSe : StatusEffect
		{
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseSe");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.statusEffectLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override Sprite LoadSprite()
		{
			return ResourceLoader.LoadSprite("Resources.EndlessModeCurseSe.png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
		}

		public override StatusEffectConfig MakeConfig()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			return new StatusEffectConfig(BepinexPlugin.sequenceTable.Next(typeof(StatusEffectConfig)), "", 10, (StatusEffectType)0, false, false, (int?)null, false, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string>(), "Default", "Default", "Default");
		}
	}
}
namespace EndlessMode.JadeBoxes
{
	public sealed class EndlessModeJadeBoxDef : JadeBoxTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeJadeBox");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.jadeBoxLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override JadeBoxConfig MakeConfig()
		{
			JadeBoxConfig val = ((JadeBoxTemplate)this).DefaultConfig();
			val.Value1 = 3;
			val.Order = -99;
			return val;
		}
	}
	[EntityLogic(typeof(EndlessModeJadeBoxDef))]
	public sealed class EndlessModeJadeBox : JadeBox
	{
		[HarmonyPatch(typeof(Station), "ForceFinish")]
		private class Station_ForceFinish_Patch
		{
			private static void Postfix(Station __instance)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun._jadeBoxes.Any((JadeBox j) => j is EndlessModeJadeBox))
				{
					__instance.IsNormalEnd = false;
					__instance.IsTrueEnd = false;
				}
			}
		}

		public static bool wait;

		public int Final => BepinexPlugin.EnableFinalAct.Value ? 4 : 3;

		protected override void OnGain(GameRunController gameRun)
		{
			if (!BepinexPlugin.EnableFinalAct.Value)
			{
				((GameEntity)this).GameRun._stages.Remove(((GameEntity)this).GameRun._stages.Last());
			}
			((GameEntity)this).GameRun.GainExhibitInstantly((Exhibit)(object)Library.CreateExhibit<JingjieGanzhiyi>(), false, (VisualSourceData)null);
		}

		protected override void OnAdded()
		{
			if (Chainloader.PluginInfos.ContainsKey("neo.lbol.modifiers.noMetaScaling"))
			{
				NoMetaScalinAPIWrap.InteractWithNoMetaScaling();
			}
			((JadeBox)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Invalid comparison between Unknown and I4
				((GameEntity)this).GameRun.CurrentStage.Index = ((GameEntity)this).GameRun._stageIndex;
				if (((GameEntity)this).GameRun.CurrentStage.Boss == null)
				{
					((GameEntity)this).GameRun.CurrentStage.InitBoss(new RandomGen(((GameEntity)this).GameRun.InitBossSeed));
				}
				if (((GameEntity)this).GameRun.CurrentStage is BambooForest && ((GameEntity)this).GameRun.CurrentStage.Index > 0)
				{
					((GameEntity)this).GameRun.AdventureHistory.Clear();
					((GameEntity)this).GameRun.ExhibitPool = new List<Type>();
					((GameEntity)this).GameRun.ShiningExhibitPool = new List<Type>();
					foreach (var (type, val7) in Library.EnumerateRollableExhibitTypes(((GameEntity)this).GameRun.UnlockLevel))
					{
						if ((int)val7.Rarity == 3 && (!((GameEntity)this).GameRun.Player.HasExhibit(type) || BepinexPlugin.EndlessExhibits.Value))
						{
							((GameEntity)this).GameRun.ShiningExhibitPool.Add(type);
						}
						else if (val7.IsPooled && (!((GameEntity)this).GameRun.Player.HasExhibit(type) || BepinexPlugin.EndlessExhibits.Value))
						{
							((GameEntity)this).GameRun.ExhibitPool.Add(type);
						}
					}
				}
			});
			((JadeBox)this).HandleGameRunEvent<StationEventArgs>(((GameEntity)this).GameRun.StationEntered, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
			{
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Expected O, but got Unknown
				//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0401: Expected O, but got Unknown
				((GameEntity)this).GameRun.CurrentStage.Index = ((GameEntity)this).GameRun._stageIndex;
				if (((GameEntity)this).GameRun.CurrentStage == ((GameEntity)this).GameRun._stages.Last() && args.Station is BossStation)
				{
					((GameEntity)this).GameRun.CurrentStation.IsNormalEnd = false;
					((GameEntity)this).GameRun.CurrentStation.IsTrueEnd = false;
					RandomGen val = new RandomGen(((GameEntity)this).GameRun.InitBossSeed);
					Stage val2 = (Stage)(object)Library.CreateStage<BambooForest>();
					((GameEntity)val2).GameRun = ((GameEntity)this).GameRun;
					val2.MapSeed = ((GameEntity)this).GameRun.RootRng.NextULong();
					val2.InitBoss(val);
					val2.InitFirstAdventure(val);
					((GameEntity)this).GameRun._stages.Add(val2);
					Stage val3 = (Stage)(object)Library.CreateStage<XuanwuRavine>();
					((GameEntity)val3).GameRun = ((GameEntity)this).GameRun;
					val3.MapSeed = ((GameEntity)this).GameRun.RootRng.NextULong();
					val3.InitBoss(val);
					val3.InitFirstAdventure(val);
					((GameEntity)this).GameRun._stages.Add(val3);
					Stage val4 = (Stage)(object)Library.CreateStage<WindGodLake>();
					((GameEntity)val4).GameRun = ((GameEntity)this).GameRun;
					val4.MapSeed = ((GameEntity)this).GameRun.RootRng.NextULong();
					val4.InitBoss(val);
					val4.InitFirstAdventure(val);
					((GameEntity)this).GameRun._stages.Add(val4);
					if (BepinexPlugin.EnableFinalAct.Value)
					{
						Stage val5 = (Stage)(object)Library.CreateStage<FinalStage>();
						((GameEntity)val5).GameRun = ((GameEntity)this).GameRun;
						val5.MapSeed = ((GameEntity)this).GameRun.RootRng.NextULong();
						val5.InitBoss(val);
						val5.InitFirstAdventure(val);
						((GameEntity)this).GameRun._stages.Add(val5);
					}
				}
				int num = MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
				if (((GameEntity)this).GameRun.CurrentStage is BambooForest && ((GameEntity)this).GameRun.CurrentStage.Index > 0 && ((GameEntity)this).GameRun.CurrentStation is EntryStation && ((GameEntity)this).GameRun.Player.Exhibits.Count((Exhibit e) => e.Config.RelativeEffects.Contains("EndlessModeCurse")) < num)
				{
					List<Exhibit> list = new List<Exhibit>
					{
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofBatteryDef.EndlessModeCurseofBattery>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofBleedingDef.EndlessModeCurseofBleeding>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofCapitalismDef.EndlessModeCurseofCapitalism>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofEternalNightDef.EndlessModeCurseofEternalNight>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofFortressDef.EndlessModeCurseofFortress>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofLiberationDef.EndlessModeCurseofLiberation>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofMicrotransactionDef.EndlessModeCurseofMicrotransaction>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofShuffleDef.EndlessModeCurseofShuffle>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofSmallHandDef.EndlessModeCurseofSmallHand>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofTenguDef.EndlessModeCurseofTengu>(),
						(Exhibit)(object)Library.CreateExhibit<EndlessModeCurseofUnmotivatedDef.EndlessModeCurseofUnmotivated>()
					};
					for (int i = 0; i < 3; i++)
					{
						Exhibit val6 = CollectionsExtensions.SampleOrDefault<Exhibit>(list.Where((Exhibit e) => !((GameEntity)this).GameRun.Player.HasExhibit(((GameEntity)e).Id)), ((GameEntity)this).GameRun.ExhibitRng);
						if (val6 != null)
						{
							list.Remove(val6);
							((GameEntity)this).GameRun.CurrentStation.Rewards.Add(StationReward.CreateExhibit(val6));
						}
					}
					if (((GameEntity)this).GameRun.CurrentStation.Rewards.Count > 0)
					{
						wait = true;
						((UiPanel<ShowRewardContent>)(object)UiManager.GetPanel<RewardPanel>()).Show(new ShowRewardContent
						{
							Station = ((GameEntity)this).GameRun.CurrentStation,
							ShowNextButton = false
						});
						CollectionExtensions.Do<RewardWidget>((IEnumerable<RewardWidget>)UiManager.GetPanel<RewardPanel>()._rewardWidgets, (Action<RewardWidget>)delegate(RewardWidget rw)
						{
							rw.Click += delegate
							{
								//IL_0053: Unknown result type (might be due to invalid IL or missing references)
								if (UiManager.GetPanel<RewardPanel>()._rewardWidgets.Count <= 2)
								{
									((UiPanelBase)UiManager.GetPanel<RewardPanel>()).Hide();
									((GameEntity)this).GameRun.CurrentStation.Rewards.Clear();
									wait = false;
									((GameEntity)this).GameRun.CurrentMap.SetAdjacentNodesStatus(((GameEntity)this).GameRun.MapMode);
								}
							};
						});
					}
				}
			});
		}

		protected override void OnEnterBattle()
		{
			((JadeBox)this).HandleBattleEvent<GameEventArgs>(((JadeBox)this).Battle.BattleStarted, (GameEventHandler<GameEventArgs>)OnBattleStarted);
			((JadeBox)this).HandleBattleEvent<StatusEffectApplyEventArgs>(((Unit)((JadeBox)this).Battle.Player).StatusEffectAdding, (GameEventHandler<StatusEffectApplyEventArgs>)OnPlayerStatusEffectAdding);
			((JadeBox)this).HandleBattleEvent<UnitEventArgs>(((JadeBox)this).Battle.EnemySpawned, (GameEventHandler<UnitEventArgs>)OnEnemySpawned);
		}

		private void OnBattleStarted(GameEventArgs args)
		{
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			float num = MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
			if (!BepinexPlugin.EnableCurse.Value)
			{
				num += 0.1f * (num * (num + 1f) / 2f);
			}
			LimitedDamage val = default(LimitedDamage);
			foreach (EnemyUnit allAliveEnemy in ((JadeBox)this).Battle.AllAliveEnemies)
			{
				if (allAliveEnemy is HardworkRabbit || allAliveEnemy is LazyRabbit)
				{
					((GameEntity)this).GameRun.SetEnemyHpAndMaxHp(Math.Min(MathExtensions.RoundToInt((float)((Unit)allAliveEnemy).Hp * (num + 1f)), 40), Math.Min(MathExtensions.RoundToInt((float)((Unit)allAliveEnemy).MaxHp * (num + 1f)), 40), allAliveEnemy, false);
				}
				else
				{
					((GameEntity)this).GameRun.SetEnemyHpAndMaxHp(MathExtensions.RoundToInt((float)((Unit)allAliveEnemy).Hp * (num + 1f)), MathExtensions.RoundToInt((float)((Unit)allAliveEnemy).MaxHp * (num + 1f)), allAliveEnemy, false);
				}
				if (((Unit)allAliveEnemy).TryGetStatusEffect<LimitedDamage>(ref val))
				{
					((GameEntity)this).React(Reactor.op_Implicit((BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)val, true, 0.1f)));
				}
				((JadeBox)this).HandleBattleEvent<StatusEffectApplyEventArgs>(((Unit)allAliveEnemy).StatusEffectAdding, (GameEventHandler<StatusEffectApplyEventArgs>)OnEnemyStatusEffectAdding);
				((JadeBox)this).HandleBattleEvent<DamageDealingEventArgs>(((Unit)allAliveEnemy).DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnEnemyDamageDealing);
			}
		}

		private void OnPlayerStatusEffectAdding(StatusEffectApplyEventArgs args)
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Invalid comparison between Unknown and I4
			float num = MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
			if (!BepinexPlugin.EnableCurse.Value)
			{
				num += 0.1f * (num * (num + 1f) / 2f);
			}
			if (args.Effect is FoxCharm)
			{
				StatusEffect effect = args.Effect;
				effect.Limit += MathExtensions.RoundToInt(num);
			}
			else if ((int)args.Effect.Type == 1 && ((GameEventArgs)args).ActionSource is EnemyUnit)
			{
				if (args.Effect.HasLevel)
				{
					args.Effect.Level = MathExtensions.RoundToInt((float)args.Effect.Level * (num + 1f));
				}
				if (args.Effect.HasCount)
				{
					args.Effect.Count = MathExtensions.RoundToInt((float)args.Effect.Count * (num + 1f));
				}
				if (args.Effect.HasDuration)
				{
					args.Effect.Duration = MathExtensions.RoundToInt((float)args.Effect.Duration * (num + 1f));
				}
			}
		}

		private void OnEnemyStatusEffectAdding(StatusEffectApplyEventArgs args)
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Invalid comparison between Unknown and I4
			float num = MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
			if (!BepinexPlugin.EnableCurse.Value)
			{
				num += 0.1f * (num * (num + 1f) / 2f);
			}
			if (args.Effect is ScarletDestiny)
			{
				StatusEffect effect = args.Effect;
				effect.Limit += MathExtensions.RoundToInt(num);
			}
			else if (args.Effect is SuwakoHex)
			{
				args.Effect.Level = Math.Min(MathExtensions.RoundToInt((float)args.Effect.Level * (num + 1f)), 5);
			}
			else if (args.Effect is HolyGrailSe)
			{
				((GameEventArgs)args).CancelBy((GameEntity)(object)this);
			}
			else if (!(args.Effect is Invincible) && !(args.Effect is InvincibleEternal) && (int)args.Effect.Type == 0)
			{
				if (args.Effect.HasLevel)
				{
					args.Effect.Level = MathExtensions.RoundToInt((float)args.Effect.Level * (num + 1f));
				}
				if (args.Effect.HasCount)
				{
					args.Effect.Count = MathExtensions.RoundToInt((float)args.Effect.Count * (num + 1f));
				}
				if (args.Effect.HasDuration)
				{
					args.Effect.Duration = MathExtensions.RoundToInt((float)args.Effect.Duration * (num + 1f));
				}
			}
		}

		private void OnEnemyDamageDealing(DamageDealingEventArgs args)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Invalid comparison between Unknown and I4
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			float num = MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
			if (!BepinexPlugin.EnableCurse.Value)
			{
				num += 0.1f * (num * (num + 1f) / 2f);
			}
			DamageInfo damageInfo = args.DamageInfo;
			if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
			{
				((DamageInfo)(ref damageInfo)).Damage = ((DamageInfo)(ref damageInfo)).Amount * (1f + num * 75f / 100f);
				args.DamageInfo = damageInfo;
				((GameEventArgs)args).AddModifier((GameEntity)(object)this);
			}
		}

		private void OnEnemySpawned(UnitEventArgs args)
		{
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			float num = MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
			if (!BepinexPlugin.EnableCurse.Value)
			{
				num += 0.1f * (num * (num + 1f) / 2f);
			}
			if (args.Unit is HardworkRabbit || args.Unit is LazyRabbit)
			{
				((GameEntity)this).GameRun.SetEnemyHpAndMaxHp(Math.Min(MathExtensions.RoundToInt((float)args.Unit.Hp * (num + 1f)), 40), Math.Min(MathExtensions.RoundToInt((float)args.Unit.MaxHp * (num + 1f)), 40), (EnemyUnit)args.Unit, false);
			}
			else
			{
				((GameEntity)this).GameRun.SetEnemyHpAndMaxHp(MathExtensions.RoundToInt((float)args.Unit.Hp * (num + 1f)), MathExtensions.RoundToInt((float)args.Unit.MaxHp * (num + 1f)), (EnemyUnit)args.Unit, false);
			}
			((JadeBox)this).HandleBattleEvent<StatusEffectApplyEventArgs>(args.Unit.StatusEffectAdding, (GameEventHandler<StatusEffectApplyEventArgs>)OnEnemyStatusEffectAdding);
			((JadeBox)this).HandleBattleEvent<DamageDealingEventArgs>(args.Unit.DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnEnemyDamageDealing);
		}
	}
}
namespace EndlessMode.Exhibits
{
	public sealed class EndlessModeCurseofBatteryDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofBatteryDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofBattery : Exhibit
		{
			[HarmonyPatch(typeof(PlayerUnit), "GainPower")]
			private class PlayerUnit_GainPower_Patch
			{
				private static void Prefix(PlayerUnit __instance, ref int power)
				{
					if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<EndlessModeCurseofBattery>() && BepinexPlugin.EnableCurse.Value)
					{
						power = MathExtensions.CeilingToInt((float)power * ((100f - (float)((Exhibit)Singleton<GameMaster>.Instance.CurrentGameRun.Player.GetExhibit<EndlessModeCurseofBattery>()).Counter) / 100f));
					}
				}
			}

			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			private class UltimateSkill_get_MaxPowerLevel_Patch
			{
				private static bool Prefix(UltimateSkill __instance, ref int __result)
				{
					if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<EndlessModeCurseofBattery>() && BepinexPlugin.EnableCurse.Value)
					{
						__result = __instance.Config.MaxPowerLevel;
						return false;
					}
					return true;
				}
			}

			protected override void OnGain(PlayerUnit player)
			{
				((Exhibit)this).Counter = Math.Min(((Exhibit)this).Value1 * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f), ((Exhibit)this).Value2);
			}

			protected override void OnAdded(PlayerUnit player)
			{
				((Exhibit)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
				{
					if (((GameEntity)this).GameRun.CurrentStage is BambooForest)
					{
						((Exhibit)this).Counter = Math.Min(((Exhibit)this).Counter + ((Exhibit)this).Value1, ((Exhibit)this).Value2);
					}
				});
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofBattery");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)10, (int?)70, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, true, (int?)0, (Keyword)16384, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofBleedingDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofBleedingDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofBleeding : Exhibit
		{
			[HarmonyPatch(typeof(Unit), "Heal")]
			private class Unit_Heal_Patch
			{
				private static void Prefix(Unit __instance, ref int healValue)
				{
					if (Singleton<GameMaster>.Instance.CurrentGameRun != null && __instance is PlayerUnit && Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<EndlessModeCurseofBleeding>() && BepinexPlugin.EnableCurse.Value)
					{
						healValue = MathExtensions.CeilingToInt((float)healValue * ((100f - (float)((Exhibit)Singleton<GameMaster>.Instance.CurrentGameRun.Player.GetExhibit<EndlessModeCurseofBleeding>()).Counter) / 100f));
					}
				}
			}

			protected override void OnGain(PlayerUnit player)
			{
				((Exhibit)this).Counter = Math.Min(((Exhibit)this).Value1 * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f), ((Exhibit)this).Value2);
			}

			protected override void OnAdded(PlayerUnit player)
			{
				((Exhibit)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
				{
					if (((GameEntity)this).GameRun.CurrentStage is BambooForest)
					{
						((Exhibit)this).Counter = Math.Min(((Exhibit)this).Counter + ((Exhibit)this).Value1, ((Exhibit)this).Value2);
					}
				});
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofBleeding");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)10, (int?)70, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, true, (int?)0, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofCapitalismDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofCapitalismDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofCapitalism : Exhibit
		{
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			private class GameRunController_ShopPriceMultiplier_Getter_Patch
			{
				private static void Postfix(GameRunController __instance, ref float __result)
				{
					if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<EndlessModeCurseofCapitalism>() && BepinexPlugin.EnableCurse.Value)
					{
						__result *= ((Exhibit)Singleton<GameMaster>.Instance.CurrentGameRun.Player.GetExhibit<EndlessModeCurseofCapitalism>()).Counter;
					}
				}
			}

			public int Counter2 => ((Exhibit)this).Counter * 100;

			protected override void OnGain(PlayerUnit player)
			{
				((Exhibit)this).Counter = Math.Min(((Exhibit)this).Value1 / 100 * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f), ((Exhibit)this).Value2 / 100);
			}

			protected override void OnAdded(PlayerUnit player)
			{
				((Exhibit)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
				{
					if (((GameEntity)this).GameRun.CurrentStage is BambooForest)
					{
						((Exhibit)this).Counter = Math.Min(((Exhibit)this).Value1 / 100 * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f), ((Exhibit)this).Value2 / 100);
					}
				});
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofCapitalism");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)100, (int?)10000, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, true, (int?)0, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofChaosDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofChaosDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofChaos : Exhibit
		{
			private List<StatusEffect> effects1 = new List<StatusEffect>
			{
				(StatusEffect)(object)Library.CreateStatusEffect<DeepFreezeSe>(),
				(StatusEffect)(object)Library.CreateStatusEffect<ExtraTurn>(),
				(StatusEffect)(object)Library.CreateStatusEffect<Firepower>(),
				(StatusEffect)(object)Library.CreateStatusEffect<Graze>(),
				(StatusEffect)(object)Library.CreateStatusEffect<GuangxueMicai>(),
				(StatusEffect)(object)Library.CreateStatusEffect<Invincible>(),
				(StatusEffect)(object)Library.CreateStatusEffect<InvincibleEternal>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<Spirit>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>(),
				(StatusEffect)(object)Library.CreateStatusEffect<LimitedDamage>()
			};

			protected override void OnEnterBattle()
			{
				((Exhibit)this).ReactBattleEvent<GameEventArgs>(((Exhibit)this).Battle.BattleStarted, (EventSequencedReactor<GameEventArgs>)OnBattleStarted);
			}

			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
			{
				ManaFreezer manaFreezer = (ManaFreezer)((IEnumerable<Card>)((Exhibit)this).Battle.HandZone).FirstOrDefault((Func<Card, bool>)((Card c) => c is ManaFreezer));
				if (manaFreezer != null)
				{
					manaFreezer.FreezeTimes += ((Exhibit)this).Counter;
				}
				yield break;
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofChaos");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)null, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofEternalNightDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofEternalNightDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofEternalNight : Exhibit
		{
			private ManaGroup Mana2
			{
				get
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					ManaGroup result = default(ManaGroup);
					((ManaGroup)(ref result)).Any = 9;
					return result;
				}
			}

			protected override void OnGain(PlayerUnit player)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				if (!((Enum)((GameEntity)this).GameRun.Puzzles).HasFlag((Enum)(object)(PuzzleFlag)64))
				{
					GameRunController gameRun = ((GameEntity)this).GameRun;
					gameRun.Puzzles = (PuzzleFlag)(gameRun.Puzzles + 64);
				}
				int val = ((Exhibit)this).InitialCounter + ((Exhibit)this).InitialCounter * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / (3f * (float)((Exhibit)this).Value1));
				ManaGroup mana = Mana2;
				((Exhibit)this).Counter = Math.Min(val, ((ManaGroup)(ref mana)).Amount);
			}

			protected override void OnAdded(PlayerUnit player)
			{
				((Exhibit)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
				{
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					//IL_0097: Unknown result type (might be due to invalid IL or missing references)
					if (((GameEntity)this).GameRun.CurrentStage is BambooForest)
					{
						int val = ((Exhibit)this).InitialCounter + ((Exhibit)this).InitialCounter * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / (3f * (float)((Exhibit)this).Value1));
						ManaGroup mana = Mana2;
						((Exhibit)this).Counter = Math.Min(val, ((ManaGroup)(ref mana)).Amount);
					}
				});
			}

			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).ReactBattleEvent<CardsEventArgs>(((Exhibit)this).Battle.CardsAddingToDiscard, (EventSequencedReactor<CardsEventArgs>)OnCards);
					((Exhibit)this).ReactBattleEvent<CardsAddingToDrawZoneEventArgs>(((Exhibit)this).Battle.CardsAddingToDrawZone, (EventSequencedReactor<CardsAddingToDrawZoneEventArgs>)OnCardsAddingToDrawZone);
					((Exhibit)this).ReactBattleEvent<CardsEventArgs>(((Exhibit)this).Battle.CardsAddingToExile, (EventSequencedReactor<CardsEventArgs>)OnCards);
					((Exhibit)this).ReactBattleEvent<CardsEventArgs>(((Exhibit)this).Battle.CardsAddingToHand, (EventSequencedReactor<CardsEventArgs>)OnCards);
				}
			}

			private IEnumerable<BattleAction> OnCards(CardsEventArgs args)
			{
				if (args.Cards.Any((Card c) => c is ManaFreezer))
				{
					args.Cards = CollectionExtensions.AddItem<Card>(args.Cards.Where((Card c) => !(c is ManaFreezer)), (Card)(object)Library.CreateCard<EndlessModeEternalNightDef.EndlessModeEternalNight>(false)).ToArray();
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCardsAddingToDrawZone(CardsAddingToDrawZoneEventArgs args)
			{
				if (args.Cards.Any((Card c) => c is ManaFreezer))
				{
					args.Cards = CollectionExtensions.AddItem<Card>(args.Cards.Where((Card c) => !(c is ManaFreezer)), (Card)(object)Library.CreateCard<EndlessModeEternalNightDef.EndlessModeEternalNight>(false)).ToArray();
				}
				yield break;
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofEternalNight");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_009a: Expected O, but got Unknown
			int num = BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig));
			int? num2 = 3;
			ManaGroup value = default(ManaGroup);
			((ManaGroup)(ref value)).Any = 1;
			return new ExhibitConfig(num, "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, num2, (int?)null, (int?)null, (ManaGroup?)value, (ManaColor?)null, (ManaColor?)null, 0, true, (int?)1, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string> { "EndlessModeEternalNight" });
		}
	}
	public sealed class EndlessModeCurseofFortressDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofFortressDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofFortress : Exhibit
		{
			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).ReactBattleEvent<GameEventArgs>(((Exhibit)this).Battle.BattleStarted, (EventSequencedReactor<GameEventArgs>)OnBattleStarted);
					((Exhibit)this).ReactBattleEvent<UnitEventArgs>(((Exhibit)this).Battle.EnemySpawned, (EventSequencedReactor<UnitEventArgs>)OnEnemySpawned);
				}
			}

			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
			{
				foreach (EnemyUnit enemy in ((Exhibit)this).Battle.AllAliveEnemies)
				{
					yield return (BattleAction)new CastBlockShieldAction((Unit)(object)enemy, 0, ((Unit)enemy).MaxHp, (BlockShieldType)2, false);
				}
			}

			private IEnumerable<BattleAction> OnEnemySpawned(UnitEventArgs args)
			{
				yield return (BattleAction)new CastBlockShieldAction(args.Unit, 0, args.Unit.MaxHp, (BlockShieldType)2, false);
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofFortress");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)0, (Keyword)1024, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofLiberationDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofLiberationDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofLiberation : Exhibit
		{
			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).ReactBattleEvent<GameEventArgs>(((Exhibit)this).Battle.BattleStarted, (EventSequencedReactor<GameEventArgs>)OnBattleStarted);
				}
			}

			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
			{
				if ((int)((Exhibit)this).Battle.EnemyGroup.EnemyType != 3)
				{
					yield break;
				}
				((Exhibit)this).NotifyActivating();
				LimitedDamage statusEffect = default(LimitedDamage);
				foreach (EnemyUnit enemy in ((Exhibit)this).Battle.AllAliveEnemies.Where((EnemyUnit e) => (int)e.Config.Type == 3))
				{
					if (((Unit)enemy).TryGetStatusEffect<LimitedDamage>(ref statusEffect))
					{
						((StatusEffect)statusEffect).Limit = MathExtensions.RoundToInt((float)(((Unit)enemy).MaxHp * ((Exhibit)this).Value1) / 100f);
						((StatusEffect)statusEffect).Count = ((StatusEffect)statusEffect).Limit;
					}
					else
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<LimitedDamage>((Unit)(object)enemy, (int?)null, (int?)null, (int?)null, (int?)MathExtensions.RoundToInt((float)(((Unit)enemy).MaxHp * ((Exhibit)this).Value1) / 100f), 0.1f, true);
					}
					statusEffect = null;
				}
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofLiberation");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)30, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)0, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofMicrotransactionDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofMicrotransactionDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofMicrotransaction : Exhibit
		{
			private List<Type> types = new List<Type>();

			protected override void OnGain(PlayerUnit player)
			{
				((Exhibit)this).Counter = Math.Min(((Exhibit)this).Value1 * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f), ((Exhibit)this).Value2);
			}

			protected override void OnAdded(PlayerUnit player)
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Invalid comparison between Unknown and I4
				((Exhibit)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
				{
					if (((GameEntity)this).GameRun.CurrentStage is BambooForest)
					{
						((Exhibit)this).Counter = Math.Min(((Exhibit)this).Counter + ((Exhibit)this).Value1, ((Exhibit)this).Value2);
						if (BepinexPlugin.EnableCurse.Value)
						{
							foreach (Type type in types)
							{
								CardConfig.FromId(type.Name).MoneyCost = ((Exhibit)this).Counter;
							}
						}
					}
				});
				if (!BepinexPlugin.EnableCurse.Value)
				{
					return;
				}
				foreach (var (item, val) in Library.EnumerateCardTypes())
				{
					if ((int)val.Type == 4 && !val.MoneyCost.HasValue)
					{
						types.Add(item);
					}
				}
				foreach (Type type2 in types)
				{
					CardConfig.FromId(type2.Name).MoneyCost = ((Exhibit)this).Counter;
				}
			}

			protected override void OnRemoved(PlayerUnit player)
			{
				foreach (Type type in types)
				{
					CardConfig.FromId(type.Name).MoneyCost = null;
				}
				types.Clear();
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofMicrotransaction");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)10, (int?)100, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, true, (int?)0, (Keyword)4, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofShuffleDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofShuffleDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofShuffle : Exhibit
		{
			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).ReactBattleEvent<UnitEventArgs>(((Unit)((Exhibit)this).Battle.Player).TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnPlayerTurnStarted);
					((Exhibit)this).ReactBattleEvent<GameEventArgs>(((Exhibit)this).Battle.Reshuffling, (EventSequencedReactor<GameEventArgs>)OnReshuffling);
				}
			}

			private IEnumerable<BattleAction> OnPlayerTurnStarted(UnitEventArgs args)
			{
				((Exhibit)this).Active = true;
				yield break;
			}

			private IEnumerable<BattleAction> OnReshuffling(GameEventArgs args)
			{
				if (((Exhibit)this).Active)
				{
					((Exhibit)this).NotifyActivating();
					((Exhibit)this).Active = false;
				}
				else
				{
					args.CancelBy((GameEntity)(object)this);
				}
				yield break;
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofShuffle");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)0, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofSmallHandDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofSmallHandDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofSmallHand : Exhibit
		{
			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).ReactBattleEvent<GameEventArgs>(((Exhibit)this).Battle.BattleStarted, (EventSequencedReactor<GameEventArgs>)OnBattleStarted);
				}
			}

			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
			{
				yield return (BattleAction)new AddCardsToHandAction((IEnumerable<Card>)Library.CreateCards<EndlessModeBrickDef.EndlessModeBrick>(((Exhibit)this).Value1, false), (AddCardsType)0);
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofSmallHand");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)2, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)null, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string> { "EndlessModeBrick" });
		}
	}
	public sealed class EndlessModeCurseofTenguDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofTenguDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofTengu : Exhibit
		{
			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).HandleBattleEvent<DamageDealingEventArgs>(((Unit)((Exhibit)this).Battle.Player).DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnPlayerDamageDealing, (GameEventPriority)99);
					((Exhibit)this).HandleBattleEvent<DamageEventArgs>(((Unit)((Exhibit)this).Battle.Player).DamageReceiving, (GameEventHandler<DamageEventArgs>)OnPlayerDamageReceiving, (GameEventPriority)99);
				}
			}

			private void OnPlayerDamageDealing(DamageDealingEventArgs args)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: 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)
				//IL_0020: Invalid comparison between Unknown and I4
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				if (((Exhibit)this).Battle.RoundCounter % 2 == 1)
				{
					DamageInfo damageInfo = args.DamageInfo;
					if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
					{
						DamageInfo damageInfo2 = args.DamageInfo;
						((DamageInfo)(ref damageInfo2)).IsAccuracy = false;
						args.DamageInfo = damageInfo2;
						((GameEventArgs)args).AddModifier((GameEntity)(object)this);
					}
				}
			}

			private void OnPlayerDamageReceiving(DamageEventArgs args)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Invalid comparison between Unknown and I4
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				if (((Exhibit)this).Battle.RoundCounter % 2 == 0)
				{
					DamageInfo damageInfo = args.DamageInfo;
					if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
					{
						DamageInfo damageInfo2 = args.DamageInfo;
						((DamageInfo)(ref damageInfo2)).IsAccuracy = true;
						args.DamageInfo = damageInfo2;
						((GameEventArgs)args).AddModifier((GameEntity)(object)this);
					}
				}
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofTengu");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, false, (int?)0, (Keyword)256, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeCurseofUnmotivatedDef : ExhibitTemplate
	{
		[EntityLogic(typeof(EndlessModeCurseofUnmotivatedDef))]
		[UsedImplicitly]
		public sealed class EndlessModeCurseofUnmotivated : Exhibit
		{
			protected override void OnGain(PlayerUnit player)
			{
				((Exhibit)this).Counter = ((Exhibit)this).Value1 * MathExtensions.TruncateToInt((float)(((GameEntity)this).GameRun._stageIndex - (((GameEntity)this).GameRun._stages.Count((Stage s) => s is FinalStage) - ((((GameEntity)this).GameRun.CurrentStage is BambooForest) ? 1 : 0))) / 3f);
			}

			protected override void OnAdded(PlayerUnit player)
			{
				((Exhibit)this).HandleGameRunEvent<GameEventArgs>(((GameEntity)this).GameRun.StageEntered, (GameEventHandler<GameEventArgs>)delegate
				{
					if (((GameEntity)this).GameRun.CurrentStage is BambooForest)
					{
						((Exhibit)this).Counter = Math.Min(((Exhibit)this).Counter + ((Exhibit)this).Value1, ((Exhibit)this).Value2);
					}
				});
			}

			protected override void OnEnterBattle()
			{
				if (BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Active = true;
					((Exhibit)this).ReactBattleEvent<UsUsingEventArgs>(((Exhibit)this).Battle.UsUsed, (EventSequencedReactor<UsUsingEventArgs>)OnUsUsed);
					((Exhibit)this).HandleBattleEvent<DamageDealingEventArgs>(((Unit)((Exhibit)this).Battle.Player).DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnPlayerDamageDealing);
				}
			}

			private IEnumerable<BattleAction> OnUsUsed(UsUsingEventArgs args)
			{
				((Exhibit)this).NotifyActivating();
				((Exhibit)this).Active = false;
				yield break;
			}

			private void OnPlayerDamageDealing(DamageDealingEventArgs args)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Invalid comparison between Unknown and I4
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				if (((Exhibit)this).Active)
				{
					DamageInfo damageInfo = args.DamageInfo;
					if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
					{
						((DamageInfo)(ref damageInfo)).Damage = ((DamageInfo)(ref damageInfo)).Amount * (1f - (float)((Exhibit)this).Counter / 100f);
						args.DamageInfo = damageInfo;
						((GameEventArgs)args).AddModifier((GameEntity)(object)this);
					}
				}
			}

			protected override void OnLeaveBattle()
			{
				((Exhibit)this).Active = false;
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeCurseofUnmotivated");
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			string folder = "";
			ExhibitSprites val = new ExhibitSprites();
			Func<string, Sprite> func = (string s) => ResourceLoader.LoadSprite(folder + IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + s + ".png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
			val.main = func("");
			return val;
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			return new ExhibitConfig(BepinexPlugin.sequenceTable.Next(typeof(ExhibitConfig)), "", 0, false, false, false, false, (AppearanceType)3, "", (ExhibitLosableType)2, (Rarity)4, (int?)5, (int?)50, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)null, 0, true, (int?)0, (Keyword)0, (IReadOnlyList<string>)new List<string> { "EndlessModeCurseSe" }, (IReadOnlyList<string>)new List<string>());
		}
	}
}
namespace EndlessMode.Cards
{
	public sealed class EndlessModeBrickDef : CardTemplate
	{
		[EntityLogic(typeof(EndlessModeBrickDef))]
		public sealed class EndlessModeBrick : Card
		{
			public override bool CanUse => false;

			protected override void OnEnterBattle(BattleController battle)
			{
				((Card)this).ReactBattleEvent<CardsEventArgs>(((Card)this).Battle.CardsAddingToDiscard, (EventSequencedReactor<CardsEventArgs>)OnCards);
				((Card)this).ReactBattleEvent<CardsAddingToDrawZoneEventArgs>(((Card)this).Battle.CardsAddingToDrawZone, (EventSequencedReactor<CardsAddingToDrawZoneEventArgs>)OnCardsAddingToDrawZone);
				((Card)this).ReactBattleEvent<CardsEventArgs>(((Card)this).Battle.CardsAddingToExile, (EventSequencedReactor<CardsEventArgs>)OnCards);
				((Card)this).ReactBattleEvent<CardsEventArgs>(((Card)this).Battle.CardsAddingToHand, (EventSequencedReactor<CardsEventArgs>)OnCards);
				((Card)this).ReactBattleEvent<CardEventArgs>(((Card)this).Battle.CardDiscarding, (EventSequencedReactor<CardEventArgs>)OnCard);
				((Card)this).ReactBattleEvent<CardEventArgs>(((Card)this).Battle.CardExiling, (EventSequencedReactor<CardEventArgs>)OnCard);
				((Card)this).ReactBattleEvent<CardMovingEventArgs>(((Card)this).Battle.CardMoving, (EventSequencedReactor<CardMovingEventArgs>)OnCardMoving);
				((Card)this).ReactBattleEvent<CardMovingToDrawZoneEventArgs>(((Card)this).Battle.CardMovingToDrawZone, (EventSequencedReactor<CardMovingToDrawZoneEventArgs>)OnCardMovingToDrawZone);
				((Card)this).ReactBattleEvent<CardEventArgs>(((Card)this).Battle.CardRemoving, (EventSequencedReactor<CardEventArgs>)OnCard);
				((Card)this).ReactBattleEvent<CardTransformEventArgs>(((Card)this).Battle.CardTransforming, (EventSequencedReactor<CardTransformEventArgs>)OnCardTransforming);
			}

			private IEnumerable<BattleAction> OnCards(CardsEventArgs args)
			{
				if (args.Cards.Any((Card c) => c is EndlessModeBrick))
				{
					args.Cards = args.Cards.Where((Card c) => c != this).ToArray();
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCardsAddingToDrawZone(CardsAddingToDrawZoneEventArgs args)
			{
				if (args.Cards.Any((Card c) => c is EndlessModeBrick))
				{
					args.Cards = args.Cards.Where((Card c) => c != this).ToArray();
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCard(CardEventArgs args)
			{
				if (args.Card == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCardMoving(CardMovingEventArgs args)
			{
				if (args.Card == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCardMovingToDrawZone(CardMovingToDrawZoneEventArgs args)
			{
				if (args.Card == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCardTransforming(CardTransformEventArgs args)
			{
				if (args.SourceCard == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeBrick");
		}

		public override CardImages LoadCardImages()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			CardImages val = new CardImages(BepinexPlugin.embeddedSource);
			val.AutoLoad((CardTemplate)(object)this, ".png", "Resources.", false);
			return val;
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.cardLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override CardConfig MakeConfig()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			return new CardConfig(BepinexPlugin.sequenceTable.Next(typeof(CardConfig)), "", 10, true, new string[0][], "Simple1", "Simple1", 0, false, false, false, false, false, (Rarity)0, (CardType)7, (TargetType?)(TargetType)0, (IReadOnlyList<ManaColor>)new List<ManaColor>(), false, default(ManaGroup), (ManaGroup?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaGroup?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (Keyword)2129936, (Keyword)2129936, false, (Keyword)65536, (Keyword)65536, (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (string)null, "", "", false, (string)null, (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeEternalNightDef : CardTemplate
	{
		[EntityLogic(typeof(EndlessModeEternalNightDef))]
		public sealed class EndlessModeEternalNight : Card
		{
			private ManaGroup Mana2
			{
				get
				{
					//IL_004c: 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_005c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0023: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Unknown result type (might be due to invalid IL or missing references)
					ManaGroup result;
					if (((GameEntity)this).GameRun != null && ((GameEntity)this).GameRun.Player.HasExhibit<EndlessModeCurseofEternalNightDef.EndlessModeCurseofEternalNight>())
					{
						result = default(ManaGroup);
						((ManaGroup)(ref result)).Any = ((Exhibit)((GameEntity)this).GameRun.Player.GetExhibit<EndlessModeCurseofEternalNightDef.EndlessModeCurseofEternalNight>()).Counter;
						return result;
					}
					result = default(ManaGroup);
					((ManaGroup)(ref result)).Any = 1;
					return result;
				}
			}

			protected override void OnEnterBattle(BattleController battle)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				BattleController battle2 = ((Card)this).Battle;
				ManaGroup mana = Mana2;
				battle2.ManaFreezeLevel = ((ManaGroup)(ref mana)).Amount;
				((Card)this).HandleBattleEvent<UnitEventArgs>(((Unit)((Card)this).Battle.Player).TurnStarted, (GameEventHandler<UnitEventArgs>)OnPlayerTurnStarted, (GameEventPriority)0);
				((Card)this).ReactBattleEvent<CardEventArgs>(((Card)this).Battle.CardExiling, (EventSequencedReactor<CardEventArgs>)OnCard);
				((Card)this).ReactBattleEvent<CardEventArgs>(((Card)this).Battle.CardRemoving, (EventSequencedReactor<CardEventArgs>)OnCard);
				((Card)this).ReactBattleEvent<CardTransformEventArgs>(((Card)this).Battle.CardTransforming, (EventSequencedReactor<CardTransformEventArgs>)OnCardTransforming);
			}

			private void OnPlayerTurnStarted(UnitEventArgs args)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				BattleController battle = ((Card)this).Battle;
				ManaGroup mana = Mana2;
				battle.ManaFreezeLevel = ((ManaGroup)(ref mana)).Amount;
			}

			private IEnumerable<BattleAction> OnCard(CardEventArgs args)
			{
				if (args.Card == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}

			private IEnumerable<BattleAction> OnCardTransforming(CardTransformEventArgs args)
			{
				if (args.SourceCard == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeEternalNight");
		}

		public override CardImages LoadCardImages()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			CardImages val = new CardImages(BepinexPlugin.embeddedSource);
			val.AutoLoad((CardTemplate)(object)this, ".png", "Resources.", false);
			return val;
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.cardLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override CardConfig MakeConfig()
		{
			//IL_0043: 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_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			int num = BepinexPlugin.sequenceTable.Next(typeof(CardConfig));
			string[][] array = new string[0][];
			TargetType? val = (TargetType)0;
			List<ManaColor> list = new List<ManaColor>();
			ManaGroup val2 = default(ManaGroup);
			((ManaGroup)(ref val2)).Any = 9;
			return new CardConfig(num, "", 10, true, array, "Simple1", "Simple1", 0, false, false, false, false, false, (Rarity)1, (CardType)7, val, (IReadOnlyList<ManaColor>)list, false, val2, (ManaGroup?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaGroup?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (Keyword)2129936, (Keyword)2129936, false, (Keyword)65536, (Keyword)65536, (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (string)null, "", "", false, "asakura masatoki", (IReadOnlyList<string>)new List<string>());
		}
	}
	public sealed class EndlessModeTeleportGapDef : CardTemplate
	{
		[EntityLogic(typeof(EndlessModeTeleportGapDef))]
		public sealed class EndlessModeTeleportGap : Card
		{
			private class Overrider : IMapModeOverrider
			{
				private readonly GameRunController _gameRun;

				public GameRunMapMode? MapMode => (GameRunMapMode)2;

				public Overrider(GameRunController gameRun)
				{
					_gameRun = gameRun;
				}

				public void OnEnteredWithMode()
				{
					_gameRun.RemoveMapModeOverrider((IMapModeOverrider)(object)this);
				}
			}

			protected override IEnumerable<BattleAction> Actions(UnitSelector selector, ManaGroup consumingMana, Interaction precondition)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if (!(((GameEntity)this).GameRun.CurrentStation is BossStation))
				{
					((GameEntity)this).GameRun.AddMapModeOverrider((IMapModeOverrider)(object)new Overrider(((GameEntity)this).GameRun));
					((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(coroutine());
					((Card)this).Battle.InstantWin();
				}
				yield break;
			}

			private IEnumerator coroutine()
			{
				yield return (object)new WaitUntil((Func<bool>)(() => (int)((GameEntity)this).GameRun.CurrentStation.Status == 4));
				GameMaster.TeleportToBossNode();
			}
		}

		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("EndlessModeTeleportGap");
		}

		public override CardImages LoadCardImages()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			CardImages val = new CardImages(BepinexPlugin.embeddedSource);
			val.AutoLoad((CardTemplate)(object)this, ".png", "Resources.", false);
			return val;
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.cardLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override CardConfig MakeConfig()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			int num = BepinexPlugin.sequenceTable.Next(typeof(CardConfig));
			string[][] array = new string[0][];
			TargetType? val = (TargetType)0;
			List<ManaColor> list = new List<ManaColor>();
			ManaGroup val2 = default(ManaGroup);
			((ManaGroup)(ref val2)).Any = 0;
			return new CardConfig(num, "", 10, true, array, "Simple1", "Simple1", 0, false, false, false, false, false, (Rarity)0, (CardType)6, val, (IReadOnlyList<ManaColor>)list, false, val2, (ManaGroup?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (ManaGroup?)null, (ManaGroup?)null, (int?)null, (int?)null, (int?)1, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (Keyword)9961472, (Keyword)9961472, false, (Keyword)0, (Keyword)0, (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>(), (string)null, "", "", false, "piyodesu", (IReadOnlyList<string>)new List<string>());
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}