Decompiled source of Nemesis Spikestrip v1.2.0

NemesisSpikestrip.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
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 BepInEx.Logging;
using GrooveSaladSpikestripContent.Content;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using NemesisSpikestrip.Changes;
using On.RoR2;
using On.RoR2.UI;
using PlasmaCoreSpikestripContent.Content.Elites;
using PlasmaCoreSpikestripContent.Content.Monsters.States;
using R2API;
using RoR2;
using Spikestrip2_0.Core;
using TPDespair.ZetAspects;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Spikestrip2_0")]
[assembly: IgnoresAccessChecksTo("ZetAspects")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NemesisSpikestrip")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8f35c92e164f5a22eef2398412a17e89c5cd13a8")]
[assembly: AssemblyProduct("NemesisSpikestrip")]
[assembly: AssemblyTitle("NemesisSpikestrip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NemesisSpikestrip
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("prodzpod.NemesisSpikestrip", "NemesisSpikestrip", "1.2.0")]
	public class Main : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(InstantiatePotMobileDamageTrail), "Start")]
		public class PatchPotMobile
		{
			public static void Postfix(InstantiatePotMobileDamageTrail __instance)
			{
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				PotMobileDamageTrail trailInstance = __instance.trailInstance;
				trailInstance.pointLifetime *= LivelyPotTrailLife.Value / 9f;
				trailInstance.radius *= LivelyPotTrailSize.Value / 2f;
				trailInstance.damagePerSecond *= LivelyPotTrailDamage.Value / 1.5f;
				ParticleSystemRenderer component = trailInstance.segmentPrefab.GetComponent<ParticleSystemRenderer>();
				component.minParticleSize *= LivelyPotTrailSize.Value / 2f;
				ParticleSystemRenderer component2 = trailInstance.segmentPrefab.GetComponent<ParticleSystemRenderer>();
				component2.maxParticleSize *= LivelyPotTrailSize.Value / 2f;
				MainModule main = trailInstance.segmentPrefab.GetComponent<ParticleSystem>().main;
				((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main)).simulationSpeed / ((LivelyPotTrailLife.Value + 0.5f) / 9f);
			}
		}

		public const string PluginGUID = "prodzpod.NemesisSpikestrip";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "NemesisSpikestrip";

		public const string PluginVersion = "1.2.0";

		public static ManualLogSource Log;

		public static PluginInfo pluginInfo;

		public static Harmony Harmony;

		public static ConfigFile Config;

		public static ConfigEntry<float> SigmaLaserLength;

		public static ConfigEntry<float> SigmaLaserThickness;

		public static ConfigEntry<float> SigmaLaserDamage;

		public static ConfigEntry<float> LivelyPotTrailSize;

		public static ConfigEntry<float> LivelyPotTrailLife;

		public static ConfigEntry<float> LivelyPotTrailDamage;

		public static Dictionary<string, string> SuperOverrides = new Dictionary<string, string>();

		public void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("prodzpod.NemesisSpikestrip");
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.NemesisSpikestrip.cfg"), true);
			SigmaLaserLength = Config.Bind<float>("Rebalance", "Sigma Construct Laser Length", 60f, "in meter");
			SigmaLaserThickness = Config.Bind<float>("Rebalance", "Sigma Construct Laser Thickness", 1f, "in meter");
			SigmaLaserDamage = Config.Bind<float>("Rebalance", "Sigma Construct Laser Damage", 1.2f, "1 = 100% coeff");
			LivelyPotTrailSize = Config.Bind<float>("Rebalance", "Lively Pot Trail Size", 3f, "in meter");
			LivelyPotTrailLife = Config.Bind<float>("Rebalance", "Lively Pot Trail Life", 3.5f, "in second");
			LivelyPotTrailDamage = Config.Bind<float>("Rebalance", "Lively Pot Trail Damage Per Second", 1.5f, "1 = 100% coeff");
			Plated.Init();
			Warped.Init();
			Veiled.Init();
			Aragonite.Init();
			if (Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetAspects"))
			{
				Log.LogDebug((object)"ZetAspect compat loaded :3");
				Harmony.PatchAll(typeof(PatchSuperOverrides));
			}
			SigmaBeam.maxRange = SigmaLaserLength.Value;
			SigmaBeam.width = SigmaLaserThickness.Value;
			SigmaBeam.damageCoefficient = SigmaLaserDamage.Value;
			Harmony.PatchAll(typeof(PatchPotMobile));
		}

		public static bool IsEnabled<T>() where T : ContentBase
		{
			bool flag = SpikestripContent.IsEnabled<T>();
			Log.LogDebug((object)(typeof(T).Name + ": " + (flag ? "Loaded" : "Disabled")));
			return flag;
		}
	}
	[HarmonyPatch(typeof(Language), "TextFragment")]
	public class PatchSuperOverrides
	{
		public static bool Prefix(string key, ref string __result)
		{
			if (Main.SuperOverrides.ContainsKey(key))
			{
				__result = Main.SuperOverrides[key];
				return false;
			}
			return true;
		}
	}
}
namespace NemesisSpikestrip.Changes
{
	public class Aragonite
	{
		[HarmonyPatch(typeof(RageAffixBuffBehaviourServer), "OnTakeDamageServer")]
		public class PatchIgnoreDrone
		{
			public static bool Prefix(DamageReport damageReport)
			{
				if (damageReport != null && damageReport.damageInfo != null && Object.op_Implicit((Object)(object)damageReport.damageInfo.attacker) && Object.op_Implicit((Object)(object)damageReport.damageInfo.attacker.GetComponent<CharacterBody>()) && Object.op_Implicit((Object)(object)damageReport.damageInfo.attacker.GetComponent<CharacterBody>().master) && Object.op_Implicit((Object)(object)damageReport.damageInfo.attacker.GetComponent<CharacterBody>().master.minionOwnership))
				{
					return Object.op_Implicit((Object)(object)damageReport.damageInfo.attacker.GetComponent<CharacterBody>().master.minionOwnership.ownerMaster);
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(RageAffixBuffBehaviourServer), "OnKilledServer")]
		public class PatchIgnoreDrone2
		{
			public static bool Prefix(DamageReport damageReport)
			{
				if (damageReport != null && Object.op_Implicit((Object)(object)damageReport.attackerMaster) && Object.op_Implicit((Object)(object)damageReport.attackerMaster.minionOwnership))
				{
					return Object.op_Implicit((Object)(object)damageReport.attackerMaster.minionOwnership.ownerMaster);
				}
				return false;
			}
		}

		public static bool enabled;

		public static ConfigEntry<bool> IgnoreDrone;

		public static void Init()
		{
			enabled = Main.Config.Bind<bool>("Aragonite", "Enabled", true, "").Value;
			IgnoreDrone = Main.Config.Bind<bool>("Aragonite", "Ignore Followers", true, "Hitting followers such as drones does not trigger the special attack");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Aragonite".ToUpper() + "_DESCRIPTION", "On hit, unleash a <style=cIsDamage>deadly wave</style> that deals <style=cIsDamage>500%</style> base damage.");
			if (enabled && Main.IsEnabled<RagingElite>())
			{
				LanguageAPI.AddOverlay("EQUIPMENT_AFFIXARAGONITE_NAME", "Anger from Below");
				Main.SuperOverrides.Add("AFFIX_ARAGONITE_NAME", "Anger from Below");
				if (IgnoreDrone.Value)
				{
					Main.Harmony.PatchAll(typeof(PatchIgnoreDrone));
					Main.Harmony.PatchAll(typeof(PatchIgnoreDrone2));
				}
			}
		}
	}
	public class Plated
	{
		[HarmonyPatch(typeof(PlatedAffixBuffBehaviour), "OnTakeDamageServer")]
		public class PatchHits
		{
			public static bool Prefix()
			{
				return false;
			}
		}

		[HarmonyPatch(typeof(PlatedAffixBuffBehaviour), "OnIncomingDamageServer")]
		public class PatchHits2
		{
			public static bool Prefix()
			{
				return false;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TakeDamage <>9__9_0;

			public static StatHookEventHandler <>9__9_1;

			public static hook_OnCharacterDeath <>9__9_2;

			public static StatHookEventHandler <>9__9_3;

			internal void <Init>b__9_0(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
			{
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: 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_009b: 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_00a6: Expected O, but got Unknown
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)self))
				{
					orig.Invoke(self, damageInfo);
					return;
				}
				CharacterBody body = self.body;
				if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)body) && body.HasBuff(((EliteBase<PlatedElite>)(object)ContentBase<PlatedElite>.instance).AffixBuff))
				{
					if (body.HasBuff(Stack))
					{
						damageInfo.rejected = true;
						EffectData val = new EffectData
						{
							origin = damageInfo.position,
							rotation = Util.QuaternionSafeLookRotation((damageInfo.force != Vector3.zero) ? damageInfo.force : Random.onUnitSphere)
						};
						EffectManager.SpawnEffect(newPlatedBlockEffectPrefab, val, true);
						body.AddBuff(Stack);
						if (body.GetBuffCount(Stack) >= Hits.Value)
						{
							body.SetBuffCount(Stack.buffIndex, 0);
						}
					}
					else
					{
						body.AddBuff(Stack);
					}
				}
				orig.Invoke(self, damageInfo);
				if (damageInfo != null && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>()) && damageInfo.attacker.GetComponent<CharacterBody>().HasBuff(PlatedElite.damageReductionBuff))
				{
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					component.SetBuffCount(PlatedElite.damageReductionBuff.buffIndex, component.GetBuffCount(PlatedElite.damageReductionBuff) - 1);
				}
			}

			internal void <Init>b__9_1(CharacterBody self, StatHookEventArgs args)
			{
				if (self.HasBuff(((EliteBase<PlatedElite>)(object)ContentBase<PlatedElite>.instance).AffixBuff))
				{
					args.healthMultAdd += MaxHPPenalty.Value - 1f;
				}
			}

			internal void <Init>b__9_2(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
			{
				//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)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass9_0 CS$<>8__locals8 = new <>c__DisplayClass9_0
				{
					damageReport = damageReport
				};
				orig.Invoke(self, CS$<>8__locals8.damageReport);
				if (CS$<>8__locals8.damageReport == null || !Object.op_Implicit((Object)(object)CS$<>8__locals8.damageReport.victimBody) || !CS$<>8__locals8.damageReport.victimBody.HasBuff(((EliteBase<PlatedElite>)(object)ContentBase<PlatedElite>.instance).AffixBuff))
				{
					return;
				}
				SphereSearch val = new SphereSearch
				{
					radius = OnDeathRange.Value + CS$<>8__locals8.damageReport.victimBody.radius,
					queryTriggerInteraction = (QueryTriggerInteraction)1,
					mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
					origin = CS$<>8__locals8.damageReport.victimBody.corePosition
				};
				val.RefreshCandidates();
				val.FilterCandidatesByDistinctHurtBoxEntities();
				TeamMask val2 = default(TeamMask);
				((TeamMask)(ref val2)).AddTeam(CS$<>8__locals8.damageReport.victimBody.teamComponent.teamIndex);
				val.FilterCandidatesByHurtBoxTeam(val2);
				CollectionExtensions.Do<HurtBox>((IEnumerable<HurtBox>)val.GetHurtBoxes(), (Action<HurtBox>)delegate(HurtBox hurtBox)
				{
					if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body) && (Object)(object)hurtBox.healthComponent.body != (Object)(object)CS$<>8__locals8.damageReport.victimBody)
					{
						hurtBox.healthComponent.body.AddBuff(OnDeath);
					}
				});
			}

			internal void <Init>b__9_3(CharacterBody self, StatHookEventArgs args)
			{
				if (self.HasBuff(OnDeath))
				{
					args.armorAdd += OnDeathArmor.Value;
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public DamageReport damageReport;

			internal void <Init>b__4(HurtBox hurtBox)
			{
				if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body) && (Object)(object)hurtBox.healthComponent.body != (Object)(object)damageReport.victimBody)
				{
					hurtBox.healthComponent.body.AddBuff(OnDeath);
				}
			}
		}

		public static bool enabled;

		public static BuffDef Stack;

		public static BuffDef OnDeath;

		public static ConfigEntry<int> Hits;

		public static ConfigEntry<float> MaxHPPenalty;

		public static ConfigEntry<float> OnDeathRange;

		public static ConfigEntry<float> OnDeathArmor;

		public static ConfigEntry<float> OnDeathDuration;

		public static GameObject newPlatedBlockEffectPrefab;

		public static void Init()
		{
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Expected O, but got Unknown
			enabled = Main.Config.Bind<bool>("Plated", "Enabled", true, "").Value;
			Hits = Main.Config.Bind<int>("Plated", "Hits", 6, "Every n hit goes through immunity");
			MaxHPPenalty = Main.Config.Bind<float>("Plated", "HP Penalty", 0.2f, "multiplied to max hp");
			OnDeathRange = Main.Config.Bind<float>("Plated", "On Death Range", 13f, "in meters");
			OnDeathArmor = Main.Config.Bind<float>("Plated", "On Death Armor", 30f, "default: 1 ruckler");
			OnDeathDuration = Main.Config.Bind<float>("Plated", "On Death Duration", 8f, "in seconds");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Plated".ToUpper() + "_DESCRIPTION", enabled ? $"All but every {Hits.Value} hit is mitigated. Attacks <style=cIsUtility>stifle</style> on hit for <style=cIsUtility>8s</style>, reducing damage dealt by <style=cIsUtility>100%</style> base damage per stack." : "Gain defensive plating that mitigates heavy damage. Attacks <style=cIsUtility>stifle</style> on hit for <style=cIsUtility>8s</style>, reducing damage dealt by <style=cIsUtility>100%</style> base damage per stack.");
			if (!enabled || !Main.IsEnabled<PlatedElite>())
			{
				return;
			}
			if (Hits.Value > 0)
			{
				Main.SuperOverrides.Add("PASSIVE_DEFENSE_PLATING", $"All but every {Hits.Value} hit is mitigated.");
				Stack = ScriptableObject.CreateInstance<BuffDef>();
				Stack.canStack = true;
				Stack.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffGenericShield.tif").WaitForCompletion();
				Stack.buffColor = new Color(31f / 51f, 48f / 85f, 0.47843137f);
				ContentAddition.AddBuffDef(Stack);
				Main.Harmony.PatchAll(typeof(PatchHits));
				Main.Harmony.PatchAll(typeof(PatchHits2));
				HealthBar.UpdateHealthbar -= new hook_UpdateHealthbar(ContentBase<PlatedElite>.instance.HealthBar_UpdateHealthbar);
				newPlatedBlockEffectPrefab = PrefabAPI.InstantiateClone(PlatedElite.platedBlockEffectPrefab, "PlatingBlockEffect 2");
				newPlatedBlockEffectPrefab.GetComponent<EffectComponent>().soundName = "Play_item_proc_crowbar";
				ContentAddition.AddEffect(newPlatedBlockEffectPrefab);
				object obj = <>c.<>9__9_0;
				if (obj == null)
				{
					hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
					{
						//IL_0145: Unknown result type (might be due to invalid IL or missing references)
						//IL_006a: Unknown result type (might be due to invalid IL or missing references)
						//IL_006f: Unknown result type (might be due to invalid IL or missing references)
						//IL_0071: Unknown result type (might be due to invalid IL or missing references)
						//IL_007b: Unknown result type (might be due to invalid IL or missing references)
						//IL_007d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0082: Unknown result type (might be due to invalid IL or missing references)
						//IL_0096: 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_009b: 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_00a6: Expected O, but got Unknown
						//IL_00da: Unknown result type (might be due to invalid IL or missing references)
						if (!Object.op_Implicit((Object)(object)self))
						{
							orig.Invoke(self, damageInfo);
						}
						else
						{
							CharacterBody body = self.body;
							if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)body) && body.HasBuff(((EliteBase<PlatedElite>)(object)ContentBase<PlatedElite>.instance).AffixBuff))
							{
								if (body.HasBuff(Stack))
								{
									damageInfo.rejected = true;
									EffectData val5 = new EffectData
									{
										origin = damageInfo.position,
										rotation = Util.QuaternionSafeLookRotation((damageInfo.force != Vector3.zero) ? damageInfo.force : Random.onUnitSphere)
									};
									EffectManager.SpawnEffect(newPlatedBlockEffectPrefab, val5, true);
									body.AddBuff(Stack);
									if (body.GetBuffCount(Stack) >= Hits.Value)
									{
										body.SetBuffCount(Stack.buffIndex, 0);
									}
								}
								else
								{
									body.AddBuff(Stack);
								}
							}
							orig.Invoke(self, damageInfo);
							if (damageInfo != null && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>()) && damageInfo.attacker.GetComponent<CharacterBody>().HasBuff(PlatedElite.damageReductionBuff))
							{
								CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
								component.SetBuffCount(PlatedElite.damageReductionBuff.buffIndex, component.GetBuffCount(PlatedElite.damageReductionBuff) - 1);
							}
						}
					};
					<>c.<>9__9_0 = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			}
			if (MaxHPPenalty.Value != 1f)
			{
				object obj2 = <>c.<>9__9_1;
				if (obj2 == null)
				{
					StatHookEventHandler val2 = delegate(CharacterBody self, StatHookEventArgs args)
					{
						if (self.HasBuff(((EliteBase<PlatedElite>)(object)ContentBase<PlatedElite>.instance).AffixBuff))
						{
							args.healthMultAdd += MaxHPPenalty.Value - 1f;
						}
					};
					<>c.<>9__9_1 = val2;
					obj2 = (object)val2;
				}
				RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
			}
			if (!(OnDeathRange.Value > 0f))
			{
				return;
			}
			OnDeath = ScriptableObject.CreateInstance<BuffDef>();
			OnDeath.canStack = false;
			OnDeath.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Junk/Common/texBuffBodyArmorIcon.tif").WaitForCompletion();
			OnDeath.buffColor = new Color(31f / 51f, 48f / 85f, 0.47843137f);
			ContentAddition.AddBuffDef(OnDeath);
			object obj3 = <>c.<>9__9_2;
			if (obj3 == null)
			{
				hook_OnCharacterDeath val3 = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
				{
					//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)
					//IL_007f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0081: Unknown result type (might be due to invalid IL or missing references)
					//IL_0086: Unknown result type (might be due to invalid IL or missing references)
					//IL_008c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0096: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a7: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00de: Unknown result type (might be due to invalid IL or missing references)
					//IL_00df: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, damageReport);
					if (damageReport != null && Object.op_Implicit((Object)(object)damageReport.victimBody) && damageReport.victimBody.HasBuff(((EliteBase<PlatedElite>)(object)ContentBase<PlatedElite>.instance).AffixBuff))
					{
						SphereSearch val5 = new SphereSearch
						{
							radius = OnDeathRange.Value + damageReport.victimBody.radius,
							queryTriggerInteraction = (QueryTriggerInteraction)1,
							mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
							origin = damageReport.victimBody.corePosition
						};
						val5.RefreshCandidates();
						val5.FilterCandidatesByDistinctHurtBoxEntities();
						TeamMask val6 = default(TeamMask);
						((TeamMask)(ref val6)).AddTeam(damageReport.victimBody.teamComponent.teamIndex);
						val5.FilterCandidatesByHurtBoxTeam(val6);
						CollectionExtensions.Do<HurtBox>((IEnumerable<HurtBox>)val5.GetHurtBoxes(), (Action<HurtBox>)delegate(HurtBox hurtBox)
						{
							if (Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body) && (Object)(object)hurtBox.healthComponent.body != (Object)(object)damageReport.victimBody)
							{
								hurtBox.healthComponent.body.AddBuff(OnDeath);
							}
						});
					}
				};
				<>c.<>9__9_2 = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj3;
			object obj4 = <>c.<>9__9_3;
			if (obj4 == null)
			{
				StatHookEventHandler val4 = delegate(CharacterBody self, StatHookEventArgs args)
				{
					if (self.HasBuff(OnDeath))
					{
						args.armorAdd += OnDeathArmor.Value;
					}
				};
				<>c.<>9__9_3 = val4;
				obj4 = (object)val4;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj4;
		}
	}
	public class Veiled
	{
		[HarmonyPatch(typeof(CharacterModel), "UpdateRendererMaterials")]
		public class PatchVisibility
		{
			public static void ILManipulator(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld<CharacterModel>(x, "cloakedMaterial")
				});
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<Material, CharacterModel, Material>>((Func<Material, CharacterModel, Material>)((Material mat, CharacterModel self) => self.body.HasBuff(((EliteBase<CloakedElite>)(object)ContentBase<CloakedElite>.instance).AffixBuff) ? fakeCloakedMaterial : mat));
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<PoolEntry> <>9__6_7;

			public static Action<DccsPool, List<DirectorCardHolder>, StageInfo> <>9__6_0;

			public static hook_CanSelect <>9__6_1;

			public static hook_CalcHighestEliteCostMultiplier <>9__6_2;

			public static hook_ResetEliteType <>9__6_3;

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

			public static Func<EliteDef, CombatDirector, EliteDef> <>9__6_9;

			public static Manipulator <>9__6_4;

			public static hook_OnHitEnemy <>9__6_5;

			public static hook_RemoveBuff_BuffIndex <>9__6_6;

			public static Func<EliteDef, bool> <>9__8_0;

			internal void <Init>b__6_0(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
			{
				if (!Object.op_Implicit((Object)(object)dccsPool))
				{
					return;
				}
				Helpers.ForEachPoolEntryInDccsPool(dccsPool, (Action<PoolEntry>)delegate(PoolEntry poolEntry)
				{
					//IL_0012: 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_004f: Unknown result type (might be due to invalid IL or missing references)
					Category[] categories = poolEntry.dccs.categories;
					for (int i = 0; i < categories.Length; i++)
					{
						DirectorCard[] cards = categories[i].cards;
						foreach (DirectorCard val in cards)
						{
							if (((Object)val.spawnCard).name.Contains("Assassin2"))
							{
								((SpawnCard)(CharacterSpawnCard)val.spawnCard).eliteRules = (EliteRules)339001;
							}
						}
					}
				});
			}

			internal void <Init>b__6_7(PoolEntry poolEntry)
			{
				//IL_0012: 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_004f: Unknown result type (might be due to invalid IL or missing references)
				Category[] categories = poolEntry.dccs.categories;
				for (int i = 0; i < categories.Length; i++)
				{
					DirectorCard[] cards = categories[i].cards;
					foreach (DirectorCard val in cards)
					{
						if (((Object)val.spawnCard).name.Contains("Assassin2"))
						{
							((SpawnCard)(CharacterSpawnCard)val.spawnCard).eliteRules = (EliteRules)339001;
						}
					}
				}
			}

			internal bool <Init>b__6_1(orig_CanSelect orig, EliteTierDef self, EliteRules rules)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				if ((int)rules == 339001)
				{
					return orig.Invoke(self, (EliteRules)0);
				}
				return orig.Invoke(self, rules);
			}

			internal float <Init>b__6_2(orig_CalcHighestEliteCostMultiplier orig, EliteRules rules)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				if ((int)rules == 339001)
				{
					return orig.Invoke((EliteRules)0);
				}
				return orig.Invoke(rules);
			}

			internal void <Init>b__6_3(orig_ResetEliteType orig, CombatDirector self)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				orig.Invoke(self);
				if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
				{
					self.currentActiveEliteDef = PickNonVeiled(self);
				}
			}

			internal void <Init>b__6_4(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				int num = -1;
				while (val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef")
				}))
				{
					num = val.Index;
					int index = val.Index;
					val.Index = index + 1;
				}
				if (num < 0)
				{
					Main.Log.LogError((object)"Veiled: PrepareNewMonsterWave IL hook failed");
					return;
				}
				val.Index = num;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<EliteDef, CombatDirector, EliteDef>>((Func<EliteDef, CombatDirector, EliteDef>)((EliteDef orig, CombatDirector self) => ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001 && Object.op_Implicit((Object)(object)orig) && ((Object)orig).name.Contains("Cloaked")) ? PickNonVeiled(self) : orig));
			}

			internal bool <Init>b__6_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef");
			}

			internal EliteDef <Init>b__6_9(EliteDef orig, CombatDirector self)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Invalid comparison between Unknown and I4
				if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001 && Object.op_Implicit((Object)(object)orig) && ((Object)orig).name.Contains("Cloaked"))
				{
					return PickNonVeiled(self);
				}
				return orig;
			}

			internal void <Init>b__6_5(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject _victim)
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody component = _victim.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.HasBuff(((EliteBase<CloakedElite>)(object)ContentBase<CloakedElite>.instance).AffixBuff) && component.HasBuff(Buffs.Cloak))
				{
					component.SetBuffCount(Buffs.Cloak.buffIndex, 0);
					component.AddTimedBuff(Cooldown, VisibleTime.Value);
					component.outOfCombatStopwatch = 0f;
				}
				orig.Invoke(self, damageInfo, _victim);
			}

			internal void <Init>b__6_6(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex idx)
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0030: 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_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: 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_0063: Expected O, but got Unknown
				if (NetworkServer.active && idx == Cooldown.buffIndex)
				{
					self.AddBuff(Buffs.Cloak);
					EffectManager.SpawnEffect(CloakedElite.SmokebombEffect, new EffectData
					{
						origin = self.transform.position,
						rotation = self.transform.rotation,
						scale = self.bestFitRadius * 0.2f
					}, true);
				}
				orig.Invoke(self, idx);
			}

			internal bool <PickNonVeiled>b__8_0(EliteDef x)
			{
				if (Object.op_Implicit((Object)(object)x) && x.IsAvailable())
				{
					return !((Object)x).name.Contains("Cloaked");
				}
				return false;
			}
		}

		public static bool enabled;

		public static Material fakeCloakedMaterial;

		public static BuffDef Cooldown;

		public static ConfigEntry<bool> BetterVisibility;

		public static ConfigEntry<bool> HitToShow;

		public static ConfigEntry<float> VisibleTime;

		public static void Init()
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected O, but got Unknown
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			enabled = Main.Config.Bind<bool>("Veiled", "Enabled", true, "").Value;
			BetterVisibility = Main.Config.Bind<bool>("Veiled", "Better Visibility", true, "make cloaked enemies easier to spot");
			HitToShow = Main.Config.Bind<bool>("Veiled", "Hit to Show Enemy", true, "hit enemy to make it visible");
			VisibleTime = Main.Config.Bind<float>("Veiled", "Duration", 4f, "in seconds");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Veiled".ToUpper() + "_DESCRIPTION", enabled ? "You are <style=cIsUtility>cloaked</style>. Getting hit makes you decloak." : "Attacks <style=cIsUtility>cloak</style> you on hit.");
			if (!enabled || !Main.IsEnabled<CloakedElite>())
			{
				return;
			}
			DirectorAPI.MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
			{
				if (Object.op_Implicit((Object)(object)dccsPool))
				{
					Helpers.ForEachPoolEntryInDccsPool(dccsPool, (Action<PoolEntry>)delegate(PoolEntry poolEntry)
					{
						//IL_0012: 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_004f: Unknown result type (might be due to invalid IL or missing references)
						Category[] categories = poolEntry.dccs.categories;
						for (int i = 0; i < categories.Length; i++)
						{
							DirectorCard[] cards = categories[i].cards;
							foreach (DirectorCard val7 in cards)
							{
								if (((Object)val7.spawnCard).name.Contains("Assassin2"))
								{
									((SpawnCard)(CharacterSpawnCard)val7.spawnCard).eliteRules = (EliteRules)339001;
								}
							}
						}
					});
				}
			};
			object obj = <>c.<>9__6_1;
			if (obj == null)
			{
				hook_CanSelect val = (orig_CanSelect orig, EliteTierDef self, EliteRules rules) => ((int)rules == 339001) ? orig.Invoke(self, (EliteRules)0) : orig.Invoke(self, rules);
				<>c.<>9__6_1 = val;
				obj = (object)val;
			}
			EliteTierDef.CanSelect += (hook_CanSelect)obj;
			object obj2 = <>c.<>9__6_2;
			if (obj2 == null)
			{
				hook_CalcHighestEliteCostMultiplier val2 = (orig_CalcHighestEliteCostMultiplier orig, EliteRules rules) => ((int)rules == 339001) ? orig.Invoke((EliteRules)0) : orig.Invoke(rules);
				<>c.<>9__6_2 = val2;
				obj2 = (object)val2;
			}
			CombatDirector.CalcHighestEliteCostMultiplier += (hook_CalcHighestEliteCostMultiplier)obj2;
			object obj3 = <>c.<>9__6_3;
			if (obj3 == null)
			{
				hook_ResetEliteType val3 = delegate(orig_ResetEliteType orig, CombatDirector self)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_001c: Invalid comparison between Unknown and I4
					orig.Invoke(self);
					if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
					{
						self.currentActiveEliteDef = PickNonVeiled(self);
					}
				};
				<>c.<>9__6_3 = val3;
				obj3 = (object)val3;
			}
			CombatDirector.ResetEliteType += (hook_ResetEliteType)obj3;
			object obj4 = <>c.<>9__6_4;
			if (obj4 == null)
			{
				Manipulator val4 = delegate(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					//IL_006e: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val7 = new ILCursor(il);
					int num = -1;
					while (val7.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef")
					}))
					{
						num = val7.Index;
						int index = val7.Index;
						val7.Index = index + 1;
					}
					if (num < 0)
					{
						Main.Log.LogError((object)"Veiled: PrepareNewMonsterWave IL hook failed");
					}
					else
					{
						val7.Index = num;
						val7.Emit(OpCodes.Ldarg_0);
						val7.EmitDelegate<Func<EliteDef, CombatDirector, EliteDef>>((Func<EliteDef, CombatDirector, EliteDef>)((EliteDef orig, CombatDirector self) => ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001 && Object.op_Implicit((Object)(object)orig) && ((Object)orig).name.Contains("Cloaked")) ? PickNonVeiled(self) : orig));
					}
				};
				<>c.<>9__6_4 = val4;
				obj4 = (object)val4;
			}
			CombatDirector.PrepareNewMonsterWave += (Manipulator)obj4;
			if (BetterVisibility.Value)
			{
				fakeCloakedMaterial = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matCloakedEffect.mat").WaitForCompletion());
				fakeCloakedMaterial.SetFloat("_Magnitude", 2.5f);
				Main.Harmony.PatchAll(typeof(PatchVisibility));
			}
			if (!HitToShow.Value)
			{
				return;
			}
			Cooldown = ScriptableObject.CreateInstance<BuffDef>();
			Cooldown.isCooldown = true;
			Cooldown.isDebuff = true;
			Cooldown.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffCloakIcon.tif").WaitForCompletion();
			Cooldown.buffColor = Color.gray;
			ContentAddition.AddBuffDef(Cooldown);
			object obj5 = <>c.<>9__6_5;
			if (obj5 == null)
			{
				hook_OnHitEnemy val5 = delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject _victim)
				{
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					CharacterBody component = _victim.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && component.HasBuff(((EliteBase<CloakedElite>)(object)ContentBase<CloakedElite>.instance).AffixBuff) && component.HasBuff(Buffs.Cloak))
					{
						component.SetBuffCount(Buffs.Cloak.buffIndex, 0);
						component.AddTimedBuff(Cooldown, VisibleTime.Value);
						component.outOfCombatStopwatch = 0f;
					}
					orig.Invoke(self, damageInfo, _victim);
				};
				<>c.<>9__6_5 = val5;
				obj5 = (object)val5;
			}
			GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj5;
			object obj6 = <>c.<>9__6_6;
			if (obj6 == null)
			{
				hook_RemoveBuff_BuffIndex val6 = delegate(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex idx)
				{
					//IL_0065: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_0030: 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_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0063: Expected O, but got Unknown
					if (NetworkServer.active && idx == Cooldown.buffIndex)
					{
						self.AddBuff(Buffs.Cloak);
						EffectManager.SpawnEffect(CloakedElite.SmokebombEffect, new EffectData
						{
							origin = self.transform.position,
							rotation = self.transform.rotation,
							scale = self.bestFitRadius * 0.2f
						}, true);
					}
					orig.Invoke(self, idx);
				};
				<>c.<>9__6_6 = val6;
				obj6 = (object)val6;
			}
			CharacterBody.RemoveBuff_BuffIndex += (hook_RemoveBuff_BuffIndex)obj6;
		}

		public static EliteDef PickNonVeiled(CombatDirector self)
		{
			List<EliteDef> list = self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList();
			if (list.Count <= 0)
			{
				return null;
			}
			return self.rng.NextElementUniform<EliteDef>(list);
		}
	}
	public class Warped
	{
		[HarmonyPatch(typeof(WarpedElite), "OnHitEnemyServer")]
		public class PatchDuration
		{
			public static void ILManipulator(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f)
				});
				val.Emit(OpCodes.Pop);
				val.EmitDelegate<Func<float>>((Func<float>)(() => Duration.Value));
			}
		}

		[HarmonyPatch(typeof(GravityBuffBehaviour), "ServerFixedUpdate")]
		public class PatchBreakout
		{
			public static void Postfix(GravityBuffBehaviour __instance)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)((ItemBehavior)__instance).body))
				{
					return;
				}
				if (Object.op_Implicit((Object)(object)((ItemBehavior)__instance).body.healthComponent))
				{
					((ItemBehavior)__instance).body.healthComponent.TakeDamageForce(Vector3.up * Time.fixedDeltaTime * (0f - ((ItemBehavior)__instance).body.corePosition.y), false, false);
				}
				Vector3 val = (Object.op_Implicit((Object)(object)((ItemBehavior)__instance).body.characterMotor) ? ((ItemBehavior)__instance).body.characterMotor.velocity : Vector3.zero);
				TimedBuff val2 = ((((ItemBehavior)__instance).body.timedBuffs != null) ? ((ItemBehavior)__instance).body.timedBuffs.Find((TimedBuff x) => x.buffIndex == WarpedElite.gravityBuff.buffIndex) : null);
				if (val2 != null && val2.timer > 0f)
				{
					val2.timer -= Time.fixedDeltaTime * BreakoutCoefficient.Value / Mathf.Sqrt(val.x * val.x + val.z * val.z + 1f);
					if (val2.timer < 0f)
					{
						((ItemBehavior)__instance).body.timedBuffs.Remove(val2);
						((ItemBehavior)__instance).body.RemoveBuff(WarpedElite.gravityBuff);
					}
				}
			}
		}

		public static bool enabled;

		public static ConfigEntry<float> Duration;

		public static ConfigEntry<float> BreakoutCoefficient;

		public static void Init()
		{
			enabled = Main.Config.Bind<bool>("Warped", "Enabled", true, "").Value;
			Duration = Main.Config.Bind<float>("Warped", "Duration", 4f, "in seconds");
			BreakoutCoefficient = Main.Config.Bind<float>("Warped", "Breakout Coefficient", 5f, "1 = 100% faster when standing completely still, hyperbolic");
			LanguageAPI.AddOverlay("EQUIPMENT_AFFIX" + "Warped".ToUpper() + "_DESCRIPTION", enabled ? $"Attacks <style=cIsUtility>levitate</style> on hit for <style=cIsUtility>{Duration.Value / BreakoutCoefficient.Value}s</style> or more." : "Attacks <style=cIsUtility>levitate</style> on hit for <style=cIsUtility>4s</style>.");
			if (enabled && Main.IsEnabled<WarpedElite>())
			{
				if (Duration.Value != 4f)
				{
					Main.Harmony.PatchAll(typeof(PatchDuration));
				}
				if (BreakoutCoefficient.Value > 0f)
				{
					Main.Harmony.PatchAll(typeof(PatchBreakout));
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}