Decompiled source of EliteReworks v2.0.1

EliteReworks2.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EliteReworks2.Common;
using EliteReworks2.Common.Components;
using EliteReworks2.Elites;
using EliteReworks2.Elites.Celestine.Components;
using EliteReworks2.Elites.Malachite.Components;
using EliteReworks2.Elites.Overloading.Components;
using EliteReworks2.Modules;
using EntityStates;
using EntityStates.Drifter.Bag;
using EntityStates.Gup;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates;
using On.EntityStates.Drifter.Bag;
using On.EntityStates.Gup;
using On.RoR2;
using On.RoR2.Projectile;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Audio;
using RoR2.ContentManagement;
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("EliteReworks2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b9a554e28f2662c5ad5286f176f6b0df5fb8778a")]
[assembly: AssemblyProduct("EliteReworks2")]
[assembly: AssemblyTitle("EliteReworks2")]
[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 EliteReworks2
{
	[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.EliteReworks2", "EliteReworks2", "2.0.1")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class EliteReworks2Plugin : BaseUnityPlugin
	{
		public const string pluginGUID = "com.Moffein.EliteReworks2";

		public const string pluginName = "EliteReworks2";

		public static PluginInfo info;

		internal void Awake()
		{
			info = ((BaseUnityPlugin)this).Info;
			new PluginContentPack().Initialize();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EliteReworks2.EliteReworks.bnk"))
			{
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				SoundBanks.Add(array);
			}
			ModCompat.Init();
			InitContent();
			ModifyEliteTiers.Init(((BaseUnityPlugin)this).Config);
			AddToAssembly();
		}

		private void InitContent()
		{
			Buffs.Init();
		}

		private void AddToAssembly()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
				select type;
			foreach (Type item in enumerable)
			{
				TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item);
				tweakBase.Init(((BaseUnityPlugin)this).Config);
			}
		}
	}
	public static class EliteReworks2Utils
	{
		public static float GetAmbientLevelDamageScalar()
		{
			float num = 1f;
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				num += 0.2f * ((float)Run.instance.ambientLevelFloor - 1f);
			}
			return num;
		}

		public static float GetAmbientLevelScaledDamage(float damage)
		{
			return damage * GetAmbientLevelDamageScalar();
		}

		public static NetworkSoundEventDef BuildNetworkSound(string eventName)
		{
			NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			val.eventName = eventName;
			((Object)val).name = "MoffeinEliteReworks_NSE_" + eventName;
			PluginContentPack.networkSoundEventDefs.Add(val);
			return val;
		}

		public static int BuffSphere(BuffDef buff, TeamIndex teamIndex, Vector3 position, float radius, float buffDuration, bool shouldTargetEnemies)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			float num2 = radius * radius;
			foreach (CharacterBody instances in CharacterBody.instancesList)
			{
				if (Object.op_Implicit((Object)(object)instances) && (!Object.op_Implicit((Object)(object)instances.teamComponent) || !(shouldTargetEnemies ? (instances.teamComponent.teamIndex == teamIndex) : (instances.teamComponent.teamIndex != teamIndex))))
				{
					Vector3 val = instances.corePosition - position;
					float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
					if (!(sqrMagnitude > num2))
					{
						instances.AddTimedBuff(buff, buffDuration);
						num++;
					}
				}
			}
			return num;
		}

		public static void DebuffSphereOverlap(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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_019b: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_01f5: 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)
			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;
				if (!Object.op_Implicit((Object)(object)healthComponent) || !Object.op_Implicit((Object)(object)healthComponent.body) || 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 class ModifyEliteTiers
	{
		public static float tier1Cost;

		public static float tier1HonorCost;

		public static float tier2Cost;

		public static int tier2MinStages;

		internal static void Init(ConfigFile config)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_002b: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_005f: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_0093: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00c3: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			tier1Cost = config.Bind<float>(new ConfigDefinition("Elite Tiers", "Tier 1 - Cost"), 4.5f, new ConfigDescription("Cost multiplier for this Elite tier. (Vanilla is 6)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			tier1HonorCost = config.Bind<float>(new ConfigDefinition("Elite Tiers", "Tier 1 (Honor) - Cost"), 3.5f, new ConfigDescription("Cost multiplier for this Elite tier. (Vanilla is 3.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			tier2Cost = config.Bind<float>(new ConfigDefinition("Elite Tiers", "Tier 2 - Cost"), 36f, new ConfigDescription("Cost multiplier for this Elite tier. (Vanilla is 36)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			tier2MinStages = config.Bind<int>(new ConfigDefinition("Elite Tiers", "Tier 2 - Minimum Stages"), 5, new ConfigDescription("Minimum stage completions before this tier becomes available. (Vanilla is 5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			CombatDirector.Init += new hook_Init(CombatDirector_Init);
		}

		private static void CombatDirector_Init(orig_Init orig)
		{
			orig.Invoke();
			EliteTierDef val = EliteAPI.VanillaEliteTiers[1];
			val.costMultiplier = tier1Cost;
			EliteTierDef val2 = EliteAPI.VanillaEliteTiers[2];
			val2.costMultiplier = tier1HonorCost;
			EliteTierDef val3 = EliteAPI.VanillaEliteTiers[3];
			val3.costMultiplier = tier1HonorCost;
			EliteTierDef val4 = EliteAPI.VanillaEliteTiers[4];
			val4.costMultiplier = tier1Cost;
			EliteTierDef val5 = EliteAPI.VanillaEliteTiers[5];
			if (tier2MinStages != 5)
			{
				val5.isAvailable = (EliteRules eliteRules) => Object.op_Implicit((Object)(object)Run.instance) && Run.instance.stageClearCount >= tier2MinStages;
			}
			val5.costMultiplier = tier2Cost;
		}
	}
}
namespace EliteReworks2.Modules
{
	internal static class ModCompat
	{
		public static bool zetAspectsLoaded;

		internal static void Init()
		{
			zetAspectsLoaded = Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetAspects");
		}
	}
	public class PluginContentPack : IContentPackProvider
	{
		[CompilerGenerated]
		private sealed class <FinalizeAsync>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FinalizeAsyncArgs args;

			public PluginContentPack <>4__this;

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

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

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

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

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

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

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

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

			private object <>2__current;

			public GetContentPackAsyncArgs args;

			public PluginContentPack <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				ContentPack.Copy(<>4__this.contentPack, args.output);
				args.ReportProgress(1f);
				return false;
			}

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

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

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

			private object <>2__current;

			public LoadStaticContentAsyncArgs args;

			public PluginContentPack <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>4__this.contentPack.identifier = <>4__this.identifier;
				<>4__this.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
				<>4__this.contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
				<>4__this.contentPack.buffDefs.Add(buffDefs.ToArray());
				<>4__this.contentPack.effectDefs.Add(effectDefs.ToArray());
				args.ReportProgress(1f);
				return false;
			}

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

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

		internal ContentPack contentPack = new ContentPack();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "com.Moffein.EliteReworks2";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__9))]
		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadStaticContentAsync>d__9(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__10))]
		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GenerateContentPackAsync>d__10(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<FinalizeAsync>d__11))]
		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinalizeAsync>d__11(0)
			{
				<>4__this = this,
				args = args
			};
		}
	}
}
namespace EliteReworks2.Elites
{
	public abstract class TweakBase<T> : TweakBase where T : TweakBase<T>
	{
		public static T Instance { get; private set; }

		public TweakBase()
		{
			if (Instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting TweakBase was instantiated twice");
			}
			Instance = this as T;
		}
	}
	public abstract class TweakBase
	{
		public abstract string ConfigCategoryString { get; }

		public abstract string ConfigOptionName { get; }

		public abstract string ConfigDescriptionString { get; }

		public ConfigEntry<bool> Enabled { get; private set; }

		protected virtual void ReadConfig(ConfigFile config)
		{
			Enabled = config.Bind<bool>(ConfigCategoryString, ConfigOptionName, true, ConfigDescriptionString);
		}

		internal void Init(ConfigFile config)
		{
			ReadConfig(config);
			if (Enabled.Value)
			{
				ApplyChanges();
			}
		}

		protected virtual void ApplyChanges()
		{
		}
	}
}
namespace EliteReworks2.Elites.Voidtouched
{
	public class Voidtouched : TweakBase<Voidtouched>
	{
		public static bool useRework;

		public static bool reworkBuffNullify;

		public float collapseBodyDamageBase = 8.4f;

		public float collapseBossBodyDamageBase = 11.2f;

		public override string ConfigCategoryString => "Voidtouched";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Voidtouched Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			//IL_0046: 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_0061: Expected O, but got Unknown
			//IL_0061: Expected O, but got Unknown
			base.ReadConfig(config);
			useRework = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Rework - Nullify on Hit"), true, new ConfigDescription("Attacks apply Nullify instead of Collapse.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			reworkBuffNullify = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Rework - Buff Nullify"), true, new ConfigDescription("Requires Rework - Nullify on Hit. Nullify only takes 2 stacks to root.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			base.ApplyChanges();
			if (useRework)
			{
				GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveVanillaVoidEliteCollapse);
				if (reworkBuffNullify)
				{
					CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(BuffNullify);
				}
				GlobalEventManager.ServerDamageDealt += new hook_ServerDamageDealt(GlobalEventManager_ServerDamageDealt);
				RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(AdjustVanillaVoidEliteStats);
			}
			else
			{
				GlobalEventManager.ProcessHitEnemy += new Manipulator(NormalizeCollapseDamage);
			}
		}

		private void GlobalEventManager_ServerDamageDealt(orig_ServerDamageDealt orig, DamageReport damageReport)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(damageReport);
			if (!damageReport.damageInfo.rejected && damageReport.damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)damageReport.attackerBody) && damageReport.attackerBody.HasBuff(Buffs.EliteVoid) && Object.op_Implicit((Object)(object)damageReport.victimBody) && !damageReport.victimBody.HasBuff(Buffs.Nullified) && Util.CheckRoll(100f * damageReport.damageInfo.procCoefficient, damageReport.attackerBody.master))
			{
				damageReport.victimBody.AddTimedBuff(Buffs.NullifyStack.buffIndex, 8f * damageReport.damageInfo.procCoefficient);
			}
		}

		private static void RemoveVanillaVoidEliteCollapse(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteVoid"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff")
			}))
			{
				val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool orig) => false));
			}
			else
			{
				Debug.LogError((object)"EliteReworks: RemoveVanillaVoidEliteCollapse IL hook failed.");
			}
		}

		private static void BuffNullify(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			orig.Invoke(self, buffDef, duration);
			if (NetworkServer.active && (Object)(object)buffDef == (Object)(object)Buffs.NullifyStack && !self.HasBuff(Buffs.Nullified))
			{
				int buffCount = self.GetBuffCount(buffDef);
				if (buffCount >= 2)
				{
					self.ClearTimedBuffs(buffDef);
					self.AddTimedBuff(Buffs.Nullified, 3f);
				}
			}
		}

		private static void AdjustVanillaVoidEliteStats(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(Buffs.EliteVoid))
			{
				args.damageMultAdd += 1.3f;
			}
		}

		private void NormalizeCollapseDamage(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "EliteVoid")
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f)
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<float, DamageInfo, float>>((Func<float, DamageInfo, float>)delegate(float damageMult, DamageInfo damageInfo)
				{
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Invalid comparison between Unknown and I4
					if (Object.op_Implicit((Object)(object)damageInfo.attacker))
					{
						CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component))
						{
							if (component.isPlayerControlled || (Object.op_Implicit((Object)(object)component.teamComponent) && (int)component.teamComponent.teamIndex == 1))
							{
								return damageMult;
							}
							float ambientLevelScaledDamage = EliteReworks2Utils.GetAmbientLevelScaledDamage(component.isChampion ? collapseBossBodyDamageBase : collapseBodyDamageBase);
							if (component.damage > ambientLevelScaledDamage)
							{
								return damageMult * (ambientLevelScaledDamage / component.damage);
							}
						}
					}
					return damageMult;
				});
			}
			else
			{
				Debug.LogError((object)"EliteReworks: NormalizeCollapseDamage IL hook failed.");
			}
		}
	}
}
namespace EliteReworks2.Elites.Twisted
{
	public class Twisted : TweakBase<Twisted>
	{
		public static class Assets
		{
			public static class Projectiles
			{
				public static GameObject UnshootableEliteBeadProjectile;
			}

			internal static void Init()
			{
				CreateUnshootableEliteBeadProjectile();
			}

			private static void CreateUnshootableEliteBeadProjectile()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)Projectiles.UnshootableEliteBeadProjectile))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Elites/EliteBead/BeadProjectileTrackingBomb.prefab").WaitForCompletion(), "MoffeinEliteReworks_UnshootableTwistedProjectile", true);
					HurtBox[] componentsInChildren = val.GetComponentsInChildren<HurtBox>();
					HurtBox[] array = componentsInChildren;
					foreach (HurtBox val2 in array)
					{
						((Behaviour)val2).enabled = false;
					}
					HealthComponent component = val.GetComponent<HealthComponent>();
					component.dontShowHealthbar = true;
					PluginContentPack.projectilePrefabs.Add(val);
					Projectiles.UnshootableEliteBeadProjectile = val;
				}
			}
		}

		public static float healthBoostCoefficient;

		public static float damageBoostCoefficient;

		public static float passiveBodyDamage = 48f;

		public static float passiveBodyDamageBoss = 64f;

		public static bool projectileIsUnshootable;

		public override string ConfigCategoryString => "T2 - Twisted";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Twisted Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: 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_0034: Expected O, but got Unknown
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_009a: Expected O, but got Unknown
			base.ReadConfig(config);
			healthBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Health Multiplier"), 16f, new ConfigDescription("Health multiplier for this Elite Type. (Vanilla = 18)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Damage Multiplier"), 4f, new ConfigDescription("Damage multiplier for this Elite Type. (Vanilla = 6)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			projectileIsUnshootable = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Projectile is Unshootable"), true, new ConfigDescription("Twisted projectile cannot be destroyed.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			base.ApplyChanges();
			ModifyStats();
			Assets.Init();
			ModifyAttachment();
			AffixBeadAttachment.FireProjectile += new Manipulator(NormalizeDamage);
			MakeProjectileUnshootable();
		}

		private void ModifyStats()
		{
			//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)
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC2/Elites/EliteBead/edBead.asset").WaitForCompletion();
			val.healthBoostCoefficient = healthBoostCoefficient;
			val.damageBoostCoefficient = damageBoostCoefficient;
		}

		private void ModifyAttachment()
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Elites/EliteBead/AffixBeadBodyAttachment.prefab").WaitForCompletion();
			AffixBeadAttachment component = val.GetComponent<AffixBeadAttachment>();
			component.damageCooldown = 0.01f;
			component.fireDelay = 1.5f;
			component.cooldownAfterFiring = 6f;
			component.maxAllies = 10;
		}

		private void NormalizeDamage(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_damage")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<float, AffixBeadAttachment, float>>((Func<float, AffixBeadAttachment, float>)delegate(float damage, AffixBeadAttachment self)
				{
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Invalid comparison between Unknown and I4
					CharacterBody val3 = null;
					if (Object.op_Implicit((Object)(object)self.networkedBodyAttachment))
					{
						val3 = self.networkedBodyAttachment.attachedBody;
					}
					return Object.op_Implicit((Object)(object)val3) ? ((val3.isPlayerControlled || (Object.op_Implicit((Object)(object)val3.teamComponent) && (int)val3.teamComponent.teamIndex == 1)) ? damage : EliteReworks2Utils.GetAmbientLevelScaledDamage(val3.isChampion ? passiveBodyDamageBoss : passiveBodyDamage)) : EliteReworks2Utils.GetAmbientLevelScaledDamage(passiveBodyDamage);
				});
			}
			else
			{
				Debug.LogError((object)"EliteReworks: AffixBead NormalizeDamage Player IL hook failed.");
			}
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_damage")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<float, AffixBeadAttachment, float>>((Func<float, AffixBeadAttachment, float>)delegate(float damage, AffixBeadAttachment self)
				{
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Invalid comparison between Unknown and I4
					CharacterBody val2 = null;
					if (Object.op_Implicit((Object)(object)self.networkedBodyAttachment))
					{
						val2 = self.networkedBodyAttachment.attachedBody;
					}
					return Object.op_Implicit((Object)(object)val2) ? ((val2.isPlayerControlled || (Object.op_Implicit((Object)(object)val2.teamComponent) && (int)val2.teamComponent.teamIndex == 1)) ? damage : EliteReworks2Utils.GetAmbientLevelScaledDamage(val2.isChampion ? passiveBodyDamageBoss : passiveBodyDamage)) : EliteReworks2Utils.GetAmbientLevelScaledDamage(passiveBodyDamage);
				});
			}
			else
			{
				Debug.LogError((object)"EliteReworks: AffixBead NormalizeDamage IL hook failed.");
			}
		}

		private void MakeProjectileUnshootable()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (projectileIsUnshootable)
			{
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Elites/EliteBead/AffixBeadBodyAttachment.prefab").WaitForCompletion();
				AffixBeadAttachment component = val.GetComponent<AffixBeadAttachment>();
				component.projectilePrefab = Assets.Projectiles.UnshootableEliteBeadProjectile;
			}
		}
	}
}
namespace EliteReworks2.Elites.Overloading
{
	public class Overloading : TweakBase<Overloading>
	{
		public static class Assets
		{
			public static class Effects
			{
				public static GameObject LightningQuiet;

				public static GameObject LightningOnHit;
			}

			public static class Projectiles
			{
				public static GameObject OnHitLightningBomb;

				public static GameObject PassiveLightningBomb;

				public static GameObject PassiveLightningBombBoss;
			}

			public static class NetworkSoundEvents
			{
				public static NetworkSoundEventDef PassiveTrigger;

				public static NetworkSoundEventDef PassiveTriggerBoss;
			}

			internal static void Init()
			{
				if (!Object.op_Implicit((Object)(object)NetworkSoundEvents.PassiveTrigger))
				{
					NetworkSoundEvents.PassiveTrigger = EliteReworks2Utils.BuildNetworkSound("Play_EliteReworks_Lightning");
				}
				if (!Object.op_Implicit((Object)(object)NetworkSoundEvents.PassiveTriggerBoss))
				{
					NetworkSoundEvents.PassiveTriggerBoss = EliteReworks2Utils.BuildNetworkSound("Play_titanboss_shift_shoot");
				}
				BuildLightningEffectQuiet();
				BuildLightningEffectOnHit();
				BuildPassiveLightningBomb();
				BuildPassiveLightningBombBoss();
				BuildOnHitLightningBomb();
			}

			private static void BuildLightningEffectQuiet()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)Effects.LightningQuiet))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(), "MoffeinEliteReworks_OverloadingLightningQuiteEffect", false);
					EffectComponent component = val.GetComponent<EffectComponent>();
					component.soundName = "Play_item_proc_chain_lightning";
					PluginContentPack.effectDefs.Add(new EffectDef(val));
					Effects.LightningQuiet = val;
				}
			}

			private static void BuildLightningEffectOnHit()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)Effects.LightningOnHit))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(), "MoffeinEliteReworks_OverloadingLightningOnHitEffect", false);
					EffectComponent component = val.GetComponent<EffectComponent>();
					component.soundName = "Play_mage_m1_impact_lightning";
					PluginContentPack.effectDefs.Add(new EffectDef(val));
					Effects.LightningOnHit = val;
				}
			}

			private static void BuildPassiveLightningBomb()
			{
				//IL_001b: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)Projectiles.PassiveLightningBomb))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricWormSeekerProjectile.prefab").WaitForCompletion(), "MoffeinEliteReworks_OverloadinPassiveProjectile", 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 = Effects.LightningQuiet;
					PluginContentPack.projectilePrefabs.Add(val);
					Projectiles.PassiveLightningBomb = val;
				}
			}

			private static void BuildPassiveLightningBombBoss()
			{
				//IL_001b: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)Projectiles.PassiveLightningBombBoss))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricOrbProjectile.prefab").WaitForCompletion(), "MoffeinEliteReworks_OverloadinPassiveBossProjectile", 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;
					PluginContentPack.projectilePrefabs.Add(val);
					Projectiles.PassiveLightningBombBoss = val;
				}
			}

			private static void BuildOnHitLightningBomb()
			{
				//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_0033: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStake.prefab").WaitForCompletion(), "MoffeinEliteReworks_OverloadingStakeProjectile", true);
				ProjectileImpactExplosion component = val.GetComponent<ProjectileImpactExplosion>();
				((ProjectileExplosion)component).blastRadius = 7f;
				((ProjectileExplosion)component).falloffModel = (FalloffModel)0;
				component.impactEffect = Effects.LightningOnHit;
				PluginContentPack.projectilePrefabs.Add(val);
				Projectiles.OnHitLightningBomb = val;
			}
		}

		public static float zapDamage;

		public static float zapDamageBoss;

		public static float healthBoostCoefficient;

		public static float damageBoostCoefficient;

		public static float healthBoostCoefficientHonor;

		public static float damageBoostCoefficientHonor;

		public static bool reworkOnHit;

		public static bool removeShield;

		public static bool reduceShield;

		public static bool passiveLightning;

		public override string ConfigCategoryString => "T1 - Overloading";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Overloading Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: 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_0034: Expected O, but got Unknown
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d3: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0104: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0135: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_0166: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_0197: Expected O, but got Unknown
			base.ReadConfig(config);
			healthBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Health Multiplier"), 3f, new ConfigDescription("Health multiplier for this Elite Type. (Vanilla = 4)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Damage Multiplier"), 1.5f, new ConfigDescription("Damage multiplier for this Elite Type. (Vanilla = 2)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			healthBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Health Multiplier"), 2.5f, new ConfigDescription("Health multiplier for this Elite Type when Honor is enabled. (Vanilla = 2.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Damage Multiplier"), 1.5f, new ConfigDescription("Damage multiplier for this Elite Type when Honor is enabled. (Vanilla = 1.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			reworkOnHit = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Bigger Overloading Bombs"), true, new ConfigDescription("Overloading bombs have a much larger blast radius.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			removeShield = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Shield - Remove Shield"), true, new ConfigDescription("Removes passive shield.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			reduceShield = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Shield - Reduce Shield"), false, new ConfigDescription("Requires Remove Shield = false. Reduces passive shield from 50% to 25%.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			passiveLightning = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Passive Lightning"), true, new ConfigDescription("Overloading Elites periodically fire lightning bombs around themselves.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			base.ApplyChanges();
			ModifyStats();
			Assets.Init();
			ReworkOnHitEffect();
			ModifyShield();
			PassiveLightning();
		}

		private void ModifyStats()
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteLightning/edLightning.asset").WaitForCompletion();
			val.healthBoostCoefficient = healthBoostCoefficient;
			val.damageBoostCoefficient = damageBoostCoefficient;
			EliteDef val2 = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteLightning/edLightningHonor.asset").WaitForCompletion();
			val2.healthBoostCoefficient = healthBoostCoefficientHonor;
			val2.damageBoostCoefficient = damageBoostCoefficientHonor;
		}

		private void ReworkOnHitEffect()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (reworkOnHit)
			{
				GlobalEventManager.OnHitAllProcess += new Manipulator(RemoveVanillaOnHit);
				GlobalEventManager.OnHitAllProcess += new hook_OnHitAllProcess(BiggerLightningBombOnHit);
			}
		}

		private void RemoveVanillaOnHit(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff")
			}))
			{
				val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool orig) => false));
			}
			else
			{
				Debug.LogError((object)"EliteReworks: AffixBlue RemoveVanillaOverloadingOnHit IL hook failed.");
			}
		}

		private void BiggerLightningBombOnHit(orig_OnHitAllProcess orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hitObject)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, hitObject);
			if (NetworkServer.active && damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.HasBuff(Buffs.AffixBlue))
				{
					ProjectileManager.instance.FireProjectile(Assets.Projectiles.OnHitLightningBomb, damageInfo.position, Quaternion.identity, damageInfo.attacker, damageInfo.damage * 0.5f, 0f, damageInfo.crit, (DamageColorIndex)3, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
		}

		private void ModifyShield()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			if (removeShield || reduceShield)
			{
				if (removeShield)
				{
					CharacterBody.RecalculateStats += new Manipulator(RemoveShields);
				}
				else
				{
					CharacterBody.RecalculateStats += new Manipulator(ReduceShields);
				}
			}
		}

		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
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "HasBuff")
			}))
			{
				val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool orig) => false));
			}
			else
			{
				Debug.LogError((object)"EliteReworks: AffixBlue RemoveShields IL hook failed.");
			}
		}

		private static void ReduceShields(ILContext il)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			bool flag = true;
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixBlue")
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f)
			}))
			{
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float orig) => orig * 0.5f));
				if (val.TryGotoNext(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 / 3f));
					flag = false;
				}
			}
			if (flag)
			{
				Debug.LogError((object)"EliteReworks: AffixBlue ReduceShields IL hook failed.");
			}
		}

		private void PassiveLightning()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			if (passiveLightning)
			{
				CharacterBody.OnClientBuffsChanged += new hook_OnClientBuffsChanged(CharacterBody_OnClientBuffsChanged);
			}
		}

		private void CharacterBody_OnClientBuffsChanged(orig_OnClientBuffsChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (self.HasBuff(Buffs.AffixBlue))
			{
				PassiveLightningComponent component = ((Component)self).GetComponent<PassiveLightningComponent>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					component = ((Component)self).gameObject.AddComponent<PassiveLightningComponent>();
					component.characterBody = self;
				}
			}
		}
	}
}
namespace EliteReworks2.Elites.Overloading.Components
{
	public class PassiveLightningComponent : MonoBehaviour
	{
		public float lightingDelay = 6f;

		public float playerDamageCoefficient = 3f;

		public float flatDamageNPC = 36f;

		public float flatDamageNPCBoss = 57.6f;

		public CharacterBody characterBody;

		private float timer = 0f;

		private void Start()
		{
			if (!Object.op_Implicit((Object)(object)characterBody))
			{
				characterBody = ((Component)this).GetComponent<CharacterBody>();
			}
			if (!Object.op_Implicit((Object)(object)characterBody))
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void FixedUpdate()
		{
			if (!Object.op_Implicit((Object)(object)characterBody) || !characterBody.HasBuff(Buffs.AffixBlue) || !Object.op_Implicit((Object)(object)characterBody.healthComponent) || !characterBody.healthComponent.alive)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			if (characterBody.HasBuff(Buffs.DisablePassiveEffect))
			{
				timer = 0f;
				return;
			}
			timer += Time.fixedDeltaTime;
			if (timer >= lightingDelay)
			{
				timer -= lightingDelay;
				FireLightningAuthority();
			}
		}

		public void FireLightningAuthority()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Invalid comparison between Unknown and I4
			//IL_00ad: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (characterBody.hasEffectiveAuthority)
			{
				float damage = (characterBody.isChampion ? EliteReworks2Utils.GetAmbientLevelScaledDamage(flatDamageNPCBoss) : EliteReworks2Utils.GetAmbientLevelScaledDamage(flatDamageNPC));
				if (characterBody.isPlayerControlled || (Object.op_Implicit((Object)(object)characterBody.teamComponent) && (int)characterBody.teamComponent.teamIndex == 1))
				{
					damage = characterBody.damage * playerDamageCoefficient;
				}
				FireMeatballs(((Component)this).gameObject, characterBody.isChampion, damage, characterBody.RollCrit(), Vector3.up, characterBody.corePosition + Vector3.up, characterBody.transform.forward, 5, 20f, 400f, characterBody.isChampion ? 25f : 20f);
			}
		}

		public void FireMeatballs(GameObject attacker, bool isChampion, float damage, bool crit, Vector3 impactNormal, Vector3 impactPosition, Vector3 forward, int meatballCount, float meatballAngle, float meatballForce, float velocity)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_003a: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			EffectManager.SimpleSoundEffect((isChampion ? Overloading.Assets.NetworkSoundEvents.PassiveTriggerBoss : Overloading.Assets.NetworkSoundEvents.PassiveTrigger).index, impactPosition, true);
			float num = 360f / (float)meatballCount;
			float num2 = Random.Range(0f, 360f);
			Vector3 val = Vector3.ProjectOnPlane(forward, impactNormal);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 zero = Vector3.zero;
			zero = Vector3.RotateTowards(impactNormal, normalized, meatballAngle * (MathF.PI / 180f), float.PositiveInfinity);
			bool flag = false;
			for (int i = 0; i < meatballCount; i++)
			{
				Vector3 val2 = Quaternion.AngleAxis(num2 + num * (float)i, impactNormal) * zero;
				GameObject val3 = (isChampion ? Overloading.Assets.Projectiles.PassiveLightningBombBoss : Overloading.Assets.Projectiles.PassiveLightningBomb);
				ProjectileManager.instance.FireProjectile(val3, impactPosition, Util.QuaternionSafeLookRotation(val2), attacker, damage, meatballForce, crit, (DamageColorIndex)0, (GameObject)null, velocity, (DamageTypeCombo?)null);
			}
		}
	}
}
namespace EliteReworks2.Elites.Mending
{
	public class Mending : TweakBase<Mending>
	{
		public static float healthBoostCoefficient;

		public static float damageBoostCoefficient;

		public static float healthBoostCoefficientHonor;

		public static float damageBoostCoefficientHonor;

		public override string ConfigCategoryString => "T1 - Mending";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Mending Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: 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_0034: Expected O, but got Unknown
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d3: Expected O, but got Unknown
			base.ReadConfig(config);
			healthBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Health Multiplier"), 3f, new ConfigDescription("Health multiplier for this Elite Type. (Vanilla = 3)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Damage Multiplier"), 1.5f, new ConfigDescription("Damage multiplier for this Elite Type. (Vanilla = 2)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			healthBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Health Multiplier"), 1.5f, new ConfigDescription("Health multiplier for this Elite Type when Honor is enabled. (Vanilla = 1.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Damage Multiplier"), 1.5f, new ConfigDescription("Damage multiplier for this Elite Type when Honor is enabled. (Vanilla = 1.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			base.ApplyChanges();
			ModifyStats();
			FixHealCore();
			AffixEarthBehavior.FixedUpdate += new hook_FixedUpdate(AffixEarthBehavior_FixedUpdate);
		}

		private void FixHealCore()
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteEarth/AffixEarthHealerBody.prefab").WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.levelMaxHealth = component.baseMaxHealth * 0.3f;
			component.levelDamage = component.baseDamage * 0.2f;
		}

		private void AffixEarthBehavior_FixedUpdate(orig_FixedUpdate orig, AffixEarthBehavior self)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((ItemBehavior)self).body) && ((ItemBehavior)self).body.HasBuff(Buffs.DisablePassiveEffect) && Object.op_Implicit((Object)(object)self.affixEarthAttachment))
			{
				Object.Destroy((Object)(object)self.affixEarthAttachment);
				self.affixEarthAttachment = null;
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void ModifyStats()
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC1/EliteEarth/edEarth.asset").WaitForCompletion();
			val.healthBoostCoefficient = healthBoostCoefficient;
			val.damageBoostCoefficient = damageBoostCoefficient;
			EliteDef val2 = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC1/EliteEarth/edEarthHonor.asset").WaitForCompletion();
			val2.healthBoostCoefficient = healthBoostCoefficientHonor;
			val2.damageBoostCoefficient = damageBoostCoefficientHonor;
		}
	}
}
namespace EliteReworks2.Elites.Malachite
{
	public class Malachite : TweakBase<Malachite>
	{
		public static class Assets
		{
			public static class Projectiles
			{
				public static GameObject MalachiteOrbModded;

				public static GameObject MalachiteStakeModded;
			}

			public static class DamageTypes
			{
				public static ModdedDamageType MalachiteSpike;
			}

			public static class Buffs
			{
				public static BuffDef MalachiteBuildup;
			}

			public static class NetworkObjects
			{
				public static GameObject AntiHealAuraIndicator;
			}

			internal static void Init()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				DamageTypes.MalachiteSpike = DamageAPI.ReserveDamageType();
				GlobalEventManager.ServerDamageDealt += new hook_ServerDamageDealt(MalachiteSpike);
				CreateMalachiteBuildup();
				CreateAntiHealAuraIndicator();
				CreateMalachiteStakeModded();
				CreateMalachiteOrbModded();
			}

			private static void CreateMalachiteOrbModded()
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)Projectiles.MalachiteOrbModded))
				{
					if (!Object.op_Implicit((Object)(object)Projectiles.MalachiteStakeModded))
					{
						CreateMalachiteStakeModded();
					}
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElitePoison/PoisonOrbProjectile.prefab").WaitForCompletion(), "MoffeinEliteReworks_MalachiteOrbModded", true);
					ProjectileDamage component = val.GetComponent<ProjectileDamage>();
					component.damageType = DamageTypeCombo.op_Implicit((DamageType)1);
					DamageAPI.AddModdedDamageType(ref component.damageType, DamageTypes.MalachiteSpike);
					PluginContentPack.projectilePrefabs.Add(val);
					Projectiles.MalachiteOrbModded = val;
					((ProjectileExplosion)val.GetComponent<ProjectileImpactExplosion>()).childrenProjectilePrefab = Projectiles.MalachiteStakeModded;
				}
			}

			private static void CreateMalachiteStakeModded()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)Projectiles.MalachiteStakeModded))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElitePoison/PoisonStakeProjectile.prefab").WaitForCompletion(), "MoffeinEliteReworks_MalachiteStakeModded", true);
					ProjectileDamage component = val.GetComponent<ProjectileDamage>();
					component.damageType = DamageTypeCombo.op_Implicit((DamageType)1);
					DamageAPI.AddModdedDamageType(ref component.damageType, DamageTypes.MalachiteSpike);
					PluginContentPack.projectilePrefabs.Add(val);
					Projectiles.MalachiteStakeModded = val;
				}
			}

			private static void MalachiteSpike(orig_ServerDamageDealt orig, DamageReport damageReport)
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(damageReport);
				if (Object.op_Implicit((Object)(object)damageReport.victimBody) && !damageReport.damageInfo.rejected && damageReport.damageInfo.procCoefficient > 0f && DamageAPI.HasModdedDamageType(damageReport.damageInfo, DamageTypes.MalachiteSpike))
				{
					damageReport.victimBody.AddTimedBuff(Buffs.HealingDisabled, 8f);
				}
			}

			private static void CreateMalachiteBuildup()
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Expected O, but got Unknown
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)Buffs.MalachiteBuildup))
				{
					BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
					val.isDebuff = true;
					val.isHidden = false;
					val.isDOT = false;
					val.isCooldown = false;
					val.canStack = true;
					val.buffColor = new Color(0.3f, 0.3f, 0.3f);
					val.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/ElitePoison/texBuffHealingDisabledIcon.tif").WaitForCompletion();
					((Object)val).name = "MoffeinEliteReworks_MalachiteBuildup";
					PluginContentPack.buffDefs.Add(val);
					Buffs.MalachiteBuildup = val;
					HealthComponent.Heal += new hook_Heal(ReduceHealing);
					CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(MalachiteBuildupBehavior);
				}
			}

			private static float ReduceHealing(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)self.body))
				{
					int buffCount = self.body.GetBuffCount(Buffs.MalachiteBuildup);
					amount *= 1f - Mathf.Min(1f, 0.2f * (float)buffCount);
				}
				return orig.Invoke(self, amount, procChainMask, nonRegen);
			}

			private static void MalachiteBuildupBehavior(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
			{
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)buffDef == (Object)(object)Buffs.MalachiteBuildup)
				{
					if (self.HasBuff(Buffs.HealingDisabled))
					{
						self.ClearTimedBuffs(Buffs.MalachiteBuildup);
						orig.Invoke(self, Buffs.HealingDisabled, duration);
						return;
					}
					int buffCount = self.GetBuffCount(Buffs.MalachiteBuildup);
					if (buffCount >= 4)
					{
						self.ClearTimedBuffs(Buffs.MalachiteBuildup);
						orig.Invoke(self, Buffs.HealingDisabled, duration);
						return;
					}
					if (buffCount > 0)
					{
						foreach (TimedBuff timedBuff in self.timedBuffs)
						{
							if (timedBuff.buffIndex == Buffs.MalachiteBuildup.buffIndex && timedBuff.timer < duration)
							{
								timedBuff.timer = duration;
							}
						}
					}
				}
				else if ((Object)(object)buffDef == (Object)(object)Buffs.HealingDisabled)
				{
					self.ClearTimedBuffs(Buffs.MalachiteBuildup);
				}
				orig.Invoke(self, buffDef, duration);
			}

			private static void CreateAntiHealAuraIndicator()
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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_0059: 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)
				if (!Object.op_Implicit((Object)(object)NetworkObjects.AntiHealAuraIndicator))
				{
					GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/NearbyDamageBonus/NearbyDamageBonusIndicator.prefab").WaitForCompletion(), "MoffeinEliteReworks_PoisonIndicator", true);
					val.transform.localScale = AntiHealAuraServer.wardRadius / 13f * Vector3.one;
					Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/ElitePoison/matElitePoisonAreaIndicator.mat").WaitForCompletion();
					MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>();
					MeshRenderer[] array = componentsInChildren;
					foreach (MeshRenderer val2 in array)
					{
						((Renderer)val2).material = material;
					}
					PrefabAPI.RegisterNetworkPrefab(val);
					NetworkObjects.AntiHealAuraIndicator = val;
				}
			}
		}

		public static float playerDamageCoefficient = 4f;

		public static float spikeDamage = 48f;

		public static float spikeDamageBoss = 64f;

		public static float healthBoostCoefficient;

		public static float damageBoostCoefficient;

		public static bool antiHealAura;

		public override string ConfigCategoryString => "T2 - Malachite";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Malachite Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: 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_0034: Expected O, but got Unknown
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_009a: Expected O, but got Unknown
			base.ReadConfig(config);
			healthBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Health Multiplier"), 16f, new ConfigDescription("Health multiplier for this Elite Type. (Vanilla = 18)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Damage Multiplier"), 4f, new ConfigDescription("Damage multiplier for this Elite Type. (Vanilla = 6)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			antiHealAura = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Rework - Antiheal Aura"), true, new ConfigDescription("Malachite Elites gradually apply antiheal to nearby enemies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			base.ApplyChanges();
			ModifyStats();
			Assets.Init();
			CharacterBody.UpdateAffixPoison += new hook_UpdateAffixPoison(UpdateAffixPoisonEliteReworks);
			if (antiHealAura)
			{
				CharacterBody.OnClientBuffsChanged += new hook_OnClientBuffsChanged(CharacterBody_OnClientBuffsChanged);
			}
		}

		private void CharacterBody_OnClientBuffsChanged(orig_OnClientBuffsChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && self.HasBuff(Buffs.AffixPoison))
			{
				AntiHealAuraServer component = ((Component)self).GetComponent<AntiHealAuraServer>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					component = ((Component)self).gameObject.AddComponent<AntiHealAuraServer>();
					component.characterBody = self;
				}
			}
		}

		private void UpdateAffixPoisonEliteReworks(orig_UpdateAffixPoison orig, CharacterBody self, float deltaTime)
		{
			//IL_0073: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Invalid comparison between Unknown and I4
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			if (!self.itemAvailability.hasAffixPoison || self.HasBuff(Buffs.DisablePassiveEffect))
			{
				self.poisonballTimer = 0f;
				return;
			}
			self.poisonballTimer += deltaTime;
			if (!(self.poisonballTimer >= 6f))
			{
				return;
			}
			self.poisonballTimer -= 6f;
			int num = 3 + (int)self.radius;
			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 = EliteReworks2Utils.GetAmbientLevelScaledDamage(self.isChampion ? spikeDamageBoss : spikeDamage);
				if (self.isPlayerControlled || (Object.op_Implicit((Object)(object)self.teamComponent) && (int)self.teamComponent.teamIndex == 1))
				{
					num3 = self.damage * playerDamageCoefficient;
				}
				ProjectileManager.instance.FireProjectile(Assets.Projectiles.MalachiteOrbModded, self.corePosition, Util.QuaternionSafeLookRotation(val3), ((Component)self).gameObject, num3, 0f, self.RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
			}
		}

		private void ModifyStats()
		{
			//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)
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/ElitePoison/edPoison.asset").WaitForCompletion();
			val.healthBoostCoefficient = healthBoostCoefficient;
			val.damageBoostCoefficient = damageBoostCoefficient;
		}
	}
}
namespace EliteReworks2.Elites.Malachite.Components
{
	public class AntiHealAuraServer : MonoBehaviour
	{
		public static float wardRadius = 25f;

		public static float refreshTime = 0.5f;

		public static float buffDuration = 1f;

		public CharacterBody characterBody;

		private float stopwatch = 0f;

		private GameObject indicator;

		private void Start()
		{
			if (!Object.op_Implicit((Object)(object)characterBody))
			{
				characterBody = ((Component)this).GetComponent<CharacterBody>();
			}
			if (!Object.op_Implicit((Object)(object)characterBody) || !NetworkServer.active)
			{
				Object.Destroy((Object)(object)this);
			}
			UpdateIndicatorServer(wardActive: true);
		}

		private void FixedUpdate()
		{
			//IL_00c1: 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)
			//IL_00e1: Expected O, but got I4
			//IL_00c6->IL00c6: Incompatible stack types: O vs I4
			//IL_00b6->IL00c6: Incompatible stack types: I4 vs O
			//IL_00b6->IL00c6: Incompatible stack types: O vs I4
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)characterBody) || !characterBody.HasBuff(Buffs.AffixPoison) || !Object.op_Implicit((Object)(object)characterBody.healthComponent) || !characterBody.healthComponent.alive)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= refreshTime)
			{
				stopwatch -= refreshTime;
				object obj = Malachite.Assets.Buffs.MalachiteBuildup;
				int num;
				if (Object.op_Implicit((Object)(object)characterBody.teamComponent))
				{
					obj = characterBody.teamComponent.teamIndex;
					num = (int)obj;
				}
				else
				{
					num = -1;
					obj = num;
					num = (int)obj;
				}
				EliteReworks2Utils.BuffSphere((BuffDef)(object)num, (TeamIndex)obj, ((Component)this).transform.position, wardRadius, buffDuration, shouldTargetEnemies: true);
			}
		}

		private void OnDestroy()
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)indicator))
			{
				Object.Destroy((Object)(object)indicator);
				indicator = null;
			}
		}

		public void UpdateIndicatorServer(bool wardActive)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)indicator) != wardActive)
			{
				if (wardActive)
				{
					indicator = Object.Instantiate<GameObject>(Malachite.Assets.NetworkObjects.AntiHealAuraIndicator);
					indicator.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
				}
				else
				{
					Object.Destroy((Object)(object)indicator);
					indicator = null;
				}
			}
		}
	}
}
namespace EliteReworks2.Elites.Glacial
{
	public class Glacial : TweakBase<Glacial>
	{
		public static class Assets
		{
			public static class NetworkSoundEvents
			{
				public static NetworkSoundEventDef SlowApplied;
			}

			public static class Effects
			{
				public static GameObject GlacialOnHitExplosion;
			}

			public static class Buffs
			{
				public static BuffDef Slow80Alt;
			}

			internal static void Init()
			{
				if (!Object.op_Implicit((Object)(object)NetworkSoundEvents.SlowApplied))
				{
					NetworkSoundEvents.SlowApplied = EliteReworks2Utils.BuildNetworkSound("Play_mage_m2_iceSpear_shoot");
				}
				BuildGlacialOnHitExplosion();
				BuildSlow80Alt();
			}

			private static void BuildSlow80Alt()
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Expected O, but got Unknown
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)Buffs.Slow80Alt))
				{
					BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdSlow80.asset").WaitForCompletion();
					BuffDef val2 = ScriptableObject.CreateInstance<BuffDef>();
					val2.isDebuff = true;
					val2.isHidden = false;
					val2.isDOT = false;
					val2.isCooldown = false;
					val2.iconSprite = val.iconSprite;
					val2.buffColor = val.buffColor;
					val2.canStack = false;
					((Object)val2).name = "MoffeinEliteReworks_Slow80Alt";
					PluginContentPack.buffDefs.Add(val2);
					Buffs.Slow80Alt = val2;
					RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Slow80AltStats);
					CharacterModel.UpdateOverlays += new Manipulator(Slow80AltOverlay);
				}
			}

			private static void Slow80AltStats(CharacterBody sender, StatHookEventArgs args)
			{
				if (sender.HasBuff(Buffs.Slow80Alt) && !sender.HasBuff(Buffs.Slow80))
				{
					args.moveSpeedReductionMultAdd += 0.8f;
				}
			}

			private static void Slow80AltOverlay(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Slow80")
				}))
				{
					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(Buffs.Slow80Alt)));
				}
				else
				{
					Debug.LogError((object)"EliteReworks: Slow80AltOverlay IL hook failed.");
				}
			}

			private static void BuildGlacialOnHitExplosion()
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)Effects.GlacialOnHitExplosion))
				{
					return;
				}
				GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElementalRings/IceRingExplosion.prefab").WaitForCompletion(), "MoffeinEliteReworks_GlacialOnHitExplosionEffect", false);
				Object.Destroy((Object)(object)val.GetComponent<ShakeEmitter>());
				EffectComponent component = val.GetComponent<EffectComponent>();
				component.soundName = "";
				component.applyScale = false;
				ParticleSystemRenderer[] componentsInChildren = val.GetComponentsInChildren<ParticleSystemRenderer>();
				ParticleSystemRenderer[] array = componentsInChildren;
				foreach (ParticleSystemRenderer val2 in array)
				{
					string name = ((Object)val2).name;
					string text = name;
					if (text == "IceMesh")
					{
						Object.Destroy((Object)(object)val2);
					}
				}
				PluginContentPack.effectDefs.Add(new EffectDef(val));
				Effects.GlacialOnHitExplosion = val;
			}
		}

		public static float healthBoostCoefficient;

		public static float damageBoostCoefficient;

		public static float healthBoostCoefficientHonor;

		public static float damageBoostCoefficientHonor;

		public static bool reworkOnHit;

		public override string ConfigCategoryString => "T1 - Glacial";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Glacial Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: 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_0034: Expected O, but got Unknown
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d3: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0104: Expected O, but got Unknown
			base.ReadConfig(config);
			healthBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Health Multiplier"), 3f, new ConfigDescription("Health multiplier for this Elite Type. (Vanilla = 4)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Damage Multiplier"), 1.5f, new ConfigDescription("Damage multiplier for this Elite Type. (Vanilla = 2)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			healthBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Health Multiplier"), 2.5f, new ConfigDescription("Health multiplier for this Elite Type when Honor is enabled. (Vanilla = 2.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Damage Multiplier"), 1.5f, new ConfigDescription("Damage multiplier for this Elite Type when Honor is enabled. (Vanilla = 1.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			reworkOnHit = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Frost Explosion on Hit"), true, new ConfigDescription("Glacial Elites create a slowing non-damaging frost explosion on hit.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			base.ApplyChanges();
			ModifyStats();
			ReworkOnHitEffect();
			Assets.Init();
		}

		private void ModifyStats()
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteIce/edIce.asset").WaitForCompletion();
			val.healthBoostCoefficient = healthBoostCoefficient;
			val.damageBoostCoefficient = damageBoostCoefficient;
			EliteDef val2 = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteIce/edIceHonor.asset").WaitForCompletion();
			val2.healthBoostCoefficient = healthBoostCoefficientHonor;
			val2.damageBoostCoefficient = damageBoostCoefficientHonor;
		}

		private void ReworkOnHitEffect()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (reworkOnHit)
			{
				GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveVanillaOnHit);
				GlobalEventManager.OnHitAll += new hook_OnHitAll(FrostExplosionOnHit);
			}
		}

		private void RemoveVanillaOnHit(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "AffixWhite"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff")
			}))
			{
				val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool orig) => false));
			}
			else
			{
				Debug.LogError((object)"EliteReworks: AffixBlue RemoveVanillaOnHit IL hook failed.");
			}
		}

		private void FrostExplosionOnHit(orig_OnHitAll orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hitObject)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageInfo, hitObject);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.HasBuff(Buffs.AffixWhite) && Object.op_Implicit((Object)(object)component.teamComponent))
				{
					float debuffDuration = 1f + damageInfo.procCoefficient * 2f;
					EliteReworks2Utils.DebuffSphereOverlap(ModCompat.zetAspectsLoaded ? Assets.Buffs.Slow80Alt.buffIndex : Buffs.Slow80.buffIndex, component.teamComponent.teamIndex, damageInfo.position, 4f, debuffDuration, Assets.Effects.GlacialOnHitExplosion, null, ignoreImmunity: false, falloff: true, Assets.NetworkSoundEvents.SlowApplied);
				}
			}
		}
	}
}
namespace EliteReworks2.Elites.Gilded
{
	public class Gilded : TweakBase<Gilded>
	{
		public static float healthBoostCoefficient;

		public static float damageBoostCoefficient;

		public static float healthBoostCoefficientHonor;

		public static float damageBoostCoefficientHonor;

		public static bool directSiphon;

		public static bool onlyKnockoutGoldFromPlayers;

		public static float playerDamageCoefficient = 2f;

		public static float passiveDamage = 24f;

		public static float passiveDamageBoss = 32f;

		public override string ConfigCategoryString => "T1 - Gilded";

		public override string ConfigOptionName => "Enable Module";

		public override string ConfigDescriptionString => "Enable changes related to Voidtouched Elites.";

		protected override void ReadConfig(ConfigFile config)
		{
			//IL_0015: 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_0034: Expected O, but got Unknown
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d3: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0104: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0135: Expected O, but got Unknown
			base.ReadConfig(config);
			healthBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Health Multiplier"), 4f, new ConfigDescription("Health multiplier for this Elite Type. (Vanilla = 5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficient = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats - Damage Multiplier"), 2f, new ConfigDescription("Damage multiplier for this Elite Type. (Vanilla = 2.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			healthBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Health Multiplier"), 3.5f, new ConfigDescription("Health multiplier for this Elite Type when Honor is enabled. (Vanilla = 3.5)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			damageBoostCoefficientHonor = config.Bind<float>(new ConfigDefinition(ConfigCategoryString, "Stats (Honor) - Damage Multiplier"), 2f, new ConfigDescription("Damage multiplier for this Elite Type when Honor is enabled. (Vanilla = 2)", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			directSiphon = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Directly Steal Gold"), true, new ConfigDescription("Directly steal gold from players instead of spawning gold chunks.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			onlyKnockoutGoldFromPlayers = config.Bind<bool>(new ConfigDefinition(ConfigCategoryString, "Only Knockout Gold from Players"), true, new ConfigDescription("Passive Spikes only knock gold chunks out of players, or when the equipment is used by a player.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected override void ApplyChanges()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			base.ApplyChanges();
			ModifyStats();
			AffixAurelioniteBehavior.FireAurelioniteAttack += new Manipulator(NormalizePassiveDamage);
			if (directSiphon)
			{
				AffixAurelioniteBehavior.StealMoneyWithFX += new hook_StealMoneyWithFX(AffixAurelioniteBehavior_StealMoneyWithFX);
			}
			if (onlyKnockoutGoldFromPlayers)
			{
				ProjectileKnockOutGold.KnockGoldFromVictim += new hook_KnockGoldFromVictim(ProjectileKnockOutGold_KnockGoldFromVictim);
			}
		}

		private void ProjectileKnockOutGold_KnockGoldFromVictim(orig_KnockGoldFromVictim orig, ProjectileKnockOutGold self, HurtBox hurtbox)
		{
			bool flag = Object.op_Implicit((Object)(object)hurtbox) && Object.op_Implicit((Object)(object)hurtbox.healthComponent) && Object.op_Implicit((Object)(object)hurtbox.healthComponent.body) && hurtbox.healthComponent.body.isPlayerControlled;
			if (!flag)
			{
				ProjectileController component = ((Component)self).GetComponent<ProjectileController>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.owner))
				{
					CharacterBody component2 = component.owner.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component2) && component2.isPlayerControlled)
					{
						flag = true;
					}
				}
			}
			if (flag)
			{
				orig.Invoke(self, hurtbox);
			}
		}

		private void ModifyStats()
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			EliteDef val = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC2/Elites/EliteAurelionite/edAurelionite.asset").WaitForCompletion();
			val.healthBoostCoefficient = healthBoostCoefficient;
			val.damageBoostCoefficient = damageBoostCoefficient;
			EliteDef val2 = Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC2/Elites/EliteAurelionite/edAurelioniteHonor.asset").WaitForCompletion();
			val2.healthBoostCoefficient = healthBoostCoefficientHonor;
			val2.damageBoostCoefficient = damageBoostCoefficientHonor;
		}

		private static void NormalizePassiveDamage(ILContext il)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			bool flag = true;
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<I