Decompiled source of EliteReworks v1.13.1

EliteReworks.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
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.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;
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+96c9812cdeae815570020f84326dced2dfb13ccd")]
[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.13.1")]
	[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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Expected O, but got Unknown
			//IL_022d: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_0266: Expected O, but got Unknown
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Expected O, but got Unknown
			//IL_029f: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Expected O, but got Unknown
			//IL_02d8: Expected O, but got Unknown
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0311: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Expected O, but got Unknown
			//IL_034a: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//IL_0383: Expected O, but got Unknown
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Expected O, but got Unknown
			//IL_03bc: Expected O, but got Unknown
			//IL_03d6: 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_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Expected O, but got Unknown
			//IL_045f: Expected O, but got Unknown
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Expected O, but got Unknown
			//IL_0494: Expected O, but got Unknown
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Expected O, but got Unknown
			//IL_04c9: Expected O, but got Unknown
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			//IL_04fe: Expected O, but got Unknown
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Expected O, but got Unknown
			//IL_0533: Expected O, but got Unknown
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Expected O, but got Unknown
			//IL_0568: Expected O, but got Unknown
			//IL_0582: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Expected O, but got Unknown
			//IL_059d: Expected O, but got Unknown
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Expected O, but got Unknown
			//IL_05d2: Expected O, but got Unknown
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Expected O, but got Unknown
			//IL_0607: Expected O, but got Unknown
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Expected O, but got Unknown
			//IL_063c: Expected O, but got Unknown
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Expected O, but got Unknown
			//IL_0671: Expected O, but got Unknown
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Expected O, but got Unknown
			//IL_06a6: Expected O, but got Unknown
			//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06db: Expected O, but got Unknown
			//IL_06db: Expected O, but got Unknown
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Expected O, but got Unknown
			//IL_0710: Expected O, but got Unknown
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_073b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0745: Expected O, but got Unknown
			//IL_0745: Expected O, but got Unknown
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_077a: Expected O, but got Unknown
			//IL_077a: Expected O, but got Unknown
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07af: Expected O, but got Unknown
			//IL_07af: 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.tGildedHonorDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 (Honor) Damage - Gilded"), 2f, 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.5f, 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.tGildedHealth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General", "T1 HP - Gilded"), 4f, 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"), 2f, 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 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 = 4f;

		public static float tGildedDamage = 2f;

		public static float tGildedHonorHealth = 3.5f;

		public static float tGildedHonorDamage = 2f;

		public static float t2Cost = 36f;

		public static float t2Health = 12f;

		public static float t2Damage = 3.5f;

		public static int t2MinStages = 5;

		public static void Setup()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			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;
			EliteDef[] eliteTypes2 = val2.eliteTypes;
			foreach (EliteDef ed2 in eliteTypes2)
			{
				ApplyT1HonorScaling(ed2);
			}
			EliteTierDef val3 = EliteAPI.VanillaEliteTiers[3];
			val2.costMultiplier = t1HonorCost;
			EliteDef[] eliteTypes3 = val2.eliteTypes;
			foreach (EliteDef ed3 in eliteTypes3)
			{
				ApplyT1HonorScaling(ed3);
			}
			EliteTierDef val4 = EliteAPI.VanillaEliteTiers[4];
			val4.costMultiplier = t1Cost;
			EliteDef[] eliteTypes4 = val4.eliteTypes;
			foreach (EliteDef ed4 in eliteTypes4)
			{
				ApplyT1Scaling(ed4);
			}
			EliteTierDef val5 = EliteAPI.VanillaEliteTiers[5];
			if (t2MinStages != 5)
			{
				val5.isAvailable = (EliteRules eliteRules) => Object.op_Implicit((Object)(object)Run.instance) && Run.instance.stageClearCount >= t2MinStages;
			}
			val5.costMultiplier = t2Cost;
			EliteDef[] eliteTypes5 = val5.eliteTypes;
			foreach (EliteDef val6 in eliteTypes5)
			{
				if ((Object)(object)val6 != (Object)null)
				{
					ApplyT2Scaling(val6);
				}
			}
		}

		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)Elites.AurelioniteHonor)
			{
				ed.healthBoostCoefficient = tGildedHonorHealth;
				ed.damageBoostCoefficient = tGildedHonorDamage;
			}
		}

		public static void ApplyT2Scaling(EliteDef ed)
		{
			ed.damageBoostCoefficient = t2Damage;
			ed.healthBoostCoefficient = t2Health;
		}
	}
}
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_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: 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_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: 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_015f: 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_0166: 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_0174: Unknown result type (might be due to invalid IL or missing references)
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: 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)
				//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: 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 affixPoisonDebuffAura = ((Component)self).gameObject.GetComponent<AffixPoisonDebuffAura>();
				if (!Object.op_Implicit((Object)(object)affixPoisonDebuffAura))
				{
					affixPoisonDebuffAura = ((Component)self).gameObject.AddComponent<AffixPoisonDebuffAura>();
				}
				if (!affixPoisonDebuffAura.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, (DamageTypeCombo?)null);
				}
			}

			internal float <SetupDebuff>b__10_0(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool isRegen)
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				int num = 0;
				if (Object.op_Implicit((Object)(object)self.body))
				{
					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_0137: Unknown result type (might be due to invalid IL or missing references)
					//IL_013c: 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_0154: Unknown result type (might be due to invalid IL or missing references)
					//IL_0156: 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_015f: 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_0166: 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_0174: Unknown result type (might be due to invalid IL or missing references)
					//IL_0179: Unknown result type (might be due to invalid IL or missing references)
					//IL_018a: Unknown result type (might be due to invalid IL or missing references)
					//IL_018c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0191: Unknown result type (might be due to invalid IL or missing references)
					//IL_0193: Unknown result type (might be due to invalid IL or missing references)
					//IL_0198: 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)
					//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ed: 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 affixPoisonDebuffAura = ((Component)self).gameObject.GetComponent<AffixPoisonDebuffAura>();
						if (!Object.op_Implicit((Object)(object)affixPoisonDebuffAura))
						{
							affixPoisonDebuffAura = ((Component)self).gameObject.AddComponent<AffixPoisonDebuffAura>();
						}
						if (!affixPoisonDebuffAura.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, (DamageTypeCombo?)null);
								}
							}
						}
					}
				};
				<>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_004e: Unknown result type (might be due to invalid IL or missing references)
					int num = 0;
					if (Object.op_Implicit((Object)(object)self.body))
					{
						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;

		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()
		{
			if (!Object.op_Implicit((Object)(object)ownerBody) || !ownerBody.HasBuff(Buffs.AffixHaunted) || !Object.op_Implicit((Object)(object)ownerBody.healthComponent) || !ownerBody.healthComponent.alive)
			{
				wardActive = false;
				if (NetworkServer.active && Object.op_Implicit((Object)(object)ownerBody.healthComponent) && !ownerBody.healthComponent.alive)
				{
					DestroyGhosts();
					ClearAliveMonsters();
				}
			}
			if (!NetworkServer.active)
			{
				return;
			}
			if (wardActive)
			{
				stopwatch += Time.fixedDeltaTime;
				if (stopwatch > refreshTime)
				{
					stopwatch -= refreshTime;
					if (attachedGhosts.Count + attachedAliveMonsters.Count < GetMaxGhosts())
					{
						FindAliveMonsters();
					}
					UpdateGhosts();
					UpdateAliveMonsters();
				}
			}
			else
			{
				ClearAliveMonsters();
			}
			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 missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_006e: 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.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f)
			});
			val.Remove();
			val.Emit(OpCodes.Ldc_R4, 0.25f);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(CharacterBody), "get_maxHealth"),
				(Instruction x) => ILPatternMatchingExt.MatchAdd(x)
			});
			int index = val.Index;
			val.Index = index + 1;
			val.EmitDelegate<Func<float, float>>((Func<float, float>)((float shieldToAdd) => shieldToAdd * (1f / 3f)));
		}
	}
	public static class AffixRed
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_UpdateFireTrail <>9__1_0;

			internal void <Setup>b__1_0(orig_UpdateFireTrail orig, CharacterBody self)
			{
				bool flag = self.HasBuff(Buffs.AffixRed);
				bool flag2 = false;
				EliteStunTracker eliteStunTracker = null;
				if (flag)
				{
					eliteStunTracker = ((Component)self).gameObject.GetComponent<EliteStunTracker>();
					if (!Object.op_Implicit((Object)(object)eliteStunTracker))
					{
						eliteStunTracker = ((Component)self).gameObject.AddComponent<EliteStunTracker>();
					}
					if (Object.op_Implicit((Object)(object)self.healthComponent) && self.healthComponent.isInFrozenState)
					{
						flag2 = true;
						eliteStunTracker.SetStun();
					}
					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))
							{
								flag2 = true;
								eliteStunTracker.SetStun();
							}
						}
					}
				}
				orig.Invoke(self);
				if (flag && Object.op_Implicit((Object)(object)self.fireTrail) && (flag2 || (Object.op_Implicit((Object)(object)eliteStunTracker) && !eliteStunTracker.PassiveActive())))
				{
					Object.Destroy((Object)(object)((Component)self.fireTrail).gameObject);
					self.fireTrail = null;
				}
			}
		}

		public static float fireTrailBaseDamage = 4.2000003f;

		public static void Setup()
		{
			//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__1_0;
			if (obj == null)
			{
				hook_UpdateFireTrail val = delegate(orig_UpdateFireTrail orig, CharacterBody self)
				{
					bool flag = self.HasBuff(Buffs.AffixRed);
					bool flag2 = false;
					EliteStunTracker eliteStunTracker = null;
					if (flag)
					{
						eliteStunTracker = ((Component)self).gameObject.GetComponent<EliteStunTracker>();
						if (!Object.op_Implicit((Object)(object)eliteStunTracker))
						{
							eliteStunTracker = ((Component)self).gameObject.AddComponent<EliteStunTracker>();
						}
						if (Object.op_Implicit((Object)(object)self.healthComponent) && self.healthComponent.isInFrozenState)
						{
							flag2 = true;
							el