Decompiled source of StaffsOfTheForsaken v1.0.1

StaffsOfTheForsaken.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using StaffsOfTheForsaken.Abilities;
using StaffsOfTheForsaken.Data;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("StaffsoftheForsaken")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("StaffsoftheForsaken")]
[assembly: AssemblyCopyright("Copyright © HP 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aa26718f-a860-473f-997c-5803d75785f4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StaffsOfTheForsaken
{
	[CreateAssetMenu(menuName = "StaffsOfTheForsaken/CooldownEffect")]
	public class StaffCooldownEffect : StatusEffect
	{
		public float CooldownDuration { get; set; }

		public override void Setup(Character character)
		{
			((StatusEffect)this).Setup(character);
			base.m_ttl = CooldownDuration;
		}

		public override string GetIconText()
		{
			float num = base.m_ttl - base.m_time;
			if (num <= 0f)
			{
				return "";
			}
			return (num < 10f) ? (num.ToString("F1") + "s") : (Mathf.CeilToInt(num) + "s");
		}

		public override bool IsDone()
		{
			return base.m_time >= base.m_ttl;
		}
	}
	public static class StaffSetup
	{
		public static void RegisterAll()
		{
			try
			{
				StaffDefinition[] all = StaffRegistry.All;
				foreach (StaffDefinition def in all)
				{
					RegisterStaff(def);
				}
				PrefabManager.OnVanillaPrefabsAvailable -= RegisterAll;
				StaffsPlugin.Log.LogInfo((object)$"Registered {StaffRegistry.All.Length} boss staffs.");
			}
			catch (Exception arg)
			{
				StaffsPlugin.Log.LogError((object)$"StaffSetup.RegisterAll failed: {arg}");
			}
		}

		private static void RegisterStaff(StaffDefinition def)
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Expected O, but got Unknown
			GameObject val = PrefabManager.Instance.CreateClonedPrefab(def.PrefabName, def.BasePrefab);
			if ((Object)(object)val == (Object)null)
			{
				StaffsPlugin.Log.LogError((object)("Could not clone '" + def.BasePrefab + "' for '" + def.PrefabName + "'. Verify the base prefab name exists in this version of Valheim."));
				return;
			}
			BossAbilityBase ability = (BossAbilityBase)(object)val.AddComponent(def.AbilityType);
			Sprite sprite = StaffsPlugin.GetSprite(def.IconName);
			RegisterCooldownEffect(def, sprite, ability);
			ItemDrop component = val.GetComponent<ItemDrop>();
			if ((Object)(object)component == (Object)null)
			{
				StaffsPlugin.Log.LogError((object)("No ItemDrop on cloned prefab " + def.PrefabName));
				return;
			}
			SharedData shared = component.m_itemData.m_shared;
			shared.m_name = def.ItemNameToken;
			shared.m_description = def.DescToken;
			shared.m_maxQuality = 1;
			if ((Object)(object)sprite != (Object)null)
			{
				shared.m_icons = (Sprite[])(object)new Sprite[1] { sprite };
			}
			else
			{
				StaffsPlugin.Log.LogWarning((object)("No icon found for '" + def.IconName + "' — using base staff icon."));
			}
			ApplyEmissionColor(val, def.EmissionColor);
			List<RequirementConfig> list = new List<RequirementConfig>();
			(string, int)[] materials = def.Materials;
			for (int i = 0; i < materials.Length; i++)
			{
				var (item, amount) = materials[i];
				list.Add(new RequirementConfig
				{
					Item = item,
					Amount = amount
				});
			}
			list.Add(new RequirementConfig
			{
				Item = def.TrophyPrefab,
				Amount = 1,
				AmountPerLevel = 0
			});
			ItemConfig val2 = new ItemConfig
			{
				Name = def.ItemNameToken,
				Description = def.DescToken,
				CraftingStation = def.CraftStation,
				MinStationLevel = def.StationLevel,
				Requirements = list.ToArray()
			};
			ItemManager.Instance.AddItem(new CustomItem(val, false, val2));
			StaffsPlugin.Log.LogDebug((object)("Registered: " + def.PrefabName + " (cloned from " + def.BasePrefab + ")"));
		}

		private static void RegisterCooldownEffect(StaffDefinition def, Sprite icon, BossAbilityBase ability)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			StaffCooldownEffect staffCooldownEffect = ScriptableObject.CreateInstance<StaffCooldownEffect>();
			((Object)staffCooldownEffect).name = def.CooldownEffectName;
			((StatusEffect)staffCooldownEffect).m_name = def.ItemNameToken;
			((StatusEffect)staffCooldownEffect).m_icon = icon;
			staffCooldownEffect.CooldownDuration = ability.CooldownSeconds;
			((StatusEffect)staffCooldownEffect).m_startMessageType = (MessageType)1;
			((StatusEffect)staffCooldownEffect).m_startMessage = "";
			((StatusEffect)staffCooldownEffect).m_stopMessage = "";
			ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)staffCooldownEffect, false));
			ability.CooldownEffectName = def.CooldownEffectName;
			StaffsPlugin.Log.LogDebug((object)("Registered cooldown SE: " + def.CooldownEffectName));
		}

		private static void ApplyEmissionColor(GameObject go, Color color)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: 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_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: 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_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			((Color)(ref val))..ctor(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), 1f);
			Transform val2 = go.transform.Find("attach/equiped/default (1)") ?? go.transform.Find("attach/default (1)");
			if ((Object)(object)val2 == (Object)null)
			{
				StaffsPlugin.Log.LogWarning((object)("ApplyEmissionColor: could not find orb mesh on " + ((Object)go).name));
				return;
			}
			Transform val3 = go.transform.Find("attach/equiped");
			if ((Object)(object)val3 != (Object)null)
			{
				DestroyChild(val3, "flames_world");
				DestroyChild(val3, "flames");
				DestroyChild(val3, "embers");
			}
			Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val4 in componentsInChildren)
			{
				Material[] materials = val4.materials;
				foreach (Material val5 in materials)
				{
					if (val5.HasProperty("_Color"))
					{
						val5.SetColor("_Color", Color.white);
					}
					if (val5.HasProperty("_BaseColor"))
					{
						val5.SetColor("_BaseColor", Color.white);
					}
					if (val5.HasProperty("_EmissionColor"))
					{
						val5.EnableKeyword("_EMISSION");
						val5.SetColor("_EmissionColor", val * 4f);
					}
					if (val5.HasProperty("_TintColor"))
					{
						val5.SetColor("_TintColor", val);
					}
				}
				val4.materials = materials;
			}
			Transform val6 = val2.Find("effects");
			if (!((Object)(object)val6 != (Object)null))
			{
				return;
			}
			Light[] componentsInChildren2 = ((Component)val6).GetComponentsInChildren<Light>(true);
			foreach (Light val7 in componentsInChildren2)
			{
				val7.color = val;
				val7.intensity = 0.9f;
				val7.range = 1.8f;
			}
			foreach (Transform item in val6)
			{
				Transform val8 = item;
				ParticleSystem component = ((Component)val8).GetComponent<ParticleSystem>();
				if ((Object)(object)component != (Object)null)
				{
					MainModule main = component.main;
					((MainModule)(ref main)).startColor = new MinMaxGradient(val);
					if (((Object)val8).name == "flare")
					{
						((MainModule)(ref main)).startSize = new MinMaxCurve(0.8f);
						((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(val.r, val.g, val.b, 0.45f));
					}
				}
			}
		}

		private static void DestroyChild(Transform parent, string childName)
		{
			Transform val = parent.Find(childName);
			if (!((Object)(object)val == (Object)null))
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
				StaffsPlugin.Log.LogDebug((object)("Destroyed FX child: " + ((Object)parent).name + "/" + childName));
			}
		}
	}
	[BepInPlugin("com.youdied.staffs_of_the_forsaken", "Staffs of the Forsaken", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class StaffsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.youdied.staffs_of_the_forsaken";

		public const string PluginName = "Staffs of the Forsaken";

		public const string PluginVersion = "1.0.1";

		internal static ManualLogSource Log;

		public static ConfigEntry<float> EikthyrDamage;

		public static ConfigEntry<float> ElderDamage;

		public static ConfigEntry<float> BonemassDamage;

		public static ConfigEntry<float> ModerDamage;

		public static ConfigEntry<float> YagluthDamage;

		public static ConfigEntry<float> QueenDamage;

		public static ConfigEntry<float> FaderDamage;

		private static readonly Dictionary<string, Sprite> _sprites = new Dictionary<string, Sprite>();

		private readonly Harmony _harmony = new Harmony("com.youdied.staffs_of_the_forsaken");

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			BindConfig();
			LoadLocalization();
			LoadIcons();
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			PrefabManager.OnVanillaPrefabsAvailable += StaffSetup.RegisterAll;
			Log.LogInfo((object)"Staffs of the Forsaken v1.0.1 loaded.");
		}

		private void BindConfig()
		{
			EikthyrDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Eikthyr_Lightning", 15f, "Lightning damage per bolt in the Eikthyr charge fan (wiki value: 15).");
			ElderDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Elder_Vine", 35f, "Pierce damage per vine projectile (wiki value: 35).");
			BonemassDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Bonemass_Poison", 130f, "Total poison damage of the AoE cloud (wiki value: 130).");
			ModerDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Moder_Frost", 200f, "Frost damage of the cold breath beam (wiki value: 200).");
			YagluthDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Yagluth_Nova", 65f, "Fire+Lightning damage of the nova, each type (wiki value: 65 each).");
			QueenDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Queen_Spit", 40f, "Blunt+Poison damage per spit projectile (wiki value: 40 each).");
			FaderDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "Fader_Fissure", 120f, "Fire damage of each fissure spike eruption (wiki value: 120).");
		}

		private void LoadLocalization()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			try
			{
				using Stream stream = executingAssembly.GetManifestResourceStream("StaffsOfTheForsaken.Localization.localization.json");
				if (stream == null)
				{
					Log.LogWarning((object)"Localization resource 'StaffsOfTheForsaken.Localization.localization.json' not found — recipe UI may show raw $tokens.");
					return;
				}
				using StreamReader streamReader = new StreamReader(stream);
				string json = streamReader.ReadToEnd();
				Dictionary<string, string> dictionary = ParseLocalizationJson(json);
				if (dictionary == null || dictionary.Count == 0)
				{
					Log.LogWarning((object)"Localization JSON parsed 0 entries — check format.");
					return;
				}
				CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
				string text = "English";
				localization.AddTranslation(ref text, dictionary);
				Log.LogInfo((object)$"Localization loaded: {dictionary.Count} tokens registered.");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed loading localization: " + ex.Message));
			}
		}

		private static Dictionary<string, string> ParseLocalizationJson(string json)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			int num = json.IndexOf("\"English\"", StringComparison.Ordinal);
			if (num < 0)
			{
				return null;
			}
			int num2 = json.IndexOf('{', num + 9);
			if (num2 < 0)
			{
				return null;
			}
			int num3 = json.LastIndexOf('}');
			if (num3 <= num2)
			{
				return null;
			}
			string text = json.Substring(num2 + 1, num3 - num2 - 1);
			string[] array = text.Split(new char[1] { '\n' });
			foreach (string text2 in array)
			{
				string text3 = text2.Trim().TrimEnd(new char[1] { ',' });
				if (!text3.StartsWith("\""))
				{
					continue;
				}
				int num4 = text3.IndexOf("\":", StringComparison.Ordinal);
				if (num4 >= 0)
				{
					string key = text3.Substring(1, num4 - 1);
					int num5 = text3.IndexOf('"', num4 + 2);
					int num6 = text3.LastIndexOf('"');
					if (num5 >= 0 && num6 > num5)
					{
						string value = text3.Substring(num5 + 1, num6 - num5 - 1);
						dictionary[key] = value;
					}
				}
			}
			return dictionary;
		}

		private void LoadIcons()
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_015b: 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)
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = "StaffsOfTheForsaken.Assets.icons.";
			MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2]
			{
				typeof(Texture2D),
				typeof(byte[])
			});
			if (methodInfo == null)
			{
				Log.LogWarning((object)"LoadImage method not found — icons will use vanilla fallback.");
				return;
			}
			string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
			foreach (string text2 in manifestResourceNames)
			{
				if (!text2.StartsWith(text) || !text2.EndsWith(".png"))
				{
					continue;
				}
				string text3 = text2.Substring(text.Length).Replace(".png", "");
				try
				{
					using Stream stream = executingAssembly.GetManifestResourceStream(text2);
					if (stream != null)
					{
						byte[] array = new byte[stream.Length];
						stream.Read(array, 0, array.Length);
						Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
						if ((bool)methodInfo.Invoke(null, new object[2] { val, array }))
						{
							_sprites[text3] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
							Log.LogDebug((object)("Icon loaded: " + text3));
						}
					}
				}
				catch (Exception ex)
				{
					Log.LogWarning((object)("Failed loading icon '" + text3 + "': " + ex.Message));
				}
			}
			if (_sprites.Count == 0)
			{
				Log.LogWarning((object)"No icons loaded — staffs will use vanilla fallback icons.");
			}
			else
			{
				Log.LogInfo((object)$"Loaded {_sprites.Count} staff icons.");
			}
		}

		public static Sprite GetSprite(string name)
		{
			_sprites.TryGetValue(name, out var value);
			return value;
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
		}
	}
}
namespace StaffsOfTheForsaken.Patches
{
	[HarmonyPatch(typeof(Humanoid), "StartAttack")]
	public static class Humanoid_StartAttack_Patch
	{
		[CompilerGenerated]
		private sealed class <PlayAnimationAndReset>d__4 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Player player;

			public ItemData weapon;

			private string <animName>5__1;

			private Animator <anim>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PlayAnimationAndReset>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<animName>5__1 = null;
				<anim>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<animName>5__1 = weapon?.m_shared?.m_attack?.m_attackAnimation ?? "";
					if (string.IsNullOrEmpty(<animName>5__1))
					{
						return false;
					}
					<anim>5__2 = ((Component)player).GetComponentInChildren<Animator>();
					if ((Object)(object)<anim>5__2 == (Object)null)
					{
						return false;
					}
					<anim>5__2.Play(525728579, 0, 0f);
					<>2__current = (object)new WaitForSeconds(0.66f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<anim>5__2.Play(-409901381, 0, 0f);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool _sfxDumped;

		private const int AttackStateHash = 525728579;

		private const int LocoStateHash = -409901381;

		private static bool Prefix(Humanoid __instance, Character target, bool secondaryAttack)
		{
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			if ((Object)(object)val != (Object)(object)Player.m_localPlayer)
			{
				return true;
			}
			if (!_sfxDumped && (Object)(object)ZNetScene.instance != (Object)null)
			{
				_sfxDumped = true;
				ManualLogSource log = StaffsPlugin.Log;
				log.LogInfo((object)"[SfxDump] Bonemass prefabs:");
				foreach (GameObject prefab in ZNetScene.instance.m_prefabs)
				{
					if ((Object)(object)prefab != (Object)null && ((Object)prefab).name.IndexOf("bonemass", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						log.LogInfo((object)("[SfxDump]  " + ((Object)prefab).name));
					}
				}
				log.LogInfo((object)"[SfxDump] Fader prefabs:");
				foreach (GameObject prefab2 in ZNetScene.instance.m_prefabs)
				{
					if ((Object)(object)prefab2 != (Object)null && ((Object)prefab2).name.IndexOf("fader", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						log.LogInfo((object)("[SfxDump]  " + ((Object)prefab2).name));
					}
				}
				log.LogInfo((object)"[SfxDump] Done.");
			}
			ItemData currentWeapon = __instance.GetCurrentWeapon();
			if ((Object)(object)currentWeapon?.m_dropPrefab == (Object)null)
			{
				return true;
			}
			BossAbilityBase component = currentWeapon.m_dropPrefab.GetComponent<BossAbilityBase>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			Vector3 aimPoint = GetAimPoint(val);
			if (component.TryActivate(val, aimPoint))
			{
				((MonoBehaviour)val).StartCoroutine(PlayAnimationAndReset(val, currentWeapon));
			}
			return false;
		}

		[IteratorStateMachine(typeof(<PlayAnimationAndReset>d__4))]
		private static IEnumerator PlayAnimationAndReset(Player player, ItemData weapon)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PlayAnimationAndReset>d__4(0)
			{
				player = player,
				weapon = weapon
			};
		}

		private static Vector3 GetAimPoint(Player player)
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Camera val = null;
			if (Camera.allCameras.Length != 0)
			{
				val = Camera.allCameras[0];
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Camera.main;
			}
			if ((Object)(object)val != (Object)null)
			{
				Ray val2 = val.ScreenPointToRay(new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f, 0f));
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(val2, ref val3, 60f, LayerMask.GetMask(new string[7] { "terrain", "Default", "character", "character_net", "Default_small", "piece", "static_solid" })))
				{
					return ((RaycastHit)(ref val3)).point;
				}
				return ((Ray)(ref val2)).origin + ((Ray)(ref val2)).direction * 30f;
			}
			return ((Component)player).transform.position + ((Component)player).transform.forward * 10f;
		}
	}
	[HarmonyPatch(typeof(Humanoid), "EquipItem")]
	public static class EquipItem_Patch
	{
		private static void Postfix(Humanoid __instance, ItemData item, bool __result)
		{
			if (!__result || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || (Object)(object)item?.m_dropPrefab == (Object)null)
			{
				return;
			}
			BossAbilityBase component = item.m_dropPrefab.GetComponent<BossAbilityBase>();
			if (!((Object)(object)component == (Object)null))
			{
				MessageHud instance = MessageHud.instance;
				if (instance != null)
				{
					instance.ShowMessage((MessageType)1, item.m_shared.m_name + " $msg_boss_staff_ready", 0, (Sprite)null, false);
				}
			}
		}
	}
}
namespace StaffsOfTheForsaken.Data
{
	public class StaffDefinition
	{
		public string PrefabName;

		public string BasePrefab;

		public string ItemNameToken;

		public string DescToken;

		public Color EmissionColor;

		public string IconName;

		public string CraftStation;

		public int StationLevel;

		public (string prefab, int amount)[] Materials;

		public string TrophyPrefab;

		public Type AbilityType;

		public string CooldownEffectName;
	}
	public static class StaffRegistry
	{
		public static readonly StaffDefinition[] All = new StaffDefinition[7]
		{
			new StaffDefinition
			{
				PrefabName = "StaffOfMeadows",
				BasePrefab = "StaffFireball",
				ItemNameToken = "$item_staff_meadows",
				DescToken = "$item_staff_meadows_desc",
				EmissionColor = new Color(0.05f, 0.45f, 1f),
				IconName = "staff_meadows",
				CraftStation = "piece_workbench",
				StationLevel = 3,
				Materials = new(string, int)[2]
				{
					("Wood", 10),
					("Resin", 10)
				},
				TrophyPrefab = "TrophyEikthyr",
				AbilityType = typeof(EikthyrChargeAbility),
				CooldownEffectName = "SE_StaffOfMeadows"
			},
			new StaffDefinition
			{
				PrefabName = "StaffOfForest",
				BasePrefab = "StaffFireball",
				ItemNameToken = "$item_staff_forest",
				DescToken = "$item_staff_forest_desc",
				EmissionColor = new Color(1f, 0.75f, 0f),
				IconName = "staff_forest",
				CraftStation = "piece_workbench",
				StationLevel = 4,
				Materials = new(string, int)[2]
				{
					("RoundLog", 10),
					("TrollHide", 10)
				},
				TrophyPrefab = "TrophyTheElder",
				AbilityType = typeof(ElderShootAbility),
				CooldownEffectName = "SE_StaffOfForest"
			},
			new StaffDefinition
			{
				PrefabName = "StaffOfMire",
				BasePrefab = "StaffFireball",
				ItemNameToken = "$item_staff_mire",
				DescToken = "$item_staff_mire_desc",
				EmissionColor = new Color(0.35f, 1.1f, 0f),
				IconName = "staff_mire",
				CraftStation = "piece_workbench",
				StationLevel = 5,
				Materials = new(string, int)[2]
				{
					("ElderBark", 10),
					("Root", 10)
				},
				TrophyPrefab = "TrophyBonemass",
				AbilityType = typeof(BonemassAoEAbility),
				CooldownEffectName = "SE_StaffOfMire"
			},
			new StaffDefinition
			{
				PrefabName = "StaffOfMountain",
				BasePrefab = "StaffFireball",
				ItemNameToken = "$item_staff_mountain",
				DescToken = "$item_staff_mountain_desc",
				EmissionColor = new Color(0.8f, 0.95f, 1f),
				IconName = "staff_mountain",
				CraftStation = "piece_workbench",
				StationLevel = 5,
				Materials = new(string, int)[2]
				{
					("FineWood", 10),
					("Obsidian", 10)
				},
				TrophyPrefab = "TrophyDragonQueen",
				AbilityType = typeof(ModerColdBreathAbility),
				CooldownEffectName = "SE_StaffOfMountain"
			},
			new StaffDefinition
			{
				PrefabName = "StaffOfPlains",
				BasePrefab = "StaffFireball",
				ItemNameToken = "$item_staff_plains",
				DescToken = "$item_staff_plains_desc",
				EmissionColor = new Color(1f, 0f, 0.8f),
				IconName = "staff_plains",
				CraftStation = "piece_workbench",
				StationLevel = 5,
				Materials = new(string, int)[2]
				{
					("LoxPelt", 10),
					("Needle", 10)
				},
				TrophyPrefab = "TrophyGoblinKing",
				AbilityType = typeof(YagluthNovaAbility),
				CooldownEffectName = "SE_StaffOfPlains"
			},
			new StaffDefinition
			{
				PrefabName = "StaffOfMist",
				BasePrefab = "StaffIceShards",
				ItemNameToken = "$item_staff_mist",
				DescToken = "$item_staff_mist_desc",
				EmissionColor = new Color(0.55f, 0f, 1f),
				IconName = "staff_mist",
				CraftStation = "piece_magetable",
				StationLevel = 1,
				Materials = new(string, int)[2]
				{
					("YggdrasilWood", 10),
					("Mandible", 10)
				},
				TrophyPrefab = "TrophySeekerQueen",
				AbilityType = typeof(QueenSpitAbility),
				CooldownEffectName = "SE_StaffOfMist"
			},
			new StaffDefinition
			{
				PrefabName = "StaffOfAsh",
				BasePrefab = "StaffIceShards",
				ItemNameToken = "$item_staff_ash",
				DescToken = "$item_staff_ash_desc",
				EmissionColor = new Color(1f, 0.05f, 0.05f),
				IconName = "staff_ash",
				CraftStation = "piece_magetable",
				StationLevel = 2,
				Materials = new(string, int)[2]
				{
					("Blackwood", 10),
					("MorgenSinew", 10)
				},
				TrophyPrefab = "TrophyFader",
				AbilityType = typeof(FaderFissureAbility),
				CooldownEffectName = "SE_StaffOfAsh"
			}
		};
	}
}
namespace StaffsOfTheForsaken.Abilities
{
	internal static class AbilityUtils
	{
		public static Vector3 CameraForwardFlat()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Camera val = null;
			if (Camera.allCameras.Length != 0)
			{
				val = Camera.allCameras[0];
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Camera.main;
			}
			if ((Object)(object)val == (Object)null)
			{
				return Vector3.forward;
			}
			Vector3 forward = ((Component)val).transform.forward;
			Vector3 val2 = new Vector3(forward.x, 0f, forward.z);
			return ((Vector3)(ref val2)).normalized;
		}

		public static Vector3 OrbTip(Player player)
		{
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand");
			if ((Object)(object)val != (Object)null)
			{
				return val.position + val.up * 0.5f;
			}
			return ((Component)player).transform.position + Vector3.up * 1.6f;
		}

		public static void PlayAttackAnim(Player player)
		{
		}
	}
	public class EikthyrChargeAbility : BossAbilityBase
	{
		[CompilerGenerated]
		private sealed class <ExpandingShockwave>d__7 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 origin;

			public float dmg;

			public Player player;

			public EikthyrChargeAbility <>4__this;

			private float <elapsed>5__1;

			private float <travelTime>5__2;

			private float <lastRadius>5__3;

			private ZDOID <playerID>5__4;

			private DamageTypes <ringDmg>5__5;

			private float <currentRadius>5__6;

			private Collider[] <hits>5__7;

			private Collider[] <>s__8;

			private int <>s__9;

			private Collider <col>5__10;

			private Character <ch>5__11;

			private float <dist>5__12;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ExpandingShockwave>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<hits>5__7 = null;
				<>s__8 = null;
				<col>5__10 = null;
				<ch>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0048: 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_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: 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_0084: Expected O, but got Unknown
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Invalid comparison between Unknown and I4
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_0208: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0214: 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_022a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: Unknown result type (might be due to invalid IL or missing references)
				//IL_024a: Unknown result type (might be due to invalid IL or missing references)
				//IL_024f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0265: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__1 = 0f;
					<travelTime>5__2 = 1f;
					<lastRadius>5__3 = 2f;
					<playerID>5__4 = ((Character)player).GetZDOID();
					<ringDmg>5__5 = new DamageTypes
					{
						m_lightning = dmg
					};
					break;
				case 1:
					<>1__state = -1;
					<elapsed>5__1 += 0.12f;
					<currentRadius>5__6 = Mathf.Lerp(2f, 10f, Mathf.Clamp01(<elapsed>5__1 / <travelTime>5__2));
					<hits>5__7 = Physics.OverlapSphere(origin, <currentRadius>5__6, LayerMask.GetMask(new string[4] { "character", "character_net", "Default_small", "creature" }));
					<>s__8 = <hits>5__7;
					for (<>s__9 = 0; <>s__9 < <>s__8.Length; <>s__9++)
					{
						<col>5__10 = <>s__8[<>s__9];
						<ch>5__11 = ((Component)<col>5__10).GetComponentInParent<Character>();
						if (!((Object)(object)<ch>5__11 == (Object)null) && !<ch>5__11.IsDead() && !(<ch>5__11 is Player) && !(<ch>5__11.GetZDOID() == <playerID>5__4) && (int)<ch>5__11.m_faction != 0)
						{
							<dist>5__12 = Vector3.Distance(origin, ((Component)<ch>5__11).transform.position);
							if (!(<dist>5__12 < <lastRadius>5__3))
							{
								Character obj = <ch>5__11;
								HitData val = new HitData
								{
									m_damage = <ringDmg>5__5,
									m_point = ((Component)<ch>5__11).transform.position
								};
								Vector3 val2 = ((Component)<ch>5__11).transform.position - origin;
								val.m_dir = ((Vector3)(ref val2)).normalized;
								val.m_attacker = <playerID>5__4;
								obj.Damage(val);
								BossAbilityBase.ApplyStatus(<ch>5__11, "Lightning");
								<ch>5__11 = null;
								<col>5__10 = null;
							}
						}
					}
					<>s__8 = null;
					<lastRadius>5__3 = <currentRadius>5__6;
					<hits>5__7 = null;
					break;
				}
				if (<elapsed>5__1 < <travelTime>5__2)
				{
					<>2__current = (object)new WaitForSeconds(0.12f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const float InnerRadius = 2f;

		private const float OuterRadius = 10f;

		private const float WaveSpeed = 8f;

		private const float TickInterval = 0.12f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = BossAbilityBase.SnapToGround(aimPoint);
			float value = StaffsPlugin.EikthyrDamage.Value;
			BossAbilityBase.SpawnFX("fx_eikthyr_stomp", val, 1.5f);
			BossAbilityBase.DealAoESafe(val, 2f, new DamageTypes
			{
				m_lightning = value
			}, player);
			StartCoroutineOn(player, ExpandingShockwave(val, value, player));
		}

		[IteratorStateMachine(typeof(<ExpandingShockwave>d__7))]
		private IEnumerator ExpandingShockwave(Vector3 origin, float dmg, Player player)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ExpandingShockwave>d__7(0)
			{
				<>4__this = this,
				origin = origin,
				dmg = dmg,
				player = player
			};
		}
	}
	public class ElderShootAbility : BossAbilityBase
	{
		private const int VineCount = 25;

		private const float VineSpeed = 30f;

		private const float MinSpread = 10f;

		private const float MaxSpread = 20f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = AbilityUtils.OrbTip(player);
			BossAbilityBase.SpawnFX("fx_gdking_rootspawn", val);
			BossAbilityBase.SpawnFX("sfx_gdking_shoot_start", val);
			float value = StaffsPlugin.ElderDamage.Value;
			for (int i = 0; i < 25; i++)
			{
				BossAbilityBase.FireProjectile("gdking_root_projectile", val, aimPoint, 30f, player, Random.Range(10f, 20f));
			}
			BossAbilityBase.DealAoESafe(aimPoint, 6f, new DamageTypes
			{
				m_pierce = value
			}, player);
			BossAbilityBase.SpawnFX("fx_gdking_rootspawn", BossAbilityBase.SnapToGround(aimPoint), 1.5f);
		}
	}
	public class BonemassAoEAbility : BossAbilityBase
	{
		[CompilerGenerated]
		private sealed class <PoisonCloud>d__6 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 center;

			public float tickDmg;

			public ZDOID playerID;

			public BonemassAoEAbility <>4__this;

			private float <elapsed>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PoisonCloud>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: 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_0099: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__1 = 0f;
					break;
				case 1:
					<>1__state = -1;
					<elapsed>5__1 += 1f;
					BossAbilityBase.DealAoEByID(center, 9f, new DamageTypes
					{
						m_poison = tickDmg
					}, playerID);
					ApplyStatusInRadius(center, 9f, playerID);
					break;
				}
				if (<elapsed>5__1 < 10f)
				{
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const float CloudRadius = 9f;

		private const float CloudDuration = 10f;

		private const float TickInterval = 1f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0034: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = BossAbilityBase.SnapToGround(aimPoint);
			BossAbilityBase.SpawnFX("vfx_sledge_hit", val, 3f);
			BossAbilityBase.SpawnFX("sfx_Bonemass_alert", val);
			BossAbilityBase.SpawnFX("sfx_Bonemass_Hit", val);
			float value = StaffsPlugin.BonemassDamage.Value;
			float poison = value * 0.4f;
			float tickDmg = value * 0.6f / 10f;
			ZDOID zDOID = ((Character)player).GetZDOID();
			BossAbilityBase.DealAoEByID(val, 9f, new DamageTypes
			{
				m_poison = poison
			}, zDOID);
			ApplyStatusInRadius(val, 9f, zDOID);
			StartCoroutineOn(player, PoisonCloud(val, tickDmg, zDOID));
		}

		[IteratorStateMachine(typeof(<PoisonCloud>d__6))]
		private IEnumerator PoisonCloud(Vector3 center, float tickDmg, ZDOID playerID)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PoisonCloud>d__6(0)
			{
				<>4__this = this,
				center = center,
				tickDmg = tickDmg,
				playerID = playerID
			};
		}

		private static void ApplyStatusInRadius(Vector3 center, float radius, ZDOID casterID)
		{
			//IL_0001: 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_007e: Invalid comparison between Unknown and I4
			Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.GetMask(new string[3] { "character", "character_net", "creature" }));
			HashSet<Character> hashSet = new HashSet<Character>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Character componentInParent = ((Component)val).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && !(componentInParent is Player) && (int)componentInParent.m_faction != 0 && hashSet.Add(componentInParent))
				{
					BossAbilityBase.ApplyStatus(componentInParent, "Poison");
				}
			}
		}
	}
	public class ModerColdBreathAbility : BossAbilityBase
	{
		private const float BeamLength = 30f;

		private const float BeamHalfAngle = 40f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_008c: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Invalid comparison between Unknown and I4
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Expected O, but got Unknown
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = ((Component)player).transform.position + Vector3.up * 1.5f;
			Vector3 val2 = aimPoint - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			BossAbilityBase.SpawnFX("vfx_dragon_coldbreath", val + normalized * 3f, 1.2f, Quaternion.LookRotation(normalized));
			BossAbilityBase.SpawnFX("sfx_dragon_coldbreath_start", val);
			float value = StaffsPlugin.ModerDamage.Value;
			ZDOID zDOID = ((Character)player).GetZDOID();
			Collider[] array = Physics.OverlapSphere(val, 30f, LayerMask.GetMask(new string[4] { "character", "character_net", "Default_small", "creature" }));
			HashSet<Character> hashSet = new HashSet<Character>();
			Collider[] array2 = array;
			foreach (Collider val3 in array2)
			{
				Character componentInParent = ((Component)val3).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && !(componentInParent is Player) && (int)componentInParent.m_faction != 0 && hashSet.Add(componentInParent))
				{
					val2 = ((Component)componentInParent).transform.position - val;
					Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
					if (!(Vector3.Angle(normalized, normalized2) > 40f))
					{
						float num = Vector3.Distance(val, ((Component)componentInParent).transform.position);
						float num2 = Mathf.Lerp(1f, 0.5f, num / 30f);
						componentInParent.Damage(new HitData
						{
							m_damage = new DamageTypes
							{
								m_frost = value * num2
							},
							m_point = ((Component)componentInParent).transform.position,
							m_dir = normalized,
							m_attacker = zDOID
						});
						BossAbilityBase.ApplyStatus(componentInParent, "Frost");
					}
				}
			}
		}
	}
	public class YagluthNovaAbility : BossAbilityBase
	{
		[CompilerGenerated]
		private sealed class <LingerFire>d__10 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 center;

			public Player player;

			public YagluthNovaAbility <>4__this;

			private float <tickDmg>5__1;

			private float <elapsed>5__2;

			private ZDOID <playerID>5__3;

			private Collider[] <cols>5__4;

			private Collider[] <>s__5;

			private int <>s__6;

			private Collider <c>5__7;

			private Character <ch>5__8;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LingerFire>d__10(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cols>5__4 = null;
				<>s__5 = null;
				<c>5__7 = null;
				<ch>5__8 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//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_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Invalid comparison between Unknown and I4
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01da: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01eb: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<tickDmg>5__1 = 10f;
					<elapsed>5__2 = 0f;
					<playerID>5__3 = ((Character)player).GetZDOID();
					break;
				case 1:
					<>1__state = -1;
					<elapsed>5__2 += 1f;
					<cols>5__4 = Physics.OverlapSphere(center, 7f, LayerMask.GetMask(new string[4] { "character", "character_net", "Default_small", "creature" }));
					<>s__5 = <cols>5__4;
					for (<>s__6 = 0; <>s__6 < <>s__5.Length; <>s__6++)
					{
						<c>5__7 = <>s__5[<>s__6];
						<ch>5__8 = ((Component)<c>5__7).GetComponentInParent<Character>();
						if (!((Object)(object)<ch>5__8 == (Object)null) && !<ch>5__8.IsDead() && !(<ch>5__8 is Player) && !(<ch>5__8.GetZDOID() == <playerID>5__3) && (int)<ch>5__8.m_faction != 0)
						{
							Character obj = <ch>5__8;
							HitData val = new HitData
							{
								m_damage = new DamageTypes
								{
									m_fire = <tickDmg>5__1
								},
								m_point = ((Component)<ch>5__8).transform.position
							};
							Vector3 val2 = ((Component)<ch>5__8).transform.position - center;
							val.m_dir = ((Vector3)(ref val2)).normalized;
							val.m_attacker = <playerID>5__3;
							obj.Damage(val);
							<ch>5__8 = null;
							<c>5__7 = null;
						}
					}
					<>s__5 = null;
					<cols>5__4 = null;
					break;
				}
				if (<elapsed>5__2 < 10f)
				{
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <NovaExpand>d__9 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 center;

			public Player player;

			public YagluthNovaAbility <>4__this;

			private float <dmg>5__1;

			private int <steps>5__2;

			private float <stepTime>5__3;

			private ZDOID <playerID>5__4;

			private HashSet<Character> <novaHit>5__5;

			private int <i>5__6;

			private float <ringRadius>5__7;

			private float <ringWidth>5__8;

			private Collider[] <cols>5__9;

			private Collider[] <>s__10;

			private int <>s__11;

			private Collider <c>5__12;

			private Character <ch>5__13;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <NovaExpand>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<novaHit>5__5 = null;
				<cols>5__9 = null;
				<>s__10 = null;
				<c>5__12 = null;
				<ch>5__13 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Expected O, but got Unknown
				//IL_031e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Invalid comparison between Unknown and I4
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: 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_0227: 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_0238: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0262: Unknown result type (might be due to invalid IL or missing references)
				//IL_0267: Unknown result type (might be due to invalid IL or missing references)
				//IL_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_026e: 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_027d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<dmg>5__1 = StaffsPlugin.YagluthDamage.Value;
					<steps>5__2 = 5;
					<stepTime>5__3 = 0.8f / (float)<steps>5__2;
					<playerID>5__4 = ((Character)player).GetZDOID();
					<novaHit>5__5 = new HashSet<Character>();
					<i>5__6 = 1;
					break;
				case 1:
					<>1__state = -1;
					<ringRadius>5__7 = 10f * ((float)<i>5__6 / (float)<steps>5__2);
					<ringWidth>5__8 = 10f / (float)<steps>5__2 * 1.5f;
					<cols>5__9 = Physics.OverlapSphere(center, <ringRadius>5__7, LayerMask.GetMask(new string[4] { "character", "character_net", "Default_small", "creature" }));
					<>s__10 = <cols>5__9;
					for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++)
					{
						<c>5__12 = <>s__10[<>s__11];
						<ch>5__13 = ((Component)<c>5__12).GetComponentInParent<Character>();
						if (!((Object)(object)<ch>5__13 == (Object)null) && !<ch>5__13.IsDead() && !(<ch>5__13.GetZDOID() == <playerID>5__4) && (int)<ch>5__13.m_faction != 0 && <novaHit>5__5.Add(<ch>5__13) && !(Vector3.Distance(center, ((Component)<ch>5__13).transform.position) < <ringRadius>5__7 - <ringWidth>5__8))
						{
							Character obj = <ch>5__13;
							HitData val = new HitData
							{
								m_damage = new DamageTypes
								{
									m_fire = <dmg>5__1,
									m_lightning = <dmg>5__1
								},
								m_point = ((Component)<ch>5__13).transform.position
							};
							Vector3 val2 = ((Component)<ch>5__13).transform.position - center;
							val.m_dir = ((Vector3)(ref val2)).normalized;
							val.m_attacker = <playerID>5__4;
							obj.Damage(val);
							BossAbilityBase.ApplyStatus(<ch>5__13, "Burning");
							BossAbilityBase.ApplyStatus(<ch>5__13, "Lightning");
							<ch>5__13 = null;
							<c>5__12 = null;
						}
					}
					<>s__10 = null;
					<cols>5__9 = null;
					<i>5__6++;
					break;
				}
				if (<i>5__6 <= <steps>5__2)
				{
					<>2__current = (object)new WaitForSeconds(<stepTime>5__3);
					<>1__state = 1;
					return true;
				}
				<>4__this.StartCoroutineOn(player, <>4__this.LingerFire(center, player));
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const float NovaRadius = 10f;

		private const float ExpandTime = 0.8f;

		private const float LingerDuration = 10f;

		private const float LingerTickRate = 1f;

		private const float LingerDmgTotal = 100f;

		private const float MinDistance = 8f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = BossAbilityBase.SnapToGround(aimPoint);
			BossAbilityBase.SpawnFX("fx_goblinking_nova", val, 1.5f);
			StartCoroutineOn(player, NovaExpand(val, player));
		}

		[IteratorStateMachine(typeof(<NovaExpand>d__9))]
		private IEnumerator NovaExpand(Vector3 center, Player player)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <NovaExpand>d__9(0)
			{
				<>4__this = this,
				center = center,
				player = player
			};
		}

		[IteratorStateMachine(typeof(<LingerFire>d__10))]
		private IEnumerator LingerFire(Vector3 center, Player player)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LingerFire>d__10(0)
			{
				<>4__this = this,
				center = center,
				player = player
			};
		}
	}
	public class QueenSpitAbility : BossAbilityBase
	{
		private const int MinSeekers = 3;

		private const int MaxSeekers = 5;

		private const float SpawnRadius = 4f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = BossAbilityBase.SnapToGround(aimPoint);
			BossAbilityBase.SpawnFX("sfx_HiveQueen_acitspit", val);
			int num = Random.Range(3, 6);
			for (int i = 0; i < num; i++)
			{
				float num2 = 360f / (float)num * (float)i * ((float)Math.PI / 180f);
				Vector3 val2 = BossAbilityBase.SnapToGround(val + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * 4f);
				ZNetScene instance = ZNetScene.instance;
				GameObject val3 = ((instance != null) ? instance.GetPrefab("Seeker") : null);
				if (!((Object)(object)val3 == (Object)null))
				{
					GameObject val4 = Object.Instantiate<GameObject>(val3, val2, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f));
					Character component = val4.GetComponent<Character>();
					if ((Object)(object)component != (Object)null)
					{
						component.m_faction = (Faction)0;
					}
					MonsterAI component2 = val4.GetComponent<MonsterAI>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.m_attackPlayerObjects = false;
					}
				}
			}
		}
	}
	public class FaderFissureAbility : BossAbilityBase
	{
		[CompilerGenerated]
		private sealed class <MeteorImpact>d__7 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 pos;

			public float dmg;

			public ZDOID playerID;

			public FaderFissureAbility <>4__this;

			private GameObject <fxGo>5__1;

			private Collider[] <cols>5__2;

			private HashSet<Character> <seen>5__3;

			private Aoe[] <>s__4;

			private int <>s__5;

			private Aoe <aoe>5__6;

			private Collider[] <>s__7;

			private int <>s__8;

			private Collider <c>5__9;

			private Character <ch>5__10;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <MeteorImpact>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<fxGo>5__1 = null;
				<cols>5__2 = null;
				<seen>5__3 = null;
				<>s__4 = null;
				<aoe>5__6 = null;
				<>s__7 = null;
				<c>5__9 = null;
				<ch>5__10 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fe: Invalid comparison between Unknown and I4
				//IL_0230: Unknown result type (might be due to invalid IL or missing references)
				//IL_0235: Unknown result type (might be due to invalid IL or missing references)
				//IL_0238: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0260: Unknown result type (might be due to invalid IL or missing references)
				//IL_0265: Unknown result type (might be due to invalid IL or missing references)
				//IL_0271: Unknown result type (might be due to invalid IL or missing references)
				//IL_0276: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0287: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0292: Unknown result type (might be due to invalid IL or missing references)
				//IL_0297: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b6: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					BossAbilityBase.SpawnFX("fx_Fader_Fissure_Prespawn", pos, 0.8f);
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<fxGo>5__1 = BossAbilityBase.SpawnFX("Fader_Fissure_AOE", pos);
					if ((Object)(object)<fxGo>5__1 != (Object)null)
					{
						<>s__4 = <fxGo>5__1.GetComponentsInChildren<Aoe>(true);
						for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
						{
							<aoe>5__6 = <>s__4[<>s__5];
							<aoe>5__6.m_damage = default(DamageTypes);
							<aoe>5__6.m_hitOwner = false;
							<aoe>5__6.m_hitFriendly = false;
							<aoe>5__6.m_hitEnemy = false;
							<aoe>5__6 = null;
						}
						<>s__4 = null;
					}
					<cols>5__2 = Physics.OverlapSphere(pos, 5f, LayerMask.GetMask(new string[4] { "character", "character_net", "Default_small", "creature" }));
					<seen>5__3 = new HashSet<Character>();
					<>s__7 = <cols>5__2;
					for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
					{
						<c>5__9 = <>s__7[<>s__8];
						<ch>5__10 = ((Component)<c>5__9).GetComponentInParent<Character>();
						if (!((Object)(object)<ch>5__10 == (Object)null) && !<ch>5__10.IsDead() && !(<ch>5__10 is Player) && (int)<ch>5__10.m_faction != 0 && <seen>5__3.Add(<ch>5__10))
						{
							Character obj = <ch>5__10;
							HitData val = new HitData
							{
								m_damage = new DamageTypes
								{
									m_fire = dmg,
									m_blunt = dmg * 0.5f
								},
								m_point = ((Component)<ch>5__10).transform.position
							};
							Vector3 val2 = ((Component)<ch>5__10).transform.position - pos;
							val.m_dir = ((Vector3)(ref val2)).normalized;
							val.m_attacker = playerID;
							obj.Damage(val);
							BossAbilityBase.ApplyStatus(<ch>5__10, "Burning");
							<ch>5__10 = null;
							<c>5__9 = null;
						}
					}
					<>s__7 = null;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const int MeteorCount = 3;

		private const float ImpactRadius = 5f;

		private const float WarnDelay = 2f;

		private const float SpreadRadius = 3f;

		protected override float CooldownTime => 20f;

		protected override void Execute(Player player, Vector3 aimPoint)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			AbilityUtils.PlayAttackAnim(player);
			Vector3 val = BossAbilityBase.SnapToGround(aimPoint);
			ZDOID zDOID = ((Character)player).GetZDOID();
			float value = StaffsPlugin.FaderDamage.Value;
			BossAbilityBase.SpawnFX("fx_Fader_Fissure_Prespawn", val, 0.5f);
			BossAbilityBase.SpawnFX("sfx_fader_fissure", val);
			for (int i = 0; i < 3; i++)
			{
				Vector2 val2 = Random.insideUnitCircle * 3f;
				Vector3 pos = BossAbilityBase.SnapToGround(val + new Vector3(val2.x, 0f, val2.y));
				StartCoroutineOn(player, MeteorImpact(pos, value, zDOID));
			}
		}

		[IteratorStateMachine(typeof(<MeteorImpact>d__7))]
		private IEnumerator MeteorImpact(Vector3 pos, float dmg, ZDOID playerID)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <MeteorImpact>d__7(0)
			{
				<>4__this = this,
				pos = pos,
				dmg = dmg,
				playerID = playerID
			};
		}
	}
	public abstract class BossAbilityBase : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayedExecute>d__10 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Player player;

			public Vector3 aimPoint;

			public BossAbilityBase <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayedExecute>d__10(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.Execute(player, aimPoint);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private float _readyAt = 0f;

		private static readonly Dictionary<string, AudioClip> s_clipCache = new Dictionary<string, AudioClip>();

		protected virtual float CooldownTime => 10f;

		public float CooldownSeconds => CooldownTime;

		public string CooldownEffectName { get; set; }

		public bool TryActivate(Player player, Vector3 aimPoint)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			float time = Time.time;
			if (time < _readyAt)
			{
				return false;
			}
			_readyAt = time + CooldownTime;
			if (!string.IsNullOrEmpty(CooldownEffectName))
			{
				ObjectDB instance = ObjectDB.instance;
				StatusEffect val = ((instance != null) ? instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(CooldownEffectName)) : null);
				if ((Object)(object)val != (Object)null)
				{
					SEMan sEMan = ((Character)player).GetSEMan();
					if (sEMan != null)
					{
						sEMan.AddStatusEffect(val, true, 0, 0f);
					}
				}
			}
			((MonoBehaviour)player).StartCoroutine(DelayedExecute(player, aimPoint));
			return true;
		}

		[IteratorStateMachine(typeof(<DelayedExecute>d__10))]
		private IEnumerator DelayedExecute(Player player, Vector3 aimPoint)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayedExecute>d__10(0)
			{
				<>4__this = this,
				player = player,
				aimPoint = aimPoint
			};
		}

		protected abstract void Execute(Player player, Vector3 aimPoint);

		protected void StartCoroutineOn(Player player, IEnumerator routine)
		{
			((MonoBehaviour)player).StartCoroutine(routine);
		}

		protected void DealAoE(Vector3 center, float radius, DamageTypes damage, Player caster, bool friendlyFire = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.GetMask(new string[3] { "character", "character_net", "Default_small" }));
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Character componentInParent = ((Component)val).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && (friendlyFire || !((Object)(object)componentInParent == (Object)(object)caster)))
				{
					HitData val2 = new HitData
					{
						m_damage = damage,
						m_point = ((Component)componentInParent).transform.position
					};
					Vector3 val3 = ((Component)componentInParent).transform.position - center;
					val2.m_dir = ((Vector3)(ref val3)).normalized;
					val2.m_attacker = ((Character)caster).GetZDOID();
					HitData val4 = val2;
					componentInParent.Damage(val4);
				}
			}
		}

		protected static void DealAoESafe(Vector3 center, float radius, DamageTypes damage, Player caster)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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)
			DealAoEByID(center, radius, damage, ((Character)caster).GetZDOID());
		}

		protected static void DealAoEByID(Vector3 center, float radius, DamageTypes damage, ZDOID casterID)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00d6: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f6: Expected O, but got Unknown
			Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.GetMask(new string[4] { "character", "character_net", "Default_small", "creature" }));
			HashSet<Character> hashSet = new HashSet<Character>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Character componentInParent = ((Component)val).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && !(componentInParent is Player) && (int)componentInParent.m_faction != 0 && hashSet.Add(componentInParent))
				{
					HitData val2 = new HitData
					{
						m_damage = damage,
						m_point = ((Component)componentInParent).transform.position
					};
					Vector3 val3 = ((Component)componentInParent).transform.position - center;
					val2.m_dir = ((Vector3)(ref val3)).normalized;
					val2.m_attacker = casterID;
					componentInParent.Damage(val2);
				}
			}
		}

		protected static void ApplyStatus(Character target, string effectName)
		{
			ObjectDB instance = ObjectDB.instance;
			StatusEffect val = ((instance != null) ? instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(effectName)) : null);
			if (!((Object)(object)val == (Object)null))
			{
				SEMan sEMan = target.GetSEMan();
				if (sEMan != null)
				{
					sEMan.AddStatusEffect(val, true, 0, 0f);
				}
			}
		}

		protected static GameObject SpawnFX(string prefabName, Vector3 pos, float scale = 1f, Quaternion? rot = null)
		{
			//IL_0050: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			ZNetScene instance = ZNetScene.instance;
			GameObject val = ((instance != null) ? instance.GetPrefab(prefabName) : null);
			if ((Object)(object)val == (Object)null)
			{
				StaffsPlugin.Log.LogWarning((object)("FX prefab not found: " + prefabName));
				return null;
			}
			Quaternion val2 = (Quaternion)(((??)rot) ?? Quaternion.identity);
			GameObject val3 = Object.Instantiate<GameObject>(val, pos, val2);
			if (scale != 1f)
			{
				val3.transform.localScale = Vector3.one * scale;
			}
			return val3;
		}

		protected static void FireProjectile(string prefabName, Vector3 origin, Vector3 target, float speed, Player owner, float spread = 0f)
		{
			//IL_003d: 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_0044: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			ZNetScene instance = ZNetScene.instance;
			GameObject val = ((instance != null) ? instance.GetPrefab(prefabName) : null);
			if ((Object)(object)val == (Object)null)
			{
				StaffsPlugin.Log.LogWarning((object)("Projectile prefab not found: " + prefabName));
				return;
			}
			Vector3 val2 = target - origin;
			Vector3 val3 = ((Vector3)(ref val2)).normalized;
			if (spread > 0f)
			{
				val3 = Quaternion.Euler(Random.Range(0f - spread, spread), Random.Range(0f - spread, spread), 0f) * val3;
			}
			GameObject val4 = Object.Instantiate<GameObject>(val, origin, Quaternion.LookRotation(val3));
			Projectile val5 = default(Projectile);
			if (val4.TryGetComponent<Projectile>(ref val5))
			{
				HitData val6 = new HitData();
				val6.m_attacker = ((Character)owner).GetZDOID();
				val5.Setup((Character)(object)owner, val3 * speed, -1f, val6, (ItemData)null, (ItemData)null);
			}
			Rigidbody val7 = default(Rigidbody);
			if (val4.TryGetComponent<Rigidbody>(ref val7))
			{
				val7.velocity = val3 * speed;
			}
		}

		protected static Vector3 SnapToGround(Vector3 pos, float searchHeight = 5f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(pos + Vector3.up * searchHeight, Vector3.down, ref val, searchHeight * 2f, LayerMask.GetMask(new string[2] { "terrain", "Default" })))
			{
				return ((RaycastHit)(ref val)).point;
			}
			return pos;
		}

		protected static void PlayAudioClip(string clipName, Vector3 pos, float volume = 1f, float pitch = 1f)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (!s_clipCache.TryGetValue(clipName, out var value) || (Object)(object)value == (Object)null)
			{
				foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
				{
					if (!allLoadedAssetBundle.isStreamedSceneAssetBundle)
					{
						try
						{
							value = allLoadedAssetBundle.LoadAsset<AudioClip>(clipName);
						}
						catch
						{
							continue;
						}
						if ((Object)(object)value != (Object)null)
						{
							break;
						}
					}
				}
				s_clipCache[clipName] = value;
			}
			if ((Object)(object)value == (Object)null)
			{
				StaffsPlugin.Log.LogWarning((object)("AudioClip not found in loaded bundles: " + clipName));
			}
			else
			{
				AudioSource.PlayClipAtPoint(value, pos, volume);
			}
		}
	}
}