Decompiled source of Steward Clan v0.3.0

plugins/StewardClan.Plugin.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using StewardClan.Plugin;
using Steward_Clan.Plugin.Patches;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Extensions;
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("StewardClan.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0+3745f02d3e1f3e5ca30ba87b7c31366dab9f16e9")]
[assembly: AssemblyProduct("StewardClan.Plugin")]
[assembly: AssemblyTitle("StewardClan.Plugin")]
[assembly: AssemblyVersion("0.3.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;
		}
	}
}
namespace StewardClan.Plugin
{
	public sealed class RelicEffectAddStatusEffectOnPyreDamage : RelicEffectBase, IStatusEffectRelicEffect, ITowerDamageTakenModifiedRelicEffect, IRelicEffect
	{
		private StatusEffectStackData[] statusEffects = Array.Empty<StatusEffectStackData>();

		private List<CharacterState> damageTargets = new List<CharacterState>();

		private CollectTargetsData targetsData;

		private Type sourceTeam;

		private AddStatusEffectParams addStatusEffectParams = new AddStatusEffectParams();

		public override bool CanApplyInPreviewMode => true;

		public Currency Currency { get; private set; }

		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_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 Mode", "", (Type)null, false);
			string fieldName2 = RelicEffectFieldNamesHelper.GetFieldName((RelicEffectFieldNames)0);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Target Team", "", (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 srcRelicData, 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			((RelicEffectBase)this).Initialize(relicState, srcRelicData, relicEffectData);
			sourceTeam = relicEffectData.GetParamSourceTeam();
			Currency = (Currency)0;
			addStatusEffectParams.sourceRelicState = ((RelicEffectBase)this).SourceRelicState;
			statusEffects = relicEffectData.GetParamStatusEffects();
			targetsData.targetTeamType = sourceTeam;
			targetsData.ignorePyre = true;
			targetsData.inCombat = false;
			((CollectTargetsData)(ref targetsData)).Reset(relicEffectData.GetTargetMode());
		}

		public int ApplyModifiedDamage(int previousDamage, RelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (previousDamage <= 0)
			{
				return previousDamage;
			}
			TargetHelper.CollectTargets(targetsData, coreGameManagers, ref damageTargets);
			foreach (CharacterState damageTarget in damageTargets)
			{
				StatusEffectStackData[] array = statusEffects;
				foreach (StatusEffectStackData val in array)
				{
					int count = val.count;
					damageTarget.AddStatusEffect(val.statusId, count, addStatusEffectParams, (CharacterState)null, true, false, true);
				}
			}
			return previousDamage;
		}

		public StatusEffectStackData[]? GetStatusEffects()
		{
			return statusEffects;
		}
	}
	public sealed class RelicEffectArmorOnCore : RelicEffectBase, IStatusEffectRelicEffect
	{
		private StatusEffectStackData[] statusEffects = Array.Empty<StatusEffectStackData>();

		private AddStatusEffectParams addStatusEffectParams = new AddStatusEffectParams();

		public override bool CanApplyInPreviewMode => true;

		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 void Initialize(RelicState relicState, RelicData srcRelicData, RelicEffectData relicEffectData)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			((RelicEffectBase)this).Initialize(relicState, srcRelicData, relicEffectData);
			addStatusEffectParams.sourceRelicState = ((RelicEffectBase)this).SourceRelicState;
			statusEffects = (StatusEffectStackData[])(object)new StatusEffectStackData[1]
			{
				new StatusEffectStackData
				{
					statusId = "armor",
					count = 1
				}
			};
		}

		public StatusEffectStackData[]? GetStatusEffects()
		{
			return statusEffects;
		}
	}
}
namespace Steward_Clan.Plugin
{
	public class CardEffectAddChampionCopy : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ICoreGameManagers coreGameManagers;

			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()
			{
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Expected O, but got Unknown
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				SaveManager saveManager = coreGameManagers.GetSaveManager();
				CardManager cardManager = coreGameManagers.GetCardManager();
				List<CardState> list = new List<CardState>();
				list = cardManager.GetAllCards(list);
				foreach (CardState item in list)
				{
					if (item.GetCardDataID() == ((GameData)saveManager.GetMainChampionData().championCardData).GetID())
					{
						AddCardUpgradingInfo val = new AddCardUpgradingInfo
						{
							upgradeDatas = new List<CardUpgradeData>(),
							copyModifiersFromCard = item
						};
						CardState val2 = coreGameManagers.GetCardManager().AddCard(saveManager.GetMainChampionData().championCardData, (CardPile)3, 1, 1, false, false, val, true, 1f);
						if (val2 != null)
						{
							val2.UpdateDamageText();
							val2.UpdateCardBodyText((SaveManager)null);
						}
						return 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();
			}
		}

		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_0006: Expected O, but got Unknown
			return new PropDescriptions();
		}

		public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
		{
			return ((CardEffectBase)this).TestEffect(cardEffectState, cardEffectParams, coreGameManagers);
		}

		[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)
			{
				coreGameManagers = coreGameManagers
			};
		}
	}
	public sealed class CardEffectCopyEquipment : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardEffectParams cardEffectParams;

			public ICoreGameManagers coreGameManagers;

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

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

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

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

			private bool MoveNext()
			{
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Expected O, but got Unknown
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				if (cardEffectParams.targets.Count == 0)
				{
					return false;
				}
				CharacterState val = cardEffectParams.targets[0];
				if ((Object)(object)val == (Object)null)
				{
					return false;
				}
				CardState val2 = val.GetEquipment().LastOrDefault();
				if (val2 == null)
				{
					return false;
				}
				string cardDataID = val2.GetCardDataID();
				CardData val3 = coreGameManagers.GetAllGameData().FindCardData(cardDataID);
				if ((Object)(object)val3 == (Object)null)
				{
					return false;
				}
				AddCardUpgradingInfo val4 = new AddCardUpgradingInfo
				{
					upgradeDatas = new List<CardUpgradeData>(),
					copyModifiersFromCard = val2
				};
				CardState val5 = coreGameManagers.GetCardManager().AddCard(val3, (CardPile)0, 1, 1, false, false, val4, true, 1f);
				if (val5 != null)
				{
					val5.UpdateDamageText();
					val5.UpdateCardBodyText((SaveManager)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 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_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("Duplication Filter", "", (Type)null, false);
			string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)0);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Num Copies", "If -1, copy all equipment", (Type)null, false);
			return val;
		}

		private bool CardFilterFunc(CardState checkCard, CardUpgradeMaskData mask, RelicManager relicManager)
		{
			if ((Object)(object)mask != (Object)null)
			{
				if (mask.FilterCard<CardState>(checkCard, relicManager) && !checkCard.IsChampionCard())
				{
					return !checkCard.CanBeCopied();
				}
				return true;
			}
			if (!checkCard.IsChampionCard())
			{
				return !checkCard.CanBeCopied();
			}
			return true;
		}

		public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
		{
			if (cardEffectParams.targets.Count == 0)
			{
				return false;
			}
			CharacterState val = cardEffectParams.targets[0];
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			CardState val2 = val.GetEquipment().LastOrDefault();
			if (val2 == null)
			{
				return false;
			}
			return !CardFilterFunc(val2, cardEffectState.GetParamCardFilter(), coreGameManagers.GetRelicManager());
		}

		[IteratorStateMachine(typeof(<ApplyEffect>d__3))]
		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__3(0)
			{
				cardEffectParams = cardEffectParams,
				coreGameManagers = coreGameManagers
			};
		}
	}
	public class CardEffectDamagePyre : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ICoreGameManagers coreGameManagers;

			public CardEffectDamagePyre <>4__this;

			public CardEffectState cardEffectState;

			public CardEffectParams cardEffectParams;

			private CombatManager <combatManager>5__2;

			private int <damageAmount>5__3;

			private int <soundGateId>5__4;

			private int <i>5__5;

			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()
			{
				<combatManager>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				CardEffectDamagePyre cardEffectDamagePyre = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<combatManager>5__2 = coreGameManagers.GetCombatManager();
					RandomManager.GetState((RngId)6);
					<damageAmount>5__3 = cardEffectDamagePyre.GetDamageAmount(cardEffectState, cardEffectParams.selfTarget);
					<soundGateId>5__4 = SoundManager.INVALID_SOUND_GATE;
					if ((int)cardEffectState.GetTargetMode() == 0)
					{
						<soundGateId>5__4 = <combatManager>5__2.IgnoreDuplicateSounds(true);
					}
					<i>5__5 = 0;
					break;
				case 1:
					<>1__state = -1;
					<i>5__5++;
					break;
				}
				if (<i>5__5 < cardEffectParams.targets.Count)
				{
					CharacterState val = cardEffectParams.targets[<i>5__5];
					<>2__current = <combatManager>5__2.ApplyDamageToTarget(<damageAmount>5__3, val, new ApplyDamageToTargetParameters
					{
						playedCard = cardEffectParams.playedCard,
						finalEffectInSequence = cardEffectParams.finalEffectInSequence,
						relicState = cardEffectParams.sourceRelic,
						selfTarget = cardEffectParams.selfTarget,
						appliedVfx = cardEffectState.GetAppliedVFX(),
						appliedVfxId = cardEffectParams.appliedVfxId
					});
					<>1__state = 1;
					return true;
				}
				<combatManager>5__2.ReleaseIgnoreDuplicateCuesHandle(<soundGateId>5__4);
				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 bool canApplyInPreviewMode;

		public override bool CanApplyInPreviewMode => canApplyInPreviewMode;

		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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0082: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00a3: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00c5: Expected O, but got Unknown
			//IL_00c6: Expected O, but got Unknown
			PropDescriptions val = new PropDescriptions { };
			string fieldName;
			((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Damage Amount", "", (Type)null, false);
			string fieldName2 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)21);
			((Dictionary<string, PropDescription>)val)[fieldName2] = new PropDescription("Use Range For Damage Amount", "", (Type)null, false);
			string fieldName3 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)3);
			((Dictionary<string, PropDescription>)val)[fieldName3] = new PropDescription("Min Damage Amount", "", (Type)null, false);
			string fieldName4 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)4);
			((Dictionary<string, PropDescription>)val)[fieldName4] = new PropDescription("Max Damage Amount", "", (Type)null, false);
			string fieldName5 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)5);
			((Dictionary<string, PropDescription>)val)[fieldName5] = new PropDescription("Range Multiplier", "", (Type)null, false);
			string fieldName6 = CardEffectFieldNamesHelper.GetFieldName((CardEffectFieldNames)23);
			((Dictionary<string, PropDescription>)val)[fieldName6] = new PropDescription("Use Status Effect Stack Multiplier", "Multiply the damage amount by the number of this type of status effect the target has.", (Type)null, false);
			return val;
		}

		public override void Setup(CardEffectState cardEffectState)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			((CardEffectBase)this).Setup(cardEffectState);
			canApplyInPreviewMode = (int)cardEffectState.GetTargetMode() != 21;
		}

		public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			int intInRange = cardEffectState.GetIntInRange();
			bool flag = !cardEffectState.GetUseIntRange() || cardEffectState.GetParamMaxInt() > 0;
			bool flag2 = true;
			if ((int)cardEffectState.GetTargetMode() == 12)
			{
				flag2 = cardEffectParams.targets.Count > 0;
			}
			return intInRange >= 0 && flag2 && flag;
		}

		protected int GetDamageAmount(CardEffectState cardEffectState, CharacterState? selfTarget)
		{
			return cardEffectState.GetIntInRange();
		}

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

		public override int GetEffectApplicationCount(CardEffectState cardEffectState, CardEffectParams _unused1, ICoreGameManagers coreGameManagers, ISystemManagers _unused2)
		{
			return GameEffectHelper.GetDamageEffectApplicationCount(cardEffectState, coreGameManagers);
		}

		public bool WillEffectKillTarget(CharacterState target, CardState card, CardEffectState cardEffectState, out int resultantDamage)
		{
			int damageAmount = GetDamageAmount(cardEffectState, null);
			int num = default(int);
			resultantDamage = target.GetDamageToTarget(damageAmount, (CharacterState)null, card, ref num, (Type)0);
			return resultantDamage >= target.GetHP();
		}

		public override string GetHintText(CardEffectState cardEffectState, CharacterState selfTarget)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			int damageAmount = GetDamageAmount(cardEffectState, selfTarget);
			return LocalizationExtensions.Localize("CardTraitScalingAddDamage_CurrentScaling_CardText", (ILocalizationParameterContext)new LocalizedIntegers(new int[1] { damageAmount }));
		}
	}
	public sealed class CardEffectReplayLastTrigger : CardEffectBase
	{
		[CompilerGenerated]
		private sealed class <ApplyEffect>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CardEffectState cardEffectState;

			public CardEffectParams cardEffectParams;

			public ICoreGameManagers coreGameManagers;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: 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_007f: 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)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (cardEffectState != null && cardEffectParams != null && (Object)(object)cardEffectParams.selfTarget != (Object)null)
					{
						Type val = (Type)2;
						Trigger paramTrigger = cardEffectState.GetParamTrigger();
						CombatManager combatManager = coreGameManagers.GetCombatManager();
						BattleTriggers val2 = (BattleTriggers)typeof(CombatManager).GetMethod("GetBattleTriggerEffects", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(combatManager, new object[2] { val, paramTrigger });
						if (val2 == null)
						{
							return false;
						}
						BattleTriggeredCardEffects val3 = val2.battleTriggeredCardEffects.LastOrDefault();
						if (val3 == null)
						{
							return false;
						}
						<>2__current = combatManager.ApplyEffects(val3.cardEffects, cardEffectParams.selectedRoom, cardEffectParams.playedCard, false, (RelicState)null, cardEffectParams.selfTarget, cardEffectParams.dropLocation, true, (ApplyPreEffectsVfxAction)null, (ApplyEffectsAction)null, false, (CharacterState)null, (CharacterState)null, 1, (CharacterState)null, false, (CardTriggerType)2, (CharacterState)null, false);
						<>1__state = 1;
						return true;
					}
					break;
				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();
			}
		}

		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("Trigger", "", (Type)null, false);
			return val;
		}

		[IteratorStateMachine(typeof(<ApplyEffect>d__1))]
		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__1(0)
			{
				cardEffectState = cardEffectState,
				cardEffectParams = cardEffectParams,
				coreGameManagers = coreGameManagers
			};
		}

		public override bool HasRandomTarget(CardEffectState cardEffectState, CombatManager combatManager)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Type val = (Type)2;
			Trigger paramTrigger = cardEffectState.GetParamTrigger();
			return combatManager.GetAnyBattleTriggerEffectsRandom(val, paramTrigger);
		}
	}
	[BepInPlugin("StewardClan.Plugin", "StewardClan.Plugin", "0.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger = new ManualLogSource("StewardClan.Plugin");

		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Railhead.GetBuilder().Configure("StewardClan.Plugin", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
			{
				ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(41)
				{
					"plugin.json", "status.json", "champions/champion_albert.json", "relics/relic_backup_generator.json", "relics/relic_construct_core.json", "relics/relic_emergency_protocol.json", "relics/relic_maintenance_manual.json", "relics/relic_storage_locker.json", "characters/character_bigger_steward.json", "characters/character_dependabot.json",
					"characters/character_fabricator.json", "characters/character_imptern.json", "characters/character_ludo_developer.json", "characters/character_mod_forger.json", "characters/character_overheating_computer.json", "characters/character_rusted_steward.json", "characters/character_unit_tester.json", "characters/character_winged_air_conditioner.json", "characters/character_wrench_head.json", "cards/card_back_to_basic.json",
					"cards/card_breaking_point.json", "cards/card_bypass.json", "cards/card_cache.json", "cards/card_ctrl_v.json", "cards/card_decompile.json", "cards/card_disarm.json", "cards/card_galvanize.json", "cards/card_gravitas.json", "cards/card_mechanical_outrage.json", "cards/card_memory_leak.json",
					"cards/card_overclock.json", "cards/card_process_data.json", "cards/card_pyre_refactor.json", "cards/card_sanity.json", "cards/card_scrap.json", "cards/card_steamburst.json", "cards/card_steward_spike.json", "cards/card_steward_tome.json", "cards/card_synthesize.json", "cards/card_try_catch.json",
					"cards/card_writeline.json"
				});
			});
			Harmony.CreateAndPatchAll(typeof(CharacterStateApplyDamagePatch), (string)null);
			Logger.LogInfo((object)"Plugin StewardClan.Plugin is loaded!");
		}
	}
	public sealed class StatusEffectConstructState : StatusEffectState
	{
		[CompilerGenerated]
		private sealed class <OnTriggered>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ICoreGameManagers coreGameManagers;

			public InputTriggerParams inputTriggerParams;

			public StatusEffectConstructState <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//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_00b8: Expected O, but got Unknown
				int num = <>1__state;
				StatusEffectConstructState statusEffectConstructState = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					CombatManager combatManager = coreGameManagers.GetCombatManager();
					if ((Object)(object)combatManager != (Object)null && combatManager.GetTurnCount() == 0)
					{
						return false;
					}
					int statusEffectStacks = inputTriggerParams.associatedCharacter.GetStatusEffectStacks(((StatusEffectState)statusEffectConstructState).GetStatusId());
					if (statusEffectStacks <= 0)
					{
						return false;
					}
					int constructAmount = statusEffectConstructState.GetConstructAmount(statusEffectStacks);
					inputTriggerParams.associatedCharacter.BuffDamage(constructAmount, (RelicState)null, true);
					RelicEffectArmorOnCore relicEffect = ((StatusEffectState)statusEffectConstructState).relicManager.GetRelicEffect<RelicEffectArmorOnCore>();
					if (relicEffect != null)
					{
						inputTriggerParams.associatedCharacter.AddStatusEffect("armor", constructAmount, new AddStatusEffectParams
						{
							sourceRelicState = ((RelicEffectBase)relicEffect).SourceRelicState
						}, (CharacterState)null, true, false, true);
					}
					<>2__current = inputTriggerParams.associatedCharacter.BuffMaxHP(constructAmount, true, (RelicState)null);
					<>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 = "construct";

		public override int GetTriggerOrder()
		{
			return 1;
		}

		public override bool TestTrigger(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers)
		{
			CombatManager combatManager = coreGameManagers.GetCombatManager();
			if (!((Object)(object)combatManager != (Object)null) || combatManager.GetTurnCount() != 0)
			{
				return inputTriggerParams.associatedCharacter.GetStatusEffectStacks(((StatusEffectState)this).GetStatusId()) > 0;
			}
			return false;
		}

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

		public override int GetEffectMagnitude(int stacks = 1)
		{
			return GetConstructAmount(stacks);
		}

		private int GetConstructAmount(int stacks)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			return (((StatusEffectState)this).GetParamInt() + base.relicManager.GetModifiedStatusMagnitudePerStack("construct", ((StatusEffectState)this).GetAssociatedCharacter().GetTeamType())) * stacks;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "StewardClan.Plugin";

		public const string PLUGIN_NAME = "StewardClan.Plugin";

		public const string PLUGIN_VERSION = "0.3.0";
	}
}
namespace Steward_Clan.Plugin.Patches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class CharacterStateApplyDamagePatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			bool flag = false;
			for (int i = 0; i < list.Count - 1; i++)
			{
				CodeInstruction val = list[i];
				Plugin.Logger.LogInfo((object)$"Instruction {i} is {val.opcode} {val.operand}");
				if (!(val.opcode == OpCodes.Callvirt) || !(val.operand is MethodInfo methodInfo) || !(methodInfo.Name == "IsPyreHeart"))
				{
					continue;
				}
				if (!flag)
				{
					flag = true;
					continue;
				}
				CodeInstruction val2 = list[i + 1];
				if (!(val2.opcode != OpCodes.Brfalse_S) && !(val2.opcode != OpCodes.Brfalse))
				{
					Label label = (Label)val2.operand;
					List<CodeInstruction> list2 = new List<CodeInstruction>
					{
						new CodeInstruction(OpCodes.Dup, (object)null),
						new CodeInstruction(OpCodes.Brfalse_S, (object)label),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldarg_1, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CharacterStateApplyDamagePatch), "OnPyreDamage", (Type[])null, (Type[])null))
					};
					list.RemoveAt(i + 1);
					list.InsertRange(i + 1, list2);
					list.Insert(i + 1 + list2.Count, val2);
					flag = true;
					return list;
				}
			}
			Plugin.Logger.LogWarning((object)"StewardClan: Failed to find IsPyreHeart() in CharacterState.ApplyDamage");
			return list;
		}

		private static void OnPyreDamage(CharacterState character, int damage)
		{
			if ((Object)(object)character != (Object)null && damage > 0)
			{
				Plugin.Logger.LogInfo((object)$"PyreHeart took {damage} damage!");
			}
		}
	}
}