Decompiled source of MiscMods v1.0.2

MiscMods.dll

Decompiled 2 years ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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 EntityStates;
using EntityStates.BeetleGuardMonster;
using EntityStates.Bell.BellWeapon;
using EntityStates.ClayBoss;
using EntityStates.ClayBoss.ClayBossWeapon;
using EntityStates.GravekeeperBoss;
using EntityStates.GreaterWispMonster;
using EntityStates.ImpBossMonster;
using EntityStates.ImpMonster;
using EntityStates.LemurianBruiserMonster;
using EntityStates.LemurianMonster;
using EntityStates.MagmaWorm;
using EntityStates.RoboBallBoss.Weapon;
using EntityStates.ScavMonster;
using EntityStates.VagrantMonster.Weapon;
using EntityStates.Vulture.Weapon;
using HG;
using HG.GeneralSerializer;
using HarmonyLib;
using IL.EntityStates;
using IL.EntityStates.BeetleGuardMonster;
using IL.EntityStates.Bell.BellWeapon;
using IL.EntityStates.ClayBoss;
using IL.EntityStates.ClayBoss.ClayBossWeapon;
using IL.EntityStates.GravekeeperBoss;
using IL.EntityStates.GreaterWispMonster;
using IL.EntityStates.ImpBossMonster;
using IL.EntityStates.ImpMonster;
using IL.EntityStates.LemurianBruiserMonster;
using IL.EntityStates.LemurianMonster;
using IL.EntityStates.RoboBallBoss.Weapon;
using IL.EntityStates.ScavMonster;
using IL.EntityStates.VagrantMonster.Weapon;
using IL.EntityStates.Vulture.Weapon;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MiscMods.Config;
using MiscMods.Hooks;
using MiscMods.StolenContent;
using MiscMods.StolenContent.Beetle;
using MiscMods.StolenContent.Donger;
using MiscMods.StolenContent.Imp;
using MiscMods.StolenContent.Lemur;
using MiscMods.StolenContent.Lunar;
using MiscMods.StolenContent.Wisp;
using MiscMods.StolenContent.Worm;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using Moonstorm;
using On.EntityStates.LemurianMonster;
using On.KinematicCharacterController;
using On.RoR2;
using On.RoR2.CharacterAI;
using On.RoR2.Projectile;
using On.RoR2.Stats;
using R2API;
using R2API.Utils;
using RiftTitansMod;
using RiftTitansMod.Modules;
using RiftTitansMod.SkillStates.Blue;
using RiftTitansMod.SkillStates.Chicken;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
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("MiscMods")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+63b89e2c6d1010600c62ce196a31f4f2d6fa3d58")]
[assembly: AssemblyProduct("MiscMods")]
[assembly: AssemblyTitle("MiscMods")]
[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 MiscMods
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.score.MiscMods", "MiscMods", "1.0.2")]
	public class MiscPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.score.MiscMods";

		public const string PluginAuthor = "score";

		public const string PluginName = "MiscMods";

		public const string PluginVersion = "1.0.2";

		public static MiscPlugin Instance { get; private set; }

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

		public static bool MSUInstalled => Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm.MoonstormSharedUtils");

		public void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PluginConfig.Init(((BaseUnityPlugin)this).Config);
			if (PluginConfig.enableEnemiesPlus.Value)
			{
				PluginConfig.EnemiesPlusConfig.Init();
			}
			if (PluginConfig.enableCruelty.Value)
			{
				Cruelty.Init();
			}
			if (PluginConfig.enablePrediction.Value)
			{
				PredictionHooks.Init();
			}
			if (PluginConfig.enableDirector.Value)
			{
				CombatDirector.Init();
			}
			if (PluginConfig.enableUnholy.Value)
			{
				UnholyHooks.Init();
			}
			if (PluginConfig.enableShmoovement.Value)
			{
				Shmoovement.Init();
			}
			HarmonyHooks.Init();
		}
	}
	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 Utils
	{
		private const float zero = 1E-05f;

		private static float dt => Time.fixedDeltaTime;

		public static void DumpEntityStateConfig(EntityStateConfiguration esc)
		{
			for (int i = 0; i < esc.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (Object.op_Implicit(esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue))
				{
					Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + (object)esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue));
				}
				else
				{
					Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + esc.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue));
				}
			}
		}

		public static void DumpEntityStateConfig(string entityStateName)
		{
			DumpEntityStateConfig(LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName));
		}

		public static void DumpAddressableEntityStateConfig(string addressablePath)
		{
			//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)
			DumpEntityStateConfig(Addressables.LoadAssetAsync<EntityStateConfiguration>((object)addressablePath).WaitForCompletion());
		}

		public static Object GetEntityStateFieldObject(string entityStateName, string fieldName)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					return val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue;
				}
			}
			return null;
		}

		public static string GetEntityStateFieldString(string entityStateName, string fieldName)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					return val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue;
				}
			}
			return string.Empty;
		}

		public static bool SetEntityStateField(string entityStateName, string fieldName, Object newObject)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject;
					return true;
				}
			}
			return false;
		}

		public static bool SetEntityStateField(string entityStateName, string fieldName, string value)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					return true;
				}
			}
			return false;
		}

		public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					return true;
				}
			}
			return false;
		}

		public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object newObject)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject;
					return true;
				}
			}
			return false;
		}

		public static Object GetAddressableEntityStateFieldObject(string fullEntityStatePath, string fieldName)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					return val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue;
				}
			}
			return null;
		}

		public static string GetAddressableEntityStateFieldString(string fullEntityStatePath, string fieldName)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					return val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue;
				}
			}
			return string.Empty;
		}

		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 void EmitPredictAimray<T>(this ILCursor c, string prefabName = "projectilePrefab")
		{
			//IL_0001: 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_0046: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			c.Emit(OpCodes.Ldarg_0);
			c.Emit(OpCodes.Call, (MethodBase)AccessTools.PropertyGetter(typeof(EntityState), "characterBody"));
			FieldInfo fieldInfo = AccessTools.Field(typeof(T), prefabName);
			if (!fieldInfo.IsStatic)
			{
				c.Emit(OpCodes.Ldarg_0);
			}
			if (!fieldInfo.IsStatic)
			{
				c.Emit(OpCodes.Ldfld, fieldInfo);
			}
			else
			{
				c.Emit(OpCodes.Ldsfld, fieldInfo);
			}
			c.Emit(OpCodes.Call, (MethodBase)Reflection.GetMethodCached(typeof(Utils), "PredictAimray"));
		}

		public static Ray PredictAimrayOLD(Ray aimRay, CharacterBody body, GameObject projectilePrefab)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00b7: 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)
			//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_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00e1: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !Object.op_Implicit((Object)(object)projectilePrefab))
			{
				return aimRay;
			}
			float num = 0f;
			ProjectileSimple val = default(ProjectileSimple);
			if (projectilePrefab.TryGetComponent<ProjectileSimple>(ref val))
			{
				num = val.desiredForwardSpeed;
			}
			ProjectileCharacterController val2 = default(ProjectileCharacterController);
			if (projectilePrefab.TryGetComponent<ProjectileCharacterController>(ref val2))
			{
				num = Mathf.Max(num, val2.velocity);
			}
			CharacterBody aimTargetBody = GetAimTargetBody(body);
			if (num > 0f && Object.op_Implicit((Object)(object)aimTargetBody))
			{
				Vector3 position = aimTargetBody.transform.position;
				Vector3 velocity;
				Vector3 accel;
				if (Object.op_Implicit((Object)(object)aimTargetBody.characterMotor) && aimTargetBody.characterMotor.hasEffectiveAuthority)
				{
					velocity = aimTargetBody.characterMotor.velocity;
					accel = GetAccel(aimTargetBody.characterMotor, ref velocity);
				}
				else
				{
					velocity = (position - aimTargetBody.previousPosition) / dt;
					accel = Vector3.zero;
				}
				if (((Vector3)(ref velocity)).sqrMagnitude > 1E-05f)
				{
					return GetRay(aimRay, num, position, velocity, accel);
				}
			}
			return aimRay;
		}

		public static Ray PredictAimray(Ray aimRay, CharacterBody body, GameObject projectilePrefab)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00b7: 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)
			//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_0097: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00e1: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !Object.op_Implicit((Object)(object)projectilePrefab))
			{
				return aimRay;
			}
			float num = 0f;
			ProjectileSimple val = default(ProjectileSimple);
			if (projectilePrefab.TryGetComponent<ProjectileSimple>(ref val))
			{
				num = val.desiredForwardSpeed;
			}
			ProjectileCharacterController val2 = default(ProjectileCharacterController);
			if (projectilePrefab.TryGetComponent<ProjectileCharacterController>(ref val2))
			{
				num = Mathf.Max(num, val2.velocity);
			}
			CharacterBody aimTargetBody = GetAimTargetBody(body);
			if (num > 0f && Object.op_Implicit((Object)(object)aimTargetBody))
			{
				Vector3 position = aimTargetBody.transform.position;
				Vector3 velocity;
				Vector3 accel;
				if (Object.op_Implicit((Object)(object)aimTargetBody.characterMotor) && aimTargetBody.characterMotor.hasEffectiveAuthority)
				{
					velocity = aimTargetBody.characterMotor.velocity;
					accel = GetAccel(aimTargetBody.characterMotor, ref velocity);
				}
				else
				{
					velocity = (position - aimTargetBody.previousPosition) / dt;
					accel = Vector3.zero;
				}
				if (((Vector3)(ref velocity)).sqrMagnitude > 1E-05f)
				{
					return GetRay(aimRay, num, position, velocity, accel);
				}
			}
			return aimRay;
		}

		private static Vector3 GetAccel(CharacterMotor motor, ref Vector3 velocity)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			float num = motor.acceleration;
			if (motor.isAirControlForced || !motor.isGrounded)
			{
				num *= (motor.disableAirControlUntilCollision ? 0f : motor.airControl);
			}
			Vector3 val = motor.moveDirection;
			if (!motor.isFlying)
			{
				val.y = 0f;
			}
			if (motor.body.isSprinting)
			{
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < 1f && magnitude > 0f)
				{
					float num2 = 1f / ((Vector3)(ref val)).magnitude;
					val *= num2;
				}
			}
			Vector3 val2 = val * motor.walkSpeed;
			if (!motor.isFlying)
			{
				val2.y = velocity.y;
			}
			val2 = Vector3.MoveTowards(velocity, val2, num * Time.fixedDeltaTime);
			if (motor.useGravity)
			{
				ref float y = ref val2.y;
				y += Physics.gravity.y * dt;
				if (motor.isGrounded)
				{
					y = Mathf.Max(y, 0f);
				}
			}
			return (val2 - velocity) / Time.fixedDeltaTime;
		}

		public static Ray GetRay(Ray aimRay, float sP, Vector3 pT, Vector3 vT, Vector3 aT)
		{
			//IL_0002: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//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_001d: 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_0043: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			float guess = Vector3.Distance(((Ray)(ref aimRay)).origin, pT) / sP;
			pT -= ((Ray)(ref aimRay)).origin;
			bool flag = ((Vector3)(ref aT)).sqrMagnitude > 1E-05f;
			float num = ((Vector3)(ref vT)).sqrMagnitude - Pow2(sP);
			float num2 = 2f * Vector3.Dot(vT, pT);
			float sqrMagnitude = ((Vector3)(ref pT)).sqrMagnitude;
			if (flag)
			{
				float a = ((Vector3)(ref aT)).sqrMagnitude * 0.25f;
				float b = Vector3.Dot(aT, vT);
				num += Vector3.Dot(aT, pT);
				guess = SolveQuarticNewton(guess, 6, a, b, num, num2, sqrMagnitude);
			}
			else
			{
				guess = SolveQuadraticNewton(guess, 6, num, num2, sqrMagnitude);
			}
			if (guess > 0f)
			{
				Vector3 val = pT + vT * guess;
				if (flag)
				{
					val += 0.5f * aT * Pow2(guess);
				}
				return new Ray(((Ray)(ref aimRay)).origin, val);
			}
			return aimRay;
		}

		private static float SolveQuarticNewton(float guess, int iterations, float a, float b, float c, float d, float e)
		{
			for (int i = 0; i < iterations; i++)
			{
				guess -= EvalQuartic(guess, a, b, c, d, e) / EvalQuarticDerivative(guess, a, b, c, d);
			}
			return guess;
		}

		private static float EvalQuartic(float t, float a, float b, float c, float d, float e)
		{
			return a * Pow4(t) + b * Pow3(t) + c * Pow2(t) + d * t + e;
		}

		private static float EvalQuarticDerivative(float t, float a, float b, float c, float d)
		{
			return 4f * a * Pow3(t) + 3f * b * Pow2(t) + 2f * c * t + d;
		}

		private static float SolveQuadraticNewton(float guess, int iterations, float a, float b, float c)
		{
			for (int i = 0; i < iterations; i++)
			{
				guess -= EvalQuadratic(guess, a, b, c) / EvalQuadraticDerivative(guess, a, b);
			}
			return guess;
		}

		private static float EvalQuadratic(float t, float a, float b, float c)
		{
			return a * Pow2(t) + b * t + c;
		}

		private static float EvalQuadraticDerivative(float t, float a, float b)
		{
			return 2f * a * t + b;
		}

		private static float Pow2(float n)
		{
			return n * n;
		}

		private static float Pow3(float n)
		{
			return n * n * n;
		}

		private static float Pow4(float n)
		{
			return n * n * n * n;
		}

		private static CharacterBody GetAimTargetBody(CharacterBody body)
		{
			BaseAI[] aiComponents = body.master.aiComponents;
			foreach (BaseAI val in aiComponents)
			{
				if (Object.op_Implicit((Object)(object)val) && val.hasAimTarget)
				{
					Target aimTarget = val.skillDriverEvaluation.aimTarget;
					if (Object.op_Implicit((Object)(object)aimTarget.characterBody) && Object.op_Implicit((Object)(object)aimTarget.healthComponent) && aimTarget.healthComponent.alive)
					{
						return aimTarget.characterBody;
					}
				}
			}
			return null;
		}

		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 MiscMods.StolenContent
{
	public class Cruelty
	{
		public class CombatCruelty : MonoBehaviour
		{
			private CombatDirector director;

			private Xoroshiro128Plus rng;

			public void SetCombatListener(CombatDirector d)
			{
				director = d;
				rng = director.rng;
				((UnityEvent<GameObject>)(object)director.onSpawnedServer).AddListener((UnityAction<GameObject>)OnSpawnedServer);
			}

			private void OnSpawnedServer(GameObject masterObject)
			{
				if (Util.CheckRoll((float)PluginConfig.CrueltyConfig.triggerChance.Value, 0f, (CharacterMaster)null))
				{
					CharacterMaster component = masterObject.GetComponent<CharacterMaster>();
					if (Object.op_Implicit((Object)(object)component) && component.hasBody && Object.op_Implicit((Object)(object)component.inventory) && component.inventory.GetItemCount(Items.HealthDecay) <= 0)
					{
						CreateCrueltyElite(component);
					}
				}
			}

			private void CreateCrueltyElite(CharacterMaster master)
			{
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Invalid comparison between Unknown and I4
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody body = master.GetBody();
				Inventory inventory = master.inventory;
				if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)inventory) || !Object.op_Implicit((Object)(object)director))
				{
					return;
				}
				List<BuffIndex> list = new List<BuffIndex>();
				BuffIndex[] eliteBuffIndices = BuffCatalog.eliteBuffIndices;
				foreach (BuffIndex val in eliteBuffIndices)
				{
					if (body.HasBuff(val) && !list.Contains(val))
					{
						list.Add(val);
					}
				}
				if (PluginConfig.CrueltyConfig.onlyApplyToElites.Value && !list.Any())
				{
					return;
				}
				DeathRewards component = ((Component)body).GetComponent<DeathRewards>();
				uint num = 0u;
				uint num2 = 0u;
				if (Object.op_Implicit((Object)(object)component))
				{
					num = component.expReward;
					num2 = component.goldReward;
				}
				(EliteDef, float) result;
				while (director.monsterCredit > 0f && list.Count < PluginConfig.CrueltyConfig.maxAffixes.Value && GetRandom(director.monsterCredit, director.currentMonsterCard, rng, list, out result))
				{
					if ((int)inventory.currentEquipmentIndex == -1)
					{
						inventory.SetEquipmentIndex(result.Item1.eliteEquipmentDef.equipmentIndex);
					}
					BuffIndex buffIndex = result.Item1.eliteEquipmentDef.passiveBuffDef.buffIndex;
					list.Add(buffIndex);
					body.AddBuff(buffIndex);
					float num3 = list.Count;
					CombatDirector obj = director;
					obj.monsterCredit -= result.Item2 / num3;
					inventory.GiveItem(Items.BoostHp, Mathf.RoundToInt((result.Item1.healthBoostCoefficient - 1f) * 10f / num3));
					inventory.GiveItem(Items.BoostDamage, Mathf.RoundToInt((result.Item1.damageBoostCoefficient - 1f) * 10f / num3));
					if (Object.op_Implicit((Object)(object)component))
					{
						component.expReward += Convert.ToUInt32((float)num / num3);
						component.goldReward += Convert.ToUInt32((float)num2 / num3);
					}
					if (!Util.CheckRoll((float)PluginConfig.CrueltyConfig.successChance.Value, 0f, (CharacterMaster)null))
					{
						break;
					}
				}
			}
		}

		public class ScriptedCruelty : MonoBehaviour
		{
			private Xoroshiro128Plus rng;

			private ScriptedCombatEncounter encounter;

			public void SetCombatListener(ScriptedCombatEncounter enc)
			{
				encounter = enc;
				rng = encounter.rng;
				encounter.combatSquad.onMemberAddedServer += OnMemberAddedServer;
			}

			private void OnMemberAddedServer(CharacterMaster master)
			{
				if ((PluginConfig.CrueltyConfig.guaranteeSpecialBoss.Value || Util.CheckRoll((float)PluginConfig.CrueltyConfig.triggerChance.Value, 0f, (CharacterMaster)null)) && Object.op_Implicit((Object)(object)master) && master.hasBody && Object.op_Implicit((Object)(object)master.inventory) && master.inventory.GetItemCount(Items.HealthDecay) <= 0)
				{
					CreateCrueltyElite(master);
				}
			}

			private void CreateCrueltyElite(CharacterMaster master)
			{
				//IL_0036: 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)
				//IL_0043: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Invalid comparison between Unknown and I4
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody body = master.GetBody();
				Inventory inventory = master.inventory;
				if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)inventory))
				{
					return;
				}
				List<BuffIndex> list = new List<BuffIndex>();
				BuffIndex[] eliteBuffIndices = BuffCatalog.eliteBuffIndices;
				foreach (BuffIndex val in eliteBuffIndices)
				{
					if (body.HasBuff(val) && !list.Contains(val))
					{
						list.Add(val);
					}
				}
				DeathRewards component = ((Component)body).GetComponent<DeathRewards>();
				uint num = 0u;
				uint num2 = 0u;
				if (Object.op_Implicit((Object)(object)component))
				{
					num = component.expReward;
					num2 = component.goldReward;
				}
				EliteDef result;
				while (list.Count < PluginConfig.CrueltyConfig.maxAffixes.Value && GetScriptedRandom(rng, list, out result))
				{
					if ((int)inventory.currentEquipmentIndex == -1)
					{
						inventory.SetEquipmentIndex(result.eliteEquipmentDef.equipmentIndex);
					}
					BuffIndex buffIndex = result.eliteEquipmentDef.passiveBuffDef.buffIndex;
					list.Add(buffIndex);
					body.AddBuff(buffIndex);
					float num3 = list.Count;
					inventory.GiveItem(Items.BoostHp, Mathf.RoundToInt((result.healthBoostCoefficient - 1f) * 10f / num3));
					inventory.GiveItem(Items.BoostDamage, Mathf.RoundToInt((result.damageBoostCoefficient - 1f) * 10f / num3));
					if (Object.op_Implicit((Object)(object)component))
					{
						component.expReward += Convert.ToUInt32((float)num / num3);
						component.goldReward += Convert.ToUInt32((float)num2 / num3);
					}
					if (!Util.CheckRoll((float)PluginConfig.CrueltyConfig.successChance.Value, 0f, (CharacterMaster)null))
					{
						break;
					}
				}
			}
		}

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

			public static hook_Awake <>9__1_0;

			public static hook_Awake <>9__1_1;

			public static Func<EliteTierDef, bool> <>9__5_0;

			public static Func<EliteTierDef, IEnumerable<EliteDef>> <>9__5_1;

			public static Func<EliteTierDef, EliteDef, global::<>f__AnonymousType0<EliteTierDef, EliteDef>> <>9__5_2;

			public static Func<global::<>f__AnonymousType0<EliteTierDef, EliteDef>, EliteDef> <>9__5_4;

			public static Func<EliteTierDef, IEnumerable<EliteDef>> <>9__6_1;

			public static Func<EliteTierDef, EliteDef, global::<>f__AnonymousType0<EliteTierDef, EliteDef>> <>9__6_2;

			internal void <Init>b__1_0(orig_Awake orig, CombatDirector self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && PluginConfig.CrueltyConfig.enabled.Value)
				{
					((Component)self).gameObject.AddComponent<CombatCruelty>().SetCombatListener(self);
				}
			}

			internal void <Init>b__1_1(orig_Awake orig, ScriptedCombatEncounter self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && PluginConfig.CrueltyConfig.enabled.Value)
				{
					((Component)self).gameObject.AddComponent<ScriptedCruelty>().SetCombatListener(self);
				}
			}

			internal bool <GetScriptedRandom>b__5_0(EliteTierDef etd)
			{
				if (etd != null)
				{
					return !etd.canSelectWithoutAvailableEliteDef;
				}
				return false;
			}

			internal IEnumerable<EliteDef> <GetScriptedRandom>b__5_1(EliteTierDef etd)
			{
				return etd.availableDefs;
			}

			internal global::<>f__AnonymousType0<EliteTierDef, EliteDef> <GetScriptedRandom>b__5_2(EliteTierDef etd, EliteDef ed)
			{
				return new { etd, ed };
			}

			internal EliteDef <GetScriptedRandom>b__5_4(global::<>f__AnonymousType0<EliteTierDef, EliteDef> <>h__TransparentIdentifier0)
			{
				return <>h__TransparentIdentifier0.ed;
			}

			internal IEnumerable<EliteDef> <GetRandom>b__6_1(EliteTierDef etd)
			{
				return etd.availableDefs;
			}

			internal global::<>f__AnonymousType0<EliteTierDef, EliteDef> <GetRandom>b__6_2(EliteTierDef etd, EliteDef ed)
			{
				return new { etd, ed };
			}
		}

		public static List<EquipmentDef> BlacklistedElites = new List<EquipmentDef>();

		public static void Init()
		{
			//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_0053: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			PluginConfig.CrueltyConfig.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_Awake val = delegate(orig_Awake orig, CombatDirector self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && PluginConfig.CrueltyConfig.enabled.Value)
					{
						((Component)self).gameObject.AddComponent<CombatCruelty>().SetCombatListener(self);
					}
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			CombatDirector.Awake += (hook_Awake)obj;
			object obj2 = <>c.<>9__1_1;
			if (obj2 == null)
			{
				hook_Awake val2 = delegate(orig_Awake orig, ScriptedCombatEncounter self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && PluginConfig.CrueltyConfig.enabled.Value)
					{
						((Component)self).gameObject.AddComponent<ScriptedCruelty>().SetCombatListener(self);
					}
				};
				<>c.<>9__1_1 = val2;
				obj2 = (object)val2;
			}
			ScriptedCombatEncounter.Awake += (hook_Awake)obj2;
		}

		private static void OnLoad()
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_000f: 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)
			EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex("AffixBlightedMoffein");
			if ((int)val != -1)
			{
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val);
				if (Object.op_Implicit((Object)(object)equipmentDef) && Object.op_Implicit((Object)(object)equipmentDef.passiveBuffDef) && Object.op_Implicit((Object)(object)equipmentDef.passiveBuffDef.eliteDef))
				{
					BlacklistedElites.Add(equipmentDef);
				}
			}
			EquipmentIndex val2 = EquipmentCatalog.FindEquipmentIndex("EliteLunarEquipment");
			if ((int)val2 != -1)
			{
				EquipmentDef equipmentDef2 = EquipmentCatalog.GetEquipmentDef(val2);
				if (Object.op_Implicit((Object)(object)equipmentDef2) && Object.op_Implicit((Object)(object)equipmentDef2.passiveBuffDef) && Object.op_Implicit((Object)(object)equipmentDef2.passiveBuffDef.eliteDef))
				{
					BlacklistedElites.Add(equipmentDef2);
				}
			}
		}

		public static bool GetScriptedRandom(Xoroshiro128Plus rng, List<BuffIndex> currentBuffs, out EliteDef result)
		{
			result = null;
			EliteTierDef[] combatDirectorEliteTiers = EliteAPI.GetCombatDirectorEliteTiers();
			if (combatDirectorEliteTiers == null || combatDirectorEliteTiers.Length == 0)
			{
				return false;
			}
			IEnumerable<EliteDef> source = from etd in combatDirectorEliteTiers
				where etd != null && !etd.canSelectWithoutAvailableEliteDef
				from ed in etd.availableDefs
				where IsValid(ed, currentBuffs)
				select ed;
			if (source.Any())
			{
				int index = rng.RangeInt(0, source.Count());
				result = source.ElementAt(index);
				return true;
			}
			return false;
		}

		public static bool GetRandom(float availableCredits, DirectorCard card, Xoroshiro128Plus rng, List<BuffIndex> currentBuffs, out (EliteDef def, float cost) result)
		{
			result = default((EliteDef, float));
			EliteTierDef[] combatDirectorEliteTiers = EliteAPI.GetCombatDirectorEliteTiers();
			if (combatDirectorEliteTiers == null || combatDirectorEliteTiers.Length == 0)
			{
				return false;
			}
			DirectorCard obj = card;
			int cost = ((obj != null) ? obj.cost : 0);
			IEnumerable<(EliteDef, float)> source = from etd in combatDirectorEliteTiers
				where IsValid(etd, card, cost, availableCredits)
				from ed in etd.availableDefs
				where IsValid(ed, currentBuffs)
				select (ed, etd.costMultiplier * (float)cost);
			if (source.Any())
			{
				int index = rng.RangeInt(0, source.Count());
				result = source.ElementAt(index);
				return true;
			}
			return false;
		}

		private static bool IsValid(EliteDef ed, List<BuffIndex> currentBuffs)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)ed) && ed.IsAvailable() && Object.op_Implicit((Object)(object)ed.eliteEquipmentDef) && Object.op_Implicit((Object)(object)ed.eliteEquipmentDef.passiveBuffDef) && ed.eliteEquipmentDef.passiveBuffDef.isElite && !BlacklistedElites.Contains(ed.eliteEquipmentDef))
			{
				return !currentBuffs.Contains(ed.eliteEquipmentDef.passiveBuffDef.buffIndex);
			}
			return false;
		}

		private static bool IsValid(EliteTierDef etd, DirectorCard card, int cost, float availableCredits)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = availableCredits >= (float)cost * etd.costMultiplier;
			if (etd != null && !etd.canSelectWithoutAvailableEliteDef && flag)
			{
				if (card != null)
				{
					return etd.CanSelect(card.spawnCard.eliteRules);
				}
				return true;
			}
			return false;
		}
	}
}
namespace MiscMods.StolenContent.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 MiscMods.StolenContent.Wisp
{
	internal class WispChanges
	{
		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()
		{
			if (PluginConfig.EnemiesPlusConfig.wispChanges.Value)
			{
				WispEmbers.TryModifyFieldValue("damageCoefficient", 0.75f);
				WispEmbers.TryModifyFieldValue("bulletCount", 6);
			}
			if (PluginConfig.EnemiesPlusConfig.greaterWispChanges.Value)
			{
				GreaterWispCard.directorCreditCost = 120;
			}
		}
	}
}
namespace MiscMods.StolenContent.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 (PluginConfig.EnemiesPlusConfig.enableTweaks.Value)
			{
				if (PluginConfig.EnemiesPlusConfig.helfireChanges.Value)
				{
					CreateHelfireDebuff();
				}
				if (PluginConfig.EnemiesPlusConfig.lunarWispChanges.Value)
				{
					LunarWispChanges();
				}
			}
			if (PluginConfig.EnemiesPlusConfig.enableSkills.Value && PluginConfig.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_005c: 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 = (DamageType)(dotStack.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 += 200f;
			}
		}

		private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			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 MiscMods.StolenContent.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();
		}
	}
}
namespace MiscMods.StolenContent.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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			impVoidSpikes = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ImpBoss/ImpVoidspikeProjectile.prefab").WaitForCompletion(), "ImpVoidSpikeProjectileScore");
			impVoidSpikes.GetComponent<ProjectileImpactExplosion>().destroyOnWorld = true;
			ContentAddition.AddProjectile(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)6;
			val.baseMaxStock = 2;
			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 float baseDuration = 3.5f;

		public static float damageCoefficient = 4f;

		public static float procCoefficient;

		public static float selfForce;

		public static float forceMagnitude = 16f;

		public static GameObject hitEffectPrefab;

		public static GameObject swipeEffectPrefab;

		public static string enterSoundString;

		public static string slashSoundString;

		public static float walkSpeedPenaltyCoefficient;

		private Animator modelAnimator;

		private float duration;

		private int slashCount;

		private Transform modelTransform;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = DoubleSlash.baseDuration / base.attackSpeedStat;
			modelAnimator = ((EntityState)this).GetModelAnimator();
			modelTransform = ((EntityState)this).GetModelTransform();
			((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);
				((EntityState)this).PlayAnimation("Gesture, Override", "DoubleSlash", "DoubleSlash.playbackRate", duration);
			}
			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();
		}

		private void HandleSlash(string animatorParamName, string muzzleName, string hitBoxGroupName)
		{
			//IL_004b: 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_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			if (!((double)modelAnimator.GetFloat(animatorParamName) <= 0.100000001490116))
			{
				Util.PlaySound(DoubleSlash.slashSoundString, ((EntityState)this).gameObject);
				EffectManager.SimpleMuzzleFlash(DoubleSlash.swipeEffectPrefab, ((EntityState)this).gameObject, muzzleName, true);
				slashCount++;
				Ray val = Utils.PredictAimray(((BaseState)this).GetAimRay(), ((EntityState)this).characterBody, ImpChanges.impVoidSpikes);
				ProjectileManager.instance.FireProjectile(ImpChanges.impVoidSpikes, ((Ray)(ref val)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref val)).direction), ((EntityState)this).gameObject, base.damageStat * 1f, 0f, Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), (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", "HandR");
					break;
				case 1:
					HandleSlash("HandL.hitBoxActive", "SwipeLeft", "HandL");
					break;
				}
			}
			if (!((double)((EntityState)this).fixedAge < (double)duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
}
namespace MiscMods.StolenContent.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)6;
			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_0162: 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);
				Debug.LogFormat("Buffing target {0}", new object[1] { base.target });
				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 MiscMods.StolenContent.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 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			duration = baseBurrowExitDuration / base.attackSpeedStat;
			((EntityState)this).PlayAnimation("Body", "Spawn1", "Spawn1.playbackRate", duration / ANIM_DURATION_COEF);
			if (((EntityState)this).isAuthority)
			{