Decompiled source of ShiningExhibitsPlus v0.1.4

ShiningExhibitsPlus.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AddWatermark;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LBoL.Base;
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.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.Exhibits;
using LBoL.Presentation.UI.Widgets;
using LBoL.Presentation.Units;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.BattleModifiers.Actions;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
using ShiningExhibitsPlus.StatusEffects;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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("ShiningExhibitsPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShiningExhibitsPlus")]
[assembly: AssemblyTitle("ShiningExhibitsPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ShiningExhibitsPlus
{
	[BepInPlugin("cyaneko.lbol.mods.shiningexhibitsplus", "ShiningExhibitsPlus", "0.1.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("LBoL.exe")]
	public class BepinexPlugin : BaseUnityPlugin
	{
		private static readonly Harmony harmony = PInfo.harmony;

		internal static ManualLogSource log;

		internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);

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

		internal static DirectorySource directorySource = new DirectorySource("cyaneko.lbol.mods.shiningexhibitsplus", "");

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

		internal static BatchLocalization statusLoc = new BatchLocalization((IResourceSource)(object)directorySource, typeof(StatusEffectTemplate), "StatusEffects_", (Locale)0, false);

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			EntityManager.RegisterSelf();
			harmony.PatchAll();
			if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
			{
				WatermarkWrapper.ActivateWatermark();
			}
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public static class PInfo
	{
		public const string GUID = "cyaneko.lbol.mods.shiningexhibitsplus";

		public const string Name = "ShiningExhibitsPlus";

		public const string version = "0.1.4";

		public static readonly Harmony harmony = new Harmony("cyaneko.lbol.mods.shiningexhibitsplus");
	}
	internal class WatermarkWrapper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void ActivateWatermark()
		{
			API.ActivateWatermark();
		}
	}
}
namespace ShiningExhibitsPlus.StatusEffects
{
	public sealed class AliceShieldProtectionDef : StatusEffectTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("AliceShieldProtection");
		}

		public override StatusEffectConfig MakeConfig()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			return new StatusEffectConfig(0, "", 7, (StatusEffectType)0, false, true, (int?)null, true, (StackType?)(StackType)1, false, (StackType?)(StackType)1, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string>(), "BuffWhite", "DroneBlockLoop", "Buff");
		}

		public override Sprite LoadSprite()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null);
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.statusLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(AliceShieldProtectionDef))]
	public sealed class AliceShieldProtection : StatusEffect
	{
		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).HandleOwnerEvent<UnitEventArgs>(unit.TurnStarting, (GameEventHandler<UnitEventArgs>)OnTurnStarting);
			((StatusEffect)this).HandleOwnerEvent<DamageEventArgs>(unit.DamageReceiving, (GameEventHandler<DamageEventArgs>)OnDamageReceiving);
		}

		private void OnTurnStarting(UnitEventArgs args)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			((GameEntity)this).React(Reactor.op_Implicit((BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)this, true, 0.1f)));
		}

		private void OnDamageReceiving(DamageEventArgs args)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between I4 and Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = args.DamageInfo;
			if (2 == (int)((DamageInfo)(ref damageInfo)).DamageType)
			{
				args.DamageInfo = ((DamageInfo)(ref damageInfo)).ReduceBy(((StatusEffect)this).Level);
				((GameEventArgs)args).AddModifier((GameEntity)(object)this);
			}
		}
	}
	public sealed class MomijiSwordFocusDef : StatusEffectTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("MomijiSwordFocus");
		}

		public override StatusEffectConfig MakeConfig()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			return new StatusEffectConfig(0, "", 7, (StatusEffectType)2, 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>(), "Lockon", "Default", "Debuff");
		}

		public override Sprite LoadSprite()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null);
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.statusLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(MomijiSwordFocusDef))]
	public sealed class MomijiSwordFocus : StatusEffect
	{
		protected override void OnAdded(Unit unit)
		{
			((StatusEffect)this).HandleOwnerEvent<DamageEventArgs>(unit.DamageReceiving, (GameEventHandler<DamageEventArgs>)OnDamageReceiving);
		}

		private void OnDamageReceiving(DamageEventArgs args)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between I4 and Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = args.DamageInfo;
			if (2 == (int)((DamageInfo)(ref damageInfo)).DamageType)
			{
				args.DamageInfo = ((DamageInfo)(ref damageInfo)).IncreaseBy(((StatusEffect)this).Level);
				((GameEventArgs)args).AddModifier((GameEntity)(object)this);
			}
		}
	}
}
namespace ShiningExhibitsPlus.Exhibits
{
	public sealed class AliceShieldDef : ExhibitTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("AliceShield");
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			return new ExhibitConfig(0, "", 10, false, false, false, true, (AppearanceType)0, "", (ExhibitLosableType)2, (Rarity)3, (int?)2, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)(ManaColor)1, 1, false, (int?)null, (Keyword)1536, (IReadOnlyList<string>)new List<string> { "AliceShieldProtection" }, (IReadOnlyList<string>)new List<string>());
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new ExhibitSprites
			{
				main = ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null)
			};
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(AliceShieldDef))]
	public sealed class AliceShield : ShiningExhibit
	{
		private bool GainedBlock;

		private bool GainedShield;

		private bool MyTurn;

		protected override string GetBaseDescription()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(((Exhibit)this).GetBaseDescription());
			if (GainedBlock || GainedShield)
			{
				stringBuilder.AppendLine();
				if (GainedBlock)
				{
					stringBuilder.Append(((GameEntity)this).LocalizeProperty("GainedBlock", true, true));
				}
				if (GainedShield)
				{
					stringBuilder.Append(((GameEntity)this).LocalizeProperty("GainedShield", true, true));
				}
			}
			return stringBuilder.ToString();
		}

		protected override void OnEnterBattle()
		{
			((Exhibit)this).HandleBattleEvent<UnitEventArgs>(((Unit)((Exhibit)this).Owner).TurnStarting, (GameEventHandler<UnitEventArgs>)OnTurnStarting);
			((Exhibit)this).HandleBattleEvent<UnitEventArgs>(((Unit)((Exhibit)this).Owner).TurnEnded, (GameEventHandler<UnitEventArgs>)OnTurnEnded);
			((Exhibit)this).ReactBattleEvent<BlockShieldEventArgs>(((Unit)((Exhibit)this).Owner).BlockShieldGained, (EventSequencedReactor<BlockShieldEventArgs>)OnBlockShieldGained);
		}

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

		private void OnTurnStarting(UnitEventArgs args)
		{
			GainedBlock = false;
			GainedShield = false;
			((Exhibit)this).Active = true;
			MyTurn = true;
		}

		private void OnTurnEnded(UnitEventArgs args)
		{
			MyTurn = false;
		}

		private IEnumerable<BattleAction> OnBlockShieldGained(BlockShieldEventArgs args)
		{
			if (((Exhibit)this).Active && MyTurn)
			{
				if (!GainedBlock && 0f < args.Block)
				{
					GainedBlock = true;
				}
				if (!GainedShield && 0f < args.Shield)
				{
					GainedShield = true;
				}
				if (GainedBlock && GainedShield)
				{
					((Exhibit)this).NotifyActivating();
					((Exhibit)this).Active = false;
					yield return (BattleAction)(object)new ApplyStatusEffectAction<AliceShieldProtection>((Unit)(object)((Exhibit)this).Owner, (int?)((Exhibit)this).Value1, (int?)null, (int?)null, (int?)null, 0.1f, true);
				}
			}
		}
	}
	public sealed class BrickManualDef : ExhibitTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("BrickManual");
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			return new ExhibitConfig(0, "", 12, false, false, false, true, (AppearanceType)0, "", (ExhibitLosableType)2, (Rarity)3, (int?)1, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)(ManaColor)2, 1, false, (int?)null, (Keyword)0, (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>());
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new ExhibitSprites
			{
				main = ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null)
			};
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(BrickManualDef))]
	public sealed class BrickManual : ShiningExhibit
	{
		protected override void OnEnterBattle()
		{
			((Exhibit)this).ReactBattleEvent<UnitEventArgs>(((Unit)((Exhibit)this).Owner).TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnTurnStarted);
		}

		protected override void OnAdded(PlayerUnit player)
		{
			GameRunController gameRun = ((GameEntity)this).GameRun;
			gameRun.DrawCardCount += ((Exhibit)this).Value1;
			if (((Exhibit)this).Battle != null)
			{
				BattleController battle = ((Exhibit)this).Battle;
				battle.DrawCardCount += ((Exhibit)this).Value1;
			}
		}

		protected override void OnRemoved(PlayerUnit player)
		{
			GameRunController gameRun = ((GameEntity)this).GameRun;
			gameRun.DrawCardCount -= ((Exhibit)this).Value1;
			if (((Exhibit)this).Battle != null)
			{
				BattleController battle = ((Exhibit)this).Battle;
				battle.DrawCardCount -= ((Exhibit)this).Value1;
			}
		}

		private IEnumerable<BattleAction> OnTurnStarted(UnitEventArgs args)
		{
			if (((Exhibit)this).Battle.BattleShouldEnd)
			{
				yield break;
			}
			((Exhibit)this).NotifyActivating();
			if (((Exhibit)this).Value1 >= ((Exhibit)this).Battle.HandZone.Count)
			{
				List<Card> list = ((Exhibit)this).Battle.HandZone.ToList();
				foreach (Card item in list)
				{
					yield return (BattleAction)new MoveCardToDrawZoneAction(item, (DrawZoneTarget)2);
				}
				yield break;
			}
			SelectHandInteraction @int = new SelectHandInteraction(((Exhibit)this).Value1, ((Exhibit)this).Value1, (IEnumerable<Card>)((Exhibit)this).Battle.HandZone)
			{
				Source = (GameEntity)(object)this
			};
			yield return (BattleAction)new InteractionAction((Interaction)(object)@int, false);
			foreach (Card selectedCard in @int.SelectedCards)
			{
				yield return (BattleAction)new MoveCardToDrawZoneAction(selectedCard, (DrawZoneTarget)2);
			}
		}
	}
	public sealed class KanakoOnbashiraDef : ExhibitTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("KanakoOnbashira");
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			return new ExhibitConfig(0, "", 10, false, false, false, true, (AppearanceType)0, "", (ExhibitLosableType)2, (Rarity)3, (int?)3, (int?)1, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)(ManaColor)5, 1, false, (int?)null, (Keyword)4, (IReadOnlyList<string>)new List<string> { "Firepower", "Spirit" }, (IReadOnlyList<string>)new List<string>());
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new ExhibitSprites
			{
				main = ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null)
			};
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(KanakoOnbashiraDef))]
	public sealed class KanakoOnbashira : ShiningExhibit
	{
		protected override void OnEnterBattle()
		{
			((Exhibit)this).ReactBattleEvent<CardUsingEventArgs>(((Exhibit)this).Battle.CardUsed, (EventSequencedReactor<CardUsingEventArgs>)OnCardUsed);
		}

		private IEnumerable<BattleAction> OnCardUsed(CardUsingEventArgs args)
		{
			if (4 == (int)args.Card.CardType)
			{
				int value = ((Exhibit)this).Value1;
				ManaGroup consumingMana = args.ConsumingMana;
				if (value <= ((ManaGroup)(ref consumingMana)).Amount)
				{
					((Exhibit)this).NotifyActivating();
					yield return (BattleAction)(object)new ApplyStatusEffectAction<Firepower>((Unit)(object)((Exhibit)this).Owner, (int?)((Exhibit)this).Value2, (int?)null, (int?)null, (int?)null, 0f, true);
					yield return (BattleAction)(object)new ApplyStatusEffectAction<Spirit>((Unit)(object)((Exhibit)this).Owner, (int?)((Exhibit)this).Value2, (int?)null, (int?)null, (int?)null, 0f, true);
				}
			}
		}
	}
	public sealed class KeikiToolsDef : ExhibitTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("KeikiTools");
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			return new ExhibitConfig(0, "", 10, false, false, false, true, (AppearanceType)0, "", (ExhibitLosableType)2, (Rarity)3, (int?)1, (int?)null, (int?)null, (ManaGroup?)ManaGroup.Single((ManaColor)7), (ManaColor?)null, (ManaColor?)(ManaColor)7, 1, false, (int?)null, (Keyword)2048, (IReadOnlyList<string>)new List<string>(), (IReadOnlyList<string>)new List<string>());
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new ExhibitSprites
			{
				main = ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null)
			};
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(KeikiToolsDef))]
	public sealed class KeikiTools : ShiningExhibit
	{
		protected override void OnEnterBattle()
		{
			((Exhibit)this).ReactBattleEvent<UnitEventArgs>(((Unit)((Exhibit)this).Owner).TurnStarted, (EventSequencedReactor<UnitEventArgs>)OnTurnStarted);
		}

		private IEnumerable<BattleAction> OnTurnStarted(UnitEventArgs args)
		{
			ManaGroup conv = ManaGroup.Empty;
			ManaGroup battleMana = ((Exhibit)this).Battle.BattleMana;
			for (int i = 0; i < ((Exhibit)this).Value1; i++)
			{
				ManaColor val = ((ManaGroup)(ref battleMana)).MaxTrivialColor;
				if (((ManaGroup)(ref battleMana))[val] <= ((ManaGroup)(ref battleMana))[(ManaColor)6])
				{
					val = (ManaColor)6;
				}
				if (0 >= ((ManaGroup)(ref battleMana))[val])
				{
					break;
				}
				ref ManaGroup reference = ref conv;
				ManaColor val2 = val;
				((ManaGroup)(ref reference))[val2] = ((ManaGroup)(ref reference))[val2] + 1;
				reference = ref battleMana;
				val2 = val;
				((ManaGroup)(ref reference))[val2] = ((ManaGroup)(ref reference))[val2] - 1;
			}
			if (conv != ManaGroup.Empty)
			{
				((Exhibit)this).NotifyActivating();
				yield return (BattleAction)(object)PerformAction.Sfx("FairySupport", 0f);
				yield return (BattleAction)new ConvertManaAction(conv, ManaGroup.Philosophies(((ManaGroup)(ref conv)).Amount), true);
			}
		}
	}
	public sealed class MomijiSwordDef : ExhibitTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("MomijiSword");
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			return new ExhibitConfig(0, "", 69, false, false, false, true, (AppearanceType)0, "", (ExhibitLosableType)2, (Rarity)3, (int?)1, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)(ManaColor)4, 1, false, (int?)null, (Keyword)0, (IReadOnlyList<string>)new List<string> { "MomijiSwordFocus" }, (IReadOnlyList<string>)new List<string>());
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new ExhibitSprites
			{
				main = ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null)
			};
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(MomijiSwordDef))]
	public sealed class MomijiSword : ShiningExhibit
	{
		protected override void OnEnterBattle()
		{
			((Exhibit)this).ReactBattleEvent<UnitEventArgs>(((Unit)((Exhibit)this).Owner).TurnEnded, (EventSequencedReactor<UnitEventArgs>)OnTurnEnded);
			((Exhibit)this).ReactBattleEvent<StatisticalDamageEventArgs>(((Unit)((Exhibit)this).Owner).StatisticalTotalDamageDealt, (EventSequencedReactor<StatisticalDamageEventArgs>)OnStatisticalDamageDealt);
		}

		private IEnumerable<BattleAction> CleanseSE(IEnumerable<EnemyUnit> enemies)
		{
			foreach (EnemyUnit enemy in enemies)
			{
				MomijiSwordFocus statusEffect = ((Unit)enemy).GetStatusEffect<MomijiSwordFocus>();
				if (statusEffect != null)
				{
					yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)statusEffect, true, 0.06f);
				}
			}
		}

		private IEnumerable<BattleAction> OnTurnEnded(UnitEventArgs args)
		{
			if (((Exhibit)this).Battle.BattleShouldEnd)
			{
				yield break;
			}
			foreach (BattleAction item in CleanseSE(((Exhibit)this).Battle.AllAliveEnemies))
			{
				yield return item;
			}
		}

		private IEnumerable<BattleAction> OnStatisticalDamageDealt(StatisticalDamageEventArgs args)
		{
			if (((Exhibit)this).Battle.BattleShouldEnd)
			{
				yield break;
			}
			IEnumerable<EnemyUnit> otherEnemies = ((Exhibit)this).Battle.AllAliveEnemies;
			if (1 == args.ArgsTable.Count)
			{
				args.ArgsTable.First().Deconstruct(out var key, out var value);
				Unit target = key;
				IReadOnlyList<DamageEventArgs> source = value;
				otherEnemies = otherEnemies.Where((EnemyUnit tgt) => tgt != target);
				if (target.IsAlive)
				{
					int num = source.Count(delegate(DamageEventArgs dmg)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0007: Unknown result type (might be due to invalid IL or missing references)
						//IL_000a: Unknown result type (might be due to invalid IL or missing references)
						//IL_000f: Invalid comparison between I4 and Unknown
						//IL_0017: Unknown result type (might be due to invalid IL or missing references)
						//IL_001c: Unknown result type (might be due to invalid IL or missing references)
						DamageInfo damageInfo = dmg.DamageInfo;
						if (2 == (int)((DamageInfo)(ref damageInfo)).DamageType)
						{
							damageInfo = dmg.DamageInfo;
							return 0f < ((DamageInfo)(ref damageInfo)).Amount;
						}
						return false;
					});
					if (0 < num)
					{
						((Exhibit)this).NotifyActivating();
						yield return (BattleAction)(object)new ApplyStatusEffectAction<MomijiSwordFocus>(target, (int?)(num * ((Exhibit)this).Value1), (int?)null, (int?)null, (int?)null, 0f, true);
					}
				}
			}
			foreach (BattleAction item in CleanseSE(otherEnemies))
			{
				yield return item;
			}
		}
	}
	public sealed class SeigaHairpinDef : ExhibitTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("SeigaHairpin");
		}

		public override ExhibitConfig MakeConfig()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			return new ExhibitConfig(0, "", 1, false, false, false, true, (AppearanceType)0, "", (ExhibitLosableType)2, (Rarity)3, (int?)1, (int?)null, (int?)null, (ManaGroup?)null, (ManaColor?)null, (ManaColor?)(ManaColor)3, 1, false, (int?)null, (Keyword)0, (IReadOnlyList<string>)new List<string> { "Weak", "Vulnerable" }, (IReadOnlyList<string>)new List<string>());
		}

		public override ExhibitSprites LoadSprite()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new ExhibitSprites
			{
				main = ResourceLoader.LoadSprite(IdContainer.op_Implicit(((EntityDefinition)this).GetId()) + ".png", (IResourceSource)(object)BepinexPlugin.directorySource, (Rect?)null, 1, (Vector2?)null)
			};
		}

		public override LocalizationOption LoadLocalization()
		{
			return (LocalizationOption)(object)BepinexPlugin.exhibitLoc.AddEntity((EntityDefinition)(object)this);
		}
	}
	[EntityLogic(typeof(SeigaHairpinDef))]
	public sealed class SeigaHairpin : ShiningExhibit
	{
		protected override void OnEnterBattle()
		{
			((Exhibit)this).ReactBattleEvent<StatusEffectApplyEventArgs>(((Unit)((Exhibit)this).Owner).StatusEffectAdding, (EventSequencedReactor<StatusEffectApplyEventArgs>)OnStatusEffectAdding);
			((Exhibit)this).ReactBattleEvent<StatusEffectEventArgs>(((Unit)((Exhibit)this).Owner).StatusEffectRemoved, (EventSequencedReactor<StatusEffectEventArgs>)OnStatusEffectRemoved);
			((Exhibit)this).ReactBattleEvent<UnitEventArgs>(((Exhibit)this).Battle.EnemySpawned, (EventSequencedReactor<UnitEventArgs>)OnEnemySpawned);
			foreach (EnemyUnit allAliveEnemy in ((Exhibit)this).Battle.AllAliveEnemies)
			{
				((Exhibit)this).HandleBattleEvent<StatusEffectEventArgs>(((Unit)allAliveEnemy).StatusEffectRemoving, (GameEventHandler<StatusEffectEventArgs>)OnEnemyStatusEffectRemoving);
			}
		}

		private BattleAction ApplyPhantomSE<T>(Unit target) where T : StatusEffect
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_005d: Expected O, but got Unknown
			Type typeFromHandle = typeof(T);
			int? num = 0;
			ApplySEnoTriggers val = new ApplySEnoTriggers(typeFromHandle, target, (int?)null, num, (int?)null, (int?)null, 0f, true);
			((EventBattleAction<StatusEffectApplyEventArgs>)val).Args.Effect.ForceNotShowDownText = true;
			((EventBattleAction<StatusEffectApplyEventArgs>)val).Args.Effect.IsAutoDecreasing = false;
			return (BattleAction)val;
		}

		private IEnumerable<BattleAction> OnEnemySpawned(UnitEventArgs args)
		{
			if (((Unit)((Exhibit)this).Owner).HasStatusEffect<Weak>())
			{
				((Exhibit)this).NotifyActivating();
				yield return ApplyPhantomSE<Weak>(args.Unit);
			}
			if (((Unit)((Exhibit)this).Owner).HasStatusEffect<Vulnerable>())
			{
				((Exhibit)this).NotifyActivating();
				yield return ApplyPhantomSE<Vulnerable>(args.Unit);
			}
			((Exhibit)this).HandleBattleEvent<StatusEffectEventArgs>(args.Unit.StatusEffectRemoving, (GameEventHandler<StatusEffectEventArgs>)OnEnemyStatusEffectRemoving);
		}

		private IEnumerable<BattleAction> OnStatusEffectAdding(StatusEffectApplyEventArgs args)
		{
			if (args.Effect is Weak)
			{
				if (!((Exhibit)this).Active)
				{
					((Exhibit)this).NotifyActivating();
					((Exhibit)this).Active = true;
				}
				foreach (EnemyUnit item in ((Exhibit)this).Battle.AllAliveEnemies.Where((EnemyUnit enemy) => !((Unit)enemy).HasStatusEffect<Weak>()))
				{
					yield return ApplyPhantomSE<Weak>((Unit)(object)item);
				}
			}
			if (!(args.Effect is Vulnerable))
			{
				yield break;
			}
			if (!((Exhibit)this).Active)
			{
				((Exhibit)this).NotifyActivating();
				((Exhibit)this).Active = true;
			}
			foreach (EnemyUnit item2 in ((Exhibit)this).Battle.AllAliveEnemies.Where((EnemyUnit enemy) => !((Unit)enemy).HasStatusEffect<Vulnerable>()))
			{
				yield return ApplyPhantomSE<Vulnerable>((Unit)(object)item2);
			}
		}

		private IEnumerable<BattleAction> OnStatusEffectRemoved(StatusEffectEventArgs args)
		{
			if (args.Effect is Weak)
			{
				foreach (EnemyUnit allAliveEnemy in ((Exhibit)this).Battle.AllAliveEnemies)
				{
					Weak statusEffect = ((Unit)allAliveEnemy).GetStatusEffect<Weak>();
					if (statusEffect != null && (!((StatusEffect)statusEffect).IsAutoDecreasing || 0 >= ((StatusEffect)statusEffect).Duration))
					{
						yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)statusEffect, true, 0f);
					}
				}
			}
			else if (args.Effect is Vulnerable)
			{
				foreach (EnemyUnit allAliveEnemy2 in ((Exhibit)this).Battle.AllAliveEnemies)
				{
					Vulnerable statusEffect2 = ((Unit)allAliveEnemy2).GetStatusEffect<Vulnerable>();
					if (statusEffect2 != null && (!((StatusEffect)statusEffect2).IsAutoDecreasing || 0 >= ((StatusEffect)statusEffect2).Duration))
					{
						yield return (BattleAction)new RemoveStatusEffectAction((StatusEffect)(object)statusEffect2, true, 0f);
					}
				}
			}
			((Exhibit)this).Active = ((Unit)((Exhibit)this).Owner).HasStatusEffect<Weak>() || ((Unit)((Exhibit)this).Owner).HasStatusEffect<Vulnerable>();
		}

		private void OnEnemyStatusEffectRemoving(StatusEffectEventArgs args)
		{
			if ((!(args.Effect is Weak) || !((Unit)((Exhibit)this).Owner).HasStatusEffect<Weak>()) && (!(args.Effect is Vulnerable) || !((Unit)((Exhibit)this).Owner).HasStatusEffect<Vulnerable>()))
			{
				return;
			}
			args.Effect.ForceNotShowDownText = true;
			args.Effect.IsAutoDecreasing = false;
			UnitView view = args.Unit.GetView<UnitView>();
			if ((Object)null != (Object)(object)view)
			{
				StatusEffectWidget obj = view._statusWidget.FindStatusEffect(args.Effect);
				if (obj != null)
				{
					obj.TextRefresh();
				}
			}
			((GameEventArgs)args).CanCancel = true;
			((GameEventArgs)args).CancelBy((GameEntity)(object)this);
		}
	}
	[HarmonyPatch(typeof(StatusEffect))]
	internal class StatusEffect_Stack_Patch
	{
		[HarmonyPatch("Stack", new Type[] { typeof(StatusEffect) })]
		private static void Postfix(StatusEffect __instance, StatusEffect other)
		{
			if (__instance is Weak || __instance is Vulnerable)
			{
				__instance.ForceNotShowDownText &= other.ForceNotShowDownText;
				__instance.IsAutoDecreasing |= other.IsAutoDecreasing;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}