Decompiled source of Endless Mode v0.5.2

EndlessMode.dll

Decompiled a day 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 Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.CompilerServices;
using EndlessMode.Cards;
using EndlessMode.EnemyUnits;
using EndlessMode.Exhibits;
using EndlessMode.JadeBoxes;
using EndlessMode.Stages;
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.Character;
using LBoL.EntityLib.EnemyUnits.Normal;
using LBoL.EntityLib.Exhibits.Adventure;
using LBoL.EntityLib.Exhibits.Common;
using LBoL.EntityLib.Stages.NormalStages;
using LBoL.EntityLib.StatusEffects.Cirno;
using LBoL.EntityLib.StatusEffects.Enemy;
using LBoL.EntityLib.StatusEffects.Enemy.Seija;
using LBoL.Presentation;
using LBoL.Presentation.Environments;
using LBoL.Presentation.UI;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.UI.Widgets;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.PersistentValues;
using LBoLEntitySideloader.Resource;
using LBoLEntitySideloader.Utils;
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.5.2")]
	[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
		{
			[CompilerGenerated]
			private sealed class <coroutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

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

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

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

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

				private bool MoveNext()
				{
					//IL_0040: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Expected O, but got Unknown
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = (object)new WaitUntil((Func<bool>)(() => UiManager.GetPanel<MapPanel>()._map != null));
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						UiManager.GetPanel<MapPanel>().FinalWidget.SetBoss("EndlessModeYuyuko");
						return false;
					}
				}

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

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

			private static void Postfix(UiManager __instance, ref GameRunController gameRun)
			{
				if (gameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					if (((IEnumerable<JadeBox>)gameRun.JadeBoxes).FirstOrDefault((Func<JadeBox, bool>)((JadeBox j) => j is EndlessModeJadeBox)) is EndlessModeJadeBox endlessModeJadeBox && endlessModeJadeBox.yuyukoQueue)
					{
						gameRun.Stages.Last((Stage s) => s is XuanwuRavine).Boss = Library.GetEnemyGroupEntry("EndlessModeYuyuko");
						if (gameRun.Stages.Last((Stage s) => s is XuanwuRavine) == gameRun.CurrentStage)
						{
							((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(coroutine());
						}
					}
					CardConfig.FromId("EndlessModeTeleportGap").IsPooled = true;
				}
				else
				{
					CardConfig.FromId("EndlessModeTeleportGap").IsPooled = false;
				}
			}

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

		[HarmonyPatch(typeof(AudioManager), "EnterStage")]
		private class AudioManager_EnterStage_Patch
		{
			private static bool Prefix(AudioManager __instance, ref int level, ref bool intoLayer0)
			{
				GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
				object obj;
				if (currentGameRun == null)
				{
					obj = null;
				}
				else
				{
					Stage currentStage = currentGameRun.CurrentStage;
					if (currentStage == null)
					{
						obj = null;
					}
					else
					{
						EnemyGroupEntry boss = currentStage.Boss;
						obj = ((boss != null) ? boss.Id : null);
					}
				}
				if ((string?)obj == "EndlessModeYuyuko")
				{
					intoLayer0 = true;
					AudioManager.GuardedGetInstance().StopUiBgm();
					string text = "EndlessModeYuyukoStageBgm";
					if (intoLayer0)
					{
						if (text != Singleton<AudioManager>.Instance.layer0Id)
						{
							Singleton<AudioManager>.Instance.layer0Id = text;
							Singleton<AudioManager>.Instance.layer0Time = 0f;
							Singleton<AudioManager>.Instance.inLayer0 = true;
							AudioManager.PlayBgm(Singleton<AudioManager>.Instance.layer0Id, 0f, true);
							return false;
						}
						if (!Singleton<AudioManager>.Instance.inLayer0)
						{
							AudioManager.EnterLayer0();
							return false;
						}
					}
					else
					{
						Singleton<AudioManager>.Instance.layer0Id = text;
						Singleton<AudioManager>.Instance.layer0Time = 0f;
					}
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(AudioManager), "PlayAdventureBgm")]
		private class AudioManager_PlayAdventureBgm_Patch
		{
			private static bool Prefix(AudioManager __instance, ref int index)
			{
				GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
				object obj;
				if (currentGameRun == null)
				{
					obj = null;
				}
				else
				{
					Stage currentStage = currentGameRun.CurrentStage;
					if (currentStage == null)
					{
						obj = null;
					}
					else
					{
						EnemyGroupEntry boss = currentStage.Boss;
						obj = ((boss != null) ? boss.Id : null);
					}
				}
				if ((string?)obj == "EndlessModeYuyuko")
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(AudioManager), "PlayEliteBgm")]
		private class AudioManager_PlayEliteBgm_Patch
		{
			private static bool Prefix(AudioManager __instance, ref string enemyId)
			{
				GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
				object obj;
				if (currentGameRun == null)
				{
					obj = null;
				}
				else
				{
					Stage currentStage = currentGameRun.CurrentStage;
					if (currentStage == null)
					{
						obj = null;
					}
					else
					{
						EnemyGroupEntry boss = currentStage.Boss;
						obj = ((boss != null) ? boss.Id : null);
					}
				}
				if ((string?)obj == "EndlessModeYuyuko")
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(VnPanel), "PlayStageBgm")]
		private class VnPanel_PlayStageBgm_Patch
		{
			private static bool Prefix(VnPanel __instance)
			{
				GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
				object obj;
				if (currentGameRun == null)
				{
					obj = null;
				}
				else
				{
					Stage currentStage = currentGameRun.CurrentStage;
					if (currentStage == null)
					{
						obj = null;
					}
					else
					{
						EnemyGroupEntry boss = currentStage.Boss;
						obj = ((boss != null) ? boss.Id : null);
					}
				}
				if ((string?)obj == "EndlessModeYuyuko")
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private class Stage_EternalStageMusic_Getter_Patch
		{
			private static bool Prefix(Stage __instance, ref bool __result)
			{
				GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
				object obj;
				if (currentGameRun == null)
				{
					obj = null;
				}
				else
				{
					Stage currentStage = currentGameRun.CurrentStage;
					if (currentStage == null)
					{
						obj = null;
					}
					else
					{
						EnemyGroupEntry boss = currentStage.Boss;
						obj = ((boss != null) ? boss.Id : null);
					}
				}
				if ((string?)obj == "EndlessModeYuyuko")
				{
					__result = true;
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(StatusEffect), "ClampMax")]
		private class StatusEffect_ClampMax_Patch
		{
			private static bool Prefix(StatusEffect __instance)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && 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 != null && 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 != null && 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 != null && 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 != null && 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 != 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
				//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(Baota), "GapOption")]
		private class Baota_GapOption_Patch
		{
			private static bool Prefix(Baota __instance)
			{
				if (((Exhibit)__instance).Counter >= 3 && 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))
				{
					int num = 0;
					if (((Exhibit)__instance).Counter > 3)
					{
						num = ((Exhibit)__instance).Counter - 3;
						((Exhibit)__instance).Counter = ((Exhibit)__instance).Counter - num;
					}
					num++;
					while (num > 0)
					{
						Exhibit val = ((IEnumerable<Exhibit>)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits).FirstOrDefault((Func<Exhibit, bool>)((Exhibit e) => e is Baota && e.Counter < 3));
						if (val != null)
						{
							int num2 = 3 - val.Counter;
							val.Counter += Math.Min(num, num2);
							val.NotifyActivating();
							num -= num2;
							continue;
						}
						break;
					}
					return false;
				}
				return true;
			}
		}

		[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
		{
			[CompilerGenerated]
			private sealed class <coroutine>d__0 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public GapOptionsPanel __instance;

				private List<Card> <list>5__1;

				private SelectCardInteraction <interaction>5__2;

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

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

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

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

				private bool MoveNext()
				{
					//IL_0094: Unknown result type (might be due to invalid IL or missing references)
					//IL_0099: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a6: Expected O, but got Unknown
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<list>5__1 = Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeckWithoutUnremovable.ToList();
						if (<list>5__1.Count > 0)
						{
							<interaction>5__2 = new SelectCardInteraction(1, Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count((Exhibit e) => e is ShoushiYubi), (IEnumerable<Card>)<list>5__1, (SelectedCardHandling)0)
							{
								CanCancel = true
							};
							<>2__current = Singleton<GameMaster>.Instance.CurrentGameRun.InteractionViewer.View((Interaction)(object)<interaction>5__2);
							<>1__state = 1;
							return true;
						}
						break;
					case 1:
						<>1__state = -1;
						if (!((Interaction)<interaction>5__2).IsCanceled)
						{
							Singleton<GameMaster>.Instance.CurrentGameRun.RemoveDeckCards((IEnumerable<Card>)<interaction>5__2.SelectedCards, true);
							__instance.SelectedAndHide();
							AudioManager.PlayUi("Jingshen", false);
						}
						<interaction>5__2 = null;
						break;
					}
					return false;
				}

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

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

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

			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();
			}
		}

		[HarmonyPatch(typeof(SystemBoard), "ResetExhibits")]
		private class SystemBoard_ResetExhibits_Patch
		{
			private static void Prefix(SystemBoard __instance, ref IEnumerable<Exhibit> exhibits)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun == null || !Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>())
				{
					return;
				}
				List<Exhibit> list = Singleton<GameMaster>.Instance.CurrentGameRun.Player._exhibits.OrderBy((Exhibit e) => e.Config.Index).ToList();
				Singleton<GameMaster>.Instance.CurrentGameRun.Player._exhibits.Clear();
				foreach (Exhibit item in list)
				{
					Singleton<GameMaster>.Instance.CurrentGameRun.Player._exhibits.Add(item);
				}
				exhibits = list;
			}
		}

		[HarmonyPatch(typeof(Environment), "LoadEnvironment", new Type[] { typeof(string) })]
		private class Environment_LoadEnvironment_Patch
		{
			private static void Prefix(Environment __instance, ref string environmentId)
			{
				if ((environmentId == "XuanwuRavine1" || environmentId == "XuanwuRavine3") && Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.HasJadeBox<EndlessModeJadeBox>() && Singleton<GameMaster>.Instance.CurrentGameRun.CurrentStage.Boss.Id == "EndlessModeYuyuko")
				{
					int stationLevel = Environment.StationLevel;
					int num = stationLevel;
					if (Environment.StationLevel < 1)
					{
						environmentId = "EndlessModeHakugyokurou1";
					}
					else if (Environment.StationLevel < 6)
					{
						environmentId = "EndlessModeHakugyokurou1";
					}
					else if (Environment.StationLevel < 11)
					{
						environmentId = "EndlessModeHakugyokurou2";
					}
					else if (Environment.StationLevel < 16)
					{
						environmentId = "EndlessModeHakugyokurou2";
					}
					else if (Environment.StationLevel >= 16)
					{
						environmentId = "EndlessModeHakugyokurou3";
					}
				}
			}
		}

		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 AssetBundle endlessMode;

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

		internal static BatchLocalization enemyUnitLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(EnemyUnitTemplate), 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);

		internal static BatchLocalization unitModelLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(UnitModelTemplate), 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. Disabling it will not prevent Curses from appearing, it will only remove the curse's effects.\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();
			}
			endlessMode = ResourceLoader.LoadAssetBundle("endlessMode", directorySource);
			EndlessModeBackgrounds.AddEndlessModeBackgrounds();
			cardLoc.DiscoverAndLoadLocFiles("Card");
			enemyUnitLoc.DiscoverAndLoadLocFiles("EnemyUnit");
			exhibitLoc.DiscoverAndLoadLocFiles("Exhibit");
			jadeBoxLoc.DiscoverAndLoadLocFiles("JadeBox");
			statusEffectLoc.DiscoverAndLoadLocFiles("StatusEffect");
			unitModelLoc.DiscoverAndLoadLocFiles("UnitModel");
			((CustomGameRunSaveData)new EndlessModeSaveData()).RegisterSelf("intoxicatedkid.endlessmode");
		}

		private void OnDestroy()
		{
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			AssetBundle obj2 = endlessMode;
			if (obj2 != null)
			{
				obj2.Unload(false);
			}
		}
	}
	public sealed class EndlessModeSaveData : CustomGameRunSaveData
	{
		public bool YuyukoQueue = false;

		public bool YuyukoDefeated = false;

		public override void Restore(GameRunController gameRun)
		{
			if (((IEnumerable<JadeBox>)gameRun.JadeBoxes).FirstOrDefault((Func<JadeBox, bool>)((JadeBox j) => j is EndlessModeJadeBox)) is EndlessModeJadeBox endlessModeJadeBox)
			{
				endlessModeJadeBox.yuyukoQueue = YuyukoQueue;
				endlessModeJadeBox.yuyukoDefeated = YuyukoDefeated;
			}
		}

		public override void Save(GameRunController gameRun)
		{
			if (((IEnumerable<JadeBox>)gameRun.JadeBoxes).FirstOrDefault((Func<JadeBox, bool>)((JadeBox j) => j is EndlessModeJadeBox)) is EndlessModeJadeBox endlessModeJadeBox)
			{
				YuyukoQueue = endlessModeJadeBox.yuyukoQueue;
				YuyukoDefeated = endlessModeJadeBox.yuyukoDefeated;
			}
		}
	}
	public class NoMetaScalinAPIWrap
	{
		[CompilerGenerated]
		private sealed class <InteractWithNoMetaScaling>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => Singleton<GameMaster>.Instance.CurrentGameRun != null));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (NoMetaScalinAPI.GetCancelEnnabled(Singleton<GameMaster>.Instance.CurrentGameRun))
					{
						Debug.Log((object)"NoMetaScaling has been Disabled.");
						NoMetaScalinAPI.SetCancelEnnabled(Singleton<GameMaster>.Instance.CurrentGameRun, false);
					}
					return false;
				}
			}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		[IteratorStateMachine(typeof(<InteractWithNoMetaScaling>d__0))]
		public static IEnumerator InteractWithNoMetaScaling()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InteractWithNoMetaScaling>d__0(0);
		}
	}
	public static class PInfo
	{
		public const string GUID = "intoxicatedkid.endlessmode";

		public const string Name = "Endless Mode";

		public const string version = "0.5.2";

		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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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>(), (string)null, "Default", "Default", "Default");
		}
	}
}
namespace EndlessMode.Stages
{
	public static class EndlessModeBackgrounds
	{
		public const string EndlessModeHakugyokurou1 = "EndlessModeHakugyokurou1";

		public const string EndlessModeHakugyokurou2 = "EndlessModeHakugyokurou2";

		public const string EndlessModeHakugyokurou3 = "EndlessModeHakugyokurou3";

		public const string EndlessModeHakugyokurou4 = "EndlessModeHakugyokurou4";

		public static void AddEndlessModeBackgrounds()
		{
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("EndlessModeHakugyokurou1", BepinexPlugin.endlessMode.LoadAsset<Sprite>("EndlessModeHakugyokurou1.png")), true, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform4 = self.transform;
				transform4.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("EndlessModeHakugyokurou2", BepinexPlugin.endlessMode.LoadAsset<Sprite>("EndlessModeHakugyokurou2.png")), true, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform3 = self.transform;
				transform3.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("EndlessModeHakugyokurou3", BepinexPlugin.endlessMode.LoadAsset<Sprite>("EndlessModeHakugyokurou3.png")), true, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform2 = self.transform;
				transform2.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("EndlessModeHakugyokurou4", BepinexPlugin.endlessMode.LoadAsset<Sprite>("EndlessModeHakugyokurou4.png")), true, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform = self.transform;
				transform.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
		}
	}
}
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;
				}
			}
		}

		[CompilerGenerated]
		private sealed class <<OnAdded>g__coroutine|7_5>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <<OnAdded>g__coroutine|7_5>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => ((UiBase)UiManager.GetPanel<MapPanel>()).IsVisible));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((UiPanelBase)UiManager.GetPanel<MapPanel>()).Hide();
					return false;
				}
			}

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

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

		public static bool wait;

		public bool yuyukoQueue = false;

		public bool yuyukoDefeated = false;

		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"))
			{
				((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(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
			{
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Expected O, but got Unknown
				//IL_0458: Unknown result type (might be due to invalid IL or missing references)
				//IL_045d: Unknown result type (might be due to invalid IL or missing references)
				//IL_046f: Unknown result type (might be due to invalid IL or missing references)
				//IL_047c: Expected O, but got Unknown
				((GameEntity)this).GameRun.CurrentStage.Index = ((GameEntity)this).GameRun._stageIndex;
				int num = ((GameEntity)this).GameRun.Player.Exhibits.Count((Exhibit e) => e.Config.RelativeEffects.Contains("EndlessModeCurseSe"));
				if (((GameEntity)this).GameRun.CurrentStage == ((GameEntity)this).GameRun._stages.Last() && ((GameEntity)this).GameRun.CurrentStation.IsStageEnd)
				{
					((GameEntity)this).GameRun.CurrentStation.IsNormalEnd = false;
					((GameEntity)this).GameRun.CurrentStation.IsTrueEnd = false;
					RandomGen val = new RandomGen(RandomGen.GetRandomSeed());
					Stage val2 = (Stage)(object)Library.CreateStage<BambooForest>();
					((GameEntity)val2).GameRun = ((GameEntity)this).GameRun;
					val2.MapSeed = val.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 = val.NextULong();
					if (val.NextInt(1, 100) <= Math.Min((num + 1) * 5, 50))
					{
						val3.Boss = Library.GetEnemyGroupEntry("EndlessModeYuyuko");
						yuyukoQueue = true;
					}
					else
					{
						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 = val.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 = val.NextULong();
						val5.InitBoss(val);
						val5.InitFirstAdventure(val);
						((GameEntity)this).GameRun._stages.Add(val5);
					}
				}
				if (yuyukoDefeated)
				{
					yuyukoDefeated = false;
					yuyukoQueue = false;
				}
				int num2 = 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("EndlessModeCurseSe")) < num2)
				{
					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)
					{
						((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(coroutine());
						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);
								}
							};
						});
					}
				}
			});
			[IteratorStateMachine(typeof(<<OnAdded>g__coroutine|7_5>d))]
			static IEnumerator coroutine()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<OnAdded>g__coroutine|7_5>d(0);
			}
		}

		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)));
				}
				EnemyGroupEntry boss = ((GameEntity)this).GameRun.CurrentStage.Boss;
				if (((boss != null) ? boss.Id : null) == "EndlessModeYuyuko")
				{
					((GameEntity)this).React(Reactor.op_Implicit((BattleAction)(object)new ApplyStatusEffectAction<EndlessModeYuyukoBuffSeDef.EndlessModeYuyukoBuffSe>((Unit)(object)allAliveEnemy, (int?)null, (int?)null, (int?)null, (int?)null, 0f, true)));
				}
				((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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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) && !(args.Effect is Curiosity) && !(args.Effect is PowerByDefense) && !(args.Effect is Immune) && (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 * (1f - (float)((Exhibit)Singleton<GameMaster>.Instance.CurrentGameRun.Player.GetExhibit<EndlessModeCurseofBattery>()).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)
			{
				if (!BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Blackout = true;
				}
				((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 * (1f - (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)
			{
				if (!BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Blackout = true;
				}
				((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)
			{
				if (!BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Blackout = true;
				}
				((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
		{
			[CompilerGenerated]
			private sealed class <OnBattleStarted>d__2 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private BattleAction <>2__current;

				private int <>l__initialThreadId;

				private GameEventArgs args;

				public GameEventArgs <>3__args;

				public EndlessModeCurseofChaos <>4__this;

				private ManaFreezer <manaFreezer>5__1;

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

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

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

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

				private bool MoveNext()
				{
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0057: Expected O, but got Unknown
					if (<>1__state != 0)
					{
						return false;
					}
					<>1__state = -1;
					<manaFreezer>5__1 = (ManaFreezer)((IEnumerable<Card>)((Exhibit)<>4__this).Battle.HandZone).FirstOrDefault((Func<Card, bool>)((Card c) => c is ManaFreezer));
					if (<manaFreezer>5__1 != null)
					{
						ManaFreezer obj = <manaFreezer>5__1;
						obj.FreezeTimes += ((Exhibit)<>4__this).Counter;
					}
					return false;
				}

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

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

				[DebuggerHidden]
				IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator()
				{
					<OnBattleStarted>d__2 <OnBattleStarted>d__;
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						<OnBattleStarted>d__ = this;
					}
					else
					{
						<OnBattleStarted>d__ = new <OnBattleStarted>d__2(0)
						{
							<>4__this = <>4__this
						};
					}
					<OnBattleStarted>d__.args = <>3__args;
					return <OnBattleStarted>d__;
				}

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

			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);
			}

			[IteratorStateMachine(typeof(<OnBattleStarted>d__2))]
			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <OnBattleStarted>d__2(-2)
				{
					<>4__this = this,
					<>3__args = args
				};
			}
		}

		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
		{
			[CompilerGenerated]
			private sealed class <OnCards>d__5 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private BattleAction <>2__current;

				private int <>l__initialThreadId;

				private CardsEventArgs args;

				public CardsEventArgs <>3__args;

				public EndlessModeCurseofEternalNight <>4__this;

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

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

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

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

				private bool MoveNext()
				{
					if (<>1__state != 0)
					{
						return false;
					}
					<>1__state = -1;
					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();
					}
					return false;
				}

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

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

				[DebuggerHidden]
				IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator()
				{
					<OnCards>d__5 <OnCards>d__;
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						<OnCards>d__ = this;
					}
					else
					{
						<OnCards>d__ = new <OnCards>d__5(0)
						{
							<>4__this = <>4__this
						};
					}
					<OnCards>d__.args = <>3__args;
					return <OnCards>d__;
				}

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

			[CompilerGenerated]
			private sealed class <OnCardsAddingToDrawZone>d__6 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private BattleAction <>2__current;

				private int <>l__initialThreadId;

				private CardsAddingToDrawZoneEventArgs args;

				public CardsAddingToDrawZoneEventArgs <>3__args;

				public EndlessModeCurseofEternalNight <>4__this;

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

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

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

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

				private bool MoveNext()
				{
					if (<>1__state != 0)
					{
						return false;
					}
					<>1__state = -1;
					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();
					}
					return false;
				}

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

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

				[DebuggerHidden]
				IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator()
				{
					<OnCardsAddingToDrawZone>d__6 <OnCardsAddingToDrawZone>d__;
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						<OnCardsAddingToDrawZone>d__ = this;
					}
					else
					{
						<OnCardsAddingToDrawZone>d__ = new <OnCardsAddingToDrawZone>d__6(0)
						{
							<>4__this = <>4__this
						};
					}
					<OnCardsAddingToDrawZone>d__.args = <>3__args;
					return <OnCardsAddingToDrawZone>d__;
				}

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

			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)
			{
				if (!BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Blackout = true;
				}
				((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);
				}
			}

			[IteratorStateMachine(typeof(<OnCards>d__5))]
			private IEnumerable<BattleAction> OnCards(CardsEventArgs args)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <OnCards>d__5(-2)
				{
					<>4__this = this,
					<>3__args = args
				};
			}

			[IteratorStateMachine(typeof(<OnCardsAddingToDrawZone>d__6))]
			private IEnumerable<BattleAction> OnCardsAddingToDrawZone(CardsAddingToDrawZoneEventArgs args)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <OnCardsAddingToDrawZone>d__6(-2)
				{
					<>4__this = this,
					<>3__args = args
				};
			}
		}

		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
		{
			[CompilerGenerated]
			private sealed class <OnBattleStarted>d__2 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private BattleAction <>2__current;

				private int <>l__initialThreadId;

				private GameEventArgs args;

				public GameEventArgs <>3__args;

				public EndlessModeCurseofFortress <>4__this;

				private IEnumerator<EnemyUnit> <>s__1;

				private EnemyUnit <enemy>5__2;

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

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

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

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

				private bool MoveNext()
				{
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_007c: Expected O, but got Unknown
					try
					{
						switch (<>1__state)
						{
						default:
							return false;
						case 0:
							<>1__state = -1;
							<>s__1 = ((Exhibit)<>4__this).Battle.AllAliveEnemies.GetEnumerator();
							<>1__state = -3;
							break;
						case 1:
							<>1__state = -3;
							<enemy>5__2 = null;
							break;
						}
						if (<>s__1.MoveNext())
						{
							<enemy>5__2 = <>s__1.Current;
							<>2__current = (BattleAction)new CastBlockShieldAction((Unit)(object)<enemy>5__2, 0, ((Unit)<enemy>5__2).MaxHp, (BlockShieldType)2, false);
							<>1__state = 1;
							return true;
						}
						<>m__Finally1();
						<>s__1 = null;
						return false;
					}
					catch
					{
						//try-fault
						((IDisposable)this).Dispose();
						throw;
					}
				}

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

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

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

				[DebuggerHidden]
				IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator()
				{
					<OnBattleStarted>d__2 <OnBattleStarted>d__;
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						<OnBattleStarted>d__ = this;
					}
					else
					{
						<OnBattleStarted>d__ = new <OnBattleStarted>d__2(0)
						{
							<>4__this = <>4__this
						};
					}
					<OnBattleStarted>d__.args = <>3__args;
					return <OnBattleStarted>d__;
				}

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

			[CompilerGenerated]
			private sealed class <OnEnemySpawned>d__3 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private BattleAction <>2__current;

				private int <>l__initialThreadId;

				private UnitEventArgs args;

				public UnitEventArgs <>3__args;

				public EndlessModeCurseofFortress <>4__this;

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

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

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

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

				private bool MoveNext()
				{
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Expected O, but got Unknown
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = (BattleAction)new CastBlockShieldAction(args.Unit, 0, args.Unit.MaxHp, (BlockShieldType)2, false);
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						return false;
					}
				}

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

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

				[DebuggerHidden]
				IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator()
				{
					<OnEnemySpawned>d__3 <OnEnemySpawned>d__;
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						<OnEnemySpawned>d__ = this;
					}
					else
					{
						<OnEnemySpawned>d__ = new <OnEnemySpawned>d__3(0)
						{
							<>4__this = <>4__this
						};
					}
					<OnEnemySpawned>d__.args = <>3__args;
					return <OnEnemySpawned>d__;
				}

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

			protected override void OnAdded(PlayerUnit player)
			{
				if (!BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Blackout = true;
				}
			}

			protected override void OnEnterBattle()
			{
				if (!BepinexPlugin.EnableCurse.Value)
				{
					((Exhibit)this).Blackout = true;
				}
				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);
				}
			}

			[IteratorStateMachine(typeof(<OnBattleStarted>d__2))]
			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs args)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <OnBattleStarted>d__2(-2)
				{
					<>4__this = this,
					<>3__args = args
				};
			}

			[IteratorStateMachine(typeof(<OnEnemySpawned>d__3))]
			private IEnumerable<BattleAction> OnEnemySpawned(UnitEventArgs args)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <OnEnemySpawned>d__3(-2)
				{
					<>4__this = this,
					<>3__args = args
				};
			}
		}

		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
		{
			[CompilerGenerated]
			private sealed class <OnBattleStarted>d__2 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private BattleAction <>2__current;

				private int <>l__initialThreadId;

				private GameEventArgs args;

				public GameEventArgs <>3__args;

				public EndlessModeCurseofLiberation <>4__this;

				private IEnumerator<EnemyUnit> <>s__1;

				private EnemyUnit <enemy>5__2;

				private LimitedDamage <statusEffect>5__3;

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

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

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

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					int num = <>1__state;
					if (num == -3 || num == 1)
					{
						try
						{
						}
						finally
						{
							<>m__Finally1();
						}
					}
					<>s__1 = null;
					<enemy>5__2 = null;
					<statusEffect>5__3 = null;
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Invalid comparison between Unknown and I4
					try
					{
						int num = <>1__state;
						if (num != 0)
						{
							if (num != 1)
							{
								return false;
							}
							<>1__state = -3;
							goto IL_0184;
						}
						<>1__state = -1;
						if ((int)((Exhibit)<>4__this).Battle.EnemyGroup.EnemyType == 3)
						{
							((Exhibit)<>4__this).NotifyActivating();
							<>s__1 = ((Exhibit)<>4__this).Battle.AllAliveEnemies.Where((EnemyUnit e) => (int)e.Config.Type == 3).GetEnumerator();
							<>1__sta