Decompiled source of SatoruGojo v1.0.2

Kusho.SatoruGojo.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using GojoMod.Audio;
using GojoMod.Cinematics;
using GojoMod.Components;
using GojoMod.SkillStates;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[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("Kusho.SatoruGojo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Kusho.SatoruGojo")]
[assembly: AssemblyTitle("Kusho.SatoruGojo")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 GojoMod
{
	internal static class GojoAssets
	{
		internal static GameObject commandoBody;

		internal static GameObject commandoDisplay;

		internal static GameObject commandoMaster;

		internal static void Init()
		{
			commandoBody = Load("RoR2/Base/Commando/CommandoBody.prefab");
			commandoDisplay = Load("RoR2/Base/Commando/CommandoDisplay.prefab");
			commandoMaster = Load("RoR2/Base/Commando/CommandoMonsterMaster.prefab");
		}

		private static GameObject Load(string key)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)key).WaitForCompletion();
				if (!Object.op_Implicit((Object)(object)obj))
				{
					GojoPlugin.Log.LogWarning((object)("Missing vanilla asset: " + key));
				}
				return obj;
			}
			catch (Exception ex)
			{
				GojoPlugin.Log.LogWarning((object)("Could not load " + key + ": " + ex.Message));
				return null;
			}
		}
	}
	internal static class GojoBundle
	{
		internal const string FileName = "gojo";

		internal static AssetBundle bundle;

		internal static GameObject gojo;

		internal static GameObject gojoDisplay;

		internal static bool Loaded => Object.op_Implicit((Object)(object)gojo);

		internal static void Init(string pluginFolder)
		{
			string text = Path.Combine(pluginFolder, "gojo");
			if (!File.Exists(text))
			{
				GojoPlugin.Log.LogWarning((object)("Model bundle not found at " + text + "; using Commando's model."));
				return;
			}
			bundle = AssetBundle.LoadFromFile(text);
			if (!Object.op_Implicit((Object)(object)bundle))
			{
				GojoPlugin.Log.LogError((object)("Could not load model bundle " + text + "."));
				return;
			}
			gojo = bundle.LoadAsset<GameObject>("mdlGojo");
			gojoDisplay = bundle.LoadAsset<GameObject>("mdlGojoDisplay");
			GojoPlugin.Log.LogInfo((object)$"Model bundle loaded: gojo={Object.op_Implicit((Object)(object)gojo)} display={Object.op_Implicit((Object)(object)gojoDisplay)}");
		}
	}
	internal static class GojoFx
	{
		internal const string Melee = "FX_CP_050_00211";

		internal const string RedCharge = "FX_CP_050_08111";

		internal const string RedAir = "FX_CP_050_08115";

		internal static readonly string[] RedBlast = new string[3] { "FX_CP_050_08112", "FX_CP_050_08113", "FX_CP_050_08114" };

		internal const string PurpleCharge = "FX_CP_050_09115";

		internal static readonly string[] PurpleBurst = new string[3] { "FX_CP_050_09111", "FX_CP_050_09113", "FX_CP_050_09116" };

		internal const string PurpleMass = "FX_CP_050_09112";

		internal const string PurpleEnd = "FX_CP_050_09114";

		internal static readonly string[] InfinityParts = new string[2] { "FX_CP_050_11101", "FX_CP_050_11201" };

		internal static readonly string[] DomainAura = new string[2] { "FX_CP_050_60301", "FX_CP_050_60302" };

		internal static readonly string[] DomainOpen = new string[3] { "FX_CP_050_60501", "FX_CP_050_60001", "FX_CP_050_60002" };

		private static readonly Dictionary<string, GameObject> prefabs = new Dictionary<string, GameObject>();

		internal static GameObject infinityEffect;

		internal static Shader FxShader { get; private set; }

		internal static string Blue(int level)
		{
			return $"FX_CP_050_0712{Mathf.Clamp(level, 1, 3)}";
		}

		internal static void Init()
		{
			if (!Object.op_Implicit((Object)(object)GojoBundle.bundle))
			{
				return;
			}
			foreach (GameObject item in from g in GojoBundle.bundle.LoadAllAssets<GameObject>()
				where ((Object)g).name.StartsWith("FX_")
				select g)
			{
				prefabs[((Object)item).name] = item;
			}
			Material? obj = (from r in prefabs.Values.SelectMany((GameObject p) => p.GetComponentsInChildren<ParticleSystemRenderer>(true))
				select ((Renderer)r).sharedMaterial).FirstOrDefault((Func<Material, bool>)((Material m) => Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)m.shader) && ((Object)m.shader).name == "Gojo/Fx"));
			FxShader = ((obj != null) ? obj.shader : null);
			infinityEffect = MakeNetworkEffect("KushoGojoInfinityEffect", InfinityParts);
			GojoPlugin.Log.LogInfo((object)$"[Fx] {prefabs.Count} Cursed Clash effects loaded.");
		}

		internal static GameObject Spawn(string name, Vector3 position, Quaternion rotation, Transform parent = null, float scale = 1.2f)
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (!prefabs.TryGetValue(name, out var value))
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(value, position, rotation);
			if (Object.op_Implicit((Object)(object)parent))
			{
				val.transform.SetParent(parent, true);
			}
			val.transform.localScale = Vector3.one * scale;
			ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				((MainModule)(ref main)).loop = false;
			}
			val.AddComponent<FxLifetime>();
			return val;
		}

		internal static GameObject SpawnLooping(string name, Vector3 position, Quaternion rotation, Transform parent = null, float scale = 1.2f)
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (!prefabs.TryGetValue(name, out var value))
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(value, position, rotation);
			if (Object.op_Implicit((Object)(object)parent))
			{
				val.transform.SetParent(parent, true);
			}
			val.transform.localScale = Vector3.one * scale;
			ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>();
			if (componentsInChildren.Any(delegate(ParticleSystem ps)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				MainModule main2 = ps.main;
				return ((MainModule)(ref main2)).loop;
			}))
			{
				return val;
			}
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val2 in array)
			{
				MainModule main = val2.main;
				((MainModule)(ref main)).loop = true;
				EmissionModule emission = val2.emission;
				if (((EmissionModule)(ref emission)).burstCount > 0)
				{
					emission = val2.emission;
					MinMaxCurve val3 = ((EmissionModule)(ref emission)).rateOverTime;
					if (((MinMaxCurve)(ref val3)).constant <= 0f)
					{
						EmissionModule emission2 = val2.emission;
						val3 = ((MainModule)(ref main)).startLifetime;
						((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(1f / Mathf.Max(0.2f, ((MinMaxCurve)(ref val3)).constant));
					}
				}
			}
			return val;
		}

		internal static void Release(GameObject effect)
		{
			if (Object.op_Implicit((Object)(object)effect))
			{
				effect.transform.SetParent((Transform)null, true);
				ParticleSystem[] componentsInChildren = effect.GetComponentsInChildren<ParticleSystem>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].Stop(true, (ParticleSystemStopBehavior)1);
				}
				effect.AddComponent<FxLifetime>();
			}
		}

		internal static void SpawnAll(IEnumerable<string> names, Vector3 position, Quaternion rotation, Transform parent = null, float scale = 1.2f)
		{
			//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)
			foreach (string name in names)
			{
				Spawn(name, position, rotation, parent, scale);
			}
		}

		private static GameObject MakeNetworkEffect(string name, string[] parts)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0072: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(new GameObject(name), name, false);
			foreach (string key in parts)
			{
				if (prefabs.TryGetValue(key, out var value))
				{
					Object.Instantiate<GameObject>(value, val.transform).transform.localScale = Vector3.one * 1.2f;
				}
			}
			EffectComponent obj = val.AddComponent<EffectComponent>();
			obj.applyScale = false;
			obj.positionAtReferencedTransform = false;
			VFXAttributes obj2 = val.AddComponent<VFXAttributes>();
			obj2.vfxPriority = (VFXPriority)2;
			obj2.vfxIntensity = (VFXIntensity)1;
			val.AddComponent<DestroyOnTimer>().duration = 2f;
			ContentAddition.AddEffect(val);
			return val;
		}
	}
	public class FxLifetime : MonoBehaviour
	{
		private ParticleSystem[] systems;

		private float minAge = 0.2f;

		private void Start()
		{
			systems = ((Component)this).GetComponentsInChildren<ParticleSystem>();
		}

		private void Update()
		{
			minAge -= Time.deltaTime;
			if (minAge > 0f || systems == null)
			{
				return;
			}
			ParticleSystem[] array = systems;
			foreach (ParticleSystem val in array)
			{
				if (Object.op_Implicit((Object)(object)val) && val.IsAlive(false))
				{
					return;
				}
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	internal static class GojoModel
	{
		internal const string VisualName = "GojoVisual";

		internal const float GameScale = 1.2f;

		internal static void AttachToBody(GameObject bodyPrefab)
		{
			//IL_0030: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			if (GojoBundle.Loaded)
			{
				Transform modelTransform = bodyPrefab.GetComponent<ModelLocator>().modelTransform;
				GameObject obj = Object.Instantiate<GameObject>(GojoBundle.gojo, modelTransform);
				((Object)obj).name = "GojoVisual";
				obj.transform.localPosition = Vector3.zero;
				obj.transform.localRotation = Quaternion.identity;
				float x = modelTransform.lossyScale.x;
				obj.transform.localScale = Vector3.one * 1.2f / ((x > 0f) ? x : 1f);
				bodyPrefab.AddComponent<GojoModelSwap>();
				bodyPrefab.AddComponent<GojoAnimator>();
			}
		}

		internal static GameObject CreateDisplay()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			GameObject val = PrefabAPI.InstantiateClone(new GameObject("KushoGojoDisplayRoot"), "KushoGojoDisplay", false);
			GameObject obj = Object.Instantiate<GameObject>(GojoBundle.gojoDisplay, val.transform);
			obj.transform.localPosition = Vector3.zero;
			obj.transform.localRotation = Quaternion.identity;
			obj.transform.localScale = Vector3.one * 1.2f;
			val.AddComponent<GojoDisplayVoice>();
			return val;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.hadi.SatoruGojo", "SatoruGojo", "1.0.2")]
	public class GojoPlugin : BaseUnityPlugin
	{
		public const string GUID = "com.hadi.SatoruGojo";

		public const string NAME = "SatoruGojo";

		public const string VERSION = "1.0.2";

		public const string TOKEN = "HADI_GOJO_";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> FreeCursedEnergy;

		internal static ConfigEntry<KeyboardShortcut> PurpleKey;

		internal static ConfigEntry<KeyboardShortcut> DomainKey;

		private static void OnCharacterDeath(DamageReport report)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody victimBody = report.victimBody;
			if (Object.op_Implicit((Object)(object)victimBody) && victimBody.baseNameToken == "HADI_GOJO_NAME")
			{
				GojoSounds.PlayAt(victimBody.corePosition, "death");
			}
			CharacterBody attackerBody = report.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody) && attackerBody.baseNameToken == "HADI_GOJO_NAME")
			{
				GojoSounds.Play(((Component)attackerBody).gameObject, "kill", 0.4f);
			}
		}

		private void Awake()
		{
			//IL_0042: 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)
			Log = ((BaseUnityPlugin)this).Logger;
			FreeCursedEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("Testing", "Free cursed energy", false, "Keeps the cursed energy gauge full, so every technique can be tried right away.");
			PurpleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "Hollow Purple", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), "Key for Hollow Purple.");
			DomainKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "Unlimited Void", new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()), "Key for Domain Expansion: Unlimited Void.");
			try
			{
				GojoAssets.Init();
				string? directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
				GojoBundle.Init(directoryName);
				GojoFx.Init();
				GojoSounds.Init(directoryName);
				DomainCinematic.Init(directoryName);
				GojoTokens.Init();
				GojoSurvivor.Init();
				GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeath;
				Log.LogInfo((object)"SatoruGojo 1.0.2 loaded.");
			}
			catch (Exception arg)
			{
				Log.LogError((object)string.Format("{0} failed to load: {1}", "SatoruGojo", arg));
			}
		}
	}
	internal static class GojoSounds
	{
		private const string MapFile = "soundmap.txt";

		private const string MapVersion = "Gojo sound map v2";

		private const float DefaultVolume = 0.3f;

		private const string GroupPrefix = "vo:";

		private const float VoiceGain = 0.6f;

		private static readonly Dictionary<string, short[]> clips = new Dictionary<string, short[]>();

		private static readonly Dictionary<string, string[]> groups = new Dictionary<string, string[]>();

		private static readonly Dictionary<string, string[]> events = new Dictionary<string, string[]>();

		private static readonly (string key, string clips, string note)[] defaults = new(string, string, string)[25]
		{
			("spawn", "vo:start_01, vo:start_02, vo:start_03", "stage start"),
			("select", "vo:start_01", "character select"),
			("jump", "vo:jump_01", "jump (plays sometimes)"),
			("dash", "vo:dash_01", "dash"),
			("melee_voice", "vo:normalattack1_01_01, vo:normalattack2_01_01, vo:normalattack3_01_01", "melee combo shout"),
			("melee_hit", "SE_CP_000_06011, SE_CP_000_06101, SE_CP_000_06111", "melee hit"),
			("teleport", "SE_CP_000_02001", "Teleport: vanishes"),
			("teleport_end", "SE_CP_000_02002", "Teleport: arrives"),
			("blue_voice", "vo:cursedenergyattack1_1_01_01", "Blue"),
			("blue_cast", "SE_CP_050_01011", "Blue appears"),
			("blue_loop", "SE_CP_050_01001", "Blue pulling"),
			("red_voice", "vo:cursedenergyattack2_1_01_01", "Red"),
			("red_charge", "SE_CP_050_01101", "Red charging"),
			("red_fire", "SE_CP_050_01111, SE_CP_050_01121", "Red fires"),
			("purple_voice", "vo:extraattack1_01_01", "Hollow Purple"),
			("purple_charge", "SE_CP_050_01201", "Hollow Purple: Blue and Red meet"),
			("purple_fire", "SE_CP_050_01211", "Hollow Purple fires"),
			("domain_voice", "vo:supercursedenergyattack_01_01", "Domain Expansion: Unlimited Void"),
			("domain_se", "SE_CP_050_02001", "Domain Expansion opens"),
			("domain_close", "SE_CP_050_02301", "Domain Expansion closes"),
			("infinity", "SE_CP_050_03001", "Infinity stops a hit"),
			("infinity_voice", "vo:guard_01", "Infinity"),
			("levelmax", "vo:levelup_max_01_01", "cursed energy full"),
			("kill", "vo:attack_kill_01", "after a kill"),
			("death", "vo:dead_01", "death")
		};

		private static PcmMixer.Voice speaking;

		private static bool Speaking
		{
			get
			{
				if (speaking != null)
				{
					return !speaking.Finished;
				}
				return false;
			}
		}

		internal static void Init(string pluginFolder)
		{
			string text = Path.Combine(pluginFolder, "sounds");
			if (!Directory.Exists(text))
			{
				GojoPlugin.Log.LogWarning((object)("[Audio] No sounds folder at " + text + "."));
				return;
			}
			string[] files = Directory.GetFiles(text, "*.wav");
			foreach (string path in files)
			{
				short[] array = Wav.LoadMono(path, 48000);
				if (array != null)
				{
					clips[Path.GetFileNameWithoutExtension(path)] = array;
				}
			}
			LoadGroups(Path.Combine(text, "voice_groups.json"));
			LoadMap(Path.Combine(text, "soundmap.txt"));
			GojoPlugin.Log.LogInfo((object)$"[Audio] Loaded {clips.Count} clips, {groups.Count} voice groups, {events.Count} sound events.");
		}

		private static void LoadGroups(string path)
		{
			if (!File.Exists(path))
			{
				return;
			}
			foreach (Match item in Regex.Matches(File.ReadAllText(path), "\"([^\"]+)\"\\s*:\\s*\\[([^\\]]*)\\]"))
			{
				groups[item.Groups[1].Value] = (from Match x in Regex.Matches(item.Groups[2].Value, "\"([^\"]+)\"")
					select x.Groups[1].Value).ToArray();
			}
		}

		private static void LoadMap(string path)
		{
			(string, string, string)[] array = defaults;
			for (int i = 0; i < array.Length; i++)
			{
				var (key, list, _) = array[i];
				events[key] = Split(list);
			}
			PcmMixer.MasterVolume = 0.3f;
			if (File.Exists(path) && !File.ReadAllText(path).Contains("Gojo sound map v2"))
			{
				File.Copy(path, Path.ChangeExtension(path, ".old.txt"), overwrite: true);
				File.Delete(path);
			}
			if (!File.Exists(path))
			{
				List<string> list2 = new List<string>
				{
					"# Gojo sound map v2: event = clip, clip, ...  (one is picked at random; empty = no sound)",
					"# Clip names are the .wav files in this folder without the extension; vo:<group> is one of the game's voice groups (voice_groups.json).",
					"volume = " + 0.3f.ToString(CultureInfo.InvariantCulture)
				};
				list2.AddRange(defaults.Select(((string key, string clips, string note) d) => d.key + " = " + d.clips + "    # " + d.note));
				File.WriteAllLines(path, list2);
				return;
			}
			string[] array2 = File.ReadAllLines(path);
			for (int i = 0; i < array2.Length; i++)
			{
				string text = array2[i].Split('#')[0].Trim();
				int num = text.IndexOf('=');
				if (num > 0)
				{
					string text2 = text.Substring(0, num).Trim().ToLowerInvariant();
					string text3 = text.Substring(num + 1).Trim();
					if (text2 == "volume" && float.TryParse(text3, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
					{
						PcmMixer.MasterVolume = Mathf.Clamp01(result);
					}
					else
					{
						events[text2] = Split(text3);
					}
				}
			}
		}

		private static string[] Split(string list)
		{
			return (from s in list.Split(',')
				select s.Trim() into s
				where s.Length > 0
				select s).ToArray();
		}

		private static bool Pick(string eventKey, out short[] samples, out bool voice)
		{
			samples = null;
			voice = false;
			if (clips.TryGetValue(eventKey, out samples))
			{
				return true;
			}
			if (!events.TryGetValue(eventKey, out var value) || value.Length == 0)
			{
				return false;
			}
			string text = value[Random.Range(0, value.Length)];
			if (text.StartsWith("vo:"))
			{
				voice = true;
				if (!groups.TryGetValue(text.Substring("vo:".Length), out var value2) || value2.Length == 0)
				{
					return false;
				}
				text = value2[Random.Range(0, value2.Length)];
			}
			return clips.TryGetValue(text, out samples);
		}

		internal static PcmMixer.Voice Play(GameObject at, string eventKey, float chance = 1f, bool loop = false, float volume = 1f)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (Random.value > chance || !Pick(eventKey, out var samples, out var voice))
			{
				return null;
			}
			if (voice && Speaking)
			{
				return null;
			}
			if (voice)
			{
				volume *= 0.6f;
			}
			PcmMixer.Voice result = PcmMixer.Play(samples, Object.op_Implicit((Object)(object)at) ? at.transform : null, Object.op_Implicit((Object)(object)at) ? at.transform.position : Vector3.zero, Object.op_Implicit((Object)(object)at), volume, loop);
			if (voice)
			{
				speaking = result;
			}
			return result;
		}

		internal static PcmMixer.Voice PlayAt(Vector3 position, string eventKey, bool loop = false)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!Pick(eventKey, out var samples, out var voice) || (voice && Speaking))
			{
				return null;
			}
			PcmMixer.Voice result = PcmMixer.Play(samples, null, position, spatial: true, voice ? 0.6f : 1f, loop);
			if (voice)
			{
				speaking = result;
			}
			return result;
		}

		internal static bool HasOwnClip(string eventKey)
		{
			return clips.ContainsKey(eventKey);
		}

		internal static PcmMixer.Voice PlayClip(GameObject at, string clipName, bool voice = false)
		{
			//IL_004c: 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)
			if (!clips.TryGetValue(clipName, out var value))
			{
				return null;
			}
			if (voice && Speaking)
			{
				PcmMixer.Stop(speaking);
			}
			PcmMixer.Voice result = PcmMixer.Play(value, Object.op_Implicit((Object)(object)at) ? at.transform : null, Object.op_Implicit((Object)(object)at) ? at.transform.position : Vector3.zero, spatial: false, voice ? 0.6f : 1f);
			if (voice)
			{
				speaking = result;
			}
			return result;
		}

		internal static void Stop(PcmMixer.Voice voice)
		{
			if (voice != null)
			{
				PcmMixer.Stop(voice);
			}
		}
	}
	internal static class GojoStaticValues
	{
		internal const float cursedEnergyMax = 100f;

		internal static readonly float[] cursedEnergyLevels = new float[3] { 28.571428f, 57.142857f, 85.71429f };

		internal const float cursedEnergyPerHit = 1f;

		internal const float cursedEnergyRegenAmount = 20f;

		internal const float cursedEnergyRegenEvery = 10f;

		internal const float meleeDamage = 2.2f;

		internal const float meleeRange = 7f;

		internal const float meleeRadius = 3.5f;

		internal const float meleeDuration = 0.55f;

		internal const float rctRate = 20f;

		internal const float blueCost = 25f;

		internal const float blueCooldown = 5f;

		internal const float blueMaxCharge = 1.5f;

		internal const float blueRange = 25f;

		internal const float blueSpeed = 22f;

		internal const float blueHoldTime = 5f;

		internal const float blueRadius = 9f;

		internal const float blueTick = 0.1f;

		internal const float blueTickDamage = 0.25f;

		internal const float bluePullForce = -380f;

		internal const float redCost = 25f;

		internal const float redCooldown = 6f;

		internal const float redMaxCharge = 1.2f;

		internal const float redSpeed = 70f;

		internal const float redRange = 70f;

		internal const float redDamage = 10f;

		internal const float redRadius = 8f;

		internal const float redForce = 7000f;

		internal const float purpleCost = 70f;

		internal const float purpleCooldown = 2f;

		internal const float purpleSpeed = 16f;

		internal const float purpleRange = 80f;

		internal const float purpleRadius = 7f;

		internal const float purpleTickDamage = 8f;

		internal const float purpleTickInterval = 0.12f;

		internal const float domainCost = 100f;

		internal const float domainCastTime = 3.5f;

		internal const float domainRadius = 45f;

		internal const float domainBindTime = 10f;

		internal const float domainHealthShare = 0.3f;

		internal const float martialArtsTime = 15f;

		internal const float martialArtsDamageMultiplier = 1.6f;
	}
	internal static class GojoSurvivor
	{
		private const string P = "HADI_GOJO_";

		internal static GameObject bodyPrefab;

		internal static GameObject displayPrefab;

		private static readonly FieldInfo skillFamilyField = typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly Dictionary<string, string> iconNames = new Dictionary<string, string>
		{
			{ "PRIMARY", "Primary" },
			{ "SECONDARY", "Blue" },
			{ "UTILITY", "RCT" },
			{ "SPECIAL", "Red" },
			{ "PURPLE", "Purple" },
			{ "DOMAIN", "Domain" }
		};

		internal static void Init()
		{
			CreateBody();
			CreateSkills();
			CreateDisplayAndSurvivor();
		}

		private static void CreateBody()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			bodyPrefab = PrefabAPI.InstantiateClone(GojoAssets.commandoBody, "KushoGojoBody", true);
			CharacterBody component = bodyPrefab.GetComponent<CharacterBody>();
			component.baseNameToken = "HADI_GOJO_NAME";
			component.subtitleNameToken = "HADI_GOJO_SUBTITLE";
			component.bodyColor = new Color(0.55f, 0.75f, 1f);
			Sprite val = Icon("Portrait");
			if (Object.op_Implicit((Object)(object)val))
			{
				component.portraitIcon = (Texture)(object)val.texture;
			}
			component.baseMaxHealth = 110f;
			component.levelMaxHealth = 33f;
			component.baseRegen = 1.5f;
			component.levelRegen = 0.3f;
			component.baseArmor = 15f;
			component.baseDamage = 12f;
			component.levelDamage = 2.4f;
			component.baseMoveSpeed = 7.5f;
			component.baseJumpCount = 1;
			bodyPrefab.AddComponent<GojoController>();
			bodyPrefab.AddComponent<GojoExtraKeys>();
			GojoModel.AttachToBody(bodyPrefab);
			ContentAddition.AddBody(bodyPrefab);
		}

		private static void CreateSkills()
		{
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			SkillLocator component = bodyPrefab.GetComponent<SkillLocator>();
			component.passiveSkill.enabled = true;
			component.passiveSkill.skillNameToken = "HADI_GOJO_PASSIVE_NAME";
			component.passiveSkill.skillDescriptionToken = "HADI_GOJO_PASSIVE_DESC";
			component.passiveSkill.icon = Icon("Passive");
			SkillDef val = Skill<SkillDef>("PRIMARY", typeof(GojoMelee), "Weapon", 0f, (InterruptPriority)0);
			val.cancelSprintingOnActivation = false;
			val.mustKeyPress = false;
			AssignFamily(component.primary, "GojoPrimaryFamily", val);
			CursedEnergySkillDef cursedEnergySkillDef = Skill<CursedEnergySkillDef>("SECONDARY", typeof(Blue), "Weapon", 5f, (InterruptPriority)1);
			cursedEnergySkillDef.cost = 25f;
			cursedEnergySkillDef.spendOnUse = true;
			AssignFamily(component.secondary, "GojoSecondaryFamily", (SkillDef)(object)cursedEnergySkillDef);
			CursedEnergySkillDef cursedEnergySkillDef2 = Skill<CursedEnergySkillDef>("UTILITY", typeof(ReverseCursedTechnique), "Weapon", 0.5f, (InterruptPriority)1);
			cursedEnergySkillDef2.cost = 1f;
			((SkillDef)cursedEnergySkillDef2).cancelSprintingOnActivation = false;
			AssignFamily(component.utility, "GojoUtilityFamily", (SkillDef)(object)cursedEnergySkillDef2);
			CursedEnergySkillDef cursedEnergySkillDef3 = Skill<CursedEnergySkillDef>("SPECIAL", typeof(Red), "Weapon", 6f, (InterruptPriority)1);
			cursedEnergySkillDef3.cost = 25f;
			cursedEnergySkillDef3.spendOnUse = true;
			AssignFamily(component.special, "GojoSpecialFamily", (SkillDef)(object)cursedEnergySkillDef3);
			CursedEnergySkillDef cursedEnergySkillDef4 = Skill<CursedEnergySkillDef>("PURPLE", typeof(HollowPurple), "Weapon", 2f, (InterruptPriority)7);
			cursedEnergySkillDef4.cost = 70f;
			ExtraSlot("KushoGojoHollowPurple", "PurpleFamily", (SkillDef)(object)cursedEnergySkillDef4);
			CursedEnergySkillDef cursedEnergySkillDef5 = Skill<CursedEnergySkillDef>("DOMAIN", typeof(UnlimitedVoid), "Weapon", 1f, (InterruptPriority)7);
			cursedEnergySkillDef5.cost = 100f;
			ExtraSlot("KushoGojoUnlimitedVoid", "DomainFamily", (SkillDef)(object)cursedEnergySkillDef5);
			Type[] array = new Type[8]
			{
				typeof(GojoMelee),
				typeof(ReverseCursedTechnique),
				typeof(Blue),
				typeof(BlueFire),
				typeof(Red),
				typeof(RedFire),
				typeof(HollowPurple),
				typeof(UnlimitedVoid)
			};
			bool flag = default(bool);
			for (int i = 0; i < array.Length; i++)
			{
				ContentAddition.AddEntityState(array[i], ref flag);
			}
		}

		private static Sprite Icon(string name)
		{
			if (!Object.op_Implicit((Object)(object)GojoBundle.bundle))
			{
				return null;
			}
			return GojoBundle.bundle.LoadAsset<Sprite>("Icon_" + name);
		}

		private static T Skill<T>(string tokenKey, Type state, string stateMachine, float cooldown, InterruptPriority priority) where T : SkillDef
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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)
			T val = ScriptableObject.CreateInstance<T>();
			((SkillDef)val).skillName = "KushoGojo" + tokenKey;
			((Object)(object)val).name = ((SkillDef)val).skillName;
			((SkillDef)val).skillNameToken = "HADI_GOJO_" + tokenKey + "_NAME";
			((SkillDef)val).skillDescriptionToken = "HADI_GOJO_" + tokenKey + "_DESC";
			((SkillDef)val).icon = Icon(iconNames.TryGetValue(tokenKey, out var value) ? value : tokenKey);
			((SkillDef)val).activationState = new SerializableEntityStateType(state);
			((SkillDef)val).activationStateMachineName = stateMachine;
			((SkillDef)val).baseRechargeInterval = cooldown;
			((SkillDef)val).baseMaxStock = 1;
			((SkillDef)val).rechargeStock = 1;
			((SkillDef)val).requiredStock = 1;
			((SkillDef)val).stockToConsume = ((cooldown > 0f) ? 1 : 0);
			((SkillDef)val).interruptPriority = priority;
			((SkillDef)val).isCombatSkill = true;
			((SkillDef)val).cancelSprintingOnActivation = true;
			((SkillDef)val).canceledFromSprinting = false;
			((SkillDef)val).fullRestockOnAssign = true;
			((SkillDef)val).mustKeyPress = cooldown > 0f;
			ContentAddition.AddSkillDef((SkillDef)(object)val);
			return val;
		}

		private static GenericSkill ExtraSlot(string slotName, string familyName, SkillDef skill)
		{
			GenericSkill obj = bodyPrefab.AddComponent<GenericSkill>();
			obj.skillName = slotName;
			AssignFamily(obj, familyName, skill);
			return obj;
		}

		private static void AssignFamily(GenericSkill slot, string familyName, SkillDef skill)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val).name = "KushoGojo" + familyName.Replace("Gojo", "");
			Variant[] array = new Variant[1];
			Variant val2 = new Variant
			{
				skillDef = skill
			};
			((Variant)(ref val2)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
			array[0] = val2;
			val.variants = (Variant[])(object)array;
			skillFamilyField.SetValue(slot, val);
			ContentAddition.AddSkillFamily(val);
		}

		private static void CreateDisplayAndSurvivor()
		{
			//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)
			displayPrefab = (Object.op_Implicit((Object)(object)GojoBundle.gojoDisplay) ? GojoModel.CreateDisplay() : PrefabAPI.InstantiateClone(GojoAssets.commandoDisplay, "KushoGojoDisplay", false));
			SurvivorDef obj = ScriptableObject.CreateInstance<SurvivorDef>();
			obj.cachedName = "KushoSatoruGojo";
			obj.bodyPrefab = bodyPrefab;
			obj.displayPrefab = displayPrefab;
			obj.displayNameToken = "HADI_GOJO_NAME";
			obj.descriptionToken = "HADI_GOJO_DESCRIPTION";
			obj.outroFlavorToken = "HADI_GOJO_OUTRO";
			obj.mainEndingEscapeFailureFlavorToken = "HADI_GOJO_FAILURE";
			obj.primaryColor = bodyPrefab.GetComponent<CharacterBody>().bodyColor;
			obj.desiredSortPosition = 101f;
			ContentAddition.AddSurvivorDef(obj);
		}
	}
	internal class CursedEnergySkillDef : SkillDef
	{
		public float cost;

		public bool spendOnUse;

		public override bool IsReady(GenericSkill skillSlot)
		{
			GojoController gojoController = GojoController.Of(((Component)skillSlot).gameObject);
			if (((SkillDef)this).IsReady(skillSlot) && Object.op_Implicit((Object)(object)gojoController))
			{
				return gojoController.CanSpend(cost);
			}
			return false;
		}

		public override void OnExecute(GenericSkill skillSlot)
		{
			if (spendOnUse)
			{
				GojoController.Of(((Component)skillSlot).gameObject)?.Spend(cost);
			}
			((SkillDef)this).OnExecute(skillSlot);
		}
	}
	internal static class GojoTokens
	{
		internal const string P = "HADI_GOJO_";

		private static string Pct(float coefficient)
		{
			return $"{coefficient * 100f:0}%";
		}

		private static string Dmg(string text)
		{
			return "<style=cIsDamage>" + text + "</style>";
		}

		private static string Util(string text)
		{
			return "<style=cIsUtility>" + text + "</style>";
		}

		internal static void Init()
		{
			Add("NAME", "Satoru Gojo");
			Add("SUBTITLE", "The Strongest");
			Add("DESCRIPTION", "A special grade jujutsu sorcerer with the Limitless and the Six Eyes. Throughout heaven and earth, he alone is the honored one.<color=#CCD3E0>\r\n\r\n< ! > You start with full cursed energy. It regains 20% every 10s, and every enemy your strikes hit gives 1% back.\r\n\r\n< ! > Blue pulls enemies together, Red blasts them apart; use both on the same crowd.\r\n\r\n< ! > With a full gauge, Unlimited Void holds everyone around you helpless, and your strikes turn into martial arts.</color>");
			Add("OUTRO", "..and so he left, still the strongest.");
			Add("FAILURE", "..and so he was sealed away.");
			Add("PASSIVE_NAME", "Six Eyes / Infinity / Float");
			Add("PASSIVE_DESC", string.Format("Cursed energy fuels his techniques: starts full, regains {0:0}% every {1:0}s and {2:0}% per enemy hit by his strikes. {3} stops the next hit, back after {4:0}s. Hold jump to {5}.", 20f, 10f, 1f, Util("Infinity"), 6f, Util("float")));
			Add("PRIMARY_NAME", "Rapid Strikes");
			Add("PRIMARY_DESC", Util("Agile.") + " Close in and strike for " + Dmg(Pct(2.2f) + " damage") + ", cycling punches, spin kicks and a rising kick.");
			Add("SECONDARY_NAME", "Cursed Technique Lapse: Blue");
			Add("SECONDARY_DESC", string.Format("Hold to charge, release to send it {0:0}m to the crosshair. {1}, then holds {2:0}s {3} for {4} 10x a second. Costs {5:0}%; scales with charge and level.", 25f, Util("Drags enemies along"), 5f, Util("pulling everything in"), Dmg(Pct(0.25f) + " damage"), 25f));
			Add("UTILITY_NAME", "Reverse Cursed Technique");
			Add("UTILITY_DESC", string.Format("Hold to turn cursed energy into {0}: 1% of the gauge heals 1% of your max health, {1:0}% a second.", Util("health"), 20f));
			Add("SPECIAL_NAME", "Cursed Technique Reversal: Red");
			Add("SPECIAL_DESC", string.Format("Hold to charge, release to fire. Bursts on impact for {0} and {1}. Costs {2:0}%; scales with charge and level.", Dmg(Pct(10f) + " damage"), Util("throws everything away"), 25f));
			Add("PURPLE_NAME", "Hollow Purple");
			Add("PURPLE_DESC", string.Format("Collide Blue and Red into imaginary mass that tears through everything in a line for {0} many times. Costs {1:0}%.", Dmg(Pct(8f) + " damage"), 70f));
			Add("DOMAIN_NAME", "Domain Expansion: Unlimited Void");
			Add("DOMAIN_DESC", string.Format("Full gauge: expand your domain. Everyone within {0:0}m is {1} through the cutscene and {2:0}s after, losing {3} (never lethal). Then your strikes become {4} for {5:0}s ({6}).", 45f, Util("held helpless"), 10f, Dmg($"{30.000002f:0}% of max health"), Util("martial arts"), 15f, Dmg($"+{60.000004f:0}%")));
		}

		private static void Add(string key, string value)
		{
			LanguageAPI.Add("HADI_GOJO_" + key, value);
		}
	}
}
namespace GojoMod.SkillStates
{
	public class Blue : GojoSkill
	{
		private GameObject orb;

		private int level;

		internal static Vector3 HandPoint(CharacterBody body, Vector3 forward)
		{
			//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_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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.Cross(Vector3.up, forward);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			return body.corePosition + forward * 0.7f + normalized * 0.25f + Vector3.up * 0.3f;
		}

		public override void OnEnter()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00a3: 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)
			base.OnEnter();
			level = ((!Object.op_Implicit((Object)(object)gojo) || !((EntityState)this).isAuthority) ? 1 : Mathf.Max(1, gojo.Level));
			Anim("Blue1", Mathf.Max(0.3f, ClipLength("Blue1")));
			Sound("blue_voice");
			Sound("blue_cast");
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			FaceDirection(direction);
			orb = GojoFx.SpawnLooping(GojoFx.Blue(level), HandPoint(((EntityState)this).characterBody, direction), Quaternion.LookRotation(-direction), null, 0.25f);
			((BaseState)this).StartAimMode(2.5f, false);
		}

		public override void Update()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (Object.op_Implicit((Object)(object)orb))
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector3 direction = ((Ray)(ref aimRay)).direction;
				orb.transform.position = HandPoint(((EntityState)this).characterBody, direction);
				float num = Mathf.Clamp01(((EntityState)this).age / 1.5f);
				orb.transform.localScale = Vector3.one * Mathf.Lerp(0.25f, 1f, num) * 1.2f;
			}
		}

		public override void FixedUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			Ray aimRay = ((BaseState)this).GetAimRay();
			FaceDirection(((Ray)(ref aimRay)).direction);
			if (((EntityState)this).isAuthority && (!Object.op_Implicit((Object)(object)((EntityState)this).inputBank) || !((EntityState)this).inputBank.skill2.down || ((EntityState)this).fixedAge >= 2.1f))
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new BlueFire
				{
					charge = Mathf.Clamp01(((EntityState)this).fixedAge / 1.5f),
					level = level,
					target = AimPoint(25f)
				});
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class BlueFire : GojoSkill
	{
		internal float charge;

		internal int level = 1;

		internal Vector3 target;

		private const float duration = 0.45f;

		public override void OnEnter()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			base.OnEnter();
			Anim("Blue2", 0.45f);
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			FaceDirection(direction);
			BlueOrb.Spawn(((EntityState)this).characterBody, Blue.HandPoint(((EntityState)this).characterBody, direction), target, level, charge, ((BaseState)this).RollCrit(), ((EntityState)this).isAuthority);
		}

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

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(charge);
			writer.Write(level);
			writer.Write(target);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			charge = reader.ReadSingle();
			level = reader.ReadInt32();
			target = reader.ReadVector3();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class GojoMelee : GojoSkill
	{
		private static readonly string[] steps = new string[8] { "Punch1", "Punch2", "Punch3", "Kick1", "Kick2", "Kick3", "UpKick1", "UpKick2" };

		private static int nextStep;

		private float duration;

		private float hitTime;

		private bool hasHit;

		private Vector3 lunge;

		public override void OnEnter()
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00e5: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			duration = 0.55f / ((BaseState)this).attackSpeedStat;
			hitTime = duration * 0.4f;
			((BaseState)this).StartAimMode(duration + 0.5f, false);
			string state = ((Object.op_Implicit((Object)(object)gojo) && gojo.MartialArts) ? "MartialArts" : steps[nextStep++ % steps.Length]);
			Anim(state, duration);
			Sound("melee_voice", 0.35f);
			HurtBox val = FindTarget(13f);
			if (Object.op_Implicit((Object)(object)val))
			{
				Vector3 val2 = ((Component)val).transform.position - ((EntityState)this).characterBody.corePosition;
				FaceDirection(val2);
				lunge = Vector3.ClampMagnitude(new Vector3(val2.x, 0f, val2.z), Mathf.Max(0f, ((Vector3)(ref val2)).magnitude - 2f)) / hitTime;
			}
			else
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				FaceDirection(((Ray)(ref aimRay)).direction);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0097: 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_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)
			//IL_0030: 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_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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge < hitTime && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.rootMotion += lunge * Time.fixedDeltaTime;
			}
			if (!hasHit && ((EntityState)this).fixedAge >= hitTime)
			{
				hasHit = true;
				Vector3 val = ((EntityState)this).characterBody.corePosition + ((EntityState)this).characterDirection.forward * 2.8f;
				GojoFx.Spawn("FX_CP_050_00211", val, Quaternion.LookRotation(((EntityState)this).characterDirection.forward));
				if (((EntityState)this).isAuthority && Hit(val, 3.5f, 2.2f, 600f, (DamageType)0) > 0)
				{
					GojoSounds.PlayAt(val, "melee_hit");
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			if (((EntityState)this).fixedAge < hitTime)
			{
				return (InterruptPriority)2;
			}
			return (InterruptPriority)0;
		}
	}
	public abstract class GojoSkill : BaseSkillState
	{
		protected GojoController gojo;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			gojo = GojoController.Of(((EntityState)this).gameObject);
		}

		protected void Anim(string state, float duration)
		{
			GojoAnimator.Play(((EntityState)this).gameObject, state, duration);
		}

		protected float ClipLength(string state)
		{
			return GojoAnimator.Length(((EntityState)this).gameObject, state);
		}

		protected void Sound(string eventKey, float chance = 1f)
		{
			GojoSounds.Play(((EntityState)this).gameObject, eventKey, chance);
		}

		protected int Hit(Vector3 point, float radius, float damageCoefficient, float force, DamageType type = (DamageType)0u, float procCoefficient = 1f)
		{
			//IL_0023: 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_0034: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_004e: 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_005a: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_008d: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00a5: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)gojo) && gojo.MartialArts)
			{
				damageCoefficient *= 1.6f;
			}
			Result val = new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = ((BaseState)this).GetTeam(),
				position = point,
				radius = radius,
				baseDamage = damageCoefficient * ((BaseState)this).damageStat,
				baseForce = force,
				crit = ((BaseState)this).RollCrit(),
				procCoefficient = procCoefficient,
				falloffModel = (FalloffModel)0,
				attackerFiltering = (AttackerFiltering)2,
				damageType = DamageTypeCombo.op_Implicit(type)
			}.Fire();
			if (val.hitCount > 0 && Object.op_Implicit((Object)(object)gojo))
			{
				gojo.Gain(1f * (float)val.hitCount);
			}
			return val.hitCount;
		}

		protected HurtBox FindTarget(float range, float maxAngle = 25f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			return Search(aimRay, range, maxAngle, (SortMode)2, lineOfSight: true) ?? Search(aimRay, range * 0.5f, 180f, (SortMode)1, lineOfSight: false);
		}

		private HurtBox Search(Ray aim, float range, float maxAngle, SortMode sort, bool lineOfSight)
		{
			//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_0007: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			BullseyeSearch val = new BullseyeSearch
			{
				teamMaskFilter = TeamMask.GetEnemyTeams(((BaseState)this).GetTeam()),
				filterByLoS = lineOfSight,
				searchOrigin = ((Ray)(ref aim)).origin,
				searchDirection = ((Ray)(ref aim)).direction,
				maxDistanceFilter = range,
				maxAngleFilter = maxAngle,
				sortMode = sort
			};
			val.RefreshCandidates();
			val.FilterOutGameObject(((EntityState)this).gameObject);
			foreach (HurtBox result in val.GetResults())
			{
				if (Object.op_Implicit((Object)(object)result) && Object.op_Implicit((Object)(object)result.healthComponent) && result.healthComponent.alive)
				{
					return result;
				}
			}
			return null;
		}

		protected Vector3 AimPoint(float range)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Ray val = aimRay;
			LayerIndex val2 = LayerIndex.world;
			int num = LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask);
			val2 = LayerIndex.entityPrecise;
			RaycastHit val3 = default(RaycastHit);
			if (!Physics.Raycast(val, ref val3, range, num | LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask), (QueryTriggerInteraction)1))
			{
				return ((Ray)(ref aimRay)).GetPoint(range);
			}
			return ((RaycastHit)(ref val3)).point;
		}

		protected void FaceDirection(Vector3 direction)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			direction.y = 0f;
			if (!(((Vector3)(ref direction)).sqrMagnitude < 0.01f) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = ((Vector3)(ref direction)).normalized;
			}
		}
	}
	public class HollowPurple : GojoSkill
	{
		private const float mergeAt = 0.7f;

		private float chargeTime;

		private float duration;

		private bool merged;

		private bool fired;

		private GameObject blue;

		private GameObject red;

		private Vector3 Forward
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				Ray aimRay = ((BaseState)this).GetAimRay();
				return ((Ray)(ref aimRay)).direction;
			}
		}

		private Vector3 Right
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = Vector3.Cross(Vector3.up, Forward);
				return ((Vector3)(ref val)).normalized;
			}
		}

		private Vector3 Centre => ((EntityState)this).characterBody.corePosition + Forward * 0.9f + Vector3.up * 0.3f;

		public override void OnEnter()
		{
			//IL_0094: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_011d: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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)
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)gojo))
			{
				gojo.Spend(70f);
			}
			chargeTime = Mathf.Max(1.2f, ClipLength("Purple1"));
			duration = chargeTime + Mathf.Max(0.5f, ClipLength("Purple2"));
			Anim("Purple1", chargeTime);
			Sound("purple_voice");
			Sound("purple_charge");
			FaceDirection(Forward);
			((BaseState)this).StartAimMode(duration + 0.5f, false);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			blue = GojoFx.SpawnLooping(GojoFx.Blue(1), Centre - Right * 0.8f, Quaternion.LookRotation(-Forward), null, 0.54f);
			red = GojoFx.SpawnLooping("FX_CP_050_08111", Centre + Right * 0.8f, Quaternion.LookRotation(Forward), null, 0.72f);
		}

		public override void Update()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (!merged)
			{
				float num = Mathf.Clamp01(((EntityState)this).age / (chargeTime * 0.7f));
				float num2 = Mathf.Lerp(0.8f, 0f, num * num);
				if (Object.op_Implicit((Object)(object)blue))
				{
					blue.transform.position = Centre - Right * num2;
				}
				if (Object.op_Implicit((Object)(object)red))
				{
					red.transform.position = Centre + Right * num2;
				}
			}
		}

		public override void FixedUpdate()
		{
			//IL_0008: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			FaceDirection(Forward);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = new Vector3(0f, Mathf.Min(0f, ((EntityState)this).characterMotor.velocity.y) * 0.2f, 0f);
			}
			if (!merged && ((EntityState)this).fixedAge >= chargeTime * 0.7f)
			{
				merged = true;
				GojoFx.Release(blue);
				GojoFx.Release(red);
				GojoFx.Spawn("FX_CP_050_09115", Centre, Quaternion.LookRotation(Forward), ((EntityState)this).transform);
			}
			if (!fired && ((EntityState)this).fixedAge >= chargeTime)
			{
				fired = true;
				Anim("Purple2", duration - chargeTime);
				Sound("purple_fire");
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector3 val = Centre + ((Ray)(ref aimRay)).direction * 1.5f;
				GojoFx.SpawnAll(GojoFx.PurpleBurst, val, Quaternion.LookRotation(((Ray)(ref aimRay)).direction));
				PurpleSphere.Spawn(((EntityState)this).characterBody, val, ((Ray)(ref aimRay)).direction, ((BaseState)this).RollCrit(), ((EntityState)this).isAuthority);
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			GojoFx.Release(blue);
			GojoFx.Release(red);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public class Red : GojoSkill
	{
		private GameObject orb;

		private GameObject air;

		private PcmMixer.Voice charging;

		private int level;

		private bool holding;

		internal static Vector3 Fingertip(CharacterBody body, Vector3 forward)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0016: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			return body.corePosition + forward * 0.8f + Vector3.up * 0.35f;
		}

		public override void OnEnter()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			level = ((!Object.op_Implicit((Object)(object)gojo) || !((EntityState)this).isAuthority) ? 1 : Mathf.Max(1, gojo.Level));
			Anim("Red1", Mathf.Max(0.3f, ClipLength("Red1")));
			Sound("red_voice");
			charging = GojoSounds.Play(((EntityState)this).gameObject, "red_charge");
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			FaceDirection(direction);
			orb = GojoFx.SpawnLooping("FX_CP_050_08111", Fingertip(((EntityState)this).characterBody, direction), Quaternion.LookRotation(direction), null, 0.4f);
			air = GojoFx.SpawnLooping("FX_CP_050_08115", ((EntityState)this).characterBody.corePosition, Quaternion.LookRotation(direction), ((EntityState)this).transform);
			((BaseState)this).StartAimMode(2.2f, false);
		}

		public override void Update()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (Object.op_Implicit((Object)(object)orb))
			{
				Transform transform = orb.transform;
				CharacterBody characterBody = ((EntityState)this).characterBody;
				Ray aimRay = ((BaseState)this).GetAimRay();
				transform.position = Fingertip(characterBody, ((Ray)(ref aimRay)).direction);
				float num = Mathf.Clamp01(((EntityState)this).age / 1.2f);
				orb.transform.localScale = Vector3.one * Mathf.Lerp(1f, 2.5f, num) * 1.2f;
				if (!holding && ((EntityState)this).age > ClipLength("Red1"))
				{
					holding = true;
					Anim("Red2", 2.2f);
				}
			}
		}

		public override void FixedUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			Ray aimRay = ((BaseState)this).GetAimRay();
			FaceDirection(((Ray)(ref aimRay)).direction);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x * 0.5f, ((EntityState)this).characterMotor.velocity.y, ((EntityState)this).characterMotor.velocity.z * 0.5f);
			}
			if (((EntityState)this).isAuthority && (!Object.op_Implicit((Object)(object)((EntityState)this).inputBank) || !((EntityState)this).inputBank.skill4.down || ((EntityState)this).fixedAge >= 2f))
			{
				Ray aimRay2 = ((BaseState)this).GetAimRay();
				((EntityState)this).outer.SetNextState((EntityState)(object)new RedFire
				{
					charge = Mathf.Clamp01(((EntityState)this).fixedAge / 1.2f),
					level = level,
					direction = ((Ray)(ref aimRay2)).direction
				});
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)orb))
			{
				EntityState.Destroy((Object)(object)orb);
			}
			GojoFx.Release(air);
			GojoSounds.Stop(charging);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class RedFire : GojoSkill
	{
		internal float charge;

		internal int level = 1;

		internal Vector3 direction;

		private float duration;

		public override void OnEnter()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			duration = Mathf.Max(0.35f, ClipLength("Red3") * 0.6f);
			Anim("Red3", duration);
			Sound("red_fire");
			FaceDirection(direction);
			RedOrb.Spawn(((EntityState)this).characterBody, Red.Fingertip(((EntityState)this).characterBody, direction), direction, level, charge, ((BaseState)this).RollCrit(), ((EntityState)this).isAuthority);
		}

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

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(charge);
			writer.Write(level);
			writer.Write(direction);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			charge = reader.ReadSingle();
			level = reader.ReadInt32();
			direction = reader.ReadVector3();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class ReverseCursedTechnique : GojoSkill
	{
		private static GameObject healEffect;

		private float nextEffect;

		public override void OnEnter()
		{
			base.OnEnter();
			if (!Object.op_Implicit((Object)(object)healEffect))
			{
				healEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MedkitHealEffect");
			}
		}

		public override void FixedUpdate()
		{
			//IL_00b7: 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_0112: 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)
			((EntityState)this).FixedUpdate();
			float num = 20f * Time.fixedDeltaTime;
			if (((EntityState)this).isAuthority)
			{
				bool num2 = Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.skill3.down;
				bool flag = !Object.op_Implicit((Object)(object)((EntityState)this).healthComponent) || ((EntityState)this).healthComponent.health >= ((EntityState)this).healthComponent.fullHealth;
				if (!num2 || flag || !Object.op_Implicit((Object)(object)gojo) || !gojo.Spend(num))
				{
					((EntityState)this).outer.SetNextStateToMain();
					return;
				}
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).healthComponent))
			{
				((EntityState)this).healthComponent.HealFraction(num / 100f, default(ProcChainMask));
			}
			nextEffect -= Time.fixedDeltaTime;
			if (nextEffect <= 0f && Object.op_Implicit((Object)(object)healEffect) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				nextEffect = 0.35f;
				EffectManager.SimpleEffect(healEffect, ((EntityState)this).characterBody.corePosition, Quaternion.identity, false);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class UnlimitedVoid : GojoSkill
	{
		private float duration;

		private bool opened;

		public override void OnEnter()
		{
			//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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			if (Object.op_Implicit((Object)(object)gojo))
			{
				gojo.DrainAll();
			}
			bool flag = DomainCinematic.Length > 0f;
			duration = (flag ? DomainCinematic.Length : 3.5f);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			((BaseState)this).StartAimMode(duration + 0.5f, false);
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, duration + 0.5f);
			}
			if (flag)
			{
				DomainCinematic.Begin(((EntityState)this).characterBody, FindTarget(45f, 180f));
			}
			else
			{
				Anim("Domain1", duration * 0.35f);
				Sound("domain_voice");
				Sound("domain_se");
				GojoFx.SpawnAll(GojoFx.DomainAura, ((EntityState)this).characterBody.corePosition, ((EntityState)this).transform.rotation, ((EntityState)this).transform);
			}
			if (NetworkServer.active)
			{
				DomainPulse.Spawn(((EntityState)this).characterBody, ((EntityState)this).characterBody.footPosition, duration + 10f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = new Vector3(0f, Mathf.Min(0f, ((EntityState)this).characterMotor.velocity.y), 0f);
			}
			if (!opened && ((EntityState)this).fixedAge >= duration)
			{
				opened = true;
				if (DomainCinematic.Length <= 0f)
				{
					GojoFx.SpawnAll(GojoFx.DomainOpen, ((EntityState)this).characterBody.footPosition, ((EntityState)this).transform.rotation);
					VoidBackdrop.Create(CameraRigController.readOnlyInstancesList).Hold(((EntityState)this).characterBody.footPosition, ((EntityState)this).transform.rotation, 10f);
				}
				if (Object.op_Implicit((Object)(object)gojo))
				{
					gojo.MartialArtsUntil = Time.time + 10f + 15f;
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration + 0.2f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
}
namespace GojoMod.Components
{
	public class BlueOrb : MonoBehaviour
	{
		private const float tick = 0.1f;

		private CharacterBody owner;

		private Vector3 target;

		private int level;

		private float charge;

		private float age;

		private float nextTick;

		private float holdUntil = -1f;

		private bool crit;

		private bool dealsDamage;

		private GameObject effect;

		private PcmMixer.Voice loop;

		private float Strength => (1f + 0.35f * (float)(level - 1)) * Mathf.Lerp(0.6f, 1.3f, charge);

		internal static void Spawn(CharacterBody owner, Vector3 from, Vector3 target, int level, float charge, bool crit, bool dealsDamage)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0073: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			BlueOrb blueOrb = new GameObject("GojoBlue").AddComponent<BlueOrb>();
			((Component)blueOrb).transform.position = from;
			blueOrb.owner = owner;
			blueOrb.target = target;
			blueOrb.level = Mathf.Max(1, level);
			blueOrb.charge = charge;
			blueOrb.crit = crit;
			blueOrb.dealsDamage = dealsDamage;
			float scale = Mathf.Lerp(0.5f, 1.3f, charge) * 1.2f;
			blueOrb.effect = GojoFx.SpawnLooping(GojoFx.Blue(blueOrb.level), from, Quaternion.LookRotation(target - from), ((Component)blueOrb).transform, scale);
			blueOrb.loop = GojoSounds.Play(((Component)blueOrb).gameObject, "blue_loop");
		}

		private void FixedUpdate()
		{
			//IL_0044: 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_005a: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			age += Time.fixedDeltaTime;
			if (!Object.op_Implicit((Object)(object)owner))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (holdUntil < 0f)
			{
				((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, target, 22f * Time.fixedDeltaTime);
				Vector3 val = ((Component)this).transform.position - target;
				if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
				{
					holdUntil = age + 5f;
				}
			}
			else if (age >= holdUntil)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (dealsDamage && !(age < nextTick))
			{
				nextTick = age + 0.1f;
				float radius = 9f * ((holdUntil < 0f) ? 0.6f : 1f) * Mathf.Lerp(0.7f, 1.2f, charge);
				new BlastAttack
				{
					attacker = ((Component)owner).gameObject,
					inflictor = ((Component)this).gameObject,
					teamIndex = owner.teamComponent.teamIndex,
					position = ((Component)this).transform.position,
					radius = radius,
					baseDamage = 0.25f * Strength * owner.damage,
					baseForce = -380f * Strength,
					crit = crit,
					procCoefficient = 0.4f,
					falloffModel = (FalloffModel)0,
					attackerFiltering = (AttackerFiltering)2
				}.Fire();
			}
		}

		private void OnDestroy()
		{
			GojoFx.Release(effect);
			GojoSounds.Stop(loop);
		}
	}
	internal static class CursedEnergyHud
	{
		private static Texture2D white;

		private static GUIStyle label;

		internal static void Draw(float energy, int level, bool martialArts, bool infinityReady, float regen)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_001f: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_0125: 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_00e6: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)white))
			{
				white = new Texture2D(1, 1);
				white.SetPixel(0, 0, Color.white);
				white.Apply();
			}
			label = (GUIStyle)(((object)label) ?? ((object)new GUIStyle(GUI.skin.label)
			{
				fontSize = 16,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)3
			}));
			float num = (float)Screen.width * 0.22f;
			float num2 = 12f;
			float num3 = ((float)Screen.width - num) * 0.5f;
			float num4 = (float)Screen.height * 0.8f;
			Rect(num3 - 2f, num4 - 2f, num + 4f, num2 + 4f, new Color(0f, 0f, 0f, 0.6f));
			Color color = ((level >= 3) ? new Color(0.72f, 0.38f, 1f) : ((level == 2) ? new Color(0.35f, 0.62f, 1f) : new Color(0.55f, 0.82f, 1f)));
			Rect(num3, num4, num * energy / 100f, num2, color);
			float[] cursedEnergyLevels = GojoStaticValues.cursedEnergyLevels;
			foreach (float num5 in cursedEnergyLevels)
			{
				Rect(num3 + num * num5 / 100f - 1f, num4, 2f, num2, new Color(1f, 1f, 1f, 0.8f));
			}
			if (energy < 100f)
			{
				float num6 = num3 + num + 10f;
				float num7 = 44f;
				Rect(num6 - 2f, num4 - 2f, num7 + 4f, num2 + 4f, new Color(0f, 0f, 0f, 0.6f));
				Rect(num6, num4, num7 * Mathf.Clamp01(regen), num2, new Color(0.55f, 0.82f, 1f, 0.9f));
				GUI.color = Color.white;
				GUI.Label(new Rect(num6 + num7 + 6f, num4 - 5f, 120f, 22f), $"+{20f:0}%  {Mathf.CeilToInt((1f - regen) * 10f)}s", label);
			}
			string text = $"Cursed Energy {energy:0}%  Lv {level}";
			if (energy >= 100f)
			{
				text += "  •  Domain Expansion ready";
			}
			if (martialArts)
			{
				text += "  •  Martial Arts";
			}
			if (infinityReady)
			{
				text += "  •  ∞";
			}
			GUI.color = Color.white;
			GUI.Label(new Rect(num3, num4 - 24f, num + 200f, 22f), text, label);
		}

		private static void Rect(float x, float y, float w, float h, Color color)
		{
			//IL_0000: 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)
			GUI.color = color;
			GUI.DrawTexture(new Rect(x, y, w, h), (Texture)(object)white);
		}
	}
	public class DomainPulse : MonoBehaviour
	{
		private const float pulseEvery = 0.5f;

		private CharacterBody owner;

		private float age;

		private float nextPulse;

		private float duration;

		private int pulses;

		internal static void Spawn(CharacterBody owner, Vector3 centre, float duration)
		{
			//IL_0005: 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)
			DomainPulse domainPulse = new GameObject("GojoUnlimitedVoid").AddComponent<DomainPulse>();
			((Component)domainPulse).transform.position = centre;
			domainPulse.owner = owner;
			domainPulse.duration = duration;
			domainPulse.pulses = Mathf.Max(1, Mathf.CeilToInt(duration / 0.5f));
		}

		private void FixedUpdate()
		{
			//IL_0096: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			age += Time.fixedDeltaTime;
			if (!Object.op_Implicit((Object)(object)owner) || age >= duration)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				if (age < nextPulse)
				{
					return;
				}
				nextPulse = age + 0.5f;
				foreach (CharacterBody item in Victims())
				{
					Hold(item);
					HealthComponent healthComponent = item.healthComponent;
					if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive)
					{
						healthComponent.TakeDamage(new DamageInfo
						{
							attacker = ((Component)owner).gameObject,
							inflictor = ((Component)this).gameObject,
							position = item.corePosition,
							damage = healthComponent.fullCombinedHealth * 0.3f / (float)pulses,
							damageType = DamageTypeCombo.op_Implicit((DamageType)67),
							damageColorIndex = (DamageColorIndex)9,
							procCoefficient = 0f,
							crit = false,
							procChainMask = default(ProcChainMask)
						});
					}
				}
			}
		}

		private IEnumerable<CharacterBody> Victims()
		{
			TeamIndex team = (TeamIndex)((!Object.op_Implicit((Object)(object)owner.teamComponent)) ? 1 : ((int)owner.teamComponent.teamIndex));
			TeamIndex t = (TeamIndex)0;
			while ((int)t < 6)
			{
				if (t != team)
				{
					foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(t))
					{
						CharacterBody val = (Object.op_Implicit((Object)(object)teamMember) ? teamMember.body : null);
						if (Object.op_Implicit((Object)(object)val))
						{
							Vector3 val2 = val.corePosition - ((Component)this).transform.position;
							if (((Vector3)(ref val2)).sqrMagnitude <= 2025f)
							{
								yield return val;
							}
						}
					}
				}
				t = (TeamIndex)(sbyte)(t + 1);
			}
		}

		private static void Hold(CharacterBody body)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.8f;
			SetStateOnHurt component = ((Component)body).GetComponent<SetStateOnHurt>();
			if (Object.op_Implicit((Object)(object)component) && component.canBeStunned)
			{
				component.SetStun(num);
			}
			body.AddTimedBuff(Buffs.Nullified, num);
			if (Object.op_Implicit((Object)(object)body.characterMotor))
			{
				body.characterMotor.velocity = Vector3.zero;
			}
			if (Object.op_Implicit((Object)(object)body.rigidbody))
			{
				body.rigidbody.velocity = Vector3.zero;
			}
		}
	}
	public class GojoAnimator : MonoBehaviour
	{
		private const float locomotionFade = 0.15f;

		private const float runClipSpeed = 7f;

		private Animator animator;

		private CharacterBody body;

		private CharacterMotor motor;

		private InputBankTest input;

		private string current;

		private float actionUntil;

		internal bool Floating { get; private set; }

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			motor = ((Component)this).GetComponent<CharacterMotor>();
			input = ((Component)this).GetComponent<InputBankTest>();
			ModelLocator component = ((Component)this).GetComponent<ModelLocator>();
			object obj;
			if (component == null)
			{
				obj = null;
			}
			else
			{
				Transform modelTransform = component.modelTransform;
				obj = ((modelTransform != null) ? modelTransform.Find("GojoVisual") : null);
			}
			Transform val = (Transform)obj;
			animator = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponentInChildren<Animator>() : null);
		}

		private void Update()
		{
			//IL_0035: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)animator) && !(Time.time < actionUntil))
			{
				Vector3 val = (Object.op_Implicit((Object)(object)motor) ? motor.velocity : Vector3.zero);
				Vector3 val2 = new Vector3(val.x, 0f, val.z);
				float magnitude = ((Vector3)(ref val2)).magnitude;
				bool flag = !Object.op_Implicit((Object)(object)motor) || motor.isGrounded;
				Floating = !flag && val.y < 0f && Object.op_Implicit((Object)(object)input) && input.jump.down;
				string text = ((!flag) ? (Floating ? "Float" : ((val.y > 0.5f) ? "JumpUp" : "Fall")) : ((!(magnitude > 1f)) ? "Idle" : "Run"));
				animator.speed = ((text == "Run") ? Mathf.Clamp(magnitude / 7f, 0.6f, 2f) : 1f);
				CrossFade(text, 0.15f);
			}
		}

		internal void PlayAction(string state, float duration, float fade = 0.08f)
		{
			if (Object.op_Implicit((Object)(object)animator) && !(duration <= 0f))
			{
				float num = ClipLength(state);
				animator.speed = ((num > 0f) ? Mathf.Clamp(num / duration, 0.4f, 3f) : 1f);
				current = null;
				CrossFade(state, fade);
				actionUntil = Time.time + duration;
			}
		}

		internal void PlayHold(string state, float holdFor)
		{
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.speed = 1f;
				current = null;
				CrossFade(state, 0.08f);
				actionUntil = Time.time + holdFor;
			}
		}

		internal static void Play(GameObject bodyObject, string state, float duration)
		{
			GojoAnimator gojoAnimator = (Object.op_Implicit((Object)(object)bodyObject) ? bodyObject.GetComponent<GojoAnimator>() : null);
			if (Object.op_Implicit((Object)(object)gojoAnimator))
			{
				gojoAnimator.PlayAction(state, duration);
			}
		}

		internal static float Length(GameObject bodyObject, string state)
		{
			GojoAnimator gojoAnimator = (Object.op_Implicit((Object)(object)bodyObject) ? bodyObject.GetComponent<GojoAnimator>() : null);
			if (!Object.op_Implicit((Object)(object)gojoAnimator) || !Object.op_Implicit((Object)(object)gojoAnimator.animator))
			{
				return 0f;
			}
			return gojoAnimator.ClipLength(state);
		}

		private void CrossFade(string state, float fade)
		{
			if (!(state == current))
			{
				current = state;
				animator.CrossFadeInFixedTime(state, fade);
			}
		}

		private float ClipLength(string state)
		{
			AnimationClip[] animationClips = animator.runtimeAnimatorController.animationClips;
			foreach (AnimationClip val in animationClips)
			{
				if (((Object)val).name == state)
				{
					return val.length;
				}
			}
			return 0f;
		}
	}
	public class GojoController : MonoBehaviour, IOnIncomingDamageServerReceiver
	{
		private const float floatFallSpeed = -2.5f;

		internal const float infinityRecharge = 6f;

		private CharacterBody body;

		private CharacterMotor motor;

		private GojoAnimator animator;

		private int lastLevel;

		private float infinityReadyAt;

		private bool greeted;

		private bool eyesUncovered;

		internal float CursedEnergy { get; private set; }

		internal float RegenProgress { get; private set; }

		internal int Level
		{
			get
			{
				int num = 0;
				float[] cursedEnergyLevels = GojoStaticValues.cursedEnergyLevels;
				foreach (float num2 in cursedEnergyLevels)
				{
					if (CursedEnergy >= num2)
					{
						num++;
					}
				}