Decompiled source of EnemiesPlusPlus v1.0.3

EnemiesPlus.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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;
using HG.GeneralSerializer;
using HarmonyLib;
using Inferno;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.EntityStates.LemurianMonster;
using On.EntityStates.Wisp1Monster;
using On.RoR2;
using R2API;
using RiftTitansMod;
using RiftTitansMod.SkillStates.Blue;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using Risky_Artifacts.Artifacts;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
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+0a89f29a452965d5388188e306984e4925e1f17e")]
[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.0.3")]
	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.0.3";

		public static EnemiesPlusPlugin Instance { get; private set; }

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

		public static bool InfernoInstalled => Chainloader.PluginInfos.ContainsKey("HIFU.Inferno");

		public static bool RiskyArtifactsInstalled => Chainloader.PluginInfos.ContainsKey("com.Moffein.RiskyArtifacts");

		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.wormSkills.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();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static float GetRiskyArtifactsWarfareProjectileSpeedMult()
		{
			if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(Warfare.artifact))
			{
				return Warfare.projSpeed;
			}
			return 1f;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static float GetInfernoProjectileSpeedMult()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Run.instance) && Run.instance.selectedDifficulty == Main.InfernoDiffIndex)
			{
				return Main.ProjectileSpeed.Value;
			}
			return 1f;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void GetProjectileSpeedModifiers(ref float speed)
		{
			if (InfernoInstalled)
			{
				speed *= GetInfernoProjectileSpeedMult();
			}
			if (RiskyArtifactsInstalled)
			{
				speed *= GetRiskyArtifactsWarfareProjectileSpeedMult();
			}
		}
	}
	public static class HarmonyHooks
	{
		public static Harmony Patcher;

		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> wormSkills;

		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> lilBeetleSkills;

		public static ConfigEntry<bool> bgChanges;

		public static ConfigEntry<bool> queenChanges;

		private static ConfigFile PluginConfigFile { get; set; }

		public static void Init(ConfigFile cfg)
		{
			PluginConfigFile = cfg;
			string section = "Skills";
			enableSkills = PluginConfigFile.BindOption(section, "Enable New Skills", defaultValue: true, "Allows any of the skills within this section to be toggled on and off.", restartRequired: true);
			bellSkills = PluginConfigFile.BindOption(section, "Enable Brass Contraptions Buff Beam Skill", defaultValue: true, "Adds a new skill that gives an ally increased armor.", restartRequired: true);
			impSkills = PluginConfigFile.BindOption(section, "Enable Imps Void Spike Skill", defaultValue: true, "Adds a new skill for Imps to throw void spikes at range, similarly to the Imp OverLord.", restartRequired: true);
			lunarGolemSkills = PluginConfigFile.BindOption(section, "Enable Lunar Golems Lunar Shell Skill", defaultValue: true, "Adds a new ability that gives them some stuff idk its vanilla but unused", restartRequired: true);
			wormSkills = PluginConfigFile.BindOption(section, "Enable Worms Leap Skill", defaultValue: true, "Adds a new leap skill and changes Worms to have better targeting.", restartRequired: true);
			section = "Tweaks";
			enableTweaks = PluginConfigFile.BindOption(section, "Enable Enemy Tweaks", defaultValue: true, "Allows any of the skills within this section to be toggled on and off.", restartRequired: true);
			helfireChanges = PluginConfigFile.BindOption(section, "Enable Lunar Helfire Debuff", defaultValue: true, "Enables Lunar enemies to apply the new Helfire debuff.", restartRequired: true);
			lunarWispChanges = PluginConfigFile.BindOption(section, "Enable Lunar Wisp Changes", defaultValue: true, "Increases Lunar Wisp movement speed and acceleration, orb applies helfire", restartRequired: true);
			wispChanges = PluginConfigFile.BindOption(section, "Enable Wisp Changes", defaultValue: true, "Makes the wisp attack a fast projectile and increases Wisp bullet count", restartRequired: true);
			greaterWispChanges = PluginConfigFile.BindOption(section, "Enable Greater Wisp Changes", defaultValue: true, "Decreases Greater Wisp credit cost", restartRequired: true);
			lemChanges = PluginConfigFile.BindOption(section, "Enable Lemurian Bite Changes", defaultValue: true, "Adds slight leap to Lemurian bite", restartRequired: true);
			section = "Beetles";
			enableBeetleFamilyChanges = PluginConfigFile.BindOption(section, "Enable Beetle Family Changes", defaultValue: true, "Enables all beetle related changes. Yes, they needed their own section. Unaffected by other config sections.", restartRequired: true);
			lilBeetleSkills = PluginConfigFile.BindOption(section, "Enable Lil Beetles Spit Skill", defaultValue: true, "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.", restartRequired: true);
			bgChanges = PluginConfigFile.BindOption(section, "Enable Beetle Guards Rally Cry Skill", defaultValue: true, "Adds a new skill that gives them and nearby allies increased attack speed and movement speed", restartRequired: true);
			queenChanges = PluginConfigFile.BindOption(section, "Enable Beetle Queens Debuff", defaultValue: true, "Adds a new debuff, Beetle Juice, to Beetle Queen and ally beetles attacks and makes spit explode mid air", restartRequired: true);
		}

		public static ConfigEntry<T> BindOption<T>(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", bool restartRequired = false)
		{
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> val = myConfig.Bind<T>(section, name, defaultValue, description);
			if (EnemiesPlusPlugin.RooInstalled)
			{
				TryRegisterOption<T>(val, restartRequired);
			}
			return val;
		}

		public static ConfigEntry<T> BindOptionSlider<T>(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false)
		{
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			string text = description;
			T val = defaultValue;
			description = text + " (Default: " + val?.ToString() + ")";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> val2 = myConfig.Bind<T>(section, name, defaultValue, description);
			if (EnemiesPlusPlugin.RooInstalled)
			{
				TryRegisterOptionSlider<T>(val2, min, max, restartRequired);
			}
			return val2;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			if (entry is ConfigEntry<string> val)
			{
				ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(val, restartRequired));
			}
			else if (entry is ConfigEntry<float> val2)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig
				{
					min = 0f,
					max = 20f,
					formatString = "{0:0.00}",
					restartRequired = restartRequired
				}));
			}
			else if (entry is ConfigEntry<int> val3)
			{
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val3, restartRequired));
			}
			else if (entry is ConfigEntry<bool> val4)
			{
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val4, restartRequired));
			}
			else if (entry is ConfigEntry<KeyboardShortcut> val5)
			{
				ModSettingsManager.AddOption((BaseOption)new KeyBindOption(val5, restartRequired));
			}
			else if (typeof(T).IsEnum)
			{
				ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, restartRequired));
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void TryRegisterOptionSlider<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_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_0054: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (entry is ConfigEntry<int> val)
			{
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val, new IntSliderConfig
				{
					min = (int)min,
					max = (int)max,
					formatString = "{0:0.00}",
					restartRequired = restartRequired
				}));
			}
			else if (entry is ConfigEntry<float> val2)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig
				{
					min = min,
					max = max,
					formatString = "{0:0.00}",
					restartRequired = restartRequired
				}));
			}
		}
	}
	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);
			Type typeFromHandle = typeof(T);
			if (Object.op_Implicit(orCreateField.fieldValue.objectValue) && typeof(Object).IsAssignableFrom(typeFromHandle))
			{
				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(typeFromHandle))
			{
				orCreateField.fieldValue.stringValue = StringSerializer.Serialize(typeFromHandle, (object)value);
				return true;
			}
			return false;
		}
	}
}
namespace EnemiesPlus.Content.Worm
{
	internal class WormChanges
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_FixedUpdateServer <0>__RemoveRandomTurns;
		}

		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_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
			//IL_009f: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			object obj = <>O.<0>__RemoveRandomTurns;
			if (obj == null)
			{
				hook_FixedUpdateServer val = RemoveRandomTurns;
				<>O.<0>__RemoveRandomTurns = val;
				obj = (object)val;
			}
			WormBodyPositionsDriver.FixedUpdateServer += (hook_FixedUpdateServer)obj;
			MagmaWormMaster.ReorderSkillDrivers(1);
			ParticleSystem[] componentsInChildren = ((Component)MagmaWorm.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem obj2 in componentsInChildren)
			{
				obj2.startSize *= 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 val2 in components)
			{
				if (val2.customName == "Blink")
				{
					val2.shouldSprint = true;
					val2.minDistance = 0f;
					val2.aimType = (AimType)1;
				}
				else
				{
					val2.skillSlot = (SkillSlot)(-1);
				}
			}
		}

		private static void RemoveRandomTurns(orig_FixedUpdateServer orig, WormBodyPositionsDriver self)
		{
			//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_00d3: 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)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody component = ((Component)self).gameObject.GetComponent<CharacterBody>();
			Vector3 val = self.referenceTransform.position;
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master) && ((object)(from machine in ((Component)self).gameObject.GetComponents<EntityStateMachine>()
				where machine.customName == "Weapon"
				select machine).First().state).GetType() != typeof(Leap))
			{
				BaseAI component2 = component.masterObject.GetComponent<BaseAI>();
				if (Object.op_Implicit((Object)(object)component2) && component2.currentEnemy != null && (Object)(object)component2.currentEnemy.characterBody != (Object)null)
				{
					val = component2.currentEnemy.characterBody.corePosition;
				}
			}
			float speedMultiplier = self.wormBodyPositions.speedMultiplier;
			Vector3 val2 = val - self.chaserPosition;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = (float)((self.chaserIsUnderground ? ((double)self.maxTurnSpeed) : ((double)self.maxTurnSpeed * (double)self.turnRateCoefficientAboveGround)) * (Math.PI / 180.0));
			Vector3 val3 = Vector3.RotateTowards(new Vector3(self.chaserVelocity.x, 0f, self.chaserVelocity.z), new Vector3(normalized.x, 0f, normalized.z) * speedMultiplier, num * Time.fixedDeltaTime, float.PositiveInfinity);
			val3 = ((Vector3)(ref val3)).normalized * speedMultiplier;
			float num2 = val.y - self.chaserPosition.y;
			float num3 = (0f - self.chaserVelocity.y) * self.yDamperConstant;
			float num4 = num2 * self.ySpringConstant;
			if (self.allowShoving && (double)Mathf.Abs(self.chaserVelocity.y) < (double)self.yShoveVelocityThreshold && (double)num2 > (double)self.yShovePositionThreshold)
			{
				val2 = self.chaserVelocity;
				self.chaserVelocity = Vector3Utils.XAZ(ref val2, self.chaserVelocity.y + self.yShoveForce * Time.fixedDeltaTime);
			}
			if (!self.chaserIsUnderground)
			{
				num4 *= self.wormForceCoefficientAboveGround;
				num3 *= self.wormForceCoefficientAboveGround;
			}
			val2 = self.chaserVelocity;
			self.chaserVelocity = Vector3Utils.XAZ(ref val2, self.chaserVelocity.y + (num4 + num3) * Time.fixedDeltaTime);
			self.chaserVelocity += Physics.gravity * Time.fixedDeltaTime;
			self.chaserVelocity = new Vector3(val3.x, self.chaserVelocity.y, val3.z);
			self.chaserPosition += self.chaserVelocity * Time.fixedDeltaTime;
			self.chasePositionVisualizer.position = self.chaserPosition;
			self.chaserIsUnderground = 0.0 - (double)num2 < (double)self.wormBodyPositions.undergroundTestYOffset;
			self.keyFrameGenerationTimer -= Time.deltaTime;
			if (!((double)self.keyFrameGenerationTimer > 0.0))
			{
				self.keyFrameGenerationTimer = self.keyFrameGenerationInterval;
				self.wormBodyPositions.AttemptToGenerateKeyFrame(self.wormBodyPositions.GetSynchronizedTimeStamp() + self.wormBodyPositions.followDelay, self.chaserPosition, self.chaserVelocity);
			}
		}
	}
}
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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			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);
				}
			}
		}

		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 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (EnemiesPlusConfig.wispChanges.Value)
			{
				CreateProjectile();
				WispEmbers.TryModifyFieldValue("damageCoefficient", 1f);
				WispEmbers.TryModifyFieldValue("bulletCount", 6);
				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 = 170f;
			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 hook_OnBuffFinalStackLost <0>__CharacterBody_OnBuffFinalStackLost;
		}

		public static GameObject lunarWispTrackingBomb;

		public static BuffDef helfireBuff;

		public static ModdedDamageType helfireDT;

		public static DotIndex helfireDotIdx;

		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 GameObject HelfireIgniteEffect => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BurnNearby/HelfireIgniteEffect.prefab").WaitForCompletion();

		internal EntityStateConfiguration LunarSeekingBomb => Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/LunarWisp/EntityStates.LunarWisp.SeekingBomb.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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_00ef: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(CharacterBody_OnBuffFirstStackGained);
			object obj = <>O.<0>__CharacterBody_OnBuffFinalStackLost;
			if (obj == null)
			{
				hook_OnBuffFinalStackLost val = CharacterBody_OnBuffFinalStackLost;
				<>O.<0>__CharacterBody_OnBuffFinalStackLost = val;
				obj = (object)val;
			}
			CharacterBody.OnBuffFinalStackLost += (hook_OnBuffFinalStackLost)obj;
			HealthComponent.Heal += new hook_Heal(PreventHelfireHeal);
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			helfireBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)helfireBuff).name = "HelfireDebuff";
			helfireBuff.canStack = true;
			helfireBuff.isCooldown = false;
			helfireBuff.isDebuff = true;
			helfireBuff.buffColor = Color.cyan;
			helfireBuff.iconSprite = FireBuffSprite;
			ContentAddition.AddBuffDef(helfireBuff);
			helfireDT = DamageAPI.ReserveDamageType();
			helfireDotIdx = DotAPI.RegisterDotDef(0.2f, 0f, (DamageColorIndex)7, helfireBuff, new CustomDotBehaviour(AddPercentHelfireDamage), (CustomDotVisual)null);
			lunarWispTrackingBomb = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispTrackingBomb.prefab").WaitForCompletion(), "LunarWispOrbScore");
			lunarWispTrackingBomb.AddComponent<ModdedDamageTypeHolderComponent>().Add(helfireDT);
			ContentAddition.AddProjectile(lunarWispTrackingBomb);
			LunarSeekingBomb.TryModifyFieldValue<GameObject>("projectilePrefab", lunarWispTrackingBomb);
		}

		private 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)
			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.1f / 10f * 0.2f;
			}
		}

		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_0062: 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)
			LunarGolemShield.baseRechargeInterval = 60f;
			(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 float PreventHelfireHeal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(helfireBuff))
			{
				return 0f;
			}
			return orig.Invoke(self, amount, procChainMask, nonRegen);
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && sender.HasBuff(Buffs.LunarShell))
			{
				args.armorAdd += 100f;
			}
		}

		private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
		{
			//IL_0066: 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)
			DamageInfo damageInfo = damageReport.damageInfo;
			if (damageInfo != null && !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)))
			{
				DotController.InflictDot(((Component)damageReport.victimBody).gameObject, damageReport.attacker, helfireDotIdx, 10f, 1f, (uint?)null);
			}
		}

		private void CharacterBody_OnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			if ((Object)(object)buffDef == (Object)(object)helfireBuff)
			{
				((Component)self).gameObject.AddComponent<NuxHelfireEffectController>();
			}
		}

		private static void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			NuxHelfireEffectController nuxHelfireEffectController = default(NuxHelfireEffectController);
			if ((Object)(object)buffDef == (Object)(object)helfireBuff && ((Component)self).TryGetComponent<NuxHelfireEffectController>(ref nuxHelfireEffectController))
			{
				Object.Destroy((Object)(object)nuxHelfireEffectController);
			}
		}
	}
	public class NuxHelfireEffectController : MonoBehaviour
	{
		private BurnEffectController burnEffectController;

		private void Start()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0037: Expected O, but got Unknown
			CharacterBody component = ((Component)this).GetComponent<CharacterBody>();
			ModelLocator component2 = ((Component)this).GetComponent<ModelLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				EffectManager.SpawnEffect(LunarChanges.Instance.HelfireIgniteEffect, new EffectData
				{
					origin = component.corePosition
				}, true);
			}
			if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.modelTransform))
			{
				burnEffectController = ((Component)this).gameObject.AddComponent<BurnEffectController>();
				burnEffectController.effectType = BurnEffectController.helfireEffect;
				burnEffectController.target = ((Component)component2.modelTransform).gameObject;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)burnEffectController))
			{
				Object.Destroy((Object)(object)burnEffectController);
			}
		}
	}
}
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_0056: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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 * 2f;
			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_009c: 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_00a9: 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 = 10f;
			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);
			}
		}

		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)3;
		}
	}
}
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();

		public static BellChanges Instance { get; private set; }

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

		private BellChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			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 invincible";
			val.activationState = new SerializableEntityStateType(typeof(BuffBeamPlus));
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)7;
			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.requireSkillReady = true;
			obj.requireEquipmentReady = false;
			obj.maxUserHealthFraction = 0.8f;
			obj.moveTargetType = (TargetType)0;
			BellMaster.ReorderSkillDrivers(2);
		}
	}
	public class BuffBeamPlus : BuffBeam
	{
		public override void OnEnter()
		{
			//IL_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((BaseState)this).attackSpeedStat = ((EntityState)this).characterBody.attackSpeed;
				((BaseState)this).damageStat = ((EntityState)this).characterBody.damage;
				((BaseState)this).critStat = ((EntityState)this).characterBody.crit;
				((BaseState)this).moveSpeedStat = ((EntityState)this).characterBody.moveSpeed;
			}
			Util.PlaySound(BuffBeam.playBeamSoundString, ((EntityState)this).gameObject);
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val = new BullseyeSearch
			{
				filterByLoS = false,
				maxDistanceFilter = 50f,
				maxAngleFilter = 180f,
				searchOrigin = ((Ray)(ref aimRay)).origin,
				searchDirection = ((Ray)(ref aimRay)).direction,
				sortMode = (SortMode)2,
				teamMaskFilter = TeamMask.none
			};
			if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
			{
				((TeamMask)(ref val.teamMaskFilter)).AddTeam(((EntityState)this).teamComponent.teamIndex);
			}
			val.RefreshCandidates();
			val.FilterOutGameObject(((EntityState)this).gameObject);
			base.target = (from x in val.GetResults()
				where Object.op_Implicit((Object)(object)x.healthComponent.body) && x.healthComponent.body.bodyIndex != ((EntityState)this).characterBody.bodyIndex
				select x).FirstOrDefault();
			if (Object.op_Implicit((Object)(object)base.target))
			{
				((BaseState)this).StartAimMode(BuffBeam.duration, false);
				base.targetBody = base.target.healthComponent.body;
				base.targetBody.AddBuff(Buffs.ElephantArmorBoost.buffIndex);
			}
			string text = "Muzzle";
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				base.muzzleTransform = component.FindChild(text);
				base.buffBeamInstance = Object.Instantiate<GameObject>(BuffBeam.buffBeamPrefab);
				ChildLocator component2 = base.buffBeamInstance.GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					base.beamTipTransform = component2.FindChild("BeamTip");
				}
				base.healBeamCurve = base.buffBeamInstance.GetComponentInChildren<BezierCurveLine>();
			}
		}

		public override void OnExit()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((BuffBeam)this).OnExit();
			if (Object.op_Implicit((Object)(object)base.targetBody))
			{
				base.targetBody.RemoveBuff(Buffs.ElephantArmorBoost.buffIndex);
			}
		}
	}
}
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;
				obj.invisibilityCount++;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup obj2 = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter;
				obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter + 1;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			((EntityState)this).gameObject.layer = LayerIndex.fakeActor.intVal;
			((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;
				obj.invisibilityCount--;
			}
			if (Object.op_Implicit((Object)(object)hurtboxGroup))
			{
				HurtBoxGroup obj2 = hurtboxGroup;
				int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter;
				obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter - 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/Beetle/BeetleQueenSpit.prefab").WaitForCompletion();

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

		internal BuffDef BeetleJuice => Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Beetle/bdBeetleJuice.asset").WaitForCompletion();

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

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

		internal SkillDef BGUtilitySkillDef => Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Beetle/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()
		{
			GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
			MakeJuice();
			if (EnemiesPlusConfig.lilBeetleSkills.Value)
			{
				LilGuyChanges();
			}
			if (EnemiesPlusConfig.bgChanges.Value)
			{
				GuardChanges();
			}
			if (EnemiesPlusConfig.queenChanges.Value)
			{
				QueenChanges();
			}
		}

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

		private void MakeJuice()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			BeetleJuice.canStack = true;
			beetleJuiceDT = DamageAPI.ReserveDamageType();
			beetleSpit = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleQueenSpit.prefab").WaitForCompletion(), "BeetleSpitProjectileScore");
			beetleSpit.AddComponent<ModdedDamageTypeHolderComponent>().Add(beetleJuiceDT);
			beetleSpit.GetComponent<ProjectileSimple>().desiredForwardSpeed = 60f;
			Transform transform = beetleSpit.transform;
			transform.localScale /= 2f;
			beetleSpit.GetComponent<Rigidbody>().useGravity = false;
			beetleSpitExplosion = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/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/Beetle/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()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			BeetleSpawn.TryModifyFieldValue("duration", 3.5f);
			BeetleBody.GetComponent<CharacterBody>().baseMoveSpeed = 7f;
			if (!EnemiesPlusConfig.lilBeetleSkills.Value)
			{
				return;
			}
			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 = 3f;
			copyOf.baseMaxStock = 1;
			SkillLocator component = BeetleBody.GetComponent<SkillLocator>();
			component.secondary.skillName = "BeetleSpit";
			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;
			component.utility = val3;
			ContentAddition.AddSkillFamily(val2);
			GameObject beetleMaster = BeetleMaster;
			BaseAI component2 = beetleMaster.GetComponent<BaseAI>();
			component2.aimVectorDampTime = 0.1f;
			component2.aimVectorMaxSpeed = 180f;
			AISkillDriver val4 = beetleMaster.AddComponent<AISkillDriver>();
			val4.customName = "SpitOffNodeGraph";
			val4.skillSlot = (SkillSlot)1;
			val4.selectionRequiresAimTarget = true;
			val4.selectionRequiresTargetLoS = true;
			val4.minDistance = 5f;
			val4.maxDistance = 25f;
			val4.ignoreNodeGraph = true;
			val4.shouldSprint = true;
			val4.movementType = (MovementType)1;
			val4.moveTargetType = (TargetType)0;
			val4.aimType = (AimType)2;
			beetleMaster.ReorderSkillDrivers(val4, 1);
			AISkillDriver val5 = beetleMaster.GetComponents<AISkillDriver>().Last();
			AISkillDriver obj = beetleMaster.AddComponent<AISkillDriver>();
			obj.customName = "BurrowTowardsTarget";
			obj.skillSlot = (SkillSlot)2;
			obj.requireSkillReady = true;
			obj.minDistance = 25f;
			obj.maxDistance = 60f;
			obj.selectionRequiresOnGround = true;
			obj.ignoreNodeGraph = true;
			obj.movementType = (MovementType)1;
			obj.moveTargetType = (TargetType)0;
			obj.aimType = (AimType)1;
			obj.resetCurrentEnemyOnNextDriverSelection = true;
			beetleMaster.AddComponentCopy<AISkillDriver>(val5);
			Object.DestroyImmediate((Object)(object)val5);
			AISkillDriver[] components = beetleMaster.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val6 in components)
			{
				switch (val6.customName)
				{
				case "HeadbuttOffNodegraph":
					val6.minDistance = 0f;
					val6.maxDistance = 5f;
					break;
				default:
					val6.shouldSprint = true;
					break;
				case "SpitOffNodeGraph":
				case "BurrowTowardsTarget":
					break;
				}
			}
			burrowFX = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleGuardSunderPop.prefab").WaitForCompletion(), "BeetleBurrowEffectScore", false);
			burrowFX.GetComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			Transform val7 = burrowFX.transform.Find("Particles/ParticleInitial/Dust");
			ParticleSystemRenderer val8 = default(ParticleSystemRenderer);
			if (Object.op_Implicit((Object)(object)val7) && ((Component)val7).TryGetComponent<ParticleSystemRenderer>(ref val8))
			{
				((Renderer)val8).sharedMaterial = new Material(((Renderer)val8).sharedMaterial);
				((Renderer)val8).sharedMaterial.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)201, (byte)126, (byte)44, byte.MaxValue)));
			}
			Transform val9 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleGuardGroundSlam.prefab").WaitForCompletion().transform.Find("ParticleInitial/Decal");
			if (Object.op_Implicit((Object)(object)val9))
			{
				Object.Instantiate<GameObject>(((Component)val9).gameObject, burrowFX.transform).transform.localScale = Vector3.one * 5f;
			}
			ContentAddition.AddEffect(burrowFX);
		}

		private void QueenChanges()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			BeetleQueenSpit.GetComponent<ProjectileImpactExplosion>().destroyOnEnemy = true;
			BeetleQueenSpit.AddComponent<ModdedDamageTypeHolderComponent>().Add(beetleJuiceDT);
			BeetleQueenAcid.AddComponent<ModdedDamageTypeHolderComponent>().Add(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.8f;
			((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, ((BaseState)this).attackSpeedStat);
			((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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired)
			{
				hasFired = true;
				Ray aimRay = ((BaseState)this).GetAimRay();
				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);
				}
			}
		}

		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)
			{
				((Enti