Decompiled source of Nemesis Spikestrip v1.1.1

NemesisSpikestrip.dll

Decompiled 3 months 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;
using GrooveSaladSpikestripContent.Content;
using GrooveUnsharedUtils;
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 TPDespair.ZetAspects;
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("NemesisSpikestrip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+185d61f378f87c549b3cdd05d27d23ff0a4ca33b")]
[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]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NemesisSpikestrip
{
	[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("prodzpod.NemesisSpikestrip", "NemesisSpikestrip", "1.1.1")]
	public class Main : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(InstantiatePotMobileDamageTrail), "Start")]
		public class PatchPotMobile
		{
			public static void Postfix(InstantiatePotMobileDamageTrail __instance)
			{
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: 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.1.1";

		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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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(SpikestripContentBase initialContent)
		{
			BaseUnityPlugin instance = Chainloader.PluginInfos["com.groovesalad.GrooveSaladSpikestripContent"].Instance;
			Base val = (Base)(object)((instance is Base) ? instance : null);
			bool flag = initialContent.IsEnabled && ((((object)initialContent).GetType().Assembly == typeof(Base).Assembly) ? Main.SpikestripContentLegacyConfig.Bind<bool>("Legacy " + val.SafeForConfig(initialContent.ConfigSection), "Enable " + val.SafeForConfig(initialContent.ConfigName), false, "Enable/Disable : " + val.SafeForConfig(initialContent.ConfigName)).Value : Base.SpikestripContentConfig.Bind<bool>(val.SafeForConfig(initialContent.ConfigSection), "Enable " + val.SafeForConfig(initialContent.ConfigName), true, "Enable/Disable : " + val.SafeForConfig(initialContent.ConfigName)).Value);
			Log.LogDebug((object)(((object)initialContent).GetType().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)
			{
				return 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) && Object.op_Implicit((Object)(object)damageReport.damageInfo.attacker.GetComponent<CharacterBody>().master.minionOwnership.ownerMaster);
			}
		}

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

		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((SpikestripContentBase)(object)SpikestripContentBase<RagingElite>.instance))
			{
				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_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)
				//IL_007d: 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_008a: 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_00a3: 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_016e: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				//IL_00f4: 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(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<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(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
				{
					args.healthMultAdd += MaxHPPenalty.Value - 1f;
				}
			}

			internal void <Init>b__9_2(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
			{
				//IL_005b: 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)
				//IL_0081: 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_0088: 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_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Expected O, but got Unknown
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0
				{
					damageReport = damageReport
				};
				orig.Invoke(self, CS$<>8__locals0.damageReport);
				if (CS$<>8__locals0.damageReport == null || !Object.op_Implicit((Object)(object)CS$<>8__locals0.damageReport.victimBody) || !CS$<>8__locals0.damageReport.victimBody.HasBuff(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
				{
					return;
				}
				SphereSearch val = new SphereSearch
				{
					radius = OnDeathRange.Value + CS$<>8__locals0.damageReport.victimBody.radius,
					queryTriggerInteraction = (QueryTriggerInteraction)1,
					mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
					origin = CS$<>8__locals0.damageReport.victimBody.corePosition
				};
				val.RefreshCandidates();
				val.FilterCandidatesByDistinctHurtBoxEntities();
				TeamMask val2 = default(TeamMask);
				((TeamMask)(ref val2)).AddTeam(CS$<>8__locals0.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__locals0.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_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_020d: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Expected O, but got Unknown
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Expected O, but got Unknown
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: 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((SpikestripContentBase)(object)SpikestripContentBase<PlatedElite>.instance))
			{
				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(SpikestripContentBase<PlatedElite>.instance.HealthBar_UpdateHealthbar);
				newPlatedBlockEffectPrefab = PrefabAPI.InstantiateClone(PlatedElite.platedBlockEffectPrefab, "PlatingBlockEffect 2");
				newPlatedBlockEffectPrefab.GetComponent<EffectComponent>().soundName = "Play_item_proc_crowbar";
				SpikestripContentBase.effectDefContent.Add(new EffectDef(newPlatedBlockEffectPrefab));
				object obj = <>c.<>9__9_0;
				if (obj == null)
				{
					hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
					{
						//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)
						//IL_007d: 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_008a: 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_00a3: 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_016e: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
						//IL_00b4: Expected O, but got Unknown
						//IL_00f4: 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(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<PlatedElite>.instance).AffixBuff))
							{
								if (body.HasBuff(Stack))
								{
									damageInfo.rejected = true;
									EffectData val7 = new EffectData
									{
										origin = damageInfo.position,
										rotation = Util.QuaternionSafeLookRotation((damageInfo.force != Vector3.zero) ? damageInfo.force : Random.onUnitSphere)
									};
									EffectManager.SpawnEffect(newPlatedBlockEffectPrefab, val7, 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(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<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_005b: 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)
					//IL_0081: 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_0088: 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_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
					//IL_00af: Expected O, but got Unknown
					//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e3: 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(((SpikestripEliteBase<PlatedElite>)(object)SpikestripContentBase<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_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0039: 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(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<CloakedElite>.instance).AffixBuff) ? fakeCloakedMaterial : mat));
			}
		}

		[HarmonyPatch(typeof(CloakedElite), "GlobalEventManager_OnHitEnemy")]
		public class PatchCloak
		{
			public static bool Prefix(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
			{
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Expected O, but got Unknown
				orig.Invoke(self, damageInfo, victim);
				if (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.Cloak) && component.HasBuff(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<CloakedElite>.instance).AffixBuff))
					{
						component.AddBuff(Buffs.Cloak);
						EffectManager.SpawnEffect(CloakedElite.SmokebombEffect, new EffectData
						{
							origin = damageInfo.attacker.transform.position,
							rotation = damageInfo.attacker.transform.rotation,
							scale = component.bestFitRadius * 0.2f
						}, true);
					}
				}
				return false;
			}
		}

		[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 Func<EliteDef, bool> <>9__6_8;

			public static hook_ResetEliteType <>9__6_3;

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

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

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

			public static Manipulator <>9__6_4;

			public static hook_OnHitEnemy <>9__6_5;

			public static hook_RemoveBuff_BuffIndex <>9__6_6;

			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_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)
					//IL_001b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
					Category[] categories = poolEntry.dccs.categories;
					foreach (Category val in categories)
					{
						DirectorCard[] cards = val.cards;
						foreach (DirectorCard val2 in cards)
						{
							if (((Object)val2.spawnCard).name.Contains("Assassin2"))
							{
								((SpawnCard)(CharacterSpawnCard)val2.spawnCard).eliteRules = (EliteRules)339001;
							}
						}
					}
				});
			}

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

			internal bool <Init>b__6_1(orig_CanSelect orig, EliteTierDef self, EliteRules rules)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_001a: 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_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_0018: 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_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Invalid comparison between Unknown and I4
				orig.Invoke(self);
				if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
				{
					self.currentActiveEliteDef = self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList());
				}
			}

			internal bool <Init>b__6_8(EliteDef x)
			{
				return Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked");
			}

			internal void <Init>b__6_4(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef")
				});
				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) ? self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList()) : orig));
			}

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

			internal EliteDef <Init>b__6_10(EliteDef orig, CombatDirector self)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Invalid comparison between Unknown and I4
				if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
				{
					return self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList());
				}
				return orig;
			}

			internal bool <Init>b__6_11(EliteDef x)
			{
				return Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked");
			}

			internal void <Init>b__6_5(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject _victim)
			{
				//IL_003c: 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(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<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_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: 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_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: 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);
			}
		}

		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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//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_0141: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: 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((SpikestripContentBase)(object)SpikestripContentBase<CloakedElite>.instance))
			{
				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_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)
						//IL_001b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
						Category[] categories = poolEntry.dccs.categories;
						foreach (Category val8 in categories)
						{
							DirectorCard[] cards = val8.cards;
							foreach (DirectorCard val9 in cards)
							{
								if (((Object)val9.spawnCard).name.Contains("Assassin2"))
								{
									((SpawnCard)(CharacterSpawnCard)val9.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_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_001e: Invalid comparison between Unknown and I4
					orig.Invoke(self);
					if ((int)self.currentMonsterCard.spawnCard.eliteRules == 339001)
					{
						self.currentActiveEliteDef = self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList());
					}
				};
				<>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_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val7 = new ILCursor(il);
					val7.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStfld<CombatDirector>(x, "currentActiveEliteDef")
					});
					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) ? self.rng.NextElementUniform<EliteDef>(self.currentActiveEliteTier.eliteTypes.Where((EliteDef x) => Object.op_Implicit((Object)(object)x) && x.IsAvailable() && !((Object)x).name.Contains("Cloaked")).ToList()) : 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_003c: 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(((SpikestripEliteBase<CloakedElite>)(object)SpikestripContentBase<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_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0033: Unknown result type (might be due to invalid IL or missing references)
					//IL_003a: 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_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_006e: 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;
			Main.Harmony.PatchAll(typeof(PatchCloak));
		}
	}
	public class Warped
	{
		[HarmonyPatch(typeof(WarpedElite), "OnHitEnemyServer")]
		public class PatchDuration
		{
			public static void ILManipulator(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0039: 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_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: 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_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: 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_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: 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((SpikestripContentBase)(object)SpikestripContentBase<WarpedElite>.instance))
			{
				if (Duration.Value != 4f)
				{
					Main.Harmony.PatchAll(typeof(PatchDuration));
				}
				if (BreakoutCoefficient.Value > 0f)
				{
					Main.Harmony.PatchAll(typeof(PatchBreakout));
				}
			}
		}
	}
}