Decompiled source of Quality v0.8.1

patchers/Quality/ItemQualities.Patcher.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx.Logging;
using Mono.Cecil;
using Mono.Collections.Generic;

[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 ItemQualitiesPatcher;

internal static class AssemblyNames
{
	public const string RoR2 = "RoR2.dll";
}
public static class BuffPatcher
{
	private static readonly LogWriter _log = new LogWriter();

	public static IEnumerable<string> TargetDLLs { get; } = new string[1] { "RoR2.dll" };

	public static void Initialize()
	{
		_log.SetLogSource(Logger.CreateLogSource("BuffPatcher"));
	}

	public static void Patch(AssemblyDefinition assembly)
	{
		//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)
		TypeDefinition type = assembly.MainModule.GetType("RoR2.CharacterBody");
		if (type == null)
		{
			_log.Error("Failed to find type: CharacterBody");
			return;
		}
		Enumerator<MethodDefinition> enumerator = type.Methods.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				MethodDefinition current = enumerator.Current;
				if (((MemberReference)current).Name == "GetBuffCount" || ((MemberReference)current).Name == "HasBuff")
				{
					disableInlining(current);
				}
			}
		}
		finally
		{
			((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
	}

	private static void disableInlining(MethodDefinition method)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		method.ImplAttributes = (MethodImplAttributes)(method.ImplAttributes & 0xFEFF);
		method.ImplAttributes = (MethodImplAttributes)(method.ImplAttributes | 8);
		_log.Debug("Disabled inlining for method " + ((MemberReference)method).FullName);
	}
}
internal sealed class LogWriter
{
	private ManualLogSource _logSource;

	public LogWriter(ManualLogSource logSource)
	{
		_logSource = logSource;
	}

	public LogWriter()
		: this(null)
	{
	}

	public void SetLogSource(ManualLogSource logSource)
	{
		_logSource = logSource;
	}

	public void Fatal(object message)
	{
		ManualLogSource logSource = _logSource;
		if (logSource != null)
		{
			logSource.LogFatal(message);
		}
	}

	public void Error(object message)
	{
		ManualLogSource logSource = _logSource;
		if (logSource != null)
		{
			logSource.LogError(message);
		}
	}

	public void Warning(object message)
	{
		ManualLogSource logSource = _logSource;
		if (logSource != null)
		{
			logSource.LogWarning(message);
		}
	}

	public void Message(object message)
	{
		ManualLogSource logSource = _logSource;
		if (logSource != null)
		{
			logSource.LogMessage(message);
		}
	}

	public void Info(object message)
	{
		ManualLogSource logSource = _logSource;
		if (logSource != null)
		{
			logSource.LogInfo(message);
		}
	}

	public void Debug(object message)
	{
		ManualLogSource logSource = _logSource;
		if (logSource != null)
		{
			logSource.LogDebug(message);
		}
	}
}

plugins/Quality/ItemQualities.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
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 System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using AK.Wwise;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Bandit2;
using EntityStates.Barrel;
using EntityStates.BossGroupHealNovaController;
using EntityStates.BrotherMonster;
using EntityStates.CaptainSupplyDrop;
using EntityStates.Drifter;
using EntityStates.Drone.DroneJunk;
using EntityStates.Engi.Mine;
using EntityStates.EngiTurret.EngiTurretWeapon;
using EntityStates.FalseSon;
using EntityStates.FalseSonBoss;
using EntityStates.FriendUnit;
using EntityStates.GoldGat;
using EntityStates.GolemMonster;
using EntityStates.GrandParentSun;
using EntityStates.Halcyonite;
using EntityStates.Headstompers;
using EntityStates.ImpBossMonster;
using EntityStates.JellyfishMonster;
using EntityStates.JunkCube;
using EntityStates.LaserTurbine;
using EntityStates.Mage;
using EntityStates.MinePod;
using EntityStates.Missions.Goldshores;
using EntityStates.MushroomShield;
using EntityStates.ParentMonster;
using EntityStates.ScavMonster;
using EntityStates.Seeker;
using EntityStates.SharedSufferingOrb;
using EntityStates.SolusAmalgamator;
using EntityStates.SolusHeart.Death;
using EntityStates.SolusWing;
using EntityStates.SolusWing.PostFight;
using EntityStates.SurvivorPod.BatteryPanel;
using EntityStates.TimedChest;
using EntityStates.VagrantMonster;
using EntityStates.VagrantNovaItem;
using EntityStates.VagrantNovaItemQuality;
using EntityStates.VoidInfestor;
using Grumpy;
using HG;
using HG.Coroutines;
using HG.GeneralSerializer;
using HG.Reflection;
using IL.EntityStates;
using IL.EntityStates.Bandit2;
using IL.EntityStates.BrotherMonster;
using IL.EntityStates.CaptainSupplyDrop;
using IL.EntityStates.Chef;
using IL.EntityStates.Drifter;
using IL.EntityStates.Drone.DroneBombardment;
using IL.EntityStates.Drone.DroneJunk;
using IL.EntityStates.FalseSon;
using IL.EntityStates.FalseSonBoss;
using IL.EntityStates.GoldGat;
using IL.EntityStates.GolemMonster;
using IL.EntityStates.Halcyonite;
using IL.EntityStates.Headstompers;
using IL.EntityStates.ImpBossMonster;
using IL.EntityStates.JellyfishMonster;
using IL.EntityStates.JunkCube;
using IL.EntityStates.Mage;
using IL.EntityStates.ParentMonster;
using IL.EntityStates.RoboBallBoss.Weapon;
using IL.EntityStates.ScavMonster;
using IL.EntityStates.Seeker;
using IL.EntityStates.SolusAmalgamator;
using IL.EntityStates.TimedChest;
using IL.EntityStates.VagrantMonster;
using IL.EntityStates.VagrantNovaItem;
using IL.RoR2;
using IL.RoR2.Items;
using IL.RoR2.Orbs;
using IL.RoR2.Projectile;
using IL.RoR2.Stats;
using IL.RoR2.UI;
using IL.RoR2.UI.LogBook;
using IL.RoR2.VoidRaidCrab;
using ItemQualities;
using ItemQualities.Buffs;
using ItemQualities.Config;
using ItemQualities.ContentManagement;
using ItemQualities.Equipments;
using ItemQualities.Items;
using ItemQualities.ModCompatibility;
using ItemQualities.Networking;
using ItemQualities.Orbs;
using ItemQualities.SaveData;
using ItemQualities.Serialization;
using ItemQualities.Utilities;
using ItemQualities.Utilities.Extensions;
using KinematicCharacterController;
using MiscFixes.Modules;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using On;
using On.EntityStates.Drifter;
using On.EntityStates.FalseSon;
using On.EntityStates.LaserTurbine;
using On.EntityStates.Missions.Goldshores;
using On.EntityStates.SolusHeart.Death;
using On.EntityStates.SolusWing.PostFight;
using On.EntityStates.SurvivorPod.BatteryPanel;
using On.EntityStates.TimedChest;
using On.EntityStates.VoidInfestor;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.Items;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using On.RoR2.SolusWingGrid;
using On.RoR2.Stats;
using On.RoR2.UI;
using On.RoR2.UI.LogBook;
using ProperSave;
using ProperSave.Data;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Rebindables;
using Rewired;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.DirectionalSearch;
using RoR2.EntitlementManagement;
using RoR2.ExpansionManagement;
using RoR2.HudOverlay;
using RoR2.Items;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.SolusWingGrid;
using RoR2.UI;
using RoR2.UI.LogBook;
using RoR2.VoidRaidCrab;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using RoR2BepInExPack.Utilities;
using ShaderSwapper;
using TMPro;
using Unity;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.Serialization;
using UnityEngine.UI;
using VultureHunter;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[assembly: OptIn]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace EntityStates.VagrantNovaItemQualityStandalone
{
	public abstract class BaseVagrantNovaItemQualityStandaloneState : EntityState
	{
		protected NovaOnLowHealthDelayBlast delayBlast { get; private set; }

		protected CharacterBody attachedBody { get; private set; }

		protected ItemQualityCounts GetItemCounts()
		{
			if (!Object.op_Implicit((Object)(object)attachedBody) || !Object.op_Implicit((Object)(object)attachedBody.inventory))
			{
				return ItemQualityCounts.zero;
			}
			return attachedBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.NovaOnLowHealth);
		}

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			delayBlast = ((EntityState)this).GetComponent<NovaOnLowHealthDelayBlast>();
			GameObject ownerObject = ((EntityState)this).GetComponent<GenericOwnership>().ownerObject;
			attachedBody = (Object.op_Implicit((Object)(object)ownerObject) ? ownerObject.GetComponent<CharacterBody>() : null);
		}
	}
	public sealed class ChargingState : BaseVagrantNovaItemQualityStandaloneState
	{
		private float duration;

		private GameObject chargeVfxInstance;

		private GameObject areaIndicatorVfxInstance;

		public override void OnEnter()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			float num = (Object.op_Implicit((Object)(object)base.attachedBody) ? base.attachedBody.attackSpeed : 1f);
			duration = EntityStates.VagrantNovaItemQuality.ChargingState.baseDuration / num;
			if (Object.op_Implicit((Object)(object)base.attachedBody))
			{
				Vector3 val = default(Vector3);
				Quaternion val2 = default(Quaternion);
				((EntityState)this).transform.GetPositionAndRotation(ref val, ref val2);
				chargeVfxInstance = Object.Instantiate<GameObject>(ChargeMegaNova.chargingEffectPrefab, val, val2);
				chargeVfxInstance.transform.localScale = Vector3.one * 0.25f;
				Util.PlayAttackSpeedSound(EntityStates.VagrantNovaItemQuality.ChargingState.chargeSound, ((EntityState)this).gameObject, EntityStates.VagrantNovaItemQuality.ChargingState.baseDuration / ChargeState.baseDuration * num);
				areaIndicatorVfxInstance = Object.Instantiate<GameObject>(ChargeMegaNova.areaIndicatorPrefab, val, val2);
				ObjectScaleCurve component = areaIndicatorVfxInstance.GetComponent<ObjectScaleCurve>();
				component.timeMax = duration;
				component.baseScale = Vector3.one * (ExplodeOnDeath.GetExplosionRadius(EntityStates.VagrantNovaItemQuality.DetonateState.blastRadius, base.attachedBody) * 2f);
				areaIndicatorVfxInstance.GetComponent<AnimateShaderAlpha>().timeMax = duration;
			}
			RoR2Application.onLateUpdate += OnLateUpdate;
		}

		public override void OnExit()
		{
			RoR2Application.onLateUpdate -= OnLateUpdate;
			if (Object.op_Implicit((Object)(object)chargeVfxInstance))
			{
				EntityState.Destroy((Object)(object)chargeVfxInstance);
				chargeVfxInstance = null;
			}
			if (Object.op_Implicit((Object)(object)areaIndicatorVfxInstance))
			{
				EntityState.Destroy((Object)(object)areaIndicatorVfxInstance);
				areaIndicatorVfxInstance = null;
			}
			((EntityState)this).OnExit();
		}

		private void OnLateUpdate()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)chargeVfxInstance))
			{
				chargeVfxInstance.transform.position = ((EntityState)this).transform.position;
			}
			if (Object.op_Implicit((Object)(object)areaIndicatorVfxInstance))
			{
				areaIndicatorVfxInstance.transform.position = ((EntityState)this).transform.position;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new DetonateState());
			}
		}
	}
	public sealed class DetonateState : BaseVagrantNovaItemQualityStandaloneState
	{
		private float duration;

		public override void OnEnter()
		{
			//IL_014a: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_0060: 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_0076: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_0127: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			duration = EntityStates.VagrantNovaItemQuality.DetonateState.baseDuration;
			float explosionRadius = ExplodeOnDeath.GetExplosionRadius(EntityStates.VagrantNovaItemQuality.DetonateState.blastRadius * base.delayBlast.procCoefficient, base.attachedBody);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)base.attachedBody))
			{
				ItemQualityCounts itemCounts = GetItemCounts();
				if (itemCounts.TotalQualityCount == 0)
				{
					itemCounts.UncommonCount = 1;
				}
				new BlastAttack
				{
					attacker = ((Component)base.attachedBody).gameObject,
					baseDamage = base.attachedBody.damage * NovaOnLowHealth.GetMiniNovaDamageCoefficient(in itemCounts),
					baseForce = EntityStates.VagrantNovaItemQuality.DetonateState.blastForce,
					bonusForce = Vector3.zero,
					attackerFiltering = (AttackerFiltering)2,
					crit = base.attachedBody.RollCrit(),
					damageColorIndex = (DamageColorIndex)3,
					damageType = DamageTypeCombo.op_Implicit((DamageTypeExtended)8192),
					falloffModel = (FalloffModel)0,
					inflictor = ((EntityState)this).gameObject,
					position = ((EntityState)this).transform.position,
					procChainMask = base.delayBlast.procChainMask,
					procCoefficient = EntityStates.VagrantNovaItemQuality.DetonateState.blastProcCoefficient * base.delayBlast.procCoefficient,
					radius = explosionRadius,
					losType = (LoSType)1,
					teamIndex = base.attachedBody.teamComponent.teamIndex
				}.Fire();
			}
			EffectData val = new EffectData
			{
				origin = ((EntityState)this).transform.position,
				scale = explosionRadius
			};
			EffectManager.SpawnEffect(EntityStates.VagrantNovaItemQuality.DetonateState.explosionEffectPrefab, val, false);
			Util.PlaySound(EntityStates.VagrantNovaItemQuality.DetonateState.explosionSound, ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (NetworkServer.active)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)new Idle());
			}
		}
	}
}
namespace EntityStates.VagrantNovaItemQuality
{
	public abstract class BaseVagrantNovaItemQualityState : BaseBodyAttachmentState
	{
		protected ItemQualityCounts GetItemCounts()
		{
			if (!Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody) || !Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody.inventory))
			{
				return ItemQualityCounts.zero;
			}
			return ((BaseBodyAttachmentState)this).attachedBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.NovaOnLowHealth);
		}
	}
	public sealed class ChargingState : BaseVagrantNovaItemQualityState
	{
		public static float baseDuration = 1.5f;

		public static string chargeSound;

		private float duration;

		private GameObject chargeVfxInstance;

		private GameObject areaIndicatorVfxInstance;

		public override void OnEnter()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			((BaseBodyAttachmentState)this).OnEnter();
			float num = (Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody) ? ((BaseBodyAttachmentState)this).attachedBody.attackSpeed : 1f);
			duration = baseDuration / num;
			if (Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody))
			{
				Vector3 val = default(Vector3);
				Quaternion val2 = default(Quaternion);
				((EntityState)this).transform.GetPositionAndRotation(ref val, ref val2);
				chargeVfxInstance = Object.Instantiate<GameObject>(ChargeMegaNova.chargingEffectPrefab, val, val2);
				chargeVfxInstance.transform.localScale = Vector3.one * 0.25f;
				Util.PlayAttackSpeedSound(chargeSound, ((EntityState)this).gameObject, baseDuration / ChargeState.baseDuration * num);
				areaIndicatorVfxInstance = Object.Instantiate<GameObject>(ChargeMegaNova.areaIndicatorPrefab, val, val2);
				ObjectScaleCurve component = areaIndicatorVfxInstance.GetComponent<ObjectScaleCurve>();
				component.timeMax = duration;
				component.baseScale = Vector3.one * (ExplodeOnDeath.GetExplosionRadius(DetonateState.blastRadius, ((BaseBodyAttachmentState)this).attachedBody) * 2f);
				areaIndicatorVfxInstance.GetComponent<AnimateShaderAlpha>().timeMax = duration;
			}
			RoR2Application.onLateUpdate += OnLateUpdate;
		}

		public override void OnExit()
		{
			RoR2Application.onLateUpdate -= OnLateUpdate;
			if (Object.op_Implicit((Object)(object)chargeVfxInstance))
			{
				EntityState.Destroy((Object)(object)chargeVfxInstance);
				chargeVfxInstance = null;
			}
			if (Object.op_Implicit((Object)(object)areaIndicatorVfxInstance))
			{
				EntityState.Destroy((Object)(object)areaIndicatorVfxInstance);
				areaIndicatorVfxInstance = null;
			}
			((EntityState)this).OnExit();
		}

		private void OnLateUpdate()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)chargeVfxInstance))
			{
				chargeVfxInstance.transform.position = ((EntityState)this).transform.position;
			}
			if (Object.op_Implicit((Object)(object)areaIndicatorVfxInstance))
			{
				areaIndicatorVfxInstance.transform.position = ((EntityState)this).transform.position;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new DetonateState());
			}
		}
	}
	public sealed class DetonateState : BaseVagrantNovaItemQualityState
	{
		public static float blastRadius;

		public static float blastProcCoefficient;

		public static float blastForce;

		public static float baseDuration;

		public static string explosionSound;

		private float duration;

		public static GameObject explosionEffectPrefab { get; private set; }

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentInitializerArgs args)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> handle = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_Base_Vagrant.VagrantNovaExplosion_prefab);
			handle.OnSuccess(delegate(GameObject vagrantNovaExplosionPrefab)
			{
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Expected O, but got Unknown
				explosionEffectPrefab = EffectScalingFixer.CreateFixedScalingCopy(vagrantNovaExplosionPrefab, 40f, "MiniVagrantNovaExplosion");
				Light componentInChildren = explosionEffectPrefab.GetComponentInChildren<Light>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					((Component)componentInChildren).gameObject.SetActive(false);
				}
				PostProcessVolume componentInChildren2 = explosionEffectPrefab.GetComponentInChildren<PostProcessVolume>();
				if (Object.op_Implicit((Object)(object)componentInChildren2))
				{
					((Component)componentInChildren2).gameObject.SetActive(false);
				}
				args.ContentPack.effectDefs.Add<EffectDef>(new EffectDef(explosionEffectPrefab));
			});
			return handle.AsProgressCoroutine<GameObject, ReadableProgress<float>>(args.ProgressReceiver);
		}

		public override void OnEnter()
		{
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			((BaseBodyAttachmentState)this).OnEnter();
			duration = baseDuration;
			float explosionRadius = ExplodeOnDeath.GetExplosionRadius(blastRadius, ((BaseBodyAttachmentState)this).attachedBody);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody))
			{
				ItemQualityCounts itemCounts = GetItemCounts();
				if (itemCounts.TotalQualityCount == 0)
				{
					itemCounts.UncommonCount = 1;
				}
				new BlastAttack
				{
					attacker = ((Component)((BaseBodyAttachmentState)this).attachedBody).gameObject,
					baseDamage = ((BaseBodyAttachmentState)this).attachedBody.damage * NovaOnLowHealth.GetMiniNovaDamageCoefficient(in itemCounts),
					baseForce = blastForce,
					bonusForce = Vector3.zero,
					attackerFiltering = (AttackerFiltering)2,
					crit = ((BaseBodyAttachmentState)this).attachedBody.RollCrit(),
					damageColorIndex = (DamageColorIndex)3,
					damageType = DamageTypeCombo.op_Implicit((DamageTypeExtended)8192),
					falloffModel = (FalloffModel)0,
					inflictor = ((EntityState)this).gameObject,
					position = ((BaseBodyAttachmentState)this).attachedBody.corePosition,
					procChainMask = default(ProcChainMask),
					procCoefficient = blastProcCoefficient,
					radius = explosionRadius,
					losType = (LoSType)1,
					teamIndex = ((BaseBodyAttachmentState)this).attachedBody.teamComponent.teamIndex
				}.Fire();
			}
			EffectData val = new EffectData
			{
				origin = (Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody) ? ((BaseBodyAttachmentState)this).attachedBody.corePosition : ((EntityState)this).transform.position),
				scale = explosionRadius
			};
			if (Object.op_Implicit((Object)(object)((BaseBodyAttachmentState)this).attachedBody))
			{
				val.SetHurtBoxReference(((BaseBodyAttachmentState)this).attachedBody.mainHurtBox);
			}
			EffectManager.SpawnEffect(explosionEffectPrefab, val, false);
			Util.PlaySound(explosionSound, ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public sealed class ReadyState : BaseVagrantNovaItemQualityState
	{
		public override void OnEnter()
		{
			((BaseBodyAttachmentState)this).OnEnter();
			GlobalEventManager.onServerDamageDealt += onServerDamageDealt;
		}

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

		private void onServerDamageDealt(DamageReport damageReport)
		{
			if (damageReport.victimBody == ((BaseBodyAttachmentState)this).attachedBody && Object.op_Implicit((Object)(object)damageReport.victimBody.inventory))
			{
				ItemQualityCounts itemCounts = GetItemCounts();
				float num;
				switch (itemCounts.HighestQuality)
				{
				case QualityTier.None:
					num = 0f;
					break;
				case QualityTier.Uncommon:
					num = 10f;
					break;
				case QualityTier.Rare:
					num = 25f;
					break;
				case QualityTier.Epic:
					num = 40f;
					break;
				case QualityTier.Legendary:
					num = 60f;
					break;
				default:
					Log.Warning($"Quality tier {itemCounts.HighestQuality} is not implemented", "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\VagrantNovaItemQuality\\ReadyState.cs", "onServerDamageDealt", 48);
					num = 0f;
					break;
				}
				if (num > 0f && RollUtil.CheckRoll(num, damageReport.victimMaster, sureProc: false))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new ChargingState());
				}
			}
		}
	}
}
namespace EntityStates.SprintArmorDash
{
	public sealed class SprintArmorDashBounce : EntityState
	{
		private static readonly SphereSearch _dashSphereSearch = new SphereSearch();

		private static EffectIndex _hitEffectIndex = (EffectIndex)(-1);

		private CharacterBody _attachedBody;

		[NonSerialized]
		public Vector3 dashDirection;

		[NonSerialized]
		public Vector3 attackPos;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_hitEffectIndex = EffectCatalogUtils.FindEffectIndex("OmniImpactVFX");
			if ((int)_hitEffectIndex == -1)
			{
				Log.Warning("Failed to find hit effect index", "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\SprintArmorDash\\SprintArmorDashBounce.cs", "Init", 33);
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0009: 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)
			((EntityState)this).OnSerialize(writer);
			writer.Write(dashDirection);
			writer.Write(attackPos);
		}

		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)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			dashDirection = reader.ReadVector3();
			attackPos = reader.ReadVector3();
		}

		public override void OnEnter()
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Invalid comparison between Unknown and I4
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Expected O, but got Unknown
			//IL_01c8: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: 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)
			((EntityState)this).OnEnter();
			NetworkedBodyAttachment component = ((EntityState)this).GetComponent<NetworkedBodyAttachment>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.attachedBody))
			{
				return;
			}
			_attachedBody = component.attachedBody;
			if (((EntityState)this).isAuthority)
			{
				IPhysMotor obj;
				if (!Object.op_Implicit((Object)(object)_attachedBody.characterMotor))
				{
					obj = ((Component)_attachedBody).GetComponent<IPhysMotor>();
				}
				else
				{
					IPhysMotor characterMotor = (IPhysMotor)(object)_attachedBody.characterMotor;
					obj = characterMotor;
				}
				if (obj != null)
				{
					PhysForceInfo val = default(PhysForceInfo);
					((PhysForceInfo)(ref val)).resetVelocity = true;
					val.force = new Vector3((0f - dashDirection.x) * 20f, 20f, (0f - dashDirection.z) * 20f);
					((PhysForceInfo)(ref val)).ignoreGroundStick = true;
					((PhysForceInfo)(ref val)).massIsOne = true;
					obj.ApplyForceImpulse(ref val);
				}
				base.outer.SetNextStateToMain();
			}
			if (!NetworkServer.active)
			{
				return;
			}
			List<HurtBox> list = default(List<HurtBox>);
			DisposableRental<HurtBox, List<HurtBox>> val2 = CollectionPool<HurtBox, List<HurtBox>>.RentCollection(ref list);
			try
			{
				_dashSphereSearch.origin = _attachedBody.corePosition;
				_dashSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
				_dashSphereSearch.radius = _attachedBody.radius + 12f;
				_dashSphereSearch.RefreshCandidates();
				_dashSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(_attachedBody.teamComponent.teamIndex));
				_dashSphereSearch.FilterCandidatesByDistinctHurtBoxEntities();
				_dashSphereSearch.GetHurtBoxes(list);
				_dashSphereSearch.ClearCandidates();
				SetStateOnHurt val5 = default(SetStateOnHurt);
				foreach (HurtBox item in list)
				{
					if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.healthComponent) && Object.op_Implicit((Object)(object)item.healthComponent.body))
					{
						if ((int)_hitEffectIndex != -1)
						{
							EffectData val3 = new EffectData
							{
								origin = ((Component)item).transform.position
							};
							val3.SetHurtBoxReference(item);
							EffectManager.SpawnEffect(_hitEffectIndex, val3, true);
						}
						DamageInfo val4 = new DamageInfo
						{
							damage = 0f,
							attacker = ((Component)_attachedBody).gameObject,
							inflictor = ((EntityState)this).gameObject,
							procCoefficient = 0f,
							position = attackPos,
							crit = _attachedBody.RollCrit(),
							inflictedHurtbox = item,
							canRejectForce = false,
							physForceFlags = (PhysForceFlags)15
						};
						if (item.healthComponent.body.isChampion)
						{
							val4.force = Vector3.zero;
						}
						else
						{
							val4.force = dashDirection * 50f;
						}
						item.healthComponent.TakeDamageForce(val4, false, false);
						GlobalEventManager.instance.OnHitEnemy(val4, ((Component)item.healthComponent).gameObject);
						GlobalEventManager.instance.OnHitAll(val4, ((Component)item.healthComponent).gameObject);
						if (((Component)item.healthComponent).TryGetComponent<SetStateOnHurt>(ref val5) && val5.canBeStunned)
						{
							val5.SetStun(1f);
							StunChanceOnHit.OnImmobilize(_attachedBody, item.healthComponent.body);
						}
						ItemQualityCounts itemCountsEffective = _attachedBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintArmor);
						float num = itemCountsEffective.UncommonCount * 3 + itemCountsEffective.RareCount * 6 + itemCountsEffective.EpicCount * 9 + itemCountsEffective.LegendaryCount * 12;
						item.healthComponent.body.AddTimedBuff(ItemQualitiesContent.Buffs.SprintArmorWeaken, num);
					}
				}
			}
			finally
			{
				val2.Dispose();
			}
		}
	}
	public sealed class SprintArmorDashDashingState : EntityState
	{
		public static float DashSpeedCoefficient;

		public static float DashEndSpeedCoefficient;

		private static readonly SphereSearch _dashSphereSearch = new SphereSearch();

		private static EffectIndex _blinkEffectIndex;

		private CharacterBody _attachedBody;

		private IPhysMotor _motor;

		private Vector3 _dashDirection;

		private bool _stoppedDash;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_blinkEffectIndex = EffectCatalogUtils.FindEffectIndex("HuntressBlinkEffect");
			if ((int)_blinkEffectIndex == -1)
			{
				Log.Warning("Failed to find blink effect index", "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\SprintArmorDash\\SprintArmorDashDashingState.cs", "Init", 33);
			}
		}

		public override void OnEnter()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnEnter();
			NetworkedBodyAttachment component = ((EntityState)this).GetComponent<NetworkedBodyAttachment>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.attachedBody))
			{
				return;
			}
			_attachedBody = component.attachedBody;
			_dashDirection = _attachedBody.inputBank.aimDirection;
			IPhysMotor motor;
			if (!Object.op_Implicit((Object)(object)_attachedBody.characterMotor))
			{
				motor = ((Component)_attachedBody).GetComponent<IPhysMotor>();
			}
			else
			{
				IPhysMotor characterMotor = (IPhysMotor)(object)_attachedBody.characterMotor;
				motor = characterMotor;
			}
			_motor = motor;
			if (((EntityState)this).isAuthority)
			{
				_attachedBody.isSprinting = true;
			}
			if (NetworkServer.active)
			{
				int num = _attachedBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.SprintArmor).HighestQuality switch
				{
					QualityTier.Uncommon => 20, 
					QualityTier.Rare => 15, 
					QualityTier.Epic => 10, 
					QualityTier.Legendary => 5, 
					_ => 30, 
				};
				for (int i = 1; i <= num; i++)
				{
					_attachedBody.AddTimedBuff(ItemQualitiesContent.Buffs.SprintArmorDashCooldown, (float)i);
				}
				_attachedBody.AddBuff(Buffs.IgnoreFallDamage);
			}
			EffectData val = new EffectData();
			val.rotation = Util.QuaternionSafeLookRotation(_dashDirection);
			val.origin = _attachedBody.corePosition;
			EffectManager.SpawnEffect(_blinkEffectIndex, val, false);
		}

		public override void OnExit()
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)_attachedBody))
			{
				_attachedBody.RemoveBuff(Buffs.IgnoreFallDamage);
				_attachedBody.AddTimedBuff(Buffs.IgnoreFallDamage, 0.2f);
			}
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!Object.op_Implicit((Object)(object)_attachedBody))
			{
				if (((EntityState)this).isAuthority)
				{
					base.outer.SetNextStateToMain();
				}
				return;
			}
			if (NetworkServer.active)
			{
				_attachedBody.isSprinting = true;
			}
			if (_attachedBody.hasEffectiveAuthority && _motor != null)
			{
				PhysForceInfo val;
				if (((EntityState)this).fixedAge < 0.1f)
				{
					IPhysMotor motor = _motor;
					val = default(PhysForceInfo);
					((PhysForceInfo)(ref val)).resetVelocity = true;
					val.force = _dashDirection * (_attachedBody.moveSpeed * DashSpeedCoefficient);
					((PhysForceInfo)(ref val)).ignoreGroundStick = true;
					((PhysForceInfo)(ref val)).massIsOne = true;
					motor.ApplyForceImpulse(ref val);
				}
				else if (!_stoppedDash)
				{
					_stoppedDash = true;
					IPhysMotor motor2 = _motor;
					val = default(PhysForceInfo);
					((PhysForceInfo)(ref val)).resetVelocity = true;
					val.force = _dashDirection * (_attachedBody.moveSpeed * DashEndSpeedCoefficient);
					((PhysForceInfo)(ref val)).ignoreGroundStick = true;
					((PhysForceInfo)(ref val)).massIsOne = true;
					motor2.ApplyForceImpulse(ref val);
				}
			}
			if (((EntityState)this).isAuthority)
			{
				if (((EntityState)this).fixedAge > 0.2f)
				{
					base.outer.SetNextStateToMain();
				}
				tryAttack();
			}
		}

		private void tryAttack()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			List<HurtBox> list = default(List<HurtBox>);
			DisposableRental<HurtBox, List<HurtBox>> val = CollectionPool<HurtBox, List<HurtBox>>.RentCollection(ref list);
			try
			{
				_dashSphereSearch.origin = _attachedBody.corePosition;
				_dashSphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
				_dashSphereSearch.radius = _attachedBody.radius + 3f;
				_dashSphereSearch.RefreshCandidates();
				_dashSphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(_attachedBody.teamComponent.teamIndex));
				_dashSphereSearch.FilterCandidatesByDistinctHurtBoxEntities();
				_dashSphereSearch.GetHurtBoxes(list);
				_dashSphereSearch.ClearCandidates();
				if (list.Count > 0)
				{
					SprintArmorDashBounce sprintArmorDashBounce = new SprintArmorDashBounce();
					sprintArmorDashBounce.attackPos = _attachedBody.corePosition;
					sprintArmorDashBounce.dashDirection = _dashDirection;
					base.outer.SetNextState((EntityState)(object)sprintArmorDashBounce);
				}
			}
			finally
			{
				val.Dispose();
			}
		}
	}
	public sealed class SprintArmorDashIdle : EntityState
	{
		public static float DoubleTapWindow;

		private float _lastValidInputTime = float.NegativeInfinity;

		private CharacterBody _attachedBody;

		private InputBankTest inputBank;

		private bool canDash
		{
			get
			{
				if (Object.op_Implicit((Object)(object)_attachedBody))
				{
					return !_attachedBody.HasBuff(ItemQualitiesContent.Buffs.SprintArmorDashCooldown);
				}
				return false;
			}
		}

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			NetworkedBodyAttachment component = ((EntityState)this).GetComponent<NetworkedBodyAttachment>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.attachedBody))
			{
				_attachedBody = component.attachedBody;
				inputBank = _attachedBody.inputBank;
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			if (Object.op_Implicit((Object)(object)_attachedBody) && _attachedBody.hasEffectiveAuthority)
			{
				UpdateAuthority();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)_attachedBody) && _attachedBody.hasEffectiveAuthority)
			{
				FixedUpdateAuthority();
			}
		}

		private void UpdateAuthority()
		{
			if (canDash && inputBank.interact.down)
			{
				if (((ButtonState)(ref inputBank.rawMoveUp)).justPressed)
				{
					if (((EntityState)this).age - _lastValidInputTime <= DoubleTapWindow)
					{
						StartDashAuthority();
					}
					_lastValidInputTime = ((EntityState)this).age;
				}
			}
			else
			{
				_lastValidInputTime = float.NegativeInfinity;
			}
		}

		private void FixedUpdateAuthority()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (canDash)
			{
				ButtonState sprintArmorDashButtonState = RebindablesCompat.GetSprintArmorDashButtonState(inputBank);
				if (((ButtonState)(ref sprintArmorDashButtonState)).justPressed)
				{
					StartDashAuthority();
				}
			}
		}

		private void StartDashAuthority()
		{
			base.outer.SetNextState((EntityState)(object)new SprintArmorDashDashingState());
		}
	}
}
namespace EntityStates.SharedSufferingOrb
{
	public sealed class SharedSufferingOrbDeath : EntityState
	{
		private static GameObject _deathEffectPrefab;

		public static float ExplosionDamageCoefficient;

		public static float ExplosionForce;

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentInitializerArgs args)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> handle = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_Base_WeeklyRun.TimeCrystalDeath_prefab);
			handle.OnSuccess(delegate(GameObject timeCrystalDeath)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				_deathEffectPrefab = PrefabAPI.InstantiateClone(timeCrystalDeath, "SharedSufferingOrbDeathEffect", false);
				args.ContentPack.effectDefs.Add<EffectDef>(new EffectDef(_deathEffectPrefab));
			});
			return handle.AsProgressCoroutine<GameObject, ReadableProgress<float>>(args.ProgressReceiver);
		}

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			explode();
		}

		private void explode()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: 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)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelBaseTransform))
				{
					EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelBaseTransform).gameObject);
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelTransform))
				{
					EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelTransform).gameObject);
				}
			}
			SharedSufferingOrbController component = ((EntityState)this).GetComponent<SharedSufferingOrbController>();
			float num = (Object.op_Implicit((Object)(object)component) ? component.BlastRadius : 0f);
			if (Object.op_Implicit((Object)(object)_deathEffectPrefab))
			{
				EffectManager.SpawnEffect(_deathEffectPrefab, new EffectData
				{
					origin = ((EntityState)this).transform.position,
					scale = num,
					rotation = Quaternion.identity
				}, false);
			}
			if (NetworkServer.active)
			{
				GenericOwnership component2 = ((EntityState)this).GetComponent<GenericOwnership>();
				GameObject val = (Object.op_Implicit((Object)(object)component2) ? component2.ownerObject : null);
				CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
				TeamIndex val3 = (TeamIndex)((!Object.op_Implicit((Object)(object)val2)) ? (-1) : ((int)val2.teamComponent.teamIndex));
				Vector3 position = ((EntityState)this).transform.position;
				float damage = ExplosionDamageCoefficient * (Object.op_Implicit((Object)(object)val2) ? val2.damage : Run.instance.teamlessDamageCoefficient);
				foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
				{
					if (FriendlyFireManager.ShouldSplashHitProceed(readOnlyInstances.healthComponent, val3) && !((Object)(object)readOnlyInstances == (Object)(object)val2) && !((Object)(object)readOnlyInstances == (Object)(object)((EntityState)this).characterBody) && !(Vector3.Distance(readOnlyInstances.corePosition, position) >= num))
					{
						DamageInfo val4 = new DamageInfo
						{
							attacker = val,
							inflictor = ((EntityState)this).gameObject,
							damage = damage,
							crit = (Object.op_Implicit((Object)(object)val2) && val2.RollCrit()),
							damageType = DamageTypeCombo.op_Implicit((DamageType)131072),
							damageColorIndex = (DamageColorIndex)16,
							procCoefficient = 0f,
							position = position
						};
						float explosionForce = ExplosionForce;
						Vector3 val5 = readOnlyInstances.corePosition - position;
						val4.force = explosionForce * ((Vector3)(ref val5)).normalized + ExplosionForce * 0.5f * Vector3.up;
						DamageInfo val6 = val4;
						DamageAPI.AddModdedDamageType(ref val6.damageType, DamageTypes.ForceAddToSharedSuffering);
						readOnlyInstances.healthComponent.TakeDamage(val6);
						GlobalEventManager.instance.OnHitEnemy(val6, ((Component)readOnlyInstances).gameObject);
						GlobalEventManager.instance.OnHitAll(val6, ((Component)readOnlyInstances).gameObject);
					}
				}
			}
			EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
}
namespace EntityStates.RoboBallBuddy
{
	public sealed class ChargeQualityGigaBeam : BaseSkillState
	{
		private static GameObject _chargeEffectPrefab;

		public static string chargeEffectMuzzleName;

		public static string chargeSoundName;

		public static float baseDuration;

		private float _duration;

		private GameObject _chargeEffectInstance;

		private EffectManagerHelper _chargeEffectInstance_efh;

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentInitializerArgs args)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> handle = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_DLC3_SolusWing.SolusWingOverheatBeamWindUp_prefab);
			handle.OnSuccess(delegate(GameObject beamWindUpPrefab)
			{
				_chargeEffectPrefab = EffectScalingFixer.CreateFixedScalingCopy(beamWindUpPrefab, 1f, "QualityGigaBeamChargeUp");
				SetGlobalScale componentInChildren = _chargeEffectPrefab.GetComponentInChildren<SetGlobalScale>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					EntityState.Destroy((Object)(object)componentInChildren);
				}
				ScaleParticleSystemDuration obj = _chargeEffectPrefab.AddComponent<ScaleParticleSystemDuration>();
				obj.particleSystems = _chargeEffectPrefab.GetComponentsInChildren<ParticleSystem>(true);
				obj.initialDuration = 5f;
				Transform val = _chargeEffectPrefab.transform.Find("Charge Up/Point Light");
				if (Object.op_Implicit((Object)(object)val) && ((Component)(object)val).ExpectComponent<Light>(out var component, "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\RoboBallBuddy\\ChargeQualityGigaBeam.cs", "LoadContent", 36))
				{
					Light obj2 = component;
					obj2.range *= 0.2f;
					Light obj3 = component;
					obj3.intensity *= 0.2f;
				}
			});
			return handle.AsProgressCoroutine<GameObject, ReadableProgress<float>>(args.ProgressReceiver);
		}

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

		public override void OnEnter()
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			_duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Util.PlayAttackSpeedSound(chargeSoundName, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat * (SolusWingOverheatBeamChargeUp.baseDuration / baseDuration));
			Transform val = ((BaseState)this).FindModelChild(chargeEffectMuzzleName);
			if (Object.op_Implicit((Object)(object)val))
			{
				if (EffectManager.ShouldUsePooledEffect(_chargeEffectPrefab))
				{
					_chargeEffectInstance_efh = EffectManager.GetAndActivatePooledEffect(_chargeEffectPrefab, val, true);
					_chargeEffectInstance = ((Component)_chargeEffectInstance_efh).gameObject;
				}
				else
				{
					_chargeEffectInstance = Object.Instantiate<GameObject>(_chargeEffectPrefab, val);
				}
				_chargeEffectInstance.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
				_chargeEffectInstance.GetComponent<ScaleParticleSystemDuration>().newDuration = _duration;
				AnimateShaderAlpha[] componentsInChildren = _chargeEffectInstance.GetComponentsInChildren<AnimateShaderAlpha>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].timeMax = _duration;
				}
			}
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((BaseSkillState)this).activatorSkillSlot))
			{
				((BaseSkillState)this).activatorSkillSlot.SetBlockedCooldownSkillState(true);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)_chargeEffectInstance_efh) && _chargeEffectInstance_efh.OwningPool != null)
			{
				((GenericPool<EffectManagerHelper>)(object)_chargeEffectInstance_efh.OwningPool).ReturnObject(_chargeEffectInstance_efh);
			}
			else if (Object.op_Implicit((Object)(object)_chargeEffectInstance))
			{
				EntityState.Destroy((Object)(object)_chargeEffectInstance);
			}
			_chargeEffectInstance = null;
			_chargeEffectInstance_efh = null;
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((BaseSkillState)this).activatorSkillSlot))
			{
				((BaseSkillState)this).activatorSkillSlot.SetBlockedCooldownSkillState(false);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= _duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new FireQualityGigaBeam
				{
					activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot
				});
			}
		}
	}
	public sealed class FireQualityGigaBeam : FireBeam, ISkillState
	{
		private static GameObject _impactEffectPrefab;

		public static float muzzleDirectionBlendFactor;

		public static float minimumBeamDistanceCoefficient;

		public static LoopSoundDef beamLoopSound;

		private float _duration;

		private float _beamRadius;

		private SoundLoopPtr _beamLoopSoundPtr;

		private Transform _laserMuzzle;

		public GenericSkill activatorSkillSlot { get; set; }

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentInitializerArgs args)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> handle = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_DLC3_SolusWing.OverheatBeamImpactEffect_prefab);
			handle.OnSuccess(delegate(GameObject impactEffectPrefab)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				_impactEffectPrefab = PrefabAPI.InstantiateClone(impactEffectPrefab, "QualityGigaBeamImpact");
				_impactEffectPrefab.transform.localScale = Vector3.one * 4f;
				args.ContentPack.effectDefs.Add<EffectDef>(new EffectDef(_impactEffectPrefab));
			});
			return handle.AsProgressCoroutine<GameObject, ReadableProgress<float>>(args.ProgressReceiver);
		}

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

		public override void OnEnter()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			base.hitEffectPrefab = _impactEffectPrefab;
			((FireBeam)this).OnEnter();
			ItemQualityCounts itemQualityCounts = ItemQualityCounts.zero;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.inventory))
			{
				itemQualityCounts = ((EntityState)this).characterBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.RoboBallBuddyItem);
			}
			_beamRadius = itemQualityCounts.HighestQuality switch
			{
				QualityTier.Uncommon => 1f, 
				QualityTier.Rare => 3f, 
				QualityTier.Epic => 8f, 
				QualityTier.Legendary => 14f, 
				_ => 1f, 
			};
			_duration = (float)itemQualityCounts.UncommonCount * 4f + (float)itemQualityCounts.RareCount * 8f + (float)itemQualityCounts.EpicCount * 12f + (float)itemQualityCounts.LegendaryCount * 16f;
			base.damageCoefficient = (float)itemQualityCounts.UncommonCount * 3f + (float)itemQualityCounts.RareCount * 6f + (float)itemQualityCounts.EpicCount * 9f + (float)itemQualityCounts.LegendaryCount * 12f;
			if (Object.op_Implicit((Object)(object)beamLoopSound))
			{
				_beamLoopSoundPtr = LoopSoundManager.PlaySoundLoopLocal(((EntityState)this).gameObject, beamLoopSound);
			}
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)activatorSkillSlot))
			{
				activatorSkillSlot.SetBlockedCooldownSkillState(true);
			}
			if (Object.op_Implicit((Object)(object)base.laserVfxInstance))
			{
				base.laserVfxInstance.transform.localScale = Vector3.one * _beamRadius;
			}
			_laserMuzzle = ((BaseState)this).FindModelChild(base.muzzleString);
			((FireBeam)this).FireBullet(((FireBeam)this).GetLaserRay(), base.muzzleString, Time.fixedTime);
		}

		public override void OnExit()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			((FireBeam)this).OnExit();
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)activatorSkillSlot))
			{
				activatorSkillSlot.SetBlockedCooldownSkillState(false);
			}
			if (((SoundLoopPtr)(ref _beamLoopSoundPtr)).isValid)
			{
				LoopSoundManager.StopSoundLoopLocal(_beamLoopSoundPtr);
				_beamLoopSoundPtr = default(SoundLoopPtr);
			}
		}

		public override void FixedUpdate()
		{
			((FireBeam)this).FixedUpdate();
			((BaseState)this).StartAimMode(2f, false);
		}

		public override Ray GetLaserRay()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			Ray laserRay = ((FireBeam)this).GetLaserRay();
			if (Object.op_Implicit((Object)(object)_laserMuzzle))
			{
				Ray val = default(Ray);
				((Ray)(ref val))..ctor(_laserMuzzle.position, _laserMuzzle.forward);
				((Ray)(ref laserRay)).origin = Vector3.Lerp(((Ray)(ref laserRay)).origin, ((Ray)(ref val)).origin, muzzleDirectionBlendFactor);
				((Ray)(ref laserRay)).direction = Vector3.Slerp(((Ray)(ref laserRay)).direction, ((Ray)(ref val)).direction, muzzleDirectionBlendFactor);
			}
			return laserRay;
		}

		public override bool ShouldFireLaser()
		{
			return ((EntityState)this).fixedAge < _duration;
		}

		public override void ModifyBullet(BulletAttack bulletAttack)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			bulletAttack.radius = _beamRadius;
			bulletAttack.damageType.damageSource = (DamageSource)2;
			HitCallback origHitCallback = bulletAttack.hitCallback;
			bulletAttack.hitCallback = new HitCallback(beamHitCallback);
			bool beamHitCallback(BulletAttack val, ref BulletHit hitInfo)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				bool flag = hitInfo.distance >= val.radius * minimumBeamDistanceCoefficient;
				val.stopperMask = (flag ? CommonMasks.bullet : LayerMask.op_Implicit(0));
				return origHitCallback.Invoke(val, ref hitInfo);
			}
		}
	}
}
namespace EntityStates.QuestVolatileBatteryQuality
{
	public abstract class QuestVolatileBatteryQualityBaseState : EntityState
	{
		protected CharacterBody attachedBody { get; private set; }

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			QuestVolatileBatteryAttachment questVolatileBatteryAttachment = default(QuestVolatileBatteryAttachment);
			if (((EntityState)this).TryGetComponent<QuestVolatileBatteryAttachment>(ref questVolatileBatteryAttachment))
			{
				attachedBody = questVolatileBatteryAttachment.victimBody;
			}
		}
	}
	public sealed class QuestVolatileBatteryQualityCountDown : QuestVolatileBatteryQualityBaseState
	{
		private static GameObject _countdownEffectPrefab;

		public static float duration;

		public static float explosionRadius;

		private GameObject _countdownEffectInstance;

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			AddressableUtil.LoadAssetAsync<GameObject>(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab, (AsyncReferenceHandleUnloadType)2).OnSuccess(delegate(GameObject volatileBatteryPreDetonation)
			{
				_countdownEffectPrefab = volatileBatteryPreDetonation;
			});
		}

		public override void OnEnter()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)_countdownEffectPrefab))
			{
				_countdownEffectInstance = Object.Instantiate<GameObject>(_countdownEffectPrefab, ((EntityState)this).transform);
				_countdownEffectInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				if (Object.op_Implicit((Object)(object)base.attachedBody))
				{
					_countdownEffectInstance.transform.localScale = Vector3.one * base.attachedBody.bestFitActualRadius;
				}
			}
		}

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

		public override void FixedUpdate()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)base.attachedBody))
			{
				((EntityState)this).transform.position = base.attachedBody.corePosition;
			}
			if (NetworkServer.active)
			{
				FixedUpdateServer();
			}
		}

		private void FixedUpdateServer()
		{
			if (((EntityState)this).fixedAge >= duration)
			{
				QuestVolatileBattery.Detonate(((EntityState)this).gameObject);
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}
	}
	public sealed class QuestVolatileBatteryQualityMonitor : QuestVolatileBatteryQualityBaseState
	{
		private static GameObject _qualityBatteryPreDetonationEffect;

		private GameObject _vfxInstance;

		[ContentInitializer]
		private static IEnumerator LoadContent(ContentInitializerArgs args)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> handle = AddressableUtil.LoadTempAssetAsync<GameObject>(RoR2_Base_QuestVolatileBattery.VolatileBatteryPreDetonation_prefab);
			handle.OnSuccess(delegate(GameObject volatileBatteryPreDetonationPrefab)
			{
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				_qualityBatteryPreDetonationEffect = PrefabAPI.InstantiateClone(volatileBatteryPreDetonationPrefab, "QualityVolatileBatteryPreDetonation", false);
				ShakeEmitter val = default(ShakeEmitter);
				if (_qualityBatteryPreDetonationEffect.TryGetComponent<ShakeEmitter>(ref val))
				{
					EntityState.Destroy((Object)(object)val);
				}
				LoopSound val2 = default(LoopSound);
				if (_qualityBatteryPreDetonationEffect.TryGetComponent<LoopSound>(ref val2))
				{
					EntityState.Destroy((Object)(object)val2);
				}
				Transform val3 = _qualityBatteryPreDetonationEffect.transform.Find("PP");
				if (Object.op_Implicit((Object)(object)val3))
				{
					EntityState.Destroy((Object)(object)((Component)val3).gameObject);
				}
				Transform val4 = _qualityBatteryPreDetonationEffect.transform.Find("LightShafts");
				if (Object.op_Implicit((Object)(object)val4))
				{
					EntityState.Destroy((Object)(object)((Component)val4).gameObject);
				}
				Transform val5 = _qualityBatteryPreDetonationEffect.transform.Find("Pulse");
				if (Object.op_Implicit((Object)(object)val5))
				{
					EntityState.Destroy((Object)(object)((Component)val5).gameObject);
				}
				Transform val6 = _qualityBatteryPreDetonationEffect.transform.Find("Sparks, Trail");
				ParticleSystem val7 = default(ParticleSystem);
				if (Object.op_Implicit((Object)(object)val6) && ((Component)val6).TryGetComponent<ParticleSystem>(ref val7))
				{
					MainModule main = val7.main;
					((MainModule)(ref main)).simulationSpeed = 0.5f;
					EmissionModule emission = val7.emission;
					((EmissionModule)(ref emission)).rateOverTimeMultiplier = 10f;
				}
				args.ContentPack.prefabs.Add<GameObject>(_qualityBatteryPreDetonationEffect);
			});
			return handle.AsProgressCoroutine<GameObject, ReadableProgress<float>>(args.ProgressReceiver);
		}

		public override void OnEnter()
		{
			//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_004f: 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)
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)base.attachedBody))
			{
				_vfxInstance = Object.Instantiate<GameObject>(_qualityBatteryPreDetonationEffect, ((EntityState)this).transform);
				_vfxInstance.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				_vfxInstance.transform.localScale = Vector3.one * base.attachedBody.bestFitActualRadius;
			}
		}

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

		public override void FixedUpdate()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)base.attachedBody))
			{
				((EntityState)this).transform.position = base.attachedBody.corePosition;
			}
			if (NetworkServer.active)
			{
				FixedUpdateServer();
			}
		}

		private void FixedUpdateServer()
		{
			if (Object.op_Implicit((Object)(object)base.attachedBody) && base.attachedBody.healthComponent.combinedHealthFraction <= 0.5f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new QuestVolatileBatteryQualityCountDown());
			}
		}
	}
}
namespace EntityStates.ParryProjectile
{
	public sealed class ParryProjectileFire : GenericProjectileBaseState
	{
		private CharacterMasterExtraStatsTracker _masterStats;

		public override void OnEnter()
		{
			((GenericProjectileBaseState)this).OnEnter();
			_masterStats = ((Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master)) ? ((Component)(object)((EntityState)this).characterBody.master).GetComponentCached<CharacterMasterExtraStatsTracker>() : null);
			if (!Object.op_Implicit((Object)(object)_masterStats))
			{
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
			else
			{
				base.projectilePrefab = ProjectileCatalog.GetProjectilePrefab(_masterStats.ParryStoredProjectileInfo.ProjectileIndex);
			}
		}

		public override void ModifyProjectileInfo(ref FireProjectileInfo fireProjectileInfo)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			((GenericProjectileBaseState)this).ModifyProjectileInfo(ref fireProjectileInfo);
			ParryStoredProjectileInfo parryStoredProjectileInfo = _masterStats.ParryStoredProjectileInfo;
			float num;
			switch (parryStoredProjectileInfo.QualityTier)
			{
			case QualityTier.Uncommon:
				num = 1.5f;
				break;
			case QualityTier.Rare:
				num = 2.5f;
				break;
			case QualityTier.Epic:
				num = 4f;
				break;
			case QualityTier.Legendary:
				num = 10f;
				break;
			default:
				Log.Error($"Quality tier {parryStoredProjectileInfo.QualityTier} is not implemented", "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\ParryProjectile\\ParryProjectileFire.cs", "ModifyProjectileInfo", 53);
				return;
			}
			fireProjectileInfo.damage = parryStoredProjectileInfo.Damage * num;
			fireProjectileInfo.crit |= parryStoredProjectileInfo.Crit;
			fireProjectileInfo.force = parryStoredProjectileInfo.Force;
			fireProjectileInfo.damageTypeOverride = DamageTypeCombo.GenericPrimary;
			fireProjectileInfo.damageColorIndex = (DamageColorIndex)3;
		}

		public override void OnExit()
		{
			((GenericProjectileBaseState)this).OnExit();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)_masterStats))
			{
				_masterStats.ParryStoredProjectileInfo = ParryStoredProjectileInfo.None;
			}
		}
	}
}
namespace EntityStates.MushroomShield
{
	public abstract class MushroomBubbleBaseState : EntityState
	{
		[NonSerialized]
		public float EffectRadius;

		public override void OnSerialize(NetworkWriter writer)
		{
			((EntityState)this).OnSerialize(writer);
			writer.Write(EffectRadius);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			EffectRadius = reader.ReadSingle();
		}

		public override void ModifyNextState(EntityState nextState)
		{
			((EntityState)this).ModifyNextState(nextState);
			if (nextState is MushroomBubbleBaseState mushroomBubbleBaseState)
			{
				mushroomBubbleBaseState.EffectRadius = EffectRadius;
			}
		}

		public abstract void Undeploy(bool immediate);
	}
	public sealed class MushroomBubbleDeploy : MushroomBubbleBaseState
	{
		public static string StartSoundString;

		private CharacterBody _ownerBody;

		private float _startMoveStopwatchValue;

		private float _undeployLifetime;

		public override void OnEnter()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnEnter();
			Util.PlaySound(StartSoundString, ((EntityState)this).gameObject);
			GenericOwnership component = ((EntityState)this).GetComponent<GenericOwnership>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.ownerObject))
			{
				return;
			}
			_ownerBody = component.ownerObject.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)_ownerBody) && Object.op_Implicit((Object)(object)_ownerBody.inventory))
			{
				ItemQualityCounts itemCountsEffective = _ownerBody.inventory.GetItemCountsEffective(ItemQualitiesContent.ItemQualityGroups.Mushroom);
				_undeployLifetime = itemCountsEffective.UncommonCount + 3 * itemCountsEffective.RareCount + 6 * itemCountsEffective.EpicCount + 12 * itemCountsEffective.LegendaryCount;
				float num = 30f;
				switch (itemCountsEffective.HighestQuality)
				{
				case QualityTier.Uncommon:
					num = 30f;
					break;
				case QualityTier.Rare:
					num = 25f;
					break;
				case QualityTier.Epic:
					num = 20f;
					break;
				case QualityTier.Legendary:
					num = 15f;
					break;
				}
				EffectRadius = num;
				((EntityState)this).transform.localScale = Vector3.one * (num / 20f);
				_startMoveStopwatchValue = _ownerBody.notMovingStopwatch;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && (!Object.op_Implicit((Object)(object)_ownerBody) || !Object.op_Implicit((Object)(object)_ownerBody.healthComponent) || !_ownerBody.healthComponent.alive || _ownerBody.notMovingStopwatch < _startMoveStopwatchValue))
			{
				Undeploy(immediate: false);
			}
		}

		public override void Undeploy(bool immediate)
		{
			if (((EntityState)this).isAuthority)
			{
				if (immediate)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleFlashOut());
					return;
				}
				((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleUndeploy
				{
					Duration = _undeployLifetime
				});
			}
		}
	}
	public sealed class MushroomBubbleFlashOut : MushroomBubbleBaseState
	{
		private static EffectIndex _bubbleShieldEndEffect = (EffectIndex)(-1);

		public static string EndSoundString;

		public static float Duration;

		private BeginRapidlyActivatingAndDeactivating _blinkController;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_bubbleShieldEndEffect = EffectCatalogUtils.FindEffectIndex("BubbleShieldEndEffect");
			if ((int)_bubbleShieldEndEffect == -1)
			{
				Log.Warning("Failed to find charge effect index", "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\MushroomShield\\MushroomBubbleFlashOut.cs", "Init", 16);
			}
		}

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			_blinkController = ((EntityState)this).GetComponent<BeginRapidlyActivatingAndDeactivating>();
			if (Object.op_Implicit((Object)(object)_blinkController))
			{
				_blinkController.delayBeforeBeginningBlinking = 0f;
				_blinkController.fixedAge = 0f;
				((Behaviour)_blinkController).enabled = true;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		public override void OnExit()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			((EntityState)this).OnExit();
			EffectManager.SpawnEffect(_bubbleShieldEndEffect, new EffectData
			{
				origin = ((EntityState)this).transform.position,
				rotation = ((EntityState)this).transform.rotation,
				scale = EffectRadius
			}, false);
			Util.PlaySound(EndSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)_blinkController))
			{
				((Behaviour)_blinkController).enabled = false;
			}
		}

		public override void Undeploy(bool immediate)
		{
		}
	}
	public sealed class MushroomBubbleUndeploy : MushroomBubbleBaseState
	{
		[NonSerialized]
		public float Duration;

		public override void OnSerialize(NetworkWriter writer)
		{
			base.OnSerialize(writer);
			writer.Write(Duration);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			base.OnDeserialize(reader);
			Duration = reader.ReadSingle();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= Duration - MushroomBubbleFlashOut.Duration)
			{
				Undeploy(immediate: true);
			}
		}

		public override void Undeploy(bool immediate)
		{
			if (((EntityState)this).isAuthority && immediate)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new MushroomBubbleFlashOut());
			}
		}
	}
}
namespace EntityStates.FriendUnit
{
	public sealed class FriendUnitPunt : BaseState
	{
		public static float BaseVelocity;

		public static float MaxLockOnAngle;

		public static float MaxDistance;

		public static float LaunchHorizontalSpeedMultiplier;

		public static string PuntSound;

		[NonSerialized]
		public GameObject Punter;

		[NonSerialized]
		public Ray AimRay;

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

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			Punter = reader.ReadGameObject();
			AimRay = reader.ReadRay();
		}

		public override void OnEnter()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0068: 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_0076: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f1: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01e4: Expected O, but got Unknown
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = true;
			}
			((BaseState)this).OnEnter();
			if (((EntityState)this).isAuthority)
			{
				CharacterBody val = (Object.op_Implicit((Object)(object)Punter) ? Punter.GetComponent<CharacterBody>() : null);
				BullseyeSearch val2 = new BullseyeSearch
				{
					searchOrigin = ((Ray)(ref AimRay)).origin,
					searchDirection = ((Ray)(ref AimRay)).direction,
					viewer = val,
					filterByLoS = true,
					filterByDistinctEntity = true,
					maxAngleFilter = MaxLockOnAngle,
					maxDistanceFilter = MaxDistance,
					sortMode = (SortMode)2,
					queryTriggerInteraction = (QueryTriggerInteraction)1,
					teamMaskFilter = TeamMask.GetEnemyTeams(TeamComponent.GetObjectTeam(Punter))
				};
				val2.RefreshCandidates();
				IPhysMotor val3 = null;
				if (Object.op_Implicit((Object)(object)val))
				{
					IPhysMotor obj;
					if (!Object.op_Implicit((Object)(object)val.characterMotor))
					{
						obj = ((Component)val).GetComponent<IPhysMotor>();
					}
					else
					{
						IPhysMotor characterMotor = (IPhysMotor)(object)val.characterMotor;
						obj = characterMotor;
					}
					val3 = obj;
				}
				Vector3 val4 = Vector3.zero;
				if (val3 != null)
				{
					val4 = val3.velocity;
				}
				Vector3 val5 = val4;
				val5.y = 0f;
				float num = ((Vector3)(ref val5)).magnitude + BaseVelocity + base.moveSpeedStat * LaunchHorizontalSpeedMultiplier;
				Vector3 force = ((Ray)(ref AimRay)).direction * num;
				using (IEnumerator<HurtBox> enumerator = val2.GetResults().GetEnumerator())
				{
					if (enumerator.MoveNext())
					{
						HurtBox current = enumerator.Current;
						force = Trajectory.CalculateInitialVelocityFromHSpeed(((EntityState)this).transform.position, ((Component)current).transform.position, num, 0f, float.PositiveInfinity);
					}
				}
				CharacterMotor characterMotor2 = ((EntityState)this).characterMotor;
				PhysForceInfo val6 = new PhysForceInfo
				{
					force = force
				};
				((PhysForceInfo)(ref val6)).massIsOne = true;
				((PhysForceInfo)(ref val6)).disableAirControlUntilCollision = true;
				((PhysForceInfo)(ref val6)).resetVelocity = true;
				((PhysForceInfo)(ref val6)).ignoreGroundStick = true;
				characterMotor2.ApplyForceImpulse(ref val6);
				((EntityState)this).characterMotor.onMovementHit += new MovementHitDelegate(onMovementHit);
			}
			Util.PlaySound(PuntSound, ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			((EntityState)this).OnExit();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = false;
				((EntityState)this).characterMotor.onMovementHit -= new MovementHitDelegate(onMovementHit);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.isSprinting = true;
			}
		}

		private void onMovementHit(ref MovementHitInfo movementHitInfo)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).outer.SetNextState((EntityState)(object)new FriendUnitPuntImpact
			{
				Punter = Punter,
				ImpactPoint = movementHitInfo.hitPoint,
				ImpactNormal = movementHitInfo.hitNormal,
				ImpactVelocity = movementHitInfo.velocity,
				DamageMultiplierFromSpeed = Mathf.Max(1f, ((Vector3)(ref movementHitInfo.velocity)).magnitude / base.moveSpeedStat)
			});
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public sealed class FriendUnitPuntImpact : BaseState
	{
		private static EffectIndex _explosionEffectIndex = (EffectIndex)(-1);

		public static float ImpactBounciness;

		public static string ImpactSoundString;

		public static float ReturnVelocityMaxAngleDelta;

		public static float ReturnVelocityMaxMagnitudeMultiplier = 1f;

		[NonSerialized]
		public GameObject Punter;

		[NonSerialized]
		public Vector3 ImpactPoint;

		[NonSerialized]
		public Vector3 ImpactNormal;

		[NonSerialized]
		public Vector3 ImpactVelocity;

		[NonSerialized]
		public float DamageMultiplierFromSpeed;

		[SystemInitializer(new Type[] { typeof(EffectCatalogUtils) })]
		private static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			_explosionEffectIndex = EffectCatalogUtils.FindEffectIndex("OmniExplosionVFXRoboBallDeath");
			if ((int)_explosionEffectIndex == -1)
			{
				Log.Error("Failed to find explosion effect index", "E:\\Git\\RoR2\\ItemQualities\\ItemQualities\\Assets\\ItemQualities\\Scripts\\EntityStates\\FriendUnit\\FriendUnitPuntImpact.cs", "Init", 21);
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			writer.Write(Punter);
			writer.Write(ImpactPoint);
			writer.Write(ImpactNormal);
			writer.Write(ImpactVelocity);
			writer.Write(DamageMultiplierFromSpeed);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			Punter = reader.ReadGameObject();
			ImpactPoint = reader.ReadVector3();
			ImpactNormal = reader.ReadVector3();
			ImpactVelocity = reader.ReadVector3();
			DamageMultiplierFromSpeed = reader.ReadSingle();
		}

		public override void OnEnter()
		{
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: 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)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01dd: 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_01e9: Invalid c