Decompiled source of mt2 sandscourged v0.2.0

plugins/mt2_sandscourged.Plugin.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using ShinyShoe;
using SimpleInjector;
using TrainworksReloaded.Base.Extensions;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Extensions;
using TrainworksReloaded.Core.Interfaces;
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: AssemblyCompany("mt2_sandscourged.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0+fffb8e2551f7368061e6bb572970e8d3be37527e")]
[assembly: AssemblyProduct("mt2_sandscourged.Plugin")]
[assembly: AssemblyTitle("mt2_sandscourged.Plugin")]
[assembly: AssemblyVersion("0.2.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[SearchWindowPath("Card Upgrade")]
public sealed class CardEffectAddTempUpgradeToCurrentCard : CardEffectBase
{
	[CompilerGenerated]
	private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CardEffectParams cardEffectParams;

		public ICoreGameManagers coreGameManagers;

		public CardEffectState cardEffectState;

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

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

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

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

		private bool MoveNext()
		{
			if (<>1__state != 0)
			{
				return false;
			}
			<>1__state = -1;
			CardState playedCard = cardEffectParams.playedCard;
			if (playedCard == null)
			{
				return false;
			}
			CardManager cardManager = coreGameManagers.GetCardManager();
			CardUpgradeState val = default(CardUpgradeState);
			if (CardUpgradeHelper.TryApplyUpgradeToCard(playedCard, playedCard, cardEffectState.GetParamCardUpgradeData(), true, cardEffectParams.isFromHiddenTrigger, coreGameManagers, ref val))
			{
				playedCard.UpdateCardBodyText((SaveManager)null);
				cardManager.RefreshCardInHand(playedCard, false, false, false);
				CardUI cardInHand = cardManager.GetCardInHand(playedCard);
				if ((Object)(object)cardInHand != (Object)null && (Object)(object)cardInHand != (Object)null)
				{
					cardInHand.ShowEnhanceFX();
				}
			}
			return false;
		}

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

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

	public override bool CanPlayAfterBossDead => false;

	public override bool CanApplyInPreviewMode => false;

	public override PropDescriptions CreateEditorInspectorDescriptions()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0025: Expected O, but got Unknown
		//IL_0026: Expected O, but got Unknown
		PropDescriptions val = new PropDescriptions { };
		string fieldName;
		((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Card Upgrade", "", (Type)null, false);
		return val;
	}

	[IteratorStateMachine(typeof(<ApplyEffect>d__5))]
	public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ApplyEffect>d__5(0)
		{
			cardEffectState = cardEffectState,
			cardEffectParams = cardEffectParams,
			coreGameManagers = coreGameManagers
		};
	}

	public override void GetTooltipsStatusList(CardEffectState cardEffectState, ref List<string> outStatusIdList)
	{
		CardEffectAddUpgradeToCurrentCard.GetTooltipsStatusList(cardEffectState.GetSourceCardEffectData(), ref outStatusIdList);
	}

	public static void GetTooltipsStatusList(CardEffectData cardEffectData, ref List<string> outStatusIdList)
	{
		foreach (StatusEffectStackData statusEffectUpgrade in cardEffectData.GetParamCardUpgradeData().GetStatusEffectUpgrades())
		{
			outStatusIdList.Add(statusEffectUpgrade.statusId);
		}
	}
}
public sealed class RoomStateAddStatusEffectOnAnyStatusApplied : RoomStateModifierBase, IRoomStateOnStatusEffectAppliedModifier, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext, IRoomStateOnCharacterTriggerModifier
{
	[CompilerGenerated]
	private sealed class <ApplyCharacterTriggerModification>d__2 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Trigger trigger;

		public FireTriggersData fireTriggersData;

		public RoomStateAddStatusEffectOnAnyStatusApplied <>4__this;

		public CharacterState affectedCharacter;

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

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

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

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

		private bool MoveNext()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			int num = <>1__state;
			RoomStateAddStatusEffectOnAnyStatusApplied roomStateAddStatusEffectOnAnyStatusApplied = <>4__this;
			if (num != 0)
			{
				return false;
			}
			<>1__state = -1;
			if ((int)trigger != 57)
			{
				return false;
			}
			if (fireTriggersData == null)
			{
				return false;
			}
			if (fireTriggersData.paramInt2 != roomStateAddStatusEffectOnAnyStatusApplied.thisInstTrackingId)
			{
				return false;
			}
			roomStateAddStatusEffectOnAnyStatusApplied.addStatusEffectParams.fromRoomModifier = true;
			affectedCharacter.AddStatusEffect(fireTriggersData.paramString, fireTriggersData.paramInt, roomStateAddStatusEffectOnAnyStatusApplied.addStatusEffectParams, (CharacterState)null, true, false, true, false);
			return false;
		}

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

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

	private static int trackingIdCounter;

	private int thisInstTrackingId;

	private bool buffsAllowed;

	private bool debuffsAllowed;

	private bool persistentAllowed;

	private bool abilitiesAllowed;

	private readonly List<Type> teamsAllowed = new List<Type>();

	private readonly List<StatusEffectStackData>? statusEffects = new List<StatusEffectStackData>();

	private readonly AddStatusEffectParams? addStatusEffectParams = new AddStatusEffectParams();

	public override void Initialize(RoomModifierData roomModifierData, ICoreGameManagers coreGameManagers)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		((RoomStateModifierBase)this).Initialize(roomModifierData, coreGameManagers);
		thisInstTrackingId = ++trackingIdCounter;
		StatusEffectStackData[] paramStatusEffects = roomModifierData.GetParamStatusEffects();
		foreach (StatusEffectStackData val in paramStatusEffects)
		{
			StatusEffectStackData item = new StatusEffectStackData
			{
				statusId = val.statusId,
				count = val.count
			};
			statusEffects?.Add(item);
		}
		int paramInt = roomModifierData.GetParamInt();
		buffsAllowed = (paramInt & 1) > 0;
		debuffsAllowed = (paramInt & 2) > 0;
		persistentAllowed = (paramInt & 4) > 0;
		abilitiesAllowed = (paramInt & 8) > 0;
		int paramInt2 = roomModifierData.GetParamInt2();
		if ((paramInt2 & 1) > 0)
		{
			teamsAllowed.Add((Type)2);
		}
		if ((paramInt2 & 2) > 0)
		{
			teamsAllowed.Add((Type)1);
		}
	}

	public void OnStatusEffectAppliedModification(CharacterState affectedCharacter, string statusId, AddStatusEffectParams addStatusEffectParams, ICoreGameManagers coreGameManagers)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Expected O, but got Unknown
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: 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)
		if (addStatusEffectParams.spawnEffect || addStatusEffectParams.fromRoomModifier || !teamsAllowed.Contains(affectedCharacter.GetTeamType()))
		{
			return;
		}
		StatusEffectData statusEffectDataById = StatusEffectManager.Instance.GetStatusEffectDataById(statusId, true);
		DisplayCategory? val = ((statusEffectDataById != null) ? new DisplayCategory?(statusEffectDataById.GetDisplayCategory()) : null);
		if (val.HasValue && ((val == (DisplayCategory?)0 && !buffsAllowed) || (val == (DisplayCategory?)1 && !debuffsAllowed) || (val == (DisplayCategory?)2 && !persistentAllowed) || (val == (DisplayCategory?)3 && !abilitiesAllowed)))
		{
			return;
		}
		CombatManager combatManager = coreGameManagers.GetCombatManager();
		using List<StatusEffectStackData>.Enumerator enumerator = statusEffects.GetEnumerator();
		while (enumerator.MoveNext())
		{
			combatManager.QueueTrigger(affectedCharacter, (Trigger)57, (CharacterState)null, true, true, new FireTriggersData
			{
				paramString = enumerator.Current.statusId,
				paramInt = enumerator.Current.count,
				paramInt2 = thisInstTrackingId
			}, 1, (CharacterTriggerState)null);
		}
	}

	[IteratorStateMachine(typeof(<ApplyCharacterTriggerModification>d__2))]
	public IEnumerator ApplyCharacterTriggerModification(Trigger trigger, CharacterState affectedCharacter, FireTriggersData? fireTriggersData, ICoreGameManagers coreGameManagers)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ApplyCharacterTriggerModification>d__2(0)
		{
			<>4__this = this,
			trigger = trigger,
			affectedCharacter = affectedCharacter,
			fireTriggersData = fireTriggersData
		};
	}
}
namespace mt2_sandscourged.Plugin
{
	[HarmonyPatch(typeof(CombatManager), "ShowKillCam")]
	internal class AddUpgradeToDeadUnitsPatch
	{
		public static void Prefix(CombatManager __instance, CardManager ___cardManager)
		{
			if (CardEffectAddUpgradeToDeadUnits.consumedCards == null)
			{
				CardEffectAddUpgradeToDeadUnits.consumedCards = ___cardManager.GetExhaustedPile(true);
			}
		}
	}
	[HarmonyPatch(typeof(CombatManager), "StartCombat")]
	internal class ClearListOnStartOfBattlePatch
	{
		public static void Postfix(CombatManager __instance)
		{
			CardEffectAddUpgradeToDeadUnits.consumedCards = null;
		}
	}
	[SearchWindowPath("Card Upgrade")]
	public sealed class CardEffectAddUpgradeToDeadUnits : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardEffectState cardEffectState;

			public CardEffectParams cardEffectParams;

			public ICoreGameManagers coreGameManagers;

			public CardEffectAddUpgradeToDeadUnits <>4__this;

			public ISystemManagers sysManagers;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				CardEffectAddUpgradeToDeadUnits cardEffectAddUpgradeToDeadUnits = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				if (IEnumerableUtility.IsNullOrEmpty<CardState>(consumedCards))
				{
					Console.Write("No consumed cards found, skipping upgrade application.");
					return false;
				}
				IEnumerable<CardState> enumerable = consumedCards.Where((CardState c) => c.IsSpawnerCard());
				Console.Write(enumerable.Count() + " dead units found for upgrade application.");
				bool flag = false;
				bool flag2 = cardEffectState.GetParamInt() != 2;
				int num2 = 1;
				if (cardEffectState.GetUseStatusEffectStackMultiplier())
				{
					if ((Object)(object)cardEffectParams.selfTarget == (Object)null)
					{
						return false;
					}
					string text = cardEffectState.GetParamStatusEffectStackData().FirstOrDefault()?.statusId;
					if (text == null)
					{
						return false;
					}
					num2 = cardEffectParams.selfTarget.GetStatusEffectStacks(text);
				}
				CardUpgradeState val = default(CardUpgradeState);
				foreach (CardState item in enumerable)
				{
					for (int i = 0; i < num2; i++)
					{
						Console.Write(item.GetDebugName() + " is attempting upgrade.");
						if (CardUpgradeHelper.TryApplyUpgradeToCard(item, (CardState)null, cardEffectState.GetParamCardUpgradeData(), flag2, cardEffectParams.isFromHiddenTrigger, coreGameManagers, ref val))
						{
							Console.Write(item.GetDebugName() + $" {i}: Success!");
							item.UpdateCardBodyText((SaveManager)null);
							flag = true;
						}
					}
				}
				if (flag)
				{
					((CardEffectBase)cardEffectAddUpgradeToDeadUnits).ShowPyreNotification(cardEffectState, coreGameManagers.GetSaveManager(), (PopupNotificationManagerBase)(object)sysManagers.GetPopupNotificationManager(), (CharacterUI)null);
				}
				consumedCards = null;
				return false;
			}

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

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

		public static List<CardState>? consumedCards;

		public override bool CanPlayAfterBossDead => true;

		public override bool CanApplyInPreviewMode => false;

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_004d: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0076: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0096: Expected O, but got Unknown
			//IL_0097: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Card Upgrade", "", (Type)null, false);
			string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)0);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Upgrade Lifetime", CardUpgradeHelper.UpgradeLifetimeEditorTooltip, typeof(UnitUpgradeLifetime), false);
			string fieldName3 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)24);
			((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Use Status Effect Stack Multiplier", "", typeof(bool), false);
			string fieldName4 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)18);
			((Dictionary<string, PropDescription>)val)[fieldName4] = new PropDescription("Status Effects to multiply by", "", (Type)null, false);
			return val;
		}

		[IteratorStateMachine(typeof(<ApplyEffect>d__6))]
		public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyEffect>d__6(0)
			{
				<>4__this = this,
				cardEffectState = cardEffectState,
				cardEffectParams = cardEffectParams,
				coreGameManagers = coreGameManagers,
				sysManagers = sysManagers
			};
		}

		public override void GetTooltipsStatusList(CardEffectState cardEffectState, ref List<string> outStatusIdList)
		{
			CardEffectAddTempCardUpgradeToCardsInHand.GetTooltipsStatusList(cardEffectState.GetSourceCardEffectData(), ref outStatusIdList);
		}

		public static void GetTooltipsStatusList(CardEffectData cardEffectData, ref List<string> outStatusIdList)
		{
			foreach (StatusEffectStackData statusEffectUpgrade in cardEffectData.GetParamCardUpgradeData().GetStatusEffectUpgrades())
			{
				outStatusIdList.Add(statusEffectUpgrade.statusId);
			}
		}

		public override void CreateAdditionalTooltips(CardEffectState cardEffectState, TooltipContainer tooltipContainer, SaveManager saveManager)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			CardUpgradeState val = new CardUpgradeState();
			val.Setup(cardEffectState.GetParamCardUpgradeData(), false, false);
			tooltipContainer.AddTooltipsCardUpgrade(CardState.None, val, saveManager);
			tooltipContainer.AddTooltipsUpgradedCardTraits(val);
		}
	}
	public sealed class CardEffectPurgeCardFromHand : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ICoreGameManagers coreGameManagers;

			public CardEffectPurgeCardFromHand <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Expected O, but got Unknown
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Expected O, but got Unknown
				int num = <>1__state;
				CardEffectPurgeCardFromHand cardEffectPurgeCardFromHand = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = coreGameManagers.GetCardManager().SelectCardFromHand(new Params
					{
						descriptionKey = "PurgeCardFromHandKey",
						overrideActionKey = "PurgeCardFromHandActionKey",
						cardChosenCallback = new CardStateChosenDelegate(cardEffectPurgeCardFromHand.HandleChooseCard),
						filterCallback = new FilterCardStateDelegate(cardEffectPurgeCardFromHand.CardFilterFunc),
						instantApplyDelay = coreGameManagers.GetAllGameData().GetBalanceData().GetAnimationTimingData()
							.cardDrawAnimationDuration,
						disableIneligibleCards = true,
						selectionHandState = (CardUIState)9
					});
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

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

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

		[CompilerGenerated]
		private sealed class <HandleChooseCard>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardManager cardManager;

			public CardState chosenCard;

			public CardEffectPurgeCardFromHand <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				int num = <>1__state;
				CardEffectPurgeCardFromHand cardEffectPurgeCardFromHand = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = cardManager.PurgeCardFromHand(new DiscardCardParams
					{
						overrideDiscardEffect = (DiscardEffect)3,
						discardCard = chosenCard,
						triggeredByCard = true,
						triggeredCard = cardEffectPurgeCardFromHand.sourceCardState,
						wasPlayed = false
					}, false);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					cardManager.RefreshHandCards(true, false);
					return false;
				}
			}

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

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

		private CardState? sourceCardState;

		public override bool CanPlayAfterBossDead => false;

		public override bool CanApplyInPreviewMode => false;

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0045: Expected O, but got Unknown
			//IL_0046: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("True = whitelist the subtype. False = blacklist the subtype.", "", (Type)null, false);
			string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)9);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("All subtypes to restrict by", "", (Type)null, false);
			return val;
		}

		public override void Setup(CardEffectState cardEffectState)
		{
			((CardEffectBase)this).Setup(cardEffectState);
			sourceCardState = cardEffectState.GetParentCardState();
		}

		public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			List<CardState> hand = coreGameManagers.GetCardManager().GetHand(false);
			if (hand.Count == 0)
			{
				return false;
			}
			List<CardState> list = default(List<CardState>);
			UsingGenericPoolObject<List<CardState>> list2 = GenericPools.GetList<CardState>(ref list);
			try
			{
				foreach (CardState item in hand)
				{
					if (item != cardEffectParams.playedCard && !CardFilterFunc(item))
					{
						list.Add(item);
					}
				}
				if (list.Count == 0)
				{
					return false;
				}
				return true;
			}
			finally
			{
				((IDisposable)list2).Dispose();
			}
		}

		[IteratorStateMachine(typeof(<ApplyEffect>d__8))]
		public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyEffect>d__8(0)
			{
				<>4__this = this,
				coreGameManagers = coreGameManagers
			};
		}

		[IteratorStateMachine(typeof(<HandleChooseCard>d__9))]
		private IEnumerator HandleChooseCard(CardState chosenCard, CardManager cardManager)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HandleChooseCard>d__9(0)
			{
				<>4__this = this,
				chosenCard = chosenCard,
				cardManager = cardManager
			};
		}

		private bool CardFilterFunc(CardState cardState)
		{
			return cardState.HasTrait<CardTraitUnpurgable>();
		}
	}
	public sealed class CardEffectSubtypeRestricted : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				return false;
			}

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

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

		private SubtypeData? subtypeToRestrict;

		private bool isWhitelist;

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Expected O, but got Unknown
			//IL_002c: 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_0044: Expected O, but got Unknown
			//IL_0044: Expected O, but got Unknown
			//IL_0045: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("True = whitelist the subtype. False = blacklist the subtype.", "", (Type)null, false);
			string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)9);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("All subtypes to restrict by", "", (Type)null, false);
			return val;
		}

		public override void Setup(CardEffectState cardEffectState)
		{
			((CardEffectBase)this).Setup(cardEffectState);
			subtypeToRestrict = cardEffectState.GetParamSubtype();
			isWhitelist = cardEffectState.GetParamBool();
		}

		public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
		{
			if (subtypeToRestrict == null)
			{
				return false;
			}
			bool flag = false;
			foreach (CharacterState target in cardEffectParams.targets)
			{
				if (target.GetHasSubtype(subtypeToRestrict))
				{
					flag = true;
				}
			}
			return flag == isWhitelist;
		}

		[IteratorStateMachine(typeof(<ApplyEffect>d__5))]
		public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyEffect>d__5(0);
		}
	}
	public sealed class CardTraitDummyBlightAndJunkCount : CardTraitState
	{
		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			return new PropDescriptions();
		}

		public override string GetCurrentEffectText(CardStatistics? cardStatistics, SaveManager? saveManager, RelicManager? relicManager)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_006f: 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_0084: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)cardStatistics != (Object)null) || !cardStatistics.GetStatValueShouldDisplayOnCardNow(((CardTraitState)this).StatValueData))
			{
				return string.Empty;
			}
			StatValueData val = default(StatValueData);
			val.cardState = ((CardTraitState)this).GetCard();
			val.trackedValue = (TrackedValueType)15;
			val.cardTypeTarget = (CardTypeTarget)3;
			val.forPreviewText = false;
			StatValueData val2 = val;
			int statValue = cardStatistics.GetStatValue(val2);
			val = default(StatValueData);
			val.cardState = ((CardTraitState)this).GetCard();
			val.trackedValue = (TrackedValueType)15;
			val.cardTypeTarget = (CardTypeTarget)4;
			val.forPreviewText = false;
			StatValueData val3 = val;
			int statValue2 = cardStatistics.GetStatValue(val3);
			return string.Format(LocalizationExtensions.Localize("CardTraitScalingAddStatusEffect_CurrentScaling_CardText", (ILocalizationParameterContext)null), (statValue + statValue2) * ((CardTraitState)this).GetParamInt());
		}
	}
	public sealed class CardTraitScalingAddBattleCardToHandFromPool : CardTraitState
	{
		[CompilerGenerated]
		private sealed class <OnCardPlayed>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardTraitScalingAddBattleCardToHandFromPool <>4__this;

			public ICoreGameManagers coreGameManagers;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Expected O, but got Unknown
				int num = <>1__state;
				CardTraitScalingAddBattleCardToHandFromPool cardTraitScalingAddBattleCardToHandFromPool = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				int additionalCards = cardTraitScalingAddBattleCardToHandFromPool.GetAdditionalCards(coreGameManagers.GetCardStatistics());
				CardManager cardManager = coreGameManagers.GetCardManager();
				int num2 = additionalCards;
				int num3 = cardManager.GetMaxHandSize() - cardManager.GetNumCardsInHand();
				if (num3 > 0)
				{
					num2 = Mathf.Min(num2, num3);
				}
				AddCardUpgradingInfo val = null;
				CardUpgradeData cardUpgradeDataParam = ((CardTraitState)cardTraitScalingAddBattleCardToHandFromPool).GetCardUpgradeDataParam();
				if ((Object)(object)cardUpgradeDataParam != (Object)null)
				{
					val = new AddCardUpgradingInfo();
					val.upgradeDatas.Add(cardUpgradeDataParam);
					val.tempCardUpgrade = true;
					val.upgradingCardSource = ((CardTraitState)cardTraitScalingAddBattleCardToHandFromPool).GetCard();
					val.ignoreTempUpgrades = false;
					val.copyModifiersFromCard = ((CardTraitState)cardTraitScalingAddBattleCardToHandFromPool).GetCard();
				}
				List<CardData> list = default(List<CardData>);
				UsingGenericPoolObject<List<CardData>> list2 = GenericPools.GetList<CardData>(ref list);
				try
				{
					int num4 = 0;
					while (true)
					{
						int num5 = num4;
						CardPool? paramCardPool = CardTraitScalingAddBattleCardToHandFromPool.paramCardPool;
						if (!(num5 < ((paramCardPool != null) ? new int?(paramCardPool.GetNumCards()) : null)))
						{
							break;
						}
						CardData cardAtIndex = CardTraitScalingAddBattleCardToHandFromPool.paramCardPool.GetCardAtIndex(num4);
						list.Add(cardAtIndex);
						num4++;
					}
					for (int i = 0; i < num2; i++)
					{
						int index = RandomManager.Range(0, list.Count, (RngId)6);
						CardData val2 = list[index];
						cardManager.AddCard(val2, (CardPile)3, i, num2, false, false, val, true, 1f);
					}
				}
				finally
				{
					((IDisposable)list2).Dispose();
				}
				return false;
			}

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

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

		public static CardPool? paramCardPool;

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			return new PropDescriptions();
		}

		[IteratorStateMachine(typeof(<OnCardPlayed>d__2))]
		public override IEnumerator OnCardPlayed(CardState thisCard, ICoreGameManagers coreGameManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnCardPlayed>d__2(0)
			{
				<>4__this = this,
				coreGameManagers = coreGameManagers
			};
		}

		private int GetAdditionalCards(CardStatistics cardStatistics)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			StatValueData val = default(StatValueData);
			val.cardState = ((CardTraitState)this).GetCard();
			val.trackedValue = ((CardTraitState)this).GetParamTrackedValue();
			val.entryDuration = ((CardTraitState)this).GetParamEntryDuration();
			val.cardTypeTarget = ((CardTraitState)this).GetParamCardType();
			val.paramSubtype = ((CardTraitState)this).GetParamSubtype();
			val.forPreviewText = false;
			StatValueData val2 = val;
			int statValue = cardStatistics.GetStatValue(val2);
			return ((CardTraitState)this).GetParamInt() * statValue;
		}
	}
	public sealed class CardTraitScalingByHandCount : CardTraitState
	{
		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0043: Expected O, but got Unknown
			//IL_0044: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Multiplier per card in hand", "", (Type)null, false);
			string fieldName2 = CardTraitFieldNamesHelper.GetFieldName((CardTraitFieldNames)2);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Divider per card in hand", "", (Type)null, false);
			return val;
		}

		public override void OnApplyingCardUpgradeToUnit(CardState thisCard, CharacterState targetUnit, CardUpgradeState upgradeState, ICoreGameManagers coreGameManagers)
		{
			CardState thisCard2 = thisCard;
			((CardTraitState)this).OnApplyingCardUpgradeToUnit(thisCard2, targetUnit, upgradeState, coreGameManagers);
			int num = IEnumerableUtility.Count<CardState>(coreGameManagers.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState c) => c != thisCard2));
			upgradeState.SetAttackDamage(((CardTraitState)this).GetParamInt() * num);
			upgradeState.SetAdditionalHP(((CardTraitState)this).GetParamInt2() * num);
		}

		public override int OnApplyingDamage(ApplyingDamageParameters damageParams, ICoreGameManagers coreGameManagers)
		{
			return coreGameManagers.GetCardManager().GetHand(false).Count() * ((CardTraitState)this).GetParamInt() / ((CardTraitState)this).GetParamInt2();
		}

		public override int OnStatusEffectApplied(CharacterState affectedCharacter, CardState thisCard, ICoreGameManagers coreGameManagers, string statusId, int sourceStacks = 0)
		{
			CardState thisCard2 = thisCard;
			int num = IEnumerableUtility.Count<CardState>(coreGameManagers.GetCardManager().GetHand(false), (Func<CardState, bool>)((CardState c) => c != thisCard2));
			return sourceStacks * (num * ((CardTraitState)this).GetParamInt() / ((CardTraitState)this).GetParamInt2()) - sourceStacks;
		}
	}
	public class CardTraitStatusEffectUpgradeMultiplier : CardTraitState
	{
		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Status to multiply by.", "", (Type)null, false);
			return val;
		}

		public override void OnApplyingCardUpgradeToUnit(CardState thisCard, CharacterState targetUnit, CardUpgradeState upgradeState, ICoreGameManagers coreGameManagers)
		{
			((CardTraitState)this).OnApplyingCardUpgradeToUnit(thisCard, targetUnit, upgradeState, coreGameManagers);
			string statusId = ((CardTraitState)this).GetParamStatusEffects().First().statusId;
			int statusEffectStacks = targetUnit.GetStatusEffectStacks(statusId);
			upgradeState.SetAttackDamage(upgradeState.GetAttackDamage() * statusEffectStacks);
			upgradeState.SetAdditionalHP(upgradeState.GetAdditionalHP() * statusEffectStacks);
		}
	}
	public interface IOnOtherStatusEffectAdded
	{
		int OnOtherStatusEffectBeingAdded(int myStacks, string statusId, int numStacks);
	}
	public sealed class RelicEffectApplyStatusEffectOnCardEarlyDiscard : RelicEffectBase, IOnDiscardRelicEffect, IRelicEffect, IStatusEffectRelicEffect
	{
		[CompilerGenerated]
		private sealed class <ApplyEffectOnCardDiscarded>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RelicEffectApplyStatusEffectOnCardEarlyDiscard <>4__this;

			public CardDiscardedRelicEffectParams relicEffectParams;

			public ICoreGameManagers coreGameManagers;

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

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

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

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

			private bool MoveNext()
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: 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_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				RelicEffectApplyStatusEffectOnCardEarlyDiscard relicEffectApplyStatusEffectOnCardEarlyDiscard = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				((RelicEffectBase)relicEffectApplyStatusEffectOnCardEarlyDiscard).NotifyRelicTriggered(((RelicEffectParams)relicEffectParams).relicManager, (CharacterUI)null, "", false, 0f);
				int currentSelectedRoom = coreGameManagers.GetRoomManager().CurrentSelectedRoom;
				CollectTargetsData val = default(CollectTargetsData);
				val.targetTeamType = relicEffectApplyStatusEffectOnCardEarlyDiscard.sourceTeam;
				val.targetMode = relicEffectApplyStatusEffectOnCardEarlyDiscard.targetMode;
				val.roomIndex = currentSelectedRoom;
				val.inCombat = false;
				val.isTesting = coreGameManagers.GetSaveManager().PreviewMode;
				CollectTargetsData val2 = val;
				List<CharacterState> list = new List<CharacterState>();
				UsingGenericPoolObject<List<CharacterState>> list2 = GenericPools.GetList<CharacterState>(ref list);
				try
				{
					TargetHelper.CollectTargets(val2, coreGameManagers, ref list);
					foreach (CharacterState item in list)
					{
						StatusEffectStackData[] statusEffectsToApply = relicEffectApplyStatusEffectOnCardEarlyDiscard.statusEffectsToApply;
						foreach (StatusEffectStackData val3 in statusEffectsToApply)
						{
							item.AddStatusEffect(val3.statusId, val3.count, relicEffectApplyStatusEffectOnCardEarlyDiscard.addStatusEffectParams, (CharacterState)null, true, false, true, false);
						}
					}
				}
				finally
				{
					((IDisposable)list2).Dispose();
				}
				((CollectTargetsData)(ref val2)).Reset((TargetMode)0);
				return false;
			}

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

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

		private Type sourceTeam;

		private TargetMode targetMode;

		private StatusEffectStackData[] statusEffectsToApply = Array.Empty<StatusEffectStackData>();

		private readonly AddStatusEffectParams addStatusEffectParams = new AddStatusEffectParams();

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Expected O, but got Unknown
			//IL_002c: 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_0044: Expected O, but got Unknown
			//IL_0044: Expected O, but got Unknown
			//IL_004c: 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_0064: Expected O, but got Unknown
			//IL_0064: Expected O, but got Unknown
			//IL_0065: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Target Team", "", (Type)null, false);
			string fieldName2 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)15);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Target Mode", "", (Type)null, false);
			string fieldName3 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)26);
			((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Status Effects to apply", "", (Type)null, false);
			return val;
		}

		public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData);
			sourceTeam = relicEffectData.GetParamSourceTeam();
			targetMode = relicEffectData.GetTargetMode();
			statusEffectsToApply = relicEffectData.GetParamStatusEffects();
			addStatusEffectParams.sourceRelicState = ((RelicEffectBase)this).SourceRelicState;
		}

		public bool TestEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
		{
			return relicEffectParams.discardCardParams.triggeredByCard;
		}

		[IteratorStateMachine(typeof(<ApplyEffectOnCardDiscarded>d__7))]
		public IEnumerator ApplyEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyEffectOnCardDiscarded>d__7(0)
			{
				<>4__this = this,
				relicEffectParams = relicEffectParams,
				coreGameManagers = coreGameManagers
			};
		}

		public StatusEffectStackData[]? GetStatusEffects()
		{
			return statusEffectsToApply;
		}
	}
	public sealed class RelicEffectCustomAddUpgrade : RelicEffectBase, ICardModifierRelicEffect, IRelicEffect, IStatusEffectRelicEffect
	{
		[CompilerGenerated]
		private sealed class <OnCharacterAdded>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ICoreGameManagers coreGameManagers;

			public RelicEffectCustomAddUpgrade <>4__this;

			public CharacterState characterState;

			public CardState fromCard;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Expected O, but got Unknown
				int num = <>1__state;
				RelicEffectCustomAddUpgrade relicEffectCustomAddUpgrade = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					RelicManager relicManager = coreGameManagers.GetRelicManager();
					if (!((Object)(object)relicEffectCustomAddUpgrade._cardUpgradeData != (Object)null) || !((Enum)relicEffectCustomAddUpgrade._sourceTeam).HasFlag((Enum)(object)characterState.GetTeamType()) || !characterState.HasStatusEffect("cardless") || characterState.GetIsClone())
					{
						break;
					}
					if (!relicEffectCustomAddUpgrade._applyToCardlessSpawns)
					{
						return false;
					}
					foreach (CardUpgradeMaskData filter in relicEffectCustomAddUpgrade._cardUpgradeData.GetFilters())
					{
						if (!filter.FilterCard<CardState>(fromCard, relicManager))
						{
							return false;
						}
						if (!filter.FilterCharacter(characterState, relicManager))
						{
							return false;
						}
					}
					if (relicEffectCustomAddUpgrade._cardUpgradeData.IsUnique() && fromCard != null && (fromCard.GetCardStateModifiers().HasUpgrade(((GameData)relicEffectCustomAddUpgrade._cardUpgradeData).GetID()) || fromCard.GetTemporaryCardStateModifiers().HasUpgrade(((GameData)relicEffectCustomAddUpgrade._cardUpgradeData).GetID())))
					{
						return false;
					}
					CardUpgradeState val = new CardUpgradeState();
					val.Setup(relicEffectCustomAddUpgrade._cardUpgradeData, false, false);
					<>2__current = characterState.ApplyCardUpgrade(val, false, "", true, false, (CardState)null, (Action<UpgradeApplicationResult>)null, (TrainRoomAttachmentState)null, false);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					break;
				}
				return false;
			}

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

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

		private Type _sourceTeam;

		private CardUpgradeData? _cardUpgradeData;

		private bool _applyToCardlessSpawns;

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Expected O, but got Unknown
			//IL_002c: 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_0044: Expected O, but got Unknown
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0063: Expected O, but got Unknown
			//IL_0064: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Source Team", "", (Type)null, false);
			string fieldName2 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)19);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Upgrade", "", (Type)null, false);
			string fieldName3 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)8);
			((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Apply to Cardless Spawns", "", (Type)null, false);
			return val;
		}

		public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData);
			_sourceTeam = relicEffectData.GetParamSourceTeam();
			_cardUpgradeData = relicEffectData.GetParamCardUpgradeData();
			_applyToCardlessSpawns = relicEffectData.GetParamBool();
		}

		public bool ApplyCardStateModifiers(CardState cardState, RelicManager relicManager, SaveManager saveManager, CardManager? cardManager)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			bool result = false;
			if ((Object)(object)_cardUpgradeData != (Object)null && ((Enum)_sourceTeam).HasFlag((Enum)(object)(Type)2))
			{
				foreach (CardUpgradeMaskData filter in _cardUpgradeData.GetFilters())
				{
					if (!filter.FilterCard<CardState>(cardState, relicManager))
					{
						return false;
					}
				}
				CardUpgradeState val = new CardUpgradeState();
				val.Setup(_cardUpgradeData, false, false);
				if (cardState.GetUpgradeData() == null)
				{
					return false;
				}
				if (val.IsUnique() && cardState.GetCardStateModifiers().HasUpgrade(((GameData)_cardUpgradeData).GetID()))
				{
					return false;
				}
				cardState.ApplyPermanentUpgrade(val, saveManager, true, (string)null);
				cardState.UpdateCardBodyText((SaveManager)null);
				if ((Object)(object)cardManager != (Object)null)
				{
					cardManager.RefreshCardInHand(cardState, true, false, false);
				}
				return true;
			}
			return result;
		}

		[IteratorStateMachine(typeof(<OnCharacterAdded>d__3))]
		public override IEnumerator OnCharacterAdded(CharacterState characterState, CardState fromCard, ICoreGameManagers coreGameManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnCharacterAdded>d__3(0)
			{
				<>4__this = this,
				characterState = characterState,
				fromCard = fromCard,
				coreGameManagers = coreGameManagers
			};
		}

		public bool GetTooltip(out string title, out string body)
		{
			title = string.Empty;
			body = string.Empty;
			return false;
		}

		public StatusEffectStackData[]? GetStatusEffects()
		{
			if ((Object)(object)_cardUpgradeData != (Object)null)
			{
				return _cardUpgradeData.GetStatusEffectUpgrades().ToArray();
			}
			return null;
		}
	}
	public sealed class RelicEffectDrawOnCardEarlyDiscard : RelicEffectBase, IOnDiscardRelicEffect, IRelicEffect
	{
		[CompilerGenerated]
		private sealed class <ApplyEffectOnCardDiscarded>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RelicEffectDrawOnCardEarlyDiscard <>4__this;

			public CardDiscardedRelicEffectParams relicEffectParams;

			public ICoreGameManagers coreGameManagers;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				RelicEffectDrawOnCardEarlyDiscard relicEffectDrawOnCardEarlyDiscard = <>4__this;
				if (num != 0)
				{
					return false;
				}
				<>1__state = -1;
				((RelicEffectBase)relicEffectDrawOnCardEarlyDiscard).NotifyRelicTriggered(((RelicEffectParams)relicEffectParams).relicManager, (CharacterUI)null, "", false, 0f);
				coreGameManagers.GetCardManager().DrawCards(relicEffectDrawOnCardEarlyDiscard._cardsToDraw, (CardState)null, (CardType)4, -1);
				return false;
			}

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

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

		private int _cardsToDraw;

		public override PropDescriptions CreateEditorInspectorDescriptions()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Num cards to draw", "", (Type)null, false);
			return val;
		}

		public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData)
		{
			((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData);
			_cardsToDraw = relicEffectData.GetParamInt();
		}

		public bool TestEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
		{
			return relicEffectParams.discardCardParams.triggeredByCard;
		}

		[IteratorStateMachine(typeof(<ApplyEffectOnCardDiscarded>d__4))]
		public IEnumerator ApplyEffectOnCardDiscarded(CardDiscardedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyEffectOnCardDiscarded>d__4(0)
			{
				<>4__this = this,
				relicEffectParams = relicEffectParams,
				coreGameManagers = coreGameManagers
			};
		}
	}
	[HarmonyPatch(typeof(CharacterState), "AddStatusEffect", new Type[]
	{
		typeof(string),
		typeof(int),
		typeof(AddStatusEffectParams),
		typeof(CharacterState),
		typeof(bool),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class CharacterState_AddStatusEffect_SelfPropagatingStatusEffectImplementationPatch
	{
		private static readonly MethodInfo ModifyStatusCountByOtherStatusMethod = typeof(CharacterState_AddStatusEffect_SelfPropagatingStatusEffectImplementationPatch).GetMethod("ModifyStatusCountByOtherStatus", BindingFlags.Static | BindingFlags.Public);

		private static readonly MethodInfo GetRoomStateModifiedStatusEffectCount = typeof(RoomState).GetMethod("GetRoomStateModifiedStatusEffectCount");

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = -1;
			for (int i = 0; i < list.Count - 1; i++)
			{
				if (CodeInstructionExtensions.Calls(list[i], GetRoomStateModifiedStatusEffectCount))
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				Plugin.Logger.LogError((object)"Expected to find GetRoomStateModifiedStatusEffectCount, but did not. Patch needs to be redone.");
				return instructions;
			}
			if (!(list[num + 1].opcode == OpCodes.Add) || !(list[num + 2].opcode == OpCodes.Starg_S))
			{
				Plugin.Logger.LogError((object)"Expected to find the numStacks + result of GetRoomStateModifiedStatusEffectCount operations, but did not. Patch needs to be redone.");
				return instructions;
			}
			List<CodeInstruction> collection = new List<CodeInstruction>(6)
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Ldarg_2, (object)null),
				new CodeInstruction(OpCodes.Ldarg_S, (object)5),
				new CodeInstruction(OpCodes.Call, (object)ModifyStatusCountByOtherStatusMethod),
				new CodeInstruction(OpCodes.Starg_S, (object)2)
			};
			list.InsertRange(num + 3, collection);
			return list;
		}

		public static int ModifyStatusCountByOtherStatus(CharacterState character, string statusId, int numStacks, bool allowModification)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (!allowModification)
			{
				return numStacks;
			}
			int num = numStacks;
			List<StatusEffectStack> list = default(List<StatusEffectStack>);
			UsingGenericPoolObject<List<StatusEffectStack>> list2 = GenericPools.GetList<StatusEffectStack>(ref list);
			try
			{
				character.GetStatusEffects(ref list, false);
				foreach (StatusEffectStack item in list)
				{
					if (item.State is IOnOtherStatusEffectAdded onOtherStatusEffectAdded)
					{
						num = onOtherStatusEffectAdded.OnOtherStatusEffectBeingAdded(item.Count, statusId, num);
					}
				}
				return num;
			}
			finally
			{
				((IDisposable)list2).Dispose();
			}
		}
	}
	internal class StatusEffectHexState : StatusEffectState, IOnOtherStatusEffectAdded
	{
		public const string StatusId = "hex";

		public int OnOtherStatusEffectBeingAdded(int myStacks, string statusId, int numStacks)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			if (statusId == "hex")
			{
				return numStacks;
			}
			StatusEffectData statusEffectDataById = StatusEffectManager.Instance.GetStatusEffectDataById(statusId, true);
			if (statusEffectDataById == null)
			{
				return numStacks;
			}
			if (statusEffectDataById.IsPropagatable() && (int)statusEffectDataById.GetDisplayCategory() == 1)
			{
				return numStacks + myStacks;
			}
			return numStacks;
		}
	}
	internal class StatusEffectScourgeState : StatusEffectState, IDamageStatusEffect
	{
		[CompilerGenerated]
		private sealed class <OnTriggered>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ICoreGameManagers coreGameManagers;

			public StatusEffectScourgeState <>4__this;

			public InputTriggerParams inputTriggerParams;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				StatusEffectScourgeState statusEffectScourgeState = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					CoreSignals.DamageAppliedPlaySound.Dispatch((Type)9);
					CombatManager combatManager = coreGameManagers.GetCombatManager();
					int damageAmount = statusEffectScourgeState.GetDamageAmount(statusEffectScourgeState.stacks);
					CharacterState associatedCharacter = statusEffectScourgeState.associatedCharacter;
					ApplyDamageToTargetParameters val = default(ApplyDamageToTargetParameters);
					val.damageType = (Type)0;
					StatusEffectData sourceStatusEffectData = ((StatusEffectState)statusEffectScourgeState).GetSourceStatusEffectData();
					val.affectedVfx = ((sourceStatusEffectData != null) ? sourceStatusEffectData.GetOnAffectedVFX() : null);
					val.relicState = inputTriggerParams.suppressingRelic;
					<>2__current = combatManager.ApplyDamageToTarget(damageAmount, associatedCharacter, val);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					return false;
				}
			}

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

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

		public const string StatusId = "scourge";

		private CharacterState? associatedCharacter;

		private int stacks;

		public override bool TestTrigger(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
		{
			if ((Object)(object)inputTriggerParams.associatedCharacter != (Object)null && inputTriggerParams.associatedCharacter.IsAlive)
			{
				associatedCharacter = inputTriggerParams.associatedCharacter;
			}
			else
			{
				associatedCharacter = null;
			}
			CharacterState val = associatedCharacter;
			stacks = (((Object)(object)val != (Object)null) ? val.GetStatusEffectStacks(((StatusEffectState)this).GetStatusId()) : 0);
			if (stacks > 0)
			{
				return (Object)(object)associatedCharacter != (Object)null;
			}
			return false;
		}

		[IteratorStateMachine(typeof(<OnTriggered>d__1))]
		protected override IEnumerator OnTriggered(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnTriggered>d__1(0)
			{
				<>4__this = this,
				inputTriggerParams = inputTriggerParams,
				coreGameManagers = coreGameManagers
			};
		}

		public override int GetEffectMagnitude(int stacks = 1)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			return (((StatusEffectState)this).GetParamInt() + base.relicManager.GetModifiedStatusMagnitudePerStack("mt2_sandscourged.plugin_scourge", ((StatusEffectState)this).GetAssociatedCharacter().GetTeamType())) * stacks;
		}

		private int GetDamageAmount(int stacks)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			List<StatusEffectStack> source = new List<StatusEffectStack>();
			UsingGenericPoolObject<List<StatusEffectStack>> list = GenericPools.GetList<StatusEffectStack>(ref source);
			try
			{
				((StatusEffectState)this).GetAssociatedCharacter().GetStatusEffects(ref source, false);
				num = source.Where((StatusEffectStack s) => (int)s.State.GetDisplayCategory() == 1).Count();
			}
			finally
			{
				((IDisposable)list).Dispose();
			}
			return (((StatusEffectState)this).GetParamInt() + base.relicManager.GetModifiedStatusMagnitudePerStack("mt2_sandscourged.plugin_scourge", ((StatusEffectState)this).GetAssociatedCharacter().GetTeamType())) * num * stacks;
		}
	}
	[BepInPlugin("mt2_sandscourged.Plugin", "mt2_sandscourged.Plugin", "0.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger = new ManualLogSource("mt2_sandscourged.Plugin");

		public void Awake()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Railhead.GetBuilder().Configure("mt2_sandscourged.Plugin", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
			{
				ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(67)
				{
					"json/plugin.json", "json/global.json", "json/class.json", "json/champions/champion_Pharaoh.json", "json/champions/champion_Vizier.json", "json/units/unit_OverseerEternal.json", "json/units/unit_ReveredScarab.json", "json/units/unit_GildedScarab.json", "json/units/unit_CursedScarab.json", "json/units/unit_ScarabSwarm.json",
					"json/units/unit_Wretch.json", "json/units/unit_PearlHost.json", "json/units/unit_SphinxHierarch.json", "json/units/unit_TwistedHusk.json", "json/units/unit_ForgottenHulk.json", "json/units/unit_PriestOfLostThoughts.json", "json/units/unit_Revenant.json", "json/units/unit_SuperiorEgo.json", "json/units/unit_Evermaw.json", "json/spells/card_Pitfall.json",
					"json/spells/card_OblivionSands.json", "json/spells/card_Sandstorm.json", "json/spells/card_Rancor.json", "json/spells/card_InMemoriam.json", "json/spells/card_TormentA.json", "json/spells/card_TormentB.json", "json/spells/card_TormentC.json", "json/spells/card_TormentD.json", "json/spells/card_TormentE.json", "json/spells/card_Dessicate.json",
					"json/spells/card_Efface.json", "json/spells/card_Hex.json", "json/spells/card_Jinx.json", "json/spells/card_Malediction.json", "json/spells/card_SpikeOfTheScourged.json", "json/spells/card_Idolize.json", "json/spells/card_Expose.json", "json/spells/card_PartTheStorm.json", "json/spells/card_GravenRite.json", "json/spells/card_ForgottenTome.json",
					"json/spells/card_SelectiveMemory.json", "json/spells/card_PainfulMemories.json", "json/equipments/equipment_ScryingEye.json", "json/equipments/equipment_PearlTap.json", "json/equipments/equipment_SpearOfTheDeserted.json", "json/equipments/equipment_CorruptedSceptre.json", "json/rooms/room_OblivionChamber.json", "json/rooms/room_ScarabPit.json", "json/blights/card_PlagueOfScarabs.json", "json/blights/card_PlagueOfBlood.json",
					"json/blights/card_PlagueOfGnarling.json", "json/scourges/card_Vexation.json", "json/relics/relic_WornHourglass.json", "json/relics/relic_CarnelianMask.json", "json/relics/relic_CursedTablet.json", "json/relics/relic_BrokenSeal.json", "json/relics/relic_EvokingFlute.json", "json/relics/relic_OblivionCrook.json", "json/relics/relic_ShiningPearl.json", "json/relics/relic_TwistedReed.json",
					"json/relics/relic_CanopicJar.json", "json/relics/relic_PolishedIdol.json", "json/relics/relic_SandBowl.json", "json/enhancers/enhancer_Scarabstone.json", "json/status_effects/hex.json", "json/status_effects/scourge.json", "json/card_effects/PurgeCardFromHand.json"
				});
			});
			Logger.LogInfo((object)"Plugin mt2_sandscourged.Plugin is loaded!");
			Railend.ConfigurePostAction((Action<Container>)delegate(Container c)
			{
				IRegister<CardPool> instance = c.GetInstance<IRegister<CardPool>>();
				string id = StringExtensions.GetId("mt2_sandscourged.Plugin", "CardPool", "TormentPool");
				CardTraitScalingAddBattleCardToHandFromPool.paramCardPool = IEnumerableUtility.GetValueOrDefault<string, CardPool>((IDictionary<string, CardPool>)instance, id, (CardPool)null);
			});
			new Harmony("mt2_sandscourged.Plugin").PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "mt2_sandscourged.Plugin";

		public const string PLUGIN_NAME = "mt2_sandscourged.Plugin";

		public const string PLUGIN_VERSION = "0.2.0";
	}
}