Decompiled source of BetterDrones v1.6.1

BetterDrones.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterDrones.DroneStates;
using BetterDrones.DroneTweaks;
using BetterDrones.Utils;
using BetterDrones.Utils.Paths;
using EntityStates;
using EntityStates.AffixEarthHealer;
using EntityStates.Drone.DroneWeapon;
using EntityStates.Engi.EngiBubbleShield;
using EntityStates.Mage.Weapon;
using EntityStates.Merc;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Drone.DroneWeapon;
using On.EntityStates.Mage.Weapon;
using On.RoR2;
using On.RoR2.CharacterAI;
using On.RoR2.Projectile;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BetterDrones")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterDrones")]
[assembly: AssemblyTitle("BetterDrones")]
[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 BetterDrones
{
	[BepInPlugin("pseudopulse.BetterDrones", "BetterDrones", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_FixedUpdate <0>__OverrideInputsPerfectAim;

			public static hook_Fire <1>__AlliesDontEatShots;
		}

		public const string PluginGUID = "pseudopulse.BetterDrones";

		public const string PluginAuthor = "pseudopulse";

		public const string PluginName = "BetterDrones";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource ModLogger;

		public static ConfigFile config;

		public static bool MechanicalAllyOrbitEnabled;

		public static float MechanicalAllyOrbitDistance;

		public static float MechanicalAllyOrbitSpeed;

		public static float MechanicalAllyOrbitOffset;

		public static List<string> MechanicalAllyOrbitBlacklist;

		public static bool PingControlEnabled;

		public static bool PerfectAimEnabled;

		public static float Alpha;

		public void Awake()
		{
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			config = ((BaseUnityPlugin)this).Config;
			MechanicalAllyOrbitEnabled = config.Bind<bool>("Global", "RoR1 Drone Movement", true, "Should aerial mechanical allies orbit you like in Risk of Rain 1? This disables AI movement changes.").Value;
			MechanicalAllyOrbitDistance = config.Bind<float>("Global", "Drone Orbit Distance", 3f, "The distance aerial mechanical allies should orbit you from.").Value;
			MechanicalAllyOrbitOffset = config.Bind<float>("Global", "Drone Orbit Height", 1.3f, "The height aerial mechanical allies should orbit you from.").Value;
			MechanicalAllyOrbitSpeed = config.Bind<float>("Global", "Drone Orbit Speed", 7f, "The speed in seconds in which it should take for an aerial mechanical ally to make a full rotation around you.").Value;
			MechanicalAllyOrbitBlacklist = config.Bind<string>("Global", "Orbit Blacklist", "RoboBallBossBody SuperRoboBallBossBody SquallBody BackupDroneBody FlameDroneBody MegaDroneBody", "List of body names to blacklist from orbit, seperated by whitespace.").Value.Split(new char[1] { ' ' }).ToList();
			MechanicalAllyOrbitBlacklist.Add("HellDroneBody");
			MechanicalAllyOrbitBlacklist.Add("BoosterDroneBody");
			MechanicalAllyOrbitBlacklist.Add("ShredderDrone");
			PingControlEnabled = config.Bind<bool>("Global", "Ping Control", true, "Should mechanical allies target your most recent ping?").Value;
			PerfectAimEnabled = config.Bind<bool>("Global", "Perfect Aim", true, "Should mechanical allies have perfect aim?").Value;
			Alpha = config.Bind<float>("Global", "Ally Transparency", 0.5f, "The transparency of mechanical allies between 1 (fully visible) and 0 (fully transparent)").Value;
			if (MechanicalAllyOrbitEnabled)
			{
				OrbitalMovement.EnableOrbitalMovement();
			}
			if (PingControlEnabled)
			{
				PingControl.EnablePingControls();
			}
			if (PerfectAimEnabled)
			{
				object obj = <>O.<0>__OverrideInputsPerfectAim;
				if (obj == null)
				{
					hook_FixedUpdate val = OverrideInputsPerfectAim;
					<>O.<0>__OverrideInputsPerfectAim = val;
					obj = (object)val;
				}
				BaseAI.FixedUpdate += (hook_FixedUpdate)obj;
			}
			GunnerDrone.EnableChanges();
			MissileDrone.EnableChanges();
			HealingDrone.EnableChanges();
			IncineratorDrone.EnableChanges();
			EmergencyDrone.EnableChanges();
			MegaDrone.EnableChanges();
			GunnerTurret.EnableChanges();
			IgnoreCollision.Enable();
			DroneTransparency.EnableChanges();
			DroneCloakPropagation.Setup();
			object obj2 = <>O.<1>__AlliesDontEatShots;
			if (obj2 == null)
			{
				hook_Fire val2 = AlliesDontEatShots;
				<>O.<1>__AlliesDontEatShots = val2;
				obj2 = (object)val2;
			}
			BulletAttack.Fire += (hook_Fire)obj2;
		}

		private static void HopooWhat(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_healthComponent")
			}))
			{
				val.RemoveRange(4);
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, 4);
				val.Index += 2;
				val.EmitDelegate<Func<EvisDash, HurtBox, bool>>((Func<EvisDash, HurtBox, bool>)((EvisDash evis, HurtBox hb) => hb.teamIndex != ((BaseState)evis).GetTeam()));
			}
			else
			{
				ModLogger.LogError((object)"Failed to apply merc dash IL hook");
			}
		}

		private static void OverrideInputsPerfectAim(orig_FixedUpdate orig, BaseAI self)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Invalid comparison between Unknown and I4
			//IL_00c0: 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)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Vector3 val = default(Vector3);
			if (NetworkServer.active && !((Object)((Component)self).gameObject).name.Contains("Drone2") && !((Object)((Component)self).gameObject).name.Contains("EmergencyDrone") && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)((Component)self.body).gameObject) && ((Enum)self.body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2) && (int)self.body.teamComponent.teamIndex == 1 && self.currentEnemy.GetBullseyePosition(ref val))
			{
				InputBankTest bodyInputBank = self.bodyInputBank;
				Vector3 val2 = val - self.bodyInputBank.aimOrigin;
				bodyInputBank.aimDirection = ((Vector3)(ref val2)).normalized;
			}
		}

		private static void AlliesDontEatShots(orig_Fire orig, BulletAttack self)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			if ((Delegate?)(object)self.filterCallback == (Delegate?)(object)BulletAttack.defaultFilterCallback)
			{
				self.filterCallback = (FilterCallback)delegate(BulletAttack attack, ref BulletHit hit)
				{
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_0029: Unknown result type (might be due to invalid IL or missing references)
					return (!Object.op_Implicit((Object)(object)hit.hitHurtBox) || hit.hitHurtBox.teamIndex != self.owner.GetComponent<TeamComponent>().teamIndex) && BulletAttack.DefaultFilterCallbackImplementation(attack, ref hit);
				};
			}
			orig.Invoke(self);
		}
	}
}
namespace BetterDrones.DroneTweaks
{
	public class DroneCloakPropagation
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_RecalculateStats <>9__0_0;

			internal void <Setup>b__0_0(orig_RecalculateStats orig, CharacterBody self)
			{
				<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0
				{
					self = self
				};
				orig.Invoke(CS$<>8__locals0.self);
				if (!NetworkServer.active || !Main.MechanicalAllyOrbitEnabled || !CS$<>8__locals0.self.isPlayerControlled)
				{
					return;
				}
				IEnumerable<CharacterMaster> enumerable = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster x) => Object.op_Implicit((Object)(object)x.minionOwnership) && (Object)(object)x.minionOwnership.ownerMaster == (Object)(object)CS$<>8__locals0.self.master && Object.op_Implicit((Object)(object)x.GetBody()) && ((Enum)x.GetBody().bodyFlags).HasFlag((Enum)(object)(BodyFlags)2));
				if (CS$<>8__locals0.self.HasBuff(Buffs.Cloak))
				{
					foreach (CharacterMaster item in enumerable)
					{
						if (!item.GetBody().HasBuff(Buffs.Cloak))
						{
							item.GetBody().AddBuff(Buffs.Cloak);
						}
					}
					return;
				}
				foreach (CharacterMaster item2 in enumerable)
				{
					if (item2.GetBody().HasBuff(Buffs.Cloak))
					{
						item2.GetBody().RemoveBuff(Buffs.Cloak);
					}
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0
		{
			public CharacterBody self;

			internal bool <Setup>b__1(CharacterMaster x)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				return Object.op_Implicit((Object)(object)x.minionOwnership) && (Object)(object)x.minionOwnership.ownerMaster == (Object)(object)self.master && Object.op_Implicit((Object)(object)x.GetBody()) && ((Enum)x.GetBody().bodyFlags).HasFlag((Enum)(object)(BodyFlags)2);
			}
		}

		public static void Setup()
		{
			//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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self)
				{
					orig.Invoke(self);
					if (!NetworkServer.active || !Main.MechanicalAllyOrbitEnabled || !self.isPlayerControlled)
					{
						return;
					}
					IEnumerable<CharacterMaster> enumerable = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster x) => Object.op_Implicit((Object)(object)x.minionOwnership) && (Object)(object)x.minionOwnership.ownerMaster == (Object)(object)self.master && Object.op_Implicit((Object)(object)x.GetBody()) && ((Enum)x.GetBody().bodyFlags).HasFlag((Enum)(object)(BodyFlags)2));
					if (self.HasBuff(Buffs.Cloak))
					{
						foreach (CharacterMaster item in enumerable)
						{
							if (!item.GetBody().HasBuff(Buffs.Cloak))
							{
								item.GetBody().AddBuff(Buffs.Cloak);
							}
						}
						return;
					}
					foreach (CharacterMaster item2 in enumerable)
					{
						if (item2.GetBody().HasBuff(Buffs.Cloak))
						{
							item2.GetBody().RemoveBuff(Buffs.Cloak);
						}
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
		}
	}
	public class DroneTransparency
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Start <>9__0_0;

			internal void <EnableChanges>b__0_0(orig_Start orig, CharacterBody self)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Invalid comparison between Unknown and I4
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)((Component)self).gameObject.GetComponent<VectorPID>()) && ((Enum)self.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2) && (int)self.teamComponent.teamIndex == 1)
				{
					((Component)self).gameObject.AddComponent<DroneAlphaController>();
				}
			}
		}

		internal static void EnableChanges()
		{
			//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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, CharacterBody self)
				{
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0045: Invalid comparison between Unknown and I4
					orig.Invoke(self);
					if (Object.op_Implicit((Object)(object)((Component)self).gameObject.GetComponent<VectorPID>()) && ((Enum)self.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2) && (int)self.teamComponent.teamIndex == 1)
					{
						((Component)self).gameObject.AddComponent<DroneAlphaController>();
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			CharacterBody.Start += (hook_Start)obj;
		}
	}
	public class DroneAlphaController : MonoBehaviour
	{
		private List<Renderer> renderers = new List<Renderer>();

		private MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock();

		private float Alpha => Main.Alpha;

		private void Start()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00b9: Expected O, but got Unknown
			CharacterBody component = ((Component)this).GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			ModelLocator modelLocator = component.modelLocator;
			if (Object.op_Implicit((Object)(object)modelLocator) && Object.op_Implicit((Object)(object)modelLocator.modelTransform) && Object.op_Implicit((Object)(object)((Component)modelLocator.modelTransform).GetComponent<CharacterModel>()))
			{
				CharacterModel component2 = ((Component)modelLocator.modelTransform).GetComponent<CharacterModel>();
				RendererInfo[] baseRendererInfos = component2.baseRendererInfos;
				foreach (RendererInfo val in baseRendererInfos)
				{
					renderers.Add(val.renderer);
				}
				SceneCamera.onSceneCameraPreRender += new SceneCameraDelegate(UpdateTransparency);
			}
		}

		private void UpdateTransparency(SceneCamera sceneCamera)
		{
			for (int i = 0; i < renderers.Count; i++)
			{
				Renderer val = renderers[i];
				val.GetPropertyBlock(propertyBlock);
				propertyBlock.SetFloat("_Fade", Alpha);
				val.SetPropertyBlock(propertyBlock);
			}
		}

		private void OnDestroy()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SceneCamera.onSceneCameraPreRender -= new SceneCameraDelegate(UpdateTransparency);
		}
	}
	public class EmergencyDrone
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__19_0;

			internal void <TweakBody>b__19_0(orig_OnEnter orig, StartHealBeam self)
			{
				if (((EntityState)self).characterBody.baseNameToken == "EMERGENCYDRONE_BODY_NAME")
				{
					self.healRateCoefficient = EmergencyDroneHealCoeff;
					self.baseDuration = EmergencyDroneDuration;
					self.targetSelectionRange = EmergencyDroneRange;
				}
				orig.Invoke(self);
			}
		}

		private static string EmergencyDroneMasterPath = "RoR2/Base/Drones/EmergencyDroneMaster.prefab";

		private static string EmergencyDroneBodyPath = "RoR2/Base/Drones/EmergencyDroneBody.prefab";

		private static bool EmergencyDroneEnabled = Main.config.Bind<bool>("Emergency Drone", "Enable Changes", true, "Should changes to the Emergency Drone be enabled?").Value;

		private static float EmergencyDroneMinDistanceFromOwner = Main.config.Bind<float>("Emergency Drone - AI", "Minimum Distance", 40f, "The minimum distance a Emergency Drone can be from you when it has no targets, vanilla is 35.").Value;

		private static bool EmergencyDroneUseTargeting = Main.config.Bind<bool>("Emergency Drone - AI", "Use Standard Targeting", false, "Use the weird special targeting that Emergency Drones have? vanilla is true.").Value;

		private static float EmergencyDroneBaseHealth = Main.config.Bind<float>("Emergency Drone - Stats", "Base Health", 460f, "The base health of a Emergency Drone, vanilla is 300.").Value;

		private static float EmergencyDroneBaseRegen = Main.config.Bind<float>("Emergency Drone - Stats", "Base Regen", 7.5f, "The base regen of a Emergency Drone, vanilla is 2.").Value;

		private static float EmergencyDroneBaseSpeed = Main.config.Bind<float>("Emergency Drone - Stats", "Base Speed", 24f, "The base speed of a Emergency Drone, vanilla is 17.").Value;

		private static float EmergencyDroneBaseAcceleration = Main.config.Bind<float>("Emergency Drone - Stats", "Base Acceleration", 24f, "The base acceleration of a Emergency Drone, vanilla is 17.").Value;

		private static float EmergencyDroneBaseDamage = Main.config.Bind<float>("Emergency Drone - Stats", "Base Damage", 5f, "The base damage of a Emergency Drone, vanilla is 10.").Value;

		private static int EmergencyDroneDuration = Main.config.Bind<int>("Emergency Drone - Primary", "Duration", 7, "The duration of a Emergency Drone's heal, vanilla is 5.").Value;

		private static int EmergencyDroneRange = Main.config.Bind<int>("Emergency Drone - Primary", "Range", 90, "The maximum targeting range of a Emergency Drone's heal, vanilla is 50.").Value;

		private static float EmergencyDroneHealCoeff = Main.config.Bind<int>("Emergency Drone - Primary", "Heal Coefficient", 1, "The heal coefficient of a Emergency Drone's healing beam, vanilla is 0.5.").Value;

		public static bool EmergencyDroneHealAuraEnabled = Main.config.Bind<bool>("Emergency Drone - Heal Aura", "Use Healing Aura", true, "Should Emergency Drones have a passive healing aura?").Value;

		public static float EmergencyDroneHealAuraFraction = Main.config.Bind<float>("Emergency Drone - Heal Aura", "Heal Fraction", 0.1f, "The healing fraction of an Emergency Drone's aura.").Value;

		public static float EmergencyDroneHealAuraRange = Main.config.Bind<float>("Emergency Drone - Heal Aura", "Range", 25f, "The range of an Emergency Drone's aura.").Value;

		public static float EmergencyDroneHealAuraInterval = Main.config.Bind<float>("Emergency Drone - Heal Aura", "Inteval", 5f, "The frequency in seconds of an Emergency Drone's aura.").Value;

		private static bool EmergencyDroneMoreStages = Main.config.Bind<bool>("Emergency Drone - More Stages", "Enabled", true, "Should the Emergency Drone spawn on more stages?").Value;

		private static void TweakAI()
		{
			//IL_0006: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)EmergencyDroneMasterPath).WaitForCompletion();
			if (Main.MechanicalAllyOrbitEnabled)
			{
				AISkillDriver[] components = val.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val2 in components)
				{
					string customName = val2.customName;
					string text = customName;
					if (!(text == "HealLeader"))
					{
						if (text == "HealNearAlly")
						{
							val2.movementType = (MovementType)0;
							val2.maxTargetHealthFraction = 1f;
							val2.minDistance = EmergencyDroneRange;
							val2.activationRequiresAimConfirmation = false;
						}
						else
						{
							Object.Destroy((Object)(object)val2);
						}
					}
					else
					{
						val2.movementType = (MovementType)0;
						val2.maxTargetHealthFraction = 1f;
						val2.maxDistance = EmergencyDroneRange;
						val2.activationRequiresAimConfirmation = false;
					}
				}
				return;
			}
			AISkillDriver[] components2 = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val3 in components2)
			{
				switch (val3.customName)
				{
				case "HardLeashToLeader":
					val3.minDistance = EmergencyDroneMinDistanceFromOwner;
					break;
				case "HealLeader":
					val3.maxTargetHealthFraction = 1f;
					val3.maxDistance = EmergencyDroneRange;
					break;
				case "HealNearAlly":
					val3.maxTargetHealthFraction = 0.85f;
					val3.minDistance = EmergencyDroneRange;
					break;
				}
			}
			if (!EmergencyDroneUseTargeting)
			{
				Object.Destroy((Object)(object)val.GetComponent<EmergencyDroneCustomTarget>());
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00a3: 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_00ac: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)EmergencyDroneBodyPath).WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = EmergencyDroneBaseHealth;
			component.baseMoveSpeed = EmergencyDroneBaseSpeed;
			component.baseAcceleration = EmergencyDroneBaseAcceleration;
			component.baseRegen = EmergencyDroneBaseRegen;
			component.baseDamage = EmergencyDroneBaseDamage;
			val.RemoveComponents<AkEvent>();
			object obj = <>c.<>9__19_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, StartHealBeam self)
				{
					if (((EntityState)self).characterBody.baseNameToken == "EMERGENCYDRONE_BODY_NAME")
					{
						self.healRateCoefficient = EmergencyDroneHealCoeff;
						self.baseDuration = EmergencyDroneDuration;
						self.targetSelectionRange = EmergencyDroneRange;
					}
					orig.Invoke(self);
				};
				<>c.<>9__19_0 = val2;
				obj = (object)val2;
			}
			StartHealBeam.OnEnter += (hook_OnEnter)obj;
			if (EmergencyDroneHealAuraEnabled)
			{
				EntityStateMachine val3 = val.AddComponent<EntityStateMachine>();
				SerializableEntityStateType val4 = default(SerializableEntityStateType);
				((SerializableEntityStateType)(ref val4))..ctor(typeof(HealAura));
				val3.initialStateType = val4;
				val3.mainStateType = val4;
				val3.customName = "HealAura";
				NetworkStateMachine component2 = val.GetComponent<NetworkStateMachine>();
				component2.stateMachines = val.GetComponents<EntityStateMachine>();
			}
		}

		public static void EnableChanges()
		{
			//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_0032: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//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_0089: 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_0092: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (!EmergencyDroneEnabled)
			{
				return;
			}
			TweakAI();
			TweakBody();
			if (!EmergencyDroneMoreStages)
			{
				return;
			}
			DirectorCard card = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Drones/iscBrokenEmergencyDrone.asset").WaitForCompletion(),
				selectionWeight = 1
			};
			List<Stage> list = new List<Stage>
			{
				(Stage)16,
				(Stage)32768,
				(Stage)64,
				(Stage)134217728
			};
			DirectorCardHolder val = new DirectorCardHolder
			{
				Card = card,
				InteractableCategory = (InteractableCategory)5
			};
			foreach (Stage item in list)
			{
				Helpers.AddNewInteractableToStage(val, item, "");
			}
		}
	}
	public class GunnerDrone
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__17_0;

			internal void <TweakBody>b__17_0(orig_OnEnter orig, FireTurret self)
			{
				FireTurret.bulletCount = GunnerDroneBulletCount;
				FireTurret.force = GunnerDroneForce;
				FireTurret.maxSpread = GunnerDroneMaxSpread;
				FireTurret.damageCoefficient = GunnerDroneDamageCoeff;
				orig.Invoke(self);
			}
		}

		private static string GunnerDroneMasterPath = "RoR2/Base/Drones/Drone1Master.prefab";

		private static string GunnerDroneBodyPath = "RoR2/Base/Drones/Drone1Body.prefab";

		private static bool GunnerDroneEnabled = Main.config.Bind<bool>("Gunner Drone", "Enable Changes", true, "Should changes to the Gunner Drone be enabled?").Value;

		private static float GunnerDroneMinDistanceFromOwner = Main.config.Bind<float>("Gunner Drone - AI", "Minimum Distance", 50f, "The minimum distance a Gunner Drone can be from you when it has no targets, vanilla is 60.").Value;

		private static float GunnerDroneStrafeDistance = Main.config.Bind<float>("Gunner Drone - AI", "Strafe Distance", 30f, "The maximum distance in which a Gunner Drone will attempt to strafe enemies, vanilla is 15.").Value;

		private static float GunnerDroneChaseDistance = Main.config.Bind<float>("Gunner Drone - AI", "Chase Distance", 175f, "The maximum distance in which a Gunner Drone will attempt to chase a target, vanilla is 45.").Value;

		private static float GunnerDroneBaseHealth = Main.config.Bind<float>("Gunner Drone - Stats", "Base Health", 210f, "The base health of a Gunner Drone, vanilla is 150.").Value;

		private static float GunnerDroneBaseRegen = Main.config.Bind<float>("Gunner Drone - Stats", "Base Regen", 7.5f, "The base regen of a Gunner Drone, vanilla is 5.").Value;

		private static float GunnerDroneBaseSpeed = Main.config.Bind<float>("Gunner Drone - Stats", "Base Speed", 24f, "The base speed of a Gunner Drone, vanilla is 17.").Value;

		private static float GunnerDroneBaseAcceleration = Main.config.Bind<float>("Gunner Drone - Stats", "Base Acceleration", 24f, "The base acceleration of a Gunner Drone, vanilla is 17.").Value;

		private static float GunnerDroneBaseCrit = Main.config.Bind<float>("Gunner Drone - Stats", "Base Critical Chance", 10f, "The base critical chance of a Gunner Drone, vanilla is 0.").Value;

		private static float GunnerDroneBaseDamage = Main.config.Bind<float>("Gunner Drone - Stats", "Base Damage", 5f, "The base damage of a Gunner Drone, vanilla is 10.").Value;

		private static int GunnerDroneBulletCount = Main.config.Bind<int>("Gunner Drone - Primary", "Bullet Count", 5, "The total bullets fired by a Gunner Drone's primary, vanilla is 4.").Value;

		private static int GunnerDroneMaxSpread = Main.config.Bind<int>("Gunner Drone - Primary", "Maximum Spread", 0, "The maximum spread of a Gunner Drone's primary, vanilla is 1.").Value;

		private static int GunnerDroneForce = Main.config.Bind<int>("Gunner Drone - Primary", "Knockback", 250, "The knockback of a Gunner Drone's primary, vanilla is 200.").Value;

		private static float GunnerDroneDamageCoeff = Main.config.Bind<float>("Gunner Drone - Primary", "Damage Coefficient", 0.5f, "The damage coefficient of a Gunner Drone's primary, vanilla is 0.5.").Value;

		private static void TweakAI()
		{
			//IL_0006: 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_0060: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)GunnerDroneMasterPath).WaitForCompletion();
			if (Main.MechanicalAllyOrbitEnabled)
			{
				AISkillDriver[] components = val.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val2 in components)
				{
					string customName = val2.customName;
					string text = customName;
					if (!(text == "StrafeNearbyEnemies"))
					{
						if (text == "ChaseFarEnemies")
						{
							val2.maxDistance = GunnerDroneChaseDistance;
							val2.movementType = (MovementType)0;
						}
						else
						{
							Object.Destroy((Object)(object)val2);
						}
					}
					else
					{
						val2.movementType = (MovementType)0;
					}
				}
				return;
			}
			AISkillDriver[] components2 = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val3 in components2)
			{
				switch (val3.customName)
				{
				case "HardLeashToLeader":
					val3.minDistance = GunnerDroneMinDistanceFromOwner;
					break;
				case "SoftLeashAttack":
					val3.minDistance = GunnerDroneMinDistanceFromOwner;
					break;
				case "SoftLeashToLeader":
					val3.minDistance = GunnerDroneMinDistanceFromOwner * 0.4f;
					break;
				case "StrafeNearbyEnemies":
					val3.maxDistance = GunnerDroneStrafeDistance;
					break;
				case "ChaseFarEnemies":
					val3.maxDistance = GunnerDroneChaseDistance;
					break;
				}
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_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_0083: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)GunnerDroneBodyPath).WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = GunnerDroneBaseHealth;
			component.baseCrit = GunnerDroneBaseCrit;
			component.baseMoveSpeed = GunnerDroneBaseSpeed;
			component.baseAcceleration = GunnerDroneBaseAcceleration;
			component.baseRegen = GunnerDroneBaseRegen;
			component.baseDamage = GunnerDroneBaseDamage;
			val.RemoveComponents<AkEvent>();
			object obj = <>c.<>9__17_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, FireTurret self)
				{
					FireTurret.bulletCount = GunnerDroneBulletCount;
					FireTurret.force = GunnerDroneForce;
					FireTurret.maxSpread = GunnerDroneMaxSpread;
					FireTurret.damageCoefficient = GunnerDroneDamageCoeff;
					orig.Invoke(self);
				};
				<>c.<>9__17_0 = val2;
				obj = (object)val2;
			}
			FireTurret.OnEnter += (hook_OnEnter)obj;
		}

		public static void EnableChanges()
		{
			if (GunnerDroneEnabled)
			{
				TweakAI();
				TweakBody();
			}
		}
	}
	public class GunnerTurret
	{
		private static string GunnerTurretMasterPath = "RoR2/Base/Drones/Turret1Master.prefab";

		private static string GunnerTurretBodyPath = "RoR2/Base/Drones/Turret1Body.prefab";

		private static bool GunnerTurretEnabled = Main.config.Bind<bool>("Gunner Turret", "Enable Changes", true, "Should changes to the Gunner Turret be enabled?").Value;

		private static float GunnerTurretChaseDistance = Main.config.Bind<float>("Gunner Turret - AI", "Maximum Distance", 175f, "The maximum distance in which a Gunner Turret will attempt to target, vanilla is 60.").Value;

		private static float GunnerTurretBaseHealth = Main.config.Bind<float>("Gunner Turret - Stats", "Base Health", 310f, "The base health of a Gunner Turret, vanilla is 200.").Value;

		private static float GunnerTurretBaseRegen = Main.config.Bind<float>("Gunner Turret - Stats", "Base Regen", 12f, "The base regen of a Gunner Turret, vanilla is 7.5.").Value;

		private static float GunnerTurretBaseCrit = Main.config.Bind<float>("Gunner Turret - Stats", "Base Critical Chance", 10f, "The base critical chance of a Gunner Turret, vanilla is 0.").Value;

		private static float GunnerTurretBaseDamage = Main.config.Bind<float>("Gunner Turret - Stats", "Base Damage", 18f, "The base damage of a Gunner Turret, vanilla is 18.").Value;

		public static bool GunnerTurretShieldEnabled = Main.config.Bind<bool>("Gunner Turret - Energy Shield", "Enabled", true, "Should the Gunner Turret has a periodic energy shield after dealing enough damage?").Value;

		public static float GunnerTurretShieldDamage = Main.config.Bind<float>("Gunner Turret - Energy Shield", "Damage Required", 1000f, "The damage required to active a Gunner Turret's Energy Shield, in percentage of base damage.").Value;

		public static float GunnerTurretShieldDuration = Main.config.Bind<float>("Gunner Turret - Energy Shield", "Duration", 5f, "The duration of a Gunner Turret's Energy Shield.").Value;

		private static void TweakAI()
		{
			//IL_0006: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)GunnerTurretMasterPath).WaitForCompletion();
			AISkillDriver[] components = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val2 in components)
			{
				if (val2.maxDistance == 60f)
				{
					val2.maxDistance = GunnerTurretChaseDistance;
				}
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_006c: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)GunnerTurretBodyPath).WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = GunnerTurretBaseHealth;
			component.baseCrit = GunnerTurretBaseCrit;
			component.baseRegen = GunnerTurretBaseRegen;
			component.baseDamage = GunnerTurretBaseDamage;
			if (GunnerTurretShieldEnabled)
			{
				EntityStateMachine val2 = val.AddComponent<EntityStateMachine>();
				SerializableEntityStateType val3 = default(SerializableEntityStateType);
				((SerializableEntityStateType)(ref val3))..ctor(typeof(TurretShield));
				val2.initialStateType = val3;
				val2.mainStateType = val3;
				val2.customName = "Shield";
				NetworkStateMachine component2 = val.GetComponent<NetworkStateMachine>();
				component2.stateMachines = val.GetComponents<EntityStateMachine>();
			}
			val.RemoveComponents<AkEvent>();
		}

		public static void EnableChanges()
		{
			if (GunnerTurretEnabled)
			{
				TweakAI();
				TweakBody();
			}
		}
	}
	public class HealingDrone
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__14_0;

			internal void <TweakBody>b__14_0(orig_OnEnter orig, StartHealBeam self)
			{
				if (((EntityState)self).characterBody.baseNameToken == "DRONE_HEALING_BODY_NAME")
				{
					self.healRateCoefficient = HealingDroneHealCoeff;
					self.baseDuration = HealingDroneDuration;
					self.targetSelectionRange = HealingDroneRange;
				}
				orig.Invoke(self);
			}
		}

		private static string HealingDroneMasterPath = "RoR2/Base/Drones/Drone2Master.prefab";

		private static string HealingDroneBodyPath = "RoR2/Base/Drones/Drone2Body.prefab";

		private static bool HealingDroneEnabled = Main.config.Bind<bool>("Healing Drone", "Enable Changes", true, "Should changes to the Healing Drone be enabled?").Value;

		private static float HealingDroneMinDistanceFromOwner = Main.config.Bind<float>("Healing Drone - AI", "Minimum Distance", 40f, "The minimum distance a Healing Drone can be from you when it has no targets, vanilla is 35.").Value;

		private static float HealingDroneBaseHealth = Main.config.Bind<float>("Healing Drone - Stats", "Base Health", 210f, "The base health of a Healing Drone, vanilla is 150.").Value;

		private static float HealingDroneBaseRegen = Main.config.Bind<float>("Healing Drone - Stats", "Base Regen", 7.5f, "The base regen of a Healing Drone, vanilla is 5.").Value;

		private static float HealingDroneBaseSpeed = Main.config.Bind<float>("Healing Drone - Stats", "Base Speed", 24f, "The base speed of a Healing Drone, vanilla is 17.").Value;

		private static float HealingDroneBaseAcceleration = Main.config.Bind<float>("Healing Drone - Stats", "Base Acceleration", 24f, "The base acceleration of a Healing Drone, vanilla is 17.").Value;

		private static float HealingDroneBaseCrit = Main.config.Bind<float>("Healing Drone - Stats", "Base Critical Chance", 15f, "The base critical chance of a Healing Drone, vanilla is 0.").Value;

		private static float HealingDroneBaseDamage = Main.config.Bind<float>("Healing Drone - Stats", "Base Damage", 5f, "The base damage of a Healing Drone, vanilla is 10.").Value;

		private static int HealingDroneDuration = Main.config.Bind<int>("Healing Drone - Primary", "Duration", 7, "The duration of a Healing Drone's heal, vanilla is 5.").Value;

		private static int HealingDroneRange = Main.config.Bind<int>("Healing Drone - Primary", "Range", 90, "The maximum targeting range of a Healing Drone's heal, vanilla is 50.").Value;

		private static float HealingDroneHealCoeff = Main.config.Bind<int>("Healing Drone - Primary", "Heal Coefficient", 1, "The heal coefficient of a Healing Drone's healing beam, vanilla is 0.5.").Value;

		private static void TweakAI()
		{
			//IL_0006: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)HealingDroneMasterPath).WaitForCompletion();
			if (Main.MechanicalAllyOrbitEnabled)
			{
				AISkillDriver[] components = val.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val2 in components)
				{
					string customName = val2.customName;
					string text = customName;
					if (!(text == "HealLeader"))
					{
						if (text == "HealNearAlly")
						{
							val2.movementType = (MovementType)0;
							val2.maxTargetHealthFraction = 0.85f;
							val2.activationRequiresAimConfirmation = false;
							val2.minDistance = 60f;
						}
						else
						{
							Object.Destroy((Object)(object)val2);
						}
					}
					else
					{
						val2.movementType = (MovementType)0;
						val2.maxTargetHealthFraction = 1f;
						val2.activationRequiresAimConfirmation = false;
					}
				}
				return;
			}
			AISkillDriver[] components2 = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val3 in components2)
			{
				switch (val3.customName)
				{
				case "HardLeashToLeader":
					val3.minDistance = HealingDroneMinDistanceFromOwner;
					break;
				case "HealLeader":
					val3.maxTargetHealthFraction = 1f;
					break;
				case "HealNearAlly":
					val3.maxTargetHealthFraction = 0.85f;
					val3.minDistance = 60f;
					break;
				}
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_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_0083: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)HealingDroneBodyPath).WaitForCompletion();
			val.RemoveComponents<AkEvent>();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = HealingDroneBaseHealth;
			component.baseCrit = HealingDroneBaseCrit;
			component.baseMoveSpeed = HealingDroneBaseSpeed;
			component.baseAcceleration = HealingDroneBaseAcceleration;
			component.baseRegen = HealingDroneBaseRegen;
			component.baseDamage = HealingDroneBaseDamage;
			object obj = <>c.<>9__14_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, StartHealBeam self)
				{
					if (((EntityState)self).characterBody.baseNameToken == "DRONE_HEALING_BODY_NAME")
					{
						self.healRateCoefficient = HealingDroneHealCoeff;
						self.baseDuration = HealingDroneDuration;
						self.targetSelectionRange = HealingDroneRange;
					}
					orig.Invoke(self);
				};
				<>c.<>9__14_0 = val2;
				obj = (object)val2;
			}
			StartHealBeam.OnEnter += (hook_OnEnter)obj;
		}

		public static void EnableChanges()
		{
			if (HealingDroneEnabled)
			{
				TweakAI();
				TweakBody();
			}
		}
	}
	public class IncineratorDrone
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__18_0;

			internal void <TweakBody>b__18_0(orig_OnEnter orig, Flamethrower self)
			{
				if (((EntityState)self).characterBody.baseNameToken == "FLAMEDRONE_BODY_NAME")
				{
					self.maxDistance = IncineratorDroneRange;
					Flamethrower.baseFlamethrowerDuration = IncineratorDroneDuration;
					Flamethrower.ignitePercentChance = IncineratorDroneBurnChance;
					Flamethrower.totalDamageCoefficient = IncineratorDroneDamageCoeff;
				}
				orig.Invoke(self);
			}
		}

		private static string IncineratorDroneMasterPath = "RoR2/Base/Drones/FlameDroneMaster.prefab";

		private static string IncineratorDroneBodyPath = "RoR2/Base/Drones/FlameDroneBody.prefab";

		private static bool IncineratorDroneEnabled = Main.config.Bind<bool>("Incinerator Drone", "Enable Changes", true, "Should changes to the Incinerator Drone be enabled?").Value;

		private static float IncineratorDroneMinDistanceFromOwner = Main.config.Bind<float>("Incinerator Drone - AI", "Minimum Distance", 120f, "The minimum distance a Incinerator Drone can be from you when it has no targets, vanilla is 120.").Value;

		private static float IncineratorDroneStrafeDistance = Main.config.Bind<float>("Incinerator Drone - AI", "Strafe Distance", 10f, "The maximum distance in which a Incinerator Drone will attempt to strafe enemies, vanilla is 12.").Value;

		private static float IncineratorDroneChaseDistance = Main.config.Bind<float>("Incinerator Drone - AI", "Chase Distance", 100f, "The maximum distance in which a Incinerator Drone will attempt to chase a target, vanilla is 100.").Value;

		private static float IncineratorDroneBaseHealth = Main.config.Bind<float>("Incinerator Drone - Stats", "Base Health", 450f, "The base health of a Incinerator Drone, vanilla is 300.").Value;

		private static float IncineratorDroneBaseRegen = Main.config.Bind<float>("Incinerator Drone - Stats", "Base Regen", 7.5f, "The base regen of a Incinerator Drone, vanilla is 5.").Value;

		private static float IncineratorDroneBaseSpeed = Main.config.Bind<float>("Incinerator Drone - Stats", "Base Speed", 24f, "The base speed of a Incinerator Drone, vanilla is 17.").Value;

		private static float IncineratorDroneBaseAcceleration = Main.config.Bind<float>("Incinerator Drone - Stats", "Base Acceleration", 24f, "The base acceleration of a Incinerator Drone, vanilla is 17.").Value;

		private static float IncineratorDroneBaseCrit = Main.config.Bind<float>("Incinerator Drone - Stats", "Base Critical Chance", 15f, "The base critical chance of a Incinerator Drone, vanilla is 0.").Value;

		private static float IncineratorDroneBaseDamage = Main.config.Bind<float>("Incinerator Drone - Stats", "Base Damage", 5f, "The base damage of a Incinerator Drone, vanilla is 10.").Value;

		private static int IncineratorDroneBaseArmor = Main.config.Bind<int>("Incinerator Drone - Stats", "Base Armor", 50, "The base armor of a Incinerator Drone, vanilla is 20.").Value;

		private static int IncineratorDroneRange = Main.config.Bind<int>("Incinerator Drone - Primary", "Range", 15, "The range of an Incinerator Drone's primary, vanilla is 12.").Value;

		private static int IncineratorDroneDuration = Main.config.Bind<int>("Incinerator Drone - Primary", "Duration", 5, "The duration of a Incinerator Drone's primary, vanilla is 3.").Value;

		private static int IncineratorDroneBurnChance = Main.config.Bind<int>("Incinerator Drone - Primary", "Ignite Chance", 100, "The ignite chance of a Incinerator Drone's primary, vanilla is 50.").Value;

		private static float IncineratorDroneDamageCoeff = Main.config.Bind<float>("Incinerator Drone - Primary", "Total Damage Coefficient", 25f, "The total damage coefficient of a Incinerator Drone's primary, vanilla is 20.").Value;

		private static void TweakAI()
		{
			//IL_0006: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)IncineratorDroneMasterPath).WaitForCompletion();
			AISkillDriver[] components = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val2 in components)
			{
				switch (val2.customName)
				{
				case "HardLeashToLeader":
					val2.minDistance = IncineratorDroneMinDistanceFromOwner;
					break;
				case "StrafeNearbyEnemies":
					val2.maxDistance = IncineratorDroneStrafeDistance;
					break;
				case "ChaseFarEnemies":
					val2.maxDistance = IncineratorDroneChaseDistance;
					break;
				}
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)IncineratorDroneBodyPath).WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = IncineratorDroneBaseHealth;
			component.baseCrit = IncineratorDroneBaseCrit;
			component.baseMoveSpeed = IncineratorDroneBaseSpeed;
			component.baseAcceleration = IncineratorDroneBaseAcceleration;
			component.baseRegen = IncineratorDroneBaseRegen;
			component.baseDamage = IncineratorDroneBaseDamage;
			component.baseArmor = IncineratorDroneBaseArmor;
			val.RemoveComponents<AkEvent>();
			object obj = <>c.<>9__18_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, Flamethrower self)
				{
					if (((EntityState)self).characterBody.baseNameToken == "FLAMEDRONE_BODY_NAME")
					{
						self.maxDistance = IncineratorDroneRange;
						Flamethrower.baseFlamethrowerDuration = IncineratorDroneDuration;
						Flamethrower.ignitePercentChance = IncineratorDroneBurnChance;
						Flamethrower.totalDamageCoefficient = IncineratorDroneDamageCoeff;
					}
					orig.Invoke(self);
				};
				<>c.<>9__18_0 = val2;
				obj = (object)val2;
			}
			Flamethrower.OnEnter += (hook_OnEnter)obj;
		}

		public static void EnableChanges()
		{
			if (IncineratorDroneEnabled)
			{
				TweakAI();
				TweakBody();
			}
		}
	}
	public class MegaDrone
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__24_0;

			public static hook_OnEnter <>9__24_1;

			public static hook_PopulateScene <>9__25_0;

			internal void <TweakBody>b__24_0(orig_OnEnter orig, FireMegaTurret self)
			{
				self.bulletCount = MegaDroneBulletCount;
				FireMegaTurret.force = MegaDroneForce;
				FireMegaTurret.maxSpread = MegaDroneMaxSpread;
				FireMegaTurret.damageCoefficient = MegaDroneDamageCoeff;
				orig.Invoke(self);
			}

			internal void <TweakBody>b__24_1(orig_OnEnter orig, FireTwinRocket self)
			{
				FireTwinRocket.damageCoefficient = MegaDroneRocketDamage;
				FireTwinRocket.force = MegaDroneRocketForce;
				orig.Invoke(self);
			}

			internal void <SpawnTweak>b__25_0(orig_PopulateScene orig, SceneDirector self)
			{
				//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_0045: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (NetworkServer.active)
				{
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "frozenwall")
					{
						InteractableSpawnCard val = InteractableSpawnCard.iscBrokenMegaDrone.Load<InteractableSpawnCard>();
						GameObject val2 = Object.Instantiate<GameObject>(((SpawnCard)val).prefab, SpawnLocation, Quaternion.identity);
						PurchaseInteraction component = val2.GetComponent<PurchaseInteraction>();
						component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost);
						NetworkServer.Spawn(val2);
					}
				}
			}
		}

		private static string MegaDroneMasterPath = "RoR2/Base/Drones/MegaDroneMaster.prefab";

		private static string MegaDroneBodyPath = "RoR2/Base/Drones/MegaDroneBody.prefab";

		private static bool MegaDroneEnabled = Main.config.Bind<bool>("TC-280", "Enable Changes", true, "Should changes to the TC-280 be enabled?").Value;

		private static float MegaDroneMinDistanceFromOwner = Main.config.Bind<float>("TC-280 - AI", "Minimum Distance", 120f, "The minimum distance a TC-280 can be from you when it has no targets, vanilla is 180.").Value;

		private static float MegaDroneStrafeDistance = Main.config.Bind<float>("TC-280 - AI", "Strafe Distance", 90f, "The maximum distance in which a TC-280 will attempt to strafe enemies, vanilla is 60.").Value;

		private static float MegaDroneChaseDistance = Main.config.Bind<float>("TC-280 - AI", "Chase Distance", 175f, "The maximum distance in which a TC-280 will attempt to chase a target, vanilla is 90.").Value;

		private static float MegaDroneTooCloseDistance = Main.config.Bind<float>("TC-280 - AI", "Too Close Distance", 10f, "The distance in which the TC-280 deems 'too close', vanilla is 20.").Value;

		private static float MegaDroneBaseHealth = Main.config.Bind<float>("TC-280 - Stats", "Base Health", 1600f, "The base health of a TC-280, vanilla is 900.").Value;

		private static float MegaDroneBaseRegen = Main.config.Bind<float>("TC-280 - Stats", "Base Regen", 10f, "The base regen of a TC-280, vanilla is 5.").Value;

		private static float MegaDroneBaseSpeed = Main.config.Bind<float>("TC-280 - Stats", "Base Speed", 24f, "The base speed of a TC-280, vanilla is 20.").Value;

		private static float MegaDroneBaseAcceleration = Main.config.Bind<float>("TC-280 - Stats", "Base Acceleration", 24f, "The base acceleration of a TC-280, vanilla is 20.").Value;

		private static float MegaDroneBaseCrit = Main.config.Bind<float>("TC-280 - Stats", "Base Critical Chance", 10f, "The base critical chance of a TC-280, vanilla is 0.").Value;

		private static float MegaDroneBaseDamage = Main.config.Bind<float>("TC-280 - Stats", "Base Damage", 7.5f, "The base damage of a TC-280, vanilla is 14.").Value;

		private static int MegaDroneBulletCount = Main.config.Bind<int>("TC-280 - Primary", "Bullet Count", 20, "The total bullets fired by a TC-280's primary, vanilla is 15.").Value;

		private static int MegaDroneMaxSpread = Main.config.Bind<int>("TC-280 - Primary", "Maximum Spread", 0, "The maximum spread of a TC-280's primary, vanilla is 1.").Value;

		private static int MegaDroneForce = Main.config.Bind<int>("TC-280 - Primary", "Knockback", 400, "The knockback of a TC-280's primary, vanilla is 400.").Value;

		private static float MegaDroneDamageCoeff = Main.config.Bind<int>("TC-280 - Primary", "Damage Coefficient", 3, "The damage coefficient of a TC-280's primary, vanilla is 2.5.").Value;

		private static float MegaDroneRocketDamage = Main.config.Bind<float>("TC-280 - Secondary", "Damage Coefficient", 5f, "The damage coefficient of a TC-280's rockets, vanilla is 4").Value;

		private static float MegaDroneRocketForce = Main.config.Bind<float>("TC-280 - Secondary", "Knockback", 1000f, "The knockback of a TC-280's rockets, vanilla is 1000").Value;

		public static bool MegaDroneLaserEnabled = Main.config.Bind<bool>("TC-280 - Laser", "Use Debuff Laser", false, "Should the TC-280 have a passive laser that debuffs targets?").Value;

		public static float MegaDroneLaserInterval = Main.config.Bind<float>("TC-280 - Laser", "Interval", 5f, "How often the laser should switch on.").Value;

		public static bool MegaDroneGuaranteed = Main.config.Bind<bool>("TC-280 - Map Secret", "Enabled", true, "Makes the TC-280 a guaranteed map secret on rallypoint and makes it no longer spawn naturally").Value;

		private static Vector3 SpawnLocation = new Vector3(54.6f, 112.2f, 71.3f);

		private static void TweakAI()
		{
			//IL_0006: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)MegaDroneMasterPath).WaitForCompletion();
			if (Main.MechanicalAllyOrbitEnabled)
			{
				AISkillDriver[] components = val.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val2 in components)
				{
					switch (val2.customName)
					{
					case "StrafeCloseEnemy":
						val2.movementType = (MovementType)0;
						break;
					case "ChaseFarEnemiesRocket":
						val2.maxDistance = MegaDroneChaseDistance;
						val2.movementType = (MovementType)0;
						break;
					case "ChaseFarEnemiesGun":
						val2.maxDistance = MegaDroneChaseDistance;
						val2.movementType = (MovementType)0;
						break;
					default:
						Object.Destroy((Object)(object)val2);
						break;
					}
				}
				return;
			}
			AISkillDriver[] components2 = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val3 in components2)
			{
				switch (val3.customName)
				{
				case "LeashLeaderHard":
					val3.minDistance = MegaDroneMinDistanceFromOwner;
					break;
				case "StopTooCloseTarget":
					val3.maxDistance = MegaDroneTooCloseDistance;
					break;
				case "StrafeCloseEnemy":
					val3.maxDistance = MegaDroneStrafeDistance;
					break;
				case "ChaseFarEnemiesRocket":
					val3.maxDistance = MegaDroneChaseDistance;
					break;
				case "ChaseFarEnemiesGun":
					val3.maxDistance = MegaDroneChaseDistance;
					break;
				}
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_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_0083: Expected O, but got Unknown
			//IL_009d: 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_00a8: Expected O, but got Unknown
			//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_00dc: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)MegaDroneBodyPath).WaitForCompletion();
			val.RemoveComponents<AkEvent>();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = MegaDroneBaseHealth;
			component.baseCrit = MegaDroneBaseCrit;
			component.baseMoveSpeed = MegaDroneBaseSpeed;
			component.baseAcceleration = MegaDroneBaseAcceleration;
			component.baseRegen = MegaDroneBaseRegen;
			component.baseDamage = MegaDroneBaseDamage;
			object obj = <>c.<>9__24_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, FireMegaTurret self)
				{
					self.bulletCount = MegaDroneBulletCount;
					FireMegaTurret.force = MegaDroneForce;
					FireMegaTurret.maxSpread = MegaDroneMaxSpread;
					FireMegaTurret.damageCoefficient = MegaDroneDamageCoeff;
					orig.Invoke(self);
				};
				<>c.<>9__24_0 = val2;
				obj = (object)val2;
			}
			FireMegaTurret.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>c.<>9__24_1;
			if (obj2 == null)
			{
				hook_OnEnter val3 = delegate(orig_OnEnter orig, FireTwinRocket self)
				{
					FireTwinRocket.damageCoefficient = MegaDroneRocketDamage;
					FireTwinRocket.force = MegaDroneRocketForce;
					orig.Invoke(self);
				};
				<>c.<>9__24_1 = val3;
				obj2 = (object)val3;
			}
			FireTwinRocket.OnEnter += (hook_OnEnter)obj2;
			if (MegaDroneLaserEnabled)
			{
				EntityStateMachine val4 = val.AddComponent<EntityStateMachine>();
				SerializableEntityStateType val5 = default(SerializableEntityStateType);
				((SerializableEntityStateType)(ref val5))..ctor(typeof(MegaLaser));
				val4.initialStateType = val5;
				val4.mainStateType = val5;
				val4.customName = "Laser";
				NetworkStateMachine component2 = val.GetComponent<NetworkStateMachine>();
				component2.stateMachines = val.GetComponents<EntityStateMachine>();
			}
		}

		private static void SpawnTweak()
		{
			//IL_002f: 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_003a: Expected O, but got Unknown
			if (!MegaDroneGuaranteed)
			{
				return;
			}
			InteractableSpawnCard.iscBrokenMegaDrone.Load<InteractableSpawnCard>().maxSpawnsPerStage = 0;
			object obj = <>c.<>9__25_0;
			if (obj == null)
			{
				hook_PopulateScene val = delegate(orig_PopulateScene orig, SceneDirector self)
				{
					//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_0045: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					if (NetworkServer.active)
					{
						Scene activeScene = SceneManager.GetActiveScene();
						if (((Scene)(ref activeScene)).name == "frozenwall")
						{
							InteractableSpawnCard val2 = InteractableSpawnCard.iscBrokenMegaDrone.Load<InteractableSpawnCard>();
							GameObject val3 = Object.Instantiate<GameObject>(((SpawnCard)val2).prefab, SpawnLocation, Quaternion.identity);
							PurchaseInteraction component = val3.GetComponent<PurchaseInteraction>();
							component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost);
							NetworkServer.Spawn(val3);
						}
					}
				};
				<>c.<>9__25_0 = val;
				obj = (object)val;
			}
			SceneDirector.PopulateScene += (hook_PopulateScene)obj;
		}

		public static void EnableChanges()
		{
			if (MegaDroneEnabled)
			{
				TweakAI();
				TweakBody();
				SpawnTweak();
			}
		}
	}
	public class MissileDrone
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__15_0;

			internal void <TweakBody>b__15_0(orig_OnEnter orig, FireMissileBarrage self)
			{
				FireMissileBarrage.damageCoefficient = MissileDroneDamageCoeff;
				FireMissileBarrage.maxMissileCount = MissileDroneMissileCount;
				orig.Invoke(self);
			}
		}

		private static string MissileDroneMasterPath = "RoR2/Base/Drones/DroneMissileMaster.prefab";

		private static string MissileDroneBodyPath = "RoR2/Base/Drones/MissileDroneBody.prefab";

		private static bool MissileDroneEnabled = Main.config.Bind<bool>("Missile Drone", "Enable Changes", true, "Should changes to the Missile Drone be enabled?").Value;

		private static float MissileDroneMinDistanceFromOwner = Main.config.Bind<float>("Missile Drone - AI", "Minimum Distance", 60f, "The minimum distance a Missile Drone can be from you when it has no targets, vanilla is 60.").Value;

		private static float MissileDroneStrafeDistance = Main.config.Bind<float>("Missile Drone - AI", "Strafe Distance", 15f, "The maximum distance in which a Missile Drone will attempt to strafe enemies, vanilla is 15.").Value;

		private static float MissileDroneChaseDistance = Main.config.Bind<float>("Missile Drone - AI", "Chase Distance", 175f, "The maximum distance in which a Missile Drone will attempt to chase a target, vanilla is 45.").Value;

		private static float MissileDroneBaseHealth = Main.config.Bind<float>("Missile Drone - Stats", "Base Health", 300f, "The base health of a Missile Drone, vanilla is 225.").Value;

		private static float MissileDroneBaseRegen = Main.config.Bind<float>("Missile Drone - Stats", "Base Regen", 7.5f, "The base regen of a Missile Drone, vanilla is 5.").Value;

		private static float MissileDroneBaseSpeed = Main.config.Bind<float>("Missile Drone - Stats", "Base Speed", 24f, "The base speed of a Missile Drone, vanilla is 17.").Value;

		private static float MissileDroneBaseAcceleration = Main.config.Bind<float>("Missile Drone - Stats", "Base Acceleration", 24f, "The base acceleration of a Missile Drone, vanilla is 17.").Value;

		private static float MissileDroneBaseCrit = Main.config.Bind<float>("Missile Drone - Stats", "Base Critical Chance", 15f, "The base critical chance of a Missile Drone, vanilla is 0.").Value;

		private static float MissileDroneBaseDamage = Main.config.Bind<float>("Missile Drone - Stats", "Base Damage", 7f, "The base damage of a Missile Drone, vanilla is 14.").Value;

		private static int MissileDroneMissileCount = Main.config.Bind<int>("Missile Drone - Primary", "Missile Count", 6, "The total missiles fired by a Missile Drone's primary, vanilla is 4.").Value;

		private static float MissileDroneDamageCoeff = Main.config.Bind<int>("Missile Drone - Primary", "Damage Coefficient", 2, "The damage coefficient of a Missile Drone's primary, vanilla is 1.").Value;

		private static void TweakAI()
		{
			//IL_0006: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)MissileDroneMasterPath).WaitForCompletion();
			if (Main.MechanicalAllyOrbitEnabled)
			{
				AISkillDriver[] components = val.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val2 in components)
				{
					string customName = val2.customName;
					string text = customName;
					if (!(text == "StrafeNearbyEnemies"))
					{
						if (text == "ChaseFarEnemies")
						{
							val2.maxDistance = MissileDroneChaseDistance;
							val2.movementType = (MovementType)0;
							val2.moveTargetType = (TargetType)0;
						}
						else
						{
							Object.Destroy((Object)(object)val2);
						}
					}
					else
					{
						val2.movementType = (MovementType)0;
						val2.moveTargetType = (TargetType)0;
					}
				}
				return;
			}
			AISkillDriver[] components2 = val.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val3 in components2)
			{
				switch (val3.customName)
				{
				case "HardLeashToLeader":
					val3.minDistance = MissileDroneMinDistanceFromOwner;
					break;
				case "SoftLeashAttack":
					val3.minDistance = MissileDroneMinDistanceFromOwner;
					break;
				case "SoftLeashToLeader":
					val3.minDistance = MissileDroneMinDistanceFromOwner * 0.4f;
					break;
				case "StrafeNearbyEnemies":
					val3.maxDistance = MissileDroneStrafeDistance;
					break;
				case "ChaseFarEnemies":
					val3.maxDistance = MissileDroneChaseDistance;
					break;
				}
			}
		}

		private static void TweakBody()
		{
			//IL_0006: 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_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_0083: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)MissileDroneBodyPath).WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = MissileDroneBaseHealth;
			component.baseCrit = MissileDroneBaseCrit;
			component.baseMoveSpeed = MissileDroneBaseSpeed;
			component.baseAcceleration = MissileDroneBaseAcceleration;
			component.baseRegen = MissileDroneBaseRegen;
			component.baseDamage = MissileDroneBaseDamage;
			val.RemoveComponents<AkEvent>();
			object obj = <>c.<>9__15_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, FireMissileBarrage self)
				{
					FireMissileBarrage.damageCoefficient = MissileDroneDamageCoeff;
					FireMissileBarrage.maxMissileCount = MissileDroneMissileCount;
					orig.Invoke(self);
				};
				<>c.<>9__15_0 = val2;
				obj = (object)val2;
			}
			FireMissileBarrage.OnEnter += (hook_OnEnter)obj;
		}

		public static void EnableChanges()
		{
			if (MissileDroneEnabled)
			{
				TweakAI();
				TweakBody();
			}
		}
	}
	public static class IgnoreCollision
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_IgnoreCollisionsWithOwner <0>__Ignore;
		}

		public static void Enable()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__Ignore;
			if (obj == null)
			{
				hook_IgnoreCollisionsWithOwner val = Ignore;
				<>O.<0>__Ignore = val;
				obj = (object)val;
			}
			ProjectileController.IgnoreCollisionsWithOwner += (hook_IgnoreCollisionsWithOwner)obj;
		}

		private static void Ignore(orig_IgnoreCollisionsWithOwner orig, ProjectileController self, bool ignore)
		{
			orig.Invoke(self, ignore);
			if (!Object.op_Implicit((Object)(object)self.owner) || !Object.op_Implicit((Object)(object)self.owner.GetComponent<CharacterBody>()) || !Object.op_Implicit((Object)(object)self.owner.GetComponent<CharacterBody>().master))
			{
				return;
			}
			List<CharacterMaster> list = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster x) => Object.op_Implicit((Object)(object)x.minionOwnership) && Object.op_Implicit((Object)(object)x.minionOwnership.ownerMaster) && (Object)(object)x.minionOwnership.ownerMaster == (Object)(object)self.owner.GetComponent<CharacterBody>().master).ToList();
			foreach (CharacterMaster item in list)
			{
				if (!Object.op_Implicit((Object)(object)item.GetBody()) || !Object.op_Implicit((Object)(object)item.GetBody().hurtBoxGroup))
				{
					continue;
				}
				CharacterBody body = item.GetBody();
				HurtBoxGroup hurtBoxGroup = body.hurtBoxGroup;
				HurtBox[] hurtBoxes = hurtBoxGroup.hurtBoxes;
				foreach (HurtBox val in hurtBoxes)
				{
					Collider[] myColliders = self.myColliders;
					foreach (Collider val2 in myColliders)
					{
						Physics.IgnoreCollision(val2, val.collider, true);
					}
				}
			}
		}
	}
	public class OrbitalMovement
	{
		private class OrbitController : MonoBehaviour
		{
			private float allyCount = 1f;

			private float fullAngle = 360f;

			private List<CharacterBody> orbiters = new List<CharacterBody>();

			private float stopwatch = 0f;

			private float updateDelay = 0.4f;

			private CharacterBody body;

			private CharacterMaster master;

			private float initialTime;

			private float distance => Main.MechanicalAllyOrbitDistance + 0.1f * (allyCount - 1f);

			private Vector3 offset => new Vector3(0f, Main.MechanicalAllyOrbitOffset, 0f);

			private float speed => Main.MechanicalAllyOrbitSpeed;

			private void Start()
			{
				body = ((Component)this).GetComponent<CharacterBody>();
				master = body.master;
				initialTime = Run.instance.GetRunStopwatch();
			}

			private void FixedUpdate()
			{
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: 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_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				stopwatch += Time.fixedDeltaTime;
				if (stopwatch >= updateDelay)
				{
					stopwatch = 0f;
					FetchAllies();
				}
				for (int i = 0; i < orbiters.Count; i++)
				{
					CharacterBody val = orbiters[i];
					if (Object.op_Implicit((Object)(object)val))
					{
						Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
						float num = Run.instance.GetRunStopwatch() - initialTime;
						Vector3 up = Vector3.up;
						Vector3 forward = body.transform.forward;
						Vector3 val2 = body.footPosition + GetOffset(val) + Quaternion.AngleAxis(fullAngle / allyCount * (float)i + num / speed * fullAngle, up) * forward * GetDistance(val);
						Vector3 val3 = (Object.op_Implicit((Object)(object)component) ? component.position : body.transform.position);
						float num2 = (body.isSprinting ? (body.moveSpeed * body.sprintingSpeedMultiplier * 1.35f) : (body.moveSpeed * 1.35f));
						Vector3 val4 = Vector3.Lerp(val3, val2, num2 * Time.fixedDeltaTime);
						if (Object.op_Implicit((Object)(object)component))
						{
							component.MovePosition(val4);
						}
						else
						{
							val.transform.position = val4;
						}
					}
				}
			}

			internal Vector3 GetOffset(CharacterBody orbiter)
			{
				//IL_0002: 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_005d: 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_00ba: 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_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_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: 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)
				//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_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)
				return (Vector3)(BodyCatalog.GetBodyName(orbiter.bodyIndex) switch
				{
					"MegaDroneBody" => offset * 7f, 
					"EmergencyDroneBody" => offset * 3f, 
					"BackupDroneBody" => offset * 2f, 
					"RoboBallRedBuddyBody" => offset * 5f, 
					"RoboBallGreenBuddyBody" => offset * 5f, 
					_ => offset, 
				});
			}

			internal float GetDistance(CharacterBody orbiter)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				return BodyCatalog.GetBodyName(orbiter.bodyIndex) switch
				{
					"MegaDroneBody" => distance * 7f, 
					"EmergencyDroneBody" => distance * 3f, 
					"BackupDroneBody" => distance * 2f, 
					"RoboBallRedBuddyBody" => distance * 5f, 
					"RoboBallGreenBuddyBody" => distance * 5f, 
					_ => distance, 
				};
			}

			internal void FetchAllies()
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				IEnumerable<CharacterMaster> enumerable = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster x) => Object.op_Implicit((Object)(object)x.minionOwnership) && (Object)(object)x.minionOwnership.ownerMaster == (Object)(object)master);
				foreach (CharacterMaster item in enumerable)
				{
					CharacterBody val = item.GetBody();
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).GetComponent<VectorPID>()) && ((Enum)val.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2) && !Main.MechanicalAllyOrbitBlacklist.Contains(BodyCatalog.GetBodyName(val.bodyIndex)) && !orbiters.Contains(val))
					{
						orbiters.Add(val);
						HurtBox[] hurtBoxes = val.hurtBoxGroup.hurtBoxes;
						foreach (HurtBox val2 in hurtBoxes)
						{
							val2.isBullseye = false;
							HurtBox.bullseyesList.Remove(val2);
						}
					}
				}
				for (int j = 0; j < orbiters.Count; j++)
				{
					CharacterBody val3 = orbiters[j];
					if (!Object.op_Implicit((Object)(object)val3))
					{
						orbiters.Remove(val3);
					}
					((Component)val3).gameObject.layer = LayerIndex.noCollision.intVal;
				}
				allyCount = orbiters.Count;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_FixedUpdate <0>__OverrideInputs;

			public static hook_Start <1>__EnableOrbit;

			public static hook_OpenSummonReturnMaster <2>__ForceRecheck;
		}

		public static void EnableOrbitalMovement()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: 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_003d: Expected O, but got Unknown
			//IL_0053: 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_005e: Expected O, but got Unknown
			object obj = <>O.<0>__OverrideInputs;
			if (obj == null)
			{
				hook_FixedUpdate val = OverrideInputs;
				<>O.<0>__OverrideInputs = val;
				obj = (object)val;
			}
			BaseAI.FixedUpdate += (hook_FixedUpdate)obj;
			object obj2 = <>O.<1>__EnableOrbit;
			if (obj2 == null)
			{
				hook_Start val2 = EnableOrbit;
				<>O.<1>__EnableOrbit = val2;
				obj2 = (object)val2;
			}
			CharacterBody.Start += (hook_Start)obj2;
			object obj3 = <>O.<2>__ForceRecheck;
			if (obj3 == null)
			{
				hook_OpenSummonReturnMaster val3 = ForceRecheck;
				<>O.<2>__ForceRecheck = val3;
				obj3 = (object)val3;
			}
			SummonMasterBehavior.OpenSummonReturnMaster += (hook_OpenSummonReturnMaster)obj3;
		}

		private static CharacterMaster ForceRecheck(orig_OpenSummonReturnMaster orig, SummonMasterBehavior self, Interactor interactor)
		{
			CharacterMaster result = orig.Invoke(self, interactor);
			OrbitController component = ((Component)interactor).GetComponent<OrbitController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				((MonoBehaviour)component).Invoke("FetchAllies", 0.2f);
			}
			return result;
		}

		private static void OverrideInputs(orig_FixedUpdate orig, BaseAI self)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)((Component)self.body).gameObject) && Object.op_Implicit((Object)(object)((Component)self.body).gameObject.GetComponent<OrbitController>()))
			{
				self.bodyInputBank.moveVector = Vector3.zero;
			}
		}

		private static void EnableOrbit(orig_Start orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && self.isPlayerControlled)
			{
				((Component)self).gameObject.AddComponent<OrbitController>();
			}
		}
	}
	public class PingControl
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_UpdateTargets <0>__OverrideTarget;
		}

		public static void EnablePingControls()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__OverrideTarget;
			if (obj == null)
			{
				hook_UpdateTargets val = OverrideTarget;
				<>O.<0>__OverrideTarget = val;
				obj = (object)val;
			}
			BaseAI.UpdateTargets += (hook_UpdateTargets)obj;
		}

		private static void OverrideTarget(orig_UpdateTargets orig, BaseAI self)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)self.master) || !Object.op_Implicit((Object)(object)self.master.minionOwnership) || !((Enum)self.body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2) || !Object.op_Implicit((Object)(object)self.master.minionOwnership.ownerMaster))
			{
				return;
			}
			CharacterMaster ownerMaster = self.master.minionOwnership.ownerMaster;
			if (Object.op_Implicit((Object)(object)ownerMaster.playerCharacterMasterController) && Object.op_Implicit((Object)(object)ownerMaster.playerCharacterMasterController.pingerController))
			{
				PingerController pingerController = ownerMaster.playerCharacterMasterController.pingerController;
				if (pingerController.currentPing.active && Object.op_Implicit((Object)(object)((PingInfo)(ref pingerController.currentPing)).targetGameObject) && Object.op_Implicit((Object)(object)((PingInfo)(ref pingerController.currentPing)).targetGameObject.GetComponent<CharacterBody>()) && (int)((PingInfo)(ref pingerController.currentPing)).targetGameObject.GetComponent<CharacterBody>().teamComponent.teamIndex != 1)
				{
					self.currentEnemy.gameObject = ((PingInfo)(ref pingerController.currentPing)).targetGameObject;
				}
			}
		}
	}
}
namespace BetterDrones.DroneStates
{
	public class HealAura : BaseState
	{
		private float stopwatch = 0f;

		private float interval => EmergencyDrone.EmergencyDroneHealAuraInterval;

		private float range => EmergencyDrone.EmergencyDroneHealAuraRange;

		private float fraction => EmergencyDrone.EmergencyDroneHealAuraFraction;

		public override void FixedUpdate()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_014f: Expected O, but got Unknown
			//IL_00fb: 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)
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			stopwatch += Time.fixedDeltaTime;
			if (!(stopwatch >= interval))
			{
				return;
			}
			stopwatch = 0f;
			SphereSearch val = new SphereSearch();
			val.radius = range;
			val.origin = ((EntityState)this).characterBody.corePosition;
			val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
			val.queryTriggerInteraction = (QueryTriggerInteraction)1;
			val.RefreshCandidates();
			TeamMask val2 = default(TeamMask);
			((TeamMask)(ref val2)).AddTeam(((BaseState)this).GetTeam());
			val.FilterCandidatesByHurtBoxTeam(val2);
			val.OrderCandidatesByDistance();
			val.FilterCandidatesByDistinctHurtBoxEntities();
			HurtBox[] hurtBoxes = val.GetHurtBoxes();
			HurtBox[] array = hurtBoxes;
			foreach (HurtBox val3 in array)
			{
				if (Object.op_Implicit((Object)(object)val3.healthComponent))
				{
					val3.healthComponent.Heal(val3.healthComponent.fullCombinedHealth * fraction, default(ProcChainMask), true);
				}
			}
			val.ClearCandidates();
			EffectManager.SpawnEffect(Heal.effectPrefab, new EffectData
			{
				scale = range,
				origin = ((EntityState)this).characterBody.corePosition
			}, true);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: 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)
			return (InterruptPriority)6;
		}
	}
	public class MegaLaser : BaseState
	{
		private float stopwatch = 0f;

		private bool isActive = false;

		private GameObject currentTarget;

		private GameObject laserInstance;

		private Transform laserInstanceEnd;

		private GameObject laserInstance2;

		private Transform laserInstanceEnd2;

		private float interval => MegaDrone.MegaDroneLaserInterval;

		public override void OnEnter()
		{
			//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_003c: 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_00a5: 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)
			((BaseState)this).OnEnter();
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/LaserEngiTurret.prefab").WaitForCompletion();
			Transform val2 = ((EntityState)this).GetModelChildLocator().FindChild("GatRight");
			if (Object.op_Implicit((Object)(object)val2))
			{
				laserInstance = Object.Instantiate<GameObject>(val, val2.position, val2.rotation);
				laserInstance.transform.parent = val2.parent;
				laserInstanceEnd = laserInstance.GetComponent<ChildLocator>().FindChild("LaserEnd");
			}
			Transform val3 = ((EntityState)this).GetModelChildLocator().FindChild("GatLeft");
			if (Object.op_Implicit((Object)(object)val3))
			{
				laserInstance2 = Object.Instantiate<GameObject>(val, val3.position, val3.rotation);
				laserInstance2.transform.parent = val2.parent;
				laserInstanceEnd2 = laserInstance.GetComponent<ChildLocator>().FindChild("LaserEnd");
			}
		}

		public override void FixedUpdate()
		{
			//IL_0088: 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)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				stopwatch += Time.fixedDeltaTime;
				if (stopwatch >= interval)
				{
					isActive = !isActive;
					stopwatch = 0f;
				}
				if (ShouldFireLaser() && Object.op_Implicit((Object)(object)currentTarget))
				{
					laserInstanceEnd.position = currentTarget.transform.position;
					laserInstanceEnd2.position = currentTarget.transform.position;
					CharacterBody component = currentTarget.GetComponent<CharacterBody>();
					List<BuffDef> list = new List<BuffDef>
					{
						Buffs.Cripple,
						Buffs.HealingDisabled,
						Buffs.Slow80,
						Buffs.Weak
					};
					foreach (BuffDef item in list)
					{
						component.AddTimedBuff(item, Time.fixedDeltaTime * 5f, 1);
					}
				}
			}
			if (isActive && Object.op_Implicit((Object)(object)currentTarget))
			{
				if (Object.op_Implicit((Object)(object)laserInstance))
				{
					laserInstance.SetActive(true);
				}
				if (Object.op_Implicit((Object)(object)laserInstance2))
				{
					laserInstance2.SetActive(true);
				}
			}
			else
			{
				if (Object.op_Implicit((Object)(object)laserInstance))
				{
					laserInstance.SetActive(false);
				}
				if (Object.op_Implicit((Object)(object)laserInstance2))
				{
					laserInstance2.SetActive(false);
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)laserInstance))
			{
				EntityState.Destroy((Object)(object)laserInstance);
			}
		}

		protected bool ShouldFireLaser()
		{
			if (!isActive)
			{
				return false;
			}
			CharacterBody characterBody = ((EntityState)this).characterBody;
			object obj;
			if (characterBody == null)
			{
				obj = null;
			}
			else
			{
				CharacterMaster master = characterBody.master;
				obj = ((master != null) ? ((Component)master).GetComponent<BaseAI>() : null);
			}
			if (Object.op_Implicit((Object)obj))
			{
				BaseAI component = ((Component)((EntityState)this).characterBody.master).GetComponent<BaseAI>();
				if (Object.op_Implicit((Object)(object)component.currentEnemy.gameObject))
				{
					currentTarget = component.currentEnemy.gameObject;
					return true;
				}
			}
			return false;
		}
	}
	public class TurretShield : BaseState
	{
		private bool isShieldUp = false;

		private float stopwatch = 0f;

		private float damageDealt = 0f;

		private GameObject shieldInstance;

		private GameObject shieldPrefab => GameObject.EngiBubbleShield.Load<GameObject>();

		private float shieldDuration => GunnerTurret.GunnerTurretShieldDuration;

		private float damageRequired => GunnerTurret.GunnerTurretShieldDamage * 0.01f * base.damageStat;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			GlobalEventManager.onServerDamageDealt += DamageDealt;
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			GlobalEventManager.onServerDamageDealt -= DamageDealt;
		}

		private void DamageDealt(DamageReport report)
		{
			if (Object.op_Implicit((Object)(object)report.attackerBody) && (Object)(object)report.attackerBody == (Object)(object)((EntityState)this).characterBody && !isShieldUp)
			{
				damageDealt += report.damageDealt;
				if (damageDealt >= damageRequired)
				{
					damageDealt = 0f;
					TriggerShield();
				}
			}
		}

		private void TriggerShield()
		{
			//IL_000e: 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_002e: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			shieldInstance = Object.Instantiate<GameObject>(shieldPrefab, ((EntityState)this).characterBody.corePosition, Quaternion.identity);
			Transform transform = shieldInstance.transform;
			transform.localScale *= 0.5f;
			shieldInstance.layer = LayerIndex.noCollision.intVal;
			((Behaviour)shieldInstance.GetComponent<ProjectileStickOnImpact>()).enabled = false;
			shieldInstance.GetComponent<EntityStateMachine>().SetNextState((EntityState)new Deployed());
			isShieldUp = true;
			AkSoundEngine.PostEvent(Events.Play_item_use_BFG_explode, ((EntityState)this).gameObject);
		}

		private void DisableShield()
		{
			if (Object.op_Implicit((Object)(object)shieldInstance))
			{
				EntityState.Destroy((Object)(object)shieldInstance);
				isShieldUp = false;
			}
			AkSoundEngine.PostEvent(Events.Play_mage_shift_wall_explode, ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (isShieldUp)
			{
				stopwatch += Time.fixedDeltaTime;
				if (stopwatch >= shieldDuration)
				{
					DisableShield();
					stopwatch = 0f;
				}
			}
			if (Object.op_Implicit((Object)(object)shieldInstance))
			{
				ProjectileController component = shieldInstance.GetComponent<ProjectileController>();
				if (Object.op_Implicit((Object)(object)component.ghost))
				{
					((Component)component.ghost).gameObject.SetActive(false);
				}
				shieldInstance.GetComponent<Rigidbody>().useGravity = false;
				shieldInstance.transform.position = ((EntityState)this).characterBody.corePosition;
			}
		}
	}
}
namespace BetterDrones.Utils
{
	public static class AddressableUtils
	{
		public static T Load<T>(this string path)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public static T LoadComponent<T>(this string path) where T : Component
		{
			return path.Load<GameObject>().GetComponent<T>();
		}
	}
	public static class Events
	{
		public static uint Play_wBisonDeath = 1113517888u;

		public static uint Play_wBisonHit = 1197473233u;

		public static uint Play_wBisonShoot1 = 3268390400u;

		public static uint Play_wBisonSpawn = 1249767875u;

		public static uint Play_wBlastdoor = 3043230225u;

		public static uint Play_wBoarDeath = 3944593657u;

		public static uint Play_wBoarExplosion = 3091761946u;

		public static uint Play_wBoarHit = 1332006904u;

		public static uint Play_wBoarMDeath = 2887033908u;

		public static uint Play_wBoarShoot1 = 2651342963u;

		public static uint Play_wBoss1Shoot1 = 3380168965u;

		public static uint Play_wBoss1Shoot2 = 3380168966u;

		public static uint Play_wBossSkill2 = 857592033u;

		public static uint Play_wBubbleShield = 3999340508u;

		public static uint Play_wBullet1 = 3448409474u;

		public static uint Play_wBullet2 = 3448409473u;

		public static uint Play_wBullet3 = 3448409472u;

		public static uint Play_wCasing = 1800381192u;

		public static uint Play_wChainLightning = 1913174254u;

		public static uint Play_wChat = 1231583519u;

		public static uint Play_wChefShoot2_1 = 4002996080u;

		public static uint Play_wChest0 = 273185112u;

		public static uint Play_wChest1 = 273185113u;

		public static uint Play_wChest2 = 273185114u;

		public static uint Play_wChest5 = 273185117u;

		public static uint Play_wChildDeath = 3731152613u;

		public static uint Play_wChildGShoot1 = 2978407106u;

		public static uint Play_wChildHit = 4072685316u;

		public static uint Play_wChildShoot1 = 4260787991u;

		public static uint Play_wClayDeath = 1853199952u;

		public static uint Play_wClayHit = 2864197409u;

		public static uint Play_wClayShoot1 = 1969574576u;

		public static uint Play_wClaySpawn = 1481867283u;

		public static uint Play_wClick = 1105771879u;

		public static uint Play_wCoin = 1232716514u;

		public static uint Play_wCoins = 2360199605u;

		public static uint Play_wCrabDeath = 2914438815u;

		public static uint Play_wCrabSpawn = 400103432u;

		public static uint Play_wCrit_01 = 3774687669u;

		public static uint Play_wCrowbar = 2755541643u;

		public static uint Play_wCutsceneAlarm = 2172459452u;

		public static uint Play_wCutsceneJet = 197474154u;

		public static uint Play_wCutscenePass = 1461112566u;

		public static uint Play_wDifficulty = 3657652262u;

		public static uint Play_wDoll = 1118795882u;

		public static uint Play_wDrill = 1252691444u;

		public static uint Play_wDrone1Spawn = 3109566651u;

		public static uint Play_wEfMushroom = 3355655210u;

		public static uint Play_wEmbryo = 3519041107u;

		public static uint Play_wError = 2120356473u;

		public static uint Play_wExplosiveShot = 1244890662u;

		public static uint Play_wFeralShoot1 = 732734997u;

		public static uint Play_wFeralShoot2 = 732734998u;

		public static uint Play_wFrozen = 1850209911u;

		public static uint Play_wGeyser = 2014257388u;

		public static uint Play_wGiantJellyExplosion = 923348941u;

		public static uint Play_wGiantJellyHit = 3830172407u;

		public static uint Play_wGolemAttack1 = 1019251312u;

		public static uint Play_wGolemDeath = 469957963u;

		public static uint Play_wGolemHit = 1924739498u;

		public static uint Play_wGolemSpawn = 2658053020u;

		public static uint Play_wGuardDeath = 2195517878u;

		public static uint Play_wGuardHit = 3726358359u;

		public static uint Play_wGuardSpawn = 1193575573u;

		public static uint Play_wHeavyShoot1 = 2266555164u;

		public static uint Play_wHitlist = 1828045284u;

		public static uint Play_wHuntressShoot1 = 2714607293u;

		public static uint Play_wHuntressShoot3 = 2714607295u;

		public static uint Play_wImpDeath = 1405469125u;

		public static uint Play_wImpGShoot1 = 702433570u;

		public static uint Play_wImpHit = 2697432036u;

		public static uint Play_wImpShoot1 = 2776445175u;

		public static uint Play_wImpShoot2 = 2776445172u;

		public static uint Play_wJanitorShoot1_1 = 2483794322u;

		public static uint Play_wJanitorShoot1_2 = 2483794321u;

		public static uint Play_wJanitorShoot2_1 = 1409879677u;

		public static uint Play_wJanitorShoot2_2 = 1409879678u;

		public static uint Play_wJanitorShoot4_1 = 1410865383u;

		public static uint Play_wJanitorShoot4_2 = 1410865380u;

		public static uint Play_wJarSouls = 4162844532u;

		public static uint Play_wJellyDeath = 2679553851u;

		public static uint Play_wJellyHit = 213554906u;

		public static uint Play_wLevelUp = 1919980434u;

		public static uint Play_wLevelUpWar = 4023542052u;

		public static uint Play_wLightning = 1330288141u;

		public static uint Play_wLizardDeath = 2074794113u;

		public static uint Play_wLizardGDeath = 4177291774u;

		public static uint Play_wLizardGHit = 1425978735u;

		public static uint Play_wLizardGShoot1 = 1170430294u;

		public static uint Play_wLizardGSpawn = 2684018717u;

		public static uint Play_wLizardHit = 4207177744u;

		public static uint Play_wLizardShoot1 = 287412267u;

		public static uint Play_wLizardSpawn = 1283696654u;

		public static uint Play_wMine = 1021358464u;

		public static uint Play_wMinerShoot1 = 1056078324u;

		public static uint Play_wMinerShoot2 = 1056078327u;

		public static uint Play_wMinerShoot3 = 1056078326u;

		public static uint Play_wMinerShoot4 = 1056078321u;

		public static uint Play_wMissileLaunch = 3415171634u;

		public static uint Play_wMS = 3023098025u;

		public static uint Play_wMush = 1473662818u;

		public static uint Play_wMushDeath = 3463803836u;

		public static uint Play_wMushHit = 2887429069u;

		public static uint Play_wMushShoot1 = 487910212u;

		public static uint Play_wMushSpawn = 4208364455u;

		public static uint Play_wNautShoot1 = 874719151u;

		public static uint Play_wPickup = 745840569u;

		public static uint Play_wPigShoot1 = 4172429713u;

		public static uint Play_wPodDeath = 368641344u;

		public static uint Play_wPodHit = 4069172177u;

		public static uint Play_wPyroShoot1 = 1977581991u;

		public static uint Play_wReflect = 3534459008u;

		public static uint Play_wReload = 1935874270u;

		public static uint Play_wRevive = 3924543518u;

		public static uint Play_wRiotGrenade = 1170699791u;

		public static uint Play_wRiotShoot1 = 392428577u;

		public static uint Play_wSamuraiShoot1 = 2292726403u;

		public static uint Play_wSamuraiShoot2 = 2292726400u;

		public static uint Play_wScavengerHit = 3803292342u;

		public static uint Play_wShield = 144484126u;

		public static uint Play_wShrine1 = 1516352125u;

		public static uint Play_wSmite = 1676655215u;

		public static uint Play_wSniper = 1326789400u;

		public static uint Play_wSniper2 = 2522836730u;

		public static uint Play_wSniperShoot3 = 3029163620u;

		public static uint Play_wSpiderHit = 1534240581u;

		public static uint Play_wSpiderShoot1 = 4018099836u;

		public static uint Play_wSpitterHit = 530229631u;

		public static uint Play_wSpitterShoot1 = 1863108870u;

		public static uint Play_wSpitter