Decompiled source of Everyone Is Here v0.0.29

lvalonmeme.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cysharp.Threading.Tasks;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using HarmonyLib;
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.Randoms;
using LBoL.Core.Stations;
using LBoL.Core.Stats;
using LBoL.Core.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.Adventures;
using LBoL.EntityLib.Cards.Adventure;
using LBoL.EntityLib.Cards.Character.Cirno;
using LBoL.EntityLib.Cards.Character.Cirno.Friend;
using LBoL.EntityLib.Cards.Character.Marisa;
using LBoL.EntityLib.Cards.Character.Reimu;
using LBoL.EntityLib.Cards.Character.Sakuya;
using LBoL.EntityLib.Cards.Enemy;
using LBoL.EntityLib.Cards.Neutral.MultiColor;
using LBoL.EntityLib.Cards.Neutral.NoColor;
using LBoL.EntityLib.Exhibits;
using LBoL.EntityLib.Exhibits.Common;
using LBoL.EntityLib.StatusEffects.Cirno;
using LBoL.EntityLib.StatusEffects.Enemy;
using LBoL.EntityLib.StatusEffects.Enemy.Seija;
using LBoL.EntityLib.StatusEffects.Marisa;
using LBoL.EntityLib.StatusEffects.Neutral.Black;
using LBoL.EntityLib.StatusEffects.Neutral.MultiColor;
using LBoL.EntityLib.StatusEffects.Others;
using LBoL.EntityLib.StatusEffects.Reimu;
using LBoL.Presentation;
using LBoL.Presentation.UI;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.UI.Widgets;
using LBoL.Presentation.Units;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.CustomHandlers;
using LBoLEntitySideloader.CustomKeywords;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.PersistentValues;
using LBoLEntitySideloader.Resource;
using LBoLEntitySideloader.Utils;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering;
using Yarn;
using lvalonmeme.Cards;
using lvalonmeme.Cards.Template;
using lvalonmeme.Config;
using lvalonmeme.Enemies.Template;
using lvalonmeme.GunName;
using lvalonmeme.ImageLoader;
using lvalonmeme.Localization;
using lvalonmeme.Patches;
using lvalonmeme.StatusEffects;

[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("lvalonmeme")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("lvalonmeme")]
[assembly: AssemblyTitle("lvalonmeme")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace VanillaTweaks
{
	[OverwriteVanilla]
	public sealed class ColdHeartedDefinition : CardTemplate
	{
		[EntityLogic(typeof(ColdHeartedDefinition))]
		public sealed class ColdHearted : Card
		{
			protected override IEnumerable<BattleAction> Actions(UnitSelector selector, ManaGroup consumingMana, Interaction precondition)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				yield return ((Card)this).BuffAction<ColdHeartedSe>(0, 0, 0, 0, 0.2f);
				if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld"))
				{
					List<Card> list = new List<Card>();
					for (int i = 0; i < ((Card)this).Value1; i++)
					{
						list.Add(Library.CreateCard("cardIceLance"));
					}
					foreach (Card iceLance2 in list)
					{
						iceLance2.SetTurnCost(((Card)this).Mana);
						iceLance2.IsEthereal = true;
						iceLance2.IsExile = true;
					}
					yield return (BattleAction)new AddCardsToHandAction((IEnumerable<Card>)list, (AddCardsType)0);
					yield break;
				}
				List<IceLance> list2 = Library.CreateCards<IceLance>(((Card)this).Value1, false).ToList();
				foreach (IceLance iceLance in list2)
				{
					((Card)iceLance).SetTurnCost(((Card)this).Mana);
					((Card)iceLance).IsEthereal = true;
					((Card)iceLance).IsExile = true;
				}
				yield return (BattleAction)new AddCardsToHandAction((IEnumerable<Card>)list2, (AddCardsType)0);
			}
		}

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

		[DontOverwrite]
		public override CardImages LoadCardImages()
		{
			return null;
		}

		[DontOverwrite]
		public override LocalizationOption LoadLocalization()
		{
			return null;
		}

		[DontOverwrite]
		public override CardConfig MakeConfig()
		{
			return null;
		}
	}
}
namespace lvalonmeme
{
	[BepInPlugin("llbol.meme.meme", "llvalonmeme", "0.0.29")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("LBoL.exe")]
	public class BepinexPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Debut), "InitVariables")]
		private class Debut_InitVariables_Patch
		{
			private static void Postfix(Debut __instance, ref IVariableStorage storage)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxSwapBlank"))
				{
					storage.SetValue("$twoColorStart", true);
				}
			}
		}

		[HarmonyPatch(typeof(StartGamePanel), "Awake")]
		private class StartGamePanel_Awake_Patch
		{
			private static void Postfix(ref StartGamePanel __instance)
			{
				try
				{
					JadeBoxToggle color5Toggle = null;
					JadeBoxToggle color7Toggle = null;
					JadeBoxToggle myfav = null;
					JadeBoxToggle best10 = null;
					foreach (KeyValuePair<JadeBox, JadeBoxToggle> jadeBoxToggle in __instance._jadeBoxToggles)
					{
						if (((GameEntity)jadeBoxToggle.Value.JadeBox).Id == "JadeBox5Color")
						{
							Debug.Log((object)"found 5colors");
							color5Toggle = jadeBoxToggle.Value;
						}
						if (((GameEntity)jadeBoxToggle.Value.JadeBox).Id == "JadeBox7Color")
						{
							Debug.Log((object)"found 7colors");
							color7Toggle = jadeBoxToggle.Value;
						}
						if (((GameEntity)jadeBoxToggle.Value.JadeBox).Id == "JadeBoxFav")
						{
							Debug.Log((object)"found myfav");
							myfav = jadeBoxToggle.Value;
						}
						if (((GameEntity)jadeBoxToggle.Value.JadeBox).Id == "SelectCard")
						{
							Debug.Log((object)"found best10");
							best10 = jadeBoxToggle.Value;
						}
					}
					if ((Object)(object)myfav != (Object)null && (Object)(object)best10 != (Object)null)
					{
						((UnityEvent<bool>)(object)myfav.Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
						{
							Debug.Log((object)"toggled myfav");
							if ((Object)(object)best10 != (Object)null && best10.IsOn)
							{
								Debug.Log((object)"disabling best10");
								best10.Toggle.SetIsOnWithoutNotify(false);
							}
						});
						((UnityEvent<bool>)(object)best10.Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
						{
							Debug.Log((object)"toggled best10");
							if ((Object)(object)myfav != (Object)null && myfav.IsOn)
							{
								Debug.Log((object)"disabling myfav");
								myfav.Toggle.SetIsOnWithoutNotify(false);
							}
						});
					}
					if (!((Object)(object)color5Toggle != (Object)null) || !((Object)(object)color7Toggle != (Object)null))
					{
						return;
					}
					((UnityEvent<bool>)(object)color5Toggle.Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
					{
						Debug.Log((object)"toggled color5Toggle");
						if ((Object)(object)color7Toggle != (Object)null && color7Toggle.IsOn)
						{
							Debug.Log((object)"disabling color7Toggle");
							color7Toggle.Toggle.SetIsOnWithoutNotify(false);
						}
					});
					((UnityEvent<bool>)(object)color7Toggle.Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
					{
						Debug.Log((object)"toggled color7Toggle");
						if ((Object)(object)color5Toggle != (Object)null && color5Toggle.IsOn)
						{
							Debug.Log((object)"disabling color5Toggle");
							color5Toggle.Toggle.SetIsOnWithoutNotify(false);
						}
					});
				}
				catch (Exception ex)
				{
					Debug.Log((object)("error when checking jadebox toggles: " + ex.Message + ex.StackTrace));
				}
			}
		}

		public class lvalonmemedata : CustomGameRunSaveData
		{
			public override void Restore(GameRunController gameRun)
			{
			}

			public override void Save(GameRunController gameRun)
			{
			}
		}

		public static string modUniqueID = "lvalonmeme";

		public static string playerName = "SampleCharacter";

		public static bool useInGameModel = true;

		public static string modelName = "Youmu";

		public static bool modelIsFlipped = true;

		public static List<ManaColor> offColors = new List<ManaColor> { (ManaColor)6 };

		public static ConfigEntry<bool> oldcard;

		public static CustomConfigEntry<bool> oldcardentry = new CustomConfigEntry<bool>(value: false, "1. 模组偏好设定 / Mod Preferences", "版本迭代者玉匣支援 / Re-version Iterator Suppoprt", "在玉匣「版本迭代者」被启用的游戏开始时,将一张「版本迭代者」加入牌组。 / At the start of a run where the \"Re-vision Iterator\" jadebox is enabled, add a \"Re-vision Iterator\" to the library.");

		public static ConfigEntry<string> blankid;

		public static CustomConfigEntry<string> blankidentry = new CustomConfigEntry<string>("kongbaikapai", "1. 模组偏好设定 / Mod Preferences", "玉匣「广纳百川」展品 / All-Accepting Jadebox Exhibit", "在玉匣「广纳百川」被启用的游戏开始时,将会以此展品进行换四(填写展品id,填下「none」则不会获得展品,获得时生成介面的展品不会生效)。 / At the start of a run where the jadebox \"All-Accepting\" is enabled, swap with this specified exhibit (enter exhibit id, entering \"none\" will give no exhibits, exhibits that generates an interface when obtained will not take effect)");

		public static ConfigEntry<bool> color5support;

		public static CustomConfigEntry<bool> color5supportentry = new CustomConfigEntry<bool>(value: true, "1. 模组偏好设定 / Mod Preferences", "玉匣「五彩斑斓」升级 / Pentachromatic Jadebox Upgrade", "在玉匣「五彩斑斓」被启用的第一场战斗开始时,升级牌组和战场内的所有卡牌。 / At the start of the first battle where the jadebox \"Pentachromatic\" is enabled, upgrade all cards in the library and battlefield.");

		public static ConfigEntry<int> balancebot;

		public static CustomConfigEntry<int> balancebotentry = new CustomConfigEntry<int>(1, "1. 模组偏好设定 / Mod Preferences", "玉匣「守恒」费用增加的总费用门槛 / Plasma Jadebox Threshold of Total Cost for Cost Increasing", "玉匣「守恒」中,使得费用增加的总费用门槛。 / On the jadebox \"Plasma\", this sets the threshold of total cost to be qualified for cost increasing.");

		public static ConfigEntry<int> balancetop;

		public static CustomConfigEntry<int> balancetopentry = new CustomConfigEntry<int>(4, "1. 模组偏好设定 / Mod Preferences", "玉匣「守恒」费用降低的总费用门槛 / Plasma Jadebox Threshold of Total Cost for Cost Reducing", "玉匣「守恒」中,使得费用降低的总费用门槛。 / On the jadebox \"Plasma\", this sets the threshold of total cost to be qualified for cost reducing.");

		public static ConfigEntry<string> balanceban;

		public static CustomConfigEntry<string> balancebanentry = new CustomConfigEntry<string>("danmujade", "1. 模组偏好设定 / Mod Preferences", "玉匣「守恒」卡牌黑名单 / Plasma Jadebox Card Blacklist", "黑名单内的卡牌不受玉匣「守恒」的影响(填写卡牌id并以「,」分隔) / Cards in the blacklist are immune from the effects of jadebox \"Plasma\" (enter card id, separated by commas)");

		public static ConfigEntry<bool> favpure;

		public static CustomConfigEntry<bool> favpureentry = new CustomConfigEntry<bool>(value: true, "1. 模组偏好设定 / Mod Preferences", "玉匣「我的最爱」基础支援 / My Favourite Jadebox Basic Support", "在玉匣「我的最爱」被启用时,如实将 4 张射击+及结界+加入牌库。此设定关闭时,额外获得一点彩色基础费用。 / At the start of a run where the jadebox \"My Favourite\" is enabled, add 4 Shoots+ and Boundaries+ to the library as written in the description. When this setting is disabled, gain an extra Philosophy base mana.");

		public static ConfigEntry<bool> favdebug;

		public static CustomConfigEntry<bool> favdebugentry = new CustomConfigEntry<bool>(value: false, "1. 模组偏好设定 / Mod Preferences", "玉匣「我的最爱」显示内测 / My Favourite Jadebox Show Debug", "在玉匣「我的最爱」被启用时,显示内测卡牌(警告!!!内测卡牌含剧透,也可能含模组的剧透,开启请三思) / At the start of a run where the jadebox \"My Favourite\" is enabled, all debug cards will be shown (WARNING!!! Debug cards contain spoilers and may also contain mod spoilers, please think carefully before enabling).");

		public static ConfigEntry<bool> doublelife;

		public static CustomConfigEntry<bool> doublelifeentry = new CustomConfigEntry<bool>(value: true, "1. 模组偏好设定 / Mod Preferences", "玉匣「宏观宇宙」血量加倍 / Macro Cosmos Jadebox Double Life", "在玉匣「宏观宇宙」被启用的游戏开始时,玩家血量加倍。 / At the start of a run where the jadebox \"Macro Cosmos\" is enabled, double the player's life.");

		public static ConfigEntry<bool> doublepower;

		public static CustomConfigEntry<bool> doublepowerentry = new CustomConfigEntry<bool>(value: true, "1. 模组偏好设定 / Mod Preferences", "玉匣「宏观宇宙」能量加倍 / Macro Cosmos Jadebox Double Power", "在玉匣「宏观宇宙」被启用时,收到的所有能量加倍,上限加倍,能多次使用。 / In a run where the jadebox \"Macro Cosmos\" is enabled, double the Power gained from all sources, double the charge limit, and allows multiple uses.");

		public static ConfigEntry<bool> doublemoney;

		public static CustomConfigEntry<bool> doublemoneyentry = new CustomConfigEntry<bool>(value: false, "1. 模组偏好设定 / Mod Preferences", "玉匣「宏观宇宙」金钱加倍 / Macro Cosmos Jadebox Double Money", "在玉匣「宏观宇宙」被启用时,收到的所有金钱加倍。 / In a run where the jadebox \"Macro Cosmos\" is enabled, double the Money gained from all sources.");

		public static ConfigEntry<bool> doublemana;

		public static CustomConfigEntry<bool> doublemanaentry = new CustomConfigEntry<bool>(value: false, "1. 模组偏好设定 / Mod Preferences", "玉匣「宏观宇宙」双倍法力 / Macro Cosmos Jadebox Double Mana", "在玉匣「宏观宇宙」被启用时,玩家的回合开始额外获得基础法力。 / At the start of the player's turn in a run where the jadebox \"Macro Cosmos\" is enabled, gain extra mana equal to the player's base mana.");

		public static ConfigEntry<bool> doubleplay;

		public static CustomConfigEntry<bool> doubleplayentry = new CustomConfigEntry<bool>(value: false, "1. 模组偏好设定 / Mod Preferences", "玉匣「宏观宇宙」回响形态 / Macro Cosmos Jadebox Echo Form", "在玉匣「宏观宇宙」被启用时,每张打出的牌都会额外打出一次。 / In a run where the jadebox \"Macro Cosmos\" is enabled, each card played will be played an additional time.");

		public static ConfigEntry<int> mult;

		public static CustomConfigEntry<int> multentry = new CustomConfigEntry<int>(1, "2. 内容设定 / Content Modifications", "群友卡牌战斗外比重倍率 / Meme Card Non-Battle Weight Mult", "提升群友卡牌战斗外比重倍率至设定的倍数 / Multiplies non-battle weight of meme cards by the set multiplier.");

		public static ConfigEntry<string> cardban;

		public static CustomConfigEntry<string> cardbanentry = new CustomConfigEntry<string>("", "2. 内容设定 / Content Modifications", "卡牌禁卡表 / Card Banlist", "禁止指定的卡牌以随机选取的方式出现在游戏里(填写卡牌id并以「,」分隔) / Bans selected cards from being rolled in the game (enter card id, separated by commas)");

		public static ConfigEntry<bool> banlistoverride;

		public static CustomConfigEntry<bool> banlistoverrideentry = new CustomConfigEntry<bool>(value: false, "2. 内容设定 / Content Modifications", "卡牌禁卡表凌驾 / Card Banlist Override", "卡牌禁卡表里的卡牌将全面禁止在局内出现,也会主动被移除。 / Cards in the Card Banlist will not exist in the game run, and will be removed actively.");

		public static ConfigEntry<string> cardwhite;

		public static CustomConfigEntry<string> cardwhiteentry = new CustomConfigEntry<string>("", "2. 内容设定 / Content Modifications", "卡牌白名单 / Card Whitelist", "不在卡牌白名单里的卡将包含在卡牌禁卡表里,卡牌禁卡表里原先的牌会被覆盖。(填写卡牌id并以「,」分隔)(警告!!!请填写足够的卡牌以确保商店,产牌和事件等不会因卡池太小而卡死) / Cards not in the Card Whitelist will be added to the Card Banlist, and the original cards in the Card Banlist will be overrwritten. (enter card id, separated by commas)(WARNING!!! Please fill in enough cards to ensure that the shop, card generation and event cards don't softlock due to having too small of a card pool)");

		public static ConfigEntry<int> imult;

		public static CustomConfigEntry<int> imultentry = new CustomConfigEntry<int>(1, "2. 内容设定 / Content Modifications", "自订卡牌比重倍率 / Custom Card Weight Mult", "提升自订卡牌比重倍率至设定的倍数 / Multiplies weight of the cards in the following Custom Card List by the set multiplier.");

		public static ConfigEntry<string> imultlist;

		public static CustomConfigEntry<string> imultlistentry = new CustomConfigEntry<string>("", "2. 内容设定 / Content Modifications", "自订卡牌表 / Custom Card List", "自订卡牌表里的卡受自订卡牌比重倍率影响(填写卡牌id并以「,」分隔) / Cards in the Custom Card List are affected by the Custom Card Weight Mult (enter card id, separated by commas)");

		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("llbol.meme.meme", "");

		private void Awake()
		{
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Expected O, but got Unknown
			log = ((BaseUnityPlugin)this).Logger;
			oldcard = ((BaseUnityPlugin)this).Config.Bind<bool>(oldcardentry.Section, oldcardentry.Key, oldcardentry.Value, oldcardentry.Description);
			blankid = ((BaseUnityPlugin)this).Config.Bind<string>(blankidentry.Section, blankidentry.Key, blankidentry.Value, blankidentry.Description);
			color5support = ((BaseUnityPlugin)this).Config.Bind<bool>(color5supportentry.Section, color5supportentry.Key, color5supportentry.Value, color5supportentry.Description);
			balancebot = ((BaseUnityPlugin)this).Config.Bind<int>(balancebotentry.Section, balancebotentry.Key, balancebotentry.Value, balancebotentry.Description);
			balancetop = ((BaseUnityPlugin)this).Config.Bind<int>(balancetopentry.Section, balancetopentry.Key, balancetopentry.Value, balancetopentry.Description);
			balanceban = ((BaseUnityPlugin)this).Config.Bind<string>(balancebanentry.Section, balancebanentry.Key, balancebanentry.Value, balancebanentry.Description);
			favpure = ((BaseUnityPlugin)this).Config.Bind<bool>(favpureentry.Section, favpureentry.Key, favpureentry.Value, favpureentry.Description);
			favdebug = ((BaseUnityPlugin)this).Config.Bind<bool>(favdebugentry.Section, favdebugentry.Key, favdebugentry.Value, favdebugentry.Description);
			doublelife = ((BaseUnityPlugin)this).Config.Bind<bool>(doublelifeentry.Section, doublelifeentry.Key, doublelifeentry.Value, doublelifeentry.Description);
			doublepower = ((BaseUnityPlugin)this).Config.Bind<bool>(doublepowerentry.Section, doublepowerentry.Key, doublepowerentry.Value, doublepowerentry.Description);
			doublemoney = ((BaseUnityPlugin)this).Config.Bind<bool>(doublemoneyentry.Section, doublemoneyentry.Key, doublemoneyentry.Value, doublemoneyentry.Description);
			doublemana = ((BaseUnityPlugin)this).Config.Bind<bool>(doublemanaentry.Section, doublemanaentry.Key, doublemanaentry.Value, doublemanaentry.Description);
			doubleplay = ((BaseUnityPlugin)this).Config.Bind<bool>(doubleplayentry.Section, doubleplayentry.Key, doubleplayentry.Value, doubleplayentry.Description);
			mult = ((BaseUnityPlugin)this).Config.Bind<int>(multentry.Section, multentry.Key, multentry.Value, multentry.Description);
			cardban = ((BaseUnityPlugin)this).Config.Bind<string>(cardbanentry.Section, cardbanentry.Key, cardbanentry.Value, cardbanentry.Description);
			banlistoverride = ((BaseUnityPlugin)this).Config.Bind<bool>(banlistoverrideentry.Section, banlistoverrideentry.Key, banlistoverrideentry.Value, banlistoverrideentry.Description);
			cardwhite = ((BaseUnityPlugin)this).Config.Bind<string>(cardwhiteentry.Section, cardwhiteentry.Key, cardwhiteentry.Value, cardwhiteentry.Description);
			log.LogDebug((object)"lvalonmeme bepinex loaded all configs");
			string[] array = cardban.Value.Split(',');
			string[] array2 = new string[0];
			string[] array3 = array;
			foreach (string text in array3)
			{
				CollectionExtensions.AddItem<string>((IEnumerable<string>)array2, text.ToLowerInvariant());
			}
			string[] array4 = array2;
			foreach (string text2 in array4)
			{
				if (text2.ToLowerInvariant() != "")
				{
					log.LogDebug((object)("lvalonmeme bepinex cardban: " + text2.ToLowerInvariant()));
				}
			}
			imult = ((BaseUnityPlugin)this).Config.Bind<int>(imultentry.Section, imultentry.Key, imultentry.Value, imultentry.Description);
			imultlist = ((BaseUnityPlugin)this).Config.Bind<string>(imultlistentry.Section, imultlistentry.Key, imultlistentry.Value, imultlistentry.Description);
			string[] array5 = imultlist.Value.Split(',');
			string[] array6 = array5;
			foreach (string text3 in array6)
			{
				if (text3.ToLowerInvariant() != "")
				{
					log.LogDebug((object)("lvalonmeme bepinex imultlist: " + text3.ToLowerInvariant()));
				}
			}
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			CardIndexGenerator.PromiseClearIndexSet();
			EntityManager.RegisterSelf();
			harmony.PatchAll();
			CHandlerManager.RegisterGameEventHandler<CardsEventArgs>((EventProvider<CardsEventArgs, GameRunController>)((GameRunController gr) => gr.DeckCardsAdding), (GameEventHandler<CardsEventArgs>)CustomHandlers.OnDeckCardsAdding, (GameEventPriority)10);
			CHandlerManager.RegisterGameEventHandler<CardsEventArgs>((EventProvider<CardsEventArgs, GameRunController>)((GameRunController gr) => gr.DeckCardsAdded), (GameEventHandler<CardsEventArgs>)CustomHandlers.OnDeckCardsAdded, (GameEventPriority)10);
			CHandlerManager.RegisterGameEventHandler<CardsEventArgs>((EventProvider<CardsEventArgs, GameRunController>)((GameRunController gr) => gr.DeckCardsRemoving), (GameEventHandler<CardsEventArgs>)CustomHandlers.OnDeckCardsRemoving, (GameEventPriority)10);
			CHandlerManager.RegisterGameEventHandler<CardsEventArgs>((EventProvider<CardsEventArgs, GameRunController>)((GameRunController gr) => gr.DeckCardsRemoved), (GameEventHandler<CardsEventArgs>)CustomHandlers.OnDeckCardsRemoved, (GameEventPriority)10);
			CHandlerManager.RegisterGameEventHandler<StationEventArgs>((EventProvider<StationEventArgs, GameRunController>)((GameRunController gr) => gr.StationRewardGenerating), (GameEventHandler<StationEventArgs>)CustomHandlers.StationRewardGenerating, (GameEventPriority)10);
			CHandlerManager.RegisterGameEventHandler<StationEventArgs>((EventProvider<StationEventArgs, GameRunController>)((GameRunController gr) => gr.StationEntering), (GameEventHandler<StationEventArgs>)CustomHandlers.StationEntering, (GameEventPriority)10);
			CHandlerManager.RegisterGameEventHandler<StationEventArgs>((EventProvider<StationEventArgs, GameRunController>)((GameRunController gr) => gr.StationEntered), (GameEventHandler<StationEventArgs>)CustomHandlers.StationEntered, (GameEventPriority)10);
			CustomHandlers.addreactors();
			((CustomGameRunSaveData)new lvalonmemedata()).RegisterSelf("llbol.meme.meme");
			Func<Sprite> func = () => ResourceLoader.LoadSprite("BossIcon.png", (IResourceSource)(object)directorySource, (Rect?)null, 1, (Vector2?)null);
			EnemyUnitTemplate.AddBossNodeIcon("lvalonmeme", func, (Assembly)null);
			List<string> list = new List<string> { "cardkotk", "cardyoumi" };
			foreach (string item in list)
			{
				CardImages val = new CardImages(embeddedSource);
				val.AutoLoad(item + 2, SampleCharacterImageLoader.file_extension, "Resources.Cards.", (List<string>)null, false);
				DictionaryExtensions.AlwaysAdd<string, Texture>(ResourcesHelper.CardImages, item + 2, (Texture)(object)val.main);
			}
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public class CustomHandlers
	{
		private static bool youmiplayed;

		public static void OnDeckCardsAdding(CardsEventArgs args)
		{
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			BattleController battle = currentGameRun.Battle;
			if (currentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld"))
			{
				for (int num = args.Cards.Length - 1; num >= 0; num--)
				{
					Card val = args.Cards[num];
					if (CustomGameEventManager.GetList("oldban").Contains(((GameEntity)val).Id))
					{
						string text = "card" + ((GameEntity)val).Id;
						Card val2 = Library.TryCreateCard(text, val.IsUpgraded, val.UpgradeCounter);
						args.Cards[num] = val2;
					}
				}
			}
			string[] arr = toolbox.banlistgetter();
			List<Card> list = args.Cards.Where((Card c) => BepinexPlugin.banlistoverride.Value && arr.Contains(((GameEntity)c).Id.ToLowerInvariant())).ToList();
			foreach (Card card in list)
			{
				if (!currentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld") || !CustomGameEventManager.GetList("oldban").Contains(((GameEntity)card).Id))
				{
					args.Cards = args.Cards.Where((Card c) => c != card).ToArray();
				}
			}
		}

		public static void OnDeckCardsAdded(CardsEventArgs args)
		{
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			BattleController battle = currentGameRun.Battle;
			bool flag = currentGameRun.BaseDeck.Any((Card card) => card is cardyoumi) && currentGameRun.BaseDeck.Any((Card card) => card is cardkotk);
			IEnumerable<Card> enumerable = currentGameRun.BaseDeck;
			if (battle != null)
			{
				enumerable = enumerable.Concat(battle.EnumerateAllCards());
			}
			foreach (Card item in enumerable)
			{
				if (item is cardyoumi)
				{
					if (flag)
					{
						CardConfig.FromId("cardyoumi").ImageId = "cardyoumi" + 2;
						CardConfig.FromId("cardyoumi").UpgradeImageId = "cardyoumi" + 2;
					}
					else
					{
						CardConfig.FromId("cardyoumi").ImageId = "cardyoumi";
						CardConfig.FromId("cardyoumi").UpgradeImageId = "cardyoumi";
					}
				}
				else if (item is cardkotk)
				{
					if (flag)
					{
						CardConfig.FromId("cardkotk").ImageId = "cardkotk" + 2;
						CardConfig.FromId("cardkotk").UpgradeImageId = "cardkotk" + 2;
						CardConfig.FromId("cardkotk").Illustrator = "Hajin";
					}
					else
					{
						CardConfig.FromId("cardkotk").ImageId = "cardkotk";
						CardConfig.FromId("cardkotk").UpgradeImageId = "cardkotk";
						CardConfig.FromId("cardkotk").Illustrator = "哈基双朋友";
					}
				}
			}
		}

		public static void OnDeckCardsRemoving(CardsEventArgs args)
		{
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			BattleController battle = currentGameRun.Battle;
		}

		public static void OnDeckCardsRemoved(CardsEventArgs args)
		{
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			BattleController battle = currentGameRun.Battle;
			bool flag = currentGameRun.BaseDeck.Any((Card card) => card is cardyoumi) && currentGameRun.BaseDeck.Any((Card card) => card is cardkotk);
			IEnumerable<Card> enumerable = currentGameRun.BaseDeck;
			if (battle != null)
			{
				enumerable = enumerable.Concat(battle.EnumerateAllCards());
			}
			foreach (Card item in enumerable)
			{
				if (item is cardyoumi)
				{
					if (flag)
					{
						CardConfig.FromId("cardyoumi").ImageId = "cardyoumi" + 2;
						CardConfig.FromId("cardyoumi").UpgradeImageId = "cardyoumi" + 2;
					}
					else
					{
						CardConfig.FromId("cardyoumi").ImageId = "cardyoumi";
						CardConfig.FromId("cardyoumi").UpgradeImageId = "cardyoumi";
					}
				}
				else if (item is cardkotk)
				{
					if (flag)
					{
						CardConfig.FromId("cardkotk").ImageId = "cardkotk" + 2;
						CardConfig.FromId("cardkotk").UpgradeImageId = "cardkotk" + 2;
						CardConfig.FromId("cardkotk").Illustrator = "Hajin";
					}
					else
					{
						CardConfig.FromId("cardkotk").ImageId = "cardkotk";
						CardConfig.FromId("cardkotk").UpgradeImageId = "cardkotk";
						CardConfig.FromId("cardkotk").Illustrator = "哈基双朋友";
					}
				}
			}
		}

		public static void StationEntering(StationEventArgs args)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			youmiplayed = false;
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			Station station = args.Station;
			EntryStation val = (EntryStation)(object)((station is EntryStation) ? station : null);
			if (val != null && CollectionsExtensions.IndexOf<Stage>(currentGameRun.Stages, ((Station)val).Stage) == 0)
			{
				return;
			}
			ManaGroup baseMana = currentGameRun.BaseMana;
			if (((ManaGroup)(ref baseMana)).HasTrivial || currentGameRun.Player.Exhibits.Any((Exhibit e) => e.Config.Id == "KongbaiKapai"))
			{
				return;
			}
			BepinexPlugin.log.LogWarning((object)"lvalonmeme station entering, no trivial mana and blank card detected");
			Singleton<GameMaster>.Instance.CurrentGameRun.GainExhibitInstantly(Library.CreateExhibit("KongbaiKapai"), false, (VisualSourceData)null);
			baseMana = currentGameRun.BaseMana;
			if (((ManaGroup)(ref baseMana)).Philosophy > 1)
			{
				currentGameRun.TryLoseBaseMana(ManaGroup.Single((ManaColor)7), false);
				return;
			}
			BepinexPlugin.log.LogWarning((object)"lvalonmeme station entering, no trivial mana after blank card");
			baseMana = currentGameRun.BaseMana;
			if (((ManaGroup)(ref baseMana)).Colorless > 0)
			{
				currentGameRun.TryLoseBaseMana(ManaGroup.Single((ManaColor)6), false);
			}
		}

		public static void StationEntered(StationEventArgs args)
		{
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			Station station = args.Station;
			EntryStation val = (EntryStation)(object)((station is EntryStation) ? station : null);
			string[] arr = toolbox.banlistgetter();
			List<Card> list = currentGameRun.BaseDeck.Where((Card c) => BepinexPlugin.banlistoverride.Value && arr.Contains(((GameEntity)c).Id.ToLowerInvariant())).ToList();
			foreach (Card item in list)
			{
				if (!currentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld") || !CustomGameEventManager.GetList("oldban").Contains(((GameEntity)item).Id))
				{
					currentGameRun.RemoveDeckCard(item, false);
				}
			}
		}

		public static void StationRewardGenerating(StationEventArgs args)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			Station station = args.Station;
			if (!currentGameRun.BaseDeck.Any((Card c) => c is cardkotk) && youmiplayed && (int)currentGameRun.CurrentStation.Type != 10)
			{
				station.Rewards.Clear();
			}
		}

		public static void addreactors()
		{
			CHandlerManager.RegisterBattleEventHandler<GameEventArgs>((EventProvider<GameEventArgs, BattleController>)((BattleController b) => b.BattleStarting), (GameEventHandler<GameEventArgs>)addbattlereactor, (Predicate<BattleController>)null, (GameEventPriority)int.MinValue);
		}

		private static void addbattlereactor(GameEventArgs args)
		{
			PlayerUnit player = Singleton<GameMaster>.Instance.CurrentGameRun.Battle.Player;
			battlereactor((Unit)(object)player);
		}

		private static void battlereactor(Unit unit)
		{
			GameRunController gamerun = Singleton<GameMaster>.Instance.CurrentGameRun;
			unit.ReactBattleEvent<CardsEventArgs>(gamerun.Battle.CardsAddedToDiscard, (Func<CardsEventArgs, IEnumerable<BattleAction>>)((CardsEventArgs args) => battlefieldyeet(args)));
			unit.ReactBattleEvent<CardsEventArgs>(gamerun.Battle.CardsAddedToExile, (Func<CardsEventArgs, IEnumerable<BattleAction>>)((CardsEventArgs args) => battlefieldyeet(args)));
			unit.ReactBattleEvent<CardsEventArgs>(gamerun.Battle.CardsAddedToHand, (Func<CardsEventArgs, IEnumerable<BattleAction>>)((CardsEventArgs args) => battlefieldyeet(args)));
			unit.ReactBattleEvent<CardsAddingToDrawZoneEventArgs>(gamerun.Battle.CardsAddedToDrawZone, (Func<CardsAddingToDrawZoneEventArgs, IEnumerable<BattleAction>>)((CardsAddingToDrawZoneEventArgs args) => battlefieldyeet2(args)));
			unit.ReactBattleEvent<CardUsingEventArgs>(gamerun.Battle.CardUsed, (Func<CardUsingEventArgs, IEnumerable<BattleAction>>)((CardUsingEventArgs args) => CardUsed(args)));
			static IEnumerable<BattleAction> CardUsed(CardUsingEventArgs args)
			{
				if (args.Card is cardyoumi)
				{
					youmiplayed = true;
				}
				return new List<BattleAction>();
			}
			IEnumerable<BattleAction> battlefieldyeet(CardsEventArgs args)
			{
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Expected O, but got Unknown
				//IL_022b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0235: Expected O, but got Unknown
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Expected I4, but got Unknown
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Expected O, but got Unknown
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Expected O, but got Unknown
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Expected O, but got Unknown
				List<BattleAction> list4 = new List<BattleAction>();
				if (gamerun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld"))
				{
					string[] source2 = toolbox.banlistgetter();
					bool value2 = BepinexPlugin.banlistoverride.Value;
					foreach (Card item in args.Cards.Where((Card card) => CustomGameEventManager.GetList("oldban").Contains(((GameEntity)card).Id)))
					{
						list4.Add((BattleAction)new RemoveCardAction(item));
						string text2 = "card" + ((GameEntity)item).Id;
						if (!value2 || !source2.Contains(text2.ToLowerInvariant()))
						{
							List<Card> list5 = new List<Card> { Library.TryCreateCard(text2, item.IsUpgraded, item.UpgradeCounter) };
							Card val2 = Library.TryCreateCard(text2, item.IsUpgraded, item.UpgradeCounter);
							CardZone zone = item.Zone;
							CardZone val3 = zone;
							switch (val3 - 2)
							{
							case 0:
								list4.Add((BattleAction)new AddCardsToHandAction((IEnumerable<Card>)list5, (AddCardsType)0));
								break;
							case 1:
								list4.Add((BattleAction)new AddCardsToDiscardAction((IEnumerable<Card>)list5, (AddCardsType)0));
								break;
							case 2:
								list4.Add((BattleAction)new AddCardsToExileAction((Card[])(object)new Card[1] { val2 }));
								break;
							}
						}
					}
				}
				else
				{
					string[] arr2 = toolbox.banlistgetter();
					List<Card> list6 = args.Cards.Where((Card c) => BepinexPlugin.banlistoverride.Value && arr2.Contains(((GameEntity)c).Id.ToLowerInvariant())).ToList();
					foreach (Card item2 in list6)
					{
						if (!gamerun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld") || !CustomGameEventManager.GetList("oldban").Contains(((GameEntity)item2).Id))
						{
							list4.Add((BattleAction)new RemoveCardAction(item2));
						}
					}
				}
				return list4;
			}
			IEnumerable<BattleAction> battlefieldyeet2(CardsAddingToDrawZoneEventArgs args)
			{
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Expected O, but got Unknown
				//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f5: Expected O, but got Unknown
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Invalid comparison between Unknown and I4
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Expected O, but got Unknown
				List<BattleAction> list = new List<BattleAction>();
				if (gamerun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld"))
				{
					string[] source = toolbox.banlistgetter();
					bool value = BepinexPlugin.banlistoverride.Value;
					foreach (Card item3 in args.Cards.Where((Card card) => CustomGameEventManager.GetList("oldban").Contains(((GameEntity)card).Id)))
					{
						list.Add((BattleAction)new RemoveCardAction(item3));
						string text = "card" + ((GameEntity)item3).Id;
						if (!value || !source.Contains(text.ToLowerInvariant()))
						{
							List<Card> list2 = new List<Card> { Library.TryCreateCard(text, item3.IsUpgraded, item3.UpgradeCounter) };
							Card val = Library.TryCreateCard(text, item3.IsUpgraded, item3.UpgradeCounter);
							if ((int)item3.Zone == 1)
							{
								list.Add((BattleAction)new AddCardsToDrawZoneAction((IEnumerable<Card>)list2, (DrawZoneTarget)2, (AddCardsType)0));
							}
						}
					}
				}
				else
				{
					string[] arr = toolbox.banlistgetter();
					List<Card> list3 = args.Cards.Where((Card c) => BepinexPlugin.banlistoverride.Value && arr.Contains(((GameEntity)c).Id.ToLowerInvariant())).ToList();
					foreach (Card item4 in list3)
					{
						if (!gamerun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld") || !CustomGameEventManager.GetList("oldban").Contains(((GameEntity)item4).Id))
						{
							list.Add((BattleAction)new RemoveCardAction(item4));
						}
					}
				}
				return list;
			}
		}
	}
	public static class PInfo
	{
		public const string GUID = "llbol.meme.meme";

		public const string Name = "llvalonmeme";

		public const string version = "0.0.29";

		public static readonly Harmony harmony = new Harmony("llbol.meme.meme");
	}
	public class SampleCharacterLoadouts
	{
		public static string UltimateSkillA = "SampleCharacterUltA";

		public static string UltimateSkillB = "SampleCharacterUltB";

		public static List<string> DeckA = new List<string> { "Shoot", "Shoot", "Boundary", "Boundary" };

		public static List<string> DeckB = new List<string> { "Shoot", "Shoot", "Boundary", "Boundary" };

		public static PlayerUnitConfig playerUnitConfig;

		static SampleCharacterLoadouts()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			string modUniqueID = BepinexPlugin.modUniqueID;
			int? num = 0;
			ManaGroup val = default(ManaGroup);
			((ManaGroup)(ref val)).White = 1;
			((ManaGroup)(ref val)).Blue = 1;
			((ManaGroup)(ref val)).Black = 1;
			((ManaGroup)(ref val)).Red = 1;
			((ManaGroup)(ref val)).Green = 0;
			((ManaGroup)(ref val)).Colorless = 0;
			((ManaGroup)(ref val)).Philosophy = 0;
			ManaGroup val2 = val;
			playerUnitConfig = new PlayerUnitConfig(modUniqueID, true, "", 0, 8, num, true, (int?)0, (ManaColor)7, (ManaColor)6, val2, "#e58c27", 80, 99, 0, UltimateSkillA, UltimateSkillB, (string)null, (string)null, (IReadOnlyList<string>)DeckA, (IReadOnlyList<string>)DeckB, 3, 2);
		}
	}
	public abstract class toolbox
	{
		public static string[] banlistgetter()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			string[] array = BepinexPlugin.cardban.Value.Split(',');
			string[] array2 = new string[0];
			string text = "";
			if (BepinexPlugin.cardwhite.Value != "")
			{
				array = BepinexPlugin.cardwhite.Value.Split(',');
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = array[i].ToLowerInvariant();
				}
				Card[] array3 = CreateAllCardsPoolList(new CardWeightTable(RarityWeightTable.AllOnes, OwnerWeightTable.AllOnes, CardTypeWeightTable.AllOnes, true));
				Card[] array4 = array3;
				foreach (Card val in array4)
				{
					if (!array.Contains(((GameEntity)val).Id.ToLowerInvariant()))
					{
						text = text + ((GameEntity)val).Id.ToLowerInvariant() + ",";
					}
				}
				return text.Split(',');
			}
			return BepinexPlugin.cardban.Value.Split(',');
		}

		public static Card[] RollCardsCustomIgnore(RandomGen rng, CardWeightTable weightTable, int count, ManaGroup? manaLimit = null, bool colorLimit = false, bool applyFactors = false, bool battleRolling = false, bool ensureCount = false, Predicate<Card> filter = null)
		{
			GameMaster instance = Singleton<GameMaster>.Instance;
			GameRunController val = ((instance != null) ? instance.CurrentGameRun : null);
			if (val == null)
			{
				throw new InvalidOperationException("Rolling cards when run is not started.");
			}
			UniqueRandomPool<Type> val2 = val.CreateValidCardsPool(weightTable, manaLimit, colorLimit, applyFactors, battleRolling, (Predicate<CardConfig>)null);
			UniqueRandomPool<Card> val3 = new UniqueRandomPool<Card>(false);
			foreach (RandomPoolEntry<Type> item in val2)
			{
				Card val4 = Library.CreateCard(item.Elem);
				if (filter(val4))
				{
					((GameEntity)val4).GameRun = val;
					val3.Add(val4, item.Weight);
				}
			}
			return val3.SampleMany(rng, count, ensureCount);
		}

		public static Card[] RollCardsCustom(RandomGen rng, CardWeightTable weightTable, int count, ManaGroup? manaLimit = null, bool colorLimit = false, bool applyFactors = false, bool battleRolling = false, bool ensureCount = false, Predicate<Card> filter = null)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			GameMaster instance = Singleton<GameMaster>.Instance;
			GameRunController val = ((instance != null) ? instance.CurrentGameRun : null);
			if (val == null)
			{
				throw new InvalidOperationException("Rolling cards when run is not started.");
			}
			UniqueRandomPool<Type> val2 = val.CreateValidCardsPool(weightTable, manaLimit, colorLimit, applyFactors, battleRolling, (Predicate<CardConfig>)null);
			UniqueRandomPool<Card> val3 = new UniqueRandomPool<Card>(false);
			foreach (RandomPoolEntry<Type> item in val2)
			{
				Card val4 = Library.CreateCard(item.Elem);
				if (filter(val4))
				{
					ManaGroup baseMana = val.BaseMana;
					if (((ManaGroup)(ref baseMana)).CanAfford(val4.Cost))
					{
						((GameEntity)val4).GameRun = val;
						val3.Add(val4, item.Weight);
					}
				}
			}
			return val3.SampleMany(rng, count, ensureCount);
		}

		public static Card[] RepeatableAllCards(RandomGen rng, CardWeightTable weightTable, int count, bool ensureCount = false, Predicate<Card> filter = null)
		{
			GameMaster instance = Singleton<GameMaster>.Instance;
			GameRunController val = ((instance != null) ? instance.CurrentGameRun : null);
			if (val == null)
			{
				throw new InvalidOperationException("Rolling cards when run is not started.");
			}
			UniqueRandomPool<Type> val2 = CreateAllCardsPool(weightTable);
			RepeatableRandomPool<Card> val3 = new RepeatableRandomPool<Card>();
			foreach (RandomPoolEntry<Type> item in val2)
			{
				Card val4 = Library.CreateCard(item.Elem);
				if (filter(val4))
				{
					((GameEntity)val4).GameRun = val;
					val3.Add(val4, item.Weight);
				}
			}
			return val3.SampleMany(rng, count, ensureCount);
		}

		public static Card[] UniqueAllCards(RandomGen rng, CardWeightTable weightTable, int count, bool ensureCount = false, Predicate<Card> filter = null)
		{
			GameMaster instance = Singleton<GameMaster>.Instance;
			GameRunController val = ((instance != null) ? instance.CurrentGameRun : null);
			if (val == null)
			{
				throw new InvalidOperationException("Rolling cards when run is not started.");
			}
			UniqueRandomPool<Type> val2 = CreateAllCardsPool(weightTable);
			UniqueRandomPool<Card> val3 = new UniqueRandomPool<Card>(false);
			foreach (RandomPoolEntry<Type> item in val2)
			{
				Card val4 = Library.CreateCard(item.Elem);
				if (filter(val4))
				{
					((GameEntity)val4).GameRun = val;
					val3.Add(val4, item.Weight);
				}
			}
			return val3.SampleMany(rng, count, ensureCount);
		}

		public static UniqueRandomPool<Type> CreateAllCardsPool(CardWeightTable weightTable, [MaybeNull] Predicate<CardConfig> filter = null)
		{
			GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
			HashSet<string> hashSet = new HashSet<string>(from e in currentGameRun.Player.Exhibits
				where e.OwnerId != null
				select e.OwnerId);
			UniqueRandomPool<Type> val = new UniqueRandomPool<Type>(false);
			foreach (var (type, obj) in EnumerateALLCardTypes())
			{
				if (filter == null || filter(obj))
				{
					val.Add(type, 1f);
				}
			}
			return val;
		}

		public static Card[] CreateAllCardsPoolList(CardWeightTable weightTable, [MaybeNull] Predicate<CardConfig> filter = null)
		{
			return (from e in ((IEnumerable<RandomPoolEntry<Type>>)CreateAllCardsPool(weightTable, filter)).ToList()
				select Library.CreateCard(e.Elem)).ToArray();
		}

		public static IEnumerable<(Type, CardConfig)> EnumerateALLCardTypes()
		{
			foreach (CardConfig item in CardConfig.AllConfig())
			{
				Type type2 = TypeFactory<Card>.TryGetType(item.Id);
				if ((object)type2 != null)
				{
					yield return (type2, item);
				}
			}
		}

		public static IEnumerable<(Type, ExhibitConfig)> EnumerateALLExhibitTypes()
		{
			foreach (ExhibitConfig item in ExhibitConfig.AllConfig())
			{
				Type type = TypeFactory<Exhibit>.TryGetType(item.Id);
				if ((object)type != null)
				{
					yield return (type, item);
				}
			}
		}

		public static UniqueRandomPool<Type> CreateAllExhibitsPool(ExhibitWeightTable weightTable, [MaybeNull] Predicate<ExhibitConfig> filter = null)
		{
			UniqueRandomPool<Type> result = new UniqueRandomPool<Type>(false);
			foreach (var item2 in EnumerateALLExhibitTypes())
			{
				ExhibitConfig item = item2.Item2;
				if (filter != null && filter(item))
				{
				}
			}
			return result;
		}

		public static Card createcardwithidBACKUP(string id)
		{
			UniqueRandomPool<Type> val = new UniqueRandomPool<Type>(false);
			foreach (var (type, val2) in EnumerateALLCardTypes())
			{
				if (val2.Id == id)
				{
					val.Add(type, 1f);
				}
			}
			UniqueRandomPool<Card> val3 = new UniqueRandomPool<Card>(false);
			foreach (RandomPoolEntry<Type> item in val)
			{
				Card val4 = Library.CreateCard(item.Elem);
				val3.Add(val4, item.Weight);
			}
			return val3.Sample(RandomGen.InitGen);
		}

		public static Card createcardwithid(string id)
		{
			return TypeFactory<Card>.CreateInstance(TypeFactory<Card>.TryGetType(id));
		}
	}
}
namespace lvalonmeme.SampleCharacterUlt
{
	public sealed class SampleCharacterUltADef : lvalonmemeulttemplate
	{
		public override UltimateSkillConfig MakeConfig()
		{
			UltimateSkillConfig defaulUltConfig = GetDefaulUltConfig();
			defaulUltConfig.Damage = 50;
			return defaulUltConfig;
		}
	}
	[EntityLogic(typeof(SampleCharacterUltADef))]
	public sealed class SampleCharacterUltA : UltimateSkill
	{
		public SampleCharacterUltA()
		{
			((UltimateSkill)this).TargetType = (TargetType)1;
			((UltimateSkill)this).GunName = GunNameID.GetGunFromId(4158);
		}

		protected override IEnumerable<BattleAction> Actions(UnitSelector selector)
		{
			EnemyUnit enemy = selector.GetEnemy(((UltimateSkill)this).Battle);
			yield return (BattleAction)new DamageAction((Unit)(object)((UltimateSkill)this).Owner, (Unit)(object)enemy, ((UltimateSkill)this).Damage, ((UltimateSkill)this).GunName, (GunType)0);
		}
	}
	public sealed class SampleCharacterUltBDef : lvalonmemeulttemplate
	{
		public override UltimateSkillConfig MakeConfig()
		{
			UltimateSkillConfig defaulUltConfig = GetDefaulUltConfig();
			defaulUltConfig.Damage = 35;
			defaulUltConfig.Value1 = 2;
			defaulUltConfig.RelativeEffects = new List<string> { "Weak" };
			return defaulUltConfig;
		}
	}
	[EntityLogic(typeof(SampleCharacterUltBDef))]
	public sealed class SampleCharacterUltB : UltimateSkill
	{
		public SampleCharacterUltB()
		{
			((UltimateSkill)this).TargetType = (TargetType)1;
			((UltimateSkill)this).GunName = GunNameID.GetGunFromId(4158);
		}

		protected override IEnumerable<BattleAction> Actions(UnitSelector selector)
		{
			EnemyUnit enemy = selector.GetEnemy(((UltimateSkill)this).Battle);
			yield return (BattleAction)new DamageAction((Unit)(object)((UltimateSkill)this).Owner, (Unit)(object)enemy, ((UltimateSkill)this).Damage, ((UltimateSkill)this).GunName, (GunType)0);
			if (((Unit)enemy).IsAlive)
			{
				yield return (BattleAction)(object)new ApplyStatusEffectAction<Weak>((Unit)(object)enemy, (int?)0, (int?)((UltimateSkill)this).Value1, (int?)0, (int?)0, 0.2f, true);
			}
		}
	}
	public class lvalonmemeulttemplate : UltimateSkillTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit(SampleCharacterDefaultConfig.DefaultID((EntityDefinition)(object)this));
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)SampleCharacterLocalization.UltimateSkillsBatchLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override Sprite LoadSprite()
		{
			return SampleCharacterImageLoader.LoadUltLoader((UltimateSkillTemplate)(object)this);
		}

		public override UltimateSkillConfig MakeConfig()
		{
			throw new NotImplementedException();
		}

		public UltimateSkillConfig GetDefaulUltConfig()
		{
			return SampleCharacterDefaultConfig.DefaultUltConfig();
		}
	}
}
namespace lvalonmeme.StatusEffects
{
	public sealed class sememeDef : lvalonmemesetemplate
	{
		public override Sprite LoadSprite()
		{
			return null;
		}
	}
	[EntityLogic(typeof(sememeDef))]
	public sealed class sememe : StatusEffect
	{
	}
	public sealed class seoldDef : lvalonmemesetemplate
	{
		public override Sprite LoadSprite()
		{
			return null;
		}
	}
	[EntityLogic(typeof(seoldDef))]
	public sealed class seold : StatusEffect
	{
	}
	public sealed class se9999Def : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.Type = (StatusEffectType)1;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(se9999Def))]
	public sealed class se9999 : StatusEffect
	{
		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnding, (EventSequencedReactor<UnitEventArgs>)OnTurnEnding);
		}

		private IEnumerable<BattleAction> OnTurnEnding(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).NotifyActivating();
				yield return (BattleAction)(object)new ApplyStatusEffectAction<Poison>(((StatusEffect)this).Owner, (int?)((StatusEffect)this).Level, (int?)null, (int?)null, (int?)null, 0f, true);
			}
		}
	}
	public sealed class seallfriendsDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			return lvalonmemesetemplate.GetDefaultStatusEffectConfig();
		}
	}
	[EntityLogic(typeof(seallfriendsDef))]
	public sealed class seallfriends : StatusEffect
	{
		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnTurnStarting);
		}

		private IEnumerable<BattleAction> OnTurnStarting(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).NotifyActivating();
				yield return (BattleAction)new AddCardsToDrawZoneAction((IEnumerable<Card>)Library.CreateCards<GatherFairy>(((StatusEffect)this).Level, false), (DrawZoneTarget)2, (AddCardsType)0);
				yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f);
			}
		}
	}
	public sealed class sebbDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.Type = (StatusEffectType)2;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(sebbDef))]
	public sealed class sebb : StatusEffect
	{
		public override bool ForceNotShowDownText => true;

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).HandleOwnerEvent<DamageDealingEventArgs>(((StatusEffect)this).Owner.DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnDamageDealing);
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnded, (EventSequencedReactor<UnitEventArgs>)OnOwnerTurnEnded);
			((StatusEffect)this).Highlight = true;
		}

		private void OnDamageDealing(DamageDealingEventArgs args)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			DamageInfo damageInfo = args.DamageInfo;
			args.DamageInfo = ((DamageInfo)(ref damageInfo)).MultiplyBy(0);
			((GameEventArgs)args).AddModifier((GameEntity)(object)this);
			if ((int)((GameEventArgs)args).Cause != 20)
			{
				((StatusEffect)this).NotifyActivating();
			}
		}

		private IEnumerable<BattleAction> OnOwnerTurnEnded(UnitEventArgs args)
		{
			yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f);
		}
	}
	public sealed class secirnolevelDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.HasCount = true;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(secirnolevelDef))]
	public sealed class secirnolevel : StatusEffect
	{
		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).Count = 0;
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnding, (EventSequencedReactor<UnitEventArgs>)OnTurnEnding);
			((StatusEffect)this).HandleOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (GameEventHandler<CardUsingEventArgs>)OnCardUsed);
		}

		public void OnCardUsed(CardUsingEventArgs args)
		{
			int count = ((StatusEffect)this).Count;
			((StatusEffect)this).Count = count + 1;
			if (((StatusEffect)this).Count >= 10)
			{
				((StatusEffect)this).Highlight = true;
			}
		}

		private IEnumerable<BattleAction> OnTurnEnding(UnitEventArgs args)
		{
			int loss = Convert.ToInt32(Math.Floor((double)(((StatusEffect)this).Count / 10))) * ((StatusEffect)this).Level;
			if (!((StatusEffect)this).Battle.BattleShouldEnd && loss != 0)
			{
				((StatusEffect)this).NotifyActivating();
				yield return (BattleAction)(object)DamageAction.LoseLife(((StatusEffect)this).Owner, loss, "Poison");
				((StatusEffect)this).Count = 0;
				((StatusEffect)this).Highlight = false;
			}
		}
	}
	public sealed class seDeepFreezeDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.Type = (StatusEffectType)1;
			defaultStatusEffectConfig.Order = 8;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(seDeepFreezeDef))]
	public sealed class seDeepFreeze : StatusEffect
	{
		public override bool ForceNotShowDownText => true;

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).HandleOwnerEvent<DamageEventArgs>(unit.DamageReceiving, (GameEventHandler<DamageEventArgs>)OnDamageReceiving);
			((StatusEffect)this).ReactOwnerEvent<GameEventArgs>(((StatusEffect)this).Battle.RoundEnding, (EventSequencedReactor<GameEventArgs>)OnRoundEnding);
		}

		private void OnDamageReceiving(DamageEventArgs args)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = args.DamageInfo;
			((DamageInfo)(ref damageInfo)).Damage = ((DamageInfo)(ref damageInfo)).Amount * 2f;
			args.DamageInfo = damageInfo;
			((GameEventArgs)args).AddModifier((GameEntity)(object)this);
		}

		private IEnumerable<BattleAction> OnRoundEnding(GameEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f);
			}
		}
	}
	public sealed class seedgingDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.HasCount = true;
			defaultStatusEffectConfig.Type = (StatusEffectType)1;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(seedgingDef))]
	public sealed class seedging : StatusEffect
	{
		public override bool ForceNotShowDownText => true;

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).Count = ((StatusEffect)this).Level;
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnding, (EventSequencedReactor<UnitEventArgs>)OnTurnEnding);
			((StatusEffect)this).HandleOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (GameEventHandler<CardUsingEventArgs>)OnCardUsed);
		}

		public void OnCardUsed(CardUsingEventArgs args)
		{
			if (((StatusEffect)this).Count > 0)
			{
				int count = ((StatusEffect)this).Count;
				((StatusEffect)this).Count = count - 1;
			}
			if (((StatusEffect)this).Count == 0)
			{
				((StatusEffect)this).Highlight = true;
			}
		}

		private IEnumerable<BattleAction> OnTurnEnding(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).NotifyActivating();
				if (((StatusEffect)this).Count == 0 && !((StatusEffect)this).Owner.HasStatusEffect<FoxCharm>())
				{
					yield return (BattleAction)(object)new ApplyStatusEffectAction<FoxCharm>(((StatusEffect)this).Owner, (int?)null, (int?)null, (int?)null, (int?)3, 0f, true);
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f);
				}
				((StatusEffect)this).Count = ((StatusEffect)this).Level;
				((StatusEffect)this).Highlight = false;
			}
		}
	}
	public sealed class seFairyTreeDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.HasCount = true;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(seFairyTreeDef))]
	public sealed class seFairyTree : StatusEffect
	{
		public ManaGroup Mana => ManaGroup.Philosophies(1);

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).ReactOwnerEvent<CardMovingEventArgs>(((StatusEffect)this).Battle.CardMoved, (EventSequencedReactor<CardMovingEventArgs>)OnCardMoved);
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnding, (EventSequencedReactor<UnitEventArgs>)OnTurnEnding);
			((StatusEffect)this).ReactOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToHand, (EventSequencedReactor<CardsEventArgs>)OnCardsAddedToHand);
			((StatusEffect)this).ReactOwnerEvent<CardEventArgs>(((StatusEffect)this).Battle.CardDrawn, (EventSequencedReactor<CardEventArgs>)OnCardDrawn);
			if (((StatusEffect)this).Count > 0)
			{
				((StatusEffect)this).Highlight = true;
			}
		}

		private IEnumerable<BattleAction> OnCardMoved(CardMovingEventArgs args)
		{
			if (((GameEventArgs)args).ActionSource != this && !((StatusEffect)this).Battle.BattleShouldEnd && ((StatusEffect)this).Count > 0 && (int)args.DestinationZone == 2 && ((int)args.Card.CardType == 3 || (int)args.Card.Config.Type == 5))
			{
				((StatusEffect)this).NotifyActivating();
				if (((StatusEffect)this).Count > 0)
				{
					yield return (BattleAction)new GainManaAction(Mana);
					yield return (BattleAction)new DrawManyCardAction(1);
					int count = ((StatusEffect)this).Count;
					((StatusEffect)this).Count = count - 1;
				}
				if (((StatusEffect)this).Count <= 0)
				{
					((StatusEffect)this).Highlight = false;
				}
			}
		}

		private IEnumerable<BattleAction> OnCardDrawn(CardEventArgs args)
		{
			if (((GameEventArgs)args).ActionSource != this && !((StatusEffect)this).Battle.BattleShouldEnd && ((StatusEffect)this).Count > 0 && ((int)args.Card.CardType == 3 || (int)args.Card.Config.Type == 5))
			{
				((StatusEffect)this).NotifyActivating();
				if (((StatusEffect)this).Count > 0)
				{
					yield return (BattleAction)new GainManaAction(Mana);
					yield return (BattleAction)new DrawManyCardAction(1);
					int count = ((StatusEffect)this).Count;
					((StatusEffect)this).Count = count - 1;
				}
				if (((StatusEffect)this).Count <= 0)
				{
					((StatusEffect)this).Highlight = false;
				}
			}
		}

		private IEnumerable<BattleAction> OnCardsAddedToHand(CardsEventArgs args)
		{
			if (((GameEventArgs)args).ActionSource != this && !((StatusEffect)this).Battle.BattleShouldEnd && ((StatusEffect)this).Count > 0 && args.Cards.Any((Card card) => (int)card.CardType == 5 || (int)card.Config.Type == 3))
			{
				((StatusEffect)this).NotifyActivating();
				if (((StatusEffect)this).Count > 0)
				{
					yield return (BattleAction)new GainManaAction(Mana);
					yield return (BattleAction)new DrawManyCardAction(1);
					int count = ((StatusEffect)this).Count;
					((StatusEffect)this).Count = count - 1;
				}
				if (((StatusEffect)this).Count <= 0)
				{
					((StatusEffect)this).Highlight = false;
				}
			}
		}

		private IEnumerable<BattleAction> OnTurnEnding(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).Count = ((StatusEffect)this).Level;
				((StatusEffect)this).Highlight = true;
			}
			yield break;
		}
	}
	public sealed class seggDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			return lvalonmemesetemplate.GetDefaultStatusEffectConfig();
		}
	}
	[EntityLogic(typeof(seggDef))]
	public sealed class segg : StatusEffect
	{
		public ManaGroup Mana => ManaGroup.Colorlesses(1);

		public override bool ForceNotShowDownText => true;

		protected override void OnAdded(Unit unit)
		{
			foreach (Card item in ((StatusEffect)this).Battle.EnumerateAllCards().Where(delegate(Card card)
			{
				//IL_0009: 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)
				int result;
				if (!card.IsPurified)
				{
					ManaGroup cost = card.Cost;
					result = (((ManaGroup)(ref cost)).HasTrivialOrHybrid ? 1 : 0);
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			}))
			{
				item.IsPurified = true;
			}
			((StatusEffect)this).NotifyActivating();
			((StatusEffect)this).HandleOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToDiscard, (GameEventHandler<CardsEventArgs>)OnAddCard);
			((StatusEffect)this).HandleOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToHand, (GameEventHandler<CardsEventArgs>)OnAddCard);
			((StatusEffect)this).HandleOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToExile, (GameEventHandler<CardsEventArgs>)OnAddCard);
			((StatusEffect)this).HandleOwnerEvent<CardsAddingToDrawZoneEventArgs>(((StatusEffect)this).Battle.CardsAddedToDrawZone, (GameEventHandler<CardsAddingToDrawZoneEventArgs>)OnAddCardToDraw);
			((StatusEffect)this).HandleOwnerEvent<CardTransformEventArgs>(((StatusEffect)this).Battle.CardTransformed, (GameEventHandler<CardTransformEventArgs>)OnCardTransformed);
			((StatusEffect)this).HandleOwnerEvent<ManaEventArgs>(((StatusEffect)this).Battle.ManaGaining, (GameEventHandler<ManaEventArgs>)OnManaGaining);
		}

		private void OnManaGaining(ManaEventArgs args)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (ManaGroupExtensions.WithColorless(args.Value, 0) != ManaGroup.Empty)
			{
				((StatusEffect)this).NotifyActivating();
				ManaGroup value = args.Value;
				args.Value = ManaGroup.Colorlesses(((ManaGroup)(ref value)).Amount);
				((GameEventArgs)args).AddModifier((GameEntity)(object)this);
			}
		}

		private void OnAddCard(CardsEventArgs args)
		{
			Card[] array = args.Cards.Where(delegate(Card card)
			{
				//IL_0009: 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)
				int result;
				if (!card.IsPurified)
				{
					ManaGroup cost = card.Cost;
					result = (((ManaGroup)(ref cost)).HasTrivialOrHybrid ? 1 : 0);
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			}).ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].IsPurified = true;
			}
		}

		private void OnAddCardToDraw(CardsAddingToDrawZoneEventArgs args)
		{
			Card[] array = args.Cards.Where(delegate(Card card)
			{
				//IL_0009: 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)
				int result;
				if (!card.IsPurified)
				{
					ManaGroup cost = card.Cost;
					result = (((ManaGroup)(ref cost)).HasTrivialOrHybrid ? 1 : 0);
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			}).ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].IsPurified = true;
			}
		}

		private void OnCardTransformed(CardTransformEventArgs args)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (args.DestinationCard.IsPurified)
			{
				ManaGroup cost = args.DestinationCard.Cost;
				if (((ManaGroup)(ref cost)).HasTrivialOrHybrid)
				{
					args.DestinationCard.IsPurified = true;
				}
			}
		}
	}
	public sealed class sekotkDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.Type = (StatusEffectType)2;
			defaultStatusEffectConfig.Order = 20;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(sekotkDef))]
	public sealed class sekotk : StatusEffect
	{
		public int Value1
		{
			get
			{
				if (((GameEntity)this).GameRun.Battle != null)
				{
					return ((StatusEffect)this).Level + 1;
				}
				return 2;
			}
		}

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).ReactOwnerEvent<DamageEventArgs>(((StatusEffect)this).Owner.DamageReceived, (EventSequencedReactor<DamageEventArgs>)OnDamageReceived);
			((StatusEffect)this).HandleOwnerEvent<DamageDealingEventArgs>(((StatusEffect)this).Owner.DamageDealing, (GameEventHandler<DamageDealingEventArgs>)OnDamageDealing);
		}

		private IEnumerable<BattleAction> OnDamageReceived(DamageEventArgs args)
		{
			if (((StatusEffect)this).Battle.BattleShouldEnd)
			{
				yield break;
			}
			DamageInfo damageInfo = args.DamageInfo;
			int num;
			if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
			{
				damageInfo = args.DamageInfo;
				num = ((((DamageInfo)(ref damageInfo)).Damage > 0f) ? 1 : 0);
			}
			else
			{
				num = 0;
			}
			if (num != 0)
			{
				if (((GameEntity)this).GameRun.BaseDeck.Any((Card c) => c is cardyoumi))
				{
					yield return ((StatusEffect)this).BuffAction<NextTurnLoseGame>(0, 0, 0, 0, 0.2f);
				}
				else
				{
					yield return (BattleAction)new DamageAction(((StatusEffect)this).Owner, ((StatusEffect)this).Owner, DamageInfo.Reaction(9999f, false), "Instant", (GunType)0);
				}
			}
		}

		private void OnDamageDealing(DamageDealingEventArgs args)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			DamageInfo damageInfo = args.DamageInfo;
			if ((int)((DamageInfo)(ref damageInfo)).DamageType == 2)
			{
				damageInfo = args.DamageInfo;
				args.DamageInfo = ((DamageInfo)(ref damageInfo)).MultiplyBy(((StatusEffect)this).Level + 1);
				((GameEventArgs)args).AddModifier((GameEntity)(object)this);
				if ((int)((GameEventArgs)args).Cause != 20)
				{
					((StatusEffect)this).NotifyActivating();
				}
			}
		}
	}
	public sealed class semanaunfreezeDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			return lvalonmemesetemplate.GetDefaultStatusEffectConfig();
		}
	}
	[EntityLogic(typeof(semanaunfreezeDef))]
	public sealed class semanaunfreeze : StatusEffect
	{
		public ManaGroup Mana => ManaGroup.Anys(1);

		protected override void OnAdded(Unit unit)
		{
			//IL_001f: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			foreach (Card item in unit.Battle.EnumerateAllCards())
			{
				item.AuraCost -= Mana;
			}
			((StatusEffect)this).HandleOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToDiscard, (GameEventHandler<CardsEventArgs>)OnAddCard);
			((StatusEffect)this).HandleOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToHand, (GameEventHandler<CardsEventArgs>)OnAddCard);
			((StatusEffect)this).HandleOwnerEvent<CardsEventArgs>(((StatusEffect)this).Battle.CardsAddedToExile, (GameEventHandler<CardsEventArgs>)OnAddCard);
			((StatusEffect)this).HandleOwnerEvent<CardsAddingToDrawZoneEventArgs>(((StatusEffect)this).Battle.CardsAddedToDrawZone, (GameEventHandler<CardsAddingToDrawZoneEventArgs>)OnAddCardToDraw);
			((StatusEffect)this).HandleOwnerEvent<CardTransformEventArgs>(((StatusEffect)this).Battle.CardTransformed, (GameEventHandler<CardTransformEventArgs>)OnCardTransformed);
			((StatusEffect)this).ReactOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (EventSequencedReactor<CardUsingEventArgs>)OnCardUsed);
		}

		private void OnAddCard(CardsEventArgs args)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			Card[] cards = args.Cards;
			foreach (Card obj in cards)
			{
				obj.AuraCost -= Mana;
			}
			((StatusEffect)this).NotifyActivating();
		}

		private void OnAddCardToDraw(CardsAddingToDrawZoneEventArgs args)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			Card[] cards = args.Cards;
			foreach (Card obj in cards)
			{
				obj.AuraCost -= Mana;
			}
			((StatusEffect)this).NotifyActivating();
		}

		private void OnCardTransformed(CardTransformEventArgs args)
		{
			//IL_0008: 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)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Card destinationCard = args.DestinationCard;
			destinationCard.AuraCost -= Mana;
			((StatusEffect)this).NotifyActivating();
		}

		private IEnumerable<BattleAction> OnCardUsed(CardUsingEventArgs args)
		{
			int level = ((StatusEffect)this).Level;
			((StatusEffect)this).Level = level - 1;
			if (((StatusEffect)this).Level <= 0)
			{
				yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f);
			}
		}

		protected override void OnRemoved(Unit unit)
		{
			//IL_001f: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			foreach (Card item in ((StatusEffect)this).Battle.EnumerateAllCards())
			{
				item.AuraCost += Mana;
			}
		}
	}
	public sealed class sesanaeconfessionDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			return lvalonmemesetemplate.GetDefaultStatusEffectConfig();
		}
	}
	[EntityLogic(typeof(sesanaeconfessionDef))]
	public sealed class sesanaeconfession : StatusEffect
	{
		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).ReactOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (EventSequencedReactor<CardUsingEventArgs>)OnCardUsed);
		}

		private IEnumerable<BattleAction> OnCardUsed(CardUsingEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd && args.Card is LoveLetter)
			{
				int level = ((StatusEffect)this).Level;
				((StatusEffect)this).Level = level - 1;
				if (((StatusEffect)this).Level <= 0)
				{
					((StatusEffect)this).Battle.RequestDebugAction((BattleAction)new InstantWinAction(), "sanaeconfession win");
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f);
				}
			}
		}
	}
	public sealed class sesanaeseductionDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.HasCount = true;
			defaultStatusEffectConfig.Type = (StatusEffectType)1;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(sesanaeseductionDef))]
	public sealed class sesanaeseduction : StatusEffect
	{
		public override bool ForceNotShowDownText => true;

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).Count = 2;
			((StatusEffect)this).ReactOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (EventSequencedReactor<CardUsingEventArgs>)OnCardUsed);
		}

		private IEnumerable<BattleAction> OnCardUsed(CardUsingEventArgs args)
		{
			if (args.Card is cardsanaeseduction)
			{
				if (((StatusEffect)this).Count > 0)
				{
					int count = ((StatusEffect)this).Count;
					((StatusEffect)this).Count = count - 1;
				}
				if (((StatusEffect)this).Count == 0)
				{
					((StatusEffect)this).Count = 2;
					((StatusEffect)this).NotifyActivating();
					yield return (BattleAction)new AddCardsToDeckAction((IEnumerable<Card>)Library.CreateCards<NewsNegative>(1, false));
				}
			}
		}
	}
	public sealed class seWhiteWorldDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.Type = (StatusEffectType)2;
			defaultStatusEffectConfig.HasCount = true;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(seWhiteWorldDef))]
	public sealed class seWhiteWorld : StatusEffect
	{
		public ManaGroup Mana => ManaGroup.Anys(((StatusEffect)this).Count);

		public ManaGroup nbMana => ManaGroup.Anys(1);

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnding, (EventSequencedReactor<UnitEventArgs>)OnTurnEnding);
		}

		private IEnumerable<BattleAction> OnTurnEnding(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).NotifyActivating();
				yield return (BattleAction)(object)new ApplyStatusEffectAction<Firepower>(((StatusEffect)this).Owner, (int?)((StatusEffect)this).Level, (int?)0, (int?)0, (int?)0, 0.2f, true);
				yield return (BattleAction)(object)new ApplyStatusEffectAction<Spirit>(((StatusEffect)this).Owner, (int?)((StatusEffect)this).Level, (int?)0, (int?)0, (int?)0, 0.2f, true);
				yield return ((StatusEffect)this).DebuffAction<ManaFreezed>(((StatusEffect)this).Owner, ((StatusEffect)this).Count, 0, 0, 0, true, 0.1f);
			}
		}
	}
	public sealed class seYonglinCardDef : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.HasCount = true;
			defaultStatusEffectConfig.Order = 11;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(seYonglinCardDef))]
	public sealed class seYonglinCard : StatusEffect
	{
		public bool hold = true;

		public ManaGroup Mana => ManaGroup.Anys(1);

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).Count = ((StatusEffect)this).Level;
			((StatusEffect)this).Highlight = true;
			((StatusEffect)this).ReactOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (EventSequencedReactor<CardUsingEventArgs>)OnCardUsed);
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnTurnStarting);
		}

		private IEnumerable<BattleAction> OnCardUsed(CardUsingEventArgs args)
		{
			Card card = args.Card;
			if (((StatusEffect)this).Battle.BattleShouldEnd || !card.CanBeDuplicated || ((StatusEffect)this).Count == 0 || hold)
			{
				hold = false;
				yield break;
			}
			((StatusEffect)this).NotifyActivating();
			Card card2 = card.CloneBattleCard();
			card2.SetTurnCost(Mana);
			card2.IsExile = true;
			card2.IsEthereal = true;
			List<Card> cards = new List<Card> { card2 };
			yield return (BattleAction)new AddCardsToHandAction((IEnumerable<Card>)cards, (AddCardsType)0);
			if (((StatusEffect)this).Count > 0)
			{
				int count = ((StatusEffect)this).Count;
				((StatusEffect)this).Count = count - 1;
			}
			if (((StatusEffect)this).Count == 0)
			{
				((StatusEffect)this).Highlight = false;
			}
		}

		private IEnumerable<BattleAction> OnTurnStarting(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).Count = ((StatusEffect)this).Level;
				((StatusEffect)this).Highlight = true;
			}
			yield break;
		}
	}
	public sealed class seYonglinCard0Def : lvalonmemesetemplate
	{
		public override StatusEffectConfig MakeConfig()
		{
			StatusEffectConfig defaultStatusEffectConfig = lvalonmemesetemplate.GetDefaultStatusEffectConfig();
			defaultStatusEffectConfig.HasCount = true;
			return defaultStatusEffectConfig;
		}
	}
	[EntityLogic(typeof(seYonglinCard0Def))]
	public sealed class seYonglinCard0 : StatusEffect
	{
		public bool hold = true;

		public ManaGroup Mana => ManaGroup.Anys(0);

		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).Count = ((StatusEffect)this).Level;
			((StatusEffect)this).Highlight = true;
			((StatusEffect)this).ReactOwnerEvent<CardUsingEventArgs>(((StatusEffect)this).Battle.CardUsed, (EventSequencedReactor<CardUsingEventArgs>)OnCardUsed);
			((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnTurnStarting);
		}

		private IEnumerable<BattleAction> OnCardUsed(CardUsingEventArgs args)
		{
			Card card = args.Card;
			if (((StatusEffect)this).Battle.BattleShouldEnd || !card.CanBeDuplicated || ((StatusEffect)this).Count == 0 || hold)
			{
				hold = false;
				yield break;
			}
			((StatusEffect)this).NotifyActivating();
			Card card2 = card.CloneBattleCard();
			card2.SetTurnCost(Mana);
			card2.IsExile = true;
			card2.IsEthereal = true;
			List<Card> cards = new List<Card> { card2 };
			yield return (BattleAction)new AddCardsToHandAction((IEnumerable<Card>)cards, (AddCardsType)0);
			if (((StatusEffect)this).Count > 0)
			{
				int count = ((StatusEffect)this).Count;
				((StatusEffect)this).Count = count - 1;
			}
			if (((StatusEffect)this).Count == 0)
			{
				((StatusEffect)this).Highlight = false;
			}
		}

		private IEnumerable<BattleAction> OnTurnStarting(UnitEventArgs args)
		{
			if (!((StatusEffect)this).Battle.BattleShouldEnd)
			{
				((StatusEffect)this).Count = ((StatusEffect)this).Level;
				((StatusEffect)this).Highlight = true;
			}
			yield break;
		}
	}
	public class lvalonmemesetemplate : StatusEffectTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit(SampleCharacterDefaultConfig.DefaultID((EntityDefinition)(object)this));
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)SampleCharacterLocalization.StatusEffectsBatchLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override Sprite LoadSprite()
		{
			return SampleCharacterImageLoader.LoadStatusEffectLoader((StatusEffectTemplate)(object)this);
		}

		public override StatusEffectConfig MakeConfig()
		{
			return GetDefaultStatusEffectConfig();
		}

		public static StatusEffectConfig GetDefaultStatusEffectConfig()
		{
			return SampleCharacterDefaultConfig.DefaultStatusEffectConfig();
		}
	}
}
namespace lvalonmeme.Patches
{
	[HarmonyPatch]
	internal class CustomGameEventManager
	{
		[HarmonyPatch(typeof(UiManager), "EnterGameRun")]
		private class UiManager_EnterGameRun_Patch
		{
			private static void Postfix(UiManager __instance)
			{
				//IL_0076: 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)
				//IL_00a1: Expected O, but got Unknown
				if (Singleton<GameMaster>.Instance.CurrentGameRun != null && Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox x) => ((GameEntity)x).Id == "JadeBoxDouble" && BepinexPlugin.doublelife.Value))
				{
					TweenExtensions.WaitForCompletion((Tween)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).GetView<UnitView>()).transform, new Vector3(1.2f, 1.2f, 1.2f), 1f), (Ease)1), true), true));
				}
			}
		}

		[HarmonyPatch(typeof(GameRunController), "InternalGainMoney")]
		private class GameRunController_InternalGainMoney_Patch
		{
			private static void Prefix(GameRunController __instance, ref int money)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox x) => ((GameEntity)x).Id == "JadeBoxDouble") && BepinexPlugin.doublemoney.Value)
				{
					money *= 2;
				}
			}
		}

		[HarmonyPatch(typeof(GameRunController), "InternalGainPower")]
		private class GameRunController_InternalGainPower_Patch
		{
			private static void Prefix(GameRunController __instance, ref int power)
			{
				if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox x) => ((GameEntity)x).Id == "JadeBoxDouble") && BepinexPlugin.doublepower.Value)
				{
					power *= 2;
				}
			}
		}

		private static List<string> memecardids = new List<string>
		{
			"cardlvalon", "cardkotk", "card9999", "cardanlemi", "cardaleph", "cardedoras", "cardyanling", "cardshouchang", "cardallfriends", "cardprimitive",
			"cardbb", "cardsanaeseduction", "cardgg", "cardsanaeconfession", "cardyoumi", "cardarashi", "cardbluepoint", "cardcirnolevel"
		};

		private static List<string> oldcardids = new List<string>
		{
			"cardold", "cardDoremyDuplicate", "cardYonglinCard", "cardMystiaSing", "cardMeilingBlock", "cardTwoBalls", "cardIceLance", "cardIceMatrix", "cardLarvaDefense", "cardSummerParty",
			"cardWhiteWorld", "cardFairyTree", "cardDeepFreeze", "cardBladePower", "cardFairyWrath", "cardColdChain", "cardJinziDoppelganger", "cardTaijiLiangyi", "cardYaoguaiBuster", "cardCleanRoom",
			"cardSakuyaSleep", "cardDropToKnife", "cardChangzhizhen", "cardHuanxiangBlock", "cardShenziUpgradeAll"
		};

		private static List<string> oldcardbanids = new List<string>
		{
			"DoremyDuplicate", "YonglinCard", "MystiaSing", "MeilingBlock", "TwoBalls", "IceLance", "IceMatrix", "LarvaDefense", "SummerParty", "WhiteWorld",
			"FairyTree", "DeepFreeze", "BladePower", "FairyWrath", "ColdChain", "JinziDoppelganger", "TaijiLiangyi", "YaoguaiBuster", "CleanRoom", "SakuyaSleep",
			"DropToKnife", "Changzhizhen", "HuanxiangBlock", "ShenziUpgradeAll"
		};

		[HarmonyPatch(typeof(GameRunController), "RollTransformCard", new Type[]
		{
			typeof(RandomGen),
			typeof(CardWeightTable),
			typeof(bool),
			typeof(bool),
			typeof(Predicate<CardConfig>)
		})]
		[HarmonyPostfix]
		private static void Postfix(GameRunController __instance, ref Card __result, RandomGen rng, CardWeightTable weightTable, bool applyFactors, bool battleRolling, Predicate<CardConfig> filter)
		{
			if (__result == null)
			{
				__result = __instance.RollCard(rng, weightTable, applyFactors, battleRolling, (Predicate<CardConfig>)null);
				if (__result == null)
				{
					__result = (Card)(object)Library.CreateCard<Shoot>();
				}
			}
		}

		public static IEnumerable<string> GetList(string type)
		{
			return type switch
			{
				"meme" => memecardids, 
				"old" => oldcardids, 
				"oldban" => oldcardbanids, 
				_ => new List<string>(), 
			};
		}

		[HarmonyPatch(typeof(CardWeightTable), "WeightFor", new Type[]
		{
			typeof(CardConfig),
			typeof(string),
			typeof(ISet<string>)
		})]
		[HarmonyPostfix]
		public static void OverrideWeightFor(CardWeightTable __instance, CardConfig cardConfig, string playerId, ISet<string> exhibitOwnerIds, ref float __result)
		{
			if (Singleton<GameMaster>.Instance.CurrentGameRun == null)
			{
				return;
			}
			string[] array = toolbox.banlistgetter();
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (text.ToLowerInvariant() == cardConfig.Id.ToLowerInvariant())
				{
					__result = 0f;
				}
			}
			float num = 1f * (float)BepinexPlugin.imult.Value;
			string[] array3 = BepinexPlugin.imultlist.Value.Split(',');
			string[] array4 = array3;
			foreach (string text2 in array4)
			{
				if (text2.ToLowerInvariant() == cardConfig.Id.ToLowerInvariant())
				{
					__result += num;
				}
			}
			if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableMemes"))
			{
				float num2 = 1f * (float)BepinexPlugin.mult.Value;
				if (Singleton<GameMaster>.Instance.CurrentGameRun == null)
				{
					if (memecardids.Contains(cardConfig.Id))
					{
						__result *= num2;
					}
				}
				else if (Singleton<GameMaster>.Instance.CurrentGameRun.Battle == null && memecardids.Contains(cardConfig.Id) && !(from x in Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck
					where memecardids.Contains(((GameEntity)x).Id)
					select ((GameEntity)x).Id).ToList().Contains(cardConfig.Id))
				{
					__result *= num2;
				}
			}
			else if (memecardids.Contains(cardConfig.Id))
			{
				__result = 0f;
			}
			if (!Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox jb) => ((GameEntity)jb).Id == "JadeBoxEnableOld"))
			{
				if (oldcardids.Contains(cardConfig.Id))
				{
					__result = 0f;
				}
			}
			else if (oldcardbanids.Contains(cardConfig.Id))
			{
				__result = 0f;
			}
		}
	}
}
namespace lvalonmeme.model
{
	public sealed class lvalonmemeel : UnitModelTemplate
	{
		public static bool useInGameModel = BepinexPlugin.useInGameModel;

		public static string model_name = (useInGameModel ? BepinexPlugin.modelName : "lvalonmemeel.png");

		public static string spellsprite_name = "SampleCharacterStand.png";

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

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)SampleCharacterLocalization.UnitModelBatchLoc.AddEntity((EntityDefinition)(object)this);
		}

		public override ModelOption LoadModelOptions()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (useInGameModel)
			{
				return new ModelOption(ResourcesHelper.LoadSpineUnitAsync(model_name));
			}
			return new ModelOption(ResourceLoader.LoadSpriteAsync(model_name, BepinexPlugin.directorySource, 565, (GraphicsFormat)4, 1, (FilterMode)1, (SpriteMeshType)1, (Rect?)null, (Vector2?)null, "file://"));
		}

		public override UniTask<Sprite> LoadSpellSprite()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (useInGameModel)
			{
				return ResourcesHelper.LoadSpellPortraitAsync(model_name);
			}
			return ResourceLoader.LoadSpriteAsync(spellsprite_name, BepinexPlugin.directorySource, 100, (GraphicsFormat)4, 1, (FilterMode)1, (SpriteMeshType)1, (Rect?)null, (Vector2?)null, "file://");
		}

		public override UnitModelConfig MakeConfig()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (useInGameModel)
			{
				UnitModelConfig val = ObjectExtensions.Copy<UnitModelConfig>(UnitModelConfig.FromName(model_name));
				val.Flip = BepinexPlugin.modelIsFlipped;
				return val;
			}
			UnitModelConfig val2 = ObjectExtensions.Copy<UnitModelConfig>(((UnitModelTemplate)this).DefaultConfig());
			val2.Flip = BepinexPlugin.modelIsFlipped;
			val2.Type = 0;
			val2.Offset = new Vector2(0f, -0.1f);
			val2.HasSpellPortrait = true;
			return val2;
		}
	}
}
namespace lvalonmeme.Localization
{
	public sealed class SampleCharacterLocalization
	{
		public static string Cards = "Cards";

		public static string Exhibits = "Exhibits";

		public static string PlayerUnit = "PlayerUnit";

		public static string EnemiesUnit = "EnemyUnit";

		public static string UnitModel = "UnitModel";

		public static string UltimateSkills = "UltimateSkills";

		public static string StatusEffects = "StatusEffects";

		public static string JadeBoxes = "JadeBoxes";

		public static BatchLocalization CardsBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(CardTemplate), Cards, (Locale)0, false);

		public static BatchLocalization ExhibitsBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(ExhibitTemplate), Exhibits, (Locale)0, false);

		public static BatchLocalization PlayerUnitBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(PlayerUnitTemplate), PlayerUnit, (Locale)0, false);

		public static BatchLocalization EnemiesUnitBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(EnemyUnitTemplate), EnemiesUnit, (Locale)0, false);

		public static BatchLocalization UnitModelBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(UnitModelTemplate), UnitModel, (Locale)0, false);

		public static BatchLocalization UltimateSkillsBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(UltimateSkillTemplate), UltimateSkills, (Locale)0, false);

		public static BatchLocalization StatusEffectsBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(StatusEffectTemplate), StatusEffects, (Locale)0, false);

		public static BatchLocalization JadeBoxBatchLoc = new BatchLocalization((IResourceSource)(object)BepinexPlugin.directorySource, typeof(JadeBoxTemplate), JadeBoxes, (Locale)0, false);

		public static void Init()
		{
			CardsBatchLoc.DiscoverAndLoadLocFiles(Cards);
			ExhibitsBatchLoc.DiscoverAndLoadLocFiles(Exhibits);
			PlayerUnitBatchLoc.DiscoverAndLoadLocFiles(PlayerUnit);
			EnemiesUnitBatchLoc.DiscoverAndLoadLocFiles(EnemiesUnit);
			UnitModelBatchLoc.DiscoverAndLoadLocFiles(UnitModel);
			UltimateSkillsBatchLoc.DiscoverAndLoadLocFiles(UltimateSkills);
			StatusEffectsBatchLoc.DiscoverAndLoadLocFiles(StatusEffects);
			JadeBoxBatchLoc.DiscoverAndLoadLocFiles(JadeBoxes);
		}
	}
}
namespace lvalonmeme.JadeBoxes
{
	public class JadeBoxEnableMemes
	{
		public sealed class JadeBoxEnableMemesDef : lvalonmemejadeboxtemplate
		{
			[EntityLogic(typeof(JadeBoxEnableMemesDef))]
			public sealed class JadeBoxEnableMemes : JadeBox
			{
			}

			public override JadeBoxConfig MakeConfig()
			{
				return ((JadeBoxTemplate)this).DefaultConfig();
			}
		}
	}
	public class JadeBoxEnableOld
	{
		public sealed class JadeBoxEnableOldDef : lvalonmemejadeboxtemplate
		{
			[EntityLogic(typeof(JadeBoxEnableOldDef))]
			public sealed class JadeBoxEnableOld : JadeBox
			{
				protected override void OnAdded()
				{
					((JadeBox)this).HandleGameRunEvent<StationEventArgs>(((GameEntity)this).GameRun.StationEntered, (GameEventHandler<StationEventArgs>)OnStationEntered);
				}

				protected override void OnGain(GameRunController gameRun)
				{
					((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(RemoveFromPool(gameRun));
				}

				private IEnumerator RemoveFromPool(GameRunController gameRun)
				{
					if (BepinexPlugin.oldcard.Value)
					{
						List<Card> card = new List<Card> { (Card)(object)Library.CreateCard<cardold>() };
						string[] arr = toolbox.banlistgetter();
						bool inban = false;
						string[] array = arr;
						foreach (string s in array)
						{
							if (s.ToLowerInvariant() == ((GameEntity)card[0]).Id.ToLowerInvariant())
							{
								inban = true;
								break;
							}
						}
						if (!inban)
						{
							gameRun.AddDeckCards((IEnumerable<Card>)card, false, (VisualSourceData)null);
						}
					}
					yield return null;
				}

				public void OnStationEntered(StationEventArgs args)
				{
					GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
					Station station = args.Station;
					EntryStation val = (EntryStation)(object)((station is EntryStation) ? station : null);
					if (val == null || CollectionsExtensions.IndexOf<Stage>(((GameEntity)this).GameRun.Stages, ((Station)val).Stage) != 0)
					{
						return;
					}
					List<Card> list = currentGameRun.BaseDeck.Where((Card card) => CustomGameEventManager.GetList("oldban").Contains(((GameEntity)card).Id)).ToList();
					foreach (Card item in list)
					{
						string id = ((GameEntity)item).Id;
						string text = id;
						if (!(text == "YaoguaiBuster"))
						{
							if (text == "IceLance")
							{
								currentGameRun.RemoveDeckCard(item, true);
								currentGameRun.AddDeckCard((Card)(object)Library.CreateCard<cardIceLance>(), false, (VisualSourceData)null);
							}
						}
						else
						{
							currentGameRun.RemoveDeckCard(item, true);
							currentGameRun.AddDeckCard((Card)(object)Library.CreateCard<cardYaoguaiBuster>(), false, (VisualSourceData)null);
						}
					}
				}

				private void UpgradeAllCards()
				{
					try
					{
						Debug.Log((object)("cards in deck: " + ((GameEntity)this).GameRun.BaseDeck.Count));
						foreach (Card item in ((GameEntity)this).GameRun.BaseDeck)
						{
							if (item.CanUpgrade && item.CanUpgradeAndPositive && !item.IsUpgraded)
							{
								item.Upgrade();
							}
						}
					}
					catch (Exception ex)
					{
						Debug.LogError((object)(" exception in UpgradeAllCards: " + ex.Message + ex.StackTrace));
					}
				}
			}

			public override JadeBoxConfig MakeConfig()
			{
				return ((JadeBoxTemplate)this).DefaultConfig();
			}
		}
	}
	public class JadeBox5Color
	{
		public sealed class JadeBox5ColorDef : lvalonmemejadeboxtemplate
		{
			[EntityLogic(typeof(JadeBox5ColorDef))]
			public sealed class JadeBox5Color : JadeBox
			{
				[HarmonyPatch(typeof(Debut), "ExchangeExhibit")]
				private class BanExhibitSwap_Patch
				{
					private static void Prefix(Debut __instance)
					{
					}
				}

				protected override void OnGain(GameRunController gameRun)
				{
					//IL_0009: Unknown result