Decompiled source of EnemiesPlusPlus v1.1.0

EnemiesPlus.dll

Decompiled a month 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 EnemiesPlus.Content.Beetle;
using EnemiesPlus.Content.Donger;
using EnemiesPlus.Content.Imp;
using EnemiesPlus.Content.Lemur;
using EnemiesPlus.Content.Lunar;
using EnemiesPlus.Content.Wisp;
using EnemiesPlus.Content.Worm;
using EntityStates;
using EntityStates.BeetleGuardMonster;
using EntityStates.Bell.BellWeapon;
using EntityStates.ImpMonster;
using EntityStates.LemurianMonster;
using EntityStates.MagmaWorm;
using EntityStates.Wisp1Monster;
using HG.GeneralSerializer;
using HarmonyLib;
using IL.RoR2;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.LemurianMonster;
using On.EntityStates.MagmaWorm;
using On.EntityStates.Wisp1Monster;
using R2API;
using RiftTitansMod;
using RiftTitansMod.SkillStates.Blue;
using RiskOfOptions;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EnemiesPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+82bcdfbab9bc3ed9a995f7d509052a4c6a1aac8a")]
[assembly: AssemblyProduct("EnemiesPlus")]
[assembly: AssemblyTitle("EnemiesPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 EnemiesPlus
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.score.EnemiesPlusPlus", "EnemiesPlusPlus", "1.1.0")]
	public class EnemiesPlusPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.score.EnemiesPlusPlus";

		public const string PluginAuthor = "score";

		public const string PluginName = "EnemiesPlusPlus";

		public const string PluginVersion = "1.1.0";

		public static EnemiesPlusPlugin Instance { get; private set; }

		public static bool RooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public static bool LeagueOfLiteralGays => Chainloader.PluginInfos.ContainsKey("com.phreel.TitansOfTheRiftSOTV");

		public void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			EnemiesPlusConfig.Init(((BaseUnityPlugin)this).Config);
			HarmonyHooks.Init();
			if (EnemiesPlusConfig.enableSkills.Value)
			{
				if (EnemiesPlusConfig.bellSkills.Value)
				{
					BellChanges.Init();
				}
				if (EnemiesPlusConfig.impSkills.Value)
				{
					ImpChanges.Init();
				}
				if (EnemiesPlusConfig.wormLeap.Value || EnemiesPlusConfig.wormTracking.Value)
				{
					WormChanges.Init();
				}
				if (EnemiesPlusConfig.lunarGolemSkills.Value)
				{
					LunarChanges.Init();
				}
			}
			if (EnemiesPlusConfig.enableTweaks.Value)
			{
				if (EnemiesPlusConfig.lemChanges.Value)
				{
					LemurChanges.Init();
				}
				if (EnemiesPlusConfig.wispChanges.Value || EnemiesPlusConfig.greaterWispChanges.Value)
				{
					WispChanges.Init();
				}
				if (EnemiesPlusConfig.helfireChanges.Value || EnemiesPlusConfig.lunarWispChanges.Value)
				{
					LunarChanges.Init();
				}
			}
			if (EnemiesPlusConfig.enableBeetleFamilyChanges.Value)
			{
				BeetleChanges.Init();
			}
		}
	}
	public static class HarmonyHooks
	{
		public static Harmony Patcher;

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			Patcher = new Harmony("com.score.EnemiesPlusPlus");
			if (EnemiesPlusPlugin.LeagueOfLiteralGays)
			{
				League();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void League()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Patcher.CreateClassProcessor(typeof(RiftFlinch)).Patch();
			RiftTitansPlugin.ReksaiCard.MonsterCategory = (MonsterCategory)4;
			DirectorCard card = RiftTitansPlugin.ReksaiCard.Card;
			card.spawnCard.directorCreditCost = 600;
			card.minimumStageCompletions = 2;
			CharacterMaster component = card.spawnCard.prefab.GetComponent<CharacterMaster>();
			AISkillDriver[] components = ((Component)component).GetComponents<AISkillDriver>();
			AISkillDriver[] array = components;
			foreach (AISkillDriver val in array)
			{
				switch (val.customName)
				{
				case "ChaseHard":
					val.shouldSprint = false;
					break;
				case "Attack":
					val.driverUpdateTimerOverride = 0.5f;
					val.nextHighPriorityOverride = components.Last();
					break;
				}
			}
			component.bodyPrefab.GetComponent<CharacterBody>().baseMoveSpeed = 10f;
		}
	}
	[HarmonyPatch(typeof(Slam), "GetMinimumInterruptPriority")]
	public class RiftFlinch
	{
		[HarmonyPostfix]
		private static void Postfix(ref InterruptPriority __result)
		{
			__result = (InterruptPriority)3;
		}
	}
	public static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		public static void Debug(string data)
		{
			_logSource.LogDebug((object)data);
		}

		public static void Error(string data)
		{
			_logSource.LogError((object)data);
		}

		public static void Fatal(string data)
		{
			_logSource.LogFatal((object)data);
		}

		public static void Info(string data)
		{
			_logSource.LogInfo((object)data);
		}

		public static void Message(string data)
		{
			_logSource.LogMessage((object)data);
		}

		public static void Warning(string data)
		{
			_logSource.LogWarning((object)data);
		}
	}
	public static class EnemiesPlusConfig
	{
		public static ConfigEntry<bool> enableSkills;

		public static ConfigEntry<bool> bellSkills;

		public static ConfigEntry<bool> impSkills;

		public static ConfigEntry<bool> wormTracking;

		public static ConfigEntry<bool> wormLeap;

		public static ConfigEntry<bool> lunarGolemSkills;

		public static ConfigEntry<bool> enableTweaks;

		public static ConfigEntry<bool> lemChanges;

		public static ConfigEntry<bool> wispChanges;

		public static ConfigEntry<bool> greaterWispChanges;

		public static ConfigEntry<bool> helfireChanges;

		public static ConfigEntry<bool> lunarWispChanges;

		public static ConfigEntry<bool> enableBeetleFamilyChanges;

		public static ConfigEntry<bool> beetleBurrow;

		public static ConfigEntry<bool> beetleSpit;

		public static ConfigEntry<bool> bgChanges;

		public static ConfigEntry<bool> queenChanges;

		private static ConfigFile PluginConfigFile { get; set; }

		public static void Init(ConfigFile cfg)
		{
			PluginConfigFile = cfg;
			if (EnemiesPlusPlugin.RooInstalled)
			{
				InitRoO();
			}
			BindSkills("Skills");
			BindTweaks("Tweaks");
			BindBeetles("Beetles");
		}

		private static void BindSkills(string section)
		{
			enableSkills = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable New Skills", "Allows any of the skills within this section to be toggled on and off.", true, (ConfigFlags)1);
			bellSkills = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Brass Contraptions Buff Beam Skill", "Adds a new skill that gives an ally increased armor.", true, (ConfigFlags)1);
			impSkills = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Imps Void Spike Skill", "Adds a new skill for Imps to throw void spikes at range, similarly to the Imp OverLord.", true, (ConfigFlags)1);
			lunarGolemSkills = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Lunar Golems Lunar Shell Skill", "Adds a new ability that gives them some stuff idk its vanilla but unused", true, (ConfigFlags)1);
			wormLeap = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Worms Leap Skill", "Adds a new leap skill.", true, (ConfigFlags)1);
		}

		private static void BindTweaks(string section)
		{
			enableTweaks = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Enemy Tweaks", "Allows any of the skills within this section to be toggled on and off.", true, (ConfigFlags)1);
			helfireChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Lunar Helfire Debuff", "Enables Lunar enemies to apply the new Helfire debuff.", true, (ConfigFlags)1);
			lunarWispChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Lunar Wisp Changes", "Increases Lunar Wisp movement speed and acceleration, orb applies helfire", true, (ConfigFlags)1);
			wispChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Wisp Changes", "Makes the wisp attack a fast projectile and increases Wisp bullet count", true, (ConfigFlags)1);
			greaterWispChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Greater Wisp Changes", "Decreases Greater Wisp credit cost", true, (ConfigFlags)1);
			lemChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Lemurian Bite Changes", "Adds slight leap to Lemurian bite", true, (ConfigFlags)1);
			wormTracking = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Worm Tracking Changes", "Changes Worms to have better targeting.", true, (ConfigFlags)1);
		}

		private static void BindBeetles(string section)
		{
			enableBeetleFamilyChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Beetle Family Changes", "Enables all beetle related changes. Yes, they needed their own section. Unaffected by other config sections.", true, (ConfigFlags)1);
			beetleBurrow = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Lil Beetle Burrow Skill", "Adds a new projectile attack to beetles and adds a new mobility skill that allows beetles to burrow into the ground and reappear near the player.", true, (ConfigFlags)1);
			beetleSpit = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Lil Beetles Spit Skill", "Adds a new projectile attack to beetles and adds a new mobility skill that allows beetles to burrow into the ground and reappear near the player.", true, (ConfigFlags)1);
			bgChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Beetle Guards Rally Cry Skill", "Adds a new skill that gives them and nearby allies increased attack speed and movement speed", true, (ConfigFlags)1);
			queenChanges = Extensions.BindOption<bool>(PluginConfigFile, section, "Enable Beetle Queens Debuff", "Adds a new debuff, Beetle Juice, to Beetle Queen and ally beetles attacks and makes spit explode mid air", true, (ConfigFlags)1);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void InitRoO()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0063: 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_007c: Expected O, but got Unknown
			try
			{
				ModSettingsManager.SetModDescription("Enemies but good.", "com.score.EnemiesPlusPlus", "EnemiesPlusPlus");
				byte[] array = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)EnemiesPlusPlugin.Instance).Info.Location), "icon.png"));
				Texture2D val = new Texture2D(256, 256);
				ImageConversion.LoadImage(val, array);
				ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f)));
			}
			catch (Exception ex)
			{
				Log.Debug(ex.ToString());
			}
		}
	}
	public static class Utils
	{
		public static void ReorderSkillDrivers(this GameObject master, int targetIdx)
		{
			AISkillDriver[] components = master.GetComponents<AISkillDriver>();
			master.ReorderSkillDrivers(components, components.Length - 1, targetIdx);
		}

		public static void ReorderSkillDrivers(this GameObject master, AISkillDriver targetSkill, int targetIdx)
		{
			AISkillDriver[] components = master.GetComponents<AISkillDriver>();
			master.ReorderSkillDrivers(components, Array.IndexOf(components, targetSkill), targetIdx);
		}

		public static void ReorderSkillDrivers(this GameObject master, AISkillDriver[] skills, int currentIdx, int targetIdx)
		{
			if (currentIdx < 0 || currentIdx >= skills.Length)
			{
				Log.Error($"{currentIdx} index not found or out of range. Must be less than {skills.Length}");
				return;
			}
			string targetName = skills[currentIdx].customName;
			if (targetIdx < 0 || targetIdx >= skills.Length)
			{
				Log.Error($"Unable to reorder skilldriver {targetName} into position {targetIdx}. target must be less than {skills.Length}");
				return;
			}
			if (targetIdx == currentIdx)
			{
				Log.Warning($"Skilldriver {targetName} already has the target index of {targetIdx}");
				return;
			}
			Dictionary<string, string> dictionary = skills.Where((AISkillDriver s) => (Object)(object)s.nextHighPriorityOverride != (Object)null).ToDictionary((AISkillDriver s) => s.customName, (AISkillDriver s) => s.nextHighPriorityOverride.customName);
			if (targetIdx > currentIdx)
			{
				master.AddComponentCopy<AISkillDriver>(skills[currentIdx]);
				Object.DestroyImmediate((Object)(object)skills[currentIdx]);
			}
			for (int i = targetIdx; i < skills.Length; i++)
			{
				if (i != currentIdx)
				{
					master.AddComponentCopy<AISkillDriver>(skills[i]);
					Object.DestroyImmediate((Object)(object)skills[i]);
				}
			}
			skills = master.GetComponents<AISkillDriver>();
			AISkillDriver val = ((IEnumerable<AISkillDriver>)skills).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == targetName));
			if ((Object)(object)val != (Object)null && Array.IndexOf(skills, val) == targetIdx)
			{
				Log.Debug($"Successfully set {targetName} to {targetIdx}");
			}
			else
			{
				Log.Error($"Done fucked it up on {targetName} with {targetIdx}");
			}
			if (!dictionary.Any())
			{
				return;
			}
			foreach (AISkillDriver val2 in skills)
			{
				if (Object.op_Implicit((Object)(object)val2) && dictionary.TryGetValue(val2.customName, out var target))
				{
					AISkillDriver val3 = ((IEnumerable<AISkillDriver>)skills).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == target));
					if ((Object)(object)val3 == (Object)null)
					{
						Log.Error("Unable to reset skill override for " + val2.customName + " targeting " + target);
						continue;
					}
					val2.nextHighPriorityOverride = val3;
					Log.Debug("successfully reset override for " + val2.customName + " targeting " + target);
				}
			}
		}

		public static void RemoveComponent<T>(this GameObject go) where T : Component
		{
			T val = default(T);
			if (go.TryGetComponent<T>(ref val))
			{
				Object.Destroy((Object)(object)val);
			}
		}

		public static void RemoveComponents<T>(this GameObject go) where T : Component
		{
			T[] components = go.GetComponents<T>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.Destroy((Object)(object)components[i]);
			}
		}

		public static T GetCopyOf<T>(this Component comp, T other) where T : Component
		{
			Type type = ((object)comp).GetType();
			if (type != ((object)other).GetType())
			{
				return default(T);
			}
			BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			PropertyInfo[] properties = type.GetProperties(bindingAttr);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.CanWrite)
				{
					try
					{
						propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
					}
					catch
					{
					}
				}
			}
			FieldInfo[] fields = type.GetFields(bindingAttr);
			foreach (FieldInfo fieldInfo in fields)
			{
				fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		public static T GetCopyOf<T>(this ScriptableObject comp, T other) where T : ScriptableObject
		{
			Type type = ((object)comp).GetType();
			if (type != ((object)other).GetType())
			{
				return default(T);
			}
			BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			PropertyInfo[] properties = type.GetProperties(bindingAttr);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.CanWrite)
				{
					try
					{
						propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
					}
					catch
					{
					}
				}
			}
			FieldInfo[] fields = type.GetFields(bindingAttr);
			foreach (FieldInfo fieldInfo in fields)
			{
				fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		public static T AddComponentCopy<T>(this GameObject go, T toAdd) where T : Component
		{
			return ((Component)(object)go.AddComponent<T>()).GetCopyOf(toAdd);
		}

		public static bool TryModifyFieldValue<T>(this EntityStateConfiguration entityStateConfiguration, string fieldName, T value)
		{
			ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
			if (Object.op_Implicit(orCreateField.fieldValue.objectValue) && typeof(Object).IsAssignableFrom(typeof(T)))
			{
				ref Object objectValue = ref orCreateField.fieldValue.objectValue;
				object obj = value;
				objectValue = (Object)((obj is Object) ? obj : null);
				return true;
			}
			if (orCreateField.fieldValue.stringValue != null && StringSerializer.CanSerializeType(typeof(T)))
			{
				orCreateField.fieldValue.stringValue = StringSerializer.Serialize(typeof(T), (object)value);
				return true;
			}
			Debug.LogError((object)("Failed to modify field " + fieldName));
			return false;
		}

		public static bool TryGetFieldValue<T>(this EntityStateConfiguration entityStateConfiguration, string fieldName, out T value) where T : Object
		{
			ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
			if (Object.op_Implicit(orCreateField.fieldValue.objectValue) && typeof(Object).IsAssignableFrom(typeof(T)))
			{
				value = (T)(object)orCreateField.fieldValue.objectValue;
				return true;
			}
			if (!string.IsNullOrEmpty(orCreateField.fieldValue.stringValue))
			{
				Debug.LogError((object)("Failed to return " + fieldName + " as an Object, try getting the string value instead."));
			}
			else
			{
				Debug.LogError((object)("Field is null " + fieldName));
			}
			value = default(T);
			return false;
		}

		public static bool TryGetFieldValueString<T>(this EntityStateConfiguration entityStateConfiguration, string fieldName, out T value) where T : IEquatable<T>
		{
			ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
			if (orCreateField.fieldValue.stringValue != null && StringSerializer.CanSerializeType(typeof(T)))
			{
				value = (T)StringSerializer.Deserialize(typeof(T), orCreateField.fieldValue.stringValue);
				return true;
			}
			if (Object.op_Implicit(orCreateField.fieldValue.objectValue))
			{
				Debug.LogError((object)("Failed to return " + fieldName + " as a string, try getting the Object value instead."));
			}
			else
			{
				Debug.LogError((object)("Field is null " + fieldName));
			}
			value = default(T);
			return false;
		}
	}
}
namespace EnemiesPlus.Content.Worm
{
	internal class WormChanges
	{
		internal GameObject MagmaWorm => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaWormBody.prefab").WaitForCompletion();

		internal GameObject ElectricWorm => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricWormBody.prefab").WaitForCompletion();

		internal GameObject MagmaWormMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaWormMaster.prefab").WaitForCompletion();

		internal GameObject ElectricWormMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricWormMaster.prefab").WaitForCompletion();

		public static WormChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new WormChanges();
			}
		}

		private WormChanges()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			if (EnemiesPlusConfig.wormTracking.Value)
			{
				SteerAtTarget.fastTurnRate = 120f;
				SteerAtTarget.slowTurnRate = 45f;
				SteerAtTarget.OnEnter += new hook_OnEnter(SteerAtTarget_OnEnter);
			}
			if (!EnemiesPlusConfig.wormLeap.Value)
			{
				return;
			}
			MagmaWormMaster.ReorderSkillDrivers(1);
			ParticleSystem[] componentsInChildren = ((Component)MagmaWorm.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponentsInChildren<ParticleSystem>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 2f;
			}
			SkillDef skillDef = MagmaWorm.GetComponent<SkillLocator>().utility.skillFamily.variants[0].skillDef;
			skillDef.activationState = new SerializableEntityStateType(typeof(Leap));
			skillDef.baseRechargeInterval = 60f;
			skillDef.activationStateMachineName = "Weapon";
			AISkillDriver[] components = MagmaWormMaster.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val in components)
			{
				if (val.customName == "Blink")
				{
					val.shouldSprint = true;
					val.minDistance = 0f;
					val.aimType = (AimType)1;
				}
				else
				{
					val.skillSlot = (SkillSlot)(-1);
				}
			}
		}

		private void WormBodyPositionsDriver_FixedUpdateServer(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			MethodReference val4 = default(MethodReference);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<WormBodyPositionsDriver>(x, "referenceTransform"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val4)
			}))
			{
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<Vector3, WormBodyPositionsDriver, Vector3>>((Func<Vector3, WormBodyPositionsDriver, Vector3>)delegate(Vector3 pos, WormBodyPositionsDriver driver)
			{
				//IL_0064: 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)
				CharacterBody val2 = default(CharacterBody);
				if (((Component)driver).TryGetComponent<CharacterBody>(ref val2) && Object.op_Implicit((Object)(object)val2.master))
				{
					BaseAI[] aiComponents = val2.master.aiComponents;
					Vector3 result = default(Vector3);
					foreach (BaseAI val3 in aiComponents)
					{
						if (Object.op_Implicit((Object)(object)val3) && val3.currentEnemy != null && val3.currentEnemy.TestLOSNow() && val3.currentEnemy.GetBullseyePosition(ref result))
						{
							return result;
						}
					}
				}
				return pos;
			});
		}

		private void SteerAtTarget_OnEnter(orig_OnEnter orig, SteerAtTarget self)
		{
			orig.Invoke(self);
			CharacterMaster val = (Object.op_Implicit((Object)(object)((EntityState)self).characterBody) ? ((EntityState)self).characterBody.master : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			BaseAI[] aiComponents = val.aiComponents;
			foreach (BaseAI val2 in aiComponents)
			{
				if (Object.op_Implicit((Object)(object)val2) && val2.currentEnemy != null && val2.currentEnemy.TestLOSNow())
				{
					self.wormBodyPositionsDriver.referenceTransform = ((Component)val2.currentEnemy.bestHurtBox).transform;
				}
			}
		}
	}
}
namespace EnemiesPlus.Content.Wisp
{
	public class FireBlast : BaseSkillState
	{
		private float duration;

		public static GameObject projectilePrefab;

		public override void OnEnter()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = FireEmbers.baseDuration;
			Ray aimRay = ((BaseState)this).GetAimRay();
			Util.PlayAttackSpeedSound(FireEmbers.attackString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			((EntityState)this).PlayAnimation("Body", "FireAttack1", "FireAttack1.playbackRate", duration, 0f);
			Fire();
		}

		public void Fire()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				bool flag = ((BaseState)this).RollCrit();
				Ray aimRay = ((BaseState)this).GetAimRay();
				for (int i = 0; i < FireEmbers.bulletCount; i++)
				{
					((Ray)(ref aimRay)).direction = Util.ApplySpread(((Ray)(ref aimRay)).direction, FireEmbers.minSpread, FireEmbers.maxSpread, 0f, 0f, 0f, 0f);
					ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * FireEmbers.damageCoefficient, FireEmbers.force / 3f, flag, (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)3;
		}
	}
	internal class WispChanges
	{
		public static GameObject WispProjectile;

		public static GameObject WispGhostPrefab;

		internal SpawnCard GreaterWispCard => Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/GreaterWisp/cscGreaterWisp.asset").WaitForCompletion();

		internal GameObject WispMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Wisp/WispMaster.prefab").WaitForCompletion();

		internal EntityStateConfiguration WispEmbers => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/Wisp/EntityStates.Wisp1Monster.FireEmbers.asset").WaitForCompletion();

		public static WispChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new WispChanges();
			}
		}

		private WispChanges()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			if (EnemiesPlusConfig.wispChanges.Value)
			{
				CreateProjectile();
				WispEmbers.TryModifyFieldValue("damageCoefficient", 1f);
				WispEmbers.TryModifyFieldValue("bulletCount", 6);
				BaseAI component = WispMaster.GetComponent<BaseAI>();
				component.aimVectorDampTime = 0.1f;
				component.aimVectorMaxSpeed = 180f;
				ChargeEmbers.FixedUpdate += new hook_FixedUpdate(ChargeEmbers_FixedUpdate);
			}
			if (EnemiesPlusConfig.greaterWispChanges.Value)
			{
				GreaterWispCard.directorCreditCost = 120;
			}
		}

		private void CreateProjectile()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			WispProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/Fireball.prefab").WaitForCompletion(), "ScoreWispFireball", true);
			WispGhostPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/FireballGhost.prefab").WaitForCompletion(), "ScoreWispFireballGhost", false);
			((Component)WispGhostPrefab.transform.GetChild(0)).transform.localScale = Vector3.one * 0.35f;
			((Renderer)((Component)WispGhostPrefab.transform.GetChild(0)).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Wisp/matWispEmber.mat").WaitForCompletion();
			WispProjectile.GetComponent<ProjectileController>().ghostPrefab = WispGhostPrefab;
			WispProjectile.GetComponent<ProjectileSimple>().desiredForwardSpeed = 250f;
			ProjectileSingleTargetImpact val = default(ProjectileSingleTargetImpact);
			if (WispProjectile.TryGetComponent<ProjectileSingleTargetImpact>(ref val))
			{
				val.impactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Wisp/ImpactWispEmber.prefab").WaitForCompletion();
			}
			ContentAddition.AddProjectile(WispProjectile);
			bool flag = default(bool);
			ContentAddition.AddEntityState<FireBlast>(ref flag);
			FireBlast.projectilePrefab = WispProjectile;
		}

		private void ChargeEmbers_FixedUpdate(orig_FixedUpdate orig, ChargeEmbers self)
		{
			if (self.stopwatch + Time.fixedDeltaTime >= self.duration && ((EntityState)self).isAuthority)
			{
				((EntityState)self).outer.SetNextState((EntityState)(object)new FireBlast());
			}
			else
			{
				orig.Invoke(self);
			}
		}
	}
}
namespace EnemiesPlus.Content.Lunar
{
	internal class LunarChanges
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static CustomDotBehaviour <0>__AddPercentHelfireDamage;

			public static CustomDotVisual <1>__AddHelfireDotVisuals;
		}

		public static GameObject lunarWispTrackingBomb;

		public static BuffDef helfireDebuff;

		public static ModdedDamageType helfireDT;

		public static DotIndex helfireDotIdx;

		public static EffectParams lunarHelfireEffect;

		public static GameObject lunarHelfireIgniteEffectPrefab;

		internal Sprite FireBuffSprite => Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffOnFireIcon.tif").WaitForCompletion();

		internal GameObject LunarGolemMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/LunarGolemMaster.prefab").WaitForCompletion();

		internal SkillDef LunarGolemShield => Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/LunarGolem/LunarGolemBodyShield.asset").WaitForCompletion();

		internal GameObject LunarWisp => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispBody.prefab").WaitForCompletion();

		internal GameObject LunarWispMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispMaster.prefab").WaitForCompletion();

		internal EntityStateConfiguration LunarSeekingBomb => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/LunarWisp/EntityStates.LunarWisp.SeekingBomb.asset").WaitForCompletion();

		internal EntityStateConfiguration LunarShell => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/LunarGolem/EntityStates.LunarGolem.Shell.asset").WaitForCompletion();

		internal EntityStateConfiguration LunarWispGat => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/LunarWisp/EntityStates.LunarWisp.FireLunarGuns.asset").WaitForCompletion();

		public static LunarChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new LunarChanges();
			}
		}

		private LunarChanges()
		{
			if (EnemiesPlusConfig.enableTweaks.Value)
			{
				if (EnemiesPlusConfig.helfireChanges.Value)
				{
					CreateHelfireDebuff();
				}
				if (EnemiesPlusConfig.lunarWispChanges.Value)
				{
					LunarWispChanges();
				}
			}
			if (EnemiesPlusConfig.enableSkills.Value && EnemiesPlusConfig.lunarGolemSkills.Value)
			{
				LunarGolemChanges();
			}
		}

		private void CreateHelfireDebuff()
		{
			//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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			helfireDebuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)helfireDebuff).name = "LunarHelfireDebuff";
			helfireDebuff.canStack = true;
			helfireDebuff.isDOT = true;
			helfireDebuff.isCooldown = false;
			helfireDebuff.isDebuff = true;
			helfireDebuff.buffColor = Color.cyan;
			helfireDebuff.iconSprite = FireBuffSprite;
			ContentAddition.AddBuffDef(helfireDebuff);
			helfireDT = DamageAPI.ReserveDamageType();
			BuffDef obj = helfireDebuff;
			object obj2 = <>O.<0>__AddPercentHelfireDamage;
			if (obj2 == null)
			{
				CustomDotBehaviour val2 = AddPercentHelfireDamage;
				<>O.<0>__AddPercentHelfireDamage = val2;
				obj2 = (object)val2;
			}
			object obj3 = <>O.<1>__AddHelfireDotVisuals;
			if (obj3 == null)
			{
				CustomDotVisual val3 = AddHelfireDotVisuals;
				<>O.<1>__AddHelfireDotVisuals = val3;
				obj3 = (object)val3;
			}
			helfireDotIdx = DotAPI.RegisterDotDef(0.2f, 0f, (DamageColorIndex)7, obj, (CustomDotBehaviour)obj2, (CustomDotVisual)obj3);
			lunarHelfireIgniteEffectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/HelfireIgniteEffect");
			lunarHelfireEffect = new EffectParams
			{
				startSound = "Play_item_proc_igniteOnKill_Loop",
				stopSound = "Stop_item_proc_igniteOnKill_Loop"
			};
			LegacyResourcesAPI.LoadAsyncCallback<Material>("Materials/matOnHelfire", (Action<Material>)delegate(Material val)
			{
				lunarHelfireEffect.overlayMaterial = val;
			});
			LegacyResourcesAPI.LoadAsyncCallback<GameObject>("Prefabs/HelfireEffect", (Action<GameObject>)delegate(GameObject val)
			{
				lunarHelfireEffect.fireEffectPrefab = val;
			});
			lunarWispTrackingBomb = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispTrackingBomb.prefab").WaitForCompletion(), "LunarWispOrbScore");
			DamageAPI.AddModdedDamageType(ref lunarWispTrackingBomb.GetComponent<ProjectileDamage>().damageType, helfireDT);
			ContentAddition.AddProjectile(lunarWispTrackingBomb);
			LunarSeekingBomb.TryModifyFieldValue<GameObject>("projectilePrefab", lunarWispTrackingBomb);
			if (LunarWispGat.TryGetFieldValueString<float>("baseDamagePerSecondCoefficient", out var value))
			{
				LunarWispGat.TryModifyFieldValue("baseDamagePerSecondCoefficient", value * 0.5f);
			}
		}

		private static void AddHelfireDotVisuals(DotController self)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self.victimBody) && self.HasDotActive(helfireDotIdx))
			{
				Transform val = (Object.op_Implicit((Object)(object)self.victimBody.modelLocator) ? self.victimBody.modelLocator.modelTransform : null);
				if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<LunarHelfireController>()))
				{
					LunarHelfireController lunarHelfireController = ((Component)self).gameObject.AddComponent<LunarHelfireController>();
					((BurnEffectController)lunarHelfireController).target = ((Component)val).gameObject;
					((BurnEffectController)lunarHelfireController).effectType = lunarHelfireEffect;
					lunarHelfireController.dotController = self;
				}
			}
		}

		private static void AddPercentHelfireDamage(DotController self, DotStack dotStack)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			if (dotStack?.dotIndex == (DotIndex?)helfireDotIdx && Object.op_Implicit((Object)(object)self.victimBody) && Object.op_Implicit((Object)(object)self.victimBody.healthComponent))
			{
				dotStack.damageType |= DamageTypeCombo.op_Implicit((DamageType)1);
				dotStack.damage = self.victimBody.healthComponent.fullHealth * 0.01f * 0.4f;
				EffectManager.SpawnEffect(lunarHelfireIgniteEffectPrefab, new EffectData
				{
					origin = self.victimBody.corePosition
				}, true);
			}
		}

		private void LunarWispChanges()
		{
			CharacterBody component = LunarWisp.GetComponent<CharacterBody>();
			component.baseMoveSpeed = 20f;
			component.baseAcceleration = 20f;
			AISkillDriver[] components = LunarWispMaster.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val in components)
			{
				switch (val.customName)
				{
				case "Back Up":
					val.maxDistance = 15f;
					break;
				case "Minigun":
					val.minDistance = 15f;
					val.maxDistance = 75f;
					break;
				case "Chase":
					val.minDistance = 30f;
					val.shouldSprint = true;
					break;
				}
			}
		}

		private void LunarGolemChanges()
		{
			//IL_0078: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			LunarShell.TryModifyFieldValue("buffDuration", 12f);
			LunarGolemShield.baseRechargeInterval = 30f;
			(from driver in LunarGolemMaster.GetComponents<AISkillDriver>()
				where driver.customName == "StrafeAndShoot"
				select driver).First().requireSkillReady = true;
			AISkillDriver obj = LunarGolemMaster.AddComponent<AISkillDriver>();
			obj.customName = "LunarShell";
			obj.skillSlot = (SkillSlot)1;
			obj.requireSkillReady = true;
			obj.requireEquipmentReady = false;
			obj.driverUpdateTimerOverride = 3f;
			obj.moveTargetType = (TargetType)0;
			obj.movementType = (MovementType)1;
			LunarGolemMaster.ReorderSkillDrivers(0);
		}

		private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
		{
			//IL_0040: 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)
			if (!damageReport.damageInfo.rejected && Object.op_Implicit((Object)(object)damageReport.attackerBody) && Object.op_Implicit((Object)(object)damageReport.victimBody) && (damageReport.attackerBody.HasBuff(Buffs.LunarShell) || DamageAPI.HasModdedDamageType(damageReport.damageInfo, helfireDT)) && Util.CheckRoll(25f * damageReport.damageInfo.procCoefficient, damageReport.attackerMaster))
			{
				DotController.InflictDot(((Component)damageReport.victim).gameObject, damageReport.attacker, helfireDotIdx, 6f, 1f, (uint?)3u);
				damageReport.victimBody.AddTimedBuff(Buffs.HealingDisabled, 6f);
			}
		}
	}
	public class LunarHelfireController : BurnEffectController
	{
		public DotController dotController;

		public void FixedUpdate()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)dotController.victimBody) || !dotController.HasDotActive(LunarChanges.helfireDotIdx))
			{
				((BurnEffectController)this).HandleDestroy();
			}
		}
	}
}
namespace EnemiesPlus.Content.Lemur
{
	internal class LemurChanges
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__BiteLeap;
		}

		private SkillDef LemBite => Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Lemurian/LemurianBodyBite.asset").WaitForCompletion();

		public static LemurChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new LemurChanges();
			}
		}

		private LemurChanges()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			object obj = <>O.<0>__BiteLeap;
			if (obj == null)
			{
				hook_OnEnter val = BiteLeap;
				<>O.<0>__BiteLeap = val;
				obj = (object)val;
			}
			Bite.OnEnter += (hook_OnEnter)obj;
			LemBite.baseRechargeInterval = 1f;
		}

		private static void BiteLeap(orig_OnEnter orig, Bite self)
		{
			//IL_0008: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Ray aimRay = ((BaseState)self).GetAimRay();
			Vector3 val = ((Ray)(ref aimRay)).direction;
			val.y = 0f;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude > 0f)
			{
				val /= magnitude;
			}
			CharacterMotor characterMotor = ((EntityState)self).characterMotor;
			Vector3 velocity = val * ((EntityState)self).characterBody.moveSpeed;
			velocity.y = ((EntityState)self).characterBody.jumpPower * 0.25f;
			characterMotor.velocity = velocity;
			((BaseCharacterController)((EntityState)self).characterMotor).Motor.ForceUnground(0.1f);
		}
	}
}
namespace EnemiesPlus.Content.Imp
{
	internal class ImpChanges
	{
		public static GameObject impVoidSpikes;

		private GameObject ImpMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Imp/ImpMaster.prefab").WaitForCompletion();

		private GameObject ImpBody => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Imp/ImpBody.prefab").WaitForCompletion();

		public static ImpChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new ImpChanges();
			}
		}

		private ImpChanges()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			impVoidSpikes = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ImpBoss/ImpVoidspikeProjectile.prefab").WaitForCompletion(), "ImpVoidSpikeProjectileScore");
			impVoidSpikes.GetComponent<ProjectileImpactExplosion>().destroyOnWorld = true;
			ContentAddition.AddProjectile(impVoidSpikes);
			ImpVoidSpike.projectilePrefab = impVoidSpikes;
			CreateSpikeSkillFamily();
			AISkillDriver obj = ImpMaster.AddComponent<AISkillDriver>();
			obj.customName = "ImpVoidSpikes";
			obj.skillSlot = (SkillSlot)1;
			obj.maxDistance = 30f;
			obj.minDistance = 15f;
			obj.shouldSprint = false;
			obj.selectionRequiresAimTarget = true;
			obj.selectionRequiresTargetLoS = true;
			obj.requireSkillReady = true;
			obj.movementType = (MovementType)2;
			obj.aimType = (AimType)2;
			obj.moveTargetType = (TargetType)0;
			ImpMaster.ReorderSkillDrivers(2);
		}

		private void CreateSpikeSkillFamily()
		{
			//IL_0035: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = "ImpVoidSpikes";
			((Object)val).name = "ImpVoidSpikes";
			val.skillNameToken = "Void Spikes";
			val.skillDescriptionToken = "Throw spikes";
			bool flag = default(bool);
			val.activationState = ContentAddition.AddEntityState<ImpVoidSpike>(ref flag);
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)3;
			val.baseMaxStock = 1;
			val.baseRechargeInterval = 5f;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			val.dontAllowPastMaxStocks = true;
			val.beginSkillCooldownOnSkillEnd = true;
			val.canceledFromSprinting = false;
			val.forceSprintDuringState = false;
			val.fullRestockOnAssign = true;
			val.resetCooldownTimerOnUse = false;
			val.isCombatSkill = true;
			val.mustKeyPress = false;
			val.cancelSprintingOnActivation = false;
			ContentAddition.AddSkillDef(val);
			GenericSkill val2 = ImpBody.AddComponent<GenericSkill>();
			val2.skillName = "ImpVoidSpikes";
			SkillFamily val3 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val3).name = "ImpVoidSpikesFamily";
			val3.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = val
				}
			};
			val2._skillFamily = val3;
			ContentAddition.AddSkillFamily(val3);
			ImpBody.GetComponent<SkillLocator>().secondary = val2;
		}
	}
	public class ImpVoidSpike : BaseState
	{
		public static GameObject projectilePrefab;

		private Animator modelAnimator;

		private float duration;

		private int slashCount;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = DoubleSlash.baseDuration / base.attackSpeedStat;
			modelAnimator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = DoubleSlash.walkSpeedPenaltyCoefficient;
			Util.PlayAttackSpeedSound(DoubleSlash.enterSoundString, ((EntityState)this).gameObject, base.attackSpeedStat);
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "DoubleSlash", "DoubleSlash.playbackRate", duration, 0f);
				((EntityState)this).PlayAnimation("Gesture, Override", "DoubleSlash", "DoubleSlash.playbackRate", duration, 0f);
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(duration + 2f);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 1f;
			((EntityState)this).OnExit();
		}

		public void HandleSlash(string animatorParamName, string muzzleName)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!((double)modelAnimator.GetFloat(animatorParamName) <= 0.1))
			{
				Util.PlaySound(DoubleSlash.slashSoundString, ((EntityState)this).gameObject);
				EffectManager.SimpleMuzzleFlash(DoubleSlash.swipeEffectPrefab, ((EntityState)this).gameObject, muzzleName, true);
				slashCount++;
				Ray aimRay = ((BaseState)this).GetAimRay();
				ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, base.damageStat, 0f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)modelAnimator))
			{
				switch (slashCount)
				{
				case 0:
					HandleSlash("HandR.hitBoxActive", "SwipeRight");
					break;
				case 1:
					HandleSlash("HandL.hitBoxActive", "SwipeLeft");
					break;
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)5;
		}
	}
}
namespace EnemiesPlus.Content.Donger
{
	internal class BellChanges
	{
		internal GameObject BellMaster => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bell/BellMaster.prefab").WaitForCompletion();

		internal GameObject BellBody => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bell/BellBody.prefab").WaitForCompletion();

		internal EntityStateConfiguration BuffBeamConfig => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Junk/Bell/EntityStates.Bell.BellWeapon.BuffBeam.asset").WaitForCompletion();

		public static BellChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new BellChanges();
			}
		}

		private BellChanges()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			if (BuffBeamConfig.TryGetFieldValueString<AnimationCurve>("beamWidthCurve", out AnimationCurve value))
			{
				BuffBeamPlus.beamWidthCurve = value;
			}
			bool flag = default(bool);
			ContentAddition.AddEntityState<BuffBeamPlus>(ref flag);
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = "BuffBeamPlus";
			((Object)val).name = "BuffBeamPlus";
			val.skillNameToken = "BuffBeamPlus";
			val.skillDescriptionToken = "Creates a beam to a nearby ally and makes them big time beefy";
			val.activationState = new SerializableEntityStateType(typeof(BuffBeamPlus));
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)1;
			val.baseMaxStock = 1;
			val.baseRechargeInterval = 45f;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			val.cancelSprintingOnActivation = false;
			val.canceledFromSprinting = false;
			val.forceSprintDuringState = false;
			val.resetCooldownTimerOnUse = false;
			val.mustKeyPress = false;
			val.dontAllowPastMaxStocks = true;
			val.beginSkillCooldownOnSkillEnd = true;
			val.fullRestockOnAssign = true;
			val.isCombatSkill = true;
			ContentAddition.AddSkillDef(val);
			GenericSkill val2 = BellBody.AddComponent<GenericSkill>();
			val2.skillName = "BuffBeamPlus";
			SkillFamily val3 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val3).name = "BellBuffBeamPlusFamily";
			val3.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = val
				}
			};
			val2._skillFamily = val3;
			ContentAddition.AddSkillFamily(val3);
			BellBody.GetComponent<SkillLocator>().secondary = val2;
			AISkillDriver obj = BellMaster.AddComponent<AISkillDriver>();
			obj.customName = "BuffBeam";
			obj.skillSlot = (SkillSlot)1;
			obj.requiredSkill = val;
			obj.requireSkillReady = true;
			obj.requireEquipmentReady = false;
			obj.moveTargetType = (TargetType)1;
			obj.aimType = (AimType)1;
			obj.maxDistance = 75f;
			BellMaster.ReorderSkillDrivers(1);
		}
	}
	public class BuffBeamPlus : BaseState
	{
		public static float duration = 12f;

		public static GameObject buffBeamPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bell/BellBuffBeam.prefab").WaitForCompletion();

		public static AnimationCurve beamWidthCurve;

		public static string playBeamSoundString = "Play_emergency_drone_heal_loop";

		public static string stopBeamSoundString = "Stop_emergency_drone_heal_loop";

		public HurtBox targetHurtbox;

		public GameObject buffBeamInstance;

		public BezierCurveLine healBeamCurve;

		public Transform muzzleTransform;

		public Transform beamTipTransform;

		public override void OnEnter()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Invalid comparison between Unknown and I4
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			Util.PlaySound(playBeamSoundString, ((EntityState)this).gameObject);
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val = new BullseyeSearch
			{
				teamMaskFilter = TeamMask.none,
				sortMode = (SortMode)1,
				maxDistanceFilter = 75f,
				searchOrigin = ((Ray)(ref aimRay)).origin,
				searchDirection = ((Ray)(ref aimRay)).direction,
				maxAngleFilter = 180f,
				filterByLoS = true
			};
			((TeamMask)(ref val.teamMaskFilter)).AddTeam(((EntityState)this).teamComponent.teamIndex);
			val.RefreshCandidates();
			val.FilterOutGameObject(((Component)((EntityState)this).characterBody).gameObject);
			foreach (HurtBox result in val.GetResults())
			{
				CharacterBody val2 = (Object.op_Implicit((Object)(object)result.healthComponent) ? result.healthComponent.body : null);
				if (Object.op_Implicit((Object)(object)val2) && (int)val2.hullClassification != 2 && val2.bodyIndex != ((EntityState)this).characterBody.bodyIndex)
				{
					targetHurtbox = result;
				}
			}
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				((BaseState)this).StartAimMode(BuffBeam.duration, false);
				targetHurtbox.healthComponent.body.AddBuff(Buffs.ElephantArmorBoost.buffIndex);
				string text = "Muzzle";
				ChildLocator modelChildLocator = ((EntityState)this).GetModelChildLocator();
				if (Object.op_Implicit((Object)(object)modelChildLocator))
				{
					muzzleTransform = modelChildLocator.FindChild(text);
					buffBeamInstance = Object.Instantiate<GameObject>(buffBeamPrefab);
					ChildLocator component = buffBeamInstance.GetComponent<ChildLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						beamTipTransform = component.FindChild("BeamTip");
						healBeamCurve = buffBeamInstance.GetComponentInChildren<BezierCurveLine>();
					}
				}
			}
			else
			{
				((EntityState)this).skillLocator.secondary.AddOneStock();
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && (((EntityState)this).fixedAge >= duration || !Object.op_Implicit((Object)(object)targetHurtbox) || !Object.op_Implicit((Object)(object)targetHurtbox.healthComponent) || !targetHurtbox.healthComponent.alive))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void UpdateHealBeamVisuals()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			if (!Object.op_Implicit((Object)(object)muzzleTransform) || !Object.op_Implicit((Object)(object)healBeamCurve))
			{
				return;
			}
			if (beamWidthCurve != null)
			{
				float widthMultiplier = beamWidthCurve.Evaluate(((EntityState)this).age / duration);
				if (Object.op_Implicit((Object)(object)healBeamCurve.lineRenderer))
				{
					healBeamCurve.lineRenderer.widthMultiplier = widthMultiplier;
				}
			}
			healBeamCurve.v0 = muzzleTransform.forward * 3f;
			((Component)healBeamCurve).transform.position = muzzleTransform.position;
			if (Object.op_Implicit((Object)(object)targetHurtbox))
			{
				beamTipTransform.position = ((Component)targetHurtbox).transform.position;
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			UpdateHealBeamVisuals();
		}

		public override void OnExit()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(stopBeamSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)buffBeamInstance))
			{
				EntityState.Destroy((Object)(object)buffBeamInstance);
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)targetHurtbox) && Object.op_Implicit((Object)(object)targetHurtbox.healthComponent) && Object.op_Implicit((Object)(object)targetHurtbox.healthComponent.body))
			{
				targetHurtbox.healthComponent.body.RemoveBuff(Buffs.ElephantArmorBoost.buffIndex);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)4;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			HurtBoxReference val = HurtBoxReference.FromHurtBox(targetHurtbox);
			((HurtBoxReference)(ref val)).Write(writer);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			HurtBoxReference val = default(HurtBoxReference);
			((HurtBoxReference)(ref val)).Read(reader);
			GameObject obj = ((HurtBoxReference)(ref val)).ResolveGameObject();
			targetHurtbox = ((obj != null) ? obj.GetComponent<HurtBox>() : null);
		}
	}
}
namespace EnemiesPlus.Content.Beetle
{
	public class BeetleBurrow : BaseState
	{
		public static float burrowAccuracyCoefficient = 0.3f;

		public static float baseBurrowDuration = 1f;

		public static float radius = 10f;

		private HurtBox target;

		private Vector3 predictedDestination;

		public float duration;

		private CharacterModel characterModel;

		private HurtBoxGroup hurtboxGroup;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseBurrowDuration;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
				hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>();
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount + 1;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup obj2 = hurtboxGroup;
				int invisibilityCount = obj2.hurtBoxesDeactivatorCounter;
				obj2.hurtBoxesDeactivatorCounter = invisibilityCount + 1;
			}
			((EntityState)this).gameObject.layer = LayerIndex.fakeActor.intVal;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			}
			CalculatePredictedDestination();
			Util.PlaySound("Play_magmaWorm_burrowed_loop", ((EntityState)this).gameObject);
		}

		private void CalculatePredictedDestination()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_000c: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val2 = new BullseyeSearch
			{
				searchOrigin = ((Ray)(ref aimRay)).origin,
				searchDirection = ((Ray)(ref aimRay)).direction,
				maxDistanceFilter = 100f,
				teamMaskFilter = TeamMask.allButNeutral,
				filterByLoS = false,
				sortMode = (SortMode)2
			};
			((TeamMask)(ref val2.teamMaskFilter)).RemoveTeam(TeamComponent.GetObjectTeam(((EntityState)this).gameObject));
			val2.RefreshCandidates();
			target = val2.GetResults().FirstOrDefault();
			if (Object.op_Implicit((Object)(object)target))
			{
				val = ((Component)target).transform.position - ((EntityState)this).transform.position;
				HealthComponent healthComponent = target.healthComponent;
				object obj;
				if (healthComponent == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody body = healthComponent.body;
					obj = ((body != null) ? body.characterMotor : null);
				}
				CharacterMotor val3 = (CharacterMotor)obj;
				if (Object.op_Implicit((Object)(object)val3))
				{
					Vector3 moveDirection = val3.moveDirection;
					Vector3 normalized = ((Vector3)(ref moveDirection)).normalized;
					float num = target.healthComponent.body.moveSpeed * duration;
					Vector3 val4 = val + (num + radius) * normalized;
					if (((Vector3)(ref val4)).sqrMagnitude <= radius * radius)
					{
						val4 = val - (num - radius) * normalized;
					}
					val = val4;
				}
			}
			predictedDestination = ((EntityState)this).transform.position + val;
			((EntityState)this).characterDirection.forward = val;
		}

		private Vector3 GetFinalPosition()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0035: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (Object.op_Implicit((Object)(object)target) ? Vector3.Lerp(predictedDestination, ((Component)target).transform.position, burrowAccuracyCoefficient) : predictedDestination);
			NodeGraph groundNodes = SceneInfo.instance.groundNodes;
			NodeIndex val2 = groundNodes.FindClosestNode(val, ((EntityState)this).characterBody.hullClassification, float.PositiveInfinity);
			groundNodes.GetNodePosition(val2, ref val);
			return val + (((EntityState)this).transform.position - ((EntityState)this).characterBody.footPosition);
		}

		private void SetPosition(Vector3 newPosition)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			if (characterMotor != null)
			{
				((BaseCharacterController)characterMotor).Motor.SetPositionAndRotation(newPosition, Quaternion.identity, true);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ExitBurrow());
			}
		}

		public override void OnExit()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//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_0024: Unknown result type (might be due to invalid IL or missing references)
			Vector3 finalPosition = GetFinalPosition();
			((EntityState)this).characterDirection.forward = finalPosition - ((EntityState)this).transform.position;
			SetPosition(finalPosition);
			((EntityState)this).gameObject.layer = LayerIndex.defaultLayer.intVal;
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			if (characterMotor != null)
			{
				((BaseCharacterController)characterMotor).Motor.RebuildCollidableLayers();
			}
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount - 1;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup obj2 = hurtboxGroup;
				int invisibilityCount = obj2.hurtBoxesDeactivatorCounter;
				obj2.hurtBoxesDeactivatorCounter = invisibilityCount - 1;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = true;
			}
			Util.PlaySound("Stop_magmaWorm_burrowed_loop", ((EntityState)this).gameObject);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class BeetleChanges
	{
		public static GameObject beetleSpit;

		public static GameObject beetleSpitGhost;

		public static GameObject beetleSpitExplosion;

		public static GameObject burrowFX;

		public static ModdedDamageType beetleJuiceDT;

		internal GameObject BeetleMaster => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Beetle.BeetleMaster_prefab).WaitForCompletion();

		internal GameObject BeetleBody => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Beetle.BeetleBody_prefab).WaitForCompletion();

		internal GameObject BeetleQueenSpit => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleQueen.BeetleQueenSpit_prefab).WaitForCompletion();

		internal GameObject BeetleQueenAcid => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleQueen.BeetleQueenAcid_prefab).WaitForCompletion();

		internal BuffDef BeetleJuice => Addressables.LoadAssetAsync<BuffDef>((object)RoR2_Base_BeetleGroup.bdBeetleJuice_asset).WaitForCompletion();

		internal GameObject BeetleGuardMaster => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleGuard.BeetleGuardMaster_prefab).WaitForCompletion();

		internal GameObject BeetleGuardBody => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleGuard.BeetleGuardBody_prefab).WaitForCompletion();

		internal SkillDef BGUtilitySkillDef => Addressables.LoadAssetAsync<SkillDef>((object)RoR2_Base_BeetleGuard.BeetleGuardBodyDefenseUp_asset).WaitForCompletion();

		internal SkillDef BeetlePrimary => Addressables.LoadAssetAsync<SkillDef>((object)RoR2_Base_Beetle.BeetleBodyHeadbutt_asset).WaitForCompletion();

		internal SkillDef BeetleSecondary => Addressables.LoadAssetAsync<SkillDef>((object)RoR2_Base_Beetle.BeetleBodySleep_asset).WaitForCompletion();

		internal EntityStateConfiguration BeetleSpawn => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)RoR2_Base_Beetle_EntityStates_BeetleMonster.SpawnState_asset).WaitForCompletion();

		public static BeetleChanges Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new BeetleChanges();
			}
		}

		private BeetleChanges()
		{
			MakeJuice();
			if (EnemiesPlusConfig.beetleBurrow.Value || EnemiesPlusConfig.beetleSpit.Value)
			{
				LilGuyChanges();
			}
			if (EnemiesPlusConfig.bgChanges.Value)
			{
				GuardChanges();
			}
			if (EnemiesPlusConfig.queenChanges.Value)
			{
				QueenChanges();
			}
		}

		private void CharacterBody_AddTimedBuff_BuffDef_float(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.Field(typeof(Buffs), "BeetleJuice"))
			}) && val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 10)
			}))
			{
				val.Next.Operand = 1;
			}
		}

		private static void CharacterBody_RecalculateStats(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			int juiceLoc = 0;
			float num = default(float);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.Field(typeof(Buffs), "BeetleJuice")),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount")
			}) && val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref juiceLoc)
			}) && val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, juiceLoc)
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.Next.Operand = 0f;
			}
			else
			{
				Log.Error("ILHook failed for beetle juice CharacterBody.RecalculateStats");
			}
		}

		private static void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = damageReport.damageInfo;
			if (damageInfo != null && !damageInfo.rejected && Object.op_Implicit((Object)(object)damageReport.victimBody) && DamageAPI.HasModdedDamageType(damageReport.damageInfo, beetleJuiceDT))
			{
				damageReport.victimBody.AddTimedBuff(Buffs.BeetleJuice, 5f);
			}
		}

		private void MakeJuice()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0087: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00e8: 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_0115: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			CharacterBody.AddTimedBuff_BuffDef_float += new Manipulator(CharacterBody_AddTimedBuff_BuffDef_float);
			BeetleJuice.canStack = false;
			beetleJuiceDT = DamageAPI.ReserveDamageType();
			beetleSpit = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleQueen.BeetleQueenSpit_prefab).WaitForCompletion(), "BeetleSpitProjectileScore");
			beetleSpit.GetComponent<ProjectileSimple>().desiredForwardSpeed = 60f;
			Transform transform = beetleSpit.transform;
			transform.localScale /= 2f;
			beetleSpit.GetComponent<Rigidbody>().useGravity = true;
			beetleSpitExplosion = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleQueen.BeetleSpitExplosion_prefab).WaitForCompletion(), "BeetleSpitExplosionScore", false);
			Transform child = beetleSpitExplosion.transform.GetChild(0);
			child.localScale /= 2f;
			foreach (Transform item in beetleSpitExplosion.transform.GetChild(0))
			{
				item.localScale /= 2f;
			}
			ProjectileImpactExplosion component = beetleSpit.GetComponent<ProjectileImpactExplosion>();
			component.impactEffect = beetleSpitExplosion;
			((ProjectileExplosion)component).childrenProjectilePrefab = null;
			component.destroyOnEnemy = true;
			((ProjectileExplosion)component).fireChildren = false;
			((ProjectileExplosion)component).blastRadius = 2f;
			beetleSpitGhost = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleQueen.BeetleQueenSpitGhost_prefab).WaitForCompletion(), "BeetleSpitProjectileGhostScore", false);
			Transform transform2 = beetleSpitGhost.transform;
			transform2.localScale /= 2f;
			Transform child2 = beetleSpitGhost.transform.GetChild(1);
			child2.localScale /= 2f;
			Transform child3 = beetleSpitGhost.transform.GetChild(0).GetChild(0);
			child3.localScale /= 2f;
			Transform child4 = beetleSpitGhost.transform.GetChild(1).GetChild(0);
			child4.localScale /= 2f;
			Transform child5 = beetleSpitGhost.transform.GetChild(1).GetChild(1);
			child5.localScale /= 2f;
			beetleSpit.GetComponent<ProjectileController>().ghostPrefab = beetleSpitGhost;
			ContentAddition.AddEffect(beetleSpitExplosion);
			ContentAddition.AddProjectile(beetleSpit);
			BeetleSpit.projectilePrefab = beetleSpit;
		}

		private void LilGuyChanges()
		{
			BeetleSpawn.TryModifyFieldValue("duration", 3.5f);
			BeetleBody.GetComponent<CharacterBody>().baseMoveSpeed = 7f;
			if (EnemiesPlusConfig.beetleSpit.Value)
			{
				MakeSpit();
			}
			if (EnemiesPlusConfig.beetleBurrow.Value)
			{
				MakeBurrow();
			}
			GameObject beetleMaster = BeetleMaster;
			BaseAI component = beetleMaster.GetComponent<BaseAI>();
			component.aimVectorDampTime = 0.1f;
			component.aimVectorMaxSpeed = 180f;
			AISkillDriver[] components = beetleMaster.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val in components)
			{
				switch (val.customName)
				{
				case "HeadbuttOffNodegraph":
					val.minDistance = 0f;
					val.maxDistance = 5f;
					break;
				default:
					val.shouldSprint = true;
					break;
				case "SpitOffNodeGraph":
				case "BurrowTowardsTarget":
					break;
				}
			}
		}

		private void MakeSpit()
		{
			//IL_001f: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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)
			SkillDef copyOf = ((ScriptableObject)(object)BeetleSecondary).GetCopyOf<SkillDef>(BeetlePrimary);
			((Object)copyOf).name = "BeetleBodySpit";
			bool flag = default(bool);
			copyOf.activationState = ContentAddition.AddEntityState<BeetleSpit>(ref flag);
			copyOf.skillName = "BeetleSpit";
			copyOf.baseRechargeInterval = 6f;
			copyOf.baseMaxStock = 1;
			BeetleBody.GetComponent<SkillLocator>().secondary.skillName = "BeetleSpit";
			AISkillDriver val = BeetleMaster.AddComponent<AISkillDriver>();
			val.customName = "SpitOffNodeGraph";
			val.skillSlot = (SkillSlot)1;
			val.selectionRequiresAimTarget = true;
			val.selectionRequiresTargetLoS = true;
			val.minDistance = 5f;
			val.maxDistance = 15f;
			val.ignoreNodeGraph = true;
			val.shouldSprint = true;
			val.movementType = (MovementType)1;
			val.moveTargetType = (TargetType)0;
			val.aimType = (AimType)2;
			BeetleMaster.ReorderSkillDrivers(val, 1);
		}

		private void MakeBurrow()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0090: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			ContentAddition.AddEntityState<BeetleBurrow>(ref flag);
			ContentAddition.AddEntityState<ExitBurrow>(ref flag);
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			((Object)val).name = "BeetleBodyBurrow";
			val.skillName = "BeetleBurrow";
			val.activationStateMachineName = "Body";
			val.activationState = ContentAddition.AddEntityState<EnterBurrow>(ref flag);
			val.baseRechargeInterval = 12f;
			val.cancelSprintingOnActivation = false;
			val.isCombatSkill = false;
			ContentAddition.AddSkillDef(val);
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = "BeetleBodyUtilityFamily";
			val2.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = val
				}
			};
			GenericSkill val3 = BeetleBody.AddComponent<GenericSkill>();
			val3.skillName = "BeetleBurrow";
			val3._skillFamily = val2;
			BeetleBody.GetComponent<SkillLocator>().utility = val3;
			ContentAddition.AddSkillFamily(val2);
			AISkillDriver val4 = BeetleMaster.GetComponents<AISkillDriver>().Last();
			AISkillDriver obj = BeetleMaster.AddComponent<AISkillDriver>();
			obj.customName = "BurrowTowardsTarget";
			obj.skillSlot = (SkillSlot)2;
			obj.requireSkillReady = true;
			obj.minDistance = 50f;
			obj.maxDistance = 100f;
			obj.selectionRequiresOnGround = true;
			obj.ignoreNodeGraph = true;
			obj.movementType = (MovementType)1;
			obj.moveTargetType = (TargetType)0;
			obj.aimType = (AimType)1;
			obj.resetCurrentEnemyOnNextDriverSelection = true;
			BeetleMaster.AddComponentCopy<AISkillDriver>(val4);
			Object.DestroyImmediate((Object)(object)val4);
			burrowFX = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleGuard.BeetleGuardSunderPop_prefab).WaitForCompletion(), "BeetleBurrowEffectScore", false);
			burrowFX.GetComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			Transform val5 = burrowFX.transform.Find("Particles/ParticleInitial/Dust");
			ParticleSystemRenderer val6 = default(ParticleSystemRenderer);
			if (Object.op_Implicit((Object)(object)val5) && ((Component)val5).TryGetComponent<ParticleSystemRenderer>(ref val6))
			{
				((Renderer)val6).sharedMaterial = new Material(((Renderer)val6).sharedMaterial);
				((Renderer)val6).sharedMaterial.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)201, (byte)126, (byte)44, byte.MaxValue)));
			}
			Transform val7 = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_BeetleGuard.BeetleGuardGroundSlam_prefab).WaitForCompletion().transform.Find("ParticleInitial/Decal");
			if (Object.op_Implicit((Object)(object)val7))
			{
				Object.Instantiate<GameObject>(((Component)val7).gameObject, burrowFX.transform).transform.localScale = Vector3.one * 5f;
			}
			ContentAddition.AddEffect(burrowFX);
		}

		private void QueenChanges()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			BeetleQueenSpit.GetComponent<ProjectileImpactExplosion>().destroyOnEnemy = true;
			DamageAPI.AddModdedDamageType(ref BeetleQueenSpit.GetComponent<ProjectileDamage>().damageType, beetleJuiceDT);
		}

		private void GuardChanges()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			AISkillDriver val = BeetleGuardMaster.AddComponent<AISkillDriver>();
			val.customName = "RallyCry";
			val.skillSlot = (SkillSlot)2;
			val.requireSkillReady = true;
			val.maxUserHealthFraction = 0.8f;
			val.movementType = (MovementType)0;
			BeetleGuardMaster.ReorderSkillDrivers(val, 2);
			bool flag = default(bool);
			BGUtilitySkillDef.activationState = ContentAddition.AddEntityState<RallyCry>(ref flag);
		}
	}
	public class BeetleSpit : BaseSkillState
	{
		public static float baseDuration = 1f;

		public static string attackSoundString = "Play_beetle_worker_attack";

		public static GameObject projectilePrefab;

		private bool hasFired;

		private float duration;

		private float fireTime;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireTime = duration * 0.9f;
			((BaseState)this).StartAimMode(fireTime, false);
			((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 0f;
			}
			Util.PlayAttackSpeedSound(attackSoundString, ((EntityState)this).gameObject, duration - fireTime);
			((EntityState)this).PlayCrossfade("Body", "EmoteSurprise", "Headbutt.playbackRate", duration, 0.1f);
		}

		public void Fire()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired)
			{
				hasFired = true;
				Ray aimRay = ((BaseState)this).GetAimRay();
				Util.PlayAttackSpeedSound(attackSoundString, ((EntityState)this).gameObject, duration - fireTime);
				if (((EntityState)this).isAuthority)
				{
					ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat, 0f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= fireTime)
			{
				Fire();
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 1f;
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class EnterBurrow : BaseState
	{
		public static float animSpeed = 1.3f;

		public static float crossfadeDelay = 1.1f;

		public static float crossfadeDuration = 0.2f;

		public static string burrowSoundString = "Play_treeBot_sprint_end";

		public static string startSoundString = "Play_beetle_worker_idle";

		private Animator modelAnimator;

		private float duration;

		private bool didCrossfade;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = crossfadeDelay + crossfadeDuration;
			((EntityState)this).PlayCrossfade("Body", "EmoteSurprise", 0.1f);
			modelAnimator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				modelAnimator.speed = animSpeed;
			}
			Util.PlaySound(startSoundString, ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= crossfadeDelay)
			{
				TryCrossfade();
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new BeetleBurrow());
			}
		}

		public override void OnExit()
		{
			TryCrossfade();
			if (NetworkServer.active)
			{
				Util.CleanseBody(((EntityState)this).characterBody, true, false, false, true, false, false);
			}
			((EntityState)this).OnExit();
		}

		public void TryCrossfade()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if (!didCrossfade && Object.op_Implicit((Object)(object)modelAnimator))
			{
				modelAnimator.speed = 1f;
				modelAnimator.Update(0f);
				modelAnimator.SetFloat("Spawn1.playbackRate", 0f);
				modelAnimator.CrossFadeInFixedTime("Spawn1", crossfadeDuration, modelAnimator.GetLayerIndex("Body"));
				EffectManager.SimpleEffect(BeetleChanges.burrowFX, ((EntityState)this).characterBody.footPosition, Quaternion.identity, false);
				Util.PlaySound(burrowSoundString, ((EntityState)this).gameObject);
				didCrossfade = true;
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class ExitBurrow : BaseState
	{
		public static float ANIM_DURATION_COEF = 0.7f;

		public static float baseBurrowExitDuration = 1.3f;

		public static float exitJumpMarker = 0.4f;

		public static string endSoundString = "Play_hermitCrab_unburrow";

		public static string burrowSoundString = "Play_treeBot_sprint_end";

		private float duration;

		private bool didJump;

		private bool didCancelAnimation;

		private bool movementHitAuthority;

		public override void OnEnter()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			duration = baseBurrowExitDuration / base.attackSpeedStat;
			((EntityState)this).PlayAnimation("Body", "Spawn1", "Spawn1.playbackRate", duration / ANIM_DURATION_COEF, 0f);
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.onMovementHit += new MovementHitDelegate(OnMovementHit);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration * exitJumpMarker / ANIM_DURATION_COEF)
			{
				TryJump();
			}
			if (!(((EntityState)this).fixedAge < duration))
			{
				TryCancelAnimation();
				if (((EntityState)this).isAuthority && (((EntityState)this).fixedAge >= duration || movementHitAuthority || (((BaseCharacterController)((EntityState)this).characterMotor).Motor.GroundingStatus.IsStableOnGround && !((BaseCharacterController)((EntityState)this).characterMotor).Motor.LastGroundingStatus.IsStableOnGround)))
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void OnExit()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			TryJump();
			TryCancelAnimation();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.onMovementHit -= new MovementHitDelegate(OnMovementHit);
			}
			((EntityState)this).OnExit();
		}

		public void TryJump()
		{
			//IL_0020: Unknown result type (might be due