Decompiled source of Aya Shameimaru v0.3.14

AyaShameimaru.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AddWatermark;
using AyaShameimaru.Cards;
using AyaShameimaru.EnemyUnits;
using AyaShameimaru.Exhibits;
using AyaShameimaru.PlayerUnits;
using AyaShameimaru.Stages;
using AyaShameimaru.StatusEffects;
using BepInEx;
using BepInEx.Bootstrap;
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 JetBrains.Annotations;
using LBoL.Base;
using LBoL.Base.Extensions;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Battle.Interactions;
using LBoL.Core.Cards;
using LBoL.Core.Helpers;
using LBoL.Core.Intentions;
using LBoL.Core.Randoms;
using LBoL.Core.Stations;
using LBoL.Core.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.Adventures.Common;
using LBoL.EntityLib.Adventures.FirstPlace;
using LBoL.EntityLib.Adventures.Shared23;
using LBoL.EntityLib.Adventures.Stage3;
using LBoL.EntityLib.Cards.Enemy;
using LBoL.EntityLib.Cards.Neutral.NoColor;
using LBoL.EntityLib.EnemyUnits.Character;
using LBoL.EntityLib.EnemyUnits.Opponent;
using LBoL.EntityLib.Exhibits;
using LBoL.EntityLib.Exhibits.Shining;
using LBoL.EntityLib.StatusEffects.Basic;
using LBoL.EntityLib.StatusEffects.Enemy;
using LBoL.EntityLib.StatusEffects.Enemy.SeijaItems;
using LBoL.EntityLib.StatusEffects.Reimu;
using LBoL.Presentation;
using LBoL.Presentation.UI;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.Units;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.ExtraFunc;
using LBoLEntitySideloader.Resource;
using LBoLEntitySideloader.Utils;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

[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("AyaShameimaru")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AyaShameimaru")]
[assembly: AssemblyTitle("AyaShameimaru")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AyaShameimaru
{
	[BepInPlugin("intoxicatedkid.ayashameimaru", "Aya Shameimaru", "0.3.14")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("LBoL.exe")]
	public class BepinexPlugin : BaseUnityPlugin
	{
		private static readonly Harmony harmony = PluginInfo.harmony;

		internal static ManualLogSource log;

		internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);

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

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

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

		internal static BatchLocalization enemyUnitLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(EnemyUnitTemplate), false);

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

		internal static BatchLocalization playerUnitLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(PlayerUnitTemplate), false);

		internal static BatchLocalization ultimateSkillLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(UltimateSkillTemplate), false);

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

		internal static BatchLocalization unitModelLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(UnitModelTemplate), false);

		public static ConfigEntry<bool> AyaPhantasmMode;

		public static ConfigEntry<string> AyaSave;

		public static int LastInput = 0;

		public static bool NormalAyaPlayerUnit => AyaSave.Value.Contains("NormalAyaPlayerUnit") ? true : false;

		public static bool HardAyaPlayerUnit => AyaSave.Value.Contains("HardAyaPlayerUnit") ? true : false;

		public static bool LunaticAyaPlayerUnit => AyaSave.Value.Contains("LunaticAyaPlayerUnit") ? true : false;

		public static bool PhantasmAyaPlayerUnit => AyaSave.Value.Contains("PhantasmAyaPlayerUnit") ? true : false;

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			AyaPhantasmMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Phantasm Mode", "Phantasm Mode", false, "Weakens many cards and exhibits.");
			AyaSave = ((BaseUnityPlugin)this).Config.Bind<string>("Records", "Records", "", "May cause an error if edited manually.");
			EntityManager.RegisterSelf();
			harmony.PatchAll();
			if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
			{
				WatermarkWrapper.ActivateWatermark();
			}
			AyaBackgrounds.AddAyaBackgrounds();
			cardLoc.DiscoverAndLoadLocFiles("Card");
			enemyUnitLoc.DiscoverAndLoadLocFiles("EnemyUnit");
			exhibitLoc.DiscoverAndLoadLocFiles("Exhibit");
			playerUnitLoc.DiscoverAndLoadLocFiles("PlayerUnit");
			ultimateSkillLoc.DiscoverAndLoadLocFiles("UltimateSkill");
			statusEffectLoc.DiscoverAndLoadLocFiles("StatusEffect");
			unitModelLoc.DiscoverAndLoadLocFiles("UnitModel");
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
			if (UnityInput.Current.anyKeyDown)
			{
				LastInput = 0;
			}
		}
	}
	public static class PluginInfo
	{
		public const string GUID = "intoxicatedkid.ayashameimaru";

		public const string Name = "Aya Shameimaru";

		public const string version = "0.3.14";

		public static readonly Harmony harmony = new Harmony("intoxicatedkid.ayashameimaru");
	}
	internal class WatermarkWrapper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void ActivateWatermark()
		{
			API.ActivateWatermark();
		}
	}
}
namespace AyaShameimaru.StatusEffects
{
	public sealed class AyaAccelerationSeDef : StatusEffectTemplate
	{
		[EntityLogic(typeof(AyaAccelerationSeDef))]
		public sealed class AyaAccelerationSe : StatusEffect
		{
			protected override void OnAdded(Unit unit)
			{
				((StatusEffect)this).HandleOwnerEvent<StatusEffectApplyEventArgs>(((StatusEffect)this).Owner.StatusEffectAdded, (GameEventHandler<StatusEffectApplyEventArgs>)delegate
				{
					int count3 = MathExtensions.RoundToInt(Math.Truncate((float)((StatusEffect)this).Level / 4f));
					((StatusEffect)this).Count = count3;
				});
				((StatusEffect)this).HandleOwnerEvent<StatusEffectEventArgs>(((StatusEffect)this).Owner.StatusEffectChanged, (GameEventHandler<StatusEffectEventArgs>)delegate
				{
					int count2 = MathExtensions.RoundToInt(Math.Truncate((float)((StatusEffect)this).Level / 4f));
					((StatusEffect)this).Count = count2;
				});
				((StatusEffect)this).HandleOwnerEvent<StatusEffectEventArgs>(((StatusEffect)this).Owner.StatusEffectRemoved, (GameEventHandler<StatusEffectEventArgs>)delegate
				{
					int count = MathExtensions.RoundToInt(Math.Truncate((float)((StatusEffect)this).Level / 4f));
					((StatusEffect)this).Count = count;
				});
				((StatusEffect)this).ReactOwnerEvent<UnitEventArgs>(((StatusEffect)this).Owner.TurnEnding, (EventSequencedReactor<UnitEventArgs>)OnOwnerTurnEnding);
				((StatusEffect)this).ReactOwnerEvent<DamageEventArgs>(((StatusEffect)this).Owner.DamageReceived, (EventSequencedReactor<DamageEventArgs>)OnOwnerDamageReceived);
			}

			private IEnumerable<BattleAction> OnOwnerTurnEnding(GameEventArgs args)
			{
				foreach (BattleAction item in Activate())
				{
					yield return item;
				}
			}

			public IEnumerable<BattleAction> Activate()
			{
				if (!((StatusEffect)this).Battle.BattleShouldEnd)
				{
					Graze statusEffect = ((StatusEffect)this).Owner.GetStatusEffect<Graze>();
					int num = ((statusEffect != null) ? ((StatusEffect)statusEffect).Level : 0);
					int num2 = MathExtensions.RoundToInt(Math.Truncate((float)((StatusEffect)this).Level / 4f));
					if (num < num2)
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<Graze>(((StatusEffect)this).Owner, (int?)(num2 - num), (int?)null, (int?)null, (int?)null, 0f, true);
					}
				}
			}

			private IEnumerable<BattleAction> OnOwnerDamageReceived(DamageEventArgs args)
			{
				DamageInfo damageInfo = args.DamageInfo;
				if (((DamageInfo)(ref damageInfo)).IsGrazed && !((Unit)((StatusEffect)this).Battle.Player).HasStatusEffect<AyaInstantShotJournalistSeDef.AyaInstantShotJournalistSe>())
				{
					((StatusEffect)this).Level = Math.Max(((StatusEffect)this).Level - 2, 0);
					if (((StatusEffect)this).Level <= 0)
					{
						yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0f);
					}
				}
			}

			public OpposeResult Oppose(AyaDecelerationSeDef.AyaDecelerationSe other)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				if (((StatusEffect)this).Level < ((StatusEffect)other).Level)
				{
					((StatusEffect)other).Level = ((StatusEffect)other).Level - ((StatusEffect)this).Level;
					return (OpposeResult)1;
				}
				if (((StatusEffect)this).Level == ((StatusEffect)other).Level)
				{
					return (OpposeResult)2;
				}
				((StatusEffect)this).Level = ((StatusEffect)this).Level - ((StatusEffect)other).Level;
				return (OpposeResult)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("AyaAccelerationSe");
		}

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

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

		public override StatusEffectConfig MakeConfig()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			return new StatusEffectConfig(BepinexPlugin.sequenceTable.Next(typeof(StatusEffectConfig)), "", 0, (StatusEffectType)0, false, true, (int?)null, true, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, true, (StackType?)(StackType)4, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string> { "Graze" }, "Graze", "Default", "Graze");
		}
	}
	public sealed class AyaDecelerationSeDef : StatusEffectTemplate
	{
		[EntityLogic(typeof(AyaDecelerationSeDef))]
		public sealed class AyaDecelerationSe : StatusEffect
		{
			public OpposeResult Oppose(AyaAccelerationSeDef.AyaAccelerationSe other)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				if (((StatusEffect)this).Level < ((StatusEffect)other).Level)
				{
					((StatusEffect)other).Level = ((StatusEffect)other).Level - ((StatusEffect)this).Level;
					return (OpposeResult)1;
				}
				if (((StatusEffect)this).Level == ((StatusEffect)other).Level)
				{
					return (OpposeResult)2;
				}
				((StatusEffect)this).Level = ((StatusEffect)this).Level - ((StatusEffect)other).Level;
				return (OpposeResult)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("AyaDecelerationSe");
		}

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

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

		public override StatusEffectConfig MakeConfig()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			return new StatusEffectConfig(BepinexPlugin.sequenceTable.Next(typeof(StatusEffectConfig)), "", 1, (StatusEffectType)0, false, true, (int?)null, true, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string>(), "Default", "Default", "Default");
		}
	}
	public sealed class AyaPassiveSeDef : StatusEffectTemplate
	{
		[EntityLogic(typeof(AyaPassiveSeDef))]
		public sealed class AyaPassiveSe : StatusEffect
		{
			[HarmonyPatch(typeof(Card), "LocalizeProperty")]
			private class Card_LocalizeProperty_Patch
			{
				private static bool Prefix(Card __instance, ref string key, ref bool decorated, ref bool required, ref string __result)
				{
					if (((GameEntity)__instance).Id == "AyaNews" && key == "Description" && Singleton<GameMaster>.Instance.CurrentGameRun != null && (Singleton<GameMaster>.Instance.CurrentGameRun.Player is AyaPlayerUnitDef.AyaPlayerUnit || Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<AyaGDef.AyaG>() || Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<AyaRDef.AyaR>()))
					{
						__result = TypeFactory<Card>.LocalizeProperty("AyaNewsSpecial", "AyaNewsDescription", decorated, required);
						return false;
					}
					return true;
				}
			}

			public int Value1 => 12;

			public int Value2 => 1;

			protected override void OnAdded(Unit unit)
			{
				((StatusEffect)this).ReactOwnerEvent<StatusEffectEventArgs>(((Unit)((StatusEffect)this).Battle.Player).StatusEffectRemoving, (EventSequencedReactor<StatusEffectEventArgs>)OnPlayerStatusEffectRemoving);
			}

			private IEnumerable<BattleAction> OnPlayerStatusEffectRemoving(StatusEffectEventArgs args)
			{
				if (args.Effect == this)
				{
					((GameEventArgs)args).ForceCancelBecause((CancelCause)4096);
				}
				yield break;
			}
		}

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

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

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

		public override StatusEffectConfig MakeConfig()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			return new StatusEffectConfig(BepinexPlugin.sequenceTable.Next(typeof(StatusEffectConfig)), "", -2, (StatusEffectType)2, false, true, (int?)null, false, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)8388608, (IReadOnlyList<string>)new List<string> { "LockedOn" }, "Default", "Default", "Default");
		}
	}
	public sealed class AyaPerfectGrazeSeDef : StatusEffectTemplate
	{
		[EntityLogic(typeof(AyaPerfectGrazeSeDef))]
		public sealed class AyaPerfectGrazeSe : StatusEffect
		{
			[HarmonyPatch(typeof(Unit), "MeasureDamage")]
			private class Unit_MeasureDamage_Patch
			{
				private static bool Prefix(Unit __instance, ref DamageInfo info, ref DamageInfo __result)
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Invalid comparison between Unknown and I4
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0055: Unknown result type (might be due to invalid IL or missing references)
					//IL_005a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					if (__instance.HasStatusEffect<AyaPerfectGrazeSe>() && (int)((DamageInfo)(ref info)).DamageType == 2 && MathExtensions.Round(((DamageInfo)(ref info)).Damage, MidpointRounding.AwayFromZero) > 0f && ((DamageInfo)(ref info)).IsAccuracy)
					{
						DamageInfo val = new DamageInfo(0f, ((DamageInfo)(ref info)).DamageType, true, ((DamageInfo)(ref info)).IsAccuracy, false);
						val = ((DamageInfo)(ref val)).BlockBy(__instance.Block);
						__result = ((DamageInfo)(ref val)).ShieldBy(__instance.Shield);
						return false;
					}
					return true;
				}
			}

			[HarmonyPatch(typeof(Unit), "TakeDamage")]
			private class Unit_TakeDamage_Patch
			{
				private static int CheckGraze(Unit unit)
				{
					return unit.HasStatusEffect<Graze>() ? 2 : (-1);
				}

				private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_0027: Expected O, but got Unknown
					//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a6: Expected O, but got Unknown
					//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ec: Expected O, but got Unknown
					return new CodeMatcher(instructions, generator).MatchForward(true, (CodeMatch[])(object)new CodeMatch[5]
					{
						new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Taking grazed accurary DamageInfo {0}.", (string)null),
						CodeMatch.op_Implicit(OpCodes.Ldarg_1),
						CodeMatch.op_Implicit(OpCodes.Box),
						CodeMatch.op_Implicit(OpCodes.Call),
						CodeMatch.op_Implicit(OpCodes.Call)
					}).Set(OpCodes.Pop, (object)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[3]
					{
						CodeMatch.op_Implicit(OpCodes.Ldarga_S),
						new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(DamageInfo), "DamageType"), (string)null),
						CodeMatch.op_Implicit(OpCodes.Ldc_I4_2)
					})
						.Set(OpCodes.Call, (object)AccessTools.Method(typeof(Unit_TakeDamage_Patch), "CheckGraze", (Type[])null, (Type[])null))
						.Insert((CodeInstruction[])(object)new CodeInstruction[1]
						{
							new CodeInstruction(OpCodes.Ldarg_0, (object)null)
						})
						.InstructionEnumeration();
				}

				private static void Postfix(Unit __instance, ref DamageInfo info)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Invalid comparison between Unknown and I4
					if ((int)((DamageInfo)(ref info)).DamageType == 2 && __instance.HasStatusEffect<AyaPerfectGrazeSe>() && ((DamageInfo)(ref info)).IsGrazed && ((DamageInfo)(ref info)).IsAccuracy)
					{
						__instance.GetStatusEffect<AyaPerfectGrazeSe>().Activate();
					}
				}
			}

			public void Activate()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				int level = ((StatusEffect)this).Level;
				((StatusEffect)this).Level = level - 1;
				if (((StatusEffect)this).Level > 0)
				{
					((StatusEffect)this).NotifyActivating();
				}
				else
				{
					((GameEntity)this).React(Reactor.op_Implicit((BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f)));
				}
			}
		}

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

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

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

		public override StatusEffectConfig MakeConfig()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			return new StatusEffectConfig(BepinexPlugin.sequenceTable.Next(typeof(StatusEffectConfig)), "", 0, (StatusEffectType)0, false, true, (int?)null, true, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)256, (IReadOnlyList<string>)new List<string>(), "Graze", "Default", "Graze");
		}
	}
}
namespace AyaShameimaru.Stages
{
	public sealed class LongExtraStageDef : StageTemplate
	{
		[EntityLogic(typeof(LongExtraStageDef))]
		public sealed class LongExtraStage : Stage
		{
			public LongExtraStage()
			{
				((Stage)this).Level = 666;
				((Stage)this).CardUpgradedChance = 1f;
				UniqueRandomPool<string> obj = new UniqueRandomPool<string>(true);
				obj.Add("31", 1f);
				obj.Add("32", 1f);
				obj.Add("33", 1f);
				((Stage)this).EnemyPoolAct1 = obj;
				UniqueRandomPool<string> obj2 = new UniqueRandomPool<string>(true);
				obj2.Add("34", 1f);
				obj2.Add("35", 1f);
				obj2.Add("36", 1f);
				((Stage)this).EnemyPoolAct2 = obj2;
				UniqueRandomPool<string> obj3 = new UniqueRandomPool<string>(true);
				obj3.Add("37", 1f);
				obj3.Add("38", 1f);
				obj3.Add("39", 1f);
				((Stage)this).EnemyPoolAct3 = obj3;
				UniqueRandomPool<string> obj4 = new UniqueRandomPool<string>(true);
				obj4.Add("37", 1f);
				obj4.Add("38", 1f);
				obj4.Add("39", 1f);
				((Stage)this).EliteEnemyPool = obj4;
				RepeatableRandomPool<string> obj5 = new RepeatableRandomPool<string>();
				obj5.Add("LongBossAyaEnemyGroup", 1f);
				((Stage)this).BossPool = obj5;
				UniqueRandomPool<Type> val = new UniqueRandomPool<Type>(false);
				val.Add(typeof(PatchouliPhilosophy), 1f);
				val.Add(typeof(JunkoColorless), 1f);
				val.Add(typeof(ShinmyoumaruForge), 1f);
				val.Add(typeof(MiyoiBartender), 1f);
				val.Add(typeof(WatatsukiPurify), 1f);
				((Stage)this).FirstAdventurePool = val;
				val = new UniqueRandomPool<Type>(true);
				val.Add(typeof(YorigamiSisters), 1f);
				val.Add(typeof(HatateInterview), 1f);
				val.Add(typeof(HinaCollect), 1f);
				val.Add(typeof(KogasaSpook), 1f);
				val.Add(typeof(KosuzuBookstore), 1f);
				val.Add(typeof(NarumiOfferCard), 1f);
				val.Add(typeof(NazrinDetect), 1f);
				val.Add(typeof(MedicinePoison), 1.2f);
				val.Add(typeof(BackgroundDancers), 1.2f);
				val.Add(typeof(SatoriCounseling), 1.2f);
				((Stage)this).AdventurePool = val;
			}

			public override GameMap CreateMap()
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Expected O, but got Unknown
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Expected O, but got Unknown
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Expected O, but got Unknown
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Invalid comparison between Unknown and I4
				int num = 24;
				GameMap val = new GameMap(num + 1, 1, (UiType)0, "LongBossAyaEnemyGroup");
				val.Nodes[0, 0] = new MapNode(val, 0, 0, 1)
				{
					StationType = (StationType)7,
					FollowerList = { 0 }
				};
				for (int i = 0; i < num - 1; i++)
				{
					StationType stationType = (StationType)1;
					val.Nodes[i + 1, 0] = new MapNode(val, i + 1, 0, 1)
					{
						StationType = stationType,
						FollowerList = { 0 }
					};
				}
				val.Nodes[num, 0] = new MapNode(val, num, 0, 1)
				{
					StationType = (StationType)10
				};
				val.StartNode = val.Nodes[0, 0];
				val.StartNode.Status = (MapNodeStatus)1;
				val.EndNode = val.Nodes[num, 0];
				if ((int)val.EndNode.StationType == 10)
				{
					val.BossNode = val.EndNode;
				}
				return val;
			}
		}

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

		public override StageConfig MakeConfig()
		{
			StageConfig val = ((StageTemplate)this).DefaultConfig();
			val.Obj0 = "LongExtraStageBackground";
			val.Obj1 = "LongExtraStageBackground";
			val.Obj2 = "LongExtraStageBackground";
			val.Obj3 = "LongExtraStageBackground";
			val.Obj4 = "LongExtraStageBackground";
			return val;
		}
	}
	public static class AyaBackgrounds
	{
		public const string AyaBackground = "AyaBackground";

		public const string AyaBackgroundTransition = "AyaBackgroundTransition";

		public const string AyaTanukiBackground = "AyaTanukiBackground";

		public const string LongExtraStageBackground = "LongExtraStageBackground";

		public static void AddAyaBackgrounds()
		{
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("AyaBackground", ResourceLoader.LoadSprite("AyaBackground.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 80, (Vector2?)null)), false, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform4 = self.transform;
				transform4.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("AyaBackgroundTransition", ResourceLoader.LoadSprite("AyaBackgroundTransition.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null)), false, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform3 = self.transform;
				transform3.position += new Vector3(0f, 0f, -0.2f);
				return self;
			}, (string)null, (Assembly)null);
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("AyaTanukiBackground", ResourceLoader.LoadSprite("AyaTanukiBackground.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null)), false, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform2 = self.transform;
				transform2.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
			StageTemplate.AddEvironmentGameobject(StageTemplate.CreateSimpleEnvObject("LongExtraStageBackground", ResourceLoader.LoadSprite("LongExtraStageBackground.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null)), false, (Func<GameObject, GameObject>)delegate(GameObject self)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				Transform transform = self.transform;
				transform.position += new Vector3(0f, 0f, -0.1f);
				return self;
			}, (string)null, (Assembly)null);
		}
	}
}
namespace AyaShameimaru.PlayerUnits
{
	public sealed class AyaPlayerUnitDef : PlayerUnitTemplate
	{
		[EntityLogic(typeof(AyaPlayerUnitDef))]
		public sealed class AyaPlayerUnit : PlayerUnit
		{
			[HarmonyPatch(typeof(AmuletForCard), "ExileCard")]
			private class AmuletForCard_ExileCard_Patch
			{
				private static bool Prefix(AmuletForCard __instance, ref IEnumerable<Card> cards)
				{
					//IL_00af: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b9: Expected O, but got Unknown
					//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
					//IL_0108: Expected O, but got Unknown
					GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
					if (((currentGameRun != null) ? currentGameRun.Player : null) is AyaPlayerUnit)
					{
						List<Card> list = cards.Where((Card card) => (int)card.CardType == 7 && !((GameEntity)card).DebugName.Contains("News")).ToList();
						if (list.Count == 0)
						{
							return false;
						}
						if (((StatusEffect)__instance).Level < list.Count)
						{
							list.RemoveRange(((StatusEffect)__instance).Level, list.Count - ((StatusEffect)__instance).Level);
						}
						((StatusEffect)__instance).NotifyActivating();
						Singleton<GameMaster>.Instance.CurrentGameRun.Battle.React(Reactor.op_Implicit((BattleAction)new ExileManyCardAction((IEnumerable<Card>)list)), (GameEntity)(object)__instance, (ActionCause)7);
						((StatusEffect)__instance).Level = ((StatusEffect)__instance).Level - list.Count;
						if (((StatusEffect)__instance).Level <= 0)
						{
							Singleton<GameMaster>.Instance.CurrentGameRun.Battle.React(Reactor.op_Implicit((BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)__instance, true, 0.1f)), (GameEntity)(object)__instance, (ActionCause)7);
						}
						return false;
					}
					return true;
				}
			}

			[HarmonyPatch(typeof(SihunYuSe), "OnOwnerTurnEnded")]
			private class SihunYuSe_OnOwnerTurnEnded_Patch
			{
				private static bool Prefix(SihunYuSe __instance)
				{
					if (FinalBossSequence >= 3)
					{
						return false;
					}
					return true;
				}
			}

			[HarmonyPatch(typeof(Stage), "GetBossCardReward")]
			private class Stage_GetBossCardReward_Patch
			{
				private static void Postfix(Stage __instance, StationReward __result)
				{
					if (!(Singleton<GameMaster>.Instance.CurrentGameRun.Player is AyaPlayerUnit) || !Singleton<GameMaster>.Instance.CurrentGameRun.Player.HasExhibit<AyaTanukisLeafDef.AyaTanukisLeaf>())
					{
						return;
					}
					List<Card> list = new List<Card>();
					Card momiji = (Card)(object)Library.CreateCard<AyaFriendMomijiDef.AyaFriendMomiji>();
					if (!Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => ((GameEntity)c).Id == ((GameEntity)momiji).Id))
					{
						list.Add(momiji);
					}
					Card megumu = (Card)(object)Library.CreateCard<AyaFriendMegumuDef.AyaFriendMegumu>();
					if (Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => ((GameEntity)c).Id == ((GameEntity)momiji).Id) && !Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => ((GameEntity)c).Id == ((GameEntity)megumu).Id))
					{
						list.Add(megumu);
					}
					Card hatate = (Card)(object)Library.CreateCard<AyaFriendHatateDef.AyaFriendHatate>();
					if (Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => ((GameEntity)c).Id == ((GameEntity)momiji).Id) && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => ((GameEntity)c).Id == ((GameEntity)megumu).Id) && !Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => ((GameEntity)c).Id == ((GameEntity)hatate).Id))
					{
						list.Add(hatate);
					}
					if (CollectionsExtensions.NotEmpty<Card>((IReadOnlyCollection<Card>)list))
					{
						Card item = ((IEnumerable<Card>)__result.Cards).FirstOrDefault((Func<Card, bool>)((Card c) => c is AyaFriendMomijiDef.AyaFriendMomiji || c is AyaFriendMegumuDef.AyaFriendMegumu || c is AyaFriendHatateDef.AyaFriendHatate)) ?? __result.Cards.First();
						__result.Cards.Remove(item);
						__result.Cards.Add(CollectionsExtensions.Sample<Card>((IEnumerable<Card>)list, Singleton<GameMaster>.Instance.CurrentGameRun.CardRng));
					}
				}
			}

			[HarmonyPatch(typeof(UiManager), "LeaveGameRun")]
			private class UiManager_LeaveGameRun_Patch
			{
				private static void Postfix(UiManager __instance)
				{
					//IL_005c: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
					//IL_0086: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
					background.SetActive(false);
					CardConfig.FromId("AyaNews").Damage = 1;
					CardConfig.FromId("AyaNews").Value1 = null;
					CardConfig.FromId("AyaNews").TargetType = (TargetType)3;
					if (((Enum)CardConfig.FromId("AyaNews").Keywords).HasFlag((Enum)(object)(Keyword)8388608))
					{
						CardConfig obj = CardConfig.FromId("AyaNews");
						obj.Keywords = (Keyword)(obj.Keywords - 8388608);
					}
					if (((Enum)CardConfig.FromId("HatateNews").Keywords).HasFlag((Enum)(object)(Keyword)8388608))
					{
						CardConfig obj2 = CardConfig.FromId("HatateNews");
						obj2.Keywords = (Keyword)(obj2.Keywords - 8388608);
					}
					CardConfig.FromId("AyaWindGirl").Value1 = 1;
				}
			}

			[HarmonyPatch(typeof(Unit), "Heal")]
			private class Unit_Heal_Patch
			{
				private static void Postfix(Unit __instance)
				{
					if (Singleton<GameMaster>.Instance.CurrentGameRun != null && __instance is AyaPlayerUnit && FinalBossSequence < 3 && !FinalBossTransition && !BossStationFinished)
					{
						if ((float)__instance.Hp / (float)__instance.MaxHp > 0.66f)
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
						else if ((float)__instance.Hp / (float)__instance.MaxHp > 0.33f)
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar1.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
						else
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar2.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
					}
				}
			}

			public static bool BossStationFinished = false;

			public static bool LastInputTriggered = false;

			public static int FinalBossSequence = 0;

			public static EnemyUnit FinalBoss = null;

			public static List<Card> FinalBossKeyCards = new List<Card>();

			public static bool FinalBossTransition = false;

			private static GameObject background = StageTemplate.TryGetEnvObject("AyaBackgroundTransition", (Assembly)null);

			private bool AyaIntro = false;

			private bool CirnoLeaved = false;

			private bool LastEnemy = false;

			public string AyaTanukiIntro1AyaTanuki => ((GameEntity)this).LocalizeProperty("AyaTanukiIntro1AyaTanuki", true, true);

			public string AyaTanukiIntro2Aya => ((GameEntity)this).LocalizeProperty("AyaTanukiIntro2Aya", true, true);

			public string AyaTanukiIntro3Aya => ((GameEntity)this).LocalizeProperty("AyaTanukiIntro3Aya", true, true);

			public string AyaTanukiIntro4AyaTanuki => ((GameEntity)this).LocalizeProperty("AyaTanukiIntro4AyaTanuki", true, true);

			public string SeijaPhase11Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase11Seija", true, true);

			public string SeijaPhase12Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase12Aya", true, true);

			public string SeijaPhase13Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase13Aya", true, true);

			public string SeijaPhase14Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase14Seija", true, true);

			public string SeijaPhase15Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase15Seija", true, true);

			public string SeijaPhase16Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase16Aya", true, true);

			public string SeijaPhase2Hidden1Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase2Hidden1Aya", true, true);

			public string SeijaPhase2Hidden2Koishi => ((GameEntity)this).LocalizeProperty("SeijaPhase2Hidden2Koishi", true, true);

			public string SeijaPhase2HiddenPhantasmMode1SukusukuAya => ((GameEntity)this).LocalizeProperty("SeijaPhase2HiddenPhantasmMode1SukusukuAya", true, true);

			public string SeijaPhase2HiddenPhantasmMode2SukusukuAya => ((GameEntity)this).LocalizeProperty("SeijaPhase2HiddenPhantasmMode2SukusukuAya", true, true);

			public string SeijaPhase2HiddenPhantasmMode3SukusukuAya => ((GameEntity)this).LocalizeProperty("SeijaPhase2HiddenPhantasmMode3SukusukuAya", true, true);

			public string SeijaPhase2HiddenPhantasmMode4SukusukuAya => ((GameEntity)this).LocalizeProperty("SeijaPhase2HiddenPhantasmMode4SukusukuAya", true, true);

			public string SeijaPhase21Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase21Seija", true, true);

			public string SeijaPhase22Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase22Seija", true, true);

			public string SeijaPhase23Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase23Aya", true, true);

			public string SeijaPhase24Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase24Seija", true, true);

			public string SeijaPhase25Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase25Seija", true, true);

			public string SeijaPhase26Reimu => ((GameEntity)this).LocalizeProperty("SeijaPhase26Reimu", true, true);

			public string SeijaPhase27Marisa => ((GameEntity)this).LocalizeProperty("SeijaPhase27Marisa", true, true);

			public string SeijaPhase28Sakuya => ((GameEntity)this).LocalizeProperty("SeijaPhase28Sakuya", true, true);

			public string SeijaPhase29Cirno => ((GameEntity)this).LocalizeProperty("SeijaPhase29Cirno", true, true);

			public string SeijaPhase210Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase210Seija", true, true);

			public string SeijaPhase211Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase211Aya", true, true);

			public string SeijaPhase212Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase212Seija", true, true);

			public string SeijaPhase213Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase213Aya", true, true);

			public string SeijaPhase214Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase214Seija", true, true);

			public string SeijaPhase215Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase215Aya", true, true);

			public string SeijaPhase216Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase216Aya", true, true);

			public string SeijaPhase217Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase217Aya", true, true);

			public string SeijaPhase3Normal1Cirno => ((GameEntity)this).LocalizeProperty("SeijaPhase3Normal1Cirno", true, true);

			public string SeijaPhase3True1Cirno => ((GameEntity)this).LocalizeProperty("SeijaPhase3True1Cirno", true, true);

			public string SeijaPhase3True2Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True2Aya", true, true);

			public string SeijaPhase3True3Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True3Aya", true, true);

			public string SeijaPhase3True4Cirno => ((GameEntity)this).LocalizeProperty("SeijaPhase3True4Cirno", true, true);

			public string SeijaPhase3True5Cirno => ((GameEntity)this).LocalizeProperty("SeijaPhase3True5Cirno", true, true);

			public string SeijaPhase3True6Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True6Aya", true, true);

			public string SeijaPhase3True7Cirno => ((GameEntity)this).LocalizeProperty("SeijaPhase3True7Cirno", true, true);

			public string SeijaPhase3True8Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True8Aya", true, true);

			public string SeijaPhase31Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase31Seija", true, true);

			public string SeijaPhase32Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase32Megumu", true, true);

			public string SeijaPhase33Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase33Seija", true, true);

			public string SeijaPhase34Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase34Seija", true, true);

			public string SeijaPhase35Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase35Megumu", true, true);

			public string SeijaPhase36Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase36Megumu", true, true);

			public string SeijaPhase37Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase37Megumu", true, true);

			public string SeijaPhase38Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase38Seija", true, true);

			public string SeijaPhase39Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase39Seija", true, true);

			public string SeijaPhase310Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase310Seija", true, true);

			public string SeijaPhase311Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase311Seija", true, true);

			public string SeijaPhase312Seija => ((GameEntity)this).LocalizeProperty("SeijaPhase312Seija", true, true);

			public string SeijaPhase3Normal2Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3Normal2Megumu", true, true);

			public string SeijaPhase3Normal3Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3Normal3Megumu", true, true);

			public string SeijaPhase3Normal4Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3Normal4Megumu", true, true);

			public string SeijaPhase3True9Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True9Megumu", true, true);

			public string SeijaPhase3True10Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True10Megumu", true, true);

			public string SeijaPhase3True11Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True11Aya", true, true);

			public string SeijaPhase3True12Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True12Megumu", true, true);

			public string SeijaPhase3True13Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True13Aya", true, true);

			public string SeijaPhase3True14Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True14Megumu", true, true);

			public string SeijaPhase3True15Aya => ((GameEntity)this).LocalizeProperty("SeijaPhase3True15Aya", true, true);

			public string SeijaPhase3True16Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True16Megumu", true, true);

			public string SeijaPhase3True17Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True17Megumu", true, true);

			public string SeijaPhase3True18Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True18Megumu", true, true);

			public string SeijaPhase3True19Megumu => ((GameEntity)this).LocalizeProperty("SeijaPhase3True19Megumu", true, true);

			public string SeijaPhase3True20Okina => ((GameEntity)this).LocalizeProperty("SeijaPhase3True20Okina", true, true);

			protected override void OnEnterGameRun(GameRunController gameRun)
			{
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_0108: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: 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_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(Timer());
				((Unit)this).HandleGameRunEvent<StationEventArgs>(((GameEntity)this).GameRun.StationEntered, (GameEventHandler<StationEventArgs>)delegate
				{
					//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
					BossStationFinished = false;
					if ((float)((Unit)this).Hp / (float)((Unit)this).MaxHp > 0.66f)
					{
						UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
					}
					else if ((float)((Unit)this).Hp / (float)((Unit)this).MaxHp > 0.33f)
					{
						UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar1.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
					}
					else
					{
						UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar2.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
					}
					UnitView view = ((Unit)this).GetView<UnitView>();
					if (view == null || ((Component)view).transform.localPosition.x != 0f)
					{
						((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(Return());
					}
				});
				((Unit)this).HandleGameRunEvent<StationEventArgs>(((GameEntity)this).GameRun.StationFinished, (GameEventHandler<StationEventArgs>)delegate(StationEventArgs args)
				{
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_006e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0070: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					//IL_0077: Unknown result type (might be due to invalid IL or missing references)
					//IL_0089: Expected I4, but got Unknown
					//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
					if (args.Station is BossStation)
					{
						BossStationFinished = true;
						UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar4.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						if (args.Station.IsNormalEnd)
						{
							GameDifficulty difficulty = ((GameEntity)this).GameRun.Difficulty;
							GameDifficulty val = difficulty;
							switch (val - 1)
							{
							case 0:
								if (!BepinexPlugin.AyaSave.Value.Contains("NormalAyaPlayerUnit"))
								{
									ConfigEntry<string> ayaSave7 = BepinexPlugin.AyaSave;
									ayaSave7.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "NormalAyaPlayerUnit" : ",NormalAyaPlayerUnit");
								}
								break;
							case 1:
								if (!BepinexPlugin.AyaSave.Value.Contains("NormalAyaPlayerUnit"))
								{
									ConfigEntry<string> ayaSave5 = BepinexPlugin.AyaSave;
									ayaSave5.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "NormalAyaPlayerUnit" : ",NormalAyaPlayerUnit");
								}
								if (!BepinexPlugin.AyaSave.Value.Contains("HardAyaPlayerUnit"))
								{
									ConfigEntry<string> ayaSave6 = BepinexPlugin.AyaSave;
									ayaSave6.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "HardAyaPlayerUnit" : ",HardAyaPlayerUnit");
								}
								break;
							case 2:
								if (!BepinexPlugin.AyaSave.Value.Contains("NormalAyaPlayerUnit"))
								{
									ConfigEntry<string> ayaSave = BepinexPlugin.AyaSave;
									ayaSave.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "NormalAyaPlayerUnit" : ",NormalAyaPlayerUnit");
								}
								if (!BepinexPlugin.AyaSave.Value.Contains("HardAyaPlayerUnit"))
								{
									ConfigEntry<string> ayaSave2 = BepinexPlugin.AyaSave;
									ayaSave2.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "HardAyaPlayerUnit" : ",HardAyaPlayerUnit");
								}
								if (!BepinexPlugin.AyaSave.Value.Contains("LunaticAyaPlayerUnit"))
								{
									ConfigEntry<string> ayaSave3 = BepinexPlugin.AyaSave;
									ayaSave3.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "LunaticAyaPlayerUnit" : ",LunaticAyaPlayerUnit");
								}
								if (!BepinexPlugin.AyaSave.Value.Contains("PhantasmAyaPlayerUnit") && BepinexPlugin.AyaPhantasmMode.Value && PuzzleFlags.GetPuzzleLevel(((GameEntity)this).GameRun.Puzzles) == 7)
								{
									ConfigEntry<string> ayaSave4 = BepinexPlugin.AyaSave;
									ayaSave4.Value += (BasicTypeExtensions.IsNullOrEmpty(BepinexPlugin.AyaSave.Value) ? "PhantasmAyaPlayerUnit" : ",PhantasmAyaPlayerUnit");
								}
								break;
							}
						}
					}
				});
				((Unit)this).HandleGameRunEvent<DamageEventArgs>(((Unit)((GameEntity)this).GameRun.Player).DamageReceived, (GameEventHandler<DamageEventArgs>)delegate
				{
					if (FinalBossSequence < 3 && !FinalBossTransition && !BossStationFinished)
					{
						if ((float)((Unit)this).Hp / (float)((Unit)this).MaxHp > 0.66f)
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
						else if ((float)((Unit)this).Hp / (float)((Unit)this).MaxHp > 0.33f)
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar1.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
						else
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar2.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
					}
				});
				CardConfig.FromId("AyaNews").Damage = 12;
				CardConfig.FromId("AyaNews").Value1 = 1;
				CardConfig.FromId("AyaNews").TargetType = (TargetType)1;
				if (!((Enum)CardConfig.FromId("AyaNews").Keywords).HasFlag((Enum)(object)(Keyword)8388608))
				{
					CardConfig obj = CardConfig.FromId("AyaNews");
					obj.Keywords = (Keyword)(obj.Keywords + 8388608);
				}
				if (!((Enum)CardConfig.FromId("HatateNews").Keywords).HasFlag((Enum)(object)(Keyword)8388608))
				{
					CardConfig obj2 = CardConfig.FromId("HatateNews");
					obj2.Keywords = (Keyword)(obj2.Keywords + 8388608);
				}
				CardConfig.FromId("AyaWindGirl").Value1 = 2;
			}

			private IEnumerator Timer()
			{
				yield return (object)new WaitUntil((Func<bool>)(() => Singleton<GameMaster>.Instance.CurrentGameRun != null));
				while (Singleton<GameMaster>.Instance.CurrentGameRun != null && FinalBossSequence < 3 && !FinalBossTransition)
				{
					if (BepinexPlugin.LastInput >= 90 && !LastInputTriggered)
					{
						LastInputTriggered = true;
						UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar3.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
					}
					else if (BepinexPlugin.LastInput < 90 && LastInputTriggered)
					{
						LastInputTriggered = false;
						if ((float)((Unit)this).Hp / (float)((Unit)this).MaxHp > 0.66f)
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
						else if ((float)((Unit)this).Hp / (float)((Unit)this).MaxHp > 0.33f)
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar1.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
						else
						{
							UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar2.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
						}
					}
					yield return (object)new WaitForSecondsRealtime(1f);
					BepinexPlugin.LastInput++;
				}
			}

			private IEnumerator Return()
			{
				TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMove(((Component)((Unit)this).GetView<UnitView>()).transform, new Vector3(-10f, 0f), 0f, false), (Ease)6), true), true));
				yield return (object)new WaitUntil((Func<bool>)(() => ((Component)((Unit)this).GetView<UnitView>()).transform.localPosition.x == -10f));
				TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMove(((Component)((Unit)this).GetView<UnitView>()).transform, new Vector3(0f, 0f), 1.25f, false), (Ease)6), true), true));
			}

			protected override void OnEnterBattle(BattleController battle)
			{
				FinalBossSequence = 0;
				((Unit)this).ReactBattleEvent<GameEventArgs>(((Unit)this).Battle.BattleStarted, (Func<GameEventArgs, IEnumerable<BattleAction>>)OnBattleStarted);
				((Unit)this).ReactBattleEvent<CardsEventArgs>(((Unit)this).Battle.CardsAddingToDiscard, (Func<CardsEventArgs, IEnumerable<BattleAction>>)OnCardsAddingToDiscard);
				((Unit)this).ReactBattleEvent<CardsAddingToDrawZoneEventArgs>(((Unit)this).Battle.CardsAddingToDrawZone, (Func<CardsAddingToDrawZoneEventArgs, IEnumerable<BattleAction>>)OnCardsAddingToDrawZone);
				((Unit)this).ReactBattleEvent<CardsEventArgs>(((Unit)this).Battle.CardsAddingToExile, (Func<CardsEventArgs, IEnumerable<BattleAction>>)OnCardsAddingToExile);
				((Unit)this).ReactBattleEvent<CardsEventArgs>(((Unit)this).Battle.CardsAddingToHand, (Func<CardsEventArgs, IEnumerable<BattleAction>>)OnCardsAddingToHand);
				((Unit)this).ReactBattleEvent<StatisticalDamageEventArgs>(((Unit)((Unit)this).Battle.Player).StatisticalTotalDamageDealt, (Func<StatisticalDamageEventArgs, IEnumerable<BattleAction>>)OnPlayerStatisticalTotalDamageDealt);
			}

			private IEnumerable<BattleAction> OnBattleStarted(GameEventArgs arg)
			{
				yield return (BattleAction)new ApplyStatusEffectAction(typeof(AyaPassiveSeDef.AyaPassiveSe), (Unit)(object)this, (int?)null, (int?)null, (int?)null, (int?)null, 0f, true);
				if (((GameEntity)this).GameRun.Battle.EnemyGroup.Id == "Aya")
				{
					((Unit)this).ReactBattleEvent<GameEventArgs>(((Unit)this).Battle.RoundStarting, (Func<GameEventArgs, IEnumerable<BattleAction>>)AyaRoundStarting);
				}
				Card Momiji = ((IEnumerable<Card>)((Unit)this).Battle.DrawZone).FirstOrDefault((Func<Card, bool>)((Card card) => card is AyaFriendMomijiDef.AyaFriendMomiji));
				Card Megumu = ((IEnumerable<Card>)((Unit)this).Battle.DrawZone).FirstOrDefault((Func<Card, bool>)((Card card) => card is AyaFriendMegumuDef.AyaFriendMegumu));
				Card Hatate = ((IEnumerable<Card>)((Unit)this).Battle.DrawZone).FirstOrDefault((Func<Card, bool>)((Card card) => card is AyaFriendHatateDef.AyaFriendHatate));
				if (Momiji != null && Megumu != null && Hatate != null && ((GameEntity)this).GameRun.Battle.EnemyGroup.Id == "Seija")
				{
					FinalBossSequence = 1;
					FinalBossKeyCards.Add(Momiji);
					FinalBossKeyCards.Add(Megumu);
					FinalBossKeyCards.Add(Hatate);
					FinalBoss = ((GameEntity)this).GameRun.Battle.AllAliveEnemies.First((EnemyUnit e) => e is Seija);
					AyaAdventoftheDivineGrandsonDef.AyaAdventoftheDivineGrandson.MusicChanged = true;
					BgmConfig.FromID(IdContainer.op_Implicit(((EntityDefinition)new AyaFinalBossBgm()).UniqueId)).LoopStart = 68.4f;
					BgmConfig.FromID(IdContainer.op_Implicit(((EntityDefinition)new AyaFinalBossBgm()).UniqueId)).LoopEnd = 223.5f;
					AudioManager.PlayInLayer1("AyaFinalBossBgm");
					((Unit)this).ReactBattleEvent<UnitEventArgs>(((Unit)((Unit)this).Battle.Player).TurnEnded, (Func<UnitEventArgs, IEnumerable<BattleAction>>)FinalBossPlayerTurnEnded);
					((Unit)this).ReactBattleEvent<DieEventArgs>(((Unit)((Unit)this).Battle.Player).Dying, (Func<DieEventArgs, IEnumerable<BattleAction>>)FinalBossPlayerDying);
					((Unit)this).ReactBattleEvent<GameEventArgs>(((Unit)this).Battle.AllEnemyTurnStarting, (Func<GameEventArgs, IEnumerable<BattleAction>>)FinalBossAllEnemyTurnStarting);
					((Unit)this).ReactBattleEvent<GameEventArgs>(((Unit)this).Battle.AllEnemyTurnEnded, (Func<GameEventArgs, IEnumerable<BattleAction>>)FinalBossAllEnemyTurnEnded);
					((Unit)this).ReactBattleEvent<CardEventArgs>(((Unit)this).Battle.CardRemoving, (Func<CardEventArgs, IEnumerable<BattleAction>>)FinalBossCardRemoving);
					((Unit)this).ReactBattleEvent<CardTransformEventArgs>(((Unit)this).Battle.CardTransforming, (Func<CardTransformEventArgs, IEnumerable<BattleAction>>)FinalBossCardTransforming);
					((Unit)this).ReactBattleEvent<UnitEventArgs>(((Unit)this).Battle.EnemySpawned, (Func<UnitEventArgs, IEnumerable<BattleAction>>)FinalBossEnemySpawned);
					((Unit)this).ReactBattleEvent<DieEventArgs>(((Unit)this).Battle.EnemyDied, (Func<DieEventArgs, IEnumerable<BattleAction>>)FinalBossEnemyDied);
					((Unit)this).ReactBattleEvent<DieEventArgs>(((Unit)FinalBoss).Dying, (Func<DieEventArgs, IEnumerable<BattleAction>>)FinalBossDying);
				}
			}

			private IEnumerable<BattleAction> AyaRoundStarting(GameEventArgs arg)
			{
				if (!AyaIntro)
				{
					AyaIntro = true;
					EnemyUnit ayaFake = ((GameEntity)this).GameRun.Battle.AllAliveEnemies.First((EnemyUnit e) => e is Aya);
					yield return (BattleAction)new DamageAction((Unit)(object)this, (Unit)(object)ayaFake, DamageInfo.HpLose(10f, false), "鸦天狗触发", (GunType)0);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)ayaFake, AyaTanukiIntro1AyaTanuki, 2f, 0f, 0f, true);
					((Unit)ayaFake).GetView<UnitView>()._statusWidget.FadeOut();
					((Unit)ayaFake).GetView<UnitView>().Escape();
					yield return (BattleAction)new SpawnEnemyAction(ayaFake, typeof(AyaTanuki), ayaFake.RootIndex, 0f, 0f, false);
					AudioManager.PlayInLayer1("AyaTanukiBgm");
					EnemyUnit limao = ((GameEntity)this).GameRun.Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaTanuki);
					yield return (BattleAction)(object)PerformAction.Effect((Unit)(object)limao, "Bianshen", 0f, (string)null, 0f, (EffectBehavior)0, 0f);
					yield return (BattleAction)(object)PerformAction.Sfx("Graze", 0f);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<AyaTanukiWindGodGrillSeDef.AyaTanukiWindGodGrillSe>((Unit)(object)limao, (int?)limao.Count1, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)PerformAction.Wait(1.5f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, AyaTanukiIntro2Aya, 2.5f, 0f, 2f, true);
					yield return (BattleAction)new EscapeAction((Unit)(object)ayaFake);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<AyaArmoredRavenSeDef.AyaArmoredRavenSe>((Unit)(object)this, (int?)1, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, AyaTanukiIntro3Aya, 2f, 0f, 2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((GameEntity)this).GameRun.Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaTanuki), AyaTanukiIntro4AyaTanuki, 1.5f, 0f, 0.5f, true);
				}
			}

			private IEnumerable<BattleAction> OnCardsAddingToDiscard(CardsEventArgs arg)
			{
				if (((GameEventArgs)arg).ActionSource == this || !arg.Cards.Any((Card card) => card is AyaNewsReimuSp || card is ManaFreezer))
				{
					yield break;
				}
				List<Card> cards = new List<Card>();
				Card[] cards2 = arg.Cards;
				foreach (Card card2 in cards2)
				{
					if (!(card2 is ManaFreezer) || !((GameEntity)this).GameRun.BaseDeck.Any((Card c) => c is AyaTenguNewspaperDeadlineDay))
					{
						if (card2 is AyaNewsReimuSp)
						{
							cards.Add((Card)(object)Library.CreateCard<AyaNewsAyaPlayerUnitSpDef.AyaNewsAyaPlayerUnitSp>());
						}
						else
						{
							cards.Add(card2);
						}
					}
				}
				((GameEventArgs)arg).CancelBy((GameEntity)(object)this);
				if (CollectionsExtensions.NotEmpty<Card>((IReadOnlyCollection<Card>)cards))
				{
					yield return (BattleAction)new AddCardsToDiscardAction((IEnumerable<Card>)cards, (AddCardsType)0);
				}
			}

			private IEnumerable<BattleAction> OnCardsAddingToDrawZone(CardsAddingToDrawZoneEventArgs arg)
			{
				if (((GameEventArgs)arg).ActionSource == this || !arg.Cards.Any((Card card) => card is AyaNewsReimuSp || card is ManaFreezer))
				{
					yield break;
				}
				List<Card> cards = new List<Card>();
				Card[] cards2 = arg.Cards;
				foreach (Card card2 in cards2)
				{
					if (!(card2 is ManaFreezer) || !((GameEntity)this).GameRun.BaseDeck.Any((Card c) => c is AyaTenguNewspaperDeadlineDay))
					{
						if (card2 is AyaNewsReimuSp)
						{
							cards.Add((Card)(object)Library.CreateCard<AyaNewsAyaPlayerUnitSpDef.AyaNewsAyaPlayerUnitSp>());
						}
						else
						{
							cards.Add(card2);
						}
					}
				}
				((GameEventArgs)arg).CancelBy((GameEntity)(object)this);
				if (CollectionsExtensions.NotEmpty<Card>((IReadOnlyCollection<Card>)cards))
				{
					yield return (BattleAction)new AddCardsToDrawZoneAction((IEnumerable<Card>)cards, arg.DrawZoneTarget, (AddCardsType)0);
				}
			}

			private IEnumerable<BattleAction> OnCardsAddingToExile(CardsEventArgs arg)
			{
				if (((GameEventArgs)arg).ActionSource == this || !arg.Cards.Any((Card card) => card is AyaNewsReimuSp || card is ManaFreezer))
				{
					yield break;
				}
				List<Card> cards = new List<Card>();
				Card[] cards2 = arg.Cards;
				foreach (Card card2 in cards2)
				{
					if (!(card2 is ManaFreezer) || !((GameEntity)this).GameRun.BaseDeck.Any((Card c) => c is AyaTenguNewspaperDeadlineDay))
					{
						if (card2 is AyaNewsReimuSp)
						{
							cards.Add((Card)(object)Library.CreateCard<AyaNewsAyaPlayerUnitSpDef.AyaNewsAyaPlayerUnitSp>());
						}
						else
						{
							cards.Add(card2);
						}
					}
				}
				((GameEventArgs)arg).CancelBy((GameEntity)(object)this);
				if (CollectionsExtensions.NotEmpty<Card>((IReadOnlyCollection<Card>)cards))
				{
					yield return (BattleAction)new AddCardsToExileAction((IEnumerable<Card>)cards);
				}
			}

			private IEnumerable<BattleAction> OnCardsAddingToHand(CardsEventArgs arg)
			{
				if (((GameEventArgs)arg).ActionSource == this || !arg.Cards.Any((Card card) => card is AyaNewsReimuSp || card is ManaFreezer))
				{
					yield break;
				}
				List<Card> cards = new List<Card>();
				Card[] cards2 = arg.Cards;
				foreach (Card card2 in cards2)
				{
					if (!(card2 is ManaFreezer) || !((GameEntity)this).GameRun.BaseDeck.Any((Card c) => c is AyaTenguNewspaperDeadlineDay))
					{
						if (card2 is AyaNewsReimuSp)
						{
							cards.Add((Card)(object)Library.CreateCard<AyaNewsAyaPlayerUnitSpDef.AyaNewsAyaPlayerUnitSp>());
						}
						else
						{
							cards.Add(card2);
						}
					}
				}
				((GameEventArgs)arg).CancelBy((GameEntity)(object)this);
				if (CollectionsExtensions.NotEmpty<Card>((IReadOnlyCollection<Card>)cards))
				{
					yield return (BattleAction)new AddCardsToHandAction((IEnumerable<Card>)cards, (AddCardsType)0);
				}
			}

			private IEnumerable<BattleAction> OnPlayerStatisticalTotalDamageDealt(StatisticalDamageEventArgs args)
			{
				if (((Unit)this).Battle.BattleShouldEnd)
				{
					yield break;
				}
				GameEntity actionSource = ((GameEventArgs)args).ActionSource;
				AyaNews ayaNews = (AyaNews)(object)((actionSource is AyaNews) ? actionSource : null);
				if (ayaNews == null || !args.ArgsTable.Keys.Any((Unit u) => u.IsAlive))
				{
					yield break;
				}
				foreach (EnemyUnit item in args.ArgsTable.Keys.Where((Unit u) => u.IsAlive))
				{
					EnemyUnit enemyUnit = item;
					yield return (BattleAction)(object)new ApplyStatusEffectAction<LockedOn>((Unit)(object)enemyUnit, (int?)((Card)ayaNews).Value1, (int?)null, (int?)null, (int?)null, 0f, true);
				}
			}

			private IEnumerable<BattleAction> FinalBossPlayerTurnEnded(UnitEventArgs arg)
			{
				if (FinalBossSequence == 1 && ((Unit)FinalBoss).Hp < 500)
				{
					FinalBossSequence = 2;
					BgmConfig.FromID(IdContainer.op_Implicit(((EntityDefinition)new AyaFinalBossBgm()).UniqueId)).LoopStart = 277.9f;
					BgmConfig.FromID(IdContainer.op_Implicit(((EntityDefinition)new AyaFinalBossBgm()).UniqueId)).LoopEnd = 447.35f;
					AudioManager.FadeOutAndPlayBgm("AyaFinalBossBgm", 0f, 0f, 227.175f, false);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase11Seija, 2.5f, 0f, 2.5f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase12Aya, 2.5f, 0f, 2.5f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase13Aya, 1.5f, 0f, 0.75f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase14Seija, 2.5f, 0f, 1.75f, true);
					yield return (BattleAction)(object)PerformAction.Wait(0.75f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase15Seija, 2.5f, 0f, 2.5f, true);
					yield return (BattleAction)(object)PerformAction.Spell((Unit)(object)FinalBoss, "逆转攻势");
					yield return (BattleAction)(object)PerformAction.Animation((Unit)(object)FinalBoss, "spell", 1f, (string)null, 0f, -1);
					yield return (BattleAction)new HealAction((Unit)(object)FinalBoss, (Unit)(object)FinalBoss, ((Unit)FinalBoss).MaxHp, (HealType)0, 0.2f);
					EnemyUnit finalBoss = FinalBoss;
					Seija seija = (Seija)(object)((finalBoss is Seija) ? finalBoss : null);
					seija._pool.Clear();
					if (!((Unit)seija).HasStatusEffect<ShendengSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<ShendengSe>((Unit)(object)seija, (int?)3, (int?)null, (int?)null, (int?)null, 0.2f, true);
					}
					if (!((Unit)seija).HasStatusEffect<HolyGrailSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<HolyGrailSe>((Unit)(object)seija, (int?)null, (int?)null, (int?)null, (int?)null, 0.2f, true);
					}
					if (!((Unit)seija).HasStatusEffect<SihunYuSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<SihunYuSe>((Unit)(object)seija, (int?)null, (int?)null, (int?)null, (int?)null, 0.2f, true);
					}
					if (!((Unit)seija).HasStatusEffect<MadokaBowSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<MadokaBowSe>((Unit)(object)seija, (int?)2, (int?)null, (int?)null, (int?)null, 0.2f, true);
					}
					if (!((Unit)seija).HasStatusEffect<QiannianShenqiSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<QiannianShenqiSe>((Unit)(object)seija, (int?)2, (int?)null, (int?)null, (int?)10, 0.2f, true);
					}
					if (!((Unit)seija).HasStatusEffect<InfinityGemsSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<InfinityGemsSe>((Unit)(object)seija, (int?)null, (int?)null, (int?)null, (int?)null, 0.2f, true);
					}
					if (!((Unit)seija).HasStatusEffect<SakuraWandSe>())
					{
						yield return (BattleAction)(object)new ApplyStatusEffectAction<SakuraWandSe>((Unit)(object)seija, (int?)null, (int?)null, (int?)null, (int?)null, 0.2f, true);
					}
					yield return (BattleAction)(object)new ApplyStatusEffectAction<GuangxueMicai>((Unit)(object)seija, (int?)null, (int?)999, (int?)null, (int?)null, 0.2f, true);
					seija.ItemCount = 6;
					seija.BigRoundCount = 6;
					seija.LastType = typeof(SakuraWandSe).Name;
					((EnemyUnit)seija)._turnMoves.Clear();
					((EnemyUnit)seija).ClearIntentions();
					((EnemyUnit)seija).NotifyIntentionsChanged();
					seija.Next = (MoveType)0;
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase16Aya, 2.5f, 0f, 2.5f, true);
				}
				else if (FinalBossSequence == 2 && ((Unit)this).Battle.BattleShouldEnd)
				{
					foreach (Unit unit in ((Unit)this).Battle.AllAliveUnits)
					{
						yield return (BattleAction)new EndShootAction(unit);
					}
					foreach (EnemyUnit enemy in ((Unit)this).Battle.AllAliveEnemies.Where((EnemyUnit e) => !(e is Seija)))
					{
						yield return (BattleAction)new ForceKillAction((Unit)(object)enemy, (Unit)(object)enemy);
					}
					if (BepinexPlugin.AyaPhantasmMode.Value)
					{
						yield return (BattleAction)new SpawnEnemyAction((EnemyUnit)null, typeof(AyaPlayerUnitSK), 2, 0f, 0.3f, false);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaPlayerUnitSK), SeijaPhase2HiddenPhantasmMode1SukusukuAya, 4f, 0f, 4f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaPlayerUnitSK), SeijaPhase2HiddenPhantasmMode2SukusukuAya, 3f, 0f, 3f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaPlayerUnitSK), SeijaPhase2HiddenPhantasmMode3SukusukuAya, 4f, 0f, 4f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaPlayerUnitSK), SeijaPhase2HiddenPhantasmMode4SukusukuAya, 4f, 0f, 4f, true);
					}
					else
					{
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase2Hidden1Aya, 5f, 0f, 5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)this).GetView<UnitView>()).transform, -1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, -12f, 5f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(4f, true);
						yield return (BattleAction)new SpawnEnemyAction((EnemyUnit)null, typeof(Koishi), 4, 0f, 0.3f, false);
						yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)((Unit)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Koishi)).GetStatusEffect<MirrorImage>(), true, 0f);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Koishi), SeijaPhase2Hidden2Koishi, 2f, 0f, 2f, true);
					}
					((Unit)this).Battle.InstantWin();
				}
				else
				{
					if (FinalBossSequence != 6)
					{
						yield break;
					}
					FinalBossSequence = 7;
					foreach (Unit unit2 in ((Unit)this).Battle.AllAliveUnits)
					{
						yield return (BattleAction)new EndShootAction(unit2);
					}
					if (((Unit)this).Battle.HandZone.Any((Card c) => c is AyaFriendCirnoDef.AyaFriendCirno))
					{
						EnemyUnit megumu2 = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaAllyLong);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)this).GetView<UnitView>()).transform, -1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, 0f, 5f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True9Megumu, 2.5f, 0f, 2.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True10Megumu, 2.5f, 0f, 2f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase3True11Aya, 2.5f, 0f, 1.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True12Megumu, 1f, 0f, 1f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase3True13Aya, 3f, 0f, 3f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True14Megumu, 2.5f, 0f, 2.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase3True15Aya, 2.5f, 0f, 2.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, -12f, 5f, false), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(0.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)megumu2).GetView<UnitView>()).transform, 1f, 0.2f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu2).GetView<UnitView>()).transform, -11f, 1f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(2f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True16Megumu, 1.5f, 0f, 1.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True17Megumu, 3.5f, 0f, 3.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True18Megumu, 3f, 0f, 3f, true);
						yield return (BattleAction)(object)PerformAction.Effect((Unit)(object)megumu2, "BuffFirepower", 0f, "Firepower", 0f, (EffectBehavior)0, 0f);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True19Megumu, 2.5f, 0f, 2.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu2).GetView<UnitView>()).transform, -22f, 5f, false), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(3f, true);
						yield return (BattleAction)new SpawnEnemyAction(megumu2, typeof(AyaPlayerUnitM), 0, 0f, 0.5f, false);
						yield return (BattleAction)new SpawnEnemyAction(megumu2, typeof(AyaPlayerUnitS), 1, 0f, 0.5f, false);
						yield return (BattleAction)new SpawnEnemyAction(megumu2, typeof(AyaPlayerUnitO), 2, 0f, 0.5f, false);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaPlayerUnitO), SeijaPhase3True20Okina, 2.5f, 0f, 2.5f, true);
						((Unit)this).Battle.InstantWin();
					}
					else
					{
						EnemyUnit megumu = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaAllyLong);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)this).GetView<UnitView>()).transform, -1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, -12f, 10f, false)), (Ease)1), true), true));
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu).GetView<UnitView>()).transform, -11f, 1f, false), (Ease)3), true), true));
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu, SeijaPhase3Normal2Megumu, 2.5f, 0f, 2.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu, SeijaPhase3Normal3Megumu, 2.5f, 0f, 3.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)megumu).GetView<UnitView>()).transform, 1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu).GetView<UnitView>()).transform, -22f, 12f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu, SeijaPhase3Normal4Megumu, 2.5f, 0f, 2.5f, false);
						((Unit)this).Battle.InstantWin();
					}
				}
			}

			private IEnumerable<BattleAction> FinalBossPlayerDying(DieEventArgs arg)
			{
				if (FinalBossSequence == 2)
				{
					FinalBossTransition = true;
					((GameEntity)this).GameRun.SetHpAndMaxHp(1, 1, false);
					((GameEventArgs)arg).ForceCancelBecause((CancelCause)4096);
					((Unit)this).Status = (UnitStatus)0;
				}
				yield break;
			}

			private IEnumerable<BattleAction> FinalBossAllEnemyTurnStarting(GameEventArgs arg)
			{
				yield break;
			}

			private IEnumerable<BattleAction> FinalBossAllEnemyTurnEnded(GameEventArgs arg)
			{
				if (FinalBossTransition)
				{
					FinalBossTransition = false;
					FinalBossSequence = 3;
					foreach (EnemyUnit enemy in ((Unit)this).Battle.AllAliveEnemies)
					{
						if (enemy != FinalBoss)
						{
							yield return (BattleAction)new EscapeAction((Unit)(object)enemy);
						}
					}
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase21Seija, 2f, 0f, 2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase22Seija, 2f, 0f, 2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase23Aya, 3f, 0f, 2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase24Seija, 2f, 0f, 2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase25Seija, 2f, 0f, 2f, true);
					Vector2 defaultChat = UnitModelConfig.FromName("Reimu").Chat;
					UnitModelConfig.FromName("Reimu").Chat = new Vector2(0.4f, 0.4f);
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Reimu), 0, 0f, 0f, false);
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)((Unit)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Reimu)).GetStatusEffect<MirrorImage>(), true, 0f);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Reimu), SeijaPhase26Reimu, 3f, 0f, 3f, true);
					UnitModelConfig.FromName("Reimu").Chat = defaultChat;
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Marisa), 1, 0f, 0f, false);
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)((Unit)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Marisa)).GetStatusEffect<MirrorImage>(), true, 0f);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Marisa), SeijaPhase27Marisa, 3f, 0f, 3f, true);
					defaultChat = UnitModelConfig.FromName("Sakuya").Chat;
					UnitModelConfig.FromName("Sakuya").Chat = new Vector2(0.4f, 0.4f);
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Sakuya), 3, 0f, 0f, false);
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)((Unit)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Sakuya)).GetStatusEffect<MirrorImage>(), true, 0f);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Sakuya), SeijaPhase28Sakuya, 3f, 0f, 3f, true);
					UnitModelConfig.FromName("Sakuya").Chat = defaultChat;
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Cirno), 4, 0f, 0f, false);
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)((Unit)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Cirno)).GetStatusEffect<MirrorImage>(), true, 0f);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<AyaPlayerUnitBuddySeDef.AyaPlayerUnitBuddySe>((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Cirno), (int?)null, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Cirno), SeijaPhase29Cirno, 3f, 0f, 3f, true);
					yield return (BattleAction)new HealAction((Unit)(object)FinalBoss, (Unit)(object)FinalBoss, ((Unit)FinalBoss).MaxHp, (HealType)0, 0.2f);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase210Seija, 2f, 0f, 1f, true);
					UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar3.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase211Aya, 2f, 0f, 1f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase212Seija, 1.5f, 0f, 1.5f, true);
					yield return (BattleAction)(object)PerformAction.Gun((Unit)(object)this, (Unit)(object)FinalBoss, "JunkoLunatic", 0f);
					foreach (EnemyUnit enemy2 in ((Unit)this).Battle.AllAliveEnemies)
					{
						yield return (BattleAction)(object)PerformAction.Animation((Unit)(object)enemy2, "hit", 0f, (string)null, 0f, 10);
					}
					AudioManager.FadeOutBgm(0f);
					background.SetActive(true);
					UiManager.GetPanel<SystemBoard>().characterImage.sprite = ResourceLoader.LoadSprite("AyaAvatar4.png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 100, (Vector2?)null);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase213Aya, 2f, 0f, 2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase214Seija, 1f, 0f, 1f, true);
					List<Card> hands = ((Unit)this).Battle.HandZone.ToList();
					foreach (Card hand in hands)
					{
						yield return (BattleAction)new MoveCardAction(hand, (CardZone)4);
					}
					List<Card> keys = FinalBossKeyCards;
					foreach (Card key in keys)
					{
						((GameEntity)key).GameRun = ((GameEntity)this).GameRun;
						if (key.Battle == null)
						{
							key.EnterBattle(((Unit)this).Battle);
						}
						if ((int)key.Zone != 5)
						{
							yield return (BattleAction)new ExileCardAction(key);
						}
					}
					Card momiji = keys.First((Card c) => c is AyaFriendMomijiDef.AyaFriendMomiji);
					if ((int)momiji.Zone != 2)
					{
						yield return (BattleAction)new MoveCardAction(momiji, (CardZone)2);
					}
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase215Aya, 4f, 0f, 4f, true);
					Card megumu3 = keys.First((Card c) => c is AyaFriendMegumuDef.AyaFriendMegumu);
					if ((int)megumu3.Zone != 2)
					{
						yield return (BattleAction)new MoveCardAction(megumu3, (CardZone)2);
					}
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase216Aya, 4f, 0f, 4f, true);
					Card hatate = keys.First((Card c) => c is AyaFriendHatateDef.AyaFriendHatate);
					if ((int)hatate.Zone != 2)
					{
						yield return (BattleAction)new MoveCardAction(hatate, (CardZone)2);
					}
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase217Aya, 4f, 0f, 4f, true);
					foreach (Card key2 in keys)
					{
						((GameEntity)key2).GameRun = ((GameEntity)this).GameRun;
						if (key2.Battle != null)
						{
							yield return (BattleAction)new RemoveCardAction(key2);
							continue;
						}
						key2.EnterBattle(((Unit)this).Battle);
						yield return (BattleAction)new RemoveCardAction(key2);
					}
					List<Exhibit> ayaExhibits = new List<Exhibit>
					{
						(Exhibit)(object)Library.CreateExhibit<AyaRDef.AyaR>(),
						(Exhibit)(object)Library.CreateExhibit<AyaGDef.AyaG>()
					};
					foreach (Exhibit exhibit in ayaExhibits.Where((Exhibit e) => !((GameEntity)this).GameRun.Player.HasExhibit(((GameEntity)e).Id)))
					{
						((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(((GameEntity)this).GameRun.GainExhibitRunner(exhibit, false, (VisualSourceData)null));
					}
					Card card = (Card)(object)Library.CreateCard<AyaFriendAyaDef.AyaFriendAya>();
					int maxHand = ((Unit)this).Battle.MaxHand;
					((Unit)this).Battle.MaxHand = 99;
					yield return (BattleAction)new AddCardsToHandAction((Card[])(object)new Card[1] { card });
					((Unit)this).Battle.MaxHand = maxHand;
					yield return (BattleAction)(object)CardHelper.AutoCastAction(card, UnitSelector.Nobody, ManaGroup.Philosophies(7), true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<AyaPerfectGrazeSeDef.AyaPerfectGrazeSe>((Unit)(object)this, (int?)10, (int?)null, (int?)null, (int?)null, 0f, true);
					background.SetActive(false);
					EnemyUnit finalBoss = FinalBoss;
					Seija seija = (Seija)(object)((finalBoss is Seija) ? finalBoss : null);
					seija.ItemCount = 8;
					seija.BigRoundCount = 8;
					if (((Unit)seija).HasStatusEffect<DragonBallSe>())
					{
						yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)((Unit)seija).GetStatusEffect<DragonBallSe>(), true, 0f);
					}
				}
				else if (FinalBossSequence == 3 && Singleton<GameMaster>.Instance.CurrentGameRun.Battle.AllAliveEnemies.Count() == 1)
				{
					FinalBossSequence = 4;
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Tianzi), 0, 0f, 0.3f, false);
					EnemyUnit tianzi = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Tianzi);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<FlatPeach>((Unit)(object)tianzi, (int?)tianzi.Count1, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<EnemyEnergy>((Unit)(object)tianzi, (int?)0, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<GuangxueMicai>((Unit)(object)tianzi, (int?)null, (int?)999, (int?)null, (int?)null, 0.2f, true);
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Yuyuko), 1, 0f, 0.3f, false);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<GuangxueMicai>((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Yuyuko), (int?)null, (int?)999, (int?)null, (int?)null, 0.2f, true);
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(AyaAllyLong), 4, 0f, 0.3f, false);
				}
				else if (FinalBossSequence == 4 && Singleton<GameMaster>.Instance.CurrentGameRun.Battle.AllAliveEnemies.Count() == 2)
				{
					FinalBossSequence = 5;
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Sanae), 0, 0f, 0.3f, false);
					EnemyUnit sanae = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Sanae);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<Curiosity>((Unit)(object)sanae, (int?)(((int)sanae.Difficulty != 3) ? 1 : 2), (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<Amulet>((Unit)(object)sanae, (int?)3, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<GuangxueMicai>((Unit)(object)sanae, (int?)null, (int?)999, (int?)null, (int?)null, 0.2f, true);
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Remilia), 1, 0f, 0.3f, false);
					EnemyUnit remilia = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Remilia);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<ScarletDestiny>((Unit)(object)remilia, (int?)null, (int?)null, (int?)null, (int?)remilia.Count2, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<Graze>((Unit)(object)remilia, (int?)3, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<GuangxueMicai>((Unit)(object)remilia, (int?)null, (int?)999, (int?)null, (int?)null, 0.2f, true);
					yield return (BattleAction)new SpawnEnemyAction(FinalBoss, typeof(Junko), 3, 0f, 0.3f, false);
					Junko junko = (Junko)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is Junko);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<JunkoPurify>((Unit)(object)junko, (int?)1, (int?)null, (int?)null, (int?)null, 0f, true);
					junko._junkoColorLevel = 1;
					yield return (BattleAction)(object)new ApplyStatusEffectAction<JunkoColor>((Unit)(object)this, (int?)1, (int?)null, (int?)0, (int?)null, 0f, true);
					junko.Next = (MoveType)1;
					((EnemyUnit)junko).CountDown = 2;
					yield return (BattleAction)(object)new ApplyStatusEffectAction<GuangxueMicai>((Unit)(object)junko, (int?)null, (int?)999, (int?)null, (int?)null, 0.2f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase38Seija, 2f, 0f, 2f, true);
				}
				else
				{
					if (FinalBossSequence != 6)
					{
						yield break;
					}
					FinalBossSequence = 7;
					if (((Unit)this).Battle.HandZone.Any((Card c) => c is AyaFriendCirnoDef.AyaFriendCirno))
					{
						EnemyUnit megumu2 = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaAllyLong);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)this).GetView<UnitView>()).transform, -1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, 0f, 5f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True9Megumu, 2.5f, 0f, 2.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True10Megumu, 2.5f, 0f, 2f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase3True11Aya, 2.5f, 0f, 1.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True12Megumu, 1f, 0f, 1f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase3True13Aya, 3f, 0f, 3f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True14Megumu, 2.5f, 0f, 2.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)this, SeijaPhase3True15Aya, 2.5f, 0f, 2.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, -12f, 5f, false), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(0.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)megumu2).GetView<UnitView>()).transform, 1f, 0.2f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu2).GetView<UnitView>()).transform, -11f, 1f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(2f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True16Megumu, 1.5f, 0f, 1.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True17Megumu, 3.5f, 0f, 3.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True18Megumu, 3f, 0f, 3f, true);
						yield return (BattleAction)(object)PerformAction.Effect((Unit)(object)megumu2, "BuffFirepower", 0f, "Firepower", 0f, (EffectBehavior)0, 0f);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu2, SeijaPhase3True19Megumu, 2.5f, 0f, 2.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu2).GetView<UnitView>()).transform, -22f, 5f, false), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Wait(3f, true);
						yield return (BattleAction)new SpawnEnemyAction(megumu2, typeof(AyaPlayerUnitM), 0, 0f, 0.5f, false);
						yield return (BattleAction)new SpawnEnemyAction(megumu2, typeof(AyaPlayerUnitS), 1, 0f, 0.5f, false);
						yield return (BattleAction)new SpawnEnemyAction(megumu2, typeof(AyaPlayerUnitO), 2, 0f, 0.5f, false);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaPlayerUnitO), SeijaPhase3True20Okina, 2.5f, 0f, 2.5f, true);
						((Unit)this).Battle.InstantWin();
					}
					else
					{
						EnemyUnit megumu = ((Unit)this).Battle.AllAliveEnemies.First((EnemyUnit e) => e is AyaAllyLong);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)this).GetView<UnitView>()).transform, -1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)this).GetView<UnitView>()).transform, -12f, 10f, false)), (Ease)1), true), true));
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu).GetView<UnitView>()).transform, -11f, 1f, false), (Ease)3), true), true));
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu, SeijaPhase3Normal2Megumu, 2.5f, 0f, 2.5f, true);
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu, SeijaPhase3Normal3Megumu, 2.5f, 0f, 3.5f, true);
						TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<Sequence>(TweenSettingsExtensions.SetUpdate<Sequence>(TweenSettingsExtensions.SetEase<Sequence>(TweenSettingsExtensions.Append(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)ShortcutExtensions.DOScaleX(((Component)((Unit)megumu).GetView<UnitView>()).transform, 1f, 0.25f)), (Tween)(object)ShortcutExtensions.DOLocalMoveX(((Component)((Unit)megumu).GetView<UnitView>()).transform, -22f, 12f, false)), (Ease)1), true), true));
						yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)megumu, SeijaPhase3Normal4Megumu, 2.5f, 0f, 2.5f, false);
						((Unit)this).Battle.InstantWin();
					}
				}
			}

			private IEnumerable<BattleAction> FinalBossCardRemoving(CardEventArgs arg)
			{
				if (FinalBossSequence < 3 && FinalBossKeyCards.Contains(arg.Card))
				{
					((GameEventArgs)arg).ForceCancelBecause((CancelCause)4096);
					yield return (BattleAction)new ExileCardAction(arg.Card);
				}
			}

			private IEnumerable<BattleAction> FinalBossCardTransforming(CardTransformEventArgs arg)
			{
				if (FinalBossSequence < 3 && FinalBossKeyCards.Contains(arg.SourceCard))
				{
					((GameEventArgs)arg).ForceCancelBecause((CancelCause)4096);
					yield return (BattleAction)new ExileCardAction(arg.SourceCard);
				}
			}

			private IEnumerable<BattleAction> FinalBossEnemySpawned(UnitEventArgs args)
			{
				if (args.Unit is AyaAllyLong)
				{
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase31Seija, 2.5f, 0f, 2.5f, true);
					yield return (BattleAction)(object)PerformAction.Chat(args.Unit, SeijaPhase32Megumu, 1.5f, 0f, 1.5f, true);
					TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOLocalMoveX(((Component)args.Unit.GetView<UnitView>()).transform, -12f, 3f, false), (Ease)3), true), true));
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase33Seija, 1.5f, 0f, 1.5f, true);
					yield return (BattleAction)(object)PerformAction.Chat((Unit)(object)FinalBoss, SeijaPhase34Seija, 1.5f, 0f, 1f, true);
					TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSetting