Decompiled source of RalseiSurvivor v1.0.1

plugins/RalseiMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.Bandit2;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.GummyClone;
using EntityStates.Loader;
using EntityStates.MeridianEvent;
using EntityStates.Missions.BrotherEncounter;
using EntityStates.RoboBallBoss.Weapon;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.EntityStates.MeridianEvent;
using On.EntityStates.Missions.BrotherEncounter;
using On.RoR2;
using R2API;
using R2API.Utils;
using RalseiMod.Characters;
using RalseiMod.Modules;
using RalseiMod.Modules.Achievements;
using RalseiMod.Modules.BaseStates;
using RalseiMod.Skills;
using RalseiMod.Skills.Dummy;
using RalseiMod.Skills.Ralsei;
using RalseiMod.Skills.SkillDefTypes;
using RalseiMod.States.Dummy;
using RalseiMod.States.Ralsei;
using RalseiMod.States.Ralsei.Weapon;
using RalseiMod.Survivors;
using RalseiMod.Survivors.Ralsei;
using RalseiMod.Survivors.Ralsei.Components;
using RoR2;
using RoR2.Achievements;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.HudOverlay;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using Ror2AggroTools;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RalseiMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RalseiMod")]
[assembly: AssemblyTitle("RalseiMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RalseiMod
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static string Combine(params string[] parameters)
		{
			string text = "RalseiMod : ";
			foreach (string text2 in parameters)
			{
				text = text + text2 + " : ";
			}
			return text;
		}

		internal static void Debug(object data)
		{
			if (RalseiPlugin.enableDebugging)
			{
				_logSource.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void ErrorAssetBundle(string assetName, string bundleName)
		{
			Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "DeployableAPI", "LanguageAPI", "LoadoutAPI", "PrefabAPI", "DamageAPI", "TempVisualEffectAPI", "SoundAPI" })]
	[BepInPlugin("com.GodRayProd.RalseiMod", "RalseiMod", "0.7.2")]
	public class RalseiPlugin : BaseUnityPlugin
	{
		public const string guid = "com.GodRayProd.RalseiMod";

		public const string teamName = "GodRayProd";

		public const string modName = "RalseiMod";

		public const string version = "0.7.2";

		public const string DEVELOPER_PREFIX = "GRP";

		public static RalseiPlugin instance;

		public static AssetBundle mainAssetBundle;

		public const string iconsPath = "";

		[AutoConfig("Enable Debugging", "Enable debug outputs to the log for troubleshooting purposes. Enabling this will slow down the game.", false)]
		public static bool enableDebugging;

		public static bool autoSprintLoaded => ModLoaded("com.johnedwa.RTAutoSprintEx");

		public static bool iabMissilesLoaded => ModLoaded("com.HouseOfFruits.IAmBecomeMissiles");

		public static bool ModLoaded(string modGuid)
		{
			return modGuid != "" && Chainloader.PluginInfos.ContainsKey(modGuid);
		}

		private void Awake()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			mainAssetBundle = Assets.LoadAssetBundle("ralseibundle");
			Config.Init();
			Language.Init();
			ConfigManager.HandleConfigAttributes(((object)this).GetType(), "Ralsei", Config.MyConfig);
			TeleporterInteraction.onTeleporterBeginChargingGlobal += WarpMinionsTp;
			Phase1.FixedUpdate += new hook_FixedUpdate(WarpMinionsBrother);
			Phase1.FixedUpdate += new hook_FixedUpdate(WarpMinionsSon);
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			new Dummy().Init();
			BeginInitializing<SurvivorBase>(types);
			Language.TryPrintOutput("RalseiSurvivor.txt");
			BeginInitializing<SkillBase>(types);
			Language.TryPrintOutput("RalseiSkills.txt");
			SurvivorBase<RalseiSurvivor>.instance.InitializeCharacterMaster();
			CharacterBase<Dummy>.instance.InitializeCharacterMaster();
			new ContentPacks().Initialize();
		}

		private void WarpMinionsSon(orig_FixedUpdate orig, Phase1 self)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if (!self.spawnedEntryFX && ((EntityState)self).fixedAge > ((FSBFEncounterBaseState)self).meridianEventTriggerInteraction.additionalEntryVFXDelay + ((FSBFPhaseBaseState)self).durationBeforeEnablingCombatEncounter)
			{
				Vector3 position = ((FSBFEncounterBaseState)self).meridianEventTriggerInteraction.falseSonEntryFXPosition.position;
				RalseiRecallComponent[] warpTargets = RalseiRecallComponent.GetWarpTargets(position, 0f);
				int num = warpTargets.Length;
				Log.Warning(num);
				int num2 = 0;
				RalseiRecallComponent[] array = warpTargets;
				Vector3 val = default(Vector3);
				foreach (RalseiRecallComponent ralseiRecallComponent in array)
				{
					float num3 = 25f;
					float num4 = MathF.PI * 2f / (float)num;
					((Vector3)(ref val))..ctor(Mathf.Cos(num4 * (float)num2) * num3, 0.25f, Mathf.Sin(num4 * (float)num2) * num3);
					num2++;
					Vector3 val2 = position + val;
					CharacterBody body = ralseiRecallComponent.master.GetBody();
					TeleportHelper.TeleportBody(body, val2);
				}
			}
			orig.Invoke(self);
		}

		private void WarpMinionsBrother(orig_FixedUpdate orig, Phase1 self)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)self).fixedAge + Time.fixedDeltaTime > Phase1.prespawnSoundDelay && !self.hasPlayedPrespawnSound)
			{
				Vector3 position = ((Component)((BrotherEncounterBaseState)self).childLocator.FindChild("CenterOrbEffect")).transform.position;
				RalseiRecallComponent[] warpTargets = RalseiRecallComponent.GetWarpTargets(position, 0f);
				int num = warpTargets.Length;
				Log.Warning(num);
				int num2 = 0;
				RalseiRecallComponent[] array = warpTargets;
				Vector3 val = default(Vector3);
				foreach (RalseiRecallComponent ralseiRecallComponent in array)
				{
					float num3 = 25f;
					float num4 = MathF.PI * 2f / (float)num;
					((Vector3)(ref val))..ctor(Mathf.Cos(num4 * (float)num2) * num3, 0.25f, Mathf.Sin(num4 * (float)num2) * num3);
					num2++;
					Vector3 val2 = position + val;
					CharacterBody body = ralseiRecallComponent.master.GetBody();
					TeleportHelper.TeleportBody(body, val2);
				}
			}
			orig.Invoke(self);
		}

		private void WarpMinionsTp(TeleporterInteraction tp)
		{
			//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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			RalseiRecallComponent[] warpTargets = RalseiRecallComponent.GetWarpTargets(tp);
			int num = warpTargets.Length;
			int num2 = 0;
			RalseiRecallComponent[] array = warpTargets;
			Vector3 val = default(Vector3);
			foreach (RalseiRecallComponent ralseiRecallComponent in array)
			{
				float num3 = 8.5f;
				float num4 = MathF.PI * 2f / (float)num;
				((Vector3)(ref val))..ctor(Mathf.Cos(num4 * (float)num2) * num3, 0.25f, Mathf.Sin(num4 * (float)num2) * num3);
				num2++;
				Vector3 val2 = ((Component)tp).transform.position + val;
				CharacterBody body = ralseiRecallComponent.master.GetBody();
				TeleportHelper.TeleportBody(body, val2);
			}
		}

		private void BeginInitializing<T>(Type[] allTypes) where T : SharedBase
		{
			Type baseType = typeof(T);
			if (!baseType.IsAbstract)
			{
				Log.Error(Log.Combine() + "Incorrect BaseType: " + baseType.Name);
				return;
			}
			Log.Debug(Log.Combine(baseType.Name) + "Initializing");
			IEnumerable<Type> enumerable = allTypes.Where((Type type) => !type.IsAbstract && type.IsSubclassOf(baseType));
			foreach (Type item in enumerable)
			{
				string text = Log.Combine(baseType.Name, item.Name);
				Log.Debug(text);
				T obj = (T)Activator.CreateInstance(item);
				if (ValidateBaseType(obj))
				{
					Log.Debug(text + "Validated");
					InitializeBaseType(obj);
					Log.Debug(text + "Initialized");
				}
			}
		}

		private bool ValidateBaseType(SharedBase obj)
		{
			return obj.isEnabled;
		}

		private void InitializeBaseType(SharedBase obj)
		{
			obj.Init();
		}
	}
}
namespace RalseiMod.States.Ralsei
{
	internal class HoverState : GenericCharacterMain
	{
		public override void OnEnter()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			((GenericCharacterMain)this).OnEnter();
			Aggro.ShedAggroFromCharacter(((EntityState)this).characterBody);
			((EntityState)this).skillLocator.utility.SetSkillOverride((object)this, SkillBase<CancelHoverSkill>.instance.SkillDef, (SkillOverridePriority)4);
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.AddBuff(LiftPrayer.hoverBuff);
				((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(CharacterMotor_onHitGroundAuthority);
			}
		}

		private void CharacterMotor_onHitGroundAuthority(ref HitGroundInfo hitGroundInfo)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}

		public override void FixedUpdate()
		{
			//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)
			((GenericCharacterMain)this).FixedUpdate();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (((ButtonState)(ref ((EntityState)this).inputBank.skill3)).justReleased)
			{
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			float y = ((EntityState)this).characterMotor.velocity.y;
			if (y < 0f)
			{
				y = Mathf.MoveTowards(y, LiftPrayer.hoverVelocity, LiftPrayer.hoverAcceleration * Time.fixedDeltaTime);
				((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x, y, ((EntityState)this).characterMotor.velocity.z);
			}
		}

		public override void OnExit()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			((GenericCharacterMain)this).OnExit();
			Util.PlaySound("Stop_fly_loop", ((EntityState)this).gameObject);
			((EntityState)this).skillLocator.utility.UnsetSkillOverride((object)this, SkillBase<CancelHoverSkill>.instance.SkillDef, (SkillOverridePriority)4);
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterBody.RemoveBuff(LiftPrayer.hoverBuff);
				((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(CharacterMotor_onHitGroundAuthority);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)3;
		}
	}
	internal class LiftState : GenericCharacterMain
	{
		private float liftRateMin;

		private float liftRateMax;

		private float duration;

		private static bool useMoveSpeed => LiftPrayer.useMoveSpeed;

		public override void OnEnter()
		{
			liftRateMin = LiftPrayer.liftSpeedMin * ((BaseState)this).attackSpeedStat;
			liftRateMax = LiftPrayer.liftSpeedMax * ((BaseState)this).attackSpeedStat;
			duration = LiftPrayer.liftDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).characterBody.AddBuff(LiftPrayer.hoverBuff);
			Util.PlaySound("Play_fly_hop", ((EntityState)this).gameObject);
			Util.PlaySound("Play_fly_loop", ((EntityState)this).gameObject);
			((GenericCharacterMain)this).OnEnter();
		}

		public override void FixedUpdate()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterMain)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				}
				float liftVelocity = GetLiftVelocity();
				((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x, liftVelocity, ((EntityState)this).characterMotor.velocity.z);
			}
			if (((EntityState)this).fixedAge >= LiftPrayer.liftDuration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new HoverState());
			}
		}

		public override void OnExit()
		{
			((GenericCharacterMain)this).OnExit();
			((EntityState)this).characterBody.RemoveBuff(LiftPrayer.hoverBuff);
		}

		private float GetLiftVelocity()
		{
			AnimationCurve val = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
			float num = ((EntityState)this).fixedAge / duration;
			float num2 = Util.Remap(val.Evaluate(num), 0f, 1f, liftRateMin, liftRateMax);
			if (useMoveSpeed)
			{
				return num2 * ((BaseState)this).moveSpeedStat;
			}
			return num2 * 8f;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)3;
		}
	}
	internal class RalseiDeathState : GenericCharacterDeath
	{
		public override void OnEnter()
		{
			((GenericCharacterDeath)this).OnEnter();
		}

		public override void CreateDeathEffects()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!((GenericCharacterDeath)this).isBrittle)
			{
				EffectManager.SimpleEffect(HenryAssets.sillyExplosionEffect, ((EntityState)this).transform.position, ((EntityState)this).transform.rotation, false);
			}
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
			((GenericCharacterDeath)this).DestroyModel();
		}

		public override void PlayDeathSound()
		{
			if (!((GenericCharacterDeath)this).isBrittle)
			{
				AkSoundEngine.PostEvent(AkSoundEngine.GetIDFromString("SillyExplosionSound"), ((EntityState)this).gameObject);
			}
		}
	}
}
namespace RalseiMod.States.Ralsei.Weapon
{
	internal class AimGuardSpell : SpellBombBaseState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			Util.PlaySound("Play_gloom_effect_loop", ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			base.OnExit();
			Util.PlaySound("Stop_gloom_effect_loop", ((EntityState)this).gameObject);
		}

		internal override float GetCastTime()
		{
			return ProtectSpell.minCastTime;
		}

		internal override float GetEffectRange()
		{
			return ProtectSpell.effectRange;
		}

		internal override float GetMaxDistance()
		{
			return 100f;
		}

		internal override GameObject GetProjectilePrefab()
		{
			return ProtectSpell.loveBomb;
		}
	}
	internal class AimHealSpell : SpellBombBaseState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			Util.PlaySound("Play_gloom_effect_loop", ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			base.OnExit();
			Util.PlaySound("Stop_gloom_effect_loop", ((EntityState)this).gameObject);
		}

		internal override float GetCastTime()
		{
			return HealSpell.minCastTime;
		}

		internal override float GetEffectRange()
		{
			return HealSpell.healRange;
		}

		internal override float GetMaxDistance()
		{
			return 100f;
		}

		internal override GameObject GetProjectilePrefab()
		{
			return HealSpell.loveBomb;
		}
	}
	internal class CastEncourageSpell : SpellBombBaseState
	{
		internal override float GetCastTime()
		{
			return HealSpell.minCastTime;
		}

		internal override float GetEffectRange()
		{
			return 15f;
		}

		internal override float GetMaxDistance()
		{
			return 100f;
		}

		internal override GameObject GetProjectilePrefab()
		{
			return Pacify.encourageProjectilePrefab;
		}

		public override void OnEnter()
		{
			base.OnEnter();
		}
	}
	internal class CastPacifySpell : BaseSkillState
	{
		public static List<string> pacifyBodyNameWhitelist = new List<string> { "UNIDENTIFIED", "AFFIXEARTH_HEALER_BODY_NAME", "URCHINTURRET_BODY_NAME" };

		public HurtBox target;

		public float baseDuration = 1f;

		private float duration;

		public static bool IsTargetPacifiable(HurtBox hurtBox)
		{
			return IsCharacterPacifiable(hurtBox.healthComponent?.body);
		}

		public static bool IsCharacterPacifiable(CharacterBody body)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null)
			{
				return false;
			}
			if (pacifyBodyNameWhitelist.Contains(body.baseNameToken) || ((Enum)body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)4))
			{
				return false;
			}
			return true;
		}

		public static bool IsCharacterSparable(CharacterBody body)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null)
			{
				return false;
			}
			if (body.isPlayerControlled)
			{
				return false;
			}
			if (body.isBoss)
			{
				Inventory inventory = body.inventory;
				if (inventory != null && inventory.GetItemCount(Items.InvadingDoppelganger) > 0)
				{
					return true;
				}
				return false;
			}
			if (body.isChampion && !Pacify.championsPacifiable)
			{
				return false;
			}
			if (((Enum)body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)16))
			{
				return false;
			}
			return true;
		}

		public static bool IsCharacterPacifiableAndSparable(CharacterBody body)
		{
			return Object.op_Implicit((Object)(object)body) && IsCharacterPacifiable(body) && IsCharacterSparable(body);
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(target));
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//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)
			((BaseSkillState)this).OnDeserialize(reader);
			HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader);
			target = ((HurtBoxReference)(ref val)).ResolveHurtBox();
		}

		public override void OnEnter()
		{
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).PlayAnimation("Gesture, Override", "CastSpellSpecial", "SpellSpecial.playbackRate", duration, 0f);
			CastToTargetServer(target);
			((BaseState)this).OnEnter();
		}

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

		public override void OnExit()
		{
			Util.PlaySound("Stop_R_cast_loop", ((EntityState)this).gameObject);
			((EntityState)this).OnExit();
		}

		public bool CastToTargetServer(HurtBox hurtBox)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Invalid comparison between Unknown and I4
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)hurtBox))
			{
				return false;
			}
			HealthComponent healthComponent = hurtBox.healthComponent;
			if (!Object.op_Implicit((Object)(object)healthComponent) || !healthComponent.alive)
			{
				return false;
			}
			if (NetworkServer.active)
			{
				CharacterBody body = healthComponent.body;
				if ((Object)(object)body != (Object)null)
				{
					EffectManager.SpawnEffect(StealthMode.smokeBombEffectPrefab, new EffectData
					{
						origin = body.footPosition
					}, true);
					if (IsCharacterSparable(body))
					{
						CharacterBody val = SpareAndRecruitEnemyMinion(hurtBox.healthComponent, body, ((EntityState)this).characterBody);
						if (Object.op_Implicit((Object)(object)val))
						{
							if (val.bodyIndex != BodyCatalog.FindBodyIndex("ScavBody") && val.inventory.GetItemCount(Items.InvadingDoppelganger) <= 0)
							{
								val.inventory.CopyItemsFrom(((EntityState)this).characterBody.inventory, (Func<ItemIndex, bool>)CopyItemFilter);
								foreach (ItemIndex item in ((EntityState)this).characterBody.inventory.itemAcquisitionOrder)
								{
									ItemDef itemDef = ItemCatalog.GetItemDef(item);
									if (!itemDef.hidden && (int)itemDef.tier != 5)
									{
										Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
										HurtBox mainHurtBox = val.mainHurtBox;
										ItemTransferOrb.DispatchItemTransferOrb(corePosition, (Inventory)null, item, 0, (Action<ItemTransferOrb>)null, Either<NetworkIdentity, HurtBox>.op_Implicit(ref mainHurtBox));
									}
								}
								if (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.MonsterTeamGainsItems))
								{
									val.inventory.AddItemsFrom(MonsterTeamGainsItemsArtifactManager.monsterTeamInventory, (Func<ItemIndex, bool>)CopyItemFilter);
								}
							}
							ReplaceMinionAI(val);
							EmpowerAndStunMinion(val);
							Util.PlaySound("Play_R_cast_start", ((EntityState)this).gameObject);
							Util.PlaySound("Play_R_target_hit", ((EntityState)this).gameObject);
							if (Pacify.swarmsDuplicate && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Swarms))
							{
								CharacterBody val2 = RespawnEnemyMinion(val.healthComponent, val, ((EntityState)this).characterBody);
								if (Object.op_Implicit((Object)(object)val2))
								{
									EmpowerAndStunMinion(val2);
									val2.inventory.CopyItemsFrom(val.inventory, (Func<ItemIndex, bool>)CopyItemFilter);
								}
							}
						}
						else
						{
							Log.Error("Ralsei Pacify failed to empower its target!");
						}
						return true;
					}
					body.AddTimedBuff(RalseiSurvivor.fatigueDebuff.buffIndex, Pacify.fatigueDuration);
					Aggro.AggroMinionsToEnemy(((EntityState)this).characterBody, body, true);
					return true;
				}
			}
			return false;
		}

		private static bool CopyItemFilter(ItemIndex itemIndex)
		{
			//IL_0001: 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_0016: 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_0053: Invalid comparison between Unknown and I4
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Invalid comparison between Unknown and I4
			if (itemIndex == Items.AutoCastEquipment.itemIndex)
			{
				return false;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex);
			return Object.op_Implicit((Object)(object)itemDef) && !itemDef.ContainsTag((ItemTag)4) && !itemDef.ContainsTag((ItemTag)11) && !itemDef.ContainsTag((ItemTag)13) && !itemDef.ContainsTag((ItemTag)17) && ((int)itemDef.tier == 4 || (int)itemDef.tier == 3 || (int)itemDef.tier == 0 || (int)itemDef.tier == 6);
		}

		private void EmpowerAndStunMinion(CharacterBody body)
		{
			RalseiSurvivor.EmpowerCharacter(body);
			if (Pacify.convertDelay > 0f)
			{
				SetStateOnHurt component = ((Component)body).GetComponent<SetStateOnHurt>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.SetStun(Pacify.convertDelay);
					body.AddTimedBuff(Buffs.HiddenInvincibility, Pacify.convertDelay);
					body.AddTimedBuff(Buffs.Cloak, Pacify.convertDelay);
					body.AddTimedBuff(Buffs.Nullified, Pacify.convertDelay);
				}
			}
		}

		private static void ReplaceMinionAI(CharacterBody b)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_00a5: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (b.isChampion && Object.op_Implicit((Object)(object)b.inventory))
			{
				b.inventory.GiveItem(Items.HealthDecay, Pacify.championDecayTime);
			}
			b.masterObject.AddComponent<RalseiRecallComponent>();
			b.bodyFlags = (BodyFlags)(b.bodyFlags | 0x40);
			if (Object.op_Implicit((Object)(object)b.inventory))
			{
			}
			CharacterMaster master2 = b.master;
			if ((Object)(object)b.characterMotor != (Object)null)
			{
				AISkillDriver val = ((Component)master2).gameObject.AddComponent<AISkillDriver>();
				val.customName = "ReturnToLeader";
				val.skillSlot = (SkillSlot)(-1);
				val.minDistance = Pacify.minionFollowRange;
				val.moveTargetType = (TargetType)2;
				val.movementType = (MovementType)1;
				val.aimType = (AimType)2;
				val.shouldSprint = true;
				val.buttonPressType = (ButtonPressType)0;
				val.driverUpdateTimerOverride = 3f;
				val.resetCurrentEnemyOnNextDriverSelection = true;
				InsertFollowDriver(master2, val);
			}
			static void InsertFollowDriver(CharacterMaster master, AISkillDriver followDriver)
			{
				BaseAI val2 = master.aiComponents[0];
				List<AISkillDriver> list = new List<AISkillDriver> { followDriver };
				AISkillDriver[] skillDrivers = val2.skillDrivers;
				foreach (AISkillDriver item in skillDrivers)
				{
					list.Add(item);
				}
				val2.skillDrivers = list.ToArray();
			}
		}

		public static CharacterBody RespawnEnemyMinion(HealthComponent victimHealthComponent, CharacterBody victimBody, CharacterBody ownerBody)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a7: Expected O, but got Unknown
			//IL_00d4: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimHealthComponent))
			{
				return null;
			}
			GameObject bodyPrefab = BodyCatalog.FindBodyPrefab(victimBody);
			if (!Object.op_Implicit((Object)(object)bodyPrefab))
			{
				return null;
			}
			CharacterMaster val = MasterCatalog.allAiMasters.FirstOrDefault((Func<CharacterMaster, bool>)((CharacterMaster master) => (Object)(object)master.bodyPrefab == (Object)(object)bodyPrefab));
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			MasterSummon val2 = new MasterSummon
			{
				masterPrefab = ((Component)val).gameObject,
				ignoreTeamMemberLimit = false,
				position = victimBody.footPosition
			};
			CharacterDirection component = ((Component)victimBody).GetComponent<CharacterDirection>();
			val2.rotation = (Object.op_Implicit((Object)(object)component) ? Quaternion.Euler(0f, component.yaw, 0f) : victimBody.transform.rotation);
			val2.summonerBodyObject = (Object.op_Implicit((Object)(object)ownerBody) ? ((Component)ownerBody).gameObject : null);
			val2.inventoryToCopy = victimBody.inventory;
			val2.useAmbientLevel = Pacify.useAmbientLevel;
			val2.preSpawnSetupCallback = (Action<CharacterMaster>)Delegate.Combine(val2.preSpawnSetupCallback, new Action<CharacterMaster>(PreSpawnSetup));
			CharacterMaster val3 = val2.Perform();
			if (!Object.op_Implicit((Object)(object)val3))
			{
				return null;
			}
			Deployable val4 = ((Component)val3).gameObject.AddComponent<Deployable>();
			val4.onUndeploy = new UnityEvent();
			val4.onUndeploy.AddListener(new UnityAction(val3.TrueKill));
			ownerBody.master.AddDeployable(val4, Pacify.pacifyDeployableSlot);
			CharacterBody body = val3.GetBody();
			if (Object.op_Implicit((Object)(object)body))
			{
				if (body.isBoss)
				{
					List<CombatSquad> instancesList = InstanceTracker.GetInstancesList<CombatSquad>();
					foreach (CombatSquad item in instancesList)
					{
						int num = item.membersList.IndexOf(val);
						if (num >= 0)
						{
							item.RemoveMemberAt(num);
							if (!item.defeatedServer && item.membersList.Count == 0)
							{
								item.TriggerDefeat();
							}
							break;
						}
					}
				}
				EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>();
				EntityStateMachine[] array = components;
				foreach (EntityStateMachine val5 in array)
				{
					val5.initialStateType = val5.mainStateType;
				}
			}
			return body;
			static void PreSpawnSetup(CharacterMaster newMaster)
			{
			}
		}

		public static CharacterBody SpareAndRecruitEnemyMinion(HealthComponent victimHealthComponent, CharacterBody victimBody, CharacterBody ownerBody)
		{
			//IL_0050: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimHealthComponent))
			{
				return null;
			}
			Util.CleanseBody(victimBody, true, false, true, true, false, false);
			victimBody.master.isBoss = false;
			bool flag = false;
			CharacterMaster master = victimBody.master;
			master.teamIndex = ownerBody.teamComponent.teamIndex;
			victimBody.teamComponent.teamIndex = ownerBody.teamComponent.teamIndex;
			BaseAI component = ((Component)master).GetComponent<BaseAI>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.enemyAttention = 0f;
				component.ForceAcquireNearestEnemyIfNoCurrentEnemy();
				component.currentEnemy.Reset();
				Aggro.ShedAggroFromCharacter(victimBody);
			}
			AIOwnership component2 = ((Component)master).gameObject.GetComponent<AIOwnership>();
			if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)ownerBody.master))
			{
				component2.ownerMaster = ownerBody.master;
			}
			if (Object.op_Implicit((Object)(object)component))
			{
				component.leader.gameObject = ((Component)ownerBody).gameObject;
			}
			Deployable val = ((Component)master).gameObject.AddComponent<Deployable>();
			val.onUndeploy = new UnityEvent();
			val.onUndeploy.AddListener(new UnityAction(master.TrueKill));
			ownerBody.master.AddDeployable(val, Pacify.pacifyDeployableSlot);
			return victimBody;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)0;
		}
	}
	public abstract class EmpowerSpellBaseState : BaseSkillState
	{
		public GameObject spellLightingEffectInstance;

		private OverlayController overlayController;

		private Animator animator;

		public static float stackInterval = 0.125f;

		public static GameObject crosshairOverridePrefab = Pacify.crosshairOverridePrefab;

		public static string enterSoundString = Paint.enterSoundString;

		public static string exitSoundString = Paint.exitSoundString;

		public static string loopSoundString = Paint.loopSoundString;

		public static string lockOnSoundString = Paint.lockOnSoundString;

		public static string stopLoopSoundString = Paint.stopLoopSoundString;

		public static float maxAngle = Paint.maxAngle * 0.75f;

		public static float maxDistance = Paint.maxDistance;

		internal HurtBox currentTarget;

		private Indicator targetIndicator;

		private SkillDef confirmTargetDummySkillDef;

		private SkillDef cancelTargetingDummySkillDef;

		private float stackStopwatch;

		private OverrideRequest crosshairOverrideRequest;

		private BullseyeSearch targetFinder;

		private bool queuedFiringState;

		private uint loopSoundID;

		private bool releasedKeyOnce = false;

		public GameObject scopeOverlayprefab => Pacify.pacifyTargetingOverlayPrefab;

		public abstract float maxHealthFraction { get; }

		public abstract bool useFriendlyTeam { get; }

		public abstract GameObject indicatorPrefab { get; }

		public override void OnEnter()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_008f: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			targetFinder = new BullseyeSearch();
			ConfigureTargetFinder();
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("Gesture, Override", "PrepareSpellEntry", "SpellSecondary.playbackRate", 0.5f / ((BaseState)this).attackSpeedStat, 0f);
			animator.SetBool("spellReady", true);
			Util.PlaySound(enterSoundString, ((EntityState)this).gameObject);
			loopSoundID = Util.PlaySound(loopSoundString, ((EntityState)this).gameObject);
			overlayController = HudOverlayManager.AddOverlay(((EntityState)this).gameObject, new OverlayCreationParams
			{
				prefab = scopeOverlayprefab,
				childLocatorEntry = "ScopeContainer"
			});
			if (Object.op_Implicit((Object)(object)crosshairOverridePrefab))
			{
				crosshairOverrideRequest = CrosshairUtils.RequestOverrideForBody(((EntityState)this).characterBody, crosshairOverridePrefab, (OverridePriority)1);
			}
			targetIndicator = new Indicator(((EntityState)this).gameObject, indicatorPrefab);
			confirmTargetDummySkillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("EngiConfirmTargetDummy"));
			cancelTargetingDummySkillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("EngiCancelTargetingDummy"));
			((EntityState)this).skillLocator.primary.SetSkillOverride((object)this, confirmTargetDummySkillDef, (SkillOverridePriority)4);
			((EntityState)this).skillLocator.secondary.SetSkillOverride((object)this, cancelTargetingDummySkillDef, (SkillOverridePriority)4);
		}

		private void ConfigureTargetFinder()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//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_009f: Unknown result type (might be due to invalid IL or missing references)
			targetFinder.filterByDistinctEntity = true;
			targetFinder.filterByLoS = true;
			targetFinder.minDistanceFilter = 0f;
			targetFinder.maxDistanceFilter = maxDistance;
			targetFinder.minAngleFilter = 0f;
			targetFinder.maxAngleFilter = maxAngle;
			targetFinder.viewer = ((EntityState)this).characterBody;
			targetFinder.sortMode = (SortMode)3;
			if (useFriendlyTeam)
			{
				targetFinder.teamMaskFilter = TeamMask.none;
				((TeamMask)(ref targetFinder.teamMaskFilter)).AddTeam(((BaseState)this).GetTeam());
			}
			else
			{
				targetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(((BaseState)this).GetTeam());
			}
		}

		private HurtBox GetCurrentTargetInfo()
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			targetFinder.searchOrigin = ((Ray)(ref aimRay)).origin;
			targetFinder.searchDirection = ((Ray)(ref aimRay)).direction;
			targetFinder.RefreshCandidates();
			targetFinder.FilterOutGameObject(((EntityState)this).gameObject);
			foreach (HurtBox result in targetFinder.GetResults())
			{
				HealthComponent healthComponent = result.healthComponent;
				if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive && healthComponent.combinedHealthFraction <= maxHealthFraction && CastPacifySpell.IsCharacterPacifiable(healthComponent.body))
				{
					return result;
				}
			}
			return null;
		}

		protected void SetScopeAlpha(float alpha)
		{
			if (overlayController != null)
			{
				overlayController.alpha = alpha;
			}
		}

		protected void RemoveOverlay(float transitionDuration)
		{
			if (overlayController != null)
			{
				HudOverlayManager.RemoveOverlay(overlayController);
				overlayController = null;
			}
		}

		public override void OnExit()
		{
			if (((EntityState)this).isAuthority && !((EntityState)this).outer.destroying && !queuedFiringState)
			{
				((BaseSkillState)this).activatorSkillSlot.ApplyAmmoPack();
			}
			Util.PlaySound(exitSoundString, ((EntityState)this).gameObject);
			Util.PlaySound(stopLoopSoundString, ((EntityState)this).gameObject);
			RemoveOverlay(0f);
			if (Object.op_Implicit((Object)(object)spellLightingEffectInstance))
			{
				animator.SetBool("spellReady", false);
			}
			((EntityState)this).PlayCrossfade("Gesture, Override", "PrepareSpellCancel", "SpellSpecial.playbackRate", 0.73f / ((BaseState)this).attackSpeedStat, 0.1f / ((BaseState)this).attackSpeedStat);
			((EntityState)this).skillLocator.secondary.UnsetSkillOverride((object)this, cancelTargetingDummySkillDef, (SkillOverridePriority)4);
			((EntityState)this).skillLocator.primary.UnsetSkillOverride((object)this, confirmTargetDummySkillDef, (SkillOverridePriority)4);
			OverrideRequest val = crosshairOverrideRequest;
			if (val != null)
			{
				val.Dispose();
			}
			targetIndicator.active = false;
			targetIndicator.targetTransform = null;
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			bool justReleased = ((ButtonState)(ref ((EntityState)this).inputBank.skill1)).justReleased;
			bool justReleased2 = ((ButtonState)(ref ((EntityState)this).inputBank.skill2)).justReleased;
			bool justReleased3 = ((ButtonState)(ref ((EntityState)this).inputBank.skill4)).justReleased;
			bool flag = false;
			if (justReleased)
			{
				flag = true;
			}
			if (justReleased3)
			{
				if (releasedKeyOnce)
				{
					flag = true;
				}
				releasedKeyOnce = true;
			}
			if (flag && (Object)(object)currentTarget != (Object)null)
			{
				queuedFiringState = true;
				((EntityState)this).outer.SetNextState(GetNextState());
			}
			else if (flag || justReleased2)
			{
				queuedFiringState = false;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			if (((EntityState)this).isAuthority)
			{
				SetTarget(GetCurrentTargetInfo());
			}
		}

		private void SetTarget(HurtBox hb)
		{
			if ((Object)(object)currentTarget != (Object)(object)hb)
			{
				currentTarget = hb;
				bool flag = (Object)(object)currentTarget != (Object)null;
				targetIndicator.active = flag;
				targetIndicator.targetTransform = (flag ? ((Component)currentTarget).transform : null);
				if ((Object)(object)hb != (Object)null)
				{
					Util.PlaySound(lockOnSoundString, ((EntityState)this).gameObject);
				}
			}
		}

		public abstract EntityState GetNextState();

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)3;
		}
	}
	internal class GrappleChuck : BaseSkillState
	{
	}
	internal class PreparePacifySpell : EmpowerSpellBaseState
	{
		public override float maxHealthFraction => 0.5f;

		public override bool useFriendlyTeam => false;

		public override GameObject indicatorPrefab => LegacyResourcesAPI.Load<GameObject>("Prefabs/WoodSpriteIndicator");

		public override void OnEnter()
		{
			base.OnEnter();
			SetScopeAlpha(0f);
			Util.PlaySound("Play_R_cast_start", ((EntityState)this).gameObject);
			Util.PlaySound("Play_R_cast_loop", ((EntityState)this).gameObject);
		}

		public override void Update()
		{
			base.Update();
			SetScopeAlpha(Mathf.Clamp01(((EntityState)this).age / 2f));
		}

		public override EntityState GetNextState()
		{
			return (EntityState)(object)new CastPacifySpell
			{
				target = currentTarget
			};
		}
	}
	internal abstract class ScarfAttackBaseState : BaseSkillState, IStepSetter
	{
		internal int step;

		private protected float enterDuration;

		private protected float exitDuration;

		private float stopwatch;

		internal bool fired = false;

		internal string muzzleString;

		public static float spreadBloomValue = 0.2f;

		public abstract bool isComboFinisher { get; }

		public abstract float altAnimationAttackSpeedThreshold { get; }

		public abstract float baseEnterDuration { get; }

		public abstract float baseExitDuration { get; }

		private float totalDuration => enterDuration + exitDuration;

		public abstract float damageCoefficient { get; }

		public virtual float force { get; } = 0f;


		public abstract GameObject hitEffectPrefab { get; }

		public void SetStep(int i)
		{
			step = i;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(step);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			step = reader.ReadInt32();
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			exitDuration = baseExitDuration / ((BaseState)this).attackSpeedStat;
			muzzleString = GetMuzzleName();
			if (baseEnterDuration > 0f)
			{
				enterDuration = baseEnterDuration / ((BaseState)this).attackSpeedStat;
			}
			else
			{
				TryAttack();
			}
			((EntityState)this).PlayCrossfade(GetAnimationLayer(), GetAnimationName(step), "ScarfPrimary.playbackRate", totalDuration * 1.5f, 0.1f * totalDuration);
		}

		public virtual string GetAnimationLayer()
		{
			return "Gesture, Override";
		}

		public virtual string GetAnimationName(int index)
		{
			return "Primary" + (index + 1);
		}

		public virtual string GetMuzzleName()
		{
			return "SwingCenter";
		}

		public virtual string GetAttackSoundString()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return ((BasicMeleeAttack)new LoaderMeleeAttack()).beginSwingSoundString;
		}

		public virtual string GetHitSoundString()
		{
			return "HenrySwordSwing";
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (!fired)
			{
				TryAttack();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= enterDuration && !fired)
			{
				TryAttack();
			}
			if (((EntityState)this).fixedAge >= totalDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public virtual void TryAttack()
		{
			if (!fired)
			{
				fired = true;
				Util.PlaySound(GetAttackSoundString(), ((EntityState)this).gameObject);
				if (isComboFinisher)
				{
					FireAttackCombo();
				}
				else
				{
					FireAttack();
				}
			}
		}

		public abstract void FireAttackCombo();

		public abstract void FireAttack();

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class ScarfAttackLong : ScarfAttackBaseState
	{
		public override bool isComboFinisher => step == ScarfRange.lastCombo;

		public override float baseEnterDuration => isComboFinisher ? ScarfRange.comboEntryDuration : ScarfRange.baseEntryDuration;

		public override float baseExitDuration => isComboFinisher ? ScarfRange.comboExitDuration : ScarfRange.baseExitDuration;

		public override float damageCoefficient => isComboFinisher ? ScarfRange.baseDamageFinisher : ScarfRange.baseDamage;

		public override float altAnimationAttackSpeedThreshold => 2.65f;

		public override GameObject hitEffectPrefab => ScarfRange.threadImpact;

		public override void OnEnter()
		{
			base.OnEnter();
			EffectManager.SimpleMuzzleFlash((step > 1) ? ScarfRange.swingEffectFinisher : ScarfRange.swingEffect, ((EntityState)this).gameObject, muzzleString, false);
		}

		public override string GetAnimationLayer()
		{
			if (isComboFinisher)
			{
				return "FullBody, Override";
			}
			return base.GetAnimationLayer();
		}

		public override string GetAnimationName(int index)
		{
			if (((EntityState)this).characterBody.attackSpeed >= altAnimationAttackSpeedThreshold)
			{
				return base.GetAnimationName(index % 2);
			}
			if (isComboFinisher)
			{
				return "PrimaryComboLong";
			}
			return base.GetAnimationName(index);
		}

		public override string GetMuzzleName()
		{
			if (((EntityState)this).characterBody.attackSpeed >= altAnimationAttackSpeedThreshold)
			{
				return base.GetMuzzleName();
			}
			if (step == ScarfRange.lastCombo)
			{
				return "SwingSpin";
			}
			return (step % 2 == 0) ? "SwingR" : "SwingL";
		}

		public override string GetAttackSoundString()
		{
			if (isComboFinisher)
			{
				return base.GetAttackSoundString();
			}
			return base.GetAttackSoundString();
		}

		public override string GetHitSoundString()
		{
			if (isComboFinisher)
			{
				return base.GetHitSoundString();
			}
			return base.GetHitSoundString();
		}

		public override void TryAttack()
		{
			if (!fired)
			{
				EffectManager.SimpleMuzzleFlash(isComboFinisher ? ScarfRange.muzzleFlashFinisher : ScarfRange.muzzleFlash, ((EntityState)this).gameObject, muzzleString, false);
				base.TryAttack();
			}
		}

		public override void FireAttackCombo()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (!((EntityState)this).characterMotor.isGrounded && ((EntityState)this).characterBody.HasBuff(LiftPrayer.hoverBuff))
			{
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, 7f);
			}
			float num = 2.2f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).AddRecoil(0f - num, -2f * num, 0f - num, num);
			((EntityState)this).characterBody.SetAimTimer(2f);
			if (((EntityState)this).isAuthority)
			{
				BulletAttack bulletAttack = GetBulletAttack();
				DamageAPI.AddModdedDamageType(bulletAttack, RalseiSurvivor.TangleOnHit);
				DamageAPI.AddModdedDamageType(bulletAttack, AggroToolsPlugin.AggroOnHit);
				bulletAttack.Fire();
			}
		}

		public override void FireAttack()
		{
			if (!((EntityState)this).characterMotor.isGrounded && ((EntityState)this).characterBody.HasBuff(LiftPrayer.hoverBuff))
			{
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, 7f);
			}
			float num = 0.8f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).AddRecoil(0f - num, -2f * num, 0f - num, num);
			((EntityState)this).characterBody.SetAimTimer(2f);
			if (((EntityState)this).isAuthority)
			{
				GetBulletAttack().Fire();
				if (isComboFinisher)
				{
					Util.PlaySound("Play_M1_basic_end_combo", ((EntityState)this).gameObject);
				}
				else
				{
					Util.PlaySound("Play_M1_basic", ((EntityState)this).gameObject);
				}
			}
		}

		private BulletAttack GetBulletAttack()
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			BulletAttack val = new BulletAttack();
			val.owner = ((EntityState)this).gameObject;
			val.weapon = ((EntityState)this).gameObject;
			val.origin = ((Ray)(ref aimRay)).origin;
			val.aimVector = ((Ray)(ref aimRay)).direction;
			val.minSpread = 0f;
			val.maxSpread = 0f;
			val.damage = damageCoefficient * ((BaseState)this).damageStat;
			val.force = force;
			val.tracerEffectPrefab = (isComboFinisher ? ScarfRange.tracerThreadFinisher : ScarfRange.tracerThread);
			val.muzzleName = muzzleString;
			val.hitEffectPrefab = hitEffectPrefab;
			val.isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
			val.radius = 1.2f;
			val.falloffModel = (FalloffModel)0;
			val.stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask;
			val.smartCollision = true;
			val.maxDistance = 999f;
			return val;
		}
	}
	internal class ScarfAttackShort : ScarfAttackBaseState
	{
		protected string playbackRateParam = "Slash.playbackRate";

		private bool hasHopped = false;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		protected bool inHitPause;

		private float hitPauseTimer;

		public override bool isComboFinisher => step == ScarfShort.lastCombo;

		public override float baseEnterDuration => isComboFinisher ? ScarfShort.comboEntryDuration : ScarfShort.baseEntryDuration;

		public override float baseExitDuration => isComboFinisher ? ScarfShort.comboExitDuration : ScarfShort.baseExitDuration;

		public override float damageCoefficient => isComboFinisher ? ScarfShort.baseDamageCombo : ScarfShort.baseDamage;

		public float procCoefficient => isComboFinisher ? ScarfShort.comboProcCoeff : ScarfShort.baseProcCoeff;

		public override float force => isComboFinisher ? ScarfShort.comboForce : ScarfShort.baseForce;

		public float hitstopDuration => isComboFinisher ? ScarfShort.comboHitstop : ScarfShort.baseHitstop;

		public float hitHopVelocity => isComboFinisher ? ScarfShort.comboHopStrength : ScarfShort.baseHopStrength;

		public override float altAnimationAttackSpeedThreshold => 2.65f;

		public override GameObject hitEffectPrefab => ScarfShort.slashImpactEffect;

		public override string GetAnimationLayer()
		{
			if (isComboFinisher)
			{
				return "FullBody, Override";
			}
			return base.GetAnimationLayer();
		}

		public override string GetAnimationName(int index)
		{
			if (((EntityState)this).characterBody.attackSpeed >= altAnimationAttackSpeedThreshold)
			{
				return base.GetAnimationName(index % 2);
			}
			if (isComboFinisher)
			{
				return "PrimaryComboLong";
			}
			return base.GetAnimationName(index);
		}

		public override string GetAttackSoundString()
		{
			if (isComboFinisher)
			{
				return base.GetAttackSoundString();
			}
			return base.GetAttackSoundString();
		}

		public override string GetHitSoundString()
		{
			if (isComboFinisher)
			{
				return base.GetHitSoundString();
			}
			return base.GetHitSoundString();
		}

		public override string GetMuzzleName()
		{
			if (isComboFinisher)
			{
				return "SwingCenter";
			}
			return (step % 2 == 0) ? "SwingR" : "SwingL";
		}

		public override void FireAttack()
		{
			FireOverlapAttack(GetOverlapAttack("ScarfGroup"), ScarfShort.slashEffectBasic);
		}

		public override void FireAttackCombo()
		{
			//IL_000e: 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)
			OverlapAttack overlapAttack = GetOverlapAttack("SpinGroup");
			DamageAPI.AddModdedDamageType(overlapAttack, RalseiSurvivor.TangleOnHit);
			DamageAPI.AddModdedDamageType(overlapAttack, AggroToolsPlugin.AggroOnHit);
			FireOverlapAttack(overlapAttack, ScarfShort.slashEffectCombo);
		}

		public override void OnEnter()
		{
			animator = ((EntityState)this).GetModelAnimator();
			((BaseState)this).StartAimMode(0.5f + enterDuration + exitDuration, false);
			base.OnEnter();
		}

		public override void OnExit()
		{
			if (inHitPause)
			{
				RemoveHitstop();
			}
			base.OnExit();
		}

		private OverlapAttack GetOverlapAttack(string hitboxGroupName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			OverlapAttack val = new OverlapAttack();
			val.hitBoxGroup = ((BaseState)this).FindHitBoxGroup(hitboxGroupName);
			val.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
			val.attacker = ((EntityState)this).gameObject;
			val.inflictor = ((EntityState)this).gameObject;
			val.teamIndex = ((BaseState)this).GetTeam();
			val.damage = damageCoefficient * ((BaseState)this).damageStat;
			val.procCoefficient = procCoefficient;
			val.hitEffectPrefab = hitEffectPrefab;
			val.forceVector = Vector3.zero;
			val.pushAwayForce = force;
			val.isCrit = ((BaseState)this).RollCrit();
			val.impactSound = (NetworkSoundEventIndex)(-1);
			return val;
		}

		public void FireOverlapAttack(OverlapAttack overlapAttack, GameObject swingEffect)
		{
			EffectManager.SimpleMuzzleFlash(swingEffect, ((EntityState)this).gameObject, GetMuzzleName(), false);
			if (((EntityState)this).isAuthority)
			{
				if (overlapAttack.Fire((List<HurtBox>)null))
				{
					OnHitEnemyAuthority();
				}
				if (isComboFinisher)
				{
					Util.PlaySound("Play_M1_basic_end_combo", ((EntityState)this).gameObject);
				}
				else
				{
					Util.PlaySound("Play_M1_basic", ((EntityState)this).gameObject);
				}
			}
		}

		protected virtual void OnHitEnemyAuthority()
		{
			Util.PlaySound(GetHitSoundString(), ((EntityState)this).gameObject);
			if (!hasHopped)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity);
				}
				hasHopped = true;
			}
			ApplyHitstop();
		}

		protected void ApplyHitstop()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!inHitPause && hitstopDuration > 0f)
			{
				storedVelocity = ((EntityState)this).characterMotor.velocity;
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, playbackRateParam);
				hitPauseTimer = hitstopDuration / ((BaseState)this).attackSpeedStat;
				inHitPause = true;
			}
		}

		private void RemoveHitstop()
		{
			//IL_0003: 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)
			((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
			inHitPause = false;
			((EntityState)this).characterMotor.velocity = storedVelocity;
		}
	}
	public abstract class SpellBombBaseState : AimThrowableBase
	{
		public GameObject spellLightingEffectInstance;

		private Animator animator;

		internal bool teleportAllies = false;

		internal abstract float GetEffectRange();

		internal abstract GameObject GetProjectilePrefab();

		internal abstract float GetCastTime();

		internal abstract float GetMaxDistance();

		public override void OnEnter()
		{
			//IL_003e: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			base.detonationRadius = GetEffectRange();
			base.projectilePrefab = GetProjectilePrefab();
			base.baseMinimumDuration = GetCastTime();
			base.maxDistance = GetMaxDistance();
			base.setFuse = true;
			base.arcVisualizerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/BasicThrowableVisualizer.prefab").WaitForCompletion();
			base.endpointVisualizerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Treebot/TreebotMortarAreaIndicator.prefab").WaitForCompletion();
			((AimThrowableBase)this).OnEnter();
			if (Object.op_Implicit((Object)(object)base.endpointVisualizerTransform))
			{
				base.endpointVisualizerTransform.localScale = new Vector3(base.detonationRadius, base.detonationRadius, base.detonationRadius);
			}
			((EntityState)this).characterBody.AddBuff(Buffs.Slow50);
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("Gesture, Override", "PrepareSpellEntry", "SpellSecondary.playbackRate", base.minimumDuration, 0f);
			animator.SetBool("spellReady", true);
		}

		public override void FixedUpdate()
		{
			((AimThrowableBase)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(3f);
			if (((EntityState)this).inputBank.skill2.down && ((EntityState)this).fixedAge > HealSpell.teleportTime)
			{
				TeleportAllies();
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void TeleportAllies()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_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_00f7: Unknown result type (might be due to invalid IL or missing references)
			teleportAllies = true;
			List<RalseiRecallComponent> allWarpTargets = RalseiRecallComponent.GetAllWarpTargets();
			Vector3 position = ((EntityState)this).transform.position;
			int num = 0;
			int count = allWarpTargets.Count;
			Vector3 val = default(Vector3);
			foreach (RalseiRecallComponent item in allWarpTargets)
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					CharacterBody body = item.master.GetBody();
					float num2 = 25f;
					float num3 = MathF.PI * 2f / (float)count;
					((Vector3)(ref val))..ctor(Mathf.Cos(num3 * (float)num) * num2, 0.25f, Mathf.Sin(num3 * (float)num) * num2);
					float num4 = 15f * ((EntityState)this).characterBody.level;
					float num5 = body.maxHealth * 0.1f + (20f + num4);
					float num6 = num5 * (float)((BaseSkillState)this).activatorSkillSlot.stock;
					body.healthComponent.Heal(num6, default(ProcChainMask), true);
					num++;
					Vector3 val2 = position + val;
					TeleportHelper.TeleportBody(body, val2);
				}
			}
			((BaseSkillState)this).activatorSkillSlot.stock = 0;
		}

		public override void OnExit()
		{
			((AimThrowableBase)this).OnExit();
			if (Object.op_Implicit((Object)(object)spellLightingEffectInstance))
			{
				animator.SetBool("spellReady", false);
			}
			((EntityState)this).PlayAnimation("Gesture, Override", "CastSpellSecondary", "SpellSecondary.playbackRate", 1f / ((BaseState)this).attackSpeedStat, 0f);
			if (((EntityState)this).characterBody.HasBuff(Buffs.Slow50))
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.Slow50);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class ThrowDummyState : BaseState
	{
		private bool dummyThrown = false;

		private float prepareDuration;

		private float throwDuration;

		public override void OnEnter()
		{
			prepareDuration = ThrowDummySkill.prepareDuration / base.attackSpeedStat;
			throwDuration = ThrowDummySkill.throwDuration / base.attackSpeedStat;
			((BaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("Gesture, Override", "PrepareSpellEntry", "SpellSecondary.playbackRate", prepareDuration, 0f);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= prepareDuration && !dummyThrown)
			{
				Util.PlaySound(DeployMinions.summonSoundString, ((EntityState)this).gameObject);
				((EntityState)this).PlayAnimation("Gesture, Override", "CastSpellSecondary", "SpellSecondary.playbackRate", 1f / base.attackSpeedStat, 0f);
				if (NetworkServer.active)
				{
					SpawnAndLaunchDummyServer();
				}
				dummyThrown = true;
			}
			if (((EntityState)this).fixedAge >= prepareDuration + throwDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void SpawnAndLaunchDummyServer()
		{
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (dummyThrown || !NetworkServer.active)
			{
				return;
			}
			Vector3 position = ((BaseState)this).FindModelChild("MuzzleSpell").position;
			CharacterMaster val = new MasterSummon
			{
				masterPrefab = MasterCatalog.GetMasterPrefab(MasterCatalog.FindMasterIndex("DummyMaster")),
				position = position,
				rotation = ((EntityState)this).transform.rotation,
				summonerBodyObject = ((EntityState)this).gameObject,
				ignoreTeamMemberLimit = true,
				inventoryToCopy = ((EntityState)this).characterBody.master.inventory
			}.Perform();
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Deployable val2 = ((EntityState)this).gameObject.AddComponent<Deployable>();
			val2.onUndeploy = new UnityEvent();
			val2.onUndeploy.AddListener(new UnityAction(val.TrueKill));
			((EntityState)this).characterBody.master.AddDeployable(val2, ThrowDummySkill.dummyDeployableSlot);
			val.onBodyStart += delegate(CharacterBody body)
			{
				if (NetworkServer.active)
				{
					Aggro.ApplyAggroBuff(body, true);
					Aggro.ShedAggroFromCharacter(((EntityState)this).characterBody);
				}
			};
			CharacterBody body2 = val.GetBody();
			if (!Object.op_Implicit((Object)(object)body2))
			{
				return;
			}
			Vector3 forceVector = ((EntityState)this).characterBody.inputBank.aimDirection * ThrowDummySkill.throwForce;
			body2.characterMotor.onMotorStart += delegate(CharacterBody body)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				IPhysMotor component = ((Component)body).GetComponent<IPhysMotor>();
				if (component == null)
				{
					Debug.LogError((object)"No force info");
				}
				else
				{
					PhysForceInfo val3 = PhysForceInfo.Create();
					val3.force = forceVector;
					((PhysForceInfo)(ref val3)).massIsOne = true;
					((PhysForceInfo)(ref val3)).ignoreGroundStick = true;
					((PhysForceInfo)(ref val3)).disableAirControlUntilCollision = false;
					component.ApplyForceImpulse(ref val3);
				}
			};
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			if (dummyThrown)
			{
				return (InterruptPriority)0;
			}
			return (InterruptPriority)2;
		}
	}
}
namespace RalseiMod.States.Dummy
{
	internal class DummyEmpowerBurstState : GenericCharacterMain
	{
		public override void OnEnter()
		{
			Debug.Log((object)"Dummy empower burst");
			((GenericCharacterMain)this).OnEnter();
			DoEmpowerBurst();
			((EntityState)this).outer.SetNextStateToMain();
		}

		private void DoEmpowerBurst()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			Debug.Log((object)"B");
			if (!NetworkServer.active)
			{
				return;
			}
			Debug.Log((object)"C");
			List<HealthComponent> list = new List<HealthComponent>();
			SphereSearch val = new SphereSearch();
			val.radius = DummyEmpowerBurst.empowerRange;
			val.origin = ((EntityState)this).characterBody.transform.position;
			val.queryTriggerInteraction = (QueryTriggerInteraction)1;
			val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
			val.RefreshCandidates();
			val.FilterCandidatesByDistinctHurtBoxEntities();
			TeamMask val2 = default(TeamMask);
			((TeamMask)(ref val2)).AddTeam(((EntityState)this).characterBody.teamComponent.teamIndex);
			val.FilterCandidatesByHurtBoxTeam(val2);
			HurtBox[] hurtBoxes = val.GetHurtBoxes();
			for (int i = 0; i < hurtBoxes.Length; i++)
			{
				HealthComponent healthComponent = hurtBoxes[i].healthComponent;
				if (!list.Contains(healthComponent))
				{
					list.Add(healthComponent);
				}
			}
			foreach (HealthComponent item in list)
			{
				if (item.body.bodyIndex != BodyCatalog.FindBodyIndex(CharacterBase<RalseiMod.Characters.Dummy>.instance.bodyName))
				{
					Debug.Log((object)"D");
					item.body.AddTimedBuff(RalseiSurvivor.empowerBuff, DummyEmpowerBurst.empowerDuration);
				}
			}
			EffectManager.SpawnEffect(Resources.Load<GameObject>("prefabs/effects/JellyfishNova"), new EffectData
			{
				origin = ((EntityState)this).transform.position,
				scale = DummyEmpowerBurst.empowerRange
			}, true);
		}
	}
	internal class DummyFatigueDeath : RalseiDeathState
	{
		public override void OnEnter()
		{
			Debug.Log((object)"Dummy fatigue burst");
			base.OnEnter();
			DoFatigueBurst();
		}

		private void DoFatigueBurst()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_002c: 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_0038: 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_0048: 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_0060: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: 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_0248: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				return;
			}
			List<HealthComponent> list = new List<HealthComponent>();
			SphereSearch val = new SphereSearch();
			val.radius = RalseiMod.Characters.Dummy.deathBlastRadius;
			val.origin = ((EntityState)this).transform.position;
			val.queryTriggerInteraction = (QueryTriggerInteraction)1;
			val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
			val.RefreshCandidates();
			val.FilterCandidatesByDistinctHurtBoxEntities();
			TeamMask all = TeamMask.all;
			((TeamMask)(ref all)).RemoveTeam(((EntityState)this).characterBody.teamComponent.teamIndex);
			val.FilterCandidatesByHurtBoxTeam(all);
			HurtBox[] hurtBoxes = val.GetHurtBoxes();
			for (int i = 0; i < hurtBoxes.Length; i++)
			{
				HealthComponent healthComponent = hurtBoxes[i].healthComponent;
				if (!list.Contains(healthComponent))
				{
					list.Add(healthComponent);
				}
			}
			DamageInfo val2 = new DamageInfo();
			val2.damage = RalseiMod.Characters.Dummy.deathDamageCoefficient * ((EntityState)this).characterBody.baseDamage;
			val2.damageType = DamageTypeCombo.op_Implicit((DamageType)32);
			val2.procCoefficient = RalseiMod.Characters.Dummy.deathProcCoeff;
			val2.attacker = ((EntityState)this).gameObject;
			GameObject masterObject = ((EntityState)this).characterBody.masterObject;
			CharacterMaster val3 = ((masterObject != null) ? masterObject.GetComponent<CharacterMaster>() : null);
			if (Object.op_Implicit((Object)(object)val3))
			{
				MinionOwnership minionOwnership = val3.minionOwnership;
				CharacterMaster val4 = ((minionOwnership != null) ? minionOwnership.ownerMaster : null);
				if (Object.op_Implicit((Object)(object)val4))
				{
					GameObject bodyObject = val4.GetBodyObject();
					if (Object.op_Implicit((Object)(object)bodyObject))
					{
						val2.attacker = bodyObject;
					}
				}
			}
			val2.crit = ((BaseState)this).RollCrit();
			foreach (HealthComponent item in list)
			{
				item.body.AddTimedBuff(RalseiSurvivor.fatigueDebuff, RalseiMod.Characters.Dummy.deathDebuffDuration);
				val2.position = item.body.corePosition;
				item.TakeDamage(val2);
				GlobalEventManager.instance.OnHitAll(val2, ((Component)item).gameObject);
				GlobalEventManager.instance.OnHitEnemy(val2, ((Component)item).gameObject);
			}
			EffectManager.SpawnEffect(Resources.Load<GameObject>("prefabs/effects/JellyfishNova"), new EffectData
			{
				origin = ((EntityState)this).transform.position,
				scale = DummyEmpowerBurst.empowerRange
			}, true);
		}
	}
	internal class DummySpawnState
	{
	}
}
namespace RalseiMod.Skills
{
	internal class CancelHoverSkill : SkillBase<CancelHoverSkill>
	{
		public override string SkillName => "Cancel Hover State";

		public override string SkillDescription => "Cancel Ralsei's hover state.";

		public override string SkillLangTokenName => "CANCELHOVER";

		public override UnlockableDef UnlockDef => null;

		public override Sprite Icon => LoadSpriteFromRorSkill("RoR2/Base/Engi/EngiCancelTargetingDummy.asset");

		public override Type ActivationState => typeof(Idle);

		public override Type BaseSkillDef => typeof(SkillDef);

		public override string CharacterName => "";

		public override SkillSlot SkillSlot => (SkillSlot)(-1);

		public override SimpleSkillData SkillData => new SimpleSkillData(1, 1f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0)
		{
			interruptPriority = (InterruptPriority)2
		};

		public override string ConfigName => "Cancel Hover State";

		public override string ActivationStateMachineName => "";

		public override AssetBundle assetBundle => RalseiPlugin.mainAssetBundle;

		public override void Hooks()
		{
		}
	}
	internal class HealSpell : SkillBase<HealSpell>
	{
		[AutoConfig("Ability Stock", 2)]
		public static int stock;

		[AutoConfig("Ability Cooldown", 14)]
		public static float cooldown;

		[AutoConfig("Heal Range", 35f)]
		public static float healRange;

		[AutoConfig("Minimum Cast Time", 0.4f)]
		public static float minCastTime;

		[AutoConfig("Immediate Heal Fraction", 0.1f)]
		public static float instantHealPercent;

		[AutoConfig("Delayed Heal Duration", 1f)]
		public static float healDuration;

		public static GameObject loveBomb;

		public static GameObject loveBombImpact;

		[AutoConfig("Ally Teleport Time", "How long to hold secondary until allies are teleported, in seconds.", 1.5f)]
		public static float teleportTime;

		public override string ConfigName => "Skill : " + SkillName;

		public override AssetBundle assetBundle => RalseiPlugin.mainAssetBundle;

		public override string SkillName => "Heal Prayer";

		public override string SkillDescription => "Cast a " + Language.Styling.HealingColor("healing spell") + " on yourself and all allies within " + Language.Styling.UtilityColor(healRange + "m") + ", restoring " + Language.Styling.HealingColor(Language.Styling.ConvertDecimal(instantHealPercent) + " health") + " and granting " + Language.Styling.HealingColor("Regenerative") + " for " + Language.Styling.HealingColor(healDuration.ToString()) + " seconds." + string.Format("Holding this ability for {0} seconds will {1} and teleport your allies to you", teleportTime, Language.Styling.DamageColor("consume all stocks")) + Language.Styling.HealingColor(" healing 10% plus a static 20 health") + ", increasing with levels.";

		public override string SkillLangTokenName => "HEALSPELL";

		public override UnlockableDef UnlockDef => null;

		public override Sprite Icon => RalseiPlugin.mainAssetBundle.LoadAsset<Sprite>("healprayer");

		public override Type ActivationState => typeof(AimHealSpell);

		public override Type BaseSkillDef => typeof(SkillDef);

		public override string CharacterName => SurvivorBase<RalseiSurvivor>.instance.bodyName;

		public override SkillSlot SkillSlot => (SkillSlot)1;

		public override SimpleSkillData SkillData => new SimpleSkillData(1, 1f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0)
		{
			stockToConsume = 1,
			baseRechargeInterval = cooldown,
			fullRestockOnAssign = false,
			beginSkillCooldownOnSkillEnd = true,
			isCombatSkill = false,
			canceledFromSprinting = true,
			cancelSprintingOnActivation = true,
			mustKeyPress = true,
			interruptPriority = (InterruptPriority)1,
			baseMaxStock = stock,
			dontAllowPastMaxStocks = false
		};

		public override void Init()
		{
			//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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			KeywordTokens = new string[1] { "KEYWORD_RAPID_REGEN" };
			base.Init();
			CreateBombProjectile();
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteEarth/AffixEarthHealExplosion.prefab").WaitForCompletion();
			loveBombImpact = PrefabAPI.InstantiateClone(val, "RalseiLoveBombExplosion", false);
			Transform transform = loveBombImpact.transform;
			transform.localScale *= healRange / 12f;
		}

		public override void Hooks()
		{
		}

		private static void CreateBombProjectile()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			loveBomb = Assets.CloneProjectilePrefab("CryoCanisterProjectile", "RalseiLoveBomb");
			Object.Destroy((Object)(object)loveBomb.GetComponent<ProjectileImpactExplosion>());
			ProjectileHealOnImpact projectileHealOnImpact = loveBomb.AddComponent<ProjectileHealOnImpact>();
			ProjectileController component = loveBomb.GetComponent<ProjectileController>();
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoSpitGhost.prefab").WaitForCompletion();
			if ((Object)(object)val != (Object)null)
			{
				component.ghostPrefab = val;
			}
			component.startSound = "";
			Content.AddProjectilePrefab(loveBomb);
		}
	}
	internal class LiftPrayer : SkillBase<LiftPrayer>
	{
		[AutoConfig("Ability Cooldown", 7)]
		public static float cooldown;

		[AutoConfig("Ascent Duration", 1.2f)]
		public static float liftDuration;

		[AutoConfig("Ascent Rate Minimum", 0.2f)]
		public static float liftSpeedMin;

		[AutoConfig("Ascent Rate Maximum", 3f)]
		public static float liftSpeedMax;

		[AutoConfig("Ascent Rate Affected By Movement Speed", "Should Ralsei's Ascent State be affected by movement speed?", false)]
		public static bool useMoveSpeed;

		[AutoConfig("Hover Vertical Speed", -5f)]
		public static float hoverVelocity;

		[AutoConfig("Hover Acceleration", "How fast should Ralsei accelerate towards the hover vertical speed while hovering", 30)]
		public static float hoverAcceleration;

		[AutoConfig("Hover Horizontal Speed Increase", 1.4f)]
		public static float hoverSpeedBoost;

		public static BuffDef hoverBuff;

		public override string ConfigName => "Skill : " + SkillName;

		public static SkillDef cancelSkillDef => SkillBase<CancelHoverSkill>.instance.SkillDef;

		public override AssetBundle assetBundle => RalseiPlugin.mainAssetBundle;

		public override string SkillName => "Ascend";

		public override string SkillDescription => "Ascend " + Language.Styling.UtilityColor("high into the air") + ", then slowly " + Language.Styling.UtilityColor("hover") + " back down. " + Language.Styling.DamageColor("Hover effect ends upon landing or recasting the ability") + ".";

		public override string SkillLangTokenName => "LIFTPRAYER";

		public override UnlockableDef UnlockDef => null;

		public override Sprite Icon => RalseiPlugin.mainAssetBundle.LoadAsset<Sprite>("ascend");

		public override Type ActivationState => typeof(LiftState);

		public override Type BaseSkillDef => typeof(SkillDef);

		public override string CharacterName => SurvivorBase<RalseiSurvivor>.instance.bodyName;

		public override SkillSlot SkillSlot => (SkillSlot)2;

		public override string ActivationStateMachineName => "Body";

		public override SimpleSkillData SkillData => new SimpleSkillData(1, 1f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0)
		{
			stockToConsume = 1,
			baseRechargeInterval = cooldown,
			beginSkillCooldownOnSkillEnd = true,
			fullRestockOnAssign = false,
			mustKeyPress = true,
			interruptPriority = (InterruptPriority)0,
			cancelSprintingOnActivation = false,
			isCombatSkill = false,
			dontAllowPastMaxStocks = false
		};

		public override void Init()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			base.Init();
			hoverBuff = Content.CreateAndAddBuff("RalseiHoverSpeed", null, Color.green, canStack: true, isDebuff: false);
			hoverBuff.isHidden = true;
			Content.AddEntityState(typeof(HoverState));
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HoverSpeedBoost);
		}

		private void HoverSpeedBoost(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(hoverBuff))
			{
				args.moveSpeedMultAdd += hoverSpeedBoost - 1f;
			}
		}
	}
	internal class Pacify : SkillBase<Pacify>
	{
		[AutoConfig("Ability Cooldown", 35)]
		public static float cooldown;

		[AutoConfig("Should Pacified Enemies Use Ambient Level", "If set to false, pacified enemies will be revived using player level. This can be used to balance enemy strength, if desired.", true)]
		public static bool useAmbientLevel;

		[AutoConfig("Sleep Conversion Delay", "The amount of seconds an enemy should sleep before converting to an ally.", 5)]
		public static float convertDelay;

		[AutoConfig("Minion Max Base", "The maximum amount of pacified minions Ralsei should be allowed to have at base.", 3)]
		public static int maxMinionBase;

		[AutoConfig("Minion Max Upgraded", "The maximum amount of pacified minions Ralsei should be allowed to have with at least one lysate cell.", 5)]
		public static int maxMinionUpgrade;

		[AutoConfig("Duplicate Pacified Minions With Swarms", true)]
		public static bool swarmsDuplicate;

		[AutoConfig("Non-Boss Fatigue Duration", 25f)]
		public static float fatigueDuration;

		[AutoConfig("Champion Decay Time", "How long should Champions (world-spawn boss-type enemies) live before dying to health decay. Set to 0 to disable.", 40)]
		public static int championDecayTime;

		[AutoConfig("Champions Sparability", "If set to true, champions (world-spawn bosstype enemies) can be spared and turned into an ally.", true)]
		public static bool championsPacifiable;

		[AutoConfig("Minion Follow Range", "The range in meters at which your minions will begin trying to follow you by sprinting", 999)]
		public static float minionFollowRange;

		[AutoConfig("Enemy Empower Ward Radius", "Affects the radius of the special Empower ward that enemy Ralseis cast.", 25f)]
		public static float empowerWardRadius;

		public static BuffDef spareBuff;

		public GetDeployableSameSlotLimit GetPacifySlotLimit;

		public static DeployableSlot pacifyDeployableSlot;

		public static GameObject encourageProjectilePrefab;

		public static GameObject encourageWardPrefab;

		public static GameObject pacifyTargetingOverlayPrefab;

		private static GameObject _crosshairOverridePrefab;

		public override string ConfigName => "Skill : " + SkillName;

		private static GameObject defaultCrosshair => Paint.crosshairOverridePrefab;

		public static GameObject crosshairOverridePrefab
		{
			get
			{
				if ((Object)(object)_crosshairOverridePrefab != (Object)null)
				{
					return _crosshairOverridePrefab;
				}
				return defaultCrosshair;
			}
			set
			{
				_crosshairOverridePrefab = value;
			}
		}

		public override AssetBundle assetBundle => RalseiPlugin.mainAssetBundle;

		public override string SkillName => "Pacify";

		public override string SkillDescription => "Has " + Language.Styling.UtilityColor("2") + " charges. Cast a " + Language.Styling.UtilityColor("Sleeping") + " spell on an enemy below " + Language.Styling.UtilityColor("50% health") + ". Pacified enemies " + Language.Styling.DamageColor("become Empowered allies") + " after " + Language.Styling.UtilityColor(convertDelay.ToString()) + "s. " + $"Max of {maxMinionBase}.";

		public override string SkillLangTokenName => "PACIFY";

		public override UnlockableDef UnlockDef => null;

		public override Sprite Icon => RalseiPlugin.mainAssetBundle.LoadAsset<Sprite>("pacify1");

		public override Type ActivationState => typeof(PreparePacifySpell);

		public override Type BaseSkillDef => typeof(DualSkillDef);

		public override string CharacterName => SurvivorBase<RalseiSurvivor>.instance.bodyName;

		public override SkillSlot SkillSlot => (SkillSlot)3;

		public override SimpleSkillData SkillData => new SimpleSkillData(1, 1f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0)
		{
			stockToConsume = 1,
			baseRechargeInterval = cooldown,
			resetCooldownTimerOnUse = false,
			canceledFromSprinting = true,
			cancelSprintingOnActivation = true,
			baseMaxStock = 2,
			isCombatSkill = false,
			interruptPriority = (InterruptPriority)2,
			dontAllowPastMaxStocks = false
		};

		public override void Init()
		{
			//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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			KeywordTokens = new string[3]
			{
				RalseiSurvivor.sleepKeywordToken,
				RalseiSurvivor.fatigueKeywordToken,
				RalseiSurvivor.empowerKeywordToken
			};
			base.Init();
			(base.SkillDef as DualSkillDef).alternateActivationState = new SerializableEntityStateType(typeof(CastEncourageSpell));
			Content.AddEntityState(typeof(CastEncourageSpell));
			Content.AddEntityState(typeof(CastPacifySpell));
			CreateTargetingCrosshairPrefabs();
			spareBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)spareBuff).name = "SpareBuff";
			spareBuff.isHidden = true;
			spareBuff.isDebuff = false;
			Content.AddBuffDef(spareBuff);
			GetPacifySlotLimit = (GetDeployableSameSlotLimit)Delegate.Combine((Delegate?)(object)GetPacifySlotLimit, (Delegate?)new GetDeployableSameSlotLimit(GetMaxPacifyMinions));
			pacifyDeployableSlot = DeployableAPI.RegisterDeployableSlot(GetPacifySlotLimit);
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/InfiniteTowerSafeWardAwaitingInteraction.prefab").WaitForCompletion();
			Transform obj = val.transform.Find("Indicator");
			GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
			GameObject val3 = PrefabAPI.InstantiateClone(val2, "EncourageWardIndicatorPrefab");
			Material val4 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/WardOnLevel/matWarbannerSphereIndicator2.mat").WaitForCompletion());
			val4.SetColor("_TintColor", Color32.op_Implicit(new Color32((byte)146, (byte)0, (byte)73, (byte)201)));
			val4.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)"RoR2/Base/Common/ColorRamps/texRampLightningYellowOffset.png").WaitForCompletion());
			MeshRenderer componentInChildren = val3.GetComponentInChildren<MeshRenderer>();
			((Renderer)componentInChildren).material = val4;
			encourageWardPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerMineAltDetonated.prefab").WaitForCompletion(), "EncourageWardPrefab", true);
			if (Object.op_Implicit((Object)(object)encourageWardPrefab))
			{
				encourageWardPrefab.transform.rotation = Quaternion.identity;
				SlowDownProjectiles component = encourageWardPrefab.GetComponent<SlowDownProjectiles>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Object.Destroy((Object)(object)component);
				}
				SphereCollider component2 = encourageWardPrefab.GetComponent<SphereCollider>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					Object.Destroy((Object)(object)component2);
				}
				GameObject gameObject = ((Component)encourageWardPrefab.transform.Find("AreaIndicator")).gameObject;
				if (Object.op_Implicit((Object)(object)gameObject))
				{
					Object.Destroy((Object)(object)gameObject);
				}
				val3.transform.parent = encourageWardPrefab.transform;
				val3.transform.localScale = new Vector3(empowerWardRadius, val3.transform.localScale.y, empowerWardRadius);
				BuffWard component3 = encourageWardPrefab.GetComponent<BuffWard>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					component3.rangeIndicator = (Object.op_Implicit((Object)(object)val2) ? val3.transform : component3.rangeIndicator);
					component3.radius = empowerWardRadius;
					component3.buffDef = RalseiSurvivor.empowerBuff;
					component3.buffDuration = 1f;
					component3.buffTimer = 1f;
					component3.expireDuration = 20f;
					component3.shape = (BuffWardShape)1;
					component3.invertTeamFilter = false;
				}
			}
			encourageProjectilePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerMineAlt.prefab").WaitForCompletion(), "EncourageProjectilePrefab", true);
			if (Object.op_Implicit((Object)(object)encourageProjectilePrefab))
			{
				ProjectileController component4 = encourageProjectilePrefab.GetComponent<ProjectileController>();
				GameObject val5 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoSpitGhost.prefab").WaitForCompletion();
				if ((Object)(object)val5 != (Object)null)
				{
					component4.ghostPrefab = val5;
				}
				ProjectileFuse component5 = encourageProjectilePrefab.GetComponent<ProjectileFuse>();
				if (Object.op_Implicit((Object)(object)component5))
				{
					component5.fuse = 0f;
				}
				ProjectileExplosion component6 = encourageProjectilePrefab.GetComponent<ProjectileExplosion>();
				i

plugins/Ror2AggroTools.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using On.RoR2;
using On.RoR2.CharacterAI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Ror2AggroTools")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Ror2AggroTools")]
[assembly: AssemblyTitle("Ror2AggroTools")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Ror2AggroTools;

public enum AggroPriority
{
	None = -3,
	LowAggro = -1,
	Normal = 0,
	HighAggro = 1,
	Killeth = 2
}
public static class Aggro
{
	public static void AggroMinionsToEnemy(CharacterBody leaderBody, CharacterBody victimBody, bool killethAggro = false)
	{
		if (Object.op_Implicit((Object)(object)victimBody))
		{
			ApplyAggroBuff(victimBody, killethAggro);
			if (Object.op_Implicit((Object)(object)leaderBody))
			{
				ResetMinionAggro(leaderBody);
			}
		}
	}

	public static void ApplyAggroBuff(CharacterBody victim, bool killethAggro = false)
	{
		if (NetworkServer.active)
		{
			if (killethAggro)
			{
				victim.AddTimedBuff(AggroToolsPlugin.killethAggro, 10f);
			}
			else
			{
				victim.AddTimedBuff(AggroToolsPlugin.priorityAggro, 10f);
			}
		}
	}

	public static void ShedAggroFromCharacter(CharacterBody body)
	{
		ShedAggroFromCharacter(((Component)body).gameObject);
	}

	public static void ShedAggroFromCharacter(GameObject gameObject)
	{
		BaseAI[] array = Object.FindObjectsOfType<BaseAI>();
		BaseAI[] array2 = array;
		foreach (BaseAI val in array2)
		{
			if ((Object)(object)val.currentEnemy.gameObject == (Object)(object)gameObject)
			{
				ResetAggro(val);
			}
		}
	}

	public static void ResetAllyAggro(CharacterMaster master)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		BaseAI[] array = Object.FindObjectsOfType<BaseAI>();
		BaseAI[] array2 = array;
		foreach (BaseAI val in array2)
		{
			if (val.master.teamIndex == master.teamIndex)
			{
				ResetAggro(val);
			}
		}
	}

	public static void ResetMinionAggro(CharacterBody leaderBody)
	{
		BaseAI[] array = Object.FindObjectsOfType<BaseAI>();
		BaseAI[] array2 = array;
		foreach (BaseAI val in array2)
		{
			if ((Object)(object)val.leader.characterBody == (Object)(object)leaderBody)
			{
				ResetAggroIfApplicable(val);
			}
		}
	}

	public static void ResetAggro(BaseAI baseAI)
	{
		baseAI.currentEnemy.Reset();
	}

	public static void ResetAggroIfApplicable(BaseAI baseAI)
	{
		HurtBox val = baseAI.FindEnemyHurtBox(float.PositiveInfinity, baseAI.fullVision, false);
		HealthComponent val2 = val?.healthComponent;
		if ((Object)(object)val2 != (Object)(object)baseAI.currentEnemy.healthComponent && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.body) && Object.op_Implicit((Object)(object)baseAI.currentEnemy.characterBody))
		{
			AggroPriority aggroPriority = GetAggroPriority(val.healthComponent?.body);
			AggroPriority aggroPriority2 = GetAggroPriority(baseAI.currentEnemy.characterBody);
			if (aggroPriority >= aggroPriority2 && aggroPriority > AggroPriority.Normal)
			{
				baseAI.currentEnemy.gameObject = ((Component)val2).gameObject;
				baseAI.currentEnemy.bestHurtBox = val;
				baseAI.enemyAttention = baseAI.enemyAttentionDuration;
			}
		}
	}

	public static AggroPriority GetAggroPriority(CharacterBody body)
	{
		if ((Object)(object)body == (Object)null || !body.healthComponent.alive)
		{
			return AggroPriority.None;
		}
		if (body.HasBuff(Buffs.Cloak))
		{
			return AggroPriority.LowAggro;
		}
		if (body.HasBuff(AggroToolsPlugin.priorityAggro))
		{
			return AggroPriority.HighAggro;
		}
		return AggroPriority.Normal;
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.RiskOfBrainrot.Ror2AggroTools", "Ror2AggroTools", "1.0.0")]
[R2APISubmoduleDependency(new string[] { "LanguageAPI", "ContentAddition", "DamageAPI", "RecalculateStatsAPI" })]
public class AggroToolsPlugin : BaseUnityPlugin
{
	public const string guid = "com.RiskOfBrainrot.Ror2AggroTools";

	public const string teamName = "RiskOfBrainrot";

	public const string modName = "Ror2AggroTools";

	public const string version = "1.0.0";

	public const float lowPriorityAggroWeight = 3f;

	public const float highPriorityAggroWeight = 100f;

	public const float priorityAggroDuration = 10f;

	public static BuffDef killethAggro;

	public static BuffDef priorityAggro;

	public static ModdedDamageType AggroOnHit;

	public static PluginInfo PInfo { get; private set; }

	public void Awake()
	{
		//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_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Expected O, but got Unknown
		PInfo = ((BaseUnityPlugin)this).Info;
		AIChanges.Init();
		AggroOnHit = DamageAPI.ReserveDamageType();
		priorityAggro = ScriptableObject.CreateInstance<BuffDef>();
		priorityAggro.canStack = false;
		priorityAggro.isHidden = true;
		priorityAggro.isDebuff = false;
		ContentAddition.AddBuffDef(priorityAggro);
		killethAggro = ScriptableObject.CreateInstance<BuffDef>();
		killethAggro.canStack = false;
		killethAggro.isHidden = true;
		killethAggro.isDebuff = false;
		ContentAddition.AddBuffDef(killethAggro);
		GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(AggroOnHitHook);
	}

	private void AggroOnHitHook(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self, damageInfo, victim);
		if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && DamageAPI.HasModdedDamageType(damageInfo, AggroOnHit) && (Object)(object)victim != (Object)null && (Object)(object)damageInfo.attacker != (Object)null)
		{
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			CharacterBody component2 = victim.GetComponent<CharacterBody>();
			if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null && component2.healthComponent.alive)
			{
				Aggro.AggroMinionsToEnemy(component, component2);
			}
		}
	}
}
public static class AIChanges
{
	public delegate void orig_setCurrentEnemy(BaseAI self, Target target);

	public static Dictionary<BaseAI, Target> aiTargetPairs;

	public static void Init()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		aiTargetPairs = new Dictionary<BaseAI, Target>();
		BaseAI.FindEnemyHurtBox += new hook_FindEnemyHurtBox(BaseAI_FindEnemyHurtbox);
		BaseAI.OnBodyDamaged += new hook_OnBodyDamaged(BaseAI_OnBodyDamaged);
	}

	private static void ClearTargetPairing(orig_OnDestroy orig, BaseAI self)
	{
		orig.Invoke(self);
		if (aiTargetPairs.ContainsKey(self))
		{
			aiTargetPairs.Remove(self);
		}
	}

	public static void Set_CurrentEnemy(orig_setCurrentEnemy orig, BaseAI self, Target target)
	{
		if (target != self.currentEnemy)
		{
			if (target == null)
			{
				aiTargetPairs.Remove(self);
			}
			else
			{
				aiTargetPairs[self] = target;
			}
		}
		orig(self, target);
	}

	private static HurtBox BaseAI_FindEnemyHurtbox(orig_FindEnemyHurtBox orig, BaseAI self, float maxDistance, bool full360Vision, bool filterByLoS)
	{
		//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)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		HurtBox result = orig.Invoke(self, maxDistance, full360Vision, filterByLoS);
		bool flag = false;
		IEnumerable<CandidateInfo> candidatesEnumerable = self.enemySearch.candidatesEnumerable;
		List<CandidateInfo> list = new List<CandidateInfo>();
		foreach (CandidateInfo item2 in candidatesEnumerable)
		{
			float num = item2.distanceSqr;
			CharacterBody val = item2.hurtBox.healthComponent?.body;
			if (Object.op_Implicit((Object)(object)val))
			{
				switch (Aggro.GetAggroPriority(val))
				{
				case AggroPriority.Killeth:
					return item2.hurtBox;
				case AggroPriority.HighAggro:
					flag = true;
					num /= 100f;
					break;
				case AggroPriority.LowAggro:
					flag = true;
					num *= 3f;
					break;
				}
			}
			CandidateInfo val2 = default(CandidateInfo);
			val2.hurtBox = item2.hurtBox;
			val2.position = item2.position;
			val2.dot = item2.dot;
			val2.distanceSqr = num;
			CandidateInfo item = val2;
			list.Add(item);
		}
		if (flag)
		{
			Func<CandidateInfo, float> sorter = self.enemySearch.GetSorter();
			if (sorter != null)
			{
				self.enemySearch.candidatesEnumerable = list.OrderBy(sorter).ToList();
			}
			return self.enemySearch.GetResults().FirstOrDefault();
		}
		return result;
	}

	private static void BaseAI_OnBodyDamaged(orig_OnBodyDamaged orig, BaseAI self, DamageReport damageReport)
	{
		if (damageReport.damageInfo == null || (Object)(object)damageReport.damageInfo.attacker == (Object)null || (Object)(object)damageReport.damageInfo.attacker == (Object)(object)((Component)self.body).gameObject)
		{
			orig.Invoke(self, damageReport);
			return;
		}
		Target currentEnemy = self.currentEnemy;
		AggroPriority aggroPriority = Aggro.GetAggroPriority((currentEnemy != null) ? currentEnemy.characterBody : null);
		AggroPriority aggroPriority2 = Aggro.GetAggroPriority(damageReport.attackerBody);
		if (aggroPriority <= aggroPriority2)
		{
			if (aggroPriority < aggroPriority2 && aggroPriority != AggroPriority.None)
			{
				self.currentEnemy.gameObject = null;
			}
			orig.Invoke(self, damageReport);
		}
	}
}