Decompiled source of JJK Cursed Techniques v1.2.5

SukunaMod.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using SukunaMod.Model;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SukunaMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.5.0")]
[assembly: AssemblyInformationalVersion("1.2.5")]
[assembly: AssemblyProduct("SukunaMod")]
[assembly: AssemblyTitle("SukunaMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SukunaMod
{
	internal static class BandanaItem
	{
		internal static readonly RuntimeItem Runtime = new RuntimeItem(new ItemSpec
		{
			AssetName = "Item Gojo Blindfold",
			DisplayName = "Gojo's Blindfold",
			Description = "Satoru Gojo's blindfold. Put it on to see with the Six Eyes and wield Limitless.",
			IconResource = "bandana_icon.png",
			ValueMax = 12500f,
			ColliderSize = new Vector3(0.24f, 0.07f, 0.3f),
			BuildModel = BuildModel,
			Behaviour = typeof(GojoBlindfoldItem)
		});

		internal static Item Item => Runtime.Item;

		internal static Texture2D IconTexture => Runtime.Icon;

		internal static void TryRegister()
		{
			Runtime.TryRegister();
		}

		private static void BuildModel(Transform parent, Vector3 center, Material baseMat, int layer)
		{
			//IL_0036: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			Mesh mesh = ItemFactory.ToMesh(BandanaModel.BuildMesh(), "Gojo Blindfold");
			Texture2D tex = ItemFactory.ToTexture(BandanaModel.BuildTexture(), 256, "Gojo Blindfold");
			Material val = ItemFactory.ModelMaterial(baseMat, tex, new Color(0.004f, 0.01f, 0.03f), "Gojo Blindfold");
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", 0.45f);
			}
			ItemFactory.SmallGlow(ItemFactory.ModelObject("Gojo Blindfold Model", parent, center, mesh, val, layer).transform, new Color(0.3f, 0.6f, 1f), 0.45f, 1.4f, layer);
		}
	}
	public class GojoBlindfoldItem : MonoBehaviour
	{
		private ItemToggle toggle;

		private ItemAttributes attributes;

		private PhysGrabObject physGrabObject;

		private bool used;

		private float rejectCooldown;

		private void Awake()
		{
			ItemFactory.GiveOwnIcon((Component)(object)this, BandanaItem.Runtime);
		}

		private void Start()
		{
			toggle = ((Component)this).GetComponent<ItemToggle>();
			attributes = ((Component)this).GetComponent<ItemAttributes>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			NotValuableObject component = ((Component)this).GetComponent<NotValuableObject>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.hasHealth = false;
			}
		}

		private void Update()
		{
			//IL_0118: 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)
			if (rejectCooldown > 0f)
			{
				rejectCooldown -= Time.deltaTime;
			}
			if (used || !Object.op_Implicit((Object)(object)toggle) || !toggle.toggleState || SemiFunc.RunIsShop() || RunManager.instance.levelIsShop || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(toggle.playerTogglePhotonID);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			if (Blindfold.Get(val) > 0)
			{
				toggle.ToggleItem(false, -1);
				if (rejectCooldown <= 0f)
				{
					rejectCooldown = 1f;
					SukunaNet.SendFingerEvent(Tech.BlindfoldRejected, val, 1, ((Component)this).transform.position);
				}
				return;
			}
			used = true;
			Powers.Grant(val, Powers.Kind.Gojo);
			if (Object.op_Implicit((Object)(object)attributes) && !string.IsNullOrEmpty(attributes.instanceName))
			{
				StatsManager.instance.ItemRemove(attributes.instanceName);
			}
			toggle.ToggleDisable(true);
			SukunaNet.SendFingerEvent(Tech.BlindfoldWorn, val, Fingers.Get(val), ((Component)this).transform.position);
			physGrabObject.DestroyPhysGrabObject();
		}
	}
	internal sealed class BossDef
	{
		internal readonly string PrefabName;

		internal readonly string Name;

		private readonly Func<int> health;

		private readonly Type ai;

		private readonly Type model;

		internal EnemySetup Setup;

		private bool done;

		private float nextAttempt;

		private int attempts;

		internal BossDef(string prefabName, string name, Func<int> health, Type ai, Type model)
		{
			PrefabName = prefabName;
			Name = name;
			this.health = health;
			this.ai = ai;
			this.model = model;
		}

		internal void TryRegister()
		{
			if (done || Time.unscaledTime < nextAttempt || !Object.op_Implicit((Object)(object)EnemyDirector.instance) || !Object.op_Implicit((Object)(object)RunManager.instance))
			{
				return;
			}
			nextAttempt = Time.unscaledTime + 3f;
			attempts++;
			try
			{
				done = Build();
				if (done && Object.op_Implicit((Object)(object)Setup))
				{
					Plugin.Log.LogInfo((object)(Name + " registered."));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Building the " + Name + " enemy failed: " + ex));
				done = attempts >= 3;
			}
		}

		private static EnemySetup FindRobe()
		{
			EnemyDirector instance = EnemyDirector.instance;
			List<EnemySetup>[] array = new List<EnemySetup>[3] { instance.enemiesDifficulty1, instance.enemiesDifficulty2, instance.enemiesDifficulty3 };
			foreach (List<EnemySetup> list in array)
			{
				if (list == null)
				{
					continue;
				}
				foreach (EnemySetup item in list)
				{
					if (Object.op_Implicit((Object)(object)item) && ((Object)item).name == "Enemy - Robe" && item.spawnObjects != null && item.spawnObjects.Count > 0)
					{
						return item;
					}
				}
			}
			return null;
		}

		private bool Build()
		{
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			EnemySetup val = FindRobe();
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			GameObject prefab = ((PrefabRef<GameObject>)(object)val.spawnObjects[0]).Prefab;
			if (!Object.op_Implicit((Object)(object)prefab))
			{
				return false;
			}
			GameObject val2 = Object.Instantiate<GameObject>(prefab, ItemFactory.Holder);
			((Object)val2).name = PrefabName;
			EnemyRobe[] componentsInChildren = val2.GetComponentsInChildren<EnemyRobe>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
			}
			EnemyRobeAnim[] componentsInChildren2 = val2.GetComponentsInChildren<EnemyRobeAnim>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
			}
			EnemyRobePersistent[] componentsInChildren3 = val2.GetComponentsInChildren<EnemyRobePersistent>(true);
			foreach (EnemyRobePersistent obj in componentsInChildren3)
			{
				GameObject gameObject = ((Component)obj).gameObject;
				Object.DestroyImmediate((Object)(object)obj);
				gameObject.SetActive(false);
			}
			Animator[] componentsInChildren4 = val2.GetComponentsInChildren<Animator>(true);
			for (int i = 0; i < componentsInChildren4.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren4[i]);
			}
			Enemy componentInChildren = val2.GetComponentInChildren<Enemy>(true);
			EnemyParent component = val2.GetComponent<EnemyParent>();
			EnemyHealth componentInChildren2 = val2.GetComponentInChildren<EnemyHealth>(true);
			if (!Object.op_Implicit((Object)(object)componentInChildren) || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)componentInChildren2))
			{
				throw new InvalidOperationException("Robe prefab is missing Enemy/EnemyParent/EnemyHealth");
			}
			Transform val3 = null;
			Transform[] componentsInChildren5 = val2.GetComponentsInChildren<Transform>(true);
			foreach (Transform val4 in componentsInChildren5)
			{
				if (((Object)val4).name == "Visual")
				{
					val3 = val4;
					break;
				}
			}
			if (!Object.op_Implicit((Object)(object)val3))
			{
				throw new InvalidOperationException("Robe prefab has no Visual");
			}
			Renderer[] componentsInChildren6 = ((Component)val3).GetComponentsInChildren<Renderer>(true);
			for (int i = 0; i < componentsInChildren6.Length; i++)
			{
				componentsInChildren6[i].enabled = false;
			}
			Light[] componentsInChildren7 = ((Component)val3).GetComponentsInChildren<Light>(true);
			for (int i = 0; i < componentsInChildren7.Length; i++)
			{
				((Behaviour)componentsInChildren7[i]).enabled = false;
			}
			HurtCollider[] componentsInChildren8 = ((Component)val3).GetComponentsInChildren<HurtCollider>(true);
			for (int i = 0; i < componentsInChildren8.Length; i++)
			{
				((Component)componentsInChildren8[i]).gameObject.SetActive(false);
			}
			component.enemyName = Name;
			component.enemyNameLocalized = null;
			component.difficulty = (Difficulty)2;
			component.SpawnedTimeMin = 600f;
			component.SpawnedTimeMax = 900f;
			component.DespawnedTimeMin = 60f;
			component.DespawnedTimeMax = 90f;
			componentInChildren2.health = health();
			componentInChildren2.spawnValuable = true;
			componentInChildren.Type = (EnemyType)4;
			componentInChildren.SightingStinger = false;
			componentInChildren.EnemyNearMusic = false;
			((Component)componentInChildren).gameObject.AddComponent(ai);
			((Component)val3).gameObject.AddComponent(model);
			EnemySetup val5 = ScriptableObject.CreateInstance<EnemySetup>();
			((Object)val5).name = PrefabName;
			val5.status = (Status)1;
			val5.rarityPreset = val.rarityPreset;
			((Object)val5).hideFlags = (HideFlags)32;
			PrefabRef val6 = NetworkPrefabs.RegisterNetworkPrefab("Enemies/" + PrefabName, val2);
			if (val6 == null)
			{
				Plugin.Log.LogError((object)("REPOLib refused the " + Name + " enemy prefab."));
				return true;
			}
			Utilities.FixAudioMixerGroups(val2);
			val5.spawnObjects = new List<PrefabRef> { val6 };
			Setup = val5;
			return true;
		}

		internal bool Spawn(Vector3 position)
		{
			//IL_001c: 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)
			if (!Object.op_Implicit((Object)(object)Setup) || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return false;
			}
			List<EnemyParent> list = Enemies.SpawnEnemy(Setup, position, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), false);
			if (list != null)
			{
				return list.Count > 0;
			}
			return false;
		}
	}
	internal static class Bosses
	{
		internal static readonly BossDef Gojo = new BossDef("Enemy - Gojo", "Satoru Gojo", () => SukunaConfig.GojoHealth.Value, typeof(GojoEnemyAI), typeof(GojoModel));

		internal static readonly BossDef Sukuna = new BossDef("Enemy - Sukuna", "Ryomen Sukuna", () => SukunaConfig.SukunaHealth.Value, typeof(SukunaEnemyAI), typeof(SukunaModel));

		internal static readonly BossDef Megumi = new BossDef("Enemy - Megumi", "Megumi Fushiguro", () => SukunaConfig.MegumiHealth.Value, typeof(MegumiEnemyAI), typeof(MegumiModel));

		internal static readonly BossDef[] All = new BossDef[3] { Gojo, Sukuna, Megumi };

		internal static float SpawnChance(BossDef b)
		{
			if (b != Gojo)
			{
				if (b != Sukuna)
				{
					return SukunaConfig.MegumiSpawnChance.Value;
				}
				return SukunaConfig.SukunaSpawnChance.Value;
			}
			return SukunaConfig.GojoSpawnChance.Value;
		}

		internal static void TryRegister()
		{
			BossDef[] all = All;
			for (int i = 0; i < all.Length; i++)
			{
				all[i].TryRegister();
			}
		}
	}
	internal abstract class BossAI : MonoBehaviour
	{
		internal static readonly List<BossAI> All = new List<BossAI>();

		private static int nextLocalId = 1;

		internal Enemy enemy;

		internal BossModel Model;

		internal bool Dead;

		protected PhotonView view;

		protected PlayerAvatar target;

		protected float aggroTimer;

		private int localId;

		private bool dropped;

		protected Vector3 roamTarget;

		private float roamTimer;

		internal int NetId
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)view) || view.ViewID == 0)
				{
					return localId;
				}
				return view.ViewID;
			}
		}

		internal Transform HandPoint
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)Model) || !Object.op_Implicit((Object)(object)Model.Hand))
				{
					return ((Component)this).transform;
				}
				return Model.Hand;
			}
		}

		internal bool Aggro => aggroTimer > 0f;

		protected static bool Host => SemiFunc.IsMasterClientOrSingleplayer();

		internal Vector3 Center
		{
			get
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.CenterTransform))
				{
					return ((Component)this).transform.position + Vector3.up;
				}
				return enemy.CenterTransform.position;
			}
		}

		internal float HealthFraction
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)enemy) || !enemy.HasHealth)
				{
					return 1f;
				}
				return (float)enemy.Health.healthCurrent / (float)Mathf.Max(1, enemy.Health.health);
			}
		}

		protected bool Busy
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				if (Object.op_Implicit((Object)(object)enemy) && (int)enemy.CurrentState != 11)
				{
					return !enemy.EnemyParent.Spawned;
				}
				return true;
			}
		}

		internal static BossAI Find(int id)
		{
			foreach (BossAI item in All)
			{
				if (Object.op_Implicit((Object)(object)item) && item.NetId == id)
				{
					return item;
				}
			}
			return null;
		}

		internal static T First<T>() where T : BossAI
		{
			foreach (BossAI item in All)
			{
				if (item is T result)
				{
					return result;
				}
			}
			return null;
		}

		protected virtual void Awake()
		{
			enemy = ((Component)this).GetComponent<Enemy>();
			view = ((Component)this).GetComponent<PhotonView>();
			localId = -(nextLocalId++);
			All.Add(this);
		}

		protected virtual void Start()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			Model = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? ((Component)((Component)this).transform.parent).GetComponentInChildren<BossModel>(true) : null);
			if (Object.op_Implicit((Object)(object)Model))
			{
				Model.Ai = this;
			}
			BossHitbox.Add(enemy, Object.op_Implicit((Object)(object)Model) ? ((Component)Model).transform : null, 2.4f, 0.42f);
			if (enemy.HasStateSpawn && Object.op_Implicit((Object)(object)enemy.StateSpawn))
			{
				enemy.StateSpawn.OnSpawn.AddListener(new UnityAction(SpawnHook));
			}
			if (enemy.HasHealth && Object.op_Implicit((Object)(object)enemy.Health))
			{
				enemy.Health.onHurt.AddListener(new UnityAction(HurtHook));
				enemy.Health.onObjectHurt.AddListener(new UnityAction(ObjectHurtHook));
				enemy.Health.onDeath.AddListener(new UnityAction(DeathHook));
			}
			if (enemy.HasRigidbody && Object.op_Implicit((Object)(object)enemy.Rigidbody))
			{
				enemy.Rigidbody.onGrabbed.AddListener(new UnityAction(GrabHook));
			}
			if (enemy.HasVision && Object.op_Implicit((Object)(object)enemy.Vision))
			{
				enemy.Vision.onVisionTriggered.AddListener(new UnityAction(VisionHook));
			}
		}

		protected virtual void OnDestroy()
		{
			All.Remove(this);
		}

		private void SpawnHook()
		{
			if (Host)
			{
				dropped = false;
				Dead = false;
				if (SemiFunc.EnemySpawn(enemy))
				{
					OnSpawned();
				}
			}
		}

		private void HurtHook()
		{
			if (Host && !Dead)
			{
				PlayerAvatar val = enemy.Health.onObjectHurtPlayer;
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = NearestPlayer(25f, needSight: false);
				}
				Provoke(val);
			}
		}

		private void ObjectHurtHook()
		{
			if (Host && !Dead && Object.op_Implicit((Object)(object)enemy.Health.onObjectHurtPlayer))
			{
				Provoke(enemy.Health.onObjectHurtPlayer);
			}
		}

		private void GrabHook()
		{
			if (Host && !Dead && Object.op_Implicit((Object)(object)enemy.Rigidbody.onGrabbedPlayerAvatar))
			{
				Provoke(enemy.Rigidbody.onGrabbedPlayerAvatar);
			}
		}

		private void VisionHook()
		{
			if (Host && !Dead)
			{
				PlayerAvatar onVisionTriggeredPlayer = enemy.Vision.onVisionTriggeredPlayer;
				if (Object.op_Implicit((Object)(object)onVisionTriggeredPlayer))
				{
					OnSeen(onVisionTriggeredPlayer);
				}
			}
		}

		private void DeathHook()
		{
			//IL_001f: 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_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_004a: Unknown result type (might be due to invalid IL or missing references)
			if (Dead)
			{
				return;
			}
			Dead = true;
			OnDied();
			if (Host)
			{
				Vector3 center = Center;
				SukunaNet.SendEnemy(Tech.EnemyDefeated, this, center, Vector3.up);
				if (!dropped)
				{
					dropped = true;
					DropLoot(center);
				}
				enemy.EnemyParent.Despawn();
				enemy.EnemyParent.DespawnedTimer = 10000000f;
			}
		}

		protected abstract void OnSpawned();

		protected abstract void OnSeen(PlayerAvatar p);

		protected abstract void Provoke(PlayerAvatar who);

		protected abstract void DropLoot(Vector3 at);

		protected virtual void OnDied()
		{
		}

		internal abstract void ProvokedFx(Cast c);

		internal abstract void DefeatedFx(Cast c);

		protected static bool Valid(PlayerAvatar p)
		{
			if (Object.op_Implicit((Object)(object)p) && !p.deadSet)
			{
				return !p.isDisabled;
			}
			return false;
		}

		protected PlayerAvatar NearestPlayer(float range, bool needSight)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0066: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar result = null;
			float num = range;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Valid(item))
				{
					float num2 = Vector3.Distance(((Component)item).transform.position, ((Component)this).transform.position);
					if (!(num2 >= num) && (!needSight || Combat.LineOfSight(((Component)this).transform.position + Vector3.up * 1.6f, BossHits.Center(item))))
					{
						result = item;
						num = num2;
					}
				}
			}
			return result;
		}

		protected void Roam(float speed)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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)
			enemy.NavMeshAgent.OverrideAgent(speed, 6f, 0.2f);
			roamTimer -= Time.deltaTime;
			if (roamTimer <= 0f || Vector3.Distance(((Component)this).transform.position, roamTarget) < 1.5f)
			{
				roamTimer = 12f;
				LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 18f);
				NavMeshHit val2 = default(NavMeshHit);
				if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 2f, ref val2, 4f, -1))
				{
					roamTarget = ((NavMeshHit)(ref val2)).position;
				}
			}
			enemy.NavMeshAgent.SetDestination(roamTarget);
		}

		protected void Face(PlayerAvatar p)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0053: 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_0080: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			if (Object.op_Implicit((Object)(object)p))
			{
				val = ((Component)p).transform.position - ((Component)this).transform.position;
			}
			else if (((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).sqrMagnitude > 0.05f)
			{
				val = enemy.NavMeshAgent.AgentVelocity;
			}
			val.y = 0f;
			if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f))
			{
				((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), Time.deltaTime * 8f);
			}
		}

		protected bool TeleportAround(PlayerAvatar p, float distance, Tech tech)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0072: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			NavMeshHit val = default(NavMeshHit);
			if (!NavMesh.SamplePosition(((Component)p).transform.position + Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward * distance, ref val, 4f, -1))
			{
				return false;
			}
			enemy.EnemyTeleported(((NavMeshHit)(ref val)).position);
			SukunaNet.SendEnemy(tech, this, position, ((NavMeshHit)(ref val)).position - position, Vector3.Distance(position, ((NavMeshHit)(ref val)).position));
			return true;
		}

		protected void Announce()
		{
			//IL_0009: 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)
			SukunaNet.SendEnemy(Tech.EnemyProvoked, this, HandPoint.position, ((Component)this).transform.forward);
		}
	}
	internal static class BossHits
	{
		internal static bool LocalTarget(out PlayerAvatar me)
		{
			me = PlayerAvatar.instance;
			if (Object.op_Implicit((Object)(object)me) && !me.deadSet && !me.isDisabled)
			{
				return Object.op_Implicit((Object)(object)me.playerHealth);
			}
			return false;
		}

		internal static Vector3 Center(PlayerAvatar p)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			return ((Component)p).transform.position + Vector3.up * 0.9f;
		}

		internal static void Hurt(Cast c, PlayerAvatar me, int damage, Vector3 push, float tumbleTime = 1.5f)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			int num = ((Object.op_Implicit((Object)(object)c.Enemy) && Object.op_Implicit((Object)(object)c.Enemy.enemy)) ? SemiFunc.EnemyGetIndex(c.Enemy.enemy) : (-1));
			if (damage > 0)
			{
				me.playerHealth.Hurt(damage, true, num, false);
			}
			if (((Vector3)(ref push)).sqrMagnitude > 0.01f && Object.op_Implicit((Object)(object)me.tumble))
			{
				me.tumble.TumbleRequest(true, false);
				me.tumble.TumbleOverrideTime(tumbleTime);
				me.tumble.TumbleForce(push);
			}
		}

		internal static bool LocalNear(Vector3 p, float radius, bool needSight, out PlayerAvatar me)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0021: 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)
			if (!LocalTarget(out me))
			{
				return false;
			}
			Vector3 val = Center(me);
			if (Vector3.Distance(val, p) > radius)
			{
				return false;
			}
			if (needSight)
			{
				return Combat.LineOfSight(p, val);
			}
			return true;
		}

		internal static bool AnyPlayerNear(Vector3 a, Vector3 b, float radius, out Vector3 at)
		{
			//IL_0064: 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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Object.op_Implicit((Object)(object)item) && !item.deadSet && !item.isDisabled)
				{
					Vector3 val = Center(item);
					if (Combat.DistanceToSegment(val, a, b) < radius)
					{
						at = val;
						return true;
					}
				}
			}
			at = Vector3.zero;
			return false;
		}

		internal static PlayerAvatar NearestPlayer(Vector3 from, float range)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			PlayerAvatar result = null;
			float num = range;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Object.op_Implicit((Object)(object)item) && !item.deadSet && !item.isDisabled)
				{
					float num2 = Vector3.Distance(Center(item), from);
					if (num2 < num)
					{
						num = num2;
						result = item;
					}
				}
			}
			return result;
		}
	}
	internal abstract class BossModel : MonoBehaviour
	{
		internal BossAI Ai;

		internal Transform Hand;

		protected float castTimer;

		protected float aggroTimer;

		protected float speed;

		protected float phase;

		private Vector3 lastPos;

		protected bool Fighting => aggroTimer > 0f;

		internal void SetAggro(float time)
		{
			aggroTimer = time;
		}

		internal virtual void OnCast()
		{
			castTimer = 0.9f;
		}

		protected virtual void Awake()
		{
			//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)
			Build();
			lastPos = ((Component)this).transform.position;
		}

		protected abstract void Build();

		protected float Step(float dt, out float s)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			Vector3 val = (position - lastPos) / dt;
			lastPos = position;
			val.y = 0f;
			speed = Mathf.Lerp(speed, Mathf.Min(((Vector3)(ref val)).magnitude, 6f), dt * 6f);
			castTimer -= dt;
			aggroTimer -= dt;
			float result = Mathf.Clamp01(speed / 2.5f);
			phase += dt * (3f + speed * 2.2f);
			s = Mathf.Sin(phase);
			return result;
		}

		protected static void Legs(float walk, float s, Transform legL, Transform legR, Transform kneeL, Transform kneeR)
		{
			//IL_0014: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			legL.localRotation = Quaternion.Euler(s * 28f * walk, 0f, 0f);
			legR.localRotation = Quaternion.Euler((0f - s) * 28f * walk, 0f, 0f);
			kneeL.localRotation = Quaternion.Euler((0f - Mathf.Max(0f, 0f - s)) * 35f * walk, 0f, 0f);
			kneeR.localRotation = Quaternion.Euler((0f - Mathf.Max(0f, s)) * 35f * walk, 0f, 0f);
		}

		protected Transform NewRoot(string name, float scale)
		{
			//IL_0001: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = new GameObject(name).transform;
			transform.SetParent(((Component)this).transform, false);
			transform.localPosition = new Vector3(0f, 0.11f, 0f);
			transform.localScale = Vector3.one * scale;
			return transform;
		}

		protected void Finish(Transform root)
		{
			int layer = ((Component)this).gameObject.layer;
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.layer = layer;
			}
			Renderer[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Renderer>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				componentsInChildren2[i].shadowCastingMode = (ShadowCastingMode)1;
			}
		}

		internal static Transform Pivot(string name, Transform parent, Vector3 localPos)
		{
			//IL_0001: 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)
			Transform transform = new GameObject(name).transform;
			transform.SetParent(parent, false);
			transform.localPosition = localPos;
			return transform;
		}

		internal static Transform Limb(string name, Transform parent, Vector3 at, float upperLen, float upperR, Material upperMat, out Transform lower, float lowerLen, float lowerR, Material lowerMat)
		{
			//IL_0002: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Pivot(name, parent, at);
			Vfx.Prim((PrimitiveType)1, val, new Vector3(0f, (0f - upperLen) * 0.5f, 0f), new Vector3(upperR * 2f, upperLen * 0.5f, upperR * 2f), Quaternion.identity, upperMat);
			lower = Pivot(name + " Lower", val, new Vector3(0f, 0f - upperLen, 0f));
			Vfx.Prim((PrimitiveType)1, lower, new Vector3(0f, (0f - lowerLen) * 0.5f, 0f), new Vector3(lowerR * 2f, lowerLen * 0.5f, lowerR * 2f), Quaternion.identity, lowerMat);
			return val;
		}

		internal static Light PointLight(Transform parent, Vector3 at, Color c, float range, float intensity)
		{
			//IL_0006: 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)
			Light obj = ((Component)Pivot("Glow", parent, at)).gameObject.AddComponent<Light>();
			obj.type = (LightType)2;
			obj.color = c;
			obj.range = range;
			obj.intensity = intensity;
			obj.shadows = (LightShadows)0;
			return obj;
		}
	}
	internal static class Combat
	{
		internal enum Impact
		{
			None,
			Light,
			Medium,
			Heavy
		}

		private static int worldMask = -1;

		private static int hingeMask = -1;

		private static int propMask = -1;

		internal const float DoorHealth = 100f;

		private static readonly Dictionary<PhysGrabHinge, float> doorHealth = new Dictionary<PhysGrabHinge, float>();

		internal static bool IsHost => SemiFunc.IsMasterClientOrSingleplayer();

		internal static int WorldMask
		{
			get
			{
				if (worldMask == -1)
				{
					worldMask = LayerMask.GetMask(new string[2] { "Default", "StaticGrabObject" });
				}
				return worldMask;
			}
		}

		private static int HingeMask
		{
			get
			{
				if (hingeMask == -1)
				{
					hingeMask = LayerMask.GetMask(new string[2] { "PhysGrabObjectHinge", "PhysGrabObject" });
				}
				return hingeMask;
			}
		}

		private static int PropMask
		{
			get
			{
				if (propMask == -1)
				{
					propMask = LayerMask.GetMask(new string[2] { "PhysGrabObject", "PhysGrabObjectCart" });
				}
				return propMask;
			}
		}

		internal static List<Enemy> Enemies()
		{
			List<Enemy> list = new List<Enemy>();
			EnemyDirector instance = EnemyDirector.instance;
			if (!Object.op_Implicit((Object)(object)instance) || instance.enemiesSpawned == null)
			{
				return list;
			}
			foreach (EnemyParent item in instance.enemiesSpawned)
			{
				if (Object.op_Implicit((Object)(object)item) && item.Spawned)
				{
					Enemy enemy = item.Enemy;
					if (Object.op_Implicit((Object)(object)enemy) && ((Behaviour)enemy).isActiveAndEnabled && (!enemy.HasHealth || !Object.op_Implicit((Object)(object)enemy.Health) || (!enemy.Health.dead && enemy.Health.healthCurrent > 0)))
					{
						list.Add(enemy);
					}
				}
			}
			return list;
		}

		internal static Vector3 Center(Enemy e)
		{
			//IL_0013: 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_004f: 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)
			if (Object.op_Implicit((Object)(object)e.CenterTransform))
			{
				return e.CenterTransform.position;
			}
			if (e.HasRigidbody && Object.op_Implicit((Object)(object)e.Rigidbody))
			{
				return ((Component)e.Rigidbody).transform.position;
			}
			return ((Component)e).transform.position + Vector3.up;
		}

		internal static int MaxHealth(Enemy e)
		{
			if (!e.HasHealth || !Object.op_Implicit((Object)(object)e.Health))
			{
				return 100;
			}
			return e.Health.health;
		}

		internal static bool LineOfSight(Vector3 from, Vector3 to)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return !Physics.Linecast(from, to, WorldMask, (QueryTriggerInteraction)1);
		}

		internal static void HurtEnemy(Enemy e, float damage, Vector3 dir, float stun, float knockback, float freeze = 0f)
		{
			//IL_00c2: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			if (IsHost && Object.op_Implicit((Object)(object)e))
			{
				if (stun > 0f && e.HasStateStunned && Object.op_Implicit((Object)(object)e.StateStunned))
				{
					e.StateStunned.Set(stun);
				}
				if (freeze > 0f)
				{
					e.Freeze(freeze);
				}
				if (knockback > 0f && e.HasRigidbody && Object.op_Implicit((Object)(object)e.Rigidbody) && Object.op_Implicit((Object)(object)e.Rigidbody.rb))
				{
					e.Rigidbody.rb.AddForce(((Vector3)(ref dir)).normalized * knockback, (ForceMode)2);
				}
				int num = Mathf.RoundToInt(damage);
				if (num > 0 && e.HasHealth && Object.op_Implicit((Object)(object)e.Health))
				{
					e.Health.Hurt(num, ((Vector3)(ref dir)).normalized);
				}
			}
		}

		private static void DamageDoors(Collider[] cols, float damage, Vector3 from, HashSet<Object> once)
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost || !SukunaConfig.CutDoors.Value)
			{
				return;
			}
			if (doorHealth.Count > 200)
			{
				foreach (PhysGrabHinge item in new List<PhysGrabHinge>(doorHealth.Keys))
				{
					if (!Object.op_Implicit((Object)(object)item))
					{
						doorHealth.Remove(item);
					}
				}
			}
			HashSet<PhysGrabHinge> hashSet = new HashSet<PhysGrabHinge>();
			for (int i = 0; i < cols.Length; i++)
			{
				PhysGrabHinge componentInParent = ((Component)cols[i]).GetComponentInParent<PhysGrabHinge>();
				if (!Object.op_Implicit((Object)(object)componentInParent) || componentInParent.dead || componentInParent.broken || !hashSet.Add(componentInParent) || (once != null && !once.Add((Object)(object)componentInParent)))
				{
					continue;
				}
				float value;
				float num = (doorHealth.TryGetValue(componentInParent, out value) ? value : 100f) - damage;
				if (num <= 0f)
				{
					doorHealth.Remove(componentInParent);
					componentInParent.DestroyHinge();
					continue;
				}
				doorHealth[componentInParent] = num;
				PhysGrabObject component = ((Component)componentInParent).GetComponent<PhysGrabObject>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.rb) && !component.rb.isKinematic)
				{
					Vector3 val = Vector3.ProjectOnPlane(component.rb.worldCenterOfMass - from, Vector3.up);
					if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
					{
						component.rb.AddForce(((Vector3)(ref val)).normalized * (1.5f + damage * 0.06f), (ForceMode)2);
					}
					component.lightBreakImpulse = true;
				}
			}
		}

		internal static void DamageDoorsSphere(Vector3 center, float radius, float damage, Vector3 from, HashSet<Object> once = null)
		{
			//IL_0000: 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)
			DamageDoors(Physics.OverlapSphere(center, radius, HingeMask, (QueryTriggerInteraction)1), damage, from, once);
		}

		internal static void DamageDoorsCapsule(Vector3 a, Vector3 b, float radius, float damage, HashSet<Object> once = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			DamageDoors(Physics.OverlapCapsule(a, b, radius, HingeMask, (QueryTriggerInteraction)1), damage, a, once);
		}

		internal static void DamageDoorsBox(Vector3 center, Vector3 halfExtents, Quaternion rot, float damage, Vector3 from)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			DamageDoors(Physics.OverlapBox(center, halfExtents, rot, HingeMask, (QueryTriggerInteraction)1), damage, from, null);
		}

		private static void HitObjects(Collider[] cols, Impact impact, float force, Vector3 from, Vector3? pushDir, float upward, HashSet<Object> once)
		{
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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_01da: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			bool flag = SukunaConfig.DamageItems.Value && impact != Impact.None;
			HashSet<PhysGrabObject> hashSet = new HashSet<PhysGrabObject>();
			for (int i = 0; i < cols.Length; i++)
			{
				PhysGrabObject componentInParent = ((Component)cols[i]).GetComponentInParent<PhysGrabObject>();
				if (!Object.op_Implicit((Object)(object)componentInParent) || !Object.op_Implicit((Object)(object)componentInParent.rb) || !hashSet.Add(componentInParent) || Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<EnemyRigidbody>()) || Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<PlayerTumble>()) || Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponentInParent<PlayerAvatar>()) || IsOurItem(componentInParent) || Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<PhysGrabHinge>()) || (Object.op_Implicit((Object)(object)componentInParent.impactDetector) && componentInParent.impactDetector.isCart) || (Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<ValuableObject>()) && !flag) || (once != null && !once.Add((Object)(object)componentInParent)))
				{
					continue;
				}
				if (flag)
				{
					switch (impact)
					{
					case Impact.Light:
						componentInParent.lightBreakImpulse = true;
						break;
					case Impact.Medium:
						componentInParent.mediumBreakImpulse = true;
						break;
					case Impact.Heavy:
						componentInParent.heavyBreakImpulse = true;
						break;
					}
				}
				if (!(force <= 0f) && !componentInParent.rb.isKinematic)
				{
					Vector3 val = componentInParent.rb.worldCenterOfMass - from;
					float num = 1f - Mathf.Clamp01(((Vector3)(ref val)).magnitude / 8f) * 0.5f;
					Vector3 val2 = pushDir ?? val;
					Vector3 val3 = ((Vector3)(ref val2)).normalized + Vector3.up * upward;
					val2 = ((Vector3)(ref val3)).normalized;
					componentInParent.rb.AddForce(val2 * force * num, (ForceMode)2);
					componentInParent.rb.AddTorque(Random.insideUnitSphere * force * 0.5f, (ForceMode)2);
				}
			}
		}

		internal static void PullObjects(Vector3 center, float radius, float strength)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			Summon.HurtSphere(center, radius, 4f * SukunaConfig.DamageMultiplier.Value, null);
			HashSet<PhysGrabObject> hashSet = new HashSet<PhysGrabObject>();
			Collider[] array = Physics.OverlapSphere(center, radius, PropMask, (QueryTriggerInteraction)1);
			for (int i = 0; i < array.Length; i++)
			{
				PhysGrabObject componentInParent = ((Component)array[i]).GetComponentInParent<PhysGrabObject>();
				if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.rb) && !componentInParent.rb.isKinematic && hashSet.Add(componentInParent) && !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<EnemyRigidbody>()) && !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<PlayerTumble>()) && !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponentInParent<PlayerAvatar>()) && !IsOurItem(componentInParent) && !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<PhysGrabHinge>()) && (SukunaConfig.DamageItems.Value || !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponent<ValuableObject>())))
				{
					Vector3 val = center - componentInParent.rb.worldCenterOfMass;
					componentInParent.rb.AddForce(((Vector3)(ref val)).normalized * Mathf.Min(strength, ((Vector3)(ref val)).magnitude * 2f), (ForceMode)2);
				}
			}
		}

		internal static bool IsOurItem(PhysGrabObject pgo)
		{
			if (!Object.op_Implicit((Object)(object)((Component)pgo).GetComponent<CursedFingerItem>()) && !Object.op_Implicit((Object)(object)((Component)pgo).GetComponent<GojoBlindfoldItem>()))
			{
				return Object.op_Implicit((Object)(object)((Component)pgo).GetComponent<TenShadowsTalismanItem>());
			}
			return true;
		}

		private static float SummonDamage(Impact impact)
		{
			return impact switch
			{
				Impact.Light => 12f, 
				Impact.Medium => 35f, 
				Impact.Heavy => 90f, 
				_ => 5f, 
			} * SukunaConfig.DamageMultiplier.Value;
		}

		internal static void HitObjectsSphere(Vector3 center, float radius, Impact impact, float force, float upward = 0.3f, HashSet<Object> once = null)
		{
			//IL_0000: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			Summon.HurtSphere(center, radius, SummonDamage(impact), once);
			HitObjects(Physics.OverlapSphere(center, radius, PropMask, (QueryTriggerInteraction)1), impact, force, center, null, upward, once);
		}

		internal static void HitObjectsCapsule(Vector3 a, Vector3 b, float radius, Impact impact, float force, HashSet<Object> once = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0023: 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)
			Summon.HurtCapsule(a, b, radius, SummonDamage(impact), once);
			HitObjects(Physics.OverlapCapsule(a, b, radius, PropMask, (QueryTriggerInteraction)1), impact, force, a, b - a, 0.2f, once);
		}

		internal static void HitObjectsBox(Vector3 center, Vector3 halfExtents, Quaternion rot, Impact impact, float force, Vector3 from)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Summon.HurtBox(center, halfExtents, rot, SummonDamage(impact));
			HitObjects(Physics.OverlapBox(center, halfExtents, rot, PropMask, (QueryTriggerInteraction)1), impact, force, from, null, 0.3f, null);
		}

		internal static Vector3 LocalPlayerCenter(out PlayerAvatar me)
		{
			//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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			me = PlayerAvatar.instance;
			if (!Object.op_Implicit((Object)(object)me))
			{
				return Vector3.zero;
			}
			return ((Component)me).transform.position + Vector3.up * 0.9f;
		}

		internal static bool CanTakeFriendlyFire(Cast c, out PlayerAvatar me)
		{
			me = PlayerAvatar.instance;
			if (SukunaConfig.FriendlyFire.Value && !c.Local && !c.Hostile && Object.op_Implicit((Object)(object)me) && !me.deadSet)
			{
				return Object.op_Implicit((Object)(object)me.playerHealth);
			}
			return false;
		}

		internal static void HurtLocalPlayer(PlayerAvatar me, int damage)
		{
			if (Object.op_Implicit((Object)(object)me) && Object.op_Implicit((Object)(object)me.playerHealth) && damage > 0)
			{
				me.playerHealth.Hurt(damage, true, -1, false);
			}
		}

		internal static float DistanceToSegment(Vector3 p, Vector3 a, Vector3 b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0035: 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_0037: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = b - a;
			float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
			if (sqrMagnitude < 1E-06f)
			{
				return Vector3.Distance(p, a);
			}
			float num = Mathf.Clamp01(Vector3.Dot(p - a, val) / sqrMagnitude);
			return Vector3.Distance(p, a + val * num);
		}
	}
	internal sealed class DebugKeys : MonoBehaviour
	{
		private int nextBoss;

		private int nextPower;

		private static bool Enabled => SukunaConfig.TestKeys.Value;

		private void Update()
		{
			//IL_0080: 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_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled)
			{
				return;
			}
			Keyboard current = Keyboard.current;
			PlayerAvatar instance = PlayerAvatar.instance;
			if (current == null || !Object.op_Implicit((Object)(object)instance) || !SemiFunc.NoTextInputsActive())
			{
				return;
			}
			if (((ButtonControl)current.f8Key).wasPressedThisFrame)
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					Hud.Notice("F8 only works for the host", 2f);
					return;
				}
				int num = Mathf.Min(SukunaConfig.MaxFingers.Value, Fingers.Get(instance) + 1);
				Fingers.SetHost(instance.steamID, num);
				Powers.Grant(instance, Powers.Kind.Sukuna);
				SukunaNet.SendFingerEvent(Tech.FingerEaten, instance, num, ((Component)instance).transform.position + Vector3.up);
			}
			if (((ButtonControl)current.f7Key).wasPressedThisFrame)
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					Hud.Notice("F7 only works for the host", 2f);
					return;
				}
				if (!Object.op_Implicit((Object)(object)FingerItem.Item))
				{
					Hud.Notice("Cursed Finger item isn't registered (see the log)", 3f);
					return;
				}
				Transform val = ((Object.op_Implicit((Object)(object)GameDirector.instance) && Object.op_Implicit((Object)(object)GameDirector.instance.MainCamera)) ? ((Component)GameDirector.instance.MainCamera).transform : ((Component)instance).transform);
				Items.SpawnItem(FingerItem.Item, val.position + val.forward * 1.2f, Quaternion.identity);
			}
			if (((ButtonControl)current.f6Key).wasPressedThisFrame)
			{
				if (Object.op_Implicit((Object)(object)SukunaController.Instance))
				{
					SukunaController.Instance.DebugRefill();
				}
				if (Object.op_Implicit((Object)(object)GojoController.Instance))
				{
					GojoController.Instance.DebugRefill();
				}
				if (Object.op_Implicit((Object)(object)MegumiController.Instance))
				{
					MegumiController.Instance.DebugRefill();
				}
				Hud.Notice("Cursed energy refilled", 1.5f);
			}
			if (((ButtonControl)current.f9Key).wasPressedThisFrame)
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					Hud.Notice("F9 only works for the host", 2f);
					return;
				}
				BossDef bossDef = Bosses.All[nextBoss % Bosses.All.Length];
				nextBoss++;
				if (!Object.op_Implicit((Object)(object)bossDef.Setup))
				{
					Hud.Notice(bossDef.Name + " isn't registered (see the log)", 3f);
					return;
				}
				Vector3 val2 = Vector3.ProjectOnPlane(((Component)instance).transform.forward, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				if (bossDef.Spawn(((Component)instance).transform.position + normalized * 8f))
				{
					Hud.Notice(bossDef.Name + " appears", 2f);
				}
				else
				{
					Hud.Notice(bossDef.Name + " couldn't be spawned", 2f);
				}
			}
			if (((ButtonControl)current.f10Key).wasPressedThisFrame)
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					Hud.Notice("F10 only works for the host", 2f);
					return;
				}
				bool flag = nextPower++ % 2 == 0;
				Powers.Grant(instance, flag ? Powers.Kind.Gojo : Powers.Kind.Megumi);
				SukunaNet.SendFingerEvent(flag ? Tech.BlindfoldWorn : Tech.TalismanUsed, instance, Fingers.Get(instance), ((Component)instance).transform.position + Vector3.up);
			}
		}
	}
	internal static class FingerItem
	{
		internal static readonly RuntimeItem Runtime = new RuntimeItem(new ItemSpec
		{
			AssetName = "Item Cursed Finger",
			DisplayName = "Cursed Finger",
			Description = "One of the twenty fingers of Ryomen Sukuna, the King of Curses. Eat it to inherit his cursed techniques.",
			IconResource = "finger_icon.png",
			ValueMax = 25000f,
			ColliderSize = new Vector3(0.085f, 0.08f, 0.32000002f),
			BuildModel = BuildModel,
			Behaviour = typeof(CursedFingerItem)
		});

		internal static Item Item => Runtime.Item;

		internal static Texture2D IconTexture => Runtime.Icon;

		internal static void TryRegister()
		{
			Runtime.Spec.ValueMax = (float)SukunaConfig.ShopPrice.Value * 250f;
			Runtime.TryRegister();
		}

		private static void BuildModel(Transform parent, Vector3 center, Material baseMat, int layer)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_008b: 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_00b8: Expected O, but got Unknown
			Mesh mesh = ItemFactory.ToMesh(FingerModel.BuildMesh(), "Cursed Finger");
			Texture2D tex = ItemFactory.ToTexture(FingerModel.BuildTexture(), 256, "Cursed Finger");
			Material mat = ItemFactory.ModelMaterial(baseMat, tex, new Color(0.025f, 0.004f, 0.004f), "Cursed Finger");
			GameObject val = ItemFactory.ModelObject("Cursed Finger Model", parent, center, mesh, mat, layer);
			ItemFactory.SmallGlow(val.transform, new Color(0.8f, 0.05f, 0.05f), 0.4f, 1.3f, layer);
			GameObject val2 = new GameObject("Cursed Aura")
			{
				layer = layer
			};
			val2.transform.SetParent(val.transform, false);
			Vfx.MakeAura(val2, 0.05f, 0.18f, 0.24000001f);
		}
	}
	internal static class SukunaConfigDefaults
	{
		internal const float FingerValue = 25000f;
	}
	public class CursedFingerItem : MonoBehaviour
	{
		private ItemToggle toggle;

		private ItemAttributes attributes;

		private PhysGrabObject physGrabObject;

		private bool used;

		private float rejectCooldown;

		private void Awake()
		{
			ItemFactory.GiveOwnIcon((Component)(object)this, FingerItem.Runtime);
		}

		private void Start()
		{
			toggle = ((Component)this).GetComponent<ItemToggle>();
			attributes = ((Component)this).GetComponent<ItemAttributes>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			NotValuableObject component = ((Component)this).GetComponent<NotValuableObject>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.hasHealth = false;
			}
		}

		private void Update()
		{
			//IL_012e: 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)
			if (rejectCooldown > 0f)
			{
				rejectCooldown -= Time.deltaTime;
			}
			if (used || !Object.op_Implicit((Object)(object)toggle) || !toggle.toggleState || SemiFunc.RunIsShop() || RunManager.instance.levelIsShop || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(toggle.playerTogglePhotonID);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			int num = Fingers.Get(val);
			if (num >= SukunaConfig.MaxFingers.Value)
			{
				toggle.ToggleItem(false, -1);
				if (rejectCooldown <= 0f)
				{
					rejectCooldown = 1f;
					SukunaNet.SendFingerEvent(Tech.FingerRejected, val, num, ((Component)this).transform.position);
				}
				return;
			}
			used = true;
			num++;
			Fingers.SetHost(val.steamID, num);
			Powers.Grant(val, Powers.Kind.Sukuna);
			if (Object.op_Implicit((Object)(object)attributes) && !string.IsNullOrEmpty(attributes.instanceName))
			{
				StatsManager.instance.ItemRemove(attributes.instanceName);
			}
			toggle.ToggleDisable(true);
			SukunaNet.SendFingerEvent(Tech.FingerEaten, val, num, ((Component)this).transform.position);
			physGrabObject.DestroyPhysGrabObject();
		}
	}
	internal sealed class PlayerStat
	{
		internal readonly string DictKey;

		private readonly string displayName;

		private Dictionary<string, int> Dict
		{
			get
			{
				StatsManager instance = StatsManager.instance;
				if (!Object.op_Implicit((Object)(object)instance))
				{
					return null;
				}
				EnsureRegistered();
				if (!instance.dictionaryOfDictionaries.TryGetValue(DictKey, out var value))
				{
					return null;
				}
				return value;
			}
		}

		internal PlayerStat(string dictKey, string displayName)
		{
			DictKey = dictKey;
			this.displayName = displayName;
		}

		internal void EnsureRegistered()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			StatsManager instance = StatsManager.instance;
			if (Object.op_Implicit((Object)(object)instance) && !instance.dictionaryOfDictionaries.ContainsKey(DictKey))
			{
				instance.dictionaryOfDictionaries.Add(DictKey, new Dictionary<string, int>());
				if (!instance.stripTheseDictionaries.ContainsKey(DictKey))
				{
					instance.stripTheseDictionaries.Add(DictKey, 0);
				}
				if (!instance.upgradesInfo.ContainsKey(DictKey))
				{
					instance.upgradesInfo.Add(DictKey, new UpgradeInfo
					{
						displayName = displayName
					});
				}
			}
		}

		internal int Get(string steamID)
		{
			if (string.IsNullOrEmpty(steamID))
			{
				return 0;
			}
			Dictionary<string, int> dict = Dict;
			if (dict == null || !dict.TryGetValue(steamID, out var value))
			{
				return 0;
			}
			return value;
		}

		internal void SetHost(string steamID, int value)
		{
			value = Mathf.Max(0, value);
			if (Object.op_Implicit((Object)(object)PunManager.instance))
			{
				PunManager.instance.UpdateStat(DictKey, steamID, value);
			}
			else
			{
				SetLocal(steamID, value);
			}
		}

		internal void SetLocal(string steamID, int value)
		{
			Dictionary<string, int> dict = Dict;
			if (dict != null && !string.IsNullOrEmpty(steamID))
			{
				if (value <= 0)
				{
					dict.Remove(steamID);
				}
				else
				{
					dict[steamID] = value;
				}
			}
		}
	}
	internal static class Fingers
	{
		internal static readonly PlayerStat Stat = new PlayerStat("playerUpgradeSukunaFingers", "Sukuna's Fingers");

		internal static void EnsureRegistered()
		{
			Stat.EnsureRegistered();
		}

		internal static int Get(string steamID)
		{
			return Stat.Get(steamID);
		}

		internal static int Get(PlayerAvatar player)
		{
			if (!Object.op_Implicit((Object)(object)player))
			{
				return 0;
			}
			return Stat.Get(player.steamID);
		}

		internal static void SetHost(string steamID, int value)
		{
			Stat.SetHost(steamID, value);
		}

		internal static void SetLocal(string steamID, int value)
		{
			Stat.SetLocal(steamID, value);
		}
	}
	internal static class Blindfold
	{
		internal static readonly PlayerStat Stat = new PlayerStat("playerUpgradeGojoBlindfold", "Gojo's Blindfold");

		internal static int Get(PlayerAvatar player)
		{
			if (!Object.op_Implicit((Object)(object)player))
			{
				return 0;
			}
			return Stat.Get(player.steamID);
		}
	}
	internal static class Shadows
	{
		internal static readonly PlayerStat Stat = new PlayerStat("playerUpgradeMegumiShadows", "Ten Shadows");

		internal static int Get(PlayerAvatar player)
		{
			if (!Object.op_Implicit((Object)(object)player))
			{
				return 0;
			}
			return Stat.Get(player.steamID);
		}
	}
	internal static class Powers
	{
		internal enum Kind
		{
			Sukuna,
			Gojo,
			Megumi
		}

		internal static bool IsGojo(PlayerAvatar p)
		{
			return Blindfold.Get(p) > 0;
		}

		internal static bool IsMegumi(PlayerAvatar p)
		{
			if (!IsGojo(p))
			{
				return Shadows.Get(p) > 0;
			}
			return false;
		}

		internal static bool IsSukuna(PlayerAvatar p)
		{
			if (!IsGojo(p) && !IsMegumi(p))
			{
				return Fingers.Get(p) > 0;
			}
			return false;
		}

		internal static void Grant(PlayerAvatar p, Kind kind)
		{
			if (Object.op_Implicit((Object)(object)p))
			{
				SetIfChanged(Blindfold.Stat, p, (kind == Kind.Gojo) ? 1 : 0);
				SetIfChanged(Shadows.Stat, p, (kind == Kind.Megumi) ? 1 : 0);
			}
		}

		private static void SetIfChanged(PlayerStat stat, PlayerAvatar p, int value)
		{
			if (stat.Get(p.steamID) != value)
			{
				stat.SetHost(p.steamID, value);
			}
		}

		internal static void EnsureRegistered()
		{
			Fingers.Stat.EnsureRegistered();
			Blindfold.Stat.EnsureRegistered();
			Shadows.Stat.EnsureRegistered();
		}
	}
	[HarmonyPatch(typeof(StatsManager), "Start")]
	internal static class StatsManagerStartPatch
	{
		private static void Postfix()
		{
			Powers.EnsureRegistered();
		}
	}
	[HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")]
	internal static class ShopPatch
	{
		private static bool Remove(ShopManager shop, Item item)
		{
			if (!Object.op_Implicit((Object)(object)item))
			{
				return false;
			}
			bool flag = shop.potentialItems.RemoveAll((Item i) => (Object)(object)i == (Object)(object)item) > 0;
			flag |= shop.potentialItemConsumables.RemoveAll((Item i) => (Object)(object)i == (Object)(object)item) > 0;
			flag |= shop.potentialItemUpgrades.RemoveAll((Item i) => (Object)(object)i == (Object)(object)item) > 0;
			flag |= shop.potentialItemHealthPacks.RemoveAll((Item i) => (Object)(object)i == (Object)(object)item) > 0;
			foreach (List<Item> value in shop.potentialSecretItems.Values)
			{
				flag |= value.RemoveAll((Item i) => (Object)(object)i == (Object)(object)item) > 0;
			}
			return flag;
		}

		private static void Postfix(ShopManager __instance)
		{
			if (!SemiFunc.IsNotMasterClient())
			{
				Remove(__instance, BandanaItem.Item);
				Remove(__instance, TalismanItem.Item);
				Item item = FingerItem.Item;
				if (Object.op_Implicit((Object)(object)item) && Remove(__instance, item) && Random.value < SukunaConfig.ShopChance.Value)
				{
					__instance.potentialItemHealthPacks.Add(item);
				}
			}
		}
	}
	internal static class Fuga
	{
		private static readonly Dictionary<Object, GameObject> charging = new Dictionary<Object, GameObject>();

		internal static void Charge(Cast c)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			StopCharge(c.Key);
			if (!c.Local)
			{
				GameObject val = new GameObject("Fuga Charge");
				FollowHand followHand = val.AddComponent<FollowHand>();
				followHand.Target = c.Caster;
				if (c.Hostile)
				{
					followHand.Anchor = c.Enemy.HandPoint;
				}
				((Component)Vfx.Emitter("Fuga Charge Flames", val.transform.position, val.transform, Vfx.FireMat, Vfx.FireYellow, Vfx.FireOrange, 50f, 0.6f, 0.22f, 0.45f, 0.12f, -0.4f, (ParticleSystemShapeType)0)).transform.localPosition = Vector3.zero;
				Light obj = val.AddComponent<Light>();
				obj.type = (LightType)2;
				obj.color = Vfx.FireOrange;
				obj.range = 5f;
				obj.intensity = 2.5f;
				Object.Destroy((Object)(object)val, 3f);
				charging[c.Key] = val;
				Sfx.Play(SfxId.FireCharge, c.Origin, 0.7f);
			}
		}

		internal static void StopCharge(Object p)
		{
			if (Object.op_Implicit(p) && charging.TryGetValue(p, out var value))
			{
				charging.Remove(p);
				if (Object.op_Implicit((Object)(object)value))
				{
					Object.Destroy((Object)(object)value);
				}
			}
		}

		internal static void Fire(Cast c)
		{
			//IL_000e: 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_0023: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			StopCharge(c.Key);
			Sfx.Play(SfxId.FireLaunch, c.Origin);
			Vfx.LightFlash(c.Origin, Vfx.FireOrange, 5f, 7f, 0.3f);
			GameObject val = new GameObject("Fuga Arrow");
			val.transform.SetPositionAndRotation(c.Origin, Quaternion.LookRotation(c.Dir));
			val.AddComponent<FugaArrow>().Init(c);
		}
	}
	internal sealed class FollowHand : MonoBehaviour
	{
		internal PlayerAvatar Target;

		internal Transform Anchor;

		private void LateUpdate()
		{
			//IL_0019: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Anchor))
			{
				((Component)this).transform.position = Anchor.position;
				return;
			}
			if (!Object.op_Implicit((Object)(object)Target))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Transform transform = ((Component)Target).transform;
			((Component)this).transform.position = transform.position + Vector3.up * 1.15f + transform.forward * 0.55f + transform.right * 0.25f;
		}
	}
	internal sealed class FugaArrow : MonoBehaviour
	{
		private Cast c;

		private const float Speed = 34f;

		private const float Range = 55f;

		private float traveled;

		private LineRenderer core;

		private LineRenderer glow;

		private ParticleSystem trail;

		private bool exploded;

		internal void Init(Cast cast)
		{
			//IL_0022: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00cc: 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_00dc: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			c = cast;
			core = Vfx.Line("Fuga Core", 2, 0.12f, new Color(1f, 0.95f, 0.8f));
			glow = Vfx.Line("Fuga Glow", 2, 0.45f, new Color(1f, 0.45f, 0.08f, 0.55f));
			((Component)core).transform.SetParent(((Component)this).transform, false);
			((Component)glow).transform.SetParent(((Component)this).transform, false);
			AnimationCurve widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 0.2f),
				new Keyframe(0.8f, 1f),
				new Keyframe(1f, 0.3f)
			});
			core.widthCurve = widthCurve;
			glow.widthCurve = widthCurve;
			trail = Vfx.Emitter("Fuga Trail", ((Component)this).transform.position, ((Component)this).transform, Vfx.FireMat, Vfx.FireYellow, Vfx.FireOrange, 90f, 0.5f, 0.35f, 0.5f, 0.08f, -0.3f, (ParticleSystemShapeType)0);
			Light obj = ((Component)this).gameObject.AddComponent<Light>();
			obj.type = (LightType)2;
			obj.color = Vfx.FireOrange;
			obj.range = 8f;
			obj.intensity = 4f;
			obj.shadows = (LightShadows)0;
		}

		private void Update()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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_01bf: 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_01d8: 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_009d: 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_0202: 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_00ba: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			if (exploded)
			{
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			float num = 34f * Time.deltaTime;
			RaycastHit val = default(RaycastHit);
			bool flag = Physics.SphereCast(position, 0.15f, c.Dir, ref val, num, Combat.WorldMask, (QueryTriggerInteraction)1);
			Vector3 val2 = (flag ? (((RaycastHit)(ref val)).point - c.Dir * 0.2f) : (position + c.Dir * num));
			if (c.Hostile)
			{
				if (traveled > 1.5f && BossHits.AnyPlayerNear(position, val2, 1.1f, out var at))
				{
					Explode(at - c.Dir * 0.3f);
					return;
				}
			}
			else
			{
				foreach (Enemy item in Combat.Enemies())
				{
					Vector3 val3 = Combat.Center(item);
					if (Combat.DistanceToSegment(val3, position, val2) < 1.1f)
					{
						Explode(val3 - c.Dir * 0.3f);
						return;
					}
				}
			}
			((Component)this).transform.position = val2;
			traveled += Vector3.Distance(position, val2);
			Vector3 val4 = val2;
			Vector3 val5 = val2 - c.Dir * 1.6f;
			core.SetPosition(0, val5);
			core.SetPosition(1, val4);
			glow.SetPosition(0, val5 - c.Dir * 0.3f);
			glow.SetPosition(1, val4 + c.Dir * 0.15f);
			if (flag || traveled >= 55f)
			{
				Explode(val2);
			}
		}

		private void Explode(Vector3 at)
		{
			//IL_0020: 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_006e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: 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_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			exploded = true;
			float num = 5.5f + 0.05f * (float)c.Fingers;
			Vfx.Explosion(at, 1.5f + 0.03f * (float)c.Fingers);
			Vfx.Burst(at, Vfx.FireYellow, Vfx.FireOrange, 60, 10f, 0.5f, 0.9f, -0.1f, Vfx.FireMat, 0.6f);
			Vfx.LightFlash(at, Vfx.FireOrange, 12f, num * 3f, 1.2f);
			Vfx.Shake(at, 10f, 0.7f);
			Sfx.Play(SfxId.Boom, at);
			GameObject val = new GameObject("Fuga Flames");
			val.transform.position = at;
			val.AddComponent<FireField>().Init(c, num * 0.75f);
			if (c.Hostile && BossHits.LocalNear(at, num * 0.8f, needSight: false, out var me))
			{
				Vector3 val2 = BossHits.Center(me) - at;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				if (magnitude < 2f || Combat.LineOfSight(at + Vector3.up * 0.2f, BossHits.Center(me)))
				{
					BossHits.Hurt(c, me, Mathf.RoundToInt(45f * (1f - 0.5f * magnitude / num)), (((Vector3)(ref val2)).normalized + Vector3.up * 0.6f) * 16f, 2f);
				}
			}
			if (!c.Hostile)
			{
				foreach (Enemy item in Combat.Enemies())
				{
					Vector3 val3 = Combat.Center(item);
					Vector3 val4 = val3 - at;
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					if (!(magnitude2 > num) && (!(magnitude2 > 2f) || Combat.LineOfSight(at + Vector3.up * 0.2f, val3)))
					{
						Vfx.Burst(val3, Vfx.FireYellow, Vfx.FireOrange, 12, 3f, 0.3f, 0.6f, -0.2f, Vfx.FireMat, 0.3f);
						if (Combat.IsHost)
						{
							float num2 = 1f - 0.5f * magnitude2 / num;
							float damage = 140f * c.Power * num2;
							Vector3 val5 = ((Vector3)(ref val4)).normalized + Vector3.up * 0.5f;
							Combat.HurtEnemy(item, damage, ((Vector3)(ref val5)).normalized, 3f, 10f * num2);
						}
					}
				}
			}
			if (Combat.IsHost)
			{
				Combat.DamageDoorsSphere(at, num * 0.7f, 80f, at);
				Combat.HitObjectsSphere(at, num, Combat.Impact.Heavy, 9f, 0.6f);
			}
			if (Combat.CanTakeFriendlyFire(c, out var me2))
			{
				PlayerAvatar me3;
				float num3 = Vector3.Distance(Combat.LocalPlayerCenter(out me3), at);
				if (num3 < num * 0.8f)
				{
					Combat.HurtLocalPlayer(me2, Mathf.RoundToInt(35f * (1f - 0.5f * num3 / num)));
				}
			}
			Vfx.StopEmitter(trail);
			Object.Destroy((Object)(object)((Component)core).gameObject);
			Object.Destroy((Object)(object)((Component)glow).gameObject);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	internal sealed class FireField : MonoBehaviour
	{
		private Cast c;

		private float radius;

		private float life = 4.5f;

		private float t;

		private float tick;

		private ParticleSystem flames;

		private ParticleSystem embers;

		private Light glow;

		internal void Init(Cast cast, float r)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			c = cast;
			radius = r;
			Vector3 val = ((Component)this).transform.position;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val + Vector3.up * 0.5f, Vector3.down, ref val2, 4f, Combat.WorldMask, (QueryTriggerInteraction)1))
			{
				val = ((RaycastHit)(ref val2)).point;
			}
			((Component)this).transform.position = val;
			flames = Vfx.Emitter("Fuga Ground Fire", val, ((Component)this).transform, Vfx.FireMat, Vfx.FireYellow, Vfx.FireOrange, 110f, 1.6f, 0.7f, 0.8f, r, -0.3f, (ParticleSystemShapeType)0);
			((Component)flames).transform.rotation = Quaternion.LookRotation(Vector3.up);
			ShapeModule shape = flames.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5;
			((ShapeModule)(ref shape)).scale = new Vector3(r * 1.6f, r * 1.6f, 0.1f);
			embers = Vfx.Emitter("Fuga Embers", val, ((Component)this).transform, Vfx.GlowMat, Vfx.FireYellow, Vfx.Red, 35f, 2.5f, 0.06f, 1.4f, r * 0.8f, -0.3f, (ParticleSystemShapeType)0);
			glow = ((Component)this).gameObject.AddComponent<Light>();
			glow.type = (LightType)2;
			glow.color = Vfx.FireOrange;
			glow.range = r * 2.5f;
			glow.intensity = 3f;
			glow.shadows = (LightShadows)0;
		}

		private void Update()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			t += Time.deltaTime;
			glow.intensity = (3f + Mathf.PerlinNoise(t * 6f, 0.3f) * 1.5f) * Mathf.Clamp01((life - t) / 1f);
			tick -= Time.deltaTime;
			if (tick <= 0f && t < life)
			{
				tick = 0.5f;
				Vector3 val;
				if (c.Hostile && BossHits.LocalTarget(out var me))
				{
					val = Vector3.ProjectOnPlane(((Component)me).transform.position - ((Component)this).transform.position, Vector3.up);
					if (((Vector3)(ref val)).magnitude < radius && Mathf.Abs(((Component)me).transform.position.y - ((Component)this).transform.position.y) < 2f)
					{
						BossHits.Hurt(c, me, 4, Vector3.zero);
					}
				}
				if (!c.Hostile)
				{
					foreach (Enemy item in Combat.Enemies())
					{
						Vector3 val2 = Combat.Center(item);
						Vector3 val3 = Vector3.ProjectOnPlane(val2 - ((Component)this).transform.position, Vector3.up);
						if (!(((Vector3)(ref val3)).magnitude > radius) && !(Mathf.Abs(val2.y - ((Component)this).transform.position.y) > 2.5f))
						{
							Combat.HurtEnemy(item, 10f * c.Power, Vector3.up, 0.3f, 0f);
						}
					}
				}
				if (Combat.CanTakeFriendlyFire(c, out var me2))
				{
					val = Vector3.ProjectOnPlane(((Component)me2).transform.position - ((Component)this).transform.position, Vector3.up);
					if (((Vector3)(ref val)).magnitude < radius && Mathf.Abs(((Component)me2).transform.position.y - ((Component)this).transform.position.y) < 2f)
					{
						Combat.HurtLocalPlayer(me2, 3);
					}
				}
			}
			if (t >= life)
			{
				Vfx.StopEmitter(flames, 1.2f);
				Vfx.StopEmitter(embers, 1.6f);
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal sealed class GojoController : MonoBehaviour, IPowerHud
	{
		internal const float PurpleChargeTime = 1.2f;

		internal static GojoController Instance;

		internal bool HudVisible;

		internal float Energy = 300f;

		internal bool InfinityOn;

		internal bool SixEyesOn;

		internal float PurpleCharge = -1f;

		private readonly Dictionary<TechInfo, float> cooldowns = new Dictionary<TechInfo, float>();

		private LevelGenerator level;

		private float infinityPulse;

		private float rctTimer;

		bool IPowerHud.HudVisible => HudVisible;

		string IPowerHud.CountText => "GOJO";

		Texture IPowerHud.Icon => (Texture)(object)BandanaItem.IconTexture;

		Color IPowerHud.Accent => GojoStats.Blue;

		float IPowerHud.Energy => Energy;

		float IPowerHud.MaxEnergy => 300f;

		string IPowerHud.EnergyTag
		{
			get
			{
				if (!InfinityOn)
				{
					return "";
				}
				return "INFINITY";
			}
		}

		bool IPowerHud.EnergyPulse => InfinityOn;

		TechInfo[] IPowerHud.Techs => TechInfo.Gojo;

		int IPowerHud.UnlockLevel => 1;

		bool IPowerHud.IsActive(TechInfo t)
		{
			return IsActive(t);
		}

		float IPowerHud.Cooldown(TechInfo t)
		{
			return Cooldown(t);
		}

		float IPowerHud.CostOf(TechInfo t)
		{
			return Cost(t);
		}

		private void Awake()
		{
			Instance = this;
		}

		internal float Cooldown(TechInfo t)
		{
			if (!cooldowns.TryGetValue(t, out var value))
			{
				return 0f;
			}
			return Mathf.Max(0f, value);
		}

		internal bool IsActive(TechInfo t)
		{
			if ((t != TechInfo.Purple || !(PurpleCharge >= 0f)) && (t != TechInfo.Infinity || !InfinityOn))
			{
				if (t == TechInfo.SixEyes)
				{
					return SixEyesOn;
				}
				return false;
			}
			return true;
		}

		private float Cost(TechInfo t)
		{
			if (t != TechInfo.SixEyes && t != TechInfo.Infinity)
			{
				return t.Cost * (SixEyesOn ? 0.5f : 1f);
			}
			return t.Cost;
		}

		internal void OnBlindfoldWorn()
		{
			Energy = 300f;
			cooldowns.Clear();
		}

		internal void DebugRefill()
		{
			Energy = 300f;
			cooldowns.Clear();
		}

		internal bool TryAbsorb(int damage)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!HudVisible || !InfinityOn || damage <= 0)
			{
				return false;
			}
			if (Energy < (float)damage)
			{
				InfinityOn = false;
				return false;
			}
			Energy -= damage;
			Hud.Flash(new Color(0.6f, 0.85f, 1f, 0.25f), 0.2f);
			PlayerAvatar instance = PlayerAvatar.instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				V