Decompiled source of dgoslings Samus Mod v2.2.3

SamusMod.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using EntityStates;
using MonoMod.RuntimeDetour.HookGen;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.ScriptableObjects;
using R2API.Utils;
using Rewired;
using Rewired.Data;
using Rewired.Data.Mapping;
using RoR2;
using RoR2.ContentManagement;
using RoR2.PostProcessing;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using SamusMod.Misc;
using SamusMod.Modules;
using SamusMod.SkillStates.BaseStates;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using VRAPI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace SamusMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.dgosling.Samus", "Samus", "2.2.3")]
	public class SamusPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.dgosling.Samus";

		public const string MODNAME = "Samus";

		public const string MODVERSION = "2.2.3";

		public const string developerPrefix = "DG";

		public static bool debug;

		public static bool cancel;

		public static float jumps;

		public static SamusPlugin instance;

		public static ManualLogSource logger
		{
			get
			{
				SamusPlugin samusPlugin = instance;
				if (samusPlugin == null)
				{
					return null;
				}
				return ((BaseUnityPlugin)samusPlugin).Logger;
			}
		}

		private void Awake()
		{
			instance = this;
			Config.ReadConfig();
			Assets.Init();
			if (!cancel)
			{
				Shaders.init();
				Tokens.Init();
				Prefabs.Init();
				Buffs.Init();
				Unlockables.Init();
				ExtraInputs.AddActionsToInputCatalog();
				HookEndpointManager.Add((MethodBase)typeof(UserData).GetMethod("wVZZKoPFwEvodLvLcYNvVAPKpUj", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)new Action<Action<UserData>, UserData>(ExtraInputs.AddCustomActions));
				if (debug)
				{
					Helpers.AwakeDebug();
				}
				ContentPackProvider.Initialize();
				Hook();
			}
		}

		private void Start()
		{
			if (debug)
			{
				Helpers.StartDebug();
			}
		}

		private void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			CharacterBody.FixedUpdate += new hook_FixedUpdate(CharacterBody_FixedUpdate);
			DamageTrail.DoDamage += new hook_DoDamage(DamageTrail_DoDamage);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			DotController.InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 += new hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1(DotController_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
			CharacterMotor.FixedUpdate += new hook_FixedUpdate(CharacterMotor_FixedUpdate);
			CharacterMotor.OnLanded += new hook_OnLanded(CharacterMotor_OnLanded);
			CharacterMaster.OnBodyDamaged += new hook_OnBodyDamaged(CharacterMaster_OnBodyDamaged);
			UserProfile.LoadDefaultProfile += new hook_LoadDefaultProfile(ExtraInputs.OnLoadDefaultProfile);
			SaveSystem.LoadUserProfiles += new hook_LoadUserProfiles(ExtraInputs.OnLoadUserProfiles);
			SettingsPanelController.Start += new hook_Start(SettingsPanelControllerStart);
			if (EmoteAPICompatibility.enabled)
			{
				SurvivorCatalog.Init += new hook_Init(EmoteAPICompatibility.SurvivorCatalog_Init);
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.inventory) && Object.op_Implicit((Object)(object)self.skillLocator) && self.baseNameToken == "DG_SAMUS_NAME")
			{
				SkillLocator skillLocator = self.skillLocator;
				if (Object.op_Implicit((Object)(object)skillLocator.secondary) && !BaseSamus.morphBall)
				{
					int num = skillLocator.secondary.bonusStockFromBody - self.inventory.GetItemCount(Items.SecondarySkillMagazine);
					int itemCount = self.inventory.GetItemCount(Items.SecondarySkillMagazine);
					skillLocator.secondary.SetBonusStockFromBody(itemCount * 5 + num);
				}
			}
		}

		private void GenericSkill_SetBonusStockFromBody(orig_SetBonusStockFromBody orig, GenericSkill self, int newBonusStockFromBody)
		{
			if (!Object.op_Implicit((Object)(object)self))
			{
				return;
			}
			if ((Object)(object)self.characterBody.skillLocator.secondary == (Object)(object)self && self.characterBody.baseNameToken == "DG_SAMUS_NAME")
			{
				if (!BaseSamus.morphBall)
				{
					newBonusStockFromBody *= 5;
					orig.Invoke(self, newBonusStockFromBody);
				}
				else if (BaseSamus.morphBall)
				{
					newBonusStockFromBody = Mathf.FloorToInt((float)(self.characterBody.skillLocator.primary.maxStock / 3)) - 1;
					orig.Invoke(self, newBonusStockFromBody);
				}
			}
			else
			{
				orig.Invoke(self, newBonusStockFromBody);
			}
		}

		private void DotController_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1(orig_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 orig, GameObject victimObject, GameObject attackerObject, DotIndex dotIndex, float duration, float damageMultiplier, uint? maxStacksFromAttacker)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if ((victimObject.gameObject.GetComponent<CharacterBody>().baseNameToken == "DG_SAMUS_NAME" || attackerObject.gameObject.GetComponent<CharacterBody>().baseNameToken == "DG_SAMUS_NAME") && (int)dotIndex == 3)
			{
				duration = 0f;
				damageMultiplier = 0f;
			}
			orig.Invoke(victimObject, attackerObject, dotIndex, duration, damageMultiplier, maxStacksFromAttacker);
		}

		private void CustomBind()
		{
		}

		internal static void SettingsPanelControllerStart(orig_Start orig, SettingsPanelController self)
		{
			orig.Invoke(self);
			if (((Object)self).name == "SettingsSubPanel, Controls (M&KB)" || ((Object)self).name == "SettingsSubPanel, Controls (Gamepad)")
			{
				Transform buttonToCopy = ((Component)self).transform.Find("Scroll View/Viewport/VerticalLayout/SettingsEntryButton, Binding (Jump)");
				uiHooks.AddActionBindingToSettings(RewiredAction.autoFire.Name, buttonToCopy);
			}
		}

		private void CharacterMaster_OnBodyDamaged(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport damageReport)
		{
			if (Object.op_Implicit((Object)(object)self))
			{
				if (self.GetBody().baseNameToken == "DG_SAMUS_NAME")
				{
					Util.PlaySound("Hurt", self.GetBodyObject());
				}
				orig.Invoke(self, damageReport);
			}
		}

		private void CharacterMotor_OnLanded(orig_OnLanded orig, CharacterMotor self)
		{
			if (Object.op_Implicit((Object)(object)self))
			{
				if (self.body.baseNameToken == "DG_SAMUS_NAME" && jumps > 0f)
				{
					jumps = 0f;
				}
				orig.Invoke(self);
			}
		}

		private void CharacterMotor_FixedUpdate(orig_FixedUpdate orig, CharacterMotor self)
		{
			if (!Object.op_Implicit((Object)(object)self))
			{
				return;
			}
			if (self.body.baseNameToken == "DG_SAMUS_NAME")
			{
				if (self.jumpCount == 1 && jumps == 0f)
				{
					jumps = 1f;
					Util.PlaySound("Jump", ((Component)self).gameObject);
				}
				else if (self.jumpCount >= 2 && jumps + 1f == (float)self.jumpCount)
				{
					jumps += 1f;
					Util.PlaySound("DJump", ((Component)self).gameObject);
				}
			}
			orig.Invoke(self);
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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)
			if ((Object)(object)self != (Object)null && (Object)(object)damageInfo.inflictor != (Object)null && (Object)(object)self.body != (Object)null && self.body.baseNameToken == "DG_SAMUS_NAME" && (((Object)damageInfo.inflictor).name == "bombExplosion(Clone)" || ((Object)damageInfo.inflictor).name == "SamusMorphBomb(Clone)"))
			{
				damageInfo.damage = 0f;
				if (self.body.characterMotor.isGrounded || self.body.characterMotor.velocity.y > -10f)
				{
					damageInfo.force = new Vector3(0f, 1200f, 0f);
				}
				else
				{
					damageInfo.force = new Vector3(0f, 3000f, 0f);
				}
			}
			orig.Invoke(self, damageInfo);
		}

		private void DamageTrail_DoDamage(orig_DoDamage orig, DamageTrail self)
		{
			if (Object.op_Implicit((Object)(object)self) && ((Object)self.segmentPrefab).name == "FireTrailSegment")
			{
				self.damagePerSecond = 0f;
				AkSoundEngine.StopPlayingID(3193947170u);
			}
			orig.Invoke(self);
		}

		private void CharacterBody_FixedUpdate(orig_FixedUpdate orig, CharacterBody self)
		{
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.skillLocator.secondary) && Object.op_Implicit((Object)(object)self.skillLocator.special) && self.baseNameToken == "DG_SAMUS_NAME" && !BaseSamus.morphBall)
			{
				if (self.skillLocator.secondary.stock >= 5)
				{
					self.skillLocator.special.stock = 1;
				}
				else
				{
					self.skillLocator.special.RemoveAllStocks();
				}
			}
			orig.Invoke(self);
		}
	}
}
namespace SamusMod.SkillStates.Samus
{
	public class AutoFireBeam : BaseSkillState
	{
		private GameObject projectilePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerNoSmoke");

		[SerializeField]
		public GameObject muzzleFlashPrefab;

		[SerializeField]
		public GameObject hitEffectPrefab;

		[SerializeField]
		public float baseDuration;

		private float duration;

		private float force = 5f;

		private string muzzleName = "gunCon";

		private Ray aimRay;

		private float timer;

		public override void OnEnter()
		{
			//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)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			aimRay = ((BaseState)this).GetAimRay();
		}

		private void Fire()
		{
			//IL_001e: 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)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0114: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					aimRay = MotionControls.dominantHand.aimRay;
					EntityState.PlayAnimationOnAnimator(MotionControls.dominantHand.animator, "Base Layer", "shoot", "Shoot.playbackRate", 0.1f);
				}
				else
				{
					((EntityState)this).PlayAnimation("Gesture, Override", "Beam", "Charge.playbackRate", 0.05f);
				}
				if (Object.op_Implicit((Object)(object)muzzleFlashPrefab))
				{
					EffectManager.SimpleMuzzleFlash(muzzleFlashPrefab, ((EntityState)this).gameObject, muzzleName, false);
				}
				float num = 0.1f * force;
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					Util.PlayAttackSpeedSound("beam", ((Component)MotionControls.dominantHand.muzzle).gameObject, ((BaseState)this).attackSpeedStat);
				}
				else
				{
					Util.PlayAttackSpeedSound("beam", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
				}
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					maxSpread = 0f,
					damage = ((BaseState)this).damageStat * Config.pBeamMult,
					force = num,
					tracerEffectPrefab = projectilePrefab,
					muzzleName = muzzleName,
					hitEffectPrefab = hitEffectPrefab,
					isCrit = ((BaseState)this).RollCrit(),
					radius = 0.1f,
					smartCollision = true
				}.Fire();
			}
		}

		public override void FixedUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			aimRay = ((BaseState)this).GetAimRay();
			timer += Time.fixedDeltaTime;
			if (timer >= duration)
			{
				timer = 0f;
				Fire();
			}
			if (((EntityState)this).isAuthority && !((BaseSkillState)this).IsKeyDownAuthority())
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class ChargeBeam : ChargeBeamBase
	{
		private GameObject chargeEffect;

		private Vector3 originalScale;

		public Vector3 newSize;

		public override void OnEnter()
		{
			//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)
			crosshairOverridePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/ToolbotGrenadeLauncherCrosshair");
			maxBloomRadius = 0.1f;
			minBloomRadius = 1f;
			originalScale = chargeEffectPrefab.transform.localScale;
			base.OnEnter();
			ChildLocator modelChildLocator = ((EntityState)this).GetModelChildLocator();
			if (Object.op_Implicit((Object)(object)modelChildLocator))
			{
				chargeEffect = ((Component)modelChildLocator.FindChild("chargeEffect")).gameObject;
				chargeEffect.SetActive(false);
			}
		}

		public override void FixedUpdate()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			if (!chargeEffect.activeSelf && calcCharge() > 0.15f)
			{
				chargeEffect.SetActive(true);
			}
			if (!Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				newSize = new Vector3(calcCharge() * 10f, calcCharge() * 10f, calcCharge() * 10f);
			}
			else
			{
				newSize = new Vector3(calcCharge() / 2f, calcCharge() / 2f, calcCharge() / 2f);
			}
			base.chargeEffectInstance.transform.localScale = newSize;
		}

		public override void OnExit()
		{
			base.OnExit();
			if (Object.op_Implicit((Object)(object)chargeEffect))
			{
				chargeEffect.SetActive(false);
			}
		}

		public override BaseFireBeam GetNextBase()
		{
			return new FireBeam();
		}
	}
	public class ExitMorphBall : BaseSkillState
	{
		private static float baseDuration = 0.42f;

		private float duration;

		private ChildLocator childLocator;

		private GameObject ball;

		[SerializeField]
		public SkillDef bomb;

		[SerializeField]
		public SkillDef exitMorph;

		private static float recharge;

		private static int pstock;

		public static float BaseDuration
		{
			get
			{
				return baseDuration;
			}
			set
			{
				baseDuration = value;
			}
		}

		public static float Recharge
		{
			get
			{
				return recharge;
			}
			set
			{
				recharge = value;
			}
		}

		public static int Pstock
		{
			get
			{
				return pstock;
			}
			set
			{
				pstock = value;
			}
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = BaseDuration / ((BaseState)this).attackSpeedStat;
			childLocator = ((EntityState)this).GetModelChildLocator();
			ball = ((Component)childLocator.FindChild("Ball2")).gameObject;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.ArmorBoost);
			}
			Collider component = ball.GetComponent<Collider>();
			ball.GetComponent<Rigidbody>();
			component.enabled = false;
			((Component)childLocator.FindChild("Ball2")).gameObject.SetActive(false);
			((Component)childLocator.FindChild("Body")).gameObject.SetActive(true);
			((EntityState)this).PlayAnimation("Body", "transformOut", "Roll.playbackRate", duration);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge < duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnExit();
			((EntityState)this).characterBody.baseMoveSpeed = morphBallEnter.NormalSpeed;
			((EntityState)this).characterBody.baseJumpCount = morphBallEnter.NormalJumps;
			((EntityState)this).characterBody.sprintingSpeedMultiplier = morphBallEnter.NormalSprint;
			((EntityState)this).characterBody.RecalculateStats();
			((EntityState)this).skillLocator.primary.UnsetSkillOverride((object)((EntityState)this).skillLocator.primary, bomb, (SkillOverridePriority)4);
			((EntityState)this).skillLocator.utility.UnsetSkillOverride((object)((EntityState)this).skillLocator.utility, exitMorph, (SkillOverridePriority)4);
			((EntityState)this).skillLocator.secondary = BaseSamus.MissileSkill;
			if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				SkinnedMeshRenderer[] dsMR = morphBallEnter.DsMR;
				for (int i = 0; i < dsMR.Length; i++)
				{
					((Renderer)dsMR[i]).enabled = true;
				}
				dsMR = morphBallEnter.NDsMR;
				for (int i = 0; i < dsMR.Length; i++)
				{
					((Renderer)dsMR[i]).enabled = true;
				}
				morphBallEnter.VRCamera.localPosition = morphBallEnter.CameraPOS;
			}
			BaseSamus.morphBall = false;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)4;
		}
	}
	public class FireBeam : BaseFireBeam
	{
		public Vector3 sizes;

		public override void OnEnter()
		{
			baseDuration = 0.05f;
			force = 5f;
			maxDamageCoefficient = StaticValues.cshootDamageCoefficient;
			minDamageCoefficient = StaticValues.shootDamageCoefficient;
			selfForce = 0f;
			speed = 200f;
			ResizeProjectile();
			tracerPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerNoSmoke");
			muzzleName = "gunCon";
			if (charge <= 0.4f)
			{
				projSound = "cShoot25";
			}
			else if (charge <= 0.7f)
			{
				projSound = "cShoot50";
			}
			else if (charge <= 0.9f)
			{
				projSound = "cShoot75";
			}
			else
			{
				projSound = "cShoot100";
			}
			tracerSound = "beam";
			base.OnEnter();
		}

		public override void OnExit()
		{
			//IL_000b: 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)
			projectilePrefab.transform.localScale = Vector3.one;
			projectilePrefab.GetComponent<ProjectileController>().ghostPrefab.transform.localScale = Vector3.one;
			projectilePrefab.GetComponent<SphereCollider>().radius = 0.6f;
			base.OnExit();
		}
	}
	public class Missile : BaseMissile
	{
		public override void OnEnter()
		{
			baseDuration = 0.1f;
			damageCoef = StaticValues.missileDamageCoefficient;
			recoil = 0.5f;
			smissleObject = null;
			Sound = "Missile";
			sMissile = false;
			base.OnEnter();
		}
	}
	public class MorphBallBomb : BaseSkillState
	{
		public float baseDuration = 0.1f;

		public string bombSound;

		[SerializeField]
		public GameObject projectilePrefab;

		private bool hasFired;

		private ChildLocator childLocator;

		public float damageCoef = 3f * Config.pBombMult;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			bombSound = "morphBomb";
			childLocator = ((EntityState)this).GetModelChildLocator();
			hasFired = false;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!hasFired)
			{
				Fire();
			}
			if (!(((EntityState)this).fixedAge < baseDuration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Fire()
		{
			//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_0057: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				if ((Object)(object)projectilePrefab != (Object)null)
				{
					FireProjectileInfo val = default(FireProjectileInfo);
					val.projectilePrefab = projectilePrefab;
					val.owner = ((EntityState)this).gameObject;
					val.position = ((EntityState)this).GetModelChildLocator().FindChild("Ball2").position;
					val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val.damage = damageCoef * ((BaseState)this).damageStat;
					val.force = 0f;
					val.crit = ((BaseState)this).RollCrit();
					FireProjectileInfo val2 = val;
					ProjectileManager.instance.FireProjectile(val2);
					hasFired = true;
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)4;
		}
	}
	public class MorphBallPBomb : BaseSkillState
	{
		public float baseDuration = 0.5f;

		public string bombSound;

		[SerializeField]
		public GameObject projectilePrefab;

		private bool hasFired;

		private ChildLocator childLocator;

		public float damageCoef = 10f * Config.pPowerBombMult;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			bombSound = "Powerbomb";
			childLocator = ((EntityState)this).GetModelChildLocator();
			hasFired = false;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!hasFired)
			{
				Fire();
			}
			if (!(((EntityState)this).fixedAge < baseDuration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Fire()
		{
			//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_0057: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				if ((Object)(object)projectilePrefab != (Object)null)
				{
					FireProjectileInfo val = default(FireProjectileInfo);
					val.projectilePrefab = projectilePrefab;
					val.owner = ((EntityState)this).gameObject;
					val.position = ((EntityState)this).GetModelChildLocator().FindChild("Ball2").position;
					val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val.damage = damageCoef * ((BaseState)this).damageStat;
					val.force = 0f;
					val.crit = ((BaseState)this).RollCrit();
					FireProjectileInfo val2 = val;
					ProjectileManager.instance.FireProjectile(val2);
					hasFired = true;
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).skillLocator.primary.RemoveAllStocks();
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)4;
		}
	}
	public class Roll : BaseState
	{
		public float duration;

		private float initialSpeedCoefficient;

		private float finalSpeedCoefficient;

		public string dodgeSoundString;

		public string bombSoundString;

		[SerializeField]
		public GameObject projectilePrefab;

		public float damageCoefficient;

		public float dodgeFOV;

		private float rollSpeed;

		private Vector3 forwardDirection;

		private Animator animator;

		private Vector3 previousPosition;

		private bool hasFired;

		public SkinnedMeshRenderer[] DmeshRenderers;

		public SkinnedMeshRenderer[] NDmeshRenderers;

		private bool vrCheck;

		public override void OnEnter()
		{
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: 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)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_011a: 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_011f: 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_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 0.8f;
			dodgeFOV = 110f;
			bombSoundString = "Bomb";
			dodgeSoundString = "Roll";
			if (VR.enabled)
			{
				DmeshRenderers = ((Component)MotionControls.dominantHand.transform).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
				NDmeshRenderers = ((Component)MotionControls.nonDominantHand.transform).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			}
			damageCoefficient = StaticValues.dashDamageCoefficient;
			initialSpeedCoefficient = StaticValues.rollSpeedCoefficientIni;
			finalSpeedCoefficient = StaticValues.rollSpeedCoefficientFin;
			if (dodgeSoundString != null)
			{
				Util.PlaySound(dodgeSoundString, ((EntityState)this).gameObject);
			}
			animator = ((EntityState)this).GetModelAnimator();
			((Component)animator).GetComponent<ChildLocator>();
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && !Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
				forwardDirection = ((Vector3)(ref val)).normalized;
			}
			else if (((EntityState)this).isAuthority && Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				forwardDirection = ((Component)Camera.main).transform.forward;
				vrCheck = true;
				SkinnedMeshRenderer[] dmeshRenderers = DmeshRenderers;
				for (int i = 0; i < dmeshRenderers.Length; i++)
				{
					((Renderer)dmeshRenderers[i]).enabled = false;
				}
				dmeshRenderers = NDmeshRenderers;
				for (int i = 0; i < dmeshRenderers.Length; i++)
				{
					((Renderer)dmeshRenderers[i]).enabled = false;
				}
			}
			Vector3 val2 = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : forwardDirection);
			Vector3 val3 = Vector3.Cross(Vector3.up, val2);
			float num = Vector3.Dot(forwardDirection, val2);
			float num2 = Vector3.Dot(forwardDirection, val3);
			animator.SetFloat("forwardSpeed", num, 0.1f, Time.fixedDeltaTime);
			animator.SetFloat("rightSpeed", num2, 0.1f, Time.fixedDeltaTime);
			if (Mathf.Abs(num) > Mathf.Abs(num2))
			{
				((EntityState)this).PlayAnimation("Body", (num > 0f) ? "Roll" : "Roll", "Roll.playbackRate", duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("Body", (num2 > 0f) ? "Roll" : "Roll", "Roll.playbackRate", duration);
			}
			RecalculateRollSpeed();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterMotor.velocity.y = 0f;
				((EntityState)this).characterMotor.velocity = forwardDirection * rollSpeed;
			}
			previousPosition = ((EntityState)this).transform.position - (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
		}

		private void RecalculateRollSpeed()
		{
			rollSpeed = base.moveSpeedStat * Mathf.Lerp(initialSpeedCoefficient, finalSpeedCoefficient, ((EntityState)this).fixedAge / duration);
		}

		public override void FixedUpdate()
		{
			//IL_0069: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//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_0119: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			RecalculateRollSpeed();
			if (((EntityState)this).fixedAge >= duration / 2f && !hasFired)
			{
				Fire();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.fovOverride = Mathf.Lerp(dodgeFOV, 60f, ((EntityState)this).fixedAge / duration);
			}
			Vector3 val = ((EntityState)this).transform.position - previousPosition;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && normalized != Vector3.zero)
			{
				Vector3 val2 = normalized * rollSpeed;
				float y = val2.y;
				val2.y = 0f;
				Vector3 velocity = forwardDirection * Mathf.Max(Vector3.Dot(val2, forwardDirection), 0f);
				velocity.y += Mathf.Max(y, 0f);
				((EntityState)this).characterMotor.velocity = velocity;
			}
			previousPosition = ((EntityState)this).transform.position;
			if (!(((EntityState)this).fixedAge < duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Fire()
		{
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0061: 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_0094: 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)
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			if ((Object)(object)projectilePrefab != (Object)null)
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = projectilePrefab;
				val.owner = ((EntityState)this).gameObject;
				val.position = ((Ray)(ref aimRay)).origin;
				val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
				val.damage = damageCoefficient * base.damageStat;
				val.force = 0f;
				val.crit = ((BaseState)this).RollCrit();
				FireProjectileInfo val2 = val;
				if (bombSoundString != null)
				{
					Util.PlaySound(bombSoundString, ((EntityState)this).gameObject);
				}
				ProjectileManager.instance.FireProjectile(val2);
				hasFired = true;
			}
		}

		public override void OnExit()
		{
			((Component)animator).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.fovOverride = -1f;
			}
			if (hasFired)
			{
				hasFired = false;
			}
			if (Utils.IsUsingMotionControls(((EntityState)this).characterBody) && vrCheck)
			{
				SkinnedMeshRenderer[] dmeshRenderers = DmeshRenderers;
				for (int i = 0; i < dmeshRenderers.Length; i++)
				{
					((Renderer)dmeshRenderers[i]).enabled = true;
				}
				dmeshRenderers = NDmeshRenderers;
				for (int i = 0; i < dmeshRenderers.Length; i++)
				{
					((Renderer)dmeshRenderers[i]).enabled = true;
				}
			}
			((EntityState)this).OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			writer.Write(forwardDirection);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			forwardDirection = reader.ReadVector3();
		}
	}
	public class SMissile : BaseMissile
	{
		public override void OnEnter()
		{
			damageCoef = StaticValues.smissileDamageCoefficient;
			baseDuration = 0.1f;
			recoil = 0.5f;
			Sound = "SMissile";
			sMissile = true;
			base.OnEnter();
		}

		public override void OnExit()
		{
			((EntityState)this).skillLocator.secondary.DeductStock(5);
			((EntityState)this).skillLocator.secondary.RecalculateMaxStock();
			base.OnExit();
		}
	}
	public class morphBallEnter : BaseSkillState
	{
		private ChildLocator ChildLocator;

		public float speedMult = 1.2f;

		public float baseDuration = 0.42f;

		private float duration;

		private GameObject ball;

		private GameObject armature;

		private GameObject mesh;

		private GameObject bone;

		private static float normalSpeed;

		private Transform tran;

		private float velx;

		private float vely;

		private float velz;

		private static int normalJumps;

		private static float normalSprint;

		[SerializeField]
		public SkillDef bomb;

		[SerializeField]
		public SkillDef powerBomb;

		[SerializeField]
		public SkillDef exitMorph;

		private static SkinnedMeshRenderer[] nDsMR;

		private static Vector3 cameraPOS;

		private static Transform vRCamera;

		private static Animator vR;

		private static SkinnedMeshRenderer[] dsMR;

		public static int NormalJumps
		{
			get
			{
				return normalJumps;
			}
			set
			{
				normalJumps = value;
			}
		}

		public static float NormalSprint
		{
			get
			{
				return normalSprint;
			}
			set
			{
				normalSprint = value;
			}
		}

		public static SkinnedMeshRenderer[] DsMR
		{
			get
			{
				return dsMR;
			}
			set
			{
				dsMR = value;
			}
		}

		public static SkinnedMeshRenderer[] NDsMR
		{
			get
			{
				return nDsMR;
			}
			set
			{
				nDsMR = value;
			}
		}

		public static Vector3 CameraPOS
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return cameraPOS;
			}
			set
			{
				//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)
				cameraPOS = value;
			}
		}

		public static Transform VRCamera
		{
			get
			{
				return vRCamera;
			}
			set
			{
				vRCamera = value;
			}
		}

		public static Animator VR
		{
			get
			{
				return vR;
			}
			set
			{
				vR = value;
			}
		}

		public static float NormalSpeed
		{
			get
			{
				return normalSpeed;
			}
			set
			{
				normalSpeed = value;
			}
		}

		public override void OnEnter()
		{
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).skillLocator.primary.SetSkillOverride((object)((EntityState)this).skillLocator.primary, bomb, (SkillOverridePriority)4);
			((EntityState)this).skillLocator.utility.SetSkillOverride((object)((EntityState)this).skillLocator.utility, exitMorph, (SkillOverridePriority)4);
			((EntityState)this).skillLocator.secondary = BaseSamus.PowerBallskill;
			ChildLocator = ((EntityState)this).GetModelChildLocator();
			ball = ((Component)ChildLocator.FindChild("Ball2")).gameObject;
			armature = ((Component)ChildLocator.FindChild("armature")).gameObject;
			mesh = ((Component)ChildLocator.FindChild("Body")).gameObject;
			bone = ((Component)ChildLocator.FindChild("Ball2Bone")).gameObject;
			if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				VR = MotionControls.dominantHand.animator;
				VRCamera = ((EntityState)this).characterBody.transform.Find("VRCamera");
				DsMR = ((Component)MotionControls.dominantHand.transform).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
				NDsMR = ((Component)MotionControls.nonDominantHand.transform).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
				VRStuff.SamusHUD.inMorphBall = true;
				SkinnedMeshRenderer[] array = DsMR;
				for (int i = 0; i < array.Length; i++)
				{
					((Renderer)array[i]).enabled = false;
				}
				array = NDsMR;
				for (int i = 0; i < array.Length; i++)
				{
					((Renderer)array[i]).enabled = false;
				}
				CameraPOS = VRCamera.localPosition;
				VRCamera.Translate(0f, -0.5f, 0f);
			}
			((EntityState)this).PlayAnimation("Body", "transformIn", "Roll.playbackRate", duration);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge < duration) && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			ball.GetComponent<Rigidbody>().constraints = (RigidbodyConstraints)94;
			ball.GetComponent<Rigidbody>().detectCollisions = false;
			NormalSpeed = ((EntityState)this).characterBody.baseMoveSpeed;
			((EntityState)this).characterBody.baseMoveSpeed = NormalSpeed * 2f;
			NormalJumps = ((EntityState)this).characterBody.baseJumpCount;
			((EntityState)this).characterBody.baseJumpCount = 0;
			NormalSprint = ((EntityState)this).characterBody.sprintingSpeedMultiplier;
			((EntityState)this).characterBody.sprintingSpeedMultiplier = 1.2f;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.ArmorBoost);
			}
			ball.SetActive(true);
			mesh.SetActive(false);
			BaseSamus.morphBall = true;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)4;
		}
	}
	public class trackingMissile : BaseMissile
	{
		protected SamusTracker SamusTracker;

		public override void OnEnter()
		{
			SamusTracker = ((EntityState)this).gameObject.GetComponent<SamusTracker>();
			target = SamusTracker.GetTrackingTarget();
			baseDuration = 0.1f;
			damageCoef = StaticValues.missileDamageCoefficient;
			recoil = 0.5f;
			smissleObject = null;
			Sound = "Missile";
			sMissile = false;
			base.OnEnter();
		}
	}
}
namespace SamusMod.SkillStates.BaseStates
{
	public class BaseFireBeam : BaseSkillState
	{
		[SerializeField]
		public GameObject projectilePrefab;

		[SerializeField]
		public GameObject muzzleflashEffectPrefab;

		public float baseDuration;

		public float minDamageCoefficient;

		public float maxDamageCoefficient;

		public float force;

		public string muzzleName;

		public GameObject tracerPrefab;

		[SerializeField]
		public GameObject bulletHitEffect;

		private float duration;

		public float selfForce;

		public float charge;

		public float speed;

		private GameObject guncon;

		public Vector3 size;

		public string tracerSound;

		public string projSound;

		public Vector3 csize;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Transform val = ((EntityState)this).GetModelChildLocator().FindChild("gunCon");
			guncon = ((Component)val).gameObject;
			if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				Animator animator = MotionControls.dominantHand.animator;
				if (charge <= 0.15f)
				{
					EntityState.PlayAnimationOnAnimator(animator, "Base Layer", "shoot", "Shoot.playbackRate", duration * 2f);
				}
				else if (charge > 0.15f)
				{
					EntityState.PlayAnimationOnAnimator(animator, "Base Layer", "chargeShoot", "Charge.playbackRate", ((BaseState)this).attackSpeedStat * 0.4585f);
				}
			}
			else if (charge == 1f)
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "chargeMaxShoot", "Charge.playbackRate", duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "Beam", "Charge.playbackRate", duration);
			}
			if (Object.op_Implicit((Object)(object)muzzleflashEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, "gunCon", false);
			}
			Fire();
		}

		public virtual void ResizeProjectile()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			projectilePrefab.transform.localScale = projectilePrefab.transform.localScale * charge + new Vector3(0.1f, 0.1f, 0.1f);
			ProjectileController component = projectilePrefab.GetComponent<ProjectileController>();
			component.ghostPrefab.transform.localScale = component.ghostPrefab.transform.localScale * charge;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		private void Fire()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: 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_025a: 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_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0190: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (charge <= 0.15f)
			{
				SphereCollider[] componentsInChildren = projectilePrefab.GetComponentsInChildren<SphereCollider>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					_ = componentsInChildren[i].radius;
				}
				charge = 0.1f;
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				aimRay = MotionControls.dominantHand.aimRay;
			}
			_ = (Object)(object)projectilePrefab != (Object)null;
			if ((Object)(object)projectilePrefab != (Object)null && charge > 0.15f)
			{
				float num = Util.Remap(charge, 0f, 1f, minDamageCoefficient, maxDamageCoefficient);
				float num2 = charge * force;
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					Util.PlaySound(projSound, ((Component)MotionControls.dominantHand.muzzle).gameObject);
				}
				else
				{
					Util.PlaySound(projSound, ((EntityState)this).gameObject);
				}
				projectilePrefab.GetComponent<colision_test>().inTransform = guncon.transform;
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = projectilePrefab;
				val.position = ((Ray)(ref aimRay)).origin;
				val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
				val.owner = ((EntityState)this).gameObject;
				val.damage = ((BaseState)this).damageStat * num;
				val.force = num2;
				val.crit = ((BaseState)this).RollCrit();
				((FireProjectileInfo)(ref val)).speedOverride = speed;
				FireProjectileInfo val2 = val;
				ProjectileManager.instance.FireProjectile(val2);
			}
			else if (((EntityState)this).isAuthority)
			{
				Util.Remap(0.1f, 0.1f, 1f, minDamageCoefficient, maxDamageCoefficient);
				float num3 = charge * force;
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					Util.PlaySound(projSound, ((Component)MotionControls.dominantHand.muzzle).gameObject);
				}
				else
				{
					Util.PlaySound(tracerSound, ((EntityState)this).gameObject);
				}
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					maxSpread = 0f,
					damage = ((BaseState)this).damageStat * Config.pBeamMult,
					force = num3,
					tracerEffectPrefab = tracerPrefab,
					muzzleName = muzzleName,
					hitEffectPrefab = bulletHitEffect,
					isCrit = ((BaseState)this).RollCrit(),
					radius = 0.1f,
					smartCollision = true
				}.Fire();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class BaseMissile : BaseSkillState
	{
		public float damageCoef;

		public float baseDuration;

		public float recoil;

		[SerializeField]
		public GameObject projectilePrefab;

		[SerializeField]
		public GameObject muzzleEffectPrefab;

		[SerializeField]
		public GameObject smissleObject;

		public GameObject sMissileExtraMissiles;

		protected static int secStock;

		public bool sMissile;

		public string Sound;

		private float duration;

		private float fireDuration;

		private bool hasFired;

		private Animator animator;

		private string muzzleString;

		private Transform muzzleTransform;

		public HurtBox target;

		private Ray gunRay;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			sMissileExtraMissiles = (((Object)(object)smissleObject != (Object)null) ? smissleObject : null);
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireDuration = 0.5f * duration;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			muzzleString = "gunCon";
			((EntityState)this).PlayAnimation("Gesture, Override", "Missile", "Missile.playbackRate", duration);
			secStock = ((EntityState)this).skillLocator.secondary.stock;
			muzzleTransform = ((EntityState)this).GetModelChildLocator().FindChild(muzzleString);
		}

		public override void OnExit()
		{
			if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				VRStuff.SamusHUD.setMissileActive(active: true);
			}
			((EntityState)this).OnExit();
		}

		private void fireMissile()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_00ef: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired)
			{
				hasFired = true;
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					Util.PlaySound(Sound, ((Component)MotionControls.dominantHand.muzzle).gameObject);
				}
				else
				{
					Util.PlaySound(Sound, ((EntityState)this).gameObject);
				}
				((EntityState)this).characterBody.AddSpreadBloom(0.75f);
				Ray aimRay = ((BaseState)this).GetAimRay();
				gunRay = new Ray(muzzleTransform.position, ((Ray)(ref aimRay)).direction);
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					aimRay = MotionControls.dominantHand.aimRay;
				}
				if ((Object)(object)muzzleEffectPrefab != (Object)null)
				{
					EffectManager.SimpleMuzzleFlash(muzzleEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				}
				if (((EntityState)this).isAuthority && (Object)(object)target != (Object)null)
				{
					MissileUtils.FireMissile(((Ray)(ref gunRay)).origin, ((EntityState)this).characterBody, default(ProcChainMask), ((Component)target).gameObject, damageCoef * ((BaseState)this).damageStat, ((BaseState)this).RollCrit(), projectilePrefab, (DamageColorIndex)0, ((Ray)(ref gunRay)).direction + Random.insideUnitSphere * 0.1f, 100f, true);
				}
				else if (((EntityState)this).isAuthority && (Object)(object)target == (Object)null && !sMissile)
				{
					MissileUtils.FireMissile(((Ray)(ref gunRay)).origin, ((EntityState)this).characterBody, default(ProcChainMask), (GameObject)null, damageCoef * ((BaseState)this).damageStat, ((BaseState)this).RollCrit(), projectilePrefab, (DamageColorIndex)0, ((Ray)(ref gunRay)).direction + Random.insideUnitSphere * 0.25f, 100f, true);
				}
				else if (((EntityState)this).isAuthority && (Object)(object)target == (Object)null && sMissile)
				{
					SuperMissileICBMLaunch(((Ray)(ref gunRay)).origin, ((EntityState)this).characterBody, default(ProcChainMask), null, damageCoef * ((BaseState)this).damageStat, ((BaseState)this).RollCrit(), projectilePrefab, (DamageColorIndex)0);
				}
			}
		}

		private void SuperMissileICBMLaunch(Vector3 position, CharacterBody attacker, ProcChainMask procChainMask, GameObject victim, float missileDamage, bool isCrit, GameObject projectilePrefab, DamageColorIndex damageColorIndex)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_0129: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_0175: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.up + Random.insideUnitSphere * 0.1f;
			float force = 200f;
			Inventory inventory = ((EntityState)this).characterBody.inventory;
			int num = ((inventory != null) ? inventory.GetItemCount(Items.MoreMissile) : 0);
			float num2 = Mathf.Max(1f, 1f + 0.5f * (float)(num - 1));
			InputBankTest inputBank = ((EntityState)this).inputBank;
			ProcChainMask procChainMask2 = procChainMask;
			if (true)
			{
				((ProcChainMask)(ref procChainMask2)).AddProc((ProcType)1);
			}
			FireProjectileInfo val2 = default(FireProjectileInfo);
			val2.projectilePrefab = projectilePrefab;
			val2.position = position;
			val2.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref gunRay)).direction);
			val2.procChainMask = procChainMask2;
			val2.target = victim;
			val2.owner = ((Component)attacker).gameObject;
			val2.damage = missileDamage * num2;
			val2.crit = isCrit;
			val2.force = force;
			val2.damageColorIndex = damageColorIndex;
			FireProjectileInfo val3 = val2;
			ProjectileManager.instance.FireProjectile(val3);
			if (num > 0)
			{
				Vector3 val4 = (Object.op_Implicit((Object)(object)inputBank) ? inputBank.aimDirection : attacker.transform.position);
				FireProjectileInfo val5 = val3;
				val5.rotation = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(45f, val4) * val);
				val5.projectilePrefab = sMissileExtraMissiles;
				val5.damage = StaticValues.missileDamageCoefficient * ((BaseState)this).damageStat;
				FireProjectileInfo val6 = val3;
				val6.rotation = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(-45f, val4) * val);
				val6.projectilePrefab = sMissileExtraMissiles;
				val6.damage = StaticValues.missileDamageCoefficient * ((BaseState)this).damageStat;
				ProjectileManager.instance.FireProjectile(val5);
				ProjectileManager.instance.FireProjectile(val6);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= fireDuration)
			{
				fireMissile();
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		public void calculateSMissiles()
		{
			int maxStock = 0;
			if (secStock % 5 == 0)
			{
				maxStock = secStock / 5;
			}
			else if (secStock / 5 > 1)
			{
				maxStock = secStock / 5;
			}
			else if (secStock < 1)
			{
				maxStock = 0;
			}
			((EntityState)this).skillLocator.special.maxStock = maxStock;
		}
	}
	public class BaseMorphBall : BaseSkillState
	{
		private ChildLocator ChildLocator;

		private bool onEnter;

		[SerializeField]
		public float speedMult = 1.2f;

		private GameObject ball;

		private GameObject armature;

		private GameObject mesh;

		private GameObject bone;

		private float normalSpeed;

		private Transform tran;

		private float velx;

		private float vely;

		private float velz;

		[SerializeField]
		public SkillDef bomb;

		[SerializeField]
		public SkillDef powerBomb;

		[SerializeField]
		public SkillDef exitMorph;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			onEnter = true;
			((EntityState)this).skillLocator.utility.SetSkillOverride((object)((EntityState)this).skillLocator.utility, exitMorph, (SkillOverridePriority)4);
			ChildLocator = ((EntityState)this).GetModelChildLocator();
			((Component)((EntityState)this).characterBody).gameObject.GetComponent<Collider>().enabled = false;
			ball = ((Component)ChildLocator.FindChild("Ball2")).gameObject;
			armature = ((Component)ChildLocator.FindChild("armature")).gameObject;
			mesh = ((Component)ChildLocator.FindChild("Body")).gameObject;
			bone = ((Component)ChildLocator.FindChild("Ball2Bone")).gameObject;
			ball.GetComponent<Rigidbody>().constraints = (RigidbodyConstraints)14;
			normalSpeed = ((BaseState)this).moveSpeedStat;
			((BaseState)this).moveSpeedStat = normalSpeed * 2f;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.ArmorBoost);
			}
			ball.SetActive(true);
			armature.SetActive(false);
			mesh.SetActive(false);
		}

		private Vector3 IdealVelocity()
		{
			//IL_0006: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			return ((EntityState)this).characterDirection.forward * ((EntityState)this).characterBody.moveSpeed * speedMult;
		}

		public override void FixedUpdate()
		{
			//IL_0075: 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)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= 0.5f && onEnter)
			{
				onEnter = false;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				Collider component = ball.GetComponent<Collider>();
				Rigidbody component2 = ball.GetComponent<Rigidbody>();
				component.enabled = true;
				component2.isKinematic = false;
				component2.interpolation = (RigidbodyInterpolation)1;
				component2.collisionDetectionMode = (CollisionDetectionMode)1;
				component2.AddForce(((EntityState)this).characterMotor.velocity * 100f, (ForceMode)0);
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			velx = ((EntityState)this).characterMotor.velocity.x;
			vely = ((EntityState)this).characterMotor.velocity.y;
			velz = ((EntityState)this).characterMotor.velocity.z;
		}

		public override void OnExit()
		{
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.ArmorBoost);
			}
			((Component)((EntityState)this).characterBody).gameObject.GetComponent<Collider>().enabled = true;
			Collider component = ball.GetComponent<Collider>();
			Rigidbody component2 = ball.GetComponent<Rigidbody>();
			component.enabled = false;
			component2.isKinematic = true;
			component2.interpolation = (RigidbodyInterpolation)0;
			component2.collisionDetectionMode = (CollisionDetectionMode)0;
			((Component)ChildLocator.FindChild("Ball2")).gameObject.SetActive(false);
			((Component)ChildLocator.FindChild("armature")).gameObject.SetActive(true);
			((Component)ChildLocator.FindChild("Body")).gameObject.SetActive(true);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class BaseSamus : GenericCharacterMain
	{
		private ChildLocator ChildLocator;

		private Animator Animator;

		private static bool noPowerBomb;

		private bool filled;

		private Collision collision;

		private Collider collider;

		private GameObject ball;

		private Rigidbody BallRigidBody;

		private Vector3 velocity;

		private Vector3 direction;

		public Vector3 camera;

		private float horizontalInput;

		private Vector3 forwardDir;

		private static float stopwatch;

		private static float stopwatch2;

		private static float cacheStopwatch;

		private static float cacheStopwatch2;

		private static float maxStopwatch;

		private static float maxStopwatch2;

		private static bool powerBombInit;

		private static bool vrCheck;

		private static CharacterBody body;

		[SerializeField]
		public SkillDef morphBallRef;

		[SerializeField]
		public SkillDef autoFireSkill;

		private static GenericSkill powerBallskill;

		private static GenericSkill missileSkill;

		private bool effectiveAuth;

		private PlayerCharacterMasterController PlayerCharacterMasterController;

		private Player player;

		public static bool morphBall { get; set; }

		public static CharacterBody Body
		{
			get
			{
				return body;
			}
			set
			{
				body = value;
			}
		}

		public static bool VrCheck
		{
			get
			{
				return vrCheck;
			}
			set
			{
				vrCheck = value;
			}
		}

		public static float Stopwatch
		{
			get
			{
				return stopwatch;
			}
			set
			{
				stopwatch = value;
			}
		}

		public static float Stopwatch2
		{
			get
			{
				return stopwatch2;
			}
			set
			{
				stopwatch2 = value;
			}
		}

		public static bool PowerBombInit
		{
			get
			{
				return powerBombInit;
			}
			set
			{
				powerBombInit = value;
			}
		}

		public static GenericSkill PowerBallskill
		{
			get
			{
				return powerBallskill;
			}
			set
			{
				powerBallskill = value;
			}
		}

		public static GenericSkill MissileSkill
		{
			get
			{
				return missileSkill;
			}
			set
			{
				missileSkill = value;
			}
		}

		public override void OnEnter()
		{
			ChildLocator = ((EntityState)this).GetModelChildLocator();
			ball = ((Component)ChildLocator.FindChild("Ball2")).gameObject;
			collider = ball.GetComponent<Collider>();
			BallRigidBody = ball.GetComponent<Rigidbody>();
			PlayerCharacterMasterController = ((EntityState)this).characterBody.master.playerCharacterMasterController;
			LocalUser val = default(LocalUser);
			CameraRigController val2 = default(CameraRigController);
			PlayerCharacterMasterController.CanSendBodyInput(PlayerCharacterMasterController.networkUser, ref val, ref player, ref val2);
			if ((Object)(object)((EntityState)this).skillLocator.utility.skillDef == (Object)(object)morphBallRef)
			{
				MissileSkill = ((EntityState)this).skillLocator.FindSkillByFamilyName("SamusSecondary");
				powerBallskill = ((EntityState)this).skillLocator.FindSkillByFamilyName("SamusSecondary2");
			}
			else
			{
				((Behaviour)((EntityState)this).skillLocator.FindSkillByFamilyName("SamusSecondary2")).enabled = false;
			}
			Stopwatch = 0f;
			Stopwatch2 = 0f;
			powerBombInit = false;
			Body = ((EntityState)this).characterBody;
			if (VR.enabled)
			{
				VrCheck = Utils.IsUsingMotionControls(Body);
				if (VrCheck)
				{
					VRStuff.setupVR(Body);
					Camera.main.nearClipPlane = 0.05f;
					((Component)ChildLocator.FindChild("chargeEffect")).gameObject.SetActive(false);
					if (Config.enableHud.Value)
					{
						VRStuff.SamusHUD.initSamusHUD(Body);
					}
				}
			}
			((GenericCharacterMain)this).OnEnter();
		}

		public override void Update()
		{
			((GenericCharacterMain)this).Update();
			if ((Object)(object)DotController.FindDotController(((EntityState)this).gameObject) != (Object)null)
			{
				DotController val = DotController.FindDotController(((EntityState)this).gameObject);
				switch (val.activeDotFlags)
				{
				case 3u:
					val.RemoveDotStackAtServer(3);
					break;
				case 1u:
					val.RemoveDotStackAtServer(1);
					break;
				case 2u:
					val.RemoveDotStackAtServer(2);
					break;
				}
			}
			if (effectiveAuth && !morphBall && player.GetButtonDown(RewiredAction.autoFire.ActionId))
			{
				if ((Object)(object)((EntityState)this).skillLocator.primary.skillDef == (Object)(object)autoFireSkill)
				{
					((EntityState)this).skillLocator.primary.UnsetSkillOverride((object)((EntityState)this).skillLocator.primary, autoFireSkill, (SkillOverridePriority)4);
				}
				else
				{
					((EntityState)this).skillLocator.primary.SetSkillOverride((object)((EntityState)this).skillLocator.primary, autoFireSkill, (SkillOverridePriority)4);
				}
			}
		}

		public override void FixedUpdate()
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterMain)this).FixedUpdate();
			effectiveAuth = ((EntityState)this).characterBody.master.hasEffectiveAuthority;
			if (Object.op_Implicit((Object)(object)Animator))
			{
				Animator.SetFloat("sprintValue", (float)(((EntityState)this).characterBody.isSprinting ? (-1) : 0), 0.2f, Time.fixedDeltaTime);
				Animator.SetBool("inCombat", !((EntityState)this).characterBody.outOfCombat || !((EntityState)this).characterBody.outOfDanger);
			}
			if (!((EntityState)this).healthComponent.alive)
			{
				EntityState.Destroy((Object)(object)VRStuff.hudHandle);
			}
			if (((EntityState)this).healthComponent.isInFrozenState && ChildLocator.FindChild("Ball").localScale != new Vector3(0.5f, 0.5f, 0.5f))
			{
				ChildLocator.FindChild("Ball").localScale = new Vector3(0.5f, 0.5f, 0.5f);
			}
			if (stopwatch2 < maxStopwatch2)
			{
				stopwatch2 += Time.fixedDeltaTime;
			}
			if (!morphBall)
			{
				return;
			}
			if (stopwatch < maxStopwatch)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			velocity = ((EntityState)this).characterMotor.velocity;
			direction = ((EntityState)this).inputBank.moveVector;
			Quaternion rotation = ((EntityState)this).cameraTargetParams.cameraPivotTransform.rotation;
			camera = ((Quaternion)(ref rotation)).eulerAngles;
			Vector3.Scale(velocity, direction);
			collider.enabled = true;
			BallRigidBody.isKinematic = false;
			BallRigidBody.interpolation = (RigidbodyInterpolation)1;
			BallRigidBody.collisionDetectionMode = (CollisionDetectionMode)1;
			float num;
			if (((EntityState)this).characterBody.isSprinting)
			{
				num = ((velocity.x < 0f && velocity.z < 0f) ? (0f - velocity.x + (0f - velocity.z)) : ((velocity.x < 0f && velocity.z > 0f) ? (0f - velocity.x + velocity.z) : ((velocity.x > 0f && velocity.z < 0f) ? (velocity.x + (0f - velocity.z)) : ((!(velocity.x > 0f) || !(velocity.z > 0f)) ? (velocity.x + velocity.z) : (velocity.x + velocity.z)))));
				if (num > 16.8f || num < -16.8f)
				{
					num = 16.8f;
				}
			}
			else
			{
				num = ((velocity.x < 0f && velocity.z < 0f) ? (0f - velocity.x + (0f - velocity.z)) : ((velocity.x < 0f && velocity.z > 0f) ? (0f - velocity.x + velocity.z) : ((velocity.x > 0f && velocity.z < 0f) ? (velocity.x + (0f - velocity.z)) : ((!(velocity.x > 0f) || !(velocity.z > 0f)) ? (velocity.x + velocity.z) : (velocity.x + velocity.z)))));
				if (num > 14f || num < -14f)
				{
					num = 14f;
				}
			}
			if (((EntityState)this).characterMotor.velocity != Vector3.zero)
			{
				ball.transform.Rotate(Vector3.up, 0f - num);
			}
		}

		private void DotController_onDotInflictedServerGlobal(DotController dotController, ref InflictDotInfo inflictDotInfo)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Invalid comparison between Unknown and I4
			if ((inflictDotInfo.victimObject.gameObject.GetComponent<CharacterBody>().baseNameToken == "DG_SAMUS_NAME" || inflictDotInfo.attackerObject.gameObject.GetComponent<CharacterBody>().baseNameToken == "DG_SAMUS_NAME") && (int)inflictDotInfo.dotIndex == 3)
			{
				inflictDotInfo.duration = 0f;
				inflictDotInfo.damageMultiplier = 0f;
			}
		}

		public override void OnExit()
		{
			((GenericCharacterMain)this).OnExit();
			EntityState.Destroy((Object)(object)VRStuff.hudHandle);
		}
	}
	public class ChargeBeamBase : BaseSkillState
	{
		[SerializeField]
		public GameObject chargeEffectPrefab;

		[SerializeField]
		public string chargeSoundString;

		[SerializeField]
		public GameObject chargeMuzzle;

		public float baseDuration = 1.15f;

		[SerializeField]
		public float minBloomRadius;

		[SerializeField]
		public float maxBloomRadius;

		public GameObject crosshairOverridePrefab;

		protected static readonly float minChargeDuration;

		protected static Vector3 size;

		private GameObject defaultCrosshairPrefab;

		private uint loopSoundInstanceId;

		private OverrideRequest crosshairOverrideRequest;

		private bool isPlayingSound;

		private float duration { get; set; }

		private Animator animator { get; set; }

		private ChildLocator childLocator { get; set; }

		[SerializeField]
		public GameObject chargeEffectInstance { get; set; }

		public virtual BaseFireBeam GetNextBase()
		{
			return new BaseFireBeam();
		}

		public override void OnEnter()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			animator = ((EntityState)this).GetModelAnimator();
			childLocator = ((EntityState)this).GetModelChildLocator();
			Transform val = childLocator.FindChild("gunCon");
			crosshairOverrideRequest = CrosshairUtils.RequestOverrideForBody(((EntityState)this).characterBody, crosshairOverridePrefab, (OverridePriority)1);
			if (!Utils.IsUsingMotionControls(((EntityState)this).characterBody))
			{
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)chargeEffectPrefab))
				{
					chargeEffectInstance = Object.Instantiate<GameObject>(chargeEffectPrefab, val.position, val.rotation);
					chargeEffectInstance.transform.parent = val;
				}
			}
			else
			{
				chargeEffectInstance = Object.Instantiate<GameObject>(chargeEffectPrefab, val);
				chargeEffectInstance.transform.Rotate(90f, 0f, 0f);
			}
			((EntityState)this).PlayAnimation("Gesture, Override", "chargeLoop", "Charge.playbackRate", duration);
			defaultCrosshairPrefab = ((EntityState)this).characterBody.defaultCrosshairPrefab;
			((BaseState)this).StartAimMode(duration + 2f, false);
		}

		public override void OnExit()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			OverrideRequest obj = crosshairOverrideRequest;
			if (obj != null)
			{
				obj.Dispose();
			}
			AkSoundEngine.StopPlayingID(loopSoundInstanceId);
			if (!((EntityState)this).outer.destroying)
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "BufferEmpty");
			}
			size = chargeEffectInstance.transform.localScale;
			EntityState.Destroy((Object)(object)chargeEffectInstance);
			((EntityState)this).OnExit();
		}

		protected virtual float calcCharge()
		{
			if (((EntityState)this).age <= Time.fixedDeltaTime)
			{
				return Mathf.Clamp01(Time.fixedDeltaTime / duration);
			}
			return Mathf.Clamp01(((EntityState)this).fixedAge / duration);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			float charge = calcCharge();
			TryNextState(charge);
		}

		public override void Update()
		{
			((EntityState)this).Update();
			float charge = calcCharge();
			TryNextState(charge);
			((EntityState)this).characterBody.SetSpreadBloom(Util.Remap(calcCharge(), 0f, 1f, minBloomRadius, maxBloomRadius), true);
		}

		private void TryNextState(float charge)
		{
			if (((EntityState)this).isAuthority && !isPlayingSound && (double)charge > 0.15)
			{
				if (Utils.IsUsingMotionControls(((EntityState)this).characterBody))
				{
					loopSoundInstanceId = Util.PlayAttackSpeedSound(chargeSoundString, ((Component)MotionControls.dominantHand.muzzle).gameObject, duration - 0.15f);
				}
				else
				{
					loopSoundInstanceId = Util.PlayAttackSpeedSound(chargeSoundString, ((EntityState)this).gameObject, duration - 0.15f);
				}
				isPlayingSound = true;
			}
			if (((EntityState)this).isAuthority && !((BaseSkillState)this).IsKeyDownAuthority() && ((EntityState)this).age >= minChargeDuration)
			{
				BaseFireBeam nextBase = GetNextBase();
				nextBase.charge = charge;
				((EntityState)this).outer.SetNextState((EntityState)(object)nextBase);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class DeathState : GenericCharacterDeath
	{
		private Vector3 previousPosition;

		private float upSpeedVelocity;

		private float upSpeed;

		private Animator modelAnimator;

		public override bool shouldAutoDestroy => false;

		public override void OnEnter()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).OnEnter();
			Vector3 val = Vector3.up * 3f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				val += ((EntityState)this).characterMotor.velocity;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)((GenericCharacterDeath)this).cachedModelTransform))
			{
				RagdollController component = ((Component)((GenericCharacterDeath)this).cachedModelTransform).GetComponent<RagdollController>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.BeginRagdoll(val);
				}
			}
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge > 4f)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)6;
		}
	}
	public class SpawnState : BaseState
	{
		[SerializeField]
		public float duration;

		private Transform modelTransform;

		private Animator animator;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			modelTransform = ((EntityState)this).GetModelTransform();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
			((EntityState)this).PlayAnimation("Body", "Spawn", "Spawn.playbackRate", duration);
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetFloat(AnimationParameters.aimWeight, 0f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetBool("inCombat", true);
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetFloat(AnimationParameters.aimWeight, 1f);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)6;
		}
	}
}
namespace SamusMod.Misc
{
	internal enum EHudState
	{
		Combat,
		Ball,
		None
	}
	internal class SamusHUD : MonoBehaviour
	{
		private GameObject baseHUD;

		private GameObject damageLight;

		private GameObject camFilter;

		[SerializeField]
		private hudHealthInterface energyIntf;

		[SerializeField]
		private hudThreat threatIntf;

		[SerializeField]
		private hudMissiles missileIntf;

		[SerializeField]
		private hudDeco decoIntf;

		[SerializeField]
		private hudHelmet helmetIntf;

		[SerializeField]
		private hudBall ballIntf;

		public hudBossEnergy bossEnergyIntf;

		private hudColors hudcolors;

		private hudColors combatHudColors;

		private hudColors ballHudColors;

		private hudColors.EnergyBarColors energyBar;

		private hudColors.EnergyBarColors combatEnergyBar;

		private hudColors.EnergyBarColors ballEnergyBar;

		private float tempHealth;

		private float cachedBossHealth;

		public bool currInit;

		private EHudState curState;

		private bool envDamage;

		private float bossAlpha = 1f;

		private List<Color> frameColorTest;

		private List<Color> baseFrame;

		private float playerHealth;

		private float maxPlayerHealth = 100f;

		private uint totalEnergyTanks = 6u;

		private uint missileAmount;

		private uint missileCapacity;

		private uint rendertimings;

		private uint filledEnergyTanks;

		private bool energyLow;

		private bool missileActive;

		private Material localMat;

		private List<Text> texts;

		private float hudDamagePracticalsInit;

		private float hudDamagePracticals;

		private float hudDamagePracticalsGain;

		private float damageTime;

		private float damageLightPulser;

		private float damageFilterAmt;

		private float damageFilterAmtInit = 1f;

		private float damageFilterAmtGain;

		private float energyLowTimer;

		private float energyLowPulse;

		private float missileActiveTimer;

		private bool wasDamaged;

		public static float DamageAm;

		public bool inMorphBall;

		private bool allInit;

		private hudTimer timer;

		private float timerV;

		private CharacterBody character;

		public GameObject bossHealthBarRoot;

		private BossGroup bossInfo;

		private Material damageMat;

		private static uint[] playingIds = new uint[50];

		private void OnDestroy()
		{
			bossEnergyIntf.reset();
		}

		private void Start()
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_0127: 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_015b: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			baseHUD = ((Component)this).gameObject;
			decoIntf.SetSize();
			helmetIntf.SetSize();
			combatHudColors = new hudColors(combatVisor: true);
			combatEnergyBar = combatHudColors.GetEnergyBarColors(combatMode: true);
			ballHudColors = new hudColors(combatVisor: false);
			ballEnergyBar = ballHudColors.GetEnergyBarColors(combatMode: false);
			timer = new hudTimer();
			texts = new List<Text>();
			Transform[] componentsInChildren = ((Component)((Component)this).gameObject.transform).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if ((Object)(object)((Component)val).gameObject.GetComponent<Text>() != (Object)null)
				{
					texts.Add(((Component)val).gameObject.GetComponent<Text>());
				}
			}
			foreach (Text text in texts)
			{
				localMat = new Material(((Graphic)text).material);
				((Graphic)text).material = localMat;
			}
			baseFrame = new List<Color>
			{
				new Color(0.156863f, 0.156863f, 0.156863f),
				new Color(0.4f, 0.4f, 0.4f),
				new Color(0.8f, 0.8f, 0.8f)
			};
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.294118f, 0.494118f, 0.639216f, 32f / 51f);
			frameColorTest = new List<Color>
			{
				baseFrame[0] * val2,
				baseFrame[1] * val2,
				baseFrame[2] * val2
			};
			updateHudState();
		}

		private void FixedUpdate()
		{
			timerV = timer.solveFTimer();
			if (missileActive)
			{
				missActiveTimer();
			}
			updateHudState();
			if (!allInit)
			{
				checkInits(Time.fixedDeltaTime);
			}
			HUDUpdate(Time.fixedDeltaTime, HudVis: true);
		}

		private void checkInits(float dt)
		{
			int num = 4;
			if (!hudcolors.init)
			{
				updateHudState();
				num--;
			}
			if (!energyIntf.initHealth)
			{
				UpdateEnergy(dt, init: true);
				num--;
			}
			if (!bossEnergyIntf.bossIni)
			{
				bossEnergyIntf.SetBossParams(Visible: false, "", "", 0f, 0f, hudcolors, energyBar);
				num--;
			}
			if (!ballIntf.ballini)
			{
				UpdateBallMode(init: true);
				num--;
			}
			if (num == 4)
			{
				allInit = true;
			}
		}

		private void updateHudState()
		{
			if (character.skillLocator.utility.skillNameToken == "DG_SAMUS_UTILITY_DASH_NAME")
			{
				curState = EHudState.Combat;
				hudcolors = combatHudColors;
				energyBar = combatEnergyBar;
				return;
			}
			inMorphBall = BaseSamus.morphBall;
			if (inMorphBall)
			{
				curState = EHudState.Ball;
			}
			else
			{
				curState = EHudState.Combat;
			}
			switch (curState)
			{
			case EHudState.Combat:
				hudcolors = combatHudColors;
				energyBar = combatEnergyBar;
				break;
			case EHudState.Ball:
				hudcolors = ballHudColors;
				energyBar = ballEnergyBar;
				break;
			case EHudState.None:
				break;
			}
		}

		private void UpdateEnergy(float dt, bool init)
		{
			float num = Mathf.Max(0f, Mathf.Ceil(character.healthComponent.combinedHealth));
			float num2 = Mathf.Ceil(character.healthComponent.fullCombinedHealth);
			uint num3 = 6u;
			uint num4 = 0u;
			num4 = (uint)character.inventory.GetItemCount(Items.ExtraLife);
			if (!init)
			{
				energyLow = isEnergyLow();
			}
			if (init || num != playerHealth || num3 != totalEnergyTanks || num2 != maxPlayerHealth || num4 != filledEnergyTanks)
			{
				if (energyIntf.checkEnergyBarIsActive(init))
				{
					if (init)
					{
						energyIntf.initValues(hudTypes.combat, num, num2, (int)num3, (int)num4, character.healthComponent, EnergyLow: false);
					}
					energyIntf.SetCurrEnergy(num, num2, wrapped: false);
					energyIntf.SetEnergyLow(energyLow);
				}
				playerHealth = num;
				maxPlayerHealth = num2;
				filledEnergyTanks = num4;
			}
			if (Object.op_Implicit((Object)(object)bossEnergyIntf))
			{
				bossInfo = bossHealthBarRoot.GetComponent<HUDBossHealthBarController>().currentBossGroup;
				if ((Object)(object)bossInfo != (Object)null && bossEnergyIntf.loaded)
				{
					bossAlpha = ((bossEnergyIntf.GetCurrentHealth() > 0f) ? 1 : 0);
					HUDBossHealthBarController component = bossHealthBarRoot.GetComponent<HUDBossHealthBarController>();
					string parsedText = ((TMP_Text)component.bossNameLabel).GetParsedText();
					string parsedText2 = ((TMP_Text)component.bossSubtitleLabel).GetParsedText();
					((Behaviour)bossHealthBarRoot.GetComponent<Canvas>()).enabled = false;
					bossEnergyIntf.SetBossParams(Visible: true, parsedText, parsedText2, bossInfo.totalObservedHealth, bossInfo.totalMaxObservedMaxHealth, hudcolors, energyBar);
				}
				else
				{
					bossEnergyIntf.SetBossParams(Visible: false, "", "", 0f, 0f, hudcolors, energyBar);
				}
			}
		}

		private void UpdateMissile(float dt, bool init)
		{
			uint stock = (uint)character.skillLocator.secondary.stock;
			uint maxStock = (uint)character.skillLocator.secondary.maxStock;
			int num = character.skillLocator.secondary.stock / 5;
			bool isMissilesActive = missileIntf.GetIsMissilesActive();
			if (missileIntf.isActive(init))
			{
				missileIntf.setHasAlt(num >= 1);
			}
			if (init)
			{
				missileIntf.missInit((int)maxStock, (int)stock, MissilesActive: false, character.skillLocator);
			}
			if (stock == missileAmount && missileActive == isMissilesActive && maxStock == missileCapacity)
			{
				return;
			}
			if (missileIntf.isActive(init))
			{
				if (maxStock != missileCapacity)
				{
					missileIntf.SetMissileCapacity((int)maxStock);
				}
				if (stock != missileAmount)
				{
					missileIntf.SetNumMissiles((int)stock);
				}
				if (missileActive != isMissilesActive)
				{
					missileIntf.SetIsMissilesActive(isMissilesActive);
				}
			}
			missileAmount = stock;
			missileActive = isMissilesActive;
			missileCapacity = maxStock;
		}

		private void UpdateThreatAssessment(float dt)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Invalid comparison between Unknown and I4
			float num = 1000f;
			float num2 = 100f;
			float num3 = float.PositiveInfinity;
			Collider[] array = Physics.OverlapSphere(character.transform.position, 100f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask));
			Collider[] array2 = Physics.OverlapSphere(character.transform.position, 25f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.projectile)).mask));
			if (array.Length > 30 || array2.Length > 30)
			{
				num = 0f;
			}
			else
			{
				Collider[] array3 = array;
				foreach (Collider val in array3)
				{
					float num4 = Vector3.Distance(character.transform.position, ((Component)val).transform.position);
					if (!(num4 < num3))
					{
						continue;
					}
					HurtBox component = ((Component)val).GetComponent<HurtBox>();
					if (!Object.op_Implicit((Object)(object)component))
					{
						continue;
					}
					HealthComponent healthComponent = component.healthComponent;
					if (!Object.op_Implicit((Object)(object)healthComponent) || (!((Object)(object)((Component)healthComponent).gameObject == (Object)(object)((Component)character).gameObject) && (int)healthComponent.body.teamComponent.teamIndex > 1))
					{
						if (num4 == 0f)
						{
							num = 0f;
							break;
						}
						num3 = num4;
					}
				}
				if (num != 0f)
				{
					array3 = array2;
					foreach (Collider val2 in array3)
					{
						float num5 = Vector3.Distance(character.transform.position, ((Component)val2).transform.position);
						if (!(num5 < num3))
						{
							continue;
						}
						ProjectileController componentInChildren = ((Component)((Component)val2).transform.root).GetComponentInChildren<ProjectileController>();
						if (!Object.op_Implicit((Object)(object)componentInChildren) || ((int)componentInChildren.teamFilter.teamIndex > 1 && !((Object)(object)componentInChildren.owner == (Object)(object)((Component)character).gameObject)))
						{
							if (num5 == 0f)
							{
								num = 0f;
								break;
							}
							num3 = num5;
						}
					}
				}
				num = (float.IsPositiveInfinity(num3) ? num2 : num3);
			}
			if (threatIntf.isActive(init: false))
			{
				threatIntf.SetThreatDistance(num);
			}
		}

		private void UpdateEnergyLow(float dt)
		{
			_ = energyLowTimer;
			energyLowTimer = Mathf.Abs(fmod(GetSecondsMod900(), 0.5f));
			if (energyLowTimer < 0.25f)
			{
				energyLowPulse = energyLowTimer / 0.25f;
			}
			else
			{
				energyLowPulse = (0.5f - energyLowTimer) / 0.25f;
			}
			if (energyLow)
			{
				playSound(1631926714u, ((Component)this).gameObject);
			}
		}

		private void InitializeDamageLight()
		{
			GameObject gameObject = ((Component)((Component)((Component)this).gameObject.transform.parent).GetComponentInChildren<HUD>()).gameObject;
			damageMat = ((Component)gameObject.GetComponent<CameraRigController>()).GetComponentInChildren<ScreenDamage>().mat;
		}

		private void UpdateBallMode(bool init)
		{
			if (ballIntf.isActive(init) && inMorphBall)
			{
				uint stock = (uint)character.skillLocator.secondary.stock;
				uint maxStock = (uint)chara