Decompiled source of HiddenUnits v2.0.8

HiddenUnits.dll

Decompiled a day ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using DM;
using EzECS.Barriers;
using HarmonyLib;
using HiddenUnits.Properties;
using Landfall.TABC;
using Landfall.TABS;
using Landfall.TABS.AI;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.AI.Components.Tags;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using LevelCreator;
using Microsoft.CodeAnalysis;
using Photon.Bolt;
using RootMotion.FinalIK;
using TFBGames;
using TGCore;
using TGCore.Library;
using TGCore.Localization;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("HiddenUnits")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1123e6589a96e3f9b6811cb7fd714bcb7d97ee9a")]
[assembly: AssemblyProduct("HiddenUnits")]
[assembly: AssemblyTitle("HiddenUnits")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 HiddenUnits
{
	public class AddEffectIfTargetingSelf : MonoBehaviour
	{
		public float checkRadius;

		public bool onlyOnce;

		public UnitEffectBase effect;

		public void DoCheck()
		{
			//IL_0006: 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_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)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit[] array = Physics.SphereCastAll(((Component)this).transform.position, checkRadius, Vector3.up, 0.1f, LayerMask.GetMask(new string[1] { "MainRig" }));
			List<Unit> list = new List<Unit>();
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val = array2[i];
				if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).transform) && Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>()) && !list.Contains(((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>()))
				{
					list.Add(((Component)((RaycastHit)(ref val)).transform.root).GetComponent<Unit>());
				}
			}
			Unit[] array3 = (from Unit unit in list
				where !unit.data.Dead && Object.op_Implicit((Object)(object)unit.data.targetData.unit) && (Object)(object)unit.data.targetData.unit == (Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>()
				select unit).ToArray();
			if (array3.Length == 0)
			{
				return;
			}
			foreach (Unit item in array3.Where((Unit x) => Object.op_Implicit((Object)(object)x)))
			{
				UnitEffectBase val2 = UnitEffectBase.AddEffectToTarget(((Component)((Component)item).transform).gameObject, effect);
				if ((Object)(object)val2 == (Object)null)
				{
					GameObject obj = Object.Instantiate<GameObject>(((Component)effect).gameObject, ((Component)item).transform.root);
					obj.transform.position = ((Component)item).transform.position;
					val2 = obj.GetComponent<UnitEffectBase>();
					TeamHolder.AddTeamHolder(obj, ((Component)((Component)this).transform.root).gameObject);
					val2.DoEffect();
				}
				else if (!onlyOnce)
				{
					val2.Ping();
				}
			}
		}
	}
	public class AddStealToWeapons : MonoBehaviour
	{
		public float chance = 1f;

		public float minimumHealthToSteal = 600f;

		public UnityEvent stealEvent;

		private void Start()
		{
			List<GameObject> list = new List<GameObject>();
			HoldingHandler componentInChildren = ((Component)((Component)this).transform.root).GetComponentInChildren<HoldingHandler>();
			HoldingHandlerMulti componentInChildren2 = ((Component)((Component)this).transform.root).GetComponentInChildren<HoldingHandlerMulti>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				if (Object.op_Implicit((Object)(object)componentInChildren.rightObject))
				{
					list.Add(((Component)componentInChildren.rightObject).gameObject);
				}
				if (Object.op_Implicit((Object)(object)componentInChildren.leftObject))
				{
					list.Add(((Component)componentInChildren.leftObject).gameObject);
				}
			}
			else if (Object.op_Implicit((Object)(object)componentInChildren2))
			{
				list.AddRange(componentInChildren2.spawnedWeapons);
			}
			foreach (GameObject item in list)
			{
				MeleeWeaponSteal meleeWeaponSteal = item.AddComponent<MeleeWeaponSteal>();
				meleeWeaponSteal.chance = chance;
				meleeWeaponSteal.minimumHealthToSteal = minimumHealthToSteal;
				meleeWeaponSteal.stealEvent = stealEvent;
			}
		}
	}
	public class Afterimage : MonoBehaviour
	{
		private UnitSpawner Spawner;

		public Material imgMaterial;

		public GameObject poofEffect;

		public float fadeTime = 5f;

		public float destroyDelay = 0.2f;

		public float afterimageTargetingPriority = 0.1f;

		public bool useRootBlueprint = true;

		public bool disableAbilities = true;

		[Header("Team Color")]
		public bool useTeamColor;

		public Material imgMaterialRed;

		public Material imgMaterialBlue;

		public void Start()
		{
			Spawner = ((Component)this).GetComponent<UnitSpawner>();
			if (useRootBlueprint)
			{
				Spawner.unitBlueprint = ((Component)((Component)this).transform.root).GetComponent<Unit>().unitBlueprint;
			}
			UnitSpawner spawner = Spawner;
			spawner.spawnUnitAction = (Action<GameObject>)Delegate.Combine(spawner.spawnUnitAction, new Action<GameObject>(SpawnAfterimage));
		}

		public void SpawnAfterimage(GameObject unit)
		{
			((MonoBehaviour)this).StartCoroutine(Spawn(unit));
		}

		private IEnumerator Spawn(GameObject u)
		{
			((Object)u).name = "AFTERIMAGE";
			Unit unit = u.GetComponent<Unit>();
			((Component)unit.data).GetComponent<UnitColorHandler>().SetMaterial((!useTeamColor) ? imgMaterial : (((int)unit.Team == 0) ? imgMaterialRed : imgMaterialBlue));
			if (disableAbilities)
			{
				ConditionalEvent[] componentsInChildren = u.GetComponentsInChildren<ConditionalEvent>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Object.Destroy((Object)(object)((Component)componentsInChildren[i]).gameObject);
				}
				ProjectileDodgeMove[] componentsInChildren2 = u.GetComponentsInChildren<ProjectileDodgeMove>();
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					Object.Destroy((Object)(object)((Component)componentsInChildren2[i]).gameObject);
				}
			}
			TeamHolder.AddTeamHolder(Object.Instantiate<GameObject>(poofEffect, unit.data.mainRig.position, poofEffect.transform.rotation), unit, (TeamHolder)null);
			yield return (object)new WaitForSeconds(0.1f);
			Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.Instantiate<GameObject>(poofEffect, component.data.mainRig.position, poofEffect.transform.rotation);
			}
			unit.api.forceSupressFromWinCondition = true;
			unit.targetingPriorityMultiplier = afterimageTargetingPriority;
			unit.api.UpdateECSValues();
			TeamSystem orCreateManager = World.Active.GetOrCreateManager<TeamSystem>();
			Dictionary<Team, List<Unit>> dictionary = (Dictionary<Team, List<Unit>>)TGAddons.GetField<TeamSystem>(orCreateManager, "m_winConditionUnits");
			dictionary[unit.Team].Remove(unit);
			TGAddons.SetField<TeamSystem>(orCreateManager, "m_winConditionUnits", (object)dictionary);
			yield return (object)new WaitForSeconds(fadeTime - 0.1f);
			TeamHolder.AddTeamHolder(Object.Instantiate<GameObject>(poofEffect, unit.data.mainRig.position, poofEffect.transform.rotation), unit, (TeamHolder)null);
			yield return (object)new WaitForSeconds(destroyDelay);
			TrailRenderer[] componentsInChildren3 = u.GetComponentsInChildren<TrailRenderer>();
			foreach (TrailRenderer val in componentsInChildren3)
			{
				((Component)val).transform.SetParent((Transform)null);
				val.emitting = false;
				((Component)val).gameObject.AddComponent<RemoveAfterSeconds>().seconds = val.time * 1.5f;
			}
			unit.DestroyUnit();
		}
	}
	public class AnchorBehavior : MonoBehaviour
	{
		private Rope Rope;

		private TeamHolder Team;

		private Unit SpawnerUnit;

		private Rigidbody OwnRig;

		private CollisionStick Stick;

		private AudioSource Audio;

		private float Counter;

		public float force;

		public float closeToWeaponThreshold = 3f;

		public float projectilePosOffset = -0.2f;

		public float basePosOffset = 0.3f;

		public float timeTillDisable = 3f;

		private void Start()
		{
			Stick = ((Component)this).GetComponent<CollisionStick>();
			Team = ((Component)this).GetComponent<TeamHolder>();
			Rope = ((Component)this).GetComponentInChildren<Rope>();
			OwnRig = ((Component)this).GetComponent<Rigidbody>();
			TeamHolder team = Team;
			object spawnerUnit;
			if (team == null)
			{
				spawnerUnit = null;
			}
			else
			{
				GameObject spawner = team.spawner;
				spawnerUnit = ((spawner != null) ? spawner.GetComponent<Unit>() : null);
			}
			SpawnerUnit = (Unit)spawnerUnit;
			Audio = ((Component)this).GetComponent<AudioSource>();
			Audio.volume = 0f;
		}

		private void Update()
		{
			float num = 0f;
			if (Object.op_Implicit((Object)(object)Rope) && !Rope.done)
			{
				num = Rope.stiffnes;
			}
			Audio.volume = Mathf.Lerp(Audio.volume, num * 0.1f, Time.deltaTime * 5f);
		}

		private void LateUpdate()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = Team.spawnerWeapon.transform;
			if (!Object.op_Implicit((Object)(object)Rope))
			{
				return;
			}
			Counter += Time.deltaTime;
			if (Counter > timeTillDisable || !Object.op_Implicit((Object)(object)Team.spawnerWeapon) || !Object.op_Implicit((Object)(object)SpawnerUnit) || (Object.op_Implicit((Object)(object)SpawnerUnit) && SpawnerUnit.data.Dead))
			{
				Rope.done = true;
				return;
			}
			Rope.position1 = ((Component)this).transform.position + ((Component)this).transform.forward * projectilePosOffset;
			Rope.Position2 = transform.position + transform.forward * basePosOffset;
			Rope rope = Rope;
			rope.middleVelocity += Vector3.up * (Mathf.Clamp(((Component)this).transform.forward.y, 0f, 1f) * Time.deltaTime * 250f);
			Vector3 val = transform.position - ((Component)this).transform.position;
			Vector3 val2 = ((Vector3)(ref val)).normalized * Rope.stiffnes;
			if (Stick.hitList.Count > 0)
			{
				if (Vector3.Distance(transform.position, ((Component)this).transform.position) <= closeToWeaponThreshold)
				{
					Rope.done = true;
					return;
				}
				Rope.stiffnes = Mathf.Lerp(Rope.stiffnes, 1f, Time.deltaTime);
				OwnRig.AddForce(val2 * (Time.deltaTime * force), (ForceMode)0);
			}
		}
	}
	public class AngelBubble : MonoBehaviour
	{
		private Rigidbody[] HitRigs;

		private Unit[] HitUnits;

		private Transform EffectTransform;

		[Header("Damage Settings")]
		public float radius = 5f;

		public float force = 1000f;

		public float minMassCap = 60f;

		public float damageOverTime = 60f;

		[Header("Curve Settings")]
		public AnimationCurve influenceCurve;

		public AnimationCurve upCurve;

		private void Start()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			EffectTransform = ((Component)this).transform.GetChild(0);
			Collider[] source = Physics.OverlapSphere(EffectTransform.position, radius);
			HitRigs = (from x in source
				select x.attachedRigidbody into x
				where Object.op_Implicit((Object)(object)x)
				select x).Distinct().ToArray();
			HitUnits = (from hit in source
				select ((Component)((Component)hit).transform.root).GetComponent<Unit>() into x
				where Object.op_Implicit((Object)(object)x) && !x.data.Dead
				select x).OrderBy(delegate(Unit x)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)x.data.mainRig).transform.position - ((Component)this).transform.position;
				return ((Vector3)(ref val)).magnitude;
			}).Distinct().ToArray();
			((MonoBehaviour)this).StartCoroutine(AnimateSpell());
		}

		private IEnumerator AnimateSpell()
		{
			float time = ((Keyframe)(ref upCurve.keys[upCurve.keys.Length - 1])).time;
			float t = 0f;
			Vector3 startPos = EffectTransform.position;
			while (t < time)
			{
				t += Time.deltaTime;
				Pull();
				EffectTransform.position = startPos + Vector3.up * upCurve.Evaluate(t);
				yield return null;
			}
		}

		private void Pull()
		{
			//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_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_007d: 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_0088: 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_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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			foreach (Rigidbody item in HitRigs.Where((Rigidbody x) => Object.op_Implicit((Object)(object)x)))
			{
				Vector3 position = EffectTransform.position;
				float num = influenceCurve.Evaluate(Vector3.Distance(item.position, position));
				float num2 = Random.Range(0.5f, 1f);
				float num3 = num2 * force * num;
				Vector3 val = position + Random.insideUnitSphere * 2f - item.position;
				WilhelmPhysicsFunctions.AddForceWithMinWeight(item, num3 * ((Vector3)(ref val)).normalized, (ForceMode)0, minMassCap);
				item.AddForce(-200f * num2 * Time.deltaTime * item.velocity, (ForceMode)5);
			}
			Unit[] hitUnits = HitUnits;
			for (int num4 = 0; num4 < hitUnits.Length; num4++)
			{
				((Damagable)hitUnits[num4].data.healthHandler).TakeDamage(damageOverTime * Time.deltaTime, Vector3.up, (Unit)null, (DamageType)0);
			}
		}
	}
	public class AttachWebToMage : MonoBehaviour
	{
		public void Start()
		{
			Attach();
		}

		public void Attach()
		{
			TeamHolder[] componentsInParent = ((Component)((Component)this).transform).GetComponentsInParent<TeamHolder>();
			if (componentsInParent.Length != 0)
			{
				TeamHolder[] array = componentsInParent.Where((TeamHolder x) => (Object)(object)x.spawnerWeapon != (Object)null).ToArray();
				if (array.Length != 0)
				{
					((Component)this).transform.SetParent(array[0].spawnerWeapon.transform);
				}
			}
		}
	}
	public class BetterParry : MonoBehaviour
	{
		private ConditionalEvent ConditionalEvent;

		private ParticleSystem Part;

		private Rigidbody OwnWeapon;

		public string soundRef;

		public float parryPower = 1f;

		public float force;

		public void Start()
		{
			Part = ((Component)this).GetComponentInChildren<ParticleSystem>();
			ConditionalEvent = ((Component)this).GetComponent<ConditionalEvent>();
			if (Object.op_Implicit((Object)(object)ConditionalEvent.data.weaponHandler))
			{
				if (Object.op_Implicit((Object)(object)ConditionalEvent.data.weaponHandler.rightWeapon) && Object.op_Implicit((Object)(object)ConditionalEvent.data.weaponHandler.rightWeapon.rigidbody))
				{
					OwnWeapon = ConditionalEvent.data.weaponHandler.rightWeapon.rigidbody;
				}
				else if (Object.op_Implicit((Object)(object)ConditionalEvent.data.weaponHandler.leftWeapon) && Object.op_Implicit((Object)(object)ConditionalEvent.data.weaponHandler.leftWeapon.rigidbody))
				{
					OwnWeapon = ConditionalEvent.data.weaponHandler.leftWeapon.rigidbody;
				}
			}
		}

		public void DoParry()
		{
			((MonoBehaviour)this).StartCoroutine(ExecuteParry(ConditionalEvent.cachedEnemyWeapon));
		}

		private IEnumerator ExecuteParry(Rigidbody enemyWeapon)
		{
			if (!Object.op_Implicit((Object)(object)enemyWeapon))
			{
				yield break;
			}
			MeleeWeapon component = ((Component)enemyWeapon).GetComponent<MeleeWeapon>();
			if (Object.op_Implicit((Object)(object)component) && !(component.requiredPowerToParry > parryPower))
			{
				component.StopSwing();
				Vector3 val = ((Component)enemyWeapon).transform.position - ConditionalEvent.data.mainRig.position;
				enemyWeapon.AddForce(((Vector3)(ref val)).normalized * force, (ForceMode)2);
				Vector3 val2 = (enemyWeapon.position + ((Component)OwnWeapon).transform.position) * 0.5f;
				if (Object.op_Implicit((Object)(object)Part) && Object.op_Implicit((Object)(object)OwnWeapon))
				{
					((Component)Part).transform.position = val2;
					Part.Play();
				}
				ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(soundRef, 1f, val2, (MaterialType)3, (Transform)null, 1f);
			}
		}
	}
	public class BillyKeys : GameStateListener
	{
		private class BillyKey
		{
			public readonly GameObject key;

			public readonly string alreadyUnlocked;

			public readonly string toBeUnlocked;

			public readonly bool isUnlocking;

			public BillyKey(GameObject key, string alreadyUnlocked, string toBeUnlocked, bool isUnlocking)
			{
				this.key = key;
				this.alreadyUnlocked = alreadyUnlocked;
				this.toBeUnlocked = toBeUnlocked;
				this.isUnlocking = isUnlocking;
			}
		}

		private Transform MainCam;

		private ISaveLoaderService Save;

		private List<bool> IsUnlocking = new List<bool>();

		private RotationShake RotationShake;

		private Rigidbody SecretObject;

		private AudioSource LoopSource;

		private bool Done;

		private float UnlockValue;

		[Header("Keys")]
		public List<GameObject> keys = new List<GameObject>();

		public List<string> alreadyUnlocked = new List<string>();

		public List<string> toBeUnlocked = new List<string>();

		[Header("Final Unlock")]
		public UnityEvent unlockAllEvent = new UnityEvent();

		public float unlockDelay = 2f;

		public float unlockDistance = 4f;

		public string finalUnlock;

		public string unlockDescription;

		public Sprite unlockImage;

		public AudioClip hitClip;

		public Color glowColor;

		public override void OnEnterNewScene()
		{
			((GameStateListener)this).OnEnterNewScene();
			PlayerCamerasManager service = ServiceLocator.GetService<PlayerCamerasManager>();
			MainCam = ((service != null) ? ((Component)service.GetMainCam((Player)0)).transform : null);
			Save = ServiceLocator.GetService<ISaveLoaderService>();
			if (Object.op_Implicit((Object)(object)((Component)this).GetComponentInChildren<RotationShake>()))
			{
				RotationShake = ((Component)this).GetComponentInChildren<RotationShake>();
			}
			if (Object.op_Implicit((Object)(object)((Component)this).GetComponentInChildren<Rigidbody>()))
			{
				SecretObject = ((Component)this).GetComponentInChildren<Rigidbody>();
			}
			LoopSource = ((Component)this).GetComponent<AudioSource>();
			List<BillyKey> list = new List<BillyKey>();
			if (keys.Count > 0)
			{
				for (int i = 0; i < keys.Count; i++)
				{
					IsUnlocking.Add(item: false);
					if (Save.HasUnlockedSecret(toBeUnlocked[i]))
					{
						keys[i].SetActive(true);
						keys[i].GetComponent<Animator>().Play("BillyKey");
						list.Add(new BillyKey(keys[i], alreadyUnlocked[i], toBeUnlocked[i], IsUnlocking[i]));
					}
				}
			}
			foreach (BillyKey item in list)
			{
				keys.Remove(item.key);
				alreadyUnlocked.Remove(item.alreadyUnlocked);
				toBeUnlocked.Remove(item.toBeUnlocked);
				IsUnlocking.Remove(item.isUnlocking);
			}
			CheckUnlocks();
		}

		public override void OnEnterPlacementState()
		{
		}

		public override void OnEnterBattleState()
		{
		}

		public void Update()
		{
			//IL_001a: 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_0036: 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)
			if (Save.HasUnlockedSecret(finalUnlock))
			{
				return;
			}
			float num = Vector3.Distance(SecretObject.worldCenterOfMass, MainCam.position);
			float num2 = Vector3.Angle(MainCam.forward, SecretObject.worldCenterOfMass - MainCam.position);
			float num3 = 1000f / (num * num2);
			LoopSource.volume = Mathf.Pow(UnlockValue * 0.25f, 1.3f);
			LoopSource.pitch = 1f + 1f * UnlockValue;
			if (Done)
			{
				if (UnlockValue > 0f || num3 > 10f)
				{
					SetColor();
				}
				if (num > unlockDistance)
				{
					UnlockValue -= Time.unscaledDeltaTime * 0.2f;
				}
				else if (num3 > 8f)
				{
					UnlockValue += Time.unscaledDeltaTime * 0.2f;
					UnlockProgressFeedback();
					if (UnlockValue > 1f)
					{
						UnlockSelf();
					}
				}
				else
				{
					UnlockValue -= Time.unscaledDeltaTime * 0.2f;
				}
				return;
			}
			for (int i = 0; i < keys.Count; i++)
			{
				if (Save.HasUnlockedSecret(alreadyUnlocked[i]) && !Save.HasUnlockedSecret(toBeUnlocked[i]) && !IsUnlocking[i] && num3 > 8f)
				{
					((MonoBehaviour)this).StartCoroutine(UnlockKey(i));
				}
			}
		}

		public IEnumerator UnlockKey(int index)
		{
			IsUnlocking[index] = true;
			keys[index].SetActive(true);
			keys[index].GetComponent<Animator>().Play("BillyKey");
			yield return (object)new WaitForSeconds(unlockDelay);
			Save.UnlockSecret(toBeUnlocked[index]);
			LoopSource.Stop();
			LoopSource.volume = 1f;
			LoopSource.PlayOneShot(hitClip);
			CheckUnlocks();
		}

		public void CheckUnlocks()
		{
			if (toBeUnlocked.TrueForAll((string x) => Save.HasUnlockedSecret(toBeUnlocked[toBeUnlocked.IndexOf(x)])))
			{
				Done = true;
				LoopSource.Play();
			}
		}

		public void UnlockSelf()
		{
			if (!Save.HasUnlockedSecret(finalUnlock))
			{
				Save.UnlockSecret(finalUnlock);
				ServiceLocator.GetService<ModalPanel>().OpenUnlockPanel(unlockDescription, unlockImage);
				PlacementUI val = Object.FindObjectOfType<PlacementUI>();
				if ((Object)(object)val != (Object)null)
				{
					val.RedrawUI(finalUnlock);
				}
				LoopSource.PlayOneShot(hitClip);
				unlockAllEvent.Invoke();
				((MonoBehaviour)this).StartCoroutine(ShrinkUnlockValue());
				HUMain.CheckUnlockConditions();
			}
		}

		public IEnumerator ShrinkUnlockValue()
		{
			while (UnlockValue > 0f)
			{
				UnlockValue -= Time.unscaledDeltaTime * 0.2f;
				SetColor();
				UnlockProgressFeedback();
				LoopSource.volume = Mathf.Pow(UnlockValue * 0.25f, 1.3f);
				LoopSource.pitch = 1f + 1f * UnlockValue;
				yield return null;
			}
		}

		private void SetColor()
		{
			//IL_006b: 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: Unknown result type (might be due to invalid IL or missing references)
			UnlockValue = Mathf.Clamp(UnlockValue, 0f, float.PositiveInfinity);
			Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<ParticleSystemRenderer>()))
				{
					continue;
				}
				Material[] materials = val.materials;
				for (int j = 0; j < materials.Length; j++)
				{
					if (materials[j].HasProperty("_EmissionColor"))
					{
						materials[j].EnableKeyword("_EMISSION");
						materials[j].SetColor("_EmissionColor", glowColor * UnlockValue * 2f);
					}
				}
				val.materials = materials;
			}
		}

		private void UnlockProgressFeedback()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//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_0020: 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)
			if (Object.op_Implicit((Object)(object)RotationShake))
			{
				if (UnlockValue <= 0f)
				{
					RotationShake.AddForce(Random.onUnitSphere * 2f);
					UnlockValue = 0f;
				}
				((Behaviour)RotationShake).enabled = true;
				RotationShake.AddForce(Random.onUnitSphere * UnlockValue * Time.deltaTime * 50f);
			}
		}
	}
	public class BillyLaser : MonoBehaviour
	{
		private List<Unit> HitList = new List<Unit>();

		public float damage = 100f;

		public float knockback = 100f;

		public float massCap = 10f;

		public bool canHitMultipleTimes = true;

		private CollisionWeaponEffect[] CollisionEffects;

		public UnityEvent collisionEvent;

		public void Start()
		{
			CollisionEffects = ((Component)this).GetComponentsInChildren<CollisionWeaponEffect>();
		}

		public void OnTriggerStay(Collider col)
		{
			DoDamage(col);
		}

		public void OnTriggerEnter(Collider col)
		{
			DoDamage(col);
		}

		public void DoDamage(Collider col)
		{
			//IL_0044: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)col.attachedRigidbody) && Object.op_Implicit((Object)(object)((Component)((Component)col.attachedRigidbody).transform.root).GetComponent<Unit>()) && ((Component)((Component)col.attachedRigidbody).transform.root).GetComponent<Unit>().Team != ((Component)((Component)this).transform.root).GetComponent<Unit>().Team && !((Object)(object)((Component)col.attachedRigidbody).transform.root == (Object)(object)((Component)this).transform.root) && ((Component)col.attachedRigidbody).transform.IsChildOf(((Component)((Component)((Component)col.attachedRigidbody).transform.root).GetComponent<Unit>().data).transform) && (!Object.op_Implicit((Object)(object)((Component)((Component)col.attachedRigidbody).transform.root).GetComponent<Unit>()) || !HitList.Contains(((Component)((Component)col.attachedRigidbody).transform.root).GetComponent<Unit>())))
			{
				Unit component = ((Component)((Component)col.attachedRigidbody).transform.root).GetComponent<Unit>();
				CollisionWeaponEffect[] collisionEffects = CollisionEffects;
				for (int i = 0; i < collisionEffects.Length; i++)
				{
					collisionEffects[i].DoEffect(((Component)col).transform, new Collision());
				}
				collisionEvent.Invoke();
				((Damagable)component.data.healthHandler).TakeDamage(damage, Vector3.zero, ((Component)((Component)this).transform.root).GetComponent<Unit>(), (DamageType)1);
				float num = Mathf.Clamp(col.attachedRigidbody.drag / 3f, 0.1f, 1f);
				WilhelmPhysicsFunctions.AddAxplosionForceWithMinWeight(col.attachedRigidbody, knockback * num, ((Component)this).transform.position, 3f, (ForceMode)1, massCap);
				Rigidbody attachedRigidbody = col.attachedRigidbody;
				attachedRigidbody.velocity *= 0.9f;
				WilhelmPhysicsFunctions.AddAxplosionForceWithMinWeight(component.data.mainRig, knockback * num, ((Component)this).transform.position, 3f, (ForceMode)1, massCap);
				Rigidbody mainRig = component.data.mainRig;
				mainRig.velocity *= 0.9f;
				if (!canHitMultipleTimes)
				{
					HitList.Add(component);
				}
			}
		}

		public void ClearHits()
		{
			HitList.Clear();
		}
	}
	public class BoxingRing : MonoBehaviour
	{
		private TeamHolder TeamHolder;

		public UnityEvent foundUnitsEvent;

		public UnityEvent noUnitsEvent;

		public Transform checkPivot;

		public LayerMask checkLayer;

		public float xCheckSize;

		public float yCheckSize;

		public float zCheckSize;

		private void Start()
		{
			TeamHolder = ((Component)this).GetComponent<TeamHolder>();
		}

		private void OnTriggerEnter(Collider col)
		{
			//IL_0028: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			Unit component = ((Component)((Component)col).transform.root).GetComponent<Unit>();
			if (Object.op_Implicit((Object)(object)component))
			{
				GameObjectEntity component2 = ((Component)component).GetComponent<GameObjectEntity>();
				if (!component2.EntityManager.HasComponent(component2.Entity, ComponentType.op_Implicit(typeof(TaggedUnitTag))))
				{
					component2.EntityManager.AddComponentData<TaggedUnitTag>(component2.Entity, default(TaggedUnitTag));
				}
			}
		}

		private void OnTriggerExit(Collider col)
		{
			//IL_0028: 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_004a: 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)
			Unit component = ((Component)((Component)col).transform.root).GetComponent<Unit>();
			if (Object.op_Implicit((Object)(object)component))
			{
				GameObjectEntity component2 = ((Component)component).GetComponent<GameObjectEntity>();
				if (component2.EntityManager.HasComponent(component2.Entity, ComponentType.op_Implicit(typeof(TaggedUnitTag))))
				{
					component2.EntityManager.RemoveComponent(component2.Entity, ComponentType.op_Implicit(typeof(TaggedUnitTag)));
				}
			}
		}

		public void CheckAround()
		{
			//IL_0006: 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_0028: 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_0072: 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)
			Collider[] array = Physics.OverlapBox(checkPivot.position, new Vector3(xCheckSize, yCheckSize, zCheckSize), checkPivot.rotation, LayerMask.op_Implicit(checkLayer));
			bool flag = false;
			Collider[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				Unit component = ((Component)((Component)array2[i]).transform.root).GetComponent<Unit>();
				if (Object.op_Implicit((Object)(object)component) && (!Object.op_Implicit((Object)(object)TeamHolder) || TeamHolder.team != component.Team))
				{
					flag = true;
				}
			}
			if (flag)
			{
				foundUnitsEvent.Invoke();
			}
			else
			{
				noUnitsEvent.Invoke();
			}
		}
	}
	public class ChainUnits : ProjectileHitEffect
	{
		public class IsChained : MonoBehaviour
		{
			private float Counter;

			public float removeTime;

			public ConfigurableJoint joint;

			public GameObject effect;

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

			private void Update()
			{
				Counter += Time.deltaTime;
				if (Counter >= removeTime)
				{
					if (Object.op_Implicit((Object)(object)joint))
					{
						Object.Destroy((Object)(object)joint);
					}
					BreakChain();
				}
			}

			private void OnJointBreak(float breakForce)
			{
				BreakChain();
			}

			private void BreakChain()
			{
				if (Object.op_Implicit((Object)(object)effect))
				{
					effect.GetComponent<Effect_ShareDamage>().Finish();
				}
				foreach (GameObject item in lines.Where((GameObject line) => Object.op_Implicit((Object)(object)line)))
				{
					Object.Destroy((Object)(object)item);
				}
				Object.Destroy((Object)(object)this);
			}
		}

		private TeamHolder TeamHolder;

		private Unit OldTarget;

		private List<Effect_ShareDamage> Effects = new List<Effect_ShareDamage>();

		[Header("Chain")]
		public GameObject lineObject;

		public int chainCount = 20;

		public float chainRadius = 5f;

		public float removeChainDelay = 5f;

		public float delayPerChain = 0.1f;

		public float chainBreakForce = 10000f;

		[Header("Hit")]
		public float damage;

		public UnitEffectBase shareDamageEffect;

		public UnitEffectBase igniteEffect;

		private void Start()
		{
			TeamHolder = ((Component)this).GetComponent<TeamHolder>();
		}

		public override bool DoEffect(HitData hit)
		{
			//IL_0036: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			OldTarget = ((Component)hit.transform.root).GetComponent<Unit>();
			if (!Object.op_Implicit((Object)(object)OldTarget) || (Object.op_Implicit((Object)(object)TeamHolder) && OldTarget.Team == TeamHolder.team) || OldTarget.data.Dead)
			{
				return false;
			}
			IsChained component = ((Component)OldTarget.data.mainRig).GetComponent<IsChained>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				((Damagable)OldTarget.data.healthHandler).TakeDamage(damage, Vector3.zero, (Unit)null, (DamageType)0);
				IsChained isChained = ((Component)OldTarget.data.mainRig).gameObject.AddComponent<IsChained>();
				isChained.removeTime = removeChainDelay;
				isChained.effect = CreateEffect(((Component)OldTarget).transform, shareDamageEffect);
				((MonoBehaviour)this).StartCoroutine(DoChains());
			}
			else if (Object.op_Implicit((Object)(object)component.effect) && Object.op_Implicit((Object)(object)component.effect.GetComponent<Effect_ShareDamage>()))
			{
				Effect_ShareDamage[] connectedUnits = component.effect.GetComponent<Effect_ShareDamage>().connectedUnits;
				foreach (Effect_ShareDamage val in connectedUnits)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						CreateEffect(((Component)val.unit).transform, igniteEffect, isDamageShare: false);
					}
				}
			}
			return false;
		}

		private IEnumerator DoChains()
		{
			for (int i = 0; i < chainCount; i++)
			{
				Unit val = SetTarget(OldTarget.data.mainRig.position);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.data) && Object.op_Implicit((Object)(object)val.data.healthHandler) && Object.op_Implicit((Object)(object)OldTarget))
				{
					GameObject val2 = Object.Instantiate<GameObject>(lineObject, ((Component)OldTarget).transform, true);
					Transform obj = TransformExtensions.FindChildRecursive(val2.transform, "T1");
					Transform val3 = TransformExtensions.FindChildRecursive(val2.transform, "T2");
					obj.position = OldTarget.data.mainRig.position;
					obj.SetParent(OldTarget.data.torso);
					val3.position = val.data.mainRig.position;
					val3.SetParent(val.data.torso);
					((Damagable)val.data.healthHandler).TakeDamage(damage, Vector3.zero, (Unit)null, (DamageType)0);
					ConfigurableJoint val4 = JointActions.AttachJoint(OldTarget.data.mainRig, val.data.mainRig, 360f, 5f, false, false, 5f);
					((Joint)val4).breakForce = chainBreakForce;
					((Joint)val4).breakTorque = chainBreakForce;
					IsChained isChained = ((Component)val.data.mainRig).gameObject.AddComponent<IsChained>();
					isChained.joint = val4;
					isChained.removeTime = removeChainDelay;
					isChained.effect = CreateEffect(((Component)val).transform, shareDamageEffect);
					isChained.lines.Add(val2);
					((Component)OldTarget.data.mainRig).GetComponent<IsChained>().lines.Add(val2);
					OldTarget = val;
				}
				yield return (object)new WaitForSeconds(delayPerChain);
			}
			foreach (Effect_ShareDamage effect in Effects)
			{
				if ((Object)(object)effect != (Object)null)
				{
					effect.connectedUnits = Effects.ToArray();
					((UnitEffectBase)effect).DoEffect();
				}
			}
		}

		private Unit SetTarget(Vector3 source)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Unit[] array = (from hit in Physics.SphereCastAll(((Component)this).transform.position, chainRadius, Vector3.up, 0.1f, LayerMask.GetMask(new string[1] { "MainRig" }))
				select ((Component)((RaycastHit)(ref hit)).transform.root).GetComponent<Unit>() into x
				where Object.op_Implicit((Object)(object)x) && !x.data.Dead && (!Object.op_Implicit((Object)(object)TeamHolder) || x.Team != TeamHolder.team) && !Object.op_Implicit((Object)(object)((Component)x.data.mainRig).GetComponent<IsChained>())
				select x).OrderBy(delegate(Unit x)
			{
				//IL_0010: 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_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)x.data.mainRig).transform.position - source;
				return ((Vector3)(ref val)).magnitude;
			}).Distinct().ToArray();
			if (array.Length == 0)
			{
				return null;
			}
			return array[0];
		}

		private GameObject CreateEffect(Transform target, UnitEffectBase effectToCreate, bool isDamageShare = true)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			Type type = ((object)effectToCreate).GetType();
			UnitEffectBase val = (UnitEffectBase)((Component)target).GetComponentInChildren(type);
			if ((Object)(object)val == (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(((Component)effectToCreate).gameObject, target);
				val2.transform.position = target.position;
				if (isDamageShare)
				{
					Effects.Add(val2.GetComponent<Effect_ShareDamage>());
				}
				else
				{
					val2.GetComponent<UnitEffectBase>().DoEffect();
				}
				return val2.gameObject;
			}
			return ((Component)val).gameObject;
		}
	}
	public class ChangeEyes : MonoBehaviour
	{
		private Unit OwnUnit;

		private EyeSpawner EyeSet;

		private void Start()
		{
			OwnUnit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			EyeSet = ((Component)OwnUnit).GetComponentInChildren<EyeSpawner>();
		}

		public void DisableEyes()
		{
			EyeSpawner eyeSet = EyeSet;
			if (eyeSet != null)
			{
				eyeSet.SetEyesActive(false);
			}
		}

		public void EnableEyes()
		{
			EyeSpawner eyeSet = EyeSet;
			if (eyeSet != null)
			{
				eyeSet.SetEyesActive(true);
			}
		}
	}
	public class ChickenSticks : MonoBehaviour
	{
		public enum ClubState
		{
			Idle,
			Swinging,
			Roaming,
			Disabled
		}

		private Rigidbody Rig;

		public ClubState currentState;

		[Header("Idle")]
		public Transform hoverTarget;

		public Vector3 offset;

		public float idleDrag = 0.8f;

		public float idleForce;

		public float idleAngularForce;

		public float idleDragAmount;

		[Header("Swinging")]
		public float returnDelay = 1f;

		public float swingingDragAmount;

		[Header("Roaming")]
		public UnityEvent roamingBeginEvent = new UnityEvent();

		public UnityEvent roamingEndEvent = new UnityEvent();

		public float roamingTimer = 5f;

		public float targetingRadius = 10f;

		public float roamingForce;

		public float roamingTorque;

		public float roamingDragAmount;

		private Unit RoamingTarget;

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

		[Header("Damage")]
		public float damage = 120f;

		public float knockback = 100f;

		public float massCap = 25f;

		public float impactMultiplier = 1f;

		public float screenShakeAmount = 1f;

		public float damageCooldown = 0.01f;

		public float disableDamageDelay = 0.3f;

		public bool dealDamageOutsideOfSwing;

		private float DamageCounter;

		private bool CanDealDamage = true;

		public void Start()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			Rig = ((Component)this).GetComponent<Rigidbody>();
			offset = (Vector3)(Object.op_Implicit((Object)(object)((Component)this).GetComponentInParent<Holdable>().hl) ? new Vector3(0f - offset.x, offset.y, offset.z) : offset);
		}

		public void FixedUpdate()
		{
			//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_004a: 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_005a: 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_0077: 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_0093: 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_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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0108: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: 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_01b5: 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)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			DamageCounter += Time.deltaTime;
			Vector3 val;
			if (currentState == ClubState.Idle && Object.op_Implicit((Object)(object)hoverTarget))
			{
				Rig.AddForce((hoverTarget.TransformPoint(offset) - ((Component)this).transform.position) * idleForce, (ForceMode)5);
				Rigidbody rig = Rig;
				rig.velocity *= idleDrag;
				Rigidbody rig2 = Rig;
				rig2.angularVelocity *= idleDrag;
				Rigidbody rig3 = Rig;
				val = Vector3.Cross(((Component)this).transform.forward, hoverTarget.forward);
				rig3.AddTorque(((Vector3)(ref val)).normalized * Vector3.Angle(((Component)this).transform.forward, hoverTarget.forward) * idleAngularForce, (ForceMode)5);
				Rigidbody rig4 = Rig;
				val = Vector3.Cross(((Component)this).transform.up, Vector3.up);
				rig4.AddTorque(((Vector3)(ref val)).normalized * Vector3.Angle(((Component)this).transform.up, Vector3.up) * idleAngularForce * 0.2f, (ForceMode)5);
			}
			else if (currentState == ClubState.Roaming)
			{
				if (Object.op_Implicit((Object)(object)RoamingTarget))
				{
					Rigidbody rig5 = Rig;
					val = RoamingTarget.data.mainRig.position - ((Component)this).transform.position;
					rig5.AddForce(((Vector3)(ref val)).normalized * roamingForce * Rig.mass * Time.deltaTime);
					Rigidbody rig6 = Rig;
					val = RoamingTarget.data.mainRig.position - ((Component)this).transform.position;
					rig6.AddTorque(((Vector3)(ref val)).normalized * roamingTorque * Rig.mass * Time.deltaTime);
				}
				else
				{
					SetTarget(targetingRadius);
				}
			}
		}

		public void SetState(ClubState state)
		{
			currentState = state;
			HitList.Clear();
			if (state == ClubState.Idle)
			{
				Rig.drag = idleDragAmount;
			}
			if (state == ClubState.Swinging)
			{
				Rig.drag = swingingDragAmount;
			}
			if (state == ClubState.Roaming)
			{
				Rig.drag = roamingDragAmount;
			}
			if (state == ClubState.Disabled)
			{
				Rig.drag = 0f;
			}
		}

		public void SetStateDisabled()
		{
			SetState(ClubState.Disabled);
		}

		public void Swing()
		{
			((MonoBehaviour)this).StartCoroutine(DoSwing());
		}

		public IEnumerator DoSwing()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => currentState == ClubState.Idle));
			SetState(ClubState.Swinging);
			CanDealDamage = true;
			yield return (object)new WaitForSeconds(returnDelay);
			SetState(ClubState.Idle);
			if (!dealDamageOutsideOfSwing)
			{
				yield return (object)new WaitForSeconds(disableDamageDelay);
				CanDealDamage = false;
			}
		}

		public void Roam()
		{
			((MonoBehaviour)this).StartCoroutine(StartRoaming());
		}

		public IEnumerator StartRoaming()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => currentState == ClubState.Idle));
			SetState(ClubState.Roaming);
			SetTarget(50f);
			roamingBeginEvent.Invoke();
			yield return (object)new WaitForSeconds(roamingTimer);
			SetState(ClubState.Idle);
			roamingEndEvent.Invoke();
		}

		public void OnCollisionEnter(Collision col)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			Unit component = ((Component)col.transform.root).GetComponent<Unit>();
			if (!(DamageCounter < damageCooldown) && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)col.rigidbody) && (!Object.op_Implicit((Object)(object)component) || !HitList.Contains(component)) && (!Object.op_Implicit((Object)(object)component) || component.Team != ((Component)((Component)this).transform.root).GetComponent<Unit>().Team) && CanDealDamage)
			{
				DamageCounter = 0f;
				bool flag = col.transform.IsChildOf(((Component)component.data).transform);
				((Damagable)component.data.healthHandler).TakeDamage(damage * (flag ? 1f : 0f), Vector3.zero, (Unit)null, (DamageType)0);
				Vector3 impulse = col.impulse;
				float num = Mathf.Clamp(((Vector3)(ref impulse)).magnitude / (((Component)this).GetComponent<Rigidbody>().mass + 10f) * 0.3f * impactMultiplier, 0f, 2f);
				if (Object.op_Implicit((Object)(object)ScreenShake.Instance))
				{
					ScreenShake.Instance.AddForce(((Component)this).transform.forward * Mathf.Sqrt(num * 0.5f) * 0.5f * screenShakeAmount, ((ContactPoint)(ref col.contacts[0])).point);
				}
				WilhelmPhysicsFunctions.AddForceWithMinWeight(component.data.mainRig, Mathf.Sqrt(num * 50f) * ((Component)this).transform.forward * knockback * (flag ? 1f : 0f), (ForceMode)1, massCap);
				WilhelmPhysicsFunctions.AddForceWithMinWeight(col.rigidbody, Mathf.Sqrt(num * 50f) * ((Component)this).transform.forward * knockback, (ForceMode)1, massCap);
				CollisionWeaponEffect[] components = ((Component)this).GetComponents<CollisionWeaponEffect>();
				for (int i = 0; i < components.Length; i++)
				{
					components[i].DoEffect(col.transform, col);
				}
				if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<CollisionSound>()))
				{
					((Component)this).GetComponent<CollisionSound>().DoEffect(col.transform, col, num);
				}
				HitList.Add(component);
				if (currentState == ClubState.Roaming)
				{
					SetTarget(targetingRadius);
				}
			}
		}

		public void SetTarget(float range)
		{
			//IL_0006: 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)
			Unit[] array = (from hit in Physics.SphereCastAll(((Component)this).transform.position, range, Vector3.up, 0.1f, LayerMask.GetMask(new string[1] { "MainRig" }))
				select ((Component)((RaycastHit)(ref hit)).transform.root).GetComponent<Unit>() into x
				where Object.op_Implicit((Object)(object)x) && !x.data.Dead && x.Team != ((Component)((Component)this).transform.root).GetComponent<Unit>().Team && !HitList.Contains(x)
				select x).OrderBy(delegate(Unit x)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)x.data.mainRig).transform.position - ((Component)this).transform.position;
				return ((Vector3)(ref val)).magnitude;
			}).Distinct().ToArray();
			if (array.Length != 0)
			{
				RoamingTarget = array[Random.Range(0, array.Length - 1)];
			}
		}
	}
	public struct CircleTarget : IMovementComponent, IComponentData
	{
		public float minCircleDistance;

		public float maxCircleDistance;
	}
	[UpdateAfter(typeof(UpdateBarrier))]
	[UpdateBefore(typeof(PreLateUpdateBarrier))]
	public class CircleTargetSystem : JobComponentSystem
	{
		private struct Filter
		{
			public EntityArray Entities;

			public ComponentDataArray<Direction> Directions;

			[ReadOnly]
			public ComponentDataArray<CircleTarget> CircleTargets;

			[ReadOnly]
			public ComponentDataArray<HasTargetTag> HasTargetTags;

			[ReadOnly]
			public ComponentDataArray<CanSeeTarget> CanSeeTargets;

			[ReadOnly]
			public ComponentDataArray<PathBlocked> PathBlocked;

			[ReadOnly]
			public ComponentDataArray<TargetData> TargetDatas;

			[ReadOnly]
			public SubtractiveComponent<IsInPool> IsInPool;

			public readonly int Length;
		}

		private struct Job : IJobParallelFor
		{
			public EntityArray Entities;

			public ComponentDataArray<Direction> Directions;

			[ReadOnly]
			public ComponentDataArray<CircleTarget> CircleTargets;

			[ReadOnly]
			public ComponentDataArray<HasTargetTag> HasTargetTags;

			[ReadOnly]
			public ComponentDataArray<CanSeeTarget> CanSeeTargets;

			[ReadOnly]
			public ComponentDataArray<TargetData> TargetDatas;

			[ReadOnly]
			public ComponentDataArray<PathBlocked> PathBlocked;

			[ReadOnly]
			public SubtractiveComponent<IsInPool> IsInPool;

			public Concurrent CommandBuffer;

			public void Execute(int index)
			{
				//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_0011: 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_002a: 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_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_0059: 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_0088: 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_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: 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_00ce: 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_00d5: 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_00e0: 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_00ee: 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_00ff: 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)
				if (!(HasTargetTags[index].Target == Entity.Null))
				{
					Entity val = ((EntityArray)(ref Entities))[index];
					Direction val2 = Directions[index];
					CircleTarget circleTarget = CircleTargets[index];
					CanSeeTarget val3 = CanSeeTargets[index];
					float distanceToTarget = TargetDatas[index].DistanceToTarget;
					if (distanceToTarget <= circleTarget.maxCircleDistance && distanceToTarget >= circleTarget.minCircleDistance && val3.CanSee == 1)
					{
						float3 value = val2.Value;
						float3 val4 = new float3(value.x, 0f, value.z);
						float3 val5 = math.cross(math.normalize(val4), new float3(0f, 1f, 0f));
						float3 val6 = math.length(val4) * val5;
						val2.Value = new float3(val6.x, value.y, val6.z);
						((Concurrent)(ref CommandBuffer)).SetComponent<Direction>(index, val, val2);
					}
				}
			}
		}

		[Inject]
		private Filter m_filter;

		[Inject]
		private PreLateUpdateBarrier m_barrier;

		protected override JobHandle OnUpdate(JobHandle inputDeps)
		{
			//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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//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_0058: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ae: 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)
			Job job = new Job
			{
				Entities = m_filter.Entities,
				Directions = m_filter.Directions,
				PathBlocked = m_filter.PathBlocked,
				CircleTargets = m_filter.CircleTargets,
				TargetDatas = m_filter.TargetDatas,
				HasTargetTags = m_filter.HasTargetTags,
				CanSeeTargets = m_filter.CanSeeTargets
			};
			EntityCommandBuffer val = ((BarrierSystem)m_barrier).CreateCommandBuffer();
			job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
			return IJobParallelForExtensions.Schedule<Job>(job, m_filter.Length, 12, inputDeps);
		}
	}
	public class ClubSpell : TargetableEffect
	{
		public AnimationCurve upCurve;

		public AnimationCurve forceCurve;

		public float force;

		private float RockStartY;

		private Rigidbody Rig;

		private Vector3 Direction;

		private Vector3 StartPos;

		public float prediction = 1f;

		private Rigidbody Target;

		public void Start()
		{
			//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)
			StartPos = ((Component)this).transform.position;
		}

		private IEnumerator Go()
		{
			float t2 = ((Keyframe)(ref upCurve.keys[upCurve.keys.Length - 1])).time;
			float c2 = 0f;
			while (c2 < t2)
			{
				c2 += Time.deltaTime;
				((Component)Rig).transform.localPosition = new Vector3(0f, upCurve.Evaluate(c2) + RockStartY, 0f);
				yield return null;
			}
			Rig.isKinematic = false;
			t2 = ((Keyframe)(ref forceCurve.keys[forceCurve.keys.Length - 1])).time;
			c2 = 0f;
			GetDirection(Rig.position, Target.position, Target);
			Rig.useGravity = false;
			while (c2 < t2)
			{
				c2 += Time.deltaTime;
				Rig.velocity = Direction * (forceCurve.Evaluate(c2) * force);
				yield return null;
			}
			Rig.useGravity = true;
		}

		public override void DoEffect(Transform startPoint, Transform endPoint)
		{
		}

		public override void DoEffect(Vector3 startPoint, Vector3 endPoint, Rigidbody targetRig = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Target = targetRig;
			Rig = ((Component)this).GetComponentInChildren<Rigidbody>();
			RockStartY = ((Component)Rig).transform.localPosition.y;
			((MonoBehaviour)this).StartCoroutine(Go());
		}

		public void DoSpell()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody targetMainRig = ((Component)((Component)this).transform.root).GetComponent<Unit>().data.targetMainRig;
			((TargetableEffect)this).DoEffect(StartPos, targetMainRig.position, targetMainRig);
		}

		private void GetDirection(Vector3 startPoint, Vector3 endPoint, Rigidbody targetRig)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_0016: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_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)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = endPoint;
			val += targetRig.velocity * (prediction * 0.1f * Vector3.Distance(startPoint, val));
			Vector3 val2 = val - startPoint;
			Direction = ((Vector3)(ref val2)).normalized;
		}
	}
	public class DamageResistance : MonoBehaviour
	{
		private Unit Unit;

		public List<DamageResistPart> damageResistParts = new List<DamageResistPart>();

		public float resistPercentage = 0.5f;

		private void Start()
		{
			Unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			Unit unit = Unit;
			unit.WasDealtDamageAction = (Action<float>)Delegate.Combine(unit.WasDealtDamageAction, new Action<float>(ResistDamage));
		}

		private void Update()
		{
		}

		public void ResistDamage(float damage)
		{
			damage = Mathf.Clamp(damage, 0f, 999999f);
			DataHandler data = Unit.data;
			data.health += damage * resistPercentage;
			int num = damageResistParts.Sum((DamageResistPart damageResistPart) => damageResistPart.weight);
			int num2 = Random.Range(0, num);
			int num3 = -1;
			for (int num4 = 0; num4 < damageResistParts.Count; num4++)
			{
				if (num2 < damageResistParts[num4].weight)
				{
					num3 = num4;
					break;
				}
				num2 -= damageResistParts[num4].weight;
			}
			if (num3 >= 0)
			{
				damageResistParts[num3].TakeDamage(damage);
			}
		}
	}
	public class DamageResistPart : MonoBehaviour
	{
		private float CurrentHealth;

		private bool DidDamageEvent;

		public DamageResistance parent;

		public int weight = 1;

		public float health = 500f;

		public float damageResistToRemoveOnFall = 0.1f;

		public float thresholdToDamage = 0.5f;

		public Gradient healthGradient;

		public int materialIndex;

		public UnityEvent fallOffEvent;

		public UnityEvent damageEvent;

		private Renderer VisualRenderer;

		private void Start()
		{
			CurrentHealth = health;
			VisualRenderer = (Renderer)(object)((Component)this).GetComponentInChildren<MeshRenderer>();
		}

		public void TakeDamage(float damage)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			CurrentHealth -= damage;
			VisualRenderer.materials[materialIndex].color = healthGradient.Evaluate(CurrentHealth / health);
			if (CurrentHealth <= 0f)
			{
				RemovePart();
			}
			else if (CurrentHealth / health <= thresholdToDamage && !DidDamageEvent)
			{
				damageEvent.Invoke();
				DidDamageEvent = true;
			}
		}

		public void RemovePart()
		{
			parent.resistPercentage = Mathf.Clamp(parent.resistPercentage - damageResistToRemoveOnFall, 0f, 1f);
			parent.damageResistParts.Remove(this);
			fallOffEvent.Invoke();
		}

		public void SetRenderer(Renderer newRenderer)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			VisualRenderer = newRenderer;
			VisualRenderer.materials[materialIndex].color = healthGradient.Evaluate(CurrentHealth / health);
		}
	}
	public class DodgeMovePhoenix : Move, IRemotelyControllable
	{
		[HideInInspector]
		public Transform targetObject;

		public float animationSpeed = 1f;

		public float animationSpeedWhenPositiveCurve = 1f;

		public float forceMultiplier = 1f;

		public bool divideForceByMass;

		public bool cancelSelf;

		public bool usedAsMovement;

		public bool randomForceMultiplier;

		public float minRange;

		public float maxRange;

		public CombatMoveDataInstance[] moves;

		[SerializeField]
		[Tooltip("See the comments in code.")]
		protected bool allowForMartian;

		private float RandomSeed;

		private DataHandler Data;

		private RigidbodyHolder AllRigs;

		private CameraAbilityPossess Possess;

		public bool IsRemotelyControlled { get; private set; }

		private void Start()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
			AllRigs = ((Component)Data).GetComponent<RigidbodyHolder>();
			for (int i = 0; i < moves.Length; i++)
			{
				if ((int)moves[i].forceDirection == 15)
				{
					Possess = ((Component)MainCam.instance).GetComponentInParent<CameraAbilityPossess>();
				}
			}
			if (randomForceMultiplier)
			{
				RandomSeed = Random.Range(-1, 1);
				forceMultiplier = Random.Range(forceMultiplier * 0.7f, forceMultiplier);
				if (RandomSeed < 0f)
				{
					forceMultiplier = 0f - forceMultiplier;
				}
			}
		}

		public void DoMove(Transform targetObj)
		{
			targetObject = targetObj;
			DoMove();
		}

		public void DoMove()
		{
			if (!Object.op_Implicit((Object)(object)Data))
			{
				Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
				AllRigs = ((Component)Data).GetComponent<RigidbodyHolder>();
			}
			((Move)this).DoMove((Rigidbody)null, Data.targetMainRig, Data.targetData);
		}

		public override void DoMove(Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
		{
			if (cancelSelf)
			{
				((MonoBehaviour)this).StopAllCoroutines();
			}
			for (int i = 0; i < moves.Length; i++)
			{
				CombatMoveDataInstance move = moves[i];
				if (IsAllowedToDoMoveInMultiplayer(move))
				{
					((MonoBehaviour)this).StartCoroutine(DoMoveSequence(move, enemyWeapon, enemyTorso, targetData));
				}
			}
		}

		private IEnumerator DoMoveSequence(CombatMoveDataInstance move, Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
		{
			float t = ((Keyframe)(ref move.forceCurve.keys[move.forceCurve.keys.Length - 1])).time;
			float c = 0f;
			if (move.useAlternateForceProjectMarsClient && BoltNetwork.IsClient)
			{
				move.force = move.alternateClientForce;
			}
			move.randomMultiplier = move.randomCurve.Evaluate(Random.value);
			List<Rigidbody> rigs = new List<Rigidbody>();
			if ((int)move.rigidbodyToMove == 0)
			{
				rigs.Add(((Component)Data.head).GetComponent<Rigidbody>());
			}
			else if ((int)move.rigidbodyToMove == 1)
			{
				if (Object.op_Implicit((Object)(object)Data.torso))
				{
					rigs.Add(((Component)Data.torso).GetComponent<Rigidbody>());
				}
			}
			else if ((int)move.rigidbodyToMove == 2)
			{
				if (Object.op_Implicit((Object)(object)Data.hip))
				{
					rigs.Add(((Component)Data.hip).GetComponent<Rigidbody>());
				}
			}
			else if ((int)move.rigidbodyToMove == 3)
			{
				if (Object.op_Implicit((Object)(object)Data.footLeft))
				{
					rigs.Add(((Component)Data.footLeft).GetComponent<Rigidbody>());
				}
			}
			else if ((int)move.rigidbodyToMove == 4)
			{
				if (Object.op_Implicit((Object)(object)Data.footRight))
				{
					rigs.Add(((Component)Data.footRight).GetComponent<Rigidbody>());
				}
			}
			else if ((int)move.rigidbodyToMove == 7)
			{
				if (Object.op_Implicit((Object)(object)Data.rightHand))
				{
					rigs.Add(((Component)Data.rightHand).GetComponent<Rigidbody>());
				}
			}
			else if ((int)move.rigidbodyToMove == 6)
			{
				if (Object.op_Implicit((Object)(object)Data.leftHand))
				{
					rigs.Add(((Component)Data.leftHand).GetComponent<Rigidbody>());
				}
			}
			else if ((int)move.rigidbodyToMove == 5)
			{
				rigs.AddRange(AllRigs.AllRigs);
			}
			else if ((int)move.rigidbodyToMove == 8)
			{
				WeaponHandler weaponHandler = Data.weaponHandler;
				if (Object.op_Implicit((Object)(object)weaponHandler))
				{
					if (Object.op_Implicit((Object)(object)weaponHandler.rightWeapon) && Object.op_Implicit((Object)(object)weaponHandler.rightWeapon.rigidbody))
					{
						rigs.Add(weaponHandler.rightWeapon.rigidbody);
					}
					else if (Object.op_Implicit((Object)(object)weaponHandler.leftWeapon) && Object.op_Implicit((Object)(object)weaponHandler.leftWeapon.rigidbody))
					{
						rigs.Add(weaponHandler.leftWeapon.rigidbody);
					}
				}
			}
			else if ((int)move.rigidbodyToMove == 9)
			{
				rigs.Add(((Component)this).GetComponent<Rigidbody>());
			}
			else if ((int)move.rigidbodyToMove == 10 && Object.op_Implicit((Object)(object)move.specificRig))
			{
				rigs.Add(move.specificRig);
			}
			if (move.includeWeapons)
			{
				WeaponHandler weaponHandler2 = Data.weaponHandler;
				if (Object.op_Implicit((Object)(object)weaponHandler2))
				{
					if (Object.op_Implicit((Object)(object)weaponHandler2.leftWeapon) && Object.op_Implicit((Object)(object)weaponHandler2.leftWeapon.rigidbody))
					{
						rigs.Add(weaponHandler2.leftWeapon.rigidbody);
					}
					if (Object.op_Implicit((Object)(object)weaponHandler2.rightWeapon) && Object.op_Implicit((Object)(object)weaponHandler2.rightWeapon.rigidbody))
					{
						rigs.Add(weaponHandler2.rightWeapon.rigidbody);
					}
				}
			}
			Vector3 forceDirection = Vector3.zero;
			if (rigs.Count >= 1)
			{
				forceDirection = GetDirection(move, enemyWeapon, enemyTorso, rigs[0], targetData);
				for (int num = rigs.Count - 1; num >= 0; num--)
				{
					if ((Object)(object)rigs[num] == (Object)null)
					{
						rigs.RemoveAt(num);
					}
				}
			}
			float massM = 1f;
			if (divideForceByMass)
			{
				float num2 = 0f;
				for (int i = 0; i < rigs.Count; i++)
				{
					num2 += rigs[i].mass / (float)rigs.Count;
				}
				massM = 1f / num2;
			}
			while (c < t)
			{
				if (CheckConditions())
				{
					for (int j = 0; j < rigs.Count; j++)
					{
						if (move.setDirectionContiniouiouss)
						{
							forceDirection = GetDirection(move, enemyWeapon, enemyTorso, rigs[0], targetData);
						}
						if (!usedAsMovement || !Object.op_Implicit((Object)(object)Data) || !Object.op_Implicit((Object)(object)((Component)Data).GetComponent<AnimationHandler>()) || ((Component)Data).GetComponent<AnimationHandler>().currentState != 0)
						{
							if (move.force != 0f && Object.op_Implicit((Object)(object)rigs[j]))
							{
								rigs[j].AddForce(forceDirection * massM * move.randomMultiplier * forceMultiplier * move.force * move.forceCurve.Evaluate(c), (ForceMode)5);
							}
							if (move.torque != 0f && Object.op_Implicit((Object)(object)rigs[j]))
							{
								rigs[j].AddTorque(forceDirection * massM * forceMultiplier * move.torque * move.forceCurve.Evaluate(c), (ForceMode)5);
							}
						}
					}
				}
				float num3 = 1f;
				num3 *= animationSpeed;
				if (move.forceCurve.Evaluate(c) > 0f)
				{
					num3 *= animationSpeedWhenPositiveCurve;
				}
				c += Time.fixedDeltaTime * num3;
				yield return (object)new WaitForFixedUpdate();
			}
		}

		private bool CheckConditions()
		{
			bool result = true;
			if (maxRange != 0f && Object.op_Implicit((Object)(object)Data) && Data.distanceToTarget > maxRange)
			{
				result = false;
			}
			if (minRange != 0f && Object.op_Implicit((Object)(object)Data) && Data.distanceToTarget < minRange)
			{
				result = false;
			}
			return result;
		}

		private Vector3 GetDirection(CombatMoveDataInstance move, Rigidbody enemyWeapon, Rigidbody enemyTorso, Rigidbody ownRig, DataHandler targetData)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected I4, but got Unknown
			//IL_002a: 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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06db: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: 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_0193: 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)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Invalid comparison between Unknown and I4
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_066c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Unknown result type (might be due to invalid IL or missing references)
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_070c: 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_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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_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_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0756: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)enemyTorso))
			{
				enemyTorso = Data.targetData.mainRig;
			}
			Vector3 val = Vector3.zero;
			if ((Object)(object)ownRig == (Object)null)
			{
				return val;
			}
			ForceDirection forceDirection = move.forceDirection;
			Vector3 val2;
			switch ((int)forceDirection)
			{
			case 0:
				val = Vector3.up;
				break;
			case 1:
				if (Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)enemyTorso))
				{
					val = enemyTorso.position - ownRig.position;
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					break;
				}
				goto default;
			case 10:
				if (Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)targetData) && Object.op_Implicit((Object)(object)targetData.head))
				{
					val = targetData.head.position + ((Component)targetData.head).transform.forward * 0.1f + ((Component)targetData.head).transform.up * 0.15f - ownRig.position;
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					break;
				}
				goto default;
			case 2:
				if (Object.op_Implicit((Object)(object)enemyWeapon))
				{
					val = ownRig.position - (enemyWeapon.worldCenterOfMass + enemyWeapon.velocity * move.predictionAmount);
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					if (move.ignoreY)
					{
						((Vector3)(ref val))..ctor(val.x, 0f, val.y);
					}
					if (Data.cantFallForSeconds < 0.5f)
					{
						Data.cantFallForSeconds = 0.5f;
					}
				}
				else if (Object.op_Implicit((Object)(object)enemyTorso))
				{
					val = -(enemyTorso.position - ownRig.position);
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
				}
				break;
			case 3:
				val = Data.characterForwardObject.forward;
				break;
			case 4:
				val = Data.characterForwardObject.right;
				break;
			case 5:
				if (Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)enemyTorso))
				{
					val = Vector3.Cross(Vector3.up, ownRig.position - enemyTorso.position);
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					break;
				}
				goto default;
			case 6:
				if (Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)Data.targetMainRig))
				{
					val = Vector3.Cross(Vector3.up, ownRig.position - Data.targetMainRig.position);
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					break;
				}
				goto default;
			case 14:
				if (Object.op_Implicit((Object)(object)ownRig))
				{
					val = ((Component)ownRig).transform.up;
					break;
				}
				goto default;
			case 15:
				if (Object.op_Implicit((Object)(object)enemyTorso) && Object.op_Implicit((Object)(object)ownRig))
				{
					Vector3 val3;
					if (Object.op_Implicit((Object)(object)Possess) && Object.op_Implicit((Object)(object)Possess.currentUnit) && Object.op_Implicit((Object)(object)Data) && Object.op_Implicit((Object)(object)Data.unit) && (Object)(object)Possess.currentUnit == (Object)(object)Data.unit)
					{
						val2 = Vector3.Cross(((Component)MainCam.instance).transform.forward, ((Component)ownRig).transform.forward);
						val3 = -((Vector3)(ref val2)).normalized * Vector3.Angle(((Component)MainCam.instance).transform.forward, ((Component)ownRig).transform.forward);
					}
					else
					{
						val2 = Vector3.Cross(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
						val3 = -((Vector3)(ref val2)).normalized * Vector3.Angle(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
					}
					val = val3;
					break;
				}
				goto default;
			case 7:
				if (Object.op_Implicit((Object)(object)enemyTorso) && Object.op_Implicit((Object)(object)ownRig))
				{
					val2 = Vector3.Cross(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
					val = -((Vector3)(ref val2)).normalized * Vector3.Angle(enemyTorso.position - ownRig.position, ((Component)ownRig).transform.forward);
					break;
				}
				goto default;
			case 11:
				if (Object.op_Implicit((Object)(object)targetData) && Object.op_Implicit((Object)(object)targetData.head) && Object.op_Implicit((Object)(object)ownRig))
				{
					val2 = Vector3.Cross(targetData.head.position + ((Component)targetData.head).transform.forward * 0.1f + ((Component)targetData.head).transform.up * 0.15f - ownRig.position, ((Component)ownRig).transform.forward);
					val = -((Vector3)(ref val2)).normalized * Vector3.Angle(targetData.head.position + ((Component)targetData.head).transform.forward * 0.1f + ((Component)targetData.head).transform.up * 0.15f - ownRig.position, ((Component)ownRig).transform.forward);
					break;
				}
				goto default;
			case 8:
				if (Object.op_Implicit((Object)(object)targetObject) && Object.op_Implicit((Object)(object)ownRig))
				{
					val = ((Component)ownRig).transform.position - ((Component)targetObject).transform.position;
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					break;
				}
				goto default;
			case 9:
				if (Object.op_Implicit((Object)(object)targetObject) && Object.op_Implicit((Object)(object)ownRig))
				{
					val = Vector3.Cross(Vector3.up, ownRig.position - targetObject.position);
					if (move.normalize)
					{
						val = ((Vector3)(ref val)).normalized;
					}
					break;
				}
				goto default;
			case 12:
				val = Data.groundedMovementDirectionObject.forward;
				break;
			case 13:
				val2 = Vector3.Cross(((Component)ownRig).transform.forward, Data.groundedMovementDirectionObject.forward);
				val = ((Vector3)(ref val2)).normalized * Vector3.Angle(((Component)ownRig).transform.forward, Data.groundedMovementDirectionObject.forward);
				break;
			default:
				if (move.randomizeDirection && Random.value > 0.5f)
				{
					val *= -1f;
				}
				else if ((int)move.forceDirection == 16 && Object.op_Implicit((Object)(object)ownRig) && Object.op_Implicit((Object)(object)enemyTorso))
				{
					((Vector3)(ref val))..ctor(enemyTorso.position.x - ownRig.position.x, 0f, enemyTorso.position.z - ownRig.position.z);
				}
				break;
			}
			return val;
		}

		public void SetIsRemotelyControlled(bool isRemotelyControlled)
		{
			IsRemotelyControlled = isRemotelyControlled;
		}

		private bool IsAllowedToDoMoveInMultiplayer(CombatMoveDataInstance move)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			if (!allowForMartian && IsRemotelyControlled)
			{
				return (int)move.rigidbodyToMove == 8;
			}
			return true;
		}
	}
	public class DreadSwords : MonoBehaviour
	{
		public delegate void AttackedEventHandler(Rigidbody target, int useAttackID);

		public UnityEvent shootEvent;

		private ShootPosition[] SwordPoints;

		private List<SpookySword> Swords = new List<SpookySword>();

		public GameObject sourceSword;

		public float throwRange = 10f;

		public float followSpeed = 1f;

		public float throwSpeed = 100f;

		public AnimationCurve throwCurve;

		private float Counter;

		private DataHandler Data;

		private bool Done;

		public float attackRate;

		private float AttackspeedMulti = 1f;

		private int AttackID;

		public event AttackedEventHandler Attacked;

		private void Awake()
		{
			SwordPoints = ((Component)this).GetComponentsInChildren<ShootPosition>();
		}

		private void Start()
		{
			//IL_002e: 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)
			//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_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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			Data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
			List<Renderer> list = new List<Renderer>();
			for (int i = 0; i < SwordPoints.Length; i++)
			{
				SpookySword val = CreateNewSword(((Component)SwordPoints[i]).transform.position + Vector3.up * 2f, quaternion.op_Implicit(((Component)SwordPoints[i]).transform.rotation));
				Renderer[] componentsInChildren = val.gameObject.GetComponentsInChildren<Renderer>();
				if (componentsInChildren != null && componentsInChildren.Length != 0)
				{
					list.AddRange(componentsInChildren);
				}
				Swords.Add(val);
			}
			if ((Object)(object)Data != (Object)null && (Object)(object)Data.unit != (Object)null)
			{
				Data.unit.AddRenderersToShowHide(list.ToArray(), Data.unit.IsSpawnedInBlindPlacement);
			}
			for (int j = 0; j < Swords.Count; j++)
			{
				if (!((Object)(object)Swords[j].gameObject == (Object)null))
				{
					Swords[j].gameObject.transform.position = ((Component)SwordPoints[j]).transform.position;
					Swords[j].gameObject.transform.rotation = ((Component)SwordPoints[j]).transform.rotation;
				}
			}
		}

		private void Update()
		{
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (