Decompiled source of EliteReworks v1.12.0

EliteReworks.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EliteReworks.SharedHooks;
using EliteReworks.Tweaks;
using EliteReworks.Tweaks.DLC1;
using EliteReworks.Tweaks.DLC2;
using EliteReworks.Tweaks.DLC2.Components;
using EliteReworks.Tweaks.T1;
using EliteReworks.Tweaks.T1.Components;
using EliteReworks.Tweaks.T2;
using EliteReworks.Tweaks.T2.Components;
using EntityStates;
using EntityStates.Gup;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Gup;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Orbs;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EliteReworks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e0896350b68be66c959af1c5dada073b304036d9")]
[assembly: AssemblyProduct("EliteReworks")]
[assembly: AssemblyTitle("EliteReworks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace EliteReworks
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.EliteReworks", "Elite Reworks", "1.12.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class EliteReworksPlugin : BaseUnityPlugin
	{
		public static BuffDef EmptyBuff = null;

		public static bool modifyStats = true;

		public static bool affixBlueEnabled = true;

		public static bool affixBlueRemoveShield = true;

		public static bool affixBlueReduceShield = false;

		public static bool affixWhiteEnabled = true;

		public static bool affixRedEnabled = true;

		public static bool affixHauntedEnabled = true;

		public static bool affixPoisonEnabled = true;

		public static bool eliteEarthEnabled = true;

		public static bool eliteVoidEnabled = true;

		public static bool affixGildedEnabled = true;

		public static bool affixBeadEnabled = true;

		public static float eliteStunDisableDuration = 1.2f;

		public static float eliteBossDamageMult = 1.6f;

		public static bool zetAspectsLoaded = false;

		private void CheckDependencies()
		{
			zetAspectsLoaded = Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetAspects");
		}

		public void Awake()
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			CheckDependencies();
			ReadConfig();
			if (affixWhiteEnabled)
			{
				AffixWhite.Setup();
			}
			if (affixBlueEnabled)
			{
				AffixBlue.Setup();
			}
			if (affixRedEnabled)
			{
				AffixRed.Setup();
			}
			if (affixHauntedEnabled)
			{
				AffixHaunted.Setup();
			}
			if (affixPoisonEnabled)
			{
				AffixPoison.Setup();
			}
			if (eliteEarthEnabled)
			{
				EliteEarth.Setup();
			}
			if (eliteVoidEnabled)
			{
				EliteVoid.Setup();
			}
			if (affixBeadEnabled)
			{
				AffixBead.Setup();
			}
			if (affixGildedEnabled)
			{
				AffixGilded.Setup();
			}
			CharacterBody.AddBuff_BuffIndex += new hook_AddBuff_BuffIndex(AddBuff.AddEliteComponents);
			GlobalEventManager.OnHitAllProcess += new hook_OnHitAllProcess(OnHitAll.TriggerOnHitAllEffects);
			HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(TakeDamage.HealthComponent_TakeDamage);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(RecalculateStats.CharacterBody_RecalculateStats);
			ModifyEliteTiers.Setup();
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EliteReworks.EliteReworks.bnk");
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			SoundBanks.Add(array);
		}

		public void ReadConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			//IL_0046: 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_0065: Expected O, but got Unknown
			//IL_0065: Expected O, but got Unknown
			//IL_007f: 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_009e: Expected O, but got Unknown
			//IL_009e: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00d7: Expected O, but got Unknown
			//IL_00f1: 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_0110: Expected O, but got Unknown
			//IL_0110: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0149: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_0182: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01bb: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_01f4: Expected O, but got Unknown
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0229: Expected O, but got Unknown
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Expected O, but got Unknown
			//IL_0262: Expected O, but got Unknown
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			//IL_029b: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_02d4: Expected O, but got Unknown
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_030d: Expected O, but got Unknown
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Expected O, but got Unknown
			//IL_0346: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Expected O, but got Unknown
			//IL_037f: Expected O, but got Unknown
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Expected O, but got Unknown
			//IL_03b8: Expected O, but got Unknown
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Expected O, but got Unknown
			//IL_03f1: Expected O, but got Unknown
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Expected O, but got Unknown
			//IL_042a: Expected O, but got Unknown
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Expected O, but got Unknown
			//IL_0463: Expected O, but got Unknown
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Expected O, but got Unknown
			//IL_0498: Expected O, but got Unknown
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Expected O, but got Unknown
			//IL_04d1: Expected O, but got Unknown
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Expected O, but got Unknown
			//IL_0506: Expected O, but got Unknown
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Expected O, but got Unknown
			//IL_053b: Expected O, but got Unknown
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Expected O, but got Unknown
			//IL_0570: Expected O, but got Unknown
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Expected O, but got Unknown
			//IL_05a5: Expected O, but got Unknown
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Expected O, but got Unknown
			//IL_05da: Expected O, but got Unknown
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Expected O, but got Unknown
			//IL_060f: Expected O, but got Unknown
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0644: Expected O, but got Unknown
			//IL_0644: Expected O, but got Unknown
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0679: Expected O, but got Unknown
			//IL_0679: Expected O, but got Unknown
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Expected O, but got Unknown
			//IL_06ae: Expected O, but got Unknown
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Expected O, but got Unknown
			//IL_06e3: Expected O, but got Unknown
			//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0718: Expected O, but got Unknown
			//IL_0718: Expected O, but got Unknown
			//IL_0732: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_074d: Expected O, but got Unknown
			//IL_074d: Expected O, but got Unknown
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_0782: Expected O, but got Unknown
			//IL_0782: Expected O, but got Unknown
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b7: Expected O, but got Unknown
			//IL_07b7: Expected O, but got Unknown
			//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ec: Expected O, but got Unknown
			//IL_07ec: Expected O, but got Unknown
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0817: Unknown result type (might be due to invalid IL or missing references)
			//IL_0821: Expected O, but got Unknown
			//IL_0821: Expected O, but got Unknown
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			//IL_084c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Expected O, but got Unknown
			//IL_0856: Expected O, but got Unknown
			modifyStats = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "Modify Scaling"), true, new ConfigDescription("Modify Elite Cost/HP/Damage multipliers.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1Cost = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 Cost"), 4.5f, new ConfigDescription("T1 Director Cost multiplier. (Vanilla is 6)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1Health = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 HP"), 3f, new ConfigDescription("T1 Health multiplier. (Vanilla is 4)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1HealthEarth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 HP - Mending"), 3f, new ConfigDescription("Mending Health multiplier. (Vanilla is 3)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1Damage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 Damage"), 1.5f, new ConfigDescription("T1 Damage multipliers. (Vanilla is 2)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1HonorCost = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) Cost"), 3.5f, new ConfigDescription("T1 Director Cost multiplier while Honor is active. (Vanilla is 3.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1HonorHealth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) HP"), 2.5f, new ConfigDescription("T1 Health multiplier while Honor is active. (Vanilla is 2.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1HonorHealthEarth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) HP - Mending"), 1.5f, new ConfigDescription("Mending Health multiplier while Honor is active. (Vanilla is 1.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t1HonorDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) Damage"), 1.5f, new ConfigDescription("T1 Damage multipliers while Honor is active. (Vanilla is 1.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.gildedHonor = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "T1 (Honor) Gilded"), true, new ConfigDescription("Adds Gilded to Honor.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.tGildedHonorDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) Damage - Gilded"), 2.3f, new ConfigDescription("T1 Director Cost multiplier while Honor is active. (Vanilla is 3.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.tGildedHonorHealth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) HP - Gilded"), 3.8f, new ConfigDescription("T1 Health multiplier while Honor is active. (Vanilla is 2.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2Cost = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T2 Cost"), 36f, new ConfigDescription("T2 Director Cost multiplier. (Vanilla is 36)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2Health = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T2 HP"), 12f, new ConfigDescription("T2 Health multiplier. (Vanilla is 18)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2Damage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T2 Damage"), 4f, new ConfigDescription("T2 Damage multipliers. (Vanilla is 6)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2Health = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T2 HP"), 12f, new ConfigDescription("T2 Health multiplier. (Vanilla is 18)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2HealthTwisted = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T2 HP - Twisted"), 12f, new ConfigDescription("Twisted Health multiplier. (Vanilla is 13)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2DamageTwisted = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T2 Damage - Twisted"), 4f, new ConfigDescription("Twisted Damage multiplier. (Vanilla is 10)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.tGildedHealth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 HP - Gilded"), 4.5f, new ConfigDescription("Gilded Health multiplier. (Vanilla is 6)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.tGildedDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 Damage - Gilded"), 2.3f, new ConfigDescription("Gilded Damage multipliers. (Vanilla is 3)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ModifyEliteTiers.t2MinStages = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("General", "T2 Min Stages"), 5, new ConfigDescription("Minimum stage completions before T2 elites start spawning. (Vanilla is 5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			EliteVoid.damageBonus = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "Voidtouched Damage"), 1.5f, new ConfigDescription("Voidtouched Damage multipliers. (Vanilla is 0.7)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixBlueEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixBlueRemoveShield = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "Remove Shield"), true, new ConfigDescription("Remove shields from Overloading Enemies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixBlueReduceShield = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "Reduce Shield"), false, new ConfigDescription("Reduces shields of Overloading Enemies. Requires Remove Shield option to be disabled.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			AffixBlue.enableOnHitRework = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "On-Hit Rework"), true, new ConfigDescription("Increases the blast radius of Overloading stickybombs.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			AffixBlue.enablePassiveLightning = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "Passive Lightning"), true, new ConfigDescription("Overloading elites periodically shoot out lightning nearby.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			AffixBluePassiveLightning.scatterBombs = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "On-Hit Scatterbombs"), false, new ConfigDescription("Requires On-Hit Rework. Replaces Overloading stickybombs with a spread of projectiles.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			AffixBluePassiveLightning.uncapOnHitLightning = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Overloading", "On-Hit Scatterbombs - Uncap On-Hit Lightning"), false, new ConfigDescription("Remove the fire rate cap on on-hit scatterbombs (laggy).", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixWhiteEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Glacial", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixRedEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T1 - Blazing", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixPoisonEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T2 - Malachite", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixHauntedEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T2 - Celestine", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			AffixHaunted.replaceOnHitEffect = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("T2 - Celestine", "New On-Hit Effect"), true, new ConfigDescription("Replaces the Vanilla Slow-on-Hit with an armor reduction penalty.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			eliteEarthEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("DLC1 - T1 - Mending", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			eliteVoidEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("DLC1 - Voidtouched", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			EliteVoid.tweakNullify = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("DLC1 - Voidtouched", "Tweak Nullify"), true, new ConfigDescription("Nullify only takes 2 stacks to root. Requires Voidtouched changes to be eanbled.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixGildedEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("DLC2 - Gilded", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			affixBeadEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("DLC2 - T2 - Twisted", "Enable Changes"), true, new ConfigDescription("Enable changes to this elite type.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}
	}
	public static class EliteReworksUtils
	{
		public static void DebuffSphere(BuffIndex buff, TeamIndex team, Vector3 position, float radius, float debuffDuration, GameObject effect, GameObject hitEffect, bool ignoreImmunity, bool falloff, NetworkSoundEventDef buffSound)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003e: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if ((Object)(object)effect != (Object)null)
			{
				EffectManager.SpawnEffect(effect, new EffectData
				{
					origin = position,
					scale = radius
				}, true);
			}
			float num = radius * radius * 0.25f;
			List<HealthComponent> list = new List<HealthComponent>();
			Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask));
			for (int i = 0; i < array.Length; i++)
			{
				HurtBox component = ((Component)array[i]).GetComponent<HurtBox>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				HealthComponent healthComponent = component.healthComponent;
				ProjectileController componentInParent = ((Component)array[i]).GetComponentInParent<ProjectileController>();
				if (!Object.op_Implicit((Object)(object)healthComponent) || Object.op_Implicit((Object)(object)componentInParent) || list.Contains(healthComponent))
				{
					continue;
				}
				list.Add(healthComponent);
				if (!Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) || healthComponent.body.teamComponent.teamIndex == team || (!ignoreImmunity && (healthComponent.body.HasBuff(Buffs.Immune) || healthComponent.body.HasBuff(Buffs.HiddenInvincibility))))
				{
					continue;
				}
				float num2 = 1f;
				if (falloff)
				{
					Vector3 val = position - component.collider.ClosestPoint(position);
					float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
					if (sqrMagnitude > num)
					{
						num2 *= 0.5f;
					}
				}
				bool flag = healthComponent.body.HasBuff(buff);
				healthComponent.body.AddTimedBuff(buff, num2 * debuffDuration);
				if (!flag)
				{
					if ((Object)(object)hitEffect != (Object)null)
					{
						EffectManager.SpawnEffect(hitEffect, new EffectData
						{
							origin = healthComponent.body.corePosition
						}, true);
					}
					if ((Object)(object)buffSound != (Object)null)
					{
						EffectManager.SimpleSoundEffect(buffSound.index, healthComponent.body.corePosition, true);
					}
				}
			}
		}

		public static void BuffSphere(CharacterBody ownerBody, BuffIndex buff, TeamIndex team, Vector3 position, float radius, float debuffDuration, GameObject effect, bool ignoreOwner)
		{
			//IL_0045: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if ((Object)(object)effect != (Object)null)
			{
				EffectManager.SpawnEffect(effect, new EffectData
				{
					origin = position,
					scale = radius
				}, true);
			}
			List<HealthComponent> list = new List<HealthComponent>();
			Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask));
			for (int i = 0; i < array.Length; i++)
			{
				HurtBox component = ((Component)array[i]).GetComponent<HurtBox>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				HealthComponent healthComponent = component.healthComponent;
				ProjectileController componentInParent = ((Component)array[i]).GetComponentInParent<ProjectileController>();
				if (Object.op_Implicit((Object)(object)healthComponent) && !Object.op_Implicit((Object)(object)componentInParent) && !list.Contains(healthComponent))
				{
					list.Add(healthComponent);
					if (Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) && healthComponent.body.teamComponent.teamIndex == team && Object.op_Implicit((Object)(object)healthComponent.body) && (!ignoreOwner || !((Object)(object)healthComponent.body == (Object)(object)ownerBody)))
					{
						healthComponent.body.AddTimedBuff(buff, debuffDuration);
					}
				}
			}
		}
	}
}
namespace EliteReworks.Tweaks
{
	public class EliteStunTracker : MonoBehaviour
	{
		private float stunDisableTimer = 0f;

		public void FixedUpdate()
		{
			if (stunDisableTimer > 0f)
			{
				stunDisableTimer -= Time.fixedDeltaTime;
			}
		}

		public bool PassiveActive()
		{
			return stunDisableTimer <= 0f;
		}

		public void SetStun()
		{
			stunDisableTimer = EliteReworksPlugin.eliteStunDisableDuration;
		}
	}
	public static class ModifyEliteTiers
	{
		public static EliteDef GildedT1HonorDef;

		public static bool gildedHonor = true;

		public static float t1Cost = 4.5f;

		public static float t1Health = 3f;

		public static float t1HealthEarth = 3f;

		public static float t1Damage = 1.5f;

		public static float t1HonorCost = 3.5f;

		public static float t1HonorHealth = 2.5f;

		public static float t1HonorHealthEarth = 1.5f;

		public static float t1HonorDamage = 1.5f;

		public static float tGildedHealth = 4.5f;

		public static float tGildedDamage = 2.3f;

		public static float tGildedHonorHealth = 3.8f;

		public static float tGildedHonorDamage = 2.3f;

		public static float t2Cost = 36f;

		public static float t2Health = 12f;

		public static float t2Damage = 3.5f;

		public static float t2HealthTwisted = 12f;

		public static float t2DamageTwisted = 3.5f;

		public static int t2MinStages = 5;

		public static void Setup()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC2/Elites/EliteAurelionite/edAurelionite.asset").WaitForCompletion();
			EliteDef val2 = ScriptableObject.CreateInstance<EliteDef>();
			val2.color = val.color;
			val2.damageBoostCoefficient = tGildedHonorDamage;
			val2.healthBoostCoefficient = tGildedHonorHealth;
			val2.modifierToken = val.modifierToken;
			((Object)val2).name = ((Object)val).name + "Honor";
			((Object)val2).name = ((Object)val2).name;
			val2.shaderEliteRampIndex = val.shaderEliteRampIndex;
			val2.eliteEquipmentDef = val.eliteEquipmentDef;
			ContentAddition.AddEliteDef(val2);
			GildedT1HonorDef = val2;
			CombatDirector.Init += new hook_Init(CombatDirector_Init);
		}

		private static void CombatDirector_Init(orig_Init orig)
		{
			orig.Invoke();
			EliteTierDef val = EliteAPI.VanillaEliteTiers[1];
			val.costMultiplier = t1Cost;
			EliteDef[] eliteTypes = val.eliteTypes;
			foreach (EliteDef ed in eliteTypes)
			{
				ApplyT1Scaling(ed);
			}
			EliteTierDef val2 = EliteAPI.VanillaEliteTiers[2];
			val2.costMultiplier = t1HonorCost;
			if (gildedHonor && Object.op_Implicit((Object)(object)GildedT1HonorDef))
			{
				List<EliteDef> list = val2.eliteTypes.ToList();
				list.Add(GildedT1HonorDef);
				val2.eliteTypes = list.ToArray();
			}
			EliteDef[] eliteTypes2 = val2.eliteTypes;
			foreach (EliteDef ed2 in eliteTypes2)
			{
				ApplyT1HonorScaling(ed2);
			}
			EliteTierDef val3 = EliteAPI.VanillaEliteTiers[3];
			val3.costMultiplier = t1Cost;
			EliteDef[] eliteTypes3 = val3.eliteTypes;
			foreach (EliteDef ed3 in eliteTypes3)
			{
				ApplyT1Scaling(ed3);
			}
			EliteTierDef val4 = EliteAPI.VanillaEliteTiers[4];
			if (t2MinStages != 5)
			{
				val4.isAvailable = (EliteRules eliteRules) => Object.op_Implicit((Object)(object)Run.instance) && Run.instance.stageClearCount >= t2MinStages;
			}
			val4.costMultiplier = t2Cost;
			EliteDef[] eliteTypes4 = val4.eliteTypes;
			foreach (EliteDef val5 in eliteTypes4)
			{
				if ((Object)(object)val5 != (Object)null)
				{
					ApplyT2Scaling(val5);
				}
			}
		}

		public static void ApplyT1Scaling(EliteDef ed)
		{
			ed.damageBoostCoefficient = t1Damage;
			ed.healthBoostCoefficient = t1Health;
			if ((Object)(object)ed == (Object)(object)Elites.Earth)
			{
				ed.healthBoostCoefficient = t1HealthEarth;
			}
			else if ((Object)(object)ed == (Object)(object)Elites.Aurelionite)
			{
				ed.healthBoostCoefficient = tGildedHealth;
				ed.damageBoostCoefficient = tGildedDamage;
			}
		}

		public static void ApplyT1HonorScaling(EliteDef ed)
		{
			ed.damageBoostCoefficient = t1HonorDamage;
			ed.healthBoostCoefficient = t1HonorHealth;
			if ((Object)(object)ed == (Object)(object)Elites.EarthHonor)
			{
				ed.healthBoostCoefficient = t1HonorHealthEarth;
			}
			else if ((Object)(object)ed == (Object)(object)GildedT1HonorDef)
			{
				ed.healthBoostCoefficient = tGildedHonorHealth;
				ed.damageBoostCoefficient = tGildedHonorDamage;
			}
		}

		public static void ApplyT2Scaling(EliteDef ed)
		{
			ed.damageBoostCoefficient = t2Damage;
			ed.healthBoostCoefficient = t2Health;
			if ((Object)(object)ed == (Object)(object)Elites.Bead)
			{
				ed.healthBoostCoefficient = t2HealthTwisted;
				ed.damageBoostCoefficient = t2DamageTwisted;
			}
		}
	}
}
namespace EliteReworks.Tweaks.T2
{
	public static class AffixHaunted
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static StatHookEventHandler <>9__4_0;

			public static hook_FixedUpdate <>9__10_0;

			public static Func<Instruction, bool> <>9__12_2;

			public static Func<bool, CharacterBody, bool> <>9__12_3;

			public static Func<Instruction, bool> <>9__12_4;

			public static Func<bool, CharacterBody, bool> <>9__12_5;

			public static Manipulator <>9__12_0;

			public static Func<Instruction, bool> <>9__12_6;

			public static Func<bool, CharacterModel, bool> <>9__12_7;

			public static Manipulator <>9__12_1;

			public static Func<Instruction, bool> <>9__13_2;

			public static Manipulator <>9__13_0;

			public static hook_ProcessHitEnemy <>9__13_1;

			internal void <Setup>b__4_0(CharacterBody sender, StatHookEventArgs args)
			{
				if (sender.HasBuff(reviveBuff))
				{
					args.moveSpeedMultAdd += 0.7f;
					args.attackSpeedMultAdd += 0.5f;
				}
				if (sender.HasBuff(armorReductionBuff))
				{
					args.armorAdd -= 20f;
				}
			}

			internal void <DisableBubble>b__10_0(orig_FixedUpdate orig, AffixHauntedBehavior self)
			{
			}

			internal void <StealBuffVFX>b__12_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Cripple")
				});
				val.Index += 2;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<bool, CharacterBody, bool>>((Func<bool, CharacterBody, bool>)((bool hasBuff, CharacterBody self) => hasBuff || self.HasBuff(armorReductionBuff)));
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Warbanner")
				});
				val.Index += 2;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<bool, CharacterBody, bool>>((Func<bool, CharacterBody, bool>)((bool hasBuff, CharacterBody self) => hasBuff || self.HasBuff(ghostsActiveBuff)));
			}

			internal bool <StealBuffVFX>b__12_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Cripple");
			}

			internal bool <StealBuffVFX>b__12_3(bool hasBuff, CharacterBody self)
			{
				return hasBuff || self.HasBuff(armorReductionBuff);
			}

			internal bool <StealBuffVFX>b__12_4(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Warbanner");
			}

			internal bool <StealBuffVFX>b__12_5(bool hasBuff, CharacterBody self)
			{
				return hasBuff || self.HasBuff(ghostsActiveBuff);
			}

			internal void <StealBuffVFX>b__12_1(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "FullCrit")
				});
				val.Index += 2;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<bool, CharacterModel, bool>>((Func<bool, CharacterModel, bool>)((bool hasBuff, CharacterModel self) => hasBuff || self.body.HasBuff(reviveBuff)));
			}

			internal bool <StealBuffVFX>b__12_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "FullCrit");
			}

			internal bool <StealBuffVFX>b__12_7(bool hasBuff, CharacterModel self)
			{
				return hasBuff || self.body.HasBuff(reviveBuff);
			}

			internal void <ChangeOnHitEffect>b__13_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixHaunted")
				});
				val.Remove();
				val.Emit<EliteReworksPlugin>(OpCodes.Ldsfld, "EmptyBuff");
			}

			internal bool <ChangeOnHitEffect>b__13_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixHaunted");
			}

			internal void <ChangeOnHitEffect>b__13_1(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				orig.Invoke(self, damageInfo, victim);
				if (!NetworkServer.active || damageInfo.rejected || !(damageInfo.procCoefficient > 0f) || !Object.op_Implicit((Object)(object)damageInfo.attacker) || !Object.op_Implicit((Object)(object)victim))
				{
					return;
				}
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					CharacterBody component2 = victim.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component2) && component.HasBuff(Buffs.AffixHaunted))
					{
						component2.AddTimedBuff(armorReductionBuff, 3f);
					}
				}
			}
		}

		public static BuffDef reviveBuff;

		public static BuffDef ghostsActiveBuff;

		public static BuffDef armorReductionBuff;

		public static bool replaceOnHitEffect = true;

		public static void Setup()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			reviveBuff = CreateReviveBuff();
			ghostsActiveBuff = CreateGhostsActiveBuff();
			armorReductionBuff = CreateArmorReductionBuff();
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				StatHookEventHandler val = delegate(CharacterBody sender, StatHookEventArgs args)
				{
					if (sender.HasBuff(reviveBuff))
					{
						args.moveSpeedMultAdd += 0.7f;
						args.attackSpeedMultAdd += 0.5f;
					}
					if (sender.HasBuff(armorReductionBuff))
					{
						args.armorAdd -= 20f;
					}
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			BaseSplitDeath.OnEnter += new hook_OnEnter(FixGhostGupSplit);
			if (EliteReworksPlugin.affixHauntedEnabled)
			{
				DisableBubble();
				GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(ReviveAsGhost);
				StealBuffVFX();
				ChangeOnHitEffect();
			}
		}

		private static void FixGhostGupSplit(orig_OnEnter orig, BaseSplitDeath self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(reviveBuff))
			{
				self.hasDied = true;
				((GenericCharacterDeath)self).DestroyBodyAsapServer();
			}
		}

		public static BuffDef CreateReviveBuff()
		{
			//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)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.6156863f, 13f / 15f, 72f / 85f);
			val.canStack = false;
			val.isDebuff = false;
			((Object)val).name = "EliteReworksHauntedRevive";
			val.iconSprite = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/DeathMark").iconSprite;
			ContentAddition.AddBuffDef(val);
			return val;
		}

		public static BuffDef CreateGhostsActiveBuff()
		{
			//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)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.8235294f, 10f / 51f, 0.08627451f);
			val.canStack = false;
			val.isDebuff = false;
			((Object)val).name = "EliteReworksHauntedGhostsActive";
			val.iconSprite = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/DeathMark").iconSprite;
			ContentAddition.AddBuffDef(val);
			return val;
		}

		public static BuffDef CreateArmorReductionBuff()
		{
			//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)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(44f / 85f, 0.8392157f, 0.9254902f);
			val.canStack = false;
			val.isDebuff = true;
			((Object)val).name = "EliteReworksHauntedArmorReduction";
			val.iconSprite = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/Cripple").iconSprite;
			ContentAddition.AddBuffDef(val);
			return val;
		}

		public static void AttemptSpawnGhost(CharacterBody sourceBody, Vector3 position, float radius)
		{
			//IL_000a: 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_0012: Invalid comparison between Unknown and I4
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)sourceBody) || (sourceBody.bodyFlags & 4) == 4)
			{
				return;
			}
			float num = radius * radius;
			if (!Object.op_Implicit((Object)(object)sourceBody.teamComponent))
			{
				return;
			}
			TeamIndex teamIndex = sourceBody.teamComponent.teamIndex;
			ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(teamIndex);
			if (teamMembers == null)
			{
				return;
			}
			foreach (TeamComponent item2 in teamMembers)
			{
				if (!Object.op_Implicit((Object)(object)item2.body) || ((Enum)item2.body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)4) || !item2.body.HasBuff(Buffs.AffixHaunted) || !Object.op_Implicit((Object)(object)item2.body.healthComponent) || !item2.body.healthComponent.alive)
				{
					continue;
				}
				Vector3 val = position - item2.body.corePosition;
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				if (!(sqrMagnitude <= num))
				{
					continue;
				}
				AffixHauntedReviveAura component = ((Component)item2.body).GetComponent<AffixHauntedReviveAura>();
				if (!Object.op_Implicit((Object)(object)component) || !component.wardActive || component.attachedGhosts.Count >= component.GetMaxGhosts())
				{
					continue;
				}
				CharacterBody val2 = Util.TryToCreateGhost(sourceBody, item2.body, 60 + (item2.body.isChampion ? 30 : 0));
				if (!Object.op_Implicit((Object)(object)val2))
				{
					break;
				}
				if (Object.op_Implicit((Object)(object)val2.master) && Object.op_Implicit((Object)(object)val2.master.inventory))
				{
					int itemCount = val2.master.inventory.GetItemCount(Items.BoostDamage);
					if (itemCount > 0)
					{
						val2.master.inventory.RemoveItem(Items.BoostDamage, val2.master.inventory.GetItemCount(Items.BoostDamage));
					}
					val2.master.inventory.GiveItem(Items.BoostDamage, 5);
					val2.master.inventory.SetEquipmentIndex((EquipmentIndex)(-1));
				}
				val2.AddBuff(reviveBuff);
				HauntTargetInfo item = new HauntTargetInfo
				{
					body = val2
				};
				component.attachedGhosts.Add(item);
				break;
			}
		}

		private static void DisableBubble()
		{
			//IL_0015: 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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				hook_FixedUpdate val = delegate
				{
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			AffixHauntedBehavior.FixedUpdate += (hook_FixedUpdate)obj;
		}

		private static void ReviveAsGhost(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
		{
			//IL_0022: 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)
			orig.Invoke(self, damageReport);
			if (Object.op_Implicit((Object)(object)damageReport.victimBody) && damageReport.victimBody.HasBuff(reviveBuff.buffIndex) && !damageReport.victimBody.disablingHurtBoxes && !damageReport.victimBody.HasBuff(Buffs.AffixHaunted))
			{
				AttemptSpawnGhost(damageReport.victimBody, damageReport.damageInfo.position, AffixHauntedReviveAura.detachRadius * 1.1f);
			}
		}

		private static void StealBuffVFX()
		{
			//IL_0015: 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_0020: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val4 = new ILCursor(il);
					val4.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Cripple")
					});
					val4.Index += 2;
					val4.Emit(OpCodes.Ldarg_0);
					val4.EmitDelegate<Func<bool, CharacterBody, bool>>((Func<bool, CharacterBody, bool>)((bool hasBuff, CharacterBody self) => hasBuff || self.HasBuff(armorReductionBuff)));
					val4.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Warbanner")
					});
					val4.Index += 2;
					val4.Emit(OpCodes.Ldarg_0);
					val4.EmitDelegate<Func<bool, CharacterBody, bool>>((Func<bool, CharacterBody, bool>)((bool hasBuff, CharacterBody self) => hasBuff || self.HasBuff(ghostsActiveBuff)));
				};
				<>c.<>9__12_0 = val;
				obj = (object)val;
			}
			CharacterBody.UpdateAllTemporaryVisualEffects += (Manipulator)obj;
			object obj2 = <>c.<>9__12_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val3 = new ILCursor(il);
					val3.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "FullCrit")
					});
					val3.Index += 2;
					val3.Emit(OpCodes.Ldarg_0);
					val3.EmitDelegate<Func<bool, CharacterModel, bool>>((Func<bool, CharacterModel, bool>)((bool hasBuff, CharacterModel self) => hasBuff || self.body.HasBuff(reviveBuff)));
				};
				<>c.<>9__12_1 = val2;
				obj2 = (object)val2;
			}
			CharacterModel.UpdateOverlays += (Manipulator)obj2;
		}

		private static void ChangeOnHitEffect()
		{
			//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_002e: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			if (!replaceOnHitEffect)
			{
				return;
			}
			object obj = <>c.<>9__13_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val3 = new ILCursor(il);
					val3.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixHaunted")
					});
					val3.Remove();
					val3.Emit<EliteReworksPlugin>(OpCodes.Ldsfld, "EmptyBuff");
				};
				<>c.<>9__13_0 = val;
				obj = (object)val;
			}
			GlobalEventManager.ProcessHitEnemy += (Manipulator)obj;
			object obj2 = <>c.<>9__13_1;
			if (obj2 == null)
			{
				hook_ProcessHitEnemy val2 = delegate(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
				{
					orig.Invoke(self, damageInfo, victim);
					if (NetworkServer.active && !damageInfo.rejected && damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)victim))
					{
						CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component))
						{
							CharacterBody component2 = victim.GetComponent<CharacterBody>();
							if (Object.op_Implicit((Object)(object)component2) && component.HasBuff(Buffs.AffixHaunted))
							{
								component2.AddTimedBuff(armorReductionBuff, 3f);
							}
						}
					}
				};
				<>c.<>9__13_1 = val2;
				obj2 = (object)val2;
			}
			GlobalEventManager.ProcessHitEnemy += (hook_ProcessHitEnemy)obj2;
		}
	}
	public static class AffixPoison
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_UpdateAffixPoison <>9__9_0;

			public static hook_Heal <>9__10_0;

			public static hook_AddBuff_BuffIndex <>9__10_1;

			internal void <Setup>b__9_0(orig_UpdateAffixPoison orig, CharacterBody self, float deltaTime)
			{
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_0162: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_018d: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
				if (!self.HasBuff(Buffs.AffixPoison))
				{
					return;
				}
				if (Object.op_Implicit((Object)(object)self.healthComponent) && self.healthComponent.isInFrozenState)
				{
					self.poisonballTimer = 0f;
				}
				else
				{
					SetStateOnHurt component = ((Component)self).gameObject.GetComponent<SetStateOnHurt>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Type type = ((object)component.targetStateMachine.state).GetType();
						if (type == typeof(StunState) || type == typeof(ShockState))
						{
							self.poisonballTimer = 0f;
						}
					}
				}
				AffixPoisonDebuffAura component2 = ((Component)self).gameObject.GetComponent<AffixPoisonDebuffAura>();
				if (!Object.op_Implicit((Object)(object)component2))
				{
					((Component)self).gameObject.AddComponent<AffixPoisonDebuffAura>();
				}
				if (!component2.wardActive)
				{
					self.poisonballTimer = 0f;
					return;
				}
				self.poisonballTimer += deltaTime;
				if (!(self.poisonballTimer >= basePoisonTimer))
				{
					return;
				}
				int num = 3 + (int)self.radius;
				self.poisonballTimer = 0f;
				Vector3 up = Vector3.up;
				float num2 = 360f / (float)num;
				Vector3 val = Vector3.ProjectOnPlane(self.transform.forward, up);
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				Vector3 val2 = Vector3.RotateTowards(up, normalized, 0.43633232f, float.PositiveInfinity);
				for (int i = 0; i < num; i++)
				{
					Vector3 val3 = Quaternion.AngleAxis(num2 * (float)i, up) * val2;
					float num3 = 60f;
					float num4 = num3 + Mathf.Max(0f, self.level - 1f) * num3 * 0.2f;
					if (self.isChampion)
					{
						num4 *= EliteReworksPlugin.eliteBossDamageMult;
					}
					ProjectileManager.instance.FireProjectile(spikeOrbProjectile, self.corePosition, Util.QuaternionSafeLookRotation(val3), ((Component)self).gameObject, num4, 0f, false, (DamageColorIndex)0, (GameObject)null, -1f);
				}
			}

			internal float <SetupDebuff>b__10_0(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool isRegen)
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				int num = Mathf.Min(self.body.GetBuffCount(MalachiteBuildup), malachiteBuildupMaxStacks);
				if (num > 0)
				{
					amount *= 1f - malachiteBuildupHealReduction * (float)num;
				}
				return orig.Invoke(self, amount, procChainMask, isRegen);
			}

			internal void <SetupDebuff>b__10_1(orig_AddBuff_BuffIndex orig, CharacterBody self, BuffIndex buffIndex)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, buffIndex);
				if (NetworkServer.active && buffIndex == Buffs.HealingDisabled.buffIndex && self.HasBuff(MalachiteBuildup.buffIndex))
				{
					self.ClearTimedBuffs(MalachiteBuildup.buffIndex);
				}
			}
		}

		public static ModdedDamageType malachiteDamage;

		public static GameObject spikePrefab;

		public static GameObject spikeOrbProjectile;

		public static float basePoisonTimer = 6f;

		public static float spikeHPPercent = 0.4f;

		public static BuffDef MalachiteBuildup;

		public static float malachiteBuildupTime = 3f;

		public static int malachiteBuildupMaxStacks = 5;

		public static float malachiteBuildupHealReduction;

		public static void Setup()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			AffixPoisonDebuffAura.refreshTime = malachiteBuildupTime / (float)malachiteBuildupMaxStacks;
			AffixPoisonDebuffAura.buffDuration = AffixPoisonDebuffAura.refreshTime + 0.1f;
			malachiteBuildupHealReduction = 1f / (float)malachiteBuildupMaxStacks;
			malachiteDamage = DamageAPI.ReserveDamageType();
			spikePrefab = BuildSpikePrefab();
			spikeOrbProjectile = BuildSpikeOrb(spikePrefab);
			AffixPoisonDebuffAura.indicatorPrefab = BuildIndicator();
			object obj = <>c.<>9__9_0;
			if (obj == null)
			{
				hook_UpdateAffixPoison val = delegate(orig_UpdateAffixPoison orig, CharacterBody self, float deltaTime)
				{
					//IL_0133: Unknown result type (might be due to invalid IL or missing references)
					//IL_0138: Unknown result type (might be due to invalid IL or missing references)
					//IL_014b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0150: Unknown result type (might be due to invalid IL or missing references)
					//IL_0152: Unknown result type (might be due to invalid IL or missing references)
					//IL_0157: Unknown result type (might be due to invalid IL or missing references)
					//IL_015b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0160: Unknown result type (might be due to invalid IL or missing references)
					//IL_0162: Unknown result type (might be due to invalid IL or missing references)
					//IL_0164: Unknown result type (might be due to invalid IL or missing references)
					//IL_0170: Unknown result type (might be due to invalid IL or missing references)
					//IL_0175: Unknown result type (might be due to invalid IL or missing references)
					//IL_0186: Unknown result type (might be due to invalid IL or missing references)
					//IL_0188: Unknown result type (might be due to invalid IL or missing references)
					//IL_018d: Unknown result type (might be due to invalid IL or missing references)
					//IL_018f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0194: Unknown result type (might be due to invalid IL or missing references)
					//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
					//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
					//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
					if (self.HasBuff(Buffs.AffixPoison))
					{
						if (Object.op_Implicit((Object)(object)self.healthComponent) && self.healthComponent.isInFrozenState)
						{
							self.poisonballTimer = 0f;
						}
						else
						{
							SetStateOnHurt component = ((Component)self).gameObject.GetComponent<SetStateOnHurt>();
							if (Object.op_Implicit((Object)(object)component))
							{
								Type type = ((object)component.targetStateMachine.state).GetType();
								if (type == typeof(StunState) || type == typeof(ShockState))
								{
									self.poisonballTimer = 0f;
								}
							}
						}
						AffixPoisonDebuffAura component2 = ((Component)self).gameObject.GetComponent<AffixPoisonDebuffAura>();
						if (!Object.op_Implicit((Object)(object)component2))
						{
							((Component)self).gameObject.AddComponent<AffixPoisonDebuffAura>();
						}
						if (!component2.wardActive)
						{
							self.poisonballTimer = 0f;
						}
						else
						{
							self.poisonballTimer += deltaTime;
							if (self.poisonballTimer >= basePoisonTimer)
							{
								int num = 3 + (int)self.radius;
								self.poisonballTimer = 0f;
								Vector3 up = Vector3.up;
								float num2 = 360f / (float)num;
								Vector3 val2 = Vector3.ProjectOnPlane(self.transform.forward, up);
								Vector3 normalized = ((Vector3)(ref val2)).normalized;
								Vector3 val3 = Vector3.RotateTowards(up, normalized, 0.43633232f, float.PositiveInfinity);
								for (int i = 0; i < num; i++)
								{
									Vector3 val4 = Quaternion.AngleAxis(num2 * (float)i, up) * val3;
									float num3 = 60f;
									float num4 = num3 + Mathf.Max(0f, self.level - 1f) * num3 * 0.2f;
									if (self.isChampion)
									{
										num4 *= EliteReworksPlugin.eliteBossDamageMult;
									}
									ProjectileManager.instance.FireProjectile(spikeOrbProjectile, self.corePosition, Util.QuaternionSafeLookRotation(val4), ((Component)self).gameObject, num4, 0f, false, (DamageColorIndex)0, (GameObject)null, -1f);
								}
							}
						}
					}
				};
				<>c.<>9__9_0 = val;
				obj = (object)val;
			}
			CharacterBody.UpdateAffixPoison += (hook_UpdateAffixPoison)obj;
			SetupDebuff();
		}

		private static void SetupDebuff()
		{
			//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)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//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_00a8: Expected O, but got Unknown
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			val.buffColor = new Color(0.3f, 0.3f, 0.3f);
			val.canStack = true;
			val.isDebuff = false;
			val.isCooldown = true;
			((Object)val).name = "EliteReworksMalachiteBuildup";
			val.iconSprite = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HealingDisabled").iconSprite;
			ContentAddition.AddBuffDef(val);
			MalachiteBuildup = val;
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				hook_Heal val2 = delegate(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool isRegen)
				{
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					int num = Mathf.Min(self.body.GetBuffCount(MalachiteBuildup), malachiteBuildupMaxStacks);
					if (num > 0)
					{
						amount *= 1f - malachiteBuildupHealReduction * (float)num;
					}
					return orig.Invoke(self, amount, procChainMask, isRegen);
				};
				<>c.<>9__10_0 = val2;
				obj = (object)val2;
			}
			HealthComponent.Heal += (hook_Heal)obj;
			object obj2 = <>c.<>9__10_1;
			if (obj2 == null)
			{
				hook_AddBuff_BuffIndex val3 = delegate(orig_AddBuff_BuffIndex orig, CharacterBody self, BuffIndex buffIndex)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_0024: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, buffIndex);
					if (NetworkServer.active && buffIndex == Buffs.HealingDisabled.buffIndex && self.HasBuff(MalachiteBuildup.buffIndex))
					{
						self.ClearTimedBuffs(MalachiteBuildup.buffIndex);
					}
				};
				<>c.<>9__10_1 = val3;
				obj2 = (object)val3;
			}
			CharacterBody.AddBuff_BuffIndex += (hook_AddBuff_BuffIndex)obj2;
		}

		private static GameObject BuildSpikePrefab()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/PoisonStakeProjectile"), "MoffeinEliteReworksPoisonStakeProjectile", true);
			ModdedDamageTypeHolderComponent val2 = val.AddComponent<ModdedDamageTypeHolderComponent>();
			val2.Add(malachiteDamage);
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static GameObject BuildSpikeOrb(GameObject projectileChild)
		{
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/PoisonOrbProjectile"), "MoffeinEliteReworksPoisonOrbProjectile", true);
			ProjectileImpactExplosion component = val.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastRadius = 0f;
			((ProjectileExplosion)component).blastDamageCoefficient = 0f;
			((ProjectileExplosion)component).blastProcCoefficient = 0f;
			((ProjectileExplosion)component).childrenProjectilePrefab = projectileChild;
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static GameObject BuildIndicator()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/NearbyDamageBonusIndicator"), "MoffeinEliteReworksPoisonIndicator", true);
			val.transform.localScale = AffixPoisonDebuffAura.wardRadius / 12.8f * Vector3.one;
			PrefabAPI.RegisterNetworkPrefab(val);
			return val;
		}

		public static void MalachiteSphere(TeamIndex team, Vector3 position, float radius, float debuffDuration)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			List<HealthComponent> list = new List<HealthComponent>();
			Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask));
			for (int i = 0; i < array.Length; i++)
			{
				HurtBox component = ((Component)array[i]).GetComponent<HurtBox>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				HealthComponent healthComponent = component.healthComponent;
				ProjectileController componentInParent = ((Component)array[i]).GetComponentInParent<ProjectileController>();
				if (!Object.op_Implicit((Object)(object)healthComponent) || Object.op_Implicit((Object)(object)componentInParent) || list.Contains(healthComponent))
				{
					continue;
				}
				list.Add(healthComponent);
				if (!Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) || healthComponent.body.teamComponent.teamIndex == team)
				{
					continue;
				}
				if (!healthComponent.body.HasBuff(Buffs.HealingDisabled.buffIndex))
				{
					healthComponent.body.AddTimedBuff(MalachiteBuildup, debuffDuration);
					int buffCount = healthComponent.body.GetBuffCount(MalachiteBuildup);
					if (buffCount >= malachiteBuildupMaxStacks)
					{
						healthComponent.body.ClearTimedBuffs(MalachiteBuildup.buffIndex);
						healthComponent.body.AddTimedBuff(Buffs.HealingDisabled.buffIndex, debuffDuration);
						continue;
					}
					for (int j = 0; j < healthComponent.body.timedBuffs.Count; j++)
					{
						if (healthComponent.body.timedBuffs[j].buffIndex == MalachiteBuildup.buffIndex && healthComponent.body.timedBuffs[j].timer < debuffDuration)
						{
							healthComponent.body.timedBuffs[j].timer = debuffDuration;
						}
					}
				}
				else
				{
					healthComponent.body.AddTimedBuff(Buffs.HealingDisabled.buffIndex, debuffDuration);
				}
			}
		}
	}
}
namespace EliteReworks.Tweaks.T2.Components
{
	[DisallowMultipleComponent]
	public class AffixHauntedReviveAura : MonoBehaviour
	{
		public static float detachRadius = 45f;

		public static float wardRadius = 30f;

		public static float refreshTime = 0.4f;

		public static float ghostPingTime = 2.5f;

		private float ghostPingStopwatch;

		public static int maxAttachedGhosts = 4;

		public static int championBonusAttachedGhosts = 2;

		public List<HauntTargetInfo> attachedGhosts;

		public List<HauntTargetInfo> attachedAliveMonsters;

		private float stopwatch;

		private CharacterBody ownerBody;

		private TeamComponent teamComponent;

		public bool wardActive = false;

		private float stunDisableTimer = 0f;

		public int GetMaxGhosts()
		{
			return maxAttachedGhosts + ((Object.op_Implicit((Object)(object)ownerBody) && ownerBody.isChampion) ? championBonusAttachedGhosts : 0);
		}

		public void Awake()
		{
			wardActive = false;
			stopwatch = 0f;
			ghostPingStopwatch = 0f;
			attachedGhosts = new List<HauntTargetInfo>();
			attachedAliveMonsters = new List<HauntTargetInfo>();
			ownerBody = ((Component)this).gameObject.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)ownerBody))
			{
				Object.Destroy((Object)(object)this);
			}
			teamComponent = ownerBody.teamComponent;
		}

		public void FixedUpdate()
		{
			wardActive = stunDisableTimer <= 0f;
			bool flag = Object.op_Implicit((Object)(object)ownerBody) && ownerBody.HasBuff(Buffs.AffixHaunted) && Object.op_Implicit((Object)(object)ownerBody.healthComponent) && ownerBody.healthComponent.alive;
			if (!flag)
			{
				wardActive = false;
				if (NetworkServer.active && Object.op_Implicit((Object)(object)ownerBody.healthComponent) && !ownerBody.healthComponent.alive)
				{
					DestroyGhosts();
					ClearAliveMonsters();
				}
			}
			if (!NetworkServer.active)
			{
				return;
			}
			if (flag)
			{
				if (Object.op_Implicit((Object)(object)ownerBody.healthComponent) && ownerBody.healthComponent.isInFrozenState)
				{
					wardActive = false;
					stunDisableTimer = EliteReworksPlugin.eliteStunDisableDuration;
				}
				else
				{
					SetStateOnHurt component = ((Component)this).gameObject.GetComponent<SetStateOnHurt>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Type type = ((object)component.targetStateMachine.state).GetType();
						if (type == typeof(StunState) || type == typeof(ShockState))
						{
							wardActive = false;
							stunDisableTimer = EliteReworksPlugin.eliteStunDisableDuration;
						}
					}
				}
			}
			if (wardActive && stunDisableTimer <= 0f)
			{
				stopwatch += Time.fixedDeltaTime;
				if (stopwatch > refreshTime)
				{
					stopwatch -= refreshTime;
					if (attachedGhosts.Count + attachedAliveMonsters.Count < GetMaxGhosts())
					{
						FindAliveMonsters();
					}
					UpdateGhosts();
					UpdateAliveMonsters();
				}
			}
			else
			{
				ClearAliveMonsters();
			}
			if (stunDisableTimer > 0f)
			{
				stunDisableTimer -= Time.fixedDeltaTime;
			}
			if (attachedGhosts.Count > 0)
			{
				if (!ownerBody.HasBuff(AffixHaunted.ghostsActiveBuff))
				{
					ownerBody.AddBuff(AffixHaunted.ghostsActiveBuff);
				}
			}
			else if (ownerBody.HasBuff(AffixHaunted.ghostsActiveBuff))
			{
				ownerBody.RemoveBuff(AffixHaunted.ghostsActiveBuff);
			}
			ghostPingStopwatch += Time.fixedDeltaTime;
			if (ghostPingStopwatch > ghostPingTime)
			{
				ghostPingStopwatch -= ghostPingTime;
				PingGhosts();
			}
		}

		private void UpdateGhosts()
		{
			if (attachedGhosts.Count <= 0)
			{
				return;
			}
			List<HauntTargetInfo> list = new List<HauntTargetInfo>();
			foreach (HauntTargetInfo attachedGhost in attachedGhosts)
			{
				if (!Object.op_Implicit((Object)(object)attachedGhost.body) || !Object.op_Implicit((Object)(object)attachedGhost.body.healthComponent) || !attachedGhost.body.healthComponent.alive)
				{
					list.Add(attachedGhost);
				}
			}
			if (list.Count <= 0)
			{
				return;
			}
			foreach (HauntTargetInfo item in list)
			{
				attachedGhosts.Remove(item);
			}
		}

		private void UpdateAliveMonsters()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			int num = GetMaxGhosts() - attachedGhosts.Count;
			int num2 = 1;
			if (attachedAliveMonsters.Count <= 0)
			{
				return;
			}
			float num3 = detachRadius * detachRadius;
			List<HauntTargetInfo> list = new List<HauntTargetInfo>();
			foreach (HauntTargetInfo attachedAliveMonster in attachedAliveMonsters)
			{
				bool flag = true;
				if (Object.op_Implicit((Object)(object)attachedAliveMonster.body))
				{
					flag = false;
					if (!Object.op_Implicit((Object)(object)attachedAliveMonster.body.healthComponent) || !attachedAliveMonster.body.healthComponent.alive || num2 > num)
					{
						flag = true;
					}
					else
					{
						Vector3 val = ownerBody.corePosition - attachedAliveMonster.body.corePosition;
						float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
						if (sqrMagnitude > num3)
						{
							flag = true;
						}
					}
				}
				if (flag)
				{
					list.Add(attachedAliveMonster);
				}
				else
				{
					num2++;
				}
			}
			if (list.Count <= 0)
			{
				return;
			}
			foreach (HauntTargetInfo item in list)
			{
				if (Object.op_Implicit((Object)(object)item.body) && item.body.HasBuff(AffixHaunted.reviveBuff))
				{
					item.body.RemoveBuff(AffixHaunted.reviveBuff);
				}
				attachedAliveMonsters.Remove(item);
			}
		}

		private void FindAliveMonsters()
		{
			//IL_001a: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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: Invalid comparison between Unknown and I4
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)teamComponent))
			{
				return;
			}
			Vector3 corePosition = ownerBody.corePosition;
			int num = GetMaxGhosts() - (attachedGhosts.Count + attachedAliveMonsters.Count);
			if (num <= 0)
			{
				return;
			}
			float num2 = wardRadius * wardRadius;
			TeamIndex teamIndex = teamComponent.teamIndex;
			ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(teamIndex);
			foreach (TeamComponent item2 in teamMembers)
			{
				if (!Object.op_Implicit((Object)(object)item2.body) || (item2.body.bodyFlags & 4) == 4 || item2.body.disablingHurtBoxes || !Object.op_Implicit((Object)(object)item2.body.healthComponent) || !item2.body.healthComponent.alive || item2.body.HasBuff(Buffs.AffixHaunted) || item2.body.HasBuff(AffixHaunted.reviveBuff))
				{
					continue;
				}
				Vector3 val = corePosition - item2.body.corePosition;
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				if (sqrMagnitude <= num2)
				{
					item2.body.AddBuff(AffixHaunted.reviveBuff);
					HauntTargetInfo item = new HauntTargetInfo
					{
						body = item2.body
					};
					attachedAliveMonsters.Add(item);
					num--;
					if (num <= 0)
					{
						break;
					}
				}
			}
		}

		private void ClearAliveMonsters()
		{
			foreach (HauntTargetInfo attachedAliveMonster in attachedAliveMonsters)
			{
				if (Object.op_Implicit((Object)(object)attachedAliveMonster.body) && attachedAliveMonster.body.HasBuff(AffixHaunted.reviveBuff) && Object.op_Implicit((Object)(object)attachedAliveMonster.body.healthComponent) && attachedAliveMonster.body.healthComponent.alive)
				{
					attachedAliveMonster.body.RemoveBuff(AffixHaunted.reviveBuff);
				}
			}
			attachedAliveMonsters.Clear();
		}

		private void DestroyGhosts()
		{
			foreach (HauntTargetInfo attachedGhost in attachedGhosts)
			{
				if (Object.op_Implicit((Object)(object)attachedGhost.body) && Object.op_Implicit((Object)(object)attachedGhost.body.healthComponent))
				{
					attachedGhost.body.healthComponent.health = -100f;
				}
			}
			attachedGhosts.Clear();
		}

		private void OnDestroy()
		{
			DestroyGhosts();
			ClearAliveMonsters();
		}

		private void PingGhosts()
		{
			//IL_0064: 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)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ownerBody) || !Object.op_Implicit((Object)(object)ownerBody.mainHurtBox))
			{
				return;
			}
			int num = 0;
			foreach (HauntTargetInfo attachedGhost in attachedGhosts)
			{
				if (Object.op_Implicit((Object)(object)attachedGhost.body))
				{
					EliteReworksCelestineOrb eliteReworksCelestineOrb = new EliteReworksCelestineOrb();
					((Orb)eliteReworksCelestineOrb).origin = attachedGhost.body.corePosition;
					((Orb)eliteReworksCelestineOrb).target = ownerBody.mainHurtBox;
					eliteReworksCelestineOrb.timeToArrive = 1f + (float)num * 0.1f;
					eliteReworksCelestineOrb.scale = 1f;
					OrbManager.instance.AddOrb((Orb)(object)eliteReworksCelestineOrb);
				}
				num++;
			}
			foreach (HauntTargetInfo attachedAliveMonster in attachedAliveMonsters)
			{
				if (Object.op_Implicit((Object)(object)attachedAliveMonster.body) && Object.op_Implicit((Object)(object)attachedAliveMonster.body.mainHurtBox))
				{
					EliteReworksCelestineOrb eliteReworksCelestineOrb2 = new EliteReworksCelestineOrb();
					((Orb)eliteReworksCelestineOrb2).origin = attachedAliveMonster.body.corePosition;
					((Orb)eliteReworksCelestineOrb2).target = ownerBody.mainHurtBox;
					eliteReworksCelestineOrb2.timeToArrive = 1f + (float)num * 0.1f;
					eliteReworksCelestineOrb2.scale = 1f;
					OrbManager.instance.AddOrb((Orb)(object)eliteReworksCelestineOrb2);
				}
				num++;
			}
		}
	}
	public class HauntTargetInfo
	{
		public CharacterBody body = null;
	}
	public class EliteReworksCelestineOrb : Orb
	{
		public static GameObject orbEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/EliteHaunted/HauntOrbEffect.prefab").WaitForCompletion();

		public float timeToArrive;

		public float scale;

		public override void Begin()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			((Orb)this).duration = timeToArrive + Random.Range(0f, 0.4f);
			EffectData val = new EffectData
			{
				scale = scale,
				origin = base.origin,
				genericFloat = ((Orb)this).duration
			};
			val.SetHurtBoxReference(base.target);
			EffectManager.SpawnEffect(orbEffect, val, true);
		}
	}
	[DisallowMultipleComponent]
	public class AffixPoisonDebuffAura : MonoBehaviour
	{
		public static float wardRadius = 22f;

		public static float buffDuration;

		public static float refreshTime;

		public static GameObject indicatorPrefab;

		private float stopwatch;

		private CharacterBody ownerBody;

		private GameObject indicator = null;

		public bool wardActive = false;

		private float stunDisableTimer = 0f;

		public void Awake()
		{
			wardActive = false;
			stopwatch = 0f;
			ownerBody = ((Component)this).gameObject.GetComponent<CharacterBody>();
		}

		public void FixedUpdate()
		{
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			wardActive = stunDisableTimer <= 0f;
			if (Object.op_Implicit((Object)(object)ownerBody) && ownerBody.HasBuff(Buffs.AffixPoison) && Object.op_Implicit((Object)(object)ownerBody.healthComponent) && ownerBody.healthComponent.alive)
			{
				if (Object.op_Implicit((Object)(object)ownerBody.healthComponent) && ownerBody.healthComponent.isInFrozenState)
				{
					wardActive = false;
					stunDisableTimer = EliteReworksPlugin.eliteStunDisableDuration;
				}
				else
				{
					SetStateOnHurt component = ((Component)this).gameObject.GetComponent<SetStateOnHurt>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Type type = ((object)component.targetStateMachine.state).GetType();
						if (type == typeof(StunState) || type == typeof(ShockState))
						{
							wardActive = false;
							stunDisableTimer = EliteReworksPlugin.eliteStunDisableDuration;
						}
					}
				}
				if (NetworkServer.active)
				{
					if (stunDisableTimer <= 0f)
					{
						if (wardActive)
						{
							stopwatch += Time.fixedDeltaTime;
							if (stopwatch > refreshTime)
							{
								stopwatch -= refreshTime;
								if (Object.op_Implicit((Object)(object)ownerBody.teamComponent))
								{
									AffixPoison.MalachiteSphere(ownerBody.teamComponent.teamIndex, ownerBody.corePosition, wardRadius, buffDuration);
								}
							}
						}
					}
					else
					{
						stunDisableTimer -= Time.fixedDeltaTime;
					}
				}
				UpdateIndicator(wardActive);
			}
			else if (NetworkServer.active && Object.op_Implicit((Object)(object)indicator))
			{
				Object.Destroy((Object)(object)indicator);
				indicator = null;
			}
		}

		public void UpdateIndicator(bool wardActive)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)indicator) != wardActive)
			{
				if (wardActive)
				{
					indicator = Object.Instantiate<GameObject>(indicatorPrefab);
					indicator.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
				}
				else
				{
					Object.Destroy((Object)(object)indicator);
					indicator = null;
				}
			}
		}
	}
}
namespace EliteReworks.Tweaks.T1
{
	public static class AffixBlue
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__13_1;

			public static Manipulator <>9__13_0;

			public static Func<Instruction, bool> <>9__20_0;

			public static Func<Instruction, bool> <>9__21_0;

			public static Func<Instruction, bool> <>9__21_1;

			public static Func<Instruction, bool> <>9__21_2;

			public static Func<Instruction, bool> <>9__21_3;

			public static Func<float, float> <>9__21_4;

			internal void <Setup>b__13_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue")
				});
				val.Remove();
				val.Emit<EliteReworksPlugin>(OpCodes.Ldsfld, "EmptyBuff");
			}

			internal bool <Setup>b__13_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue");
			}

			internal bool <RemoveShields>b__20_0(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue");
			}

			internal bool <ReduceShields>b__21_0(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue");
			}

			internal bool <ReduceShields>b__21_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 0.5f);
			}

			internal bool <ReduceShields>b__21_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchCall(x, typeof(CharacterBody), "get_maxHealth");
			}

			internal bool <ReduceShields>b__21_3(Instruction x)
			{
				return ILPatternMatchingExt.MatchAdd(x);
			}

			internal float <ReduceShields>b__21_4(float shieldToAdd)
			{
				return shieldToAdd * (1f / 3f);
			}
		}

		public static int baseMeatballCount = 5;

		public static float lightningDamageCoefficient = 0.5f;

		public static GameObject lightningProjectilePrefab;

		public static GameObject lightningBossProjectilePrefab;

		public static GameObject lightningEffectPrefab;

		public static GameObject lightningEffectQuietPrefab;

		public static GameObject lightningEffectOnHitPrefab;

		public static GameObject lightningBombV2Prefab;

		public static GameObject scatterProjectilePrefab;

		public static NetworkSoundEventDef triggerSound;

		public static NetworkSoundEventDef triggerBossSound;

		public static bool enablePassiveLightning = true;

		public static bool enableOnHitRework = true;

		public static void Setup()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_008c: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			lightningEffectPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(), "MoffeinEliteReworkOverloadinLightningVFX", false);
			EffectComponent component = lightningEffectPrefab.GetComponent<EffectComponent>();
			component.soundName = "Play_EliteReworks_Lightning";
			ContentAddition.AddEffect(lightningEffectPrefab);
			lightningEffectQuietPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(), "MoffeinEliteReworkOverloadinLightningQuietVFX", false);
			EffectComponent component2 = lightningEffectQuietPrefab.GetComponent<EffectComponent>();
			component2.soundName = "Play_item_proc_chain_lightning";
			ContentAddition.AddEffect(lightningEffectQuietPrefab);
			lightningEffectOnHitPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(), "MoffeinEliteReworkOverloadinLightningOnHitVFX", false);
			EffectComponent component3 = lightningEffectOnHitPrefab.GetComponent<EffectComponent>();
			component3.soundName = "Play_mage_m1_impact_lightning";
			ContentAddition.AddEffect(lightningEffectOnHitPrefab);
			lightningProjectilePrefab = BuildLightningProjectile();
			lightningBossProjectilePrefab = BuildLightningBossProjectile();
			if (AffixBluePassiveLightning.scatterBombs)
			{
				scatterProjectilePrefab = BuildScatterProjectile();
			}
			else
			{
				lightningBombV2Prefab = BuildLightningBombV2();
			}
			AffixBluePassiveLightning.lightningProjectilePrefab = lightningProjectilePrefab;
			triggerSound = BuildTriggerSound();
			triggerBossSound = BuildTriggerBossSound();
			if (enableOnHitRework)
			{
				object obj = <>c.<>9__13_0;
				if (obj == null)
				{
					Manipulator val = delegate(ILContext il)
					{
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: Expected O, but got Unknown
						//IL_003f: Unknown result type (might be due to invalid IL or missing references)
						ILCursor val2 = new ILCursor(il);
						val2.GotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue")
						});
						val2.Remove();
						val2.Emit<EliteReworksPlugin>(OpCodes.Ldsfld, "EmptyBuff");
					};
					<>c.<>9__13_0 = val;
					obj = (object)val;
				}
				GlobalEventManager.OnHitAllProcess += (Manipulator)obj;
			}
			if (EliteReworksPlugin.affixBlueRemoveShield)
			{
				CharacterBody.RecalculateStats += new Manipulator(RemoveShields);
			}
			else if (EliteReworksPlugin.affixBlueReduceShield)
			{
				CharacterBody.RecalculateStats += new Manipulator(ReduceShields);
			}
		}

		private static GameObject BuildLightningProjectile()
		{
			//IL_008a: 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)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/ElectricWormSeekerProjectile"), "MoffeinEliteReworkOverloadinLightningProjectile", true);
			ProjectileController component = val.GetComponent<ProjectileController>();
			component.procCoefficient = 0f;
			AkEvent[] componentsInChildren = val.GetComponentsInChildren<AkEvent>();
			AkEvent[] array = componentsInChildren;
			foreach (AkEvent val2 in array)
			{
				Object.Destroy((Object)(object)val2);
			}
			Object.Destroy((Object)(object)val.GetComponent<AkGameObj>());
			ProjectileImpactExplosion component2 = val.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component2).blastProcCoefficient = 0f;
			((ProjectileExplosion)component2).blastRadius = 5f;
			component2.destroyOnEnemy = false;
			((ProjectileExplosion)component2).blastAttackerFiltering = (AttackerFiltering)2;
			((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
			component2.impactEffect = lightningEffectQuietPrefab;
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static GameObject BuildScatterProjectile()
		{
			//IL_008a: 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)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/ElectricWormSeekerProjectile"), "MoffeinEliteReworkOverloadinScatterProjectile", true);
			ProjectileController component = val.GetComponent<ProjectileController>();
			component.procCoefficient = 0f;
			AkEvent[] componentsInChildren = val.GetComponentsInChildren<AkEvent>();
			AkEvent[] array = componentsInChildren;
			foreach (AkEvent val2 in array)
			{
				Object.Destroy((Object)(object)val2);
			}
			Object.Destroy((Object)(object)val.GetComponent<AkGameObj>());
			ProjectileImpactExplosion component2 = val.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component2).blastProcCoefficient = 0f;
			((ProjectileExplosion)component2).blastRadius = 4f;
			component2.destroyOnEnemy = false;
			((ProjectileExplosion)component2).blastAttackerFiltering = (AttackerFiltering)2;
			((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
			component2.impactEffect = lightningEffectOnHitPrefab;
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static GameObject BuildLightningBossProjectile()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricOrbProjectile.prefab").WaitForCompletion(), "MoffeinEliteReworkOverloadinLightningBossProjectile", true);
			ProjectileController component = val.GetComponent<ProjectileController>();
			component.procCoefficient = 0f;
			AkEvent[] componentsInChildren = val.GetComponentsInChildren<AkEvent>();
			AkEvent[] array = componentsInChildren;
			foreach (AkEvent val2 in array)
			{
				Object.Destroy((Object)(object)val2);
			}
			Object.Destroy((Object)(object)val.GetComponent<AkGameObj>());
			ProjectileImpactExplosion component2 = val.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component2).blastProcCoefficient = 0f;
			((ProjectileExplosion)component2).blastRadius = 7f;
			component2.destroyOnEnemy = false;
			((ProjectileExplosion)component2).blastAttackerFiltering = (AttackerFiltering)2;
			((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)component2).fireChildren = false;
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static NetworkSoundEventDef BuildTriggerSound()
		{
			NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			val.eventName = "Play_EliteReworks_Lightning";
			((Object)val).name = "EliteReworksOverloadingNetworkSound";
			ContentAddition.AddNetworkSoundEventDef(val);
			return val;
		}

		private static NetworkSoundEventDef BuildTriggerBossSound()
		{
			NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			val.eventName = "Play_titanboss_shift_shoot";
			((Object)val).name = "EliteReworksOverloadingBossNetworkSound";
			ContentAddition.AddNetworkSoundEventDef(val);
			return val;
		}

		private static GameObject BuildLightningBombV2()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/LightningStake"), "MoffeinEliteReworksOverloadingStakeV2", true);
			ProjectileImpactExplosion component = val.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastRadius = 7f;
			((ProjectileExplosion)component).falloffModel = (FalloffModel)0;
			component.impactEffect = lightningEffectOnHitPrefab;
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static void RemoveShields(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue")
			});
			val.Remove();
			val.Emit<EliteReworksPlugin>(OpCodes.Ldsfld, "EmptyBuff");
		}

		private static void ReduceShields(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or mis