Decompiled source of Overseer v0.7.3

Overseer.dll

Decompiled 2 weeks 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 EntityStates;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.Projectile;
using Overseer.Components;
using Overseer.Content;
using Overseer.States;
using Overseer.Units;
using Overseer.Units.Defense;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
using YAU.AddressableUtils;
using YAU.AddressableUtils.Assets;
using YAU.Attributes;
using YAU.Components;
using YAU.Constants;
using YAU.Content;
using YAU.ContentBases;
using YAU.Extensions.Enumeration;
using YAU.Extensions.Text;
using YAU.Helpers;

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

			public static hook_TakeDamage <1>__WardenAbsorb;

			public static hook_TakeDamage <2>__MarkedDamage;
		}

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

			public static Func<CharacterModel, bool> <>9__2_0;

			public static FilterCallback <>9__6_0;

			internal bool <Initialize>b__2_0(CharacterModel x)
			{
				return Object.op_Implicit((Object)(object)x.body) && Object.op_Implicit((Object)(object)((Component)x.body).GetComponent<Marker>());
			}

			internal bool <AlliesDontEatShots>b__6_0(BulletAttack attack, ref BulletHit hit)
			{
				if (Object.op_Implicit((Object)(object)hit.hitHurtBox) && Object.op_Implicit((Object)(object)hit.hitHurtBox.healthComponent) && ((Component)hit.hitHurtBox.healthComponent.body).GetComponent<IUnitC>() != null)
				{
					return false;
				}
				return BulletAttack.DefaultFilterCallbackImplementation(attack, ref hit);
			}
		}

		public SurvivorDef sdOverseer;

		public GameObject OverseerBody;

		public override void Initialize(YAUContentPack pack, ConfigFile config, string identifier)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			((GenericBase)this).contentPack = pack;
			sdOverseer = Main.assets.LoadAsset<SurvivorDef>("sdOverseer.asset");
			OverseerBody = Main.assets.LoadAsset<GameObject>("OverseerBody.prefab");
			OverseerBody.GetComponent<CameraTargetParams>().cameraParams = CharacterCameraParams.ccpStandard;
			OverseerBody.GetComponent<CharacterBody>().preferredPodPrefab = GameObject.RoboCratePod;
			((GenericBase)this).contentPack.RegisterGameObject(OverseerBody);
			((GenericBase)this).contentPack.RegisterScriptableObject((ScriptableObject)(object)sdOverseer);
			object obj = <>O.<0>__Ignore;
			if (obj == null)
			{
				hook_IgnoreCollisionsWithOwner val = Ignore;
				<>O.<0>__Ignore = val;
				obj = (object)val;
			}
			ProjectileController.IgnoreCollisionsWithOwner += (hook_IgnoreCollisionsWithOwner)obj;
			SetupLang();
			OverlayManager.AddOverlay(Material.matPulverizedOverlay, (Func<CharacterModel, bool>)((CharacterModel x) => Object.op_Implicit((Object)(object)x.body) && Object.op_Implicit((Object)(object)((Component)x.body).GetComponent<Marker>())));
			object obj2 = <>O.<1>__WardenAbsorb;
			if (obj2 == null)
			{
				hook_TakeDamage val2 = WardenAbsorb;
				<>O.<1>__WardenAbsorb = val2;
				obj2 = (object)val2;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj2;
			object obj3 = <>O.<2>__MarkedDamage;
			if (obj3 == null)
			{
				hook_TakeDamage val3 = MarkedDamage;
				<>O.<2>__MarkedDamage = val3;
				obj3 = (object)val3;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj3;
		}

		private static void MarkedDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
		{
			if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<Marker>()))
			{
				info.damage *= 1.25f;
			}
			orig.Invoke(self, info);
		}

		private static void WardenAbsorb(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<OverseerController>()))
			{
				orig.Invoke(self, info);
				return;
			}
			OverseerController component = ((Component)self).GetComponent<OverseerController>();
			List<WardenController> list = new List<WardenController>();
			foreach (IUnitC activeUnit in component.activeUnits)
			{
				if (Object.op_Implicit((Object)(object)activeUnit.GetSelf().GetComponent<WardenController>()))
				{
					list.Add(activeUnit.GetSelf().GetComponent<WardenController>());
				}
			}
			if (list.Count() > 0)
			{
				float num = info.damage * 0.4f;
				info.damage *= 0.6f;
				float damage = num / (float)list.Count();
				foreach (WardenController item in list)
				{
					item.body.healthComponent.TakeDamage(new DamageInfo
					{
						damage = damage,
						position = ((Component)item).transform.position,
						damageColorIndex = (DamageColorIndex)2
					});
				}
			}
			orig.Invoke(self, info);
		}

		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) || !Object.op_Implicit((Object)(object)self.owner.GetComponent<OverseerController>()))
			{
				return;
			}
			foreach (IUnitC activeUnit in self.owner.GetComponent<OverseerController>().activeUnits)
			{
				Collider[] myColliders = self.myColliders;
				foreach (Collider val in myColliders)
				{
					Physics.IgnoreCollision(activeUnit.GetSelf().GetComponentInChildren<Collider>(), val, true);
				}
			}
		}

		private static void AlliesDontEatShots(orig_Fire orig, BulletAttack self)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if ((Delegate?)(object)self.filterCallback == (Delegate?)(object)BulletAttack.defaultFilterCallback)
			{
				object obj = <>c.<>9__6_0;
				if (obj == null)
				{
					FilterCallback val = delegate(BulletAttack attack, ref BulletHit hit)
					{
						return (!Object.op_Implicit((Object)(object)hit.hitHurtBox) || !Object.op_Implicit((Object)(object)hit.hitHurtBox.healthComponent) || ((Component)hit.hitHurtBox.healthComponent.body).GetComponent<IUnitC>() == null) && BulletAttack.DefaultFilterCallbackImplementation(attack, ref hit);
					};
					<>c.<>9__6_0 = val;
					obj = (object)val;
				}
				self.filterCallback = (FilterCallback)obj;
			}
			orig.Invoke(self);
		}

		private void SetupLang()
		{
			StringExtensions.Add("OVERSEER_NAME", "Overseer");
			StringExtensions.Add("OVERSEER_PASSIVE1_NAME", "Defense System");
			StringExtensions.Add("OVERSEER_PASSIVE1_DESC", "A defensive shield absorbs heavy hits. Regenerates 50% slower when assembling a unit.");
			StringExtensions.Add("OVERSEER_PASSIVE2_NAME", "Vengeance Protocol");
			StringExtensions.Add("OVERSEER_PASSIVE2_DESC", "Units <style=cIsUtility>seek out</style> targets on death, exploding for <style=cIsDamage>800%</style> damage.");
			StringExtensions.Add("OVERSEER_PASSIVE3_NAME", "Swarm Commander");
			StringExtensions.Add("OVERSEER_PASSIVE3_DESC", "Increase unit cap and unit assembly speed by <style=cIsDamage>200%</style>. Units are <style=cDeath>half as effective</style>.");
			StringExtensions.Add("OVERSEER_PRIMARY_NAME", "Spectral Cascade");
			StringExtensions.Add("OVERSEER_PRIMARY_DESC", "Fire a volley of 3 <style=cIsUtility>plasma blasts</style> for <style=cIsDamage>70% damage</style>. The last shot deals <style=cIsDamage>160%</style> and <style=cDeath>Marks</style> targets.");
			StringExtensions.Add("OVERSEER_SECONDARY_NAME", "Discharge");
			StringExtensions.Add("OVERSEER_SECONDARY_DESC", "<style=cIsUtility>Shocking</style>. Launch a burst of plasma for <style=cIsDamage>400% damage</style>. Units struck <style=cDeath>detonate</style> in an <style=cIsUtility>electrifying blast</style>.");
			StringExtensions.Add("OVERSEER_UTILITY_NAME", "Beam Transmission");
			StringExtensions.Add("OVERSEER_UTILITY_DESC", "Perform a short <style=cIsUtility>intangible</style> dash.");
			StringExtensions.Add("OVERSEER_SPECIAL_NAME", "Reconfigure");
			StringExtensions.Add("OVERSEER_SPECIAL_DESC", "Switch to <style=cIsUtility>producing</style> the next type of <style=cIsDamage>unit</style>.");
			StringExtensions.Add("OVERSEER_SENTINEL_NAME", "Unit: Sentinel");
			StringExtensions.Add("OVERSEER_SENTINEL_DESC", "An agile unit that fires piercing lasers for <style=cIsDamage>50% damage</style> and launches homing missiles for <style=cIsDamage>200% damage</style>.");
			StringExtensions.Add("OVERSEER_MENDER_NAME", "Unit: Mender");
			StringExtensions.Add("OVERSEER_MENDER_DESC", "A sturdy unit that <style=cIsHealing>repairs</style> you and nearby units.");
			StringExtensions.Add("OVERSEER_BEACON_NAME", "Unit: Beacon");
			StringExtensions.Add("OVERSEER_BEACON_DESC", "A fragile unit that overclocks you, <style=cIsUtility>increasing your speed</style>.");
			StringExtensions.Add("OVERSEER_SWARMER_NAME", "Unit: Swarmer");
			StringExtensions.Add("OVERSEER_SWARMER_DESC", "A fragile unit that performs quick ram attacks at targets for <style=cIsDamage>100% damage per second</style>.");
			StringExtensions.Add("OVERSEER_WARDEN_NAME", "Unit: Warden");
			StringExtensions.Add("OVERSEER_WARDEN_DESC", "A sturdy unit that redirects <style=cIsUtility>40%</style> of the damage taken by you and nearby units to itself.");
			StringExtensions.Add("OVERSEER_VICTORY", "And so it left, ");
		}
	}
	[BepInPlugin("pseudopulse.Overseer", "Overseer", "0.7.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "pseudopulse.Overseer";

		public const string PluginAuthor = "pseudopulse";

		public const string PluginName = "Overseer";

		public const string PluginVersion = "0.7.0";

		private const bool ShouldShowLog = false;

		[StubShaders]
		public static AssetBundle assets;

		public static ManualLogSource ModLogger;

		public static YAUContentPack contentPack;

		public void Awake()
		{
			assets = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("Overseer.dll", "overseerbundle"));
			ModLogger = ((BaseUnityPlugin)this).Logger;
			contentPack = ContentPackManager.CreateContentPack(Assembly.GetExecutingAssembly(), "Overseer");
			ContentScanner.ScanTypes<GenericBase>(Assembly.GetExecutingAssembly(), (Action<GenericBase>)delegate(GenericBase x)
			{
				x.Initialize(contentPack, ((BaseUnityPlugin)this).Config, "Overseer");
			});
			ConfigManager.HandleConfigAttributes(Assembly.GetExecutingAssembly(), ((BaseUnityPlugin)this).Config);
			UnitCatalog.Initialize();
			Dash.CreatePrefabs();
			Material[] array = assets.LoadAllAssets<Material>();
			foreach (Material val in array)
			{
				val.shader = Shader.HGStandard;
			}
		}

		public static void Log(string text)
		{
			bool flag = true;
		}
	}
}
namespace Overseer.Units
{
	[CreateAssetMenu(menuName = "Overseer/Action", fileName = "Action")]
	public class UnitAction : ScriptableObject
	{
		public Sprite Icon;

		public KeyCode ActivationKey;

		public ActionType ActionType;

		public string KeyCodeText;
	}
	public enum ActionType
	{
		Recall,
		Retarget,
		Terminate,
		BuildOffense,
		BuildDefense,
		BuildSupport,
		Cancel
	}
	public class SwarmerController : UnitController
	{
		private bool isCurrentlyInDashAttack = false;

		private float stopwatch = 0f;

		private float attackCooldown = Random.Range(1f, 3f);

		private Vector3 forwardVec;

		private float stopwatch2;

		public ContactDamage contactDamage;

		private bool shouldTarget = true;

		public override HurtBox Target { get; set; }

		public override void OverrideTarget(HurtBox newTarget)
		{
			Target = newTarget;
		}

		public override void PerformMovement(int totalUnits, int thisUnit)
		{
			if (isCurrentlyInDashAttack)
			{
				DashMovement();
			}
			else
			{
				OrbitalMovement(totalUnits, thisUnit, 360f, 0f, 3.5f);
			}
		}

		public override void PerformSecondaryAction()
		{
		}

		public void DashMovement()
		{
			//IL_0007: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = Vector3.Lerp(((Component)this).transform.position, ((Component)this).transform.position + forwardVec * 3f, 20f * Time.fixedDeltaTime);
			((Component)this).transform.position = position;
		}

		public void Cancel()
		{
			isCurrentlyInDashAttack = false;
		}

		public override void FixedUpdate()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			contactDamage.overlapAttack.attacker = ((Component)owner).gameObject;
			if (!isCurrentlyInDashAttack)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			Vector3 val;
			if (stopwatch >= attackCooldown)
			{
				stopwatch = 0f;
				attackCooldown = Random.Range(1f, 3f);
				if (Object.op_Implicit((Object)(object)Target))
				{
					isCurrentlyInDashAttack = true;
					val = ((Component)Target).transform.position - ((Component)this).transform.position;
					forwardVec = ((Vector3)(ref val)).normalized;
					((MonoBehaviour)this).Invoke("Cancel", 3f);
				}
				else
				{
					Target = FindNearbyEnemy();
				}
			}
			if (!Object.op_Implicit((Object)(object)Target))
			{
				isCurrentlyInDashAttack = false;
			}
			if (Object.op_Implicit((Object)(object)Target) && !((Behaviour)Target).isActiveAndEnabled)
			{
				Target = null;
			}
			stopwatch2 += Time.fixedDeltaTime;
			if (stopwatch2 >= 0.5f && isCurrentlyInDashAttack)
			{
				val = ((Component)Target).transform.position - ((Component)this).transform.position;
				forwardVec = ((Vector3)(ref val)).normalized;
				stopwatch2 = 0f;
			}
			if (isCurrentlyInDashAttack)
			{
				((Component)this).transform.rotation = Quaternion.identity;
				((Component)this).transform.forward = forwardVec;
			}
			else
			{
				((Component)this).transform.rotation = Quaternion.Euler(-90f, 0f, 0f);
			}
		}

		public override void Recall()
		{
			if (isCurrentlyInDashAttack)
			{
				isCurrentlyInDashAttack = false;
			}
			shouldTarget = !shouldTarget;
		}
	}
	[CreateAssetMenu(menuName = "Overseer/Unit", fileName = "Unit")]
	public class Unit : ScriptableObject
	{
		public string Name;

		public string Description;

		public Sprite Icon;

		public GameObject Prefab;

		public float AssemblyTime;

		public UnitIndex UnitType;

		public void Initialize()
		{
		}
	}
	public enum UnitIndex
	{
		Sentinel,
		Swarmer,
		Warden,
		Mender,
		Beacon,
		Battery
	}
	public static class UnitCatalog
	{
		public static List<Unit> allUnits;

		public static void Initialize()
		{
			allUnits = Main.assets.LoadAllAssets<Unit>().ToList();
			foreach (Unit allUnit in allUnits)
			{
				allUnit.Initialize();
			}
		}

		public static Unit GetUnitType(UnitIndex index)
		{
			return allUnits.FirstOrDefault((Unit x) => x.UnitType == index);
		}

		public static GameObject SpawnUnit(OverseerController owner, Unit type)
		{
			//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)
			GameObject val = Object.Instantiate<GameObject>(type.Prefab, ((Component)owner).transform.position, Quaternion.identity);
			IUnitC component = val.GetComponent<IUnitC>();
			component.Initialize(owner);
			NetworkServer.Spawn(val);
			return val;
		}
	}
	public interface IUnitC
	{
		HurtBox Target { get; set; }

		Unit UnitType { get; set; }

		TargetType TargetType { get; set; }

		void OverrideTarget(HurtBox newTarget);

		void PerformMovement(int totalUnits, int thisUnit);

		void Recall();

		void PerformSecondaryAction();

		void Initialize(OverseerController owner);

		void Destruct(bool ignoreVengeance = false);

		GameObject GetSelf();
	}
	public abstract class UnitController : MonoBehaviour, IUnitC
	{
		public Unit type;

		private Vector3 freeformTargetPos;

		private float freeformUpdateStopwatch;

		public CharacterBody body;

		public OverseerController owner;

		private bool hasRequestedDestruction = false;

		private HurtBox destructionTarget;

		private bool isDoingInfernalDestruction = false;

		private float altFireStopwatch = 0f;

		protected bool isOvercharged = false;

		private float overchargeTimer = 0f;

		public abstract HurtBox Target { get; set; }

		public Unit UnitType
		{
			get
			{
				return type;
			}
			set
			{
				type = value;
			}
		}

		public virtual TargetType TargetType { get; set; } = (TargetType)0;


		public virtual float OrbitDistance { get; } = 3f;


		public virtual float FreeformDistance { get; } = 3f;


		public virtual bool OrbitalPivotIsTarget { get; } = false;


		public abstract void OverrideTarget(HurtBox newTarget);

		public abstract void PerformMovement(int totalUnits, int thisUnit);

		public abstract void PerformSecondaryAction();

		public abstract void Recall();

		public GameObject GetSelf()
		{
			return ((Component)this).gameObject;
		}

		public void Initialize(OverseerController owner)
		{
			this.owner = owner;
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		public void Overcharge()
		{
		}

		public void Destruct(bool ignoreVengenace = false)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (owner.isPassiveInfernal && !ignoreVengenace)
			{
				isDoingInfernalDestruction = true;
				destructionTarget = FindNearbyEnemy();
				if (Object.op_Implicit((Object)(object)destructionTarget))
				{
					freeformTargetPos = ((Component)destructionTarget).transform.position;
					return;
				}
			}
			EffectManager.SpawnEffect(GameObject.ExplosionDroneDeath, new EffectData
			{
				origin = ((Component)this).transform.position
			}, true);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void OrbitalMovement(int totalUnits, int thisUnit, float fullAngle, float offset)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if (!isDoingInfernalDestruction)
			{
				Vector3 val = (OrbitalPivotIsTarget ? ((Component)Target).transform.position : owner.body.corePosition) + Vector3.up + Quaternion.AngleAxis(fullAngle / (float)totalUnits * (float)thisUnit + offset, Vector3.up) * owner.body.characterDirection.forward * OrbitDistance;
				Vector3 position = Vector3.Lerp(((Component)this).transform.position, val, 20f * Time.fixedDeltaTime);
				((Component)this).transform.position = position;
			}
		}

		public void OrbitalMovement(int totalUnits, int thisUnit, float fullAngle, float offset, float dist)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (!isDoingInfernalDestruction)
			{
				Vector3 val = (OrbitalPivotIsTarget ? ((Component)Target).transform.position : owner.body.corePosition) + Vector3.up + Quaternion.AngleAxis(fullAngle / (float)totalUnits * (float)thisUnit + offset, Vector3.up) * owner.body.characterDirection.forward * dist;
				Vector3 position = Vector3.Lerp(((Component)this).transform.position, val, 20f * Time.fixedDeltaTime);
				((Component)this).transform.position = position;
			}
		}

		public void OrbitalMovement(int totalUnits, int thisUnit, float fullAngle, float offset, float dist, float vertoffset)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			if (!isDoingInfernalDestruction)
			{
				Vector3 val = (OrbitalPivotIsTarget ? ((Component)Target).transform.position : owner.body.corePosition) + Vector3.up * vertoffset + Quaternion.AngleAxis(fullAngle / (float)totalUnits * (float)thisUnit + offset, Vector3.up) * owner.body.characterDirection.forward * dist;
				Vector3 position = Vector3.Lerp(((Component)this).transform.position, val, 20f * Time.fixedDeltaTime);
				((Component)this).transform.position = position;
			}
		}

		public void FreeformMovement()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = Vector3.Lerp(((Component)this).transform.position, freeformTargetPos, 2f * Time.fixedDeltaTime);
			((Component)this).transform.position = position;
		}

		public virtual void FixedUpdate()
		{
			//IL_00d6: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			freeformUpdateStopwatch -= Time.fixedDeltaTime;
			if (isOvercharged)
			{
				overchargeTimer -= Time.fixedDeltaTime;
				if (overchargeTimer <= 0f)
				{
					isOvercharged = false;
				}
			}
			altFireStopwatch -= Time.fixedDeltaTime;
			if (altFireStopwatch <= 0f)
			{
				altFireStopwatch = Random.Range(3f, 6f);
				PerformSecondaryAction();
			}
			if (isDoingInfernalDestruction)
			{
				if (Object.op_Implicit((Object)(object)destructionTarget))
				{
					freeformTargetPos = ((Component)destructionTarget).transform.position;
				}
				FreeformMovement();
				if (Vector3.Distance(body.corePosition, freeformTargetPos) < 3f)
				{
					BlastAttack val = new BlastAttack();
					val.baseDamage = owner.body.damage * 8f;
					val.radius = 5f;
					val.crit = false;
					val.damageColorIndex = (DamageColorIndex)3;
					val.falloffModel = (FalloffModel)0;
					val.position = body.corePosition;
					val.procChainMask = default(ProcChainMask);
					val.procCoefficient = 1f;
					val.attacker = ((Component)owner).gameObject;
					val.teamIndex = (TeamIndex)1;
					val.attackerFiltering = (AttackerFiltering)2;
					val.Fire();
					EffectManager.SpawnEffect(GameObject.OmniExplosionVFX, new EffectData
					{
						origin = body.corePosition,
						scale = 5f
					}, true);
					AkSoundEngine.PostEvent(WwiseEvents.Play_wGiantJellyExplosion, ((Component)this).gameObject);
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			if (freeformUpdateStopwatch <= 0f)
			{
				freeformUpdateStopwatch = 1f;
				if (Object.op_Implicit((Object)(object)Target))
				{
					freeformTargetPos = Target.healthComponent.body.corePosition + Random.onUnitSphere * FreeformDistance;
					freeformTargetPos.y = Target.healthComponent.body.corePosition.y + Random.Range(-0.5f, 1.5f);
				}
				else
				{
					freeformTargetPos = owner.body.corePosition + Random.onUnitSphere * FreeformDistance;
					freeformTargetPos.y = owner.body.corePosition.y + Random.Range(-0.5f, 1.5f);
				}
			}
			if (Object.op_Implicit((Object)(object)body) && !body.healthComponent.alive && !hasRequestedDestruction)
			{
				hasRequestedDestruction = true;
				owner.RequestDestruction(this);
			}
		}

		public HurtBox FindNearbyEnemy()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			SphereSearch val = new SphereSearch();
			val.radius = (isDoingInfernalDestruction ? 300f : 60f);
			val.origin = ((Component)this).transform.position;
			val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
			val.RefreshCandidates();
			val.OrderCandidatesByDistance();
			val.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams((TeamIndex)1));
			val.FilterCandidatesByDistinctHurtBoxEntities();
			return val.GetHurtBoxes().FirstOrDefault();
		}
	}
	[CreateAssetMenu(fileName = "UnitSkillDef", menuName = "Overseer/UnitSkillDef")]
	public class UnitSkillDef : SkillDef
	{
		public Unit UnitType;
	}
}
namespace Overseer.Units.Support
{
	public class BeaconController : UnitController
	{
		private float stopwatch = 3f;

		private float tpStopwatch = 0f;

		private float tpDelay = 1f;

		public override HurtBox Target { get; set; }

		public override bool OrbitalPivotIsTarget => true;

		public override float OrbitDistance => 4f;

		public override float FreeformDistance => 5f;

		public override TargetType TargetType => (TargetType)1;

		public override void OverrideTarget(HurtBox newTarget)
		{
		}

		public override void PerformMovement(int totalUnits, int thisUnit)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_00ab: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			tpStopwatch += Time.fixedDeltaTime;
			if (!(tpStopwatch >= tpDelay))
			{
				return;
			}
			tpDelay = Random.Range(0.7f, 2f);
			Vector3 position = ((Component)this).transform.position;
			Vector3[] array = (from x in Utils.GetSafePositionsWithinDistance(((Component)Target).transform.position, 8f)
				where HasLOS(x)
				select x).ToArray();
			if (array.Length != 0)
			{
				tpStopwatch = 0f;
				Vector3 random = EnumeratorExtensions.GetRandom<Vector3>((IEnumerable<Vector3>)array, Run.instance.runRNG);
				random += Vector3.up * 1.5f + Random.onUnitSphere;
				if (!(Vector3.Distance(random, ((Component)this).transform.position) < 3f))
				{
					((Component)this).transform.position = random;
					EffectManager.SpawnEffect(Dash.TPTracer, new EffectData
					{
						origin = random,
						start = position,
						scale = 0.6f
					}, true);
				}
			}
		}

		public bool HasLOS(Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)Target).transform.position - pos;
			return Physics.Raycast(pos, ((Vector3)(ref val)).normalized, 2000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask));
		}

		public override void PerformSecondaryAction()
		{
		}

		public override void FixedUpdate()
		{
			//IL_0065: 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)
			base.FixedUpdate();
			if (!Object.op_Implicit((Object)(object)Target))
			{
				Target = owner.body.mainHurtBox;
			}
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= 1f && Object.op_Implicit((Object)(object)Target) && Vector3.Distance(((Component)this).transform.position, ((Component)Target).transform.position) < 10f)
			{
				stopwatch = 0f;
				Target.healthComponent.body.AddTimedBuff(BeaconSpeedBoost.BeaconSpeed, 3f);
			}
		}

		public override void Recall()
		{
			Target = owner.body.mainHurtBox;
		}
	}
}
namespace Overseer.Units.Offense
{
	public class SentinelController : UnitController
	{
		private bool isFreeform = true;

		private float stopwatch = 0f;

		public override HurtBox Target { get; set; }

		public override void OverrideTarget(HurtBox newTarget)
		{
			Target = newTarget;
		}

		public override void PerformMovement(int totalUnits, int thisUnit)
		{
			//IL_0021: 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)
			if (!Object.op_Implicit((Object)(object)Target) || !isFreeform || !(Vector3.Distance(((Component)Target).transform.position, ((Component)this).transform.position) < 5f))
			{
				if (isFreeform)
				{
					FreeformMovement();
					return;
				}
				float fullAngle = 0f;
				float offset = 270f;
				float dist = ((thisUnit >= totalUnits / 2) ? (-(thisUnit - totalUnits / 2) - 1) : (thisUnit + 1));
				OrbitalMovement(totalUnits, thisUnit, fullAngle, offset, dist);
			}
		}

		public override void PerformSecondaryAction()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			if (isFreeform || Object.op_Implicit((Object)(object)Target))
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.crit = Util.CheckRoll(owner.body.crit, 0f, (CharacterMaster)null);
				val.damage = owner.body.damage * 2f;
				val.owner = ((Component)owner).gameObject;
				val.position = ((Component)this).transform.position;
				Vector3 val2 = ((isFreeform && Object.op_Implicit((Object)(object)Target)) ? (((Component)Target).transform.position - ((Component)this).transform.position) : (owner.AimPoint - ((Component)this).transform.position));
				val.rotation = Util.QuaternionSafeLookRotation(((Vector3)(ref val2)).normalized);
				val.projectilePrefab = GameObject.MissileProjectile;
				ProjectileManager.instance.FireProjectile(val);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (Object.op_Implicit((Object)(object)Target) && !((Behaviour)Target).isActiveAndEnabled)
			{
				Target = null;
			}
			if (stopwatch >= 1f)
			{
				if (!Object.op_Implicit((Object)(object)Target))
				{
					Target = FindNearbyEnemy();
				}
				stopwatch = 0f;
				if (Object.op_Implicit((Object)(object)Target) && isFreeform)
				{
					FireLaser();
				}
				else if (!isFreeform)
				{
					FireLaserFlank();
				}
			}
			Vector3 val;
			if (Object.op_Implicit((Object)(object)Target))
			{
				Transform transform = ((Component)this).transform;
				val = ((Component)Target).transform.position - ((Component)this).transform.position;
				transform.forward = ((Vector3)(ref val)).normalized;
			}
			if (!isFreeform)
			{
				Transform transform2 = ((Component)this).transform;
				val = owner.AimPoint - ((Component)this).transform.position;
				transform2.forward = ((Vector3)(ref val)).normalized;
			}
			if (isFreeform && !Object.op_Implicit((Object)(object)Target))
			{
				Transform transform3 = ((Component)this).transform;
				val = owner.body.corePosition - ((Component)this).transform.position;
				transform3.forward = ((Vector3)(ref val)).normalized;
			}
		}

		public void FireLaser()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			BulletAttack val = new BulletAttack();
			val.origin = ((Component)this).transform.position;
			val.owner = ((Component)owner).gameObject;
			val.weapon = ((Component)this).gameObject;
			Vector3 val2 = ((Component)Target).transform.position - ((Component)this).transform.position;
			val.aimVector = ((Vector3)(ref val2)).normalized;
			val.damage = owner.body.damage * owner.UnitEffectModifier * 0.5f;
			val.isCrit = Util.CheckRoll(owner.body.crit, 0f, (CharacterMaster)null);
			val.minSpread = 0f;
			val.maxSpread = 3f;
			val.procCoefficient = 1f;
			val.damageColorIndex = (DamageColorIndex)3;
			val.tracerEffectPrefab = GameObject.TracerCaptainDefenseMatrix;
			val.Fire();
			CharacterMaster master = Target.healthComponent.body.master;
			BaseAI val3 = ((master != null) ? ((Component)master).GetComponent<BaseAI>() : null) ?? null;
			if (Object.op_Implicit((Object)(object)val3))
			{
				val3.currentEnemy.gameObject = ((Component)this).gameObject;
			}
			AkSoundEngine.PostEvent(WwiseEvents.Play_captain_drone_zap, ((Component)this).gameObject);
		}

		public void FireLaserFlank()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_0037: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			BulletAttack val = new BulletAttack();
			val.origin = ((Component)this).transform.position;
			val.owner = ((Component)owner).gameObject;
			val.weapon = ((Component)this).gameObject;
			val.aimVector = GetFlankLaserAimDir();
			val.damage = owner.body.damage * owner.UnitEffectModifier * 1f;
			val.isCrit = Util.CheckRoll(owner.body.crit, 0f, (CharacterMaster)null);
			val.minSpread = 0f;
			val.maxSpread = 0f;
			val.procCoefficient = 1f;
			val.damageColorIndex = (DamageColorIndex)3;
			val.tracerEffectPrefab = GameObject.TracerCaptainDefenseMatrix;
			val.stopperMask = ((LayerIndex)(ref LayerIndex.world)).collisionMask;
			val.Fire();
			AkSoundEngine.PostEvent(WwiseEvents.Play_captain_drone_zap, ((Component)this).gameObject);
		}

		public Vector3 GetFlankLaserAimDir()
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = owner.body.inputBank.GetAimRay();
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(aimRay, ref val, 4000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				Vector3 val2 = ((RaycastHit)(ref val)).point - ((Component)this).transform.position;
				return ((Vector3)(ref val2)).normalized;
			}
			return ((Ray)(ref aimRay)).direction;
		}

		public override void Recall()
		{
			isFreeform = !isFreeform;
		}
	}
}
namespace Overseer.Units.Defense
{
	public class MenderController : UnitController
	{
		private float stopwatch = 0f;

		private bool formationClose = true;

		public override HurtBox Target { get; set; }

		public override TargetType TargetType => (TargetType)1;

		public override void OverrideTarget(HurtBox newTarget)
		{
		}

		public override void PerformMovement(int totalUnits, int thisUnit)
		{
			if (formationClose)
			{
				OrbitalMovement(totalUnits, thisUnit, 360f, 0f, 1.5f);
			}
			else
			{
				OrbitalMovement(totalUnits, thisUnit, 20f, -10f, 3f);
			}
		}

		public override void PerformSecondaryAction()
		{
		}

		public override void Recall()
		{
			formationClose = !formationClose;
		}

		public override void FixedUpdate()
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			stopwatch += Time.fixedDeltaTime;
			if (!Object.op_Implicit((Object)(object)Target))
			{
				Target = owner.body.mainHurtBox;
			}
			if (!(stopwatch >= 1f) || !Object.op_Implicit((Object)(object)Target))
			{
				return;
			}
			stopwatch = 0f;
			List<CharacterBody> list = CharacterBody.readOnlyInstancesList.Where((CharacterBody x) => Object.op_Implicit((Object)(object)((Component)x).GetComponent<OverseerController>()) || Object.op_Implicit((Object)(object)((Component)x).GetComponent<UnitController>())).ToList();
			foreach (CharacterBody item in list)
			{
				if (Vector3.Distance(((Component)Target).transform.position, item.corePosition) < 15f)
				{
					item.healthComponent.HealFraction(0.015f * owner.UnitEffectModifier, default(ProcChainMask));
				}
			}
		}
	}
	public class WardenController : UnitController
	{
		private ProjectileController target;

		public LineRenderer lr;

		private bool isReflecting = false;

		private float stopwatch = 0f;

		public override HurtBox Target { get; set; }

		public override void OverrideTarget(HurtBox newTarget)
		{
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
		}

		public override void PerformMovement(int totalUnits, int thisUnit)
		{
			OrbitalMovement(totalUnits, thisUnit, 360f, 0f, 3.5f);
		}

		public override void PerformSecondaryAction()
		{
		}

		public override void Recall()
		{
		}
	}
}
namespace Overseer.States
{
	public class Dash : BaseState
	{
		public static GameObject TPEffect;

		public static GameObject TPTracer;

		public Vector3 blinkVector;

		public CharacterModel model;

		public HurtBoxGroup hbg;

		public float duration = 0.2f;

		public float speedCoeff = 5f;

		public Vector3 startPos;

		public override void OnEnter()
		{
			//IL_0066: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			AkSoundEngine.PostEvent(WwiseEvents.Play_huntress_shift_mini_blink, ((EntityState)this).gameObject);
			model = ((Component)((EntityState)this).GetModelTransform()).GetComponent<CharacterModel>();
			hbg = ((Component)model).GetComponent<HurtBoxGroup>();
			CharacterModel obj = model;
			obj.invisibilityCount++;
			HurtBoxGroup obj2 = hbg;
			int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter;
			obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter + 1;
			blinkVector = GetBlinkVector();
			startPos = ((EntityState)this).characterBody.corePosition;
		}

		public Vector3 GetBlinkVector()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			return (((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector;
		}

		public override void FixedUpdate()
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterMotor.velocity = Vector3.zero;
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.rootMotion += blinkVector * (base.moveSpeedStat * speedCoeff * Time.fixedDeltaTime);
			if (((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			((EntityState)this).OnExit();
			EffectManager.SpawnEffect(TPTracer, new EffectData
			{
				origin = startPos,
				start = ((EntityState)this).characterBody.corePosition
			}, true);
			CharacterModel obj = model;
			obj.invisibilityCount--;
			HurtBoxGroup obj2 = hbg;
			int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter;
			obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter - 1;
		}

		public static void CreatePrefabs()
		{
			//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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			TPEffect = RuntimePrefabManager.CreatePrefab(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Parent/ParentTeleportEffect.prefab").WaitForCompletion(), "LunarConstructTeleport");
			Transform child = TPEffect.transform.GetChild(0);
			ParticleSystemRenderer component = ((Component)child.GetChild(0)).GetComponent<ParticleSystemRenderer>();
			Texture2D val = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampLunarWispFire.png").WaitForCompletion();
			Material val2 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Parent/matParentTeleportPortal.mat").WaitForCompletion());
			val2.SetTexture("_RemapTex", (Texture)(object)val);
			((Renderer)component).sharedMaterial = val2;
			((Component)child.GetChild(1)).gameObject.SetActive(false);
			ParticleSystemRenderer component2 = ((Component)child.GetChild(3)).GetComponent<ParticleSystemRenderer>();
			((Renderer)component2).sharedMaterial = val2;
			((Component)component2).gameObject.transform.localScale = Vector3.one * 0.25f;
			MainModule main = ((Component)child.GetChild(3)).GetComponent<ParticleSystem>().main;
			((MainModule)(ref main)).duration = 0.17f;
			((Component)child.GetChild(4)).gameObject.SetActive(false);
			TPTracer = RuntimePrefabManager.CreatePrefab(GameObject.VoidSurvivorBeamTracer, "OverloadingTracer");
			((Component)TPTracer.transform.GetChild(0)).gameObject.SetActive(false);
			((Component)TPTracer.transform.GetChild(1)).gameObject.SetActive(false);
			LineRenderer component3 = TPTracer.GetComponent<LineRenderer>();
			component3.widthMultiplier = 0.33f;
			component3.numCapVertices = 10;
			Material val3 = Object.Instantiate<Material>(Material.matVoidSurvivorBeamTrail);
			val3.SetTexture("_RemapTex", (Texture)(object)Texture2D.texRampLunarWardDecal);
			((Renderer)component3).material = val3;
			AnimateShaderAlpha component4 = TPTracer.GetComponent<AnimateShaderAlpha>();
			component4.timeMax = 0.4f;
			Main.contentPack.RegisterGameObject(TPTracer);
			Main.contentPack.RegisterGameObject(TPEffect);
		}
	}
	public class Discharge : BaseSkillState
	{
		public float DamageCoefficient = 4f;

		public override void OnEnter()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0038: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			((EntityState)this).characterBody.SetAimTimer(0.1f);
			BulletAttack val = new BulletAttack();
			val.damage = ((BaseState)this).damageStat * DamageCoefficient;
			val.damageType = (DamageType)16777216;
			Ray aimRay = ((BaseState)this).GetAimRay();
			val.aimVector = ((Ray)(ref aimRay)).direction;
			val.isCrit = ((BaseState)this).RollCrit();
			val.origin = ((EntityState)this).inputBank.aimOrigin;
			val.procCoefficient = 1f;
			val.owner = ((EntityState)this).gameObject;
			val.tracerEffectPrefab = GameObject.TracerMageLightningLaser;
			val.radius = 0.3f;
			val.hitCallback = (HitCallback)delegate(BulletAttack attack, ref BulletHit hitInfo)
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: 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)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Expected O, but got Unknown
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)hitInfo.hitHurtBox))
				{
					Debug.Log((object)"we hit something");
					UnitController componentInParent = ((Component)hitInfo.hitHurtBox).GetComponentInParent<UnitController>();
					if (Object.op_Implicit((Object)(object)componentInParent))
					{
						Debug.Log((object)"we hit a unit");
						BlastAttack val2 = new BlastAttack();
						val2.attacker = ((EntityState)this).gameObject;
						val2.baseDamage = ((BaseState)this).damageStat * 4f;
						val2.radius = 10f;
						val2.crit = false;
						val2.falloffModel = (FalloffModel)0;
						val2.damageType = (DamageType)16777216;
						val2.position = ((Component)componentInParent).transform.position;
						val2.teamIndex = (TeamIndex)1;
						val2.procCoefficient = 1f;
						EffectManager.SpawnEffect(GameObject.CaptainTazerSupplyDropNova, new EffectData
						{
							origin = ((Component)componentInParent).transform.position,
							scale = 10f
						}, false);
						val2.Fire();
						componentInParent.owner.RequestDestruction(componentInParent, ignoreVengeance: true);
					}
				}
				return BulletAttack.DefaultHitCallbackImplementation(attack, ref hitInfo);
			};
			val.Fire();
			AkSoundEngine.PostEvent(WwiseEvents.Play_roboBall_death_small_explo, ((EntityState)this).gameObject);
			((EntityState)this).outer.SetNextStateToMain();
		}
	}
	public class Reconfigure : BaseState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).GetComponent<OverseerController>().ReconfigureUnits();
			AkSoundEngine.PostEvent(WwiseEvents.Play_MULT_R_variant_activate, ((EntityState)this).gameObject);
			((EntityState)this).outer.SetNextStateToMain();
		}
	}
	public class Spectral : BaseSkillState
	{
		public class MarkOnHit : MonoBehaviour, IProjectileImpactBehavior
		{
			public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Invalid comparison between Unknown and I4
				if (Object.op_Implicit((Object)(object)impactInfo.collider))
				{
					HurtBox component = ((Component)impactInfo.collider).GetComponent<HurtBox>();
					if (Object.op_Implicit((Object)(object)component) && (int)component.healthComponent.body.teamComponent.teamIndex != 1)
					{
						ProjectileController component2 = ((Component)this).GetComponent<ProjectileController>();
						OverseerController component3 = component2.owner.GetComponent<OverseerController>();
						component3.Retarget(component);
						((Component)component.healthComponent).gameObject.AddComponent<Marker>();
					}
				}
			}
		}

		public static GameObject ProjectileStandard;

		public static GameObject ProjectileLast;

		public static int TotalShots;

		public int ShotsFired = 0;

		public float FireDelay = 0.2f;

		public float DamageCoefficient => (ShotsFired > 2) ? 1.6f : 0.7f;

		public GameObject ProjectilePrefab => (ShotsFired > 2) ? ProjectileLast : ProjectileStandard;

		static Spectral()
		{
			TotalShots = 3;
			ProjectileStandard = RuntimePrefabManager.CreatePrefab(GameObject.RoboBallProjectile, "OverseerPlasmaShot");
			((ProjectileExplosion)ProjectileStandard.GetComponent<ProjectileImpactExplosion>()).blastDamageCoefficient = 1f;
			((ProjectileExplosion)ProjectileStandard.GetComponent<ProjectileImpactExplosion>()).blastRadius = 3f;
			ProjectileLast = RuntimePrefabManager.CreatePrefab(GameObject.RoboBallProjectile, "OverseerPlasmaShotEnd");
			ProjectileLast.AddComponent<MarkOnHit>();
			((ProjectileExplosion)ProjectileLast.GetComponent<ProjectileImpactExplosion>()).blastDamageCoefficient = 1f;
			((ProjectileExplosion)ProjectileLast.GetComponent<ProjectileImpactExplosion>()).blastRadius = 3f;
			Main.contentPack.RegisterGameObject(ProjectileStandard);
			Main.contentPack.RegisterGameObject(ProjectileLast);
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			FireDelay /= ((BaseState)this).attackSpeedStat;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(0.5f);
			if (((EntityState)this).fixedAge >= FireDelay)
			{
				((EntityState)this).fixedAge = 0f;
				Fire();
			}
			if (ShotsFired >= 3)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		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)2;
		}

		public void Fire()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0071: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			ShotsFired++;
			FireProjectileInfo val = default(FireProjectileInfo);
			val.damage = ((BaseState)this).damageStat * DamageCoefficient;
			val.projectilePrefab = ProjectilePrefab;
			val.owner = ((EntityState)this).gameObject;
			val.position = ((EntityState)this).inputBank.aimOrigin;
			val.crit = ((BaseState)this).RollCrit();
			val.rotation = Util.QuaternionSafeLookRotation(((EntityState)this).inputBank.aimDirection);
			val.useSpeedOverride = true;
			((FireProjectileInfo)(ref val)).speedOverride = 200f;
			ProjectileManager.instance.FireProjectile(val);
		}
	}
}
namespace Overseer.Content
{
	public class BeaconSpeedBoost : GenericBase<BeaconSpeedBoost>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_RecalculateStats <>9__1_0;

			internal void <Initialize>b__1_0(orig_RecalculateStats orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && self.HasBuff(BeaconSpeed))
				{
					float num = 1f + 0.05f * (float)self.GetBuffCount(BeaconSpeed);
					self.moveSpeed *= num;
				}
			}
		}

		public static BuffDef BeaconSpeed;

		public override void Initialize(YAUContentPack pack, ConfigFile config, string identifier)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			BeaconSpeed = Main.assets.LoadAsset<BuffDef>("bdBeaconSpeed.asset");
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && self.HasBuff(BeaconSpeed))
					{
						float num = 1f + 0.05f * (float)self.GetBuffCount(BeaconSpeed);
						self.moveSpeed *= num;
					}
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
			pack.RegisterScriptableObject((ScriptableObject)(object)BeaconSpeed);
		}
	}
	public class WardenRes : GenericBase<BeaconSpeedBoost>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TakeDamage <>9__1_0;

			internal void <Initialize>b__1_0(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
			{
				if (self.body.HasBuff(WardenResBuff))
				{
					float num = 1f - 0.02f * (float)self.body.GetBuffCount(WardenResBuff);
					info.damage *= num;
				}
				orig.Invoke(self, info);
			}
		}

		public static BuffDef WardenResBuff;

		public override void Initialize(YAUContentPack pack, ConfigFile config, string identifier)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			WardenResBuff = Main.assets.LoadAsset<BuffDef>("bdWardenRes.asset");
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
				{
					if (self.body.HasBuff(WardenResBuff))
					{
						float num = 1f - 0.02f * (float)self.body.GetBuffCount(WardenResBuff);
						info.damage *= num;
					}
					orig.Invoke(self, info);
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			pack.RegisterScriptableObject((ScriptableObject)(object)WardenResBuff);
		}
	}
}
namespace Overseer.Components
{
	public class ActionSelection : MonoBehaviour
	{
		public Image image;

		public UnitAction action;

		public TextMeshProUGUI text;

		public void Initialize()
		{
			image.sprite = action.Icon;
			((TMP_Text)text).text = action.KeyCodeText;
		}
	}
	public class ActionSelector : MonoBehaviour
	{
		public RectTransform container;

		public GameObject selectorPrefab;

		public List<UnitAction> actions;

		private ActionSelection[] actionElements;

		private int currentSelected = 0;

		internal OnFireAction onActionFired = new OnFireAction();

		public void Start()
		{
			UIElementAllocator<ActionSelection> val = new UIElementAllocator<ActionSelection>(container, selectorPrefab, true, false);
			val.AllocateElements(actions.Count);
			actionElements = val.elements.ToArray();
			for (int i = 0; i < actionElements.Length; i++)
			{
				actionElements[i].action = actions[i];
				actionElements[i].Initialize();
			}
		}

		public void UpdateBasedOnUnitChoices(Unit offense, Unit defense, Unit support)
		{
			actionElements[0].image.sprite = offense.Icon;
			actionElements[1].image.sprite = defense.Icon;
			actionElements[2].image.sprite = support.Icon;
		}

		public void FixedUpdate()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < actionElements.Length; i++)
			{
				if (Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown((KeyCode)114) || Input.GetKeyDown((KeyCode)325))
				{
					((UnityEvent<ActionType>)onActionFired).Invoke(ActionType.Cancel);
					Object.Destroy((Object)(object)this);
					break;
				}
				if (Input.GetKeyDown(actionElements[i].action.ActivationKey))
				{
					((UnityEvent<ActionType>)onActionFired).Invoke(actionElements[i].action.ActionType);
					Object.Destroy((Object)(object)this);
					break;
				}
			}
		}
	}
	public class OnFireAction : UnityEvent<ActionType>
	{
		private int guh;
	}
	public class Marker : MonoBehaviour
	{
		private float timeAlive = 0f;

		public void FixedUpdate()
		{
			timeAlive += Time.fixedDeltaTime;
			if (timeAlive >= 5f)
			{
				Object.Destroy((Object)(object)this);
			}
		}
	}
	public class OverseerController : MonoBehaviour
	{
		public CharacterBody body;

		public int unitCap;

		public GenericSkill offenseFamily;

		public GenericSkill defenseFamily;

		public GenericSkill supportFamily;

		public GenericSkill passive;

		public Unit NullUnit;

		public GameObject OverseerUIPrefab;

		public SkillDef passiveInfernal;

		public SkillDef passiveSwarmer;

		private Unit currentUnitType = null;

		private float unitStopwatch = 0f;

		internal List<IUnitC> activeUnits = new List<IUnitC>();

		private GameObject UIPrefabInstance;

		private bool hasRecalled = false;

		internal Vector3 AimPoint;

		private bool isPassiveSwarmer = false;

		internal bool isPassiveInfernal = false;

		internal float UnitEffectModifier = 1f;

		internal float UnitAssemblyModifier = 1f;

		private GameObject MainHUDInstance;

		private List<Unit> UnitTypes = new List<Unit>();

		private int index = 0;

		public void Start()
		{
			currentUnitType = NullUnit;
			UIPrefabInstance = Object.Instantiate<GameObject>(OverseerUIPrefab);
			UIPrefabInstance.GetComponent<UnitUIBar>().controller = this;
			if ((Object)(object)passive.skillDef == (Object)(object)passiveSwarmer)
			{
				isPassiveSwarmer = true;
				unitCap *= 2;
				UnitAssemblyModifier = 0.5f;
				UnitEffectModifier = 0.5f;
			}
			if ((Object)(object)passive.skillDef == (Object)(object)passiveInfernal)
			{
				isPassiveInfernal = true;
			}
		}

		public void TriggerAltFire()
		{
			foreach (IUnitC activeUnit in activeUnits)
			{
				activeUnit.PerformSecondaryAction();
			}
		}

		public float GetAssemblyPercentage()
		{
			if ((Object)(object)currentUnitType == (Object)(object)NullUnit)
			{
				return 0f;
			}
			if (activeUnits.Count >= unitCap)
			{
				return 1f;
			}
			return unitStopwatch / (currentUnitType.AssemblyTime * UnitAssemblyModifier);
		}

		public Sprite GetUnitIcon()
		{
			return currentUnitType.Icon;
		}

		public string GetUnitCountText()
		{
			return activeUnits.Count + " / " + unitCap;
		}

		public void SpawnUnit()
		{
			if (!((Object)(object)currentUnitType == (Object)(object)NullUnit) && activeUnits.Count <= unitCap)
			{
				GameObject val = UnitCatalog.SpawnUnit(this, currentUnitType);
				IUnitC component = val.GetComponent<IUnitC>();
				if (hasRecalled)
				{
					component.Recall();
				}
				CharacterBody component2 = val.GetComponent<CharacterBody>();
				component2.level = body.level;
				component2.baseDamage = body.baseDamage;
				component2.levelDamage = body.levelDamage;
				activeUnits.Add(component);
			}
		}

		public void HandleAction(ActionType type)
		{
			switch (type)
			{
			case ActionType.Recall:
				foreach (IUnitC activeUnit in activeUnits)
				{
					activeUnit.Recall();
				}
				hasRecalled = !hasRecalled;
				break;
			case ActionType.Retarget:
				break;
			case ActionType.Terminate:
			{
				List<IUnitC> list = new List<IUnitC>();
				for (int i = 0; i < activeUnits.Count; i++)
				{
					IUnitC item = activeUnits[i];
					list.Add(item);
				}
				for (int j = 0; j < list.Count; j++)
				{
					activeUnits.Remove(list[j]);
					list[j].Destruct();
				}
				break;
			}
			}
		}

		public void Retarget(HurtBox target)
		{
			foreach (IUnitC activeUnit in activeUnits)
			{
				activeUnit.OverrideTarget(target);
			}
		}

		public void RequestDestruction(IUnitC unit, bool ignoreVengeance = false)
		{
			activeUnits.Remove(unit);
			unit.Destruct();
		}

		public void ReconfigureUnits()
		{
			UnitTypes.Clear();
			UnitTypes.Add(NullUnit);
			UnitTypes.Add((offenseFamily.skillDef as UnitSkillDef).UnitType);
			UnitTypes.Add((defenseFamily.skillDef as UnitSkillDef).UnitType);
			UnitTypes.Add((supportFamily.skillDef as UnitSkillDef).UnitType);
			index++;
			if (index >= UnitTypes.Count)
			{
				index = 0;
			}
			currentUnitType = UnitTypes[index];
		}

		public float GetAssemblyTime()
		{
			return currentUnitType.AssemblyTime * UnitAssemblyModifier;
		}

		public void FixedUpdate()
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			foreach (Unit unitType in UnitCatalog.allUnits)
			{
				List<IUnitC> list = activeUnits.Where((IUnitC x) => (Object)(object)x.UnitType == (Object)(object)unitType).ToList();
				for (int i = 0; i < list.Count; i++)
				{
					list[i].PerformMovement(list.Count, i);
				}
			}
			if (activeUnits.Count < unitCap)
			{
				unitStopwatch += Time.fixedDeltaTime;
			}
			if (Object.op_Implicit((Object)(object)currentUnitType) && unitStopwatch >= GetAssemblyTime())
			{
				unitStopwatch = 0f;
				SpawnUnit();
			}
			Ray aimRay = body.inputBank.GetAimRay();
			AimPoint = ((Ray)(ref aimRay)).GetPoint(40f);
			if (!Object.op_Implicit((Object)(object)MainHUDInstance))
			{
				MainHUDInstance = GameObject.Find("HUDSimple(Clone)");
				if (Object.op_Implicit((Object)(object)MainHUDInstance))
				{
					MainHUDInstance = ((Component)MainHUDInstance.transform.Find("MainContainer").Find("MainUIArea")).gameObject;
				}
			}
			if (Object.op_Implicit((Object)(object)MainHUDInstance))
			{
				UIPrefabInstance.SetActive(MainHUDInstance.activeInHierarchy);
			}
		}
	}
	public class OverseerSpikeController : MonoBehaviour
	{
		public GenericSkill spikeStockTarget;

		public List<GameObject> Spikes = new List<GameObject>();

		public GameObject SpikePrefab;

		public Transform[] unitSpawnPoints;

		public void FixedUpdate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			if (Spikes.Count() < spikeStockTarget.stock && Spikes.Count() < 3)
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.owner = ((Component)this).gameObject;
				val.damage = ((Component)this).GetComponent<CharacterBody>().damage * 2f;
				val.position = ((Component)this).transform.position;
				val.rotation = Quaternion.identity;
				val.projectilePrefab = SpikePrefab;
				ProjectileManager.instance.FireProjectile(val);
			}
			for (int i = 0; i < Spikes.Count; i++)
			{
				if (!Spikes[i].GetComponent<Spike>().hasFired)
				{
					Vector3 position = ((Component)unitSpawnPoints[i]).transform.position;
					Vector3 position2 = Vector3.Lerp(Spikes[i].transform.position, position, 20f * Time.fixedDeltaTime);
					Spikes[i].transform.position = position2;
					Spikes[i].transform.forward = ((Component)this).GetComponent<CharacterDirection>().forward;
				}
			}
		}

		public void FireSpikes()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject spike in Spikes)
			{
				if (!spike.GetComponent<Spike>().hasFired)
				{
					spike.transform.forward = GetFlankLaserAimDir(spike.transform.position);
					spike.GetComponent<Spike>().Fire();
				}
			}
		}

		public Vector3 GetFlankLaserAimDir(Vector3 pos)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0041: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((Component)this).GetComponent<CharacterBody>().inputBank.GetAimRay();
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(aimRay, ref val, 4000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				Vector3 val2 = ((RaycastHit)(ref val)).point - pos;
				return ((Vector3)(ref val2)).normalized;
			}
			return ((Ray)(ref aimRay)).direction;
		}
	}
	public class Spike : MonoBehaviour
	{
		internal OverseerController owner;

		internal OverseerSpikeController spikeController;

		[SerializeField]
		private List<MonoBehaviour> ToEnable;

		private HealthComponent component;

		internal bool hasFired = false;

		internal bool shouldCheck = false;

		internal bool hasChecked = false;

		public void Fire()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).GetComponent<Rigidbody>().velocity = Vector3.zero;
			foreach (MonoBehaviour item in ToEnable)
			{
				((Behaviour)item).enabled = true;
			}
			hasFired = true;
		}

		public void OnHit()
		{
			shouldCheck = true;
		}

		public void Start()
		{
			component = ((Component)this).GetComponent<HealthComponent>();
			spikeController = ((Component)this).GetComponent<ProjectileController>().owner.GetComponent<OverseerSpikeController>();
			owner = ((Component)spikeController).GetComponent<OverseerController>();
			spikeController.Spikes.Add(((Component)this).gameObject);
			Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>();
			foreach (Collider val in componentsInChildren)
			{
				foreach (IUnitC activeUnit in owner.activeUnits)
				{
					Collider[] componentsInChildren2 = activeUnit.GetSelf().GetComponentsInChildren<Collider>();
					foreach (Collider val2 in componentsInChildren2)
					{
						Physics.IgnoreCollision(val, val2, true);
					}
				}
			}
		}

		public void OnDestroy()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			if (NetworkServer.active)
			{
			}
			spikeController.spikeStockTarget.DeductStock(1);
			spikeController.Spikes.Remove(((Component)this).gameObject);
			EffectManager.SpawnEffect(GameObject.ExplosionDroneDeath, new EffectData
			{
				origin = ((Component)this).transform.position
			}, false);
		}

		public void FixedUpdate()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Invalid comparison between Unknown and I4
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			if (!component.alive)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			if (!shouldCheck || hasChecked)
			{
				return;
			}
			ProjectileStickOnImpact val = ((Component)this).GetComponent<ProjectileStickOnImpact>();
			if (Object.op_Implicit((Object)(object)val.stuckBody))
			{
				Main.Log("stuckbody found");
				CharacterBody stuckBody = val.stuckBody;
				hasChecked = true;
				if (Object.op_Implicit((Object)(object)((Component)stuckBody).GetComponent<UnitController>()))
				{
					Main.Log("we hit a unit, return");
					return;
				}
				if ((int)stuckBody.teamComponent.teamIndex == 1)
				{
					Main.Log("hit a friendly, return");
					return;
				}
				Main.Log("retargeting to: " + (object)stuckBody.mainHurtBox);
				owner.Retarget(stuckBody.mainHurtBox);
				DamageInfo val2 = new DamageInfo();
				val2.damage = owner.body.damage * 3f;
				val2.crit = Util.CheckRoll(owner.body.crit, owner.body.master);
				val2.position = ((Component)this).transform.position;
				val2.procCoefficient = 1f;
				val2.attacker = ((Component)owner.body).gameObject;
				stuckBody.healthComponent.TakeDamage(val2);
				GlobalEventManager.instance.OnHitEnemy(val2, ((Component)stuckBody).gameObject);
				GlobalEventManager.instance.OnHitAll(val2, ((Component)stuckBody).gameObject);
			}
		}
	}
	public class TrackerAlly : HurtboxTracker
	{
		public override void Start()
		{
			((HurtboxTracker)this).Start();
		}

		public override void FixedUpdate()
		{
			((Tracker)this).FixedUpdate();
			if ((Object)(object)((Tracker)this).target != (Object)null && ((Component)((Component)((Tracker)this).target).GetComponent<HurtBox>().healthComponent).GetComponent<IUnitC>() != null)
			{
				((Tracker)this).target = null;
			}
		}
	}
	public class TrackerEnemy : HurtboxTracker
	{
	}
	public class UnitUIBar : MonoBehaviour
	{
		public Image RadialChargeMeter;

		public Image UnitIcon;

		public TextMeshProUGUI UnitCountText;

		internal OverseerController controller;

		public void FixedUpdate()
		{
			if (Object.op_Implicit((Object)(object)controller))
			{
				RadialChargeMeter.fillAmount = controller.GetAssemblyPercentage();
				UnitIcon.sprite = controller.GetUnitIcon();
				((TMP_Text)UnitCountText).text = controller.GetUnitCountText();
			}
		}
	}
}