Decompiled source of Young Sasuke v0.6.1

plugins/YoungSasuke/HenryMod.dll

Decompiled a day ago
using System;
using System.Collections;
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.Serialization.Json;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using HG;
using HG.BlendableTypes;
using HenryMod.Modules;
using HenryMod.Modules.Achievements;
using HenryMod.Modules.BaseStates;
using HenryMod.Modules.Characters;
using HenryMod.Survivors.Henry;
using HenryMod.Survivors.Henry.SkillStates;
using KinematicCharacterController;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.SurvivorMannequins;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HenryMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HenryMod")]
[assembly: AssemblyTitle("HenryMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HenryMod
{
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("local.henry.YoungSasuke", "Young Sasuke", "0.6.0")]
	public class HenryPlugin : BaseUnityPlugin
	{
		public const string MODUID = "local.henry.YoungSasuke";

		public const string MODNAME = "Young Sasuke";

		public const string MODVERSION = "0.6.0";

		public const string DEVELOPER_PREFIX = "ROB";

		public static HenryPlugin instance;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			SasukeTuning.Init(((BaseUnityPlugin)this).Config);
			SasukeAudio.Preload();
			SasukeCurseTimer.Init();
			Language.Init();
			new HenrySurvivor().Initialize();
			new ContentPacks().Initialize();
			SasukeSmoke.Init();
			SasukePolishTest.Init();
			SasukeAudioTest.Init();
			SasukeHeadTest.Init();
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public class SasukeAudio : MonoBehaviour
	{
		private uint fire;

		private uint charge;

		private uint voice;

		private uint sharingan;

		private float voiceUntil;

		private float voiceAt = -1f;

		private CharacterBody body;

		private float sustainUntil = -1f;

		private float chargeStarted;

		private bool charging;

		private bool released;

		private bool looping;

		private bool diagnostics;

		public static void Preload()
		{
			try
			{
				SoundBanks.Add(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)HenryPlugin.instance).Info.Location), "Assets", "Audio", "YoungSasuke04.bnk")));
				Log.Info("Young Sasuke Wwise bank queued");
			}
			catch (Exception ex)
			{
				Log.Error("Sasuke soundbank: " + ex);
			}
		}

		private static uint Play(string name, GameObject go)
		{
			if (!Object.op_Implicit((Object)(object)go.GetComponent<AkGameObj>()))
			{
				go.AddComponent<AkGameObj>();
			}
			return AkSoundEngine.PostEvent("Play_YS04_" + name, go);
		}

		private static void Stop(ref uint id, int fade = 60)
		{
			if (id != 0)
			{
				AkSoundEngine.StopPlayingID(id, fade);
			}
			id = 0u;
		}

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			diagnostics = File.Exists(Path.Combine(SasukeVisual.Assets, "RUN_HEAD_TEST"));
		}

		private bool LocalCaster()
		{
			return Object.op_Implicit((Object)(object)body) && body.isPlayerControlled && Util.HasEffectiveAuthority(((Component)this).gameObject);
		}

		public void StartFire(float speed)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkClient.active)
			{
				released = false;
				AkSoundEngine.SetRTPCValue("YS04_FirePitch", 0f, ((Component)this).gameObject);
				Stop(ref fire, 0);
				fire = Play(LocalCaster() ? "fire_prep_local" : "fire_prep", ((Component)this).gameObject);
				voiceAt = Time.time + Mathf.Max(0.1f, 1.3333334f / Mathf.Max(0.1f, speed) - 1.233333f);
			}
		}

		public void Sharingan()
		{
			if (NetworkClient.active)
			{
				Stop(ref sharingan, 0);
				sharingan = Play(LocalCaster() ? "sharingan_local" : "sharingan", ((Component)this).gameObject);
			}
		}

		public void ReleaseFire(float speed)
		{
			if (NetworkClient.active)
			{
				released = true;
				Stop(ref fire, 20);
				fire = Play(LocalCaster() ? "fire_release_local" : "fire_release", ((Component)this).gameObject);
				if (diagnostics)
				{
					Log.Info("HEAD_ACTUAL_RELEASE local=" + LocalCaster() + " id=" + fire);
				}
			}
		}

		public void StopFire()
		{
			if (!released)
			{
				voiceAt = -1f;
				Stop(ref fire);
				Stop(ref voice);
				voiceUntil = 0f;
			}
		}

		public void BeginCharge()
		{
			if (NetworkClient.active)
			{
				charging = true;
				looping = false;
				chargeStarted = Time.time;
				sustainUntil = Time.time + 0.2f;
				Stop(ref charge);
				charge = Play("charge_onset", ((Component)this).gameObject);
			}
		}

		public void Sustain()
		{
			if (NetworkClient.active)
			{
				if (!charging)
				{
					charging = true;
					looping = true;
					charge = Play("charge_loop", ((Component)this).gameObject);
				}
				sustainUntil = Time.time + 0.15f;
			}
		}

		public void EndCharge()
		{
			Stop(ref charge, 80);
			charging = false;
			sustainUntil = -1f;
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
			{
				voiceAt = -1f;
				Stop(ref fire);
				Stop(ref voice);
				Stop(ref sharingan);
				EndCharge();
			}
			else
			{
				if (!NetworkClient.active)
				{
					return;
				}
				if (voiceAt >= 0f && Time.time >= voiceAt)
				{
					voiceAt = -1f;
					if (Time.time >= voiceUntil)
					{
						Stop(ref voice, 0);
						voice = Play(LocalCaster() ? "fire_voice_local" : "fire_voice", ((Component)this).gameObject);
						voiceUntil = Time.time + 1.667f;
					}
				}
				if (charging && Time.time > sustainUntil)
				{
					EndCharge();
				}
				else if (charging && !looping && Time.time - chargeStarted >= 4.5f)
				{
					Stop(ref charge, 30);
					charge = Play("charge_loop", ((Component)this).gameObject);
					looping = true;
				}
			}
		}

		private void OnDisable()
		{
			voiceAt = -1f;
			Stop(ref fire);
			Stop(ref voice);
			Stop(ref sharingan);
			EndCharge();
		}

		public static void FireImpact(GameObject emitter)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkClient.active)
			{
				if (!Object.op_Implicit((Object)(object)emitter.GetComponent<AkGameObj>()))
				{
					emitter.AddComponent<AkGameObj>();
				}
				AkSoundEngine.SetRTPCValue("YS04_FirePitch", 0f, emitter);
				uint num = Play("fire_release", emitter);
				if (File.Exists(Path.Combine(SasukeVisual.Assets, "RUN_POLISH_TEST")))
				{
					Log.Info("RC03_FIRE_IMPACT t=" + Time.time + " id=" + num + " at=" + ((object)emitter.transform.position/*cast due to .constrained prefix*/).ToString());
				}
			}
		}

		public static void Impact(Vector3 point)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkClient.active)
			{
				GameObject val = new GameObject("Chidori impact audio");
				val.transform.position = point;
				Play("chidori_impact", val);
				Object.Destroy((Object)(object)val, 1.1f);
			}
		}
	}
	public class SasukeFireImpactAudio : MonoBehaviour
	{
		private void Start()
		{
			SasukeAudio.FireImpact(((Component)this).gameObject);
		}
	}
	public class SasukeImpactAudio : MonoBehaviour
	{
		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			SasukeAudio.Impact(((Component)this).transform.position);
		}
	}
	public static class SasukeAudioTest
	{
		public static void Init()
		{
			if (File.Exists(Path.Combine(SasukeVisual.Assets, "RUN_AUDIO_TEST")))
			{
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
				{
					((MonoBehaviour)HenryPlugin.instance).StartCoroutine(Run());
				});
			}
		}

		private unsafe static void Callback(object cookie, AkCallbackType type, AkCallbackInfo info)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Log.Info("P04_AUDIO_CALLBACK " + cookie?.ToString() + " " + ((object)(*(AkCallbackType*)(&type))/*cast due to .constrained prefix*/).ToString() + ((info is AkDurationCallbackInfo) ? (" duration=" + ((AkDurationCallbackInfo)info).fDuration) : ""));
		}

		private unsafe static IEnumerator Run()
		{
			yield return (object)new WaitForSeconds(12f);
			GameObject go = new GameObject("Sasuke audio diagnostic");
			AkAudioListener listener = Object.FindObjectOfType<AkAudioListener>();
			if (Object.op_Implicit((Object)(object)listener))
			{
				go.transform.position = ((Component)listener).transform.position;
			}
			go.AddComponent<AkGameObj>();
			if (!Object.op_Implicit((Object)(object)listener))
			{
				go.AddComponent<AkAudioListener>();
			}
			Log.Info("P04_LISTENER " + (object)listener);
			Log.Info("P04_AUDIO_CAPTURE " + ((object)AkSoundEngine.StartOutputCapture(Path.Combine(SasukeVisual.Assets, "P04_WwiseOutput.wav"))/*cast due to .constrained prefix*/).ToString());
			string[] array = new string[5] { "fire_prep", "fire_release", "charge_onset", "charge_loop", "chidori_impact" };
			int position = default(int);
			foreach (string name in array)
			{
				uint id = AkSoundEngine.PostEvent("Play_YS04_" + name, go, 1048585u, new EventCallback(Callback), (object)name);
				Log.Info("P04_AUDIO_START " + name + " id=" + id);
				yield return (object)new WaitForSeconds(0.25f);
				AKRESULT result = AkSoundEngine.GetSourcePlayPosition(id, ref position);
				Log.Info("P04_AUDIO_POSITION " + name + " " + ((object)(*(AKRESULT*)(&result))/*cast due to .constrained prefix*/).ToString() + " ms=" + position);
				yield return (object)new WaitForSeconds((name == "charge_onset") ? 4.5f : ((name == "charge_loop") ? 4f : 2f));
				AkSoundEngine.StopPlayingID(id, 50);
				yield return (object)new WaitForSeconds(0.1f);
			}
			AkSoundEngine.SetRTPCValue("YS04_FirePitch", 1200f, go);
			uint fast = AkSoundEngine.PostEvent("Play_YS04_fire_prep", go, 1048585u, new EventCallback(Callback), (object)"fire_prep_2x");
			yield return (object)new WaitForSeconds(0.25f);
			int fastPos = default(int);
			Log.Info("P04_AUDIO_2X " + ((object)AkSoundEngine.GetSourcePlayPosition(fast, ref fastPos)/*cast due to .constrained prefix*/).ToString() + " ms=" + fastPos);
			yield return (object)new WaitForSeconds(1f);
			Log.Info("P04_AUDIO_CAPTURE_STOP " + ((object)AkSoundEngine.StopOutputCapture()/*cast due to .constrained prefix*/).ToString());
			Object.Destroy((Object)(object)go);
			Log.Info("P04_AUDIO_END");
		}
	}
	public static class SasukeCombat
	{
		public static void Setup(GameObject prefab, Sprite icon)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			Content.AddEntityState(typeof(LionCombo));
			Skills.ClearGenericSkills(prefab);
			Skills.CreateSkillFamilies(prefab);
			SasukeAttackSkillDef sasukeAttackSkillDef = ScriptableObject.CreateInstance<SasukeAttackSkillDef>();
			((SkillDef)sasukeAttackSkillDef).skillName = "SasukeLionsBarrage";
			((SkillDef)sasukeAttackSkillDef).skillNameToken = "SASUKE_PRIMARY";
			((SkillDef)sasukeAttackSkillDef).skillDescriptionToken = "SASUKE_PRIMARY_DESC";
			((SkillDef)sasukeAttackSkillDef).icon = icon;
			((SkillDef)sasukeAttackSkillDef).activationState = new SerializableEntityStateType(typeof(LionCombo));
			((SkillDef)sasukeAttackSkillDef).activationStateMachineName = "Weapon";
			((SkillDef)sasukeAttackSkillDef).baseMaxStock = 1;
			((SkillDef)sasukeAttackSkillDef).rechargeStock = 1;
			((SkillDef)sasukeAttackSkillDef).requiredStock = 1;
			((SkillDef)sasukeAttackSkillDef).stockToConsume = 0;
			((SkillDef)sasukeAttackSkillDef).baseRechargeInterval = 0f;
			((SkillDef)sasukeAttackSkillDef).interruptPriority = (InterruptPriority)1;
			((SkillDef)sasukeAttackSkillDef).isCombatSkill = true;
			((SkillDef)sasukeAttackSkillDef).mustKeyPress = false;
			((SkillDef)sasukeAttackSkillDef).cancelSprintingOnActivation = false;
			((SkillDef)sasukeAttackSkillDef).canceledFromSprinting = false;
			((Object)sasukeAttackSkillDef).name = ((SkillDef)sasukeAttackSkillDef).skillName;
			Content.AddSkillDef((SkillDef)(object)sasukeAttackSkillDef);
			Skills.AddPrimarySkills(prefab, sasukeAttackSkillDef);
			LanguageAPI.Add("SASUKE_PRIMARY", "Lion’s Barrage");
			LanguageAPI.Add("SASUKE_PRIMARY_DESC", SasukeText.Primary);
		}

		public static bool Enemy(HurtBox h, CharacterBody b)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			return Object.op_Implicit((Object)(object)h) && Object.op_Implicit((Object)(object)h.healthComponent) && h.healthComponent.alive && h.teamIndex != b.teamComponent.teamIndex && (int)h.teamIndex > 0;
		}

		public static bool Hit(CharacterBody body, Vector3 center, float radius, float coefficient, float proc, HashSet<HealthComponent> victims, bool one = false)
		{
			//IL_0017: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00d9: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				return false;
			}
			bool result = false;
			Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2);
			foreach (Collider val in array)
			{
				HurtBox component = ((Component)val).GetComponent<HurtBox>();
				if (Enemy(component, body) && !victims.Contains(component.healthComponent) && !Physics.Linecast(body.corePosition, ((Component)component).transform.position, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					victims.Add(component.healthComponent);
					DamageInfo val2 = new DamageInfo
					{
						attacker = ((Component)body).gameObject,
						inflictor = ((Component)body).gameObject,
						damage = body.damage * coefficient,
						crit = body.RollCrit(),
						position = ((Component)component).transform.position,
						force = Vector3.zero,
						procCoefficient = proc,
						damageType = DamageTypeCombo.op_Implicit((DamageType)0)
					};
					component.healthComponent.TakeDamage(val2);
					GlobalEventManager.instance.OnHitEnemy(val2, ((Component)component.healthComponent).gameObject);
					GlobalEventManager.instance.OnHitAll(val2, ((Component)component.healthComponent).gameObject);
					result = true;
					if (one)
					{
						break;
					}
				}
			}
			return result;
		}
	}
	public class SasukeAttackSkillDef : SkillDef
	{
		public override bool CanExecute(GenericSkill slot)
		{
			EntityStateMachine[] components = ((Component)slot).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.state is ChidoriCharge || val.state is ChidoriCarry || val.state is ChidoriStrike || val.state is ChidoriRecovery)
				{
					return false;
				}
			}
			return ((SkillDef)this).CanExecute(slot);
		}
	}
	public class LionCombo : BaseSkillState
	{
		public int step;

		private float speed;

		private float duration;

		private float start;

		private float end;

		private float chainTime;

		private bool queued;

		private bool finished;

		private SasukeVisual visual;

		private Transform limb;

		private readonly HashSet<HealthComponent> victims = new HashSet<HealthComponent>();

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			speed = Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
			bool flag = Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded;
			duration = ((step == 0) ? 1f : ((step == 1) ? 1.2f : (flag ? 1.4f : 1.6f))) / speed;
			start = ((step < 2) ? 13f : (flag ? 28f : 32f)) / 30f / speed;
			end = ((step == 0) ? 16f : ((step == 1) ? 18f : (flag ? 32f : 36f))) / 30f / speed;
			chainTime = ((step == 0) ? SasukeTuning.PunchChain.Value : ((step == 1) ? SasukeTuning.KickChain.Value : 999f)) / speed;
			visual = SasukeVisual.Find(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)visual))
			{
				visual.Play((step == 0) ? "LionsBarrage_01_Punch" : ((step == 1) ? "LionsBarrage_02_RisingKick" : (flag ? "LionsBarrage_03_Heel_Air" : "LionsBarrage_03_Heel_Ground")), speed, duration, restart: true);
				limb = visual.Bone((step == 0) ? "hand.L" : "foot.R");
			}
			((EntityState)this).characterBody.SetAimTimer(duration + 1f);
		}

		public override void FixedUpdate()
		{
			//IL_00a3: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > start && ((EntityState)this).inputBank.skill1.down)
			{
				queued = true;
			}
			if (((EntityState)this).fixedAge >= start && ((EntityState)this).fixedAge - Time.fixedDeltaTime <= end)
			{
				SasukeCombat.Hit(((EntityState)this).characterBody, Object.op_Implicit((Object)(object)limb) ? limb.position : (((EntityState)this).characterBody.corePosition + ((EntityState)this).inputBank.aimDirection * 1.4f), SasukeTuning.MeleeRadius.Value, (step == 0) ? SasukeTuning.Punch.Value : ((step == 1) ? SasukeTuning.Kick.Value : SasukeTuning.Heel.Value), SasukeTuning.MeleeProc.Value, victims);
			}
			if (((EntityState)this).isAuthority && (((EntityState)this).fixedAge >= duration || (queued && step < 2 && ((EntityState)this).fixedAge >= Mathf.Max(chainTime, end))))
			{
				finished = true;
				if (queued && step < 2)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new LionCombo
					{
						step = step + 1
					});
				}
				else
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

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

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)visual))
			{
				visual.lockUntil = 0f;
			}
			((EntityState)this).OnExit();
		}

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

		public override void OnDeserialize(NetworkReader r)
		{
			((BaseSkillState)this).OnDeserialize(r);
			step = r.ReadInt32();
		}
	}
	public class SasukeCurseTimer : NetworkBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_UpdateIcon <>9__2_0;

			internal void <Init>b__2_0(orig_UpdateIcon orig, BuffIcon self)
			{
				orig.Invoke(self);
				if ((Object)(object)self.buffDef == (Object)(object)SasukeKit.curse && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<SasukeBuffCountdown>()))
				{
					((Component)self).gameObject.AddComponent<SasukeBuffCountdown>();
				}
			}
		}

		private CharacterBody body;

		private float serverEnd;

		public float Remaining
		{
			get
			{
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)body) || !body.HasBuff(SasukeKit.curse))
				{
					return 0f;
				}
				if (NetworkServer.active)
				{
					return Actual();
				}
				return Mathf.Max(0f, serverEnd - ((NetworkManagerSystem)NetworkManager.singleton).serverFixedTime);
			}
		}

		public static void Init()
		{
			//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: Expected O, but got Unknown
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				hook_UpdateIcon val = delegate(orig_UpdateIcon orig, BuffIcon self)
				{
					orig.Invoke(self);
					if ((Object)(object)self.buffDef == (Object)(object)SasukeKit.curse && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<SasukeBuffCountdown>()))
					{
						((Component)self).gameObject.AddComponent<SasukeBuffCountdown>();
					}
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			BuffIcon.UpdateIcon += (hook_UpdateIcon)obj;
		}

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private float Actual()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			if (Object.op_Implicit((Object)(object)body) && body.HasBuff(SasukeKit.curse))
			{
				foreach (TimedBuff timedBuff in body.timedBuffs)
				{
					if (timedBuff.buffIndex == SasukeKit.curse.buffIndex)
					{
						num = Mathf.Max(num, timedBuff.timer);
					}
				}
			}
			return num;
		}

		private void FixedUpdate()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				float num = Actual();
				float num2 = ((num > 0f) ? (((NetworkManagerSystem)NetworkManager.singleton).serverFixedTime + num) : 0f);
				if (Mathf.Abs(num2 - serverEnd) > 0.05f)
				{
					serverEnd = num2;
					((NetworkBehaviour)this).SetDirtyBit(1u);
				}
			}
		}

		public override bool OnSerialize(NetworkWriter writer, bool initialState)
		{
			writer.Write(serverEnd);
			return true;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			serverEnd = reader.ReadSingle();
		}
	}
	public class SasukeBuffCountdown : MonoBehaviour
	{
		private BuffIcon icon;

		private TextMeshProUGUI label;

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			icon = ((Component)this).GetComponent<BuffIcon>();
			GameObject val = new GameObject("Curse remaining seconds", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)this).transform, false);
			label = val.AddComponent<TextMeshProUGUI>();
			if (Object.op_Implicit((Object)(object)icon.stackCount))
			{
				((TMP_Text)label).font = ((TMP_Text)icon.stackCount).font;
			}
			((TMP_Text)label).fontSize = 15f;
			((TMP_Text)label).fontStyle = (FontStyles)1;
			((TMP_Text)label).alignment = (TextAlignmentOptions)1028;
			((Graphic)label).color = Color.white;
			((TMP_Text)label).outlineWidth = 0.2f;
			((TMP_Text)label).outlineColor = Color32.op_Implicit(Color.black);
			((Graphic)label).raycastTarget = false;
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = new Vector2(3f, 1f);
		}

		private void LateUpdate()
		{
			BuffDisplay componentInParent = ((Component)this).GetComponentInParent<BuffDisplay>();
			CharacterBody val = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.source : null);
			SasukeCurseTimer sasukeCurseTimer = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<SasukeCurseTimer>() : null);
			float num = (Object.op_Implicit((Object)(object)sasukeCurseTimer) ? sasukeCurseTimer.Remaining : 0f);
			bool flag = Object.op_Implicit((Object)(object)icon) && (Object)(object)icon.buffDef == (Object)(object)SasukeKit.curse && num > 0f;
			((Behaviour)label).enabled = flag;
			if (flag)
			{
				((TMP_Text)label).text = Mathf.CeilToInt(num).ToString();
			}
		}
	}
	public class SasukeDisplaySkin : MonoBehaviour
	{
		private static readonly FieldInfo LoadoutField = typeof(SurvivorMannequinSlotController).GetField("currentLoadout", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private SurvivorMannequinSlotController slot;

		private Transform blue;

		private Transform black;

		private void LateUpdate()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)slot))
			{
				slot = ((Component)this).GetComponentInParent<SurvivorMannequinSlotController>();
			}
			if (Object.op_Implicit((Object)(object)slot) && !(LoadoutField == null))
			{
				object? value = LoadoutField.GetValue(slot);
				Loadout val = (Loadout)((value is Loadout) ? value : null);
				if (val != null)
				{
					Apply(val.bodyLoadoutManager.GetSkinIndex(BodyCatalog.FindBodyIndex("YoungSasukeBody")));
				}
			}
		}

		public void Apply(uint index)
		{
			if (!Object.op_Implicit((Object)(object)blue))
			{
				blue = ((Component)this).transform.Find("OriginalCostume");
			}
			if (!Object.op_Implicit((Object)(object)black))
			{
				black = ((Component)this).transform.Find("ChuninCostume");
			}
			if (Object.op_Implicit((Object)(object)blue) && Object.op_Implicit((Object)(object)black))
			{
				bool flag = index == 1;
				if (((Component)blue).gameObject.activeSelf == flag)
				{
					((Component)blue).gameObject.SetActive(!flag);
				}
				if (((Component)black).gameObject.activeSelf != flag)
				{
					((Component)black).gameObject.SetActive(flag);
				}
			}
		}
	}
	public class SasukeEffects : MonoBehaviour
	{
		private static Texture2D eyeTexture;

		private static Texture2D[] reveals;

		private static Material glow;

		private static Material transparent;

		private static Material blueGlow;

		private static Material purpleGlow;

		private static bool prepared;

		private CharacterBody body;

		private SasukeVisual visual;

		private Transform hand;

		private GameObject core;

		private GameObject eye;

		private Light light;

		private Material eyeMaterial;

		private readonly List<LineRenderer> arcs = new List<LineRenderer>();

		private readonly List<SkinnedMeshRenderer> marks = new List<SkinnedMeshRenderer>();

		private readonly List<ParticleSystem> dust = new List<ParticleSystem>();

		private Material markMaterial;

		private float charge;

		private float until;

		private float nextArc;

		private float nextDust;

		private float buffStart;

		private float eyeStart = -99f;

		private int revealIndex = -1;

		private int dustIndex;

		private bool wasBuff;

		private bool full;

		private bool ready;

		public int DustPuffs { get; private set; }

		public double LastActivationMilliseconds { get; private set; }

		public int MarkCount => marks.Count;

		public static Shader Find(params string[] names)
		{
			foreach (string text in names)
			{
				try
				{
					Shader val = Shader.Find(text);
					if (Object.op_Implicit((Object)(object)val))
					{
						return val;
					}
				}
				catch
				{
				}
			}
			return Shader.Find("Hopoo Games/Deferred/Standard");
		}

		public static Material Glow(Color color)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_001b: 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)
			Material val = new Material(Find("Hopoo Games/Deferred/Standard"));
			val.color = color;
			val.SetColor("_EmColor", color);
			val.SetFloat("_EmPower", 2f);
			val.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture);
			return val;
		}

		public static Material Transparent()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Find("Hopoo Games/FX/Cloud Remap"));
			val.SetColor("_TintColor", Color.white);
			val.SetInt("_SrcBlend", 5);
			val.SetInt("_DstBlend", 10);
			val.SetInt("_ZWrite", 0);
			val.SetInt("_Cull", 0);
			val.SetFloat("_AlphaBoost", 1f);
			val.SetFloat("_AlphaBias", 0f);
			val.SetFloat("_Boost", 1f);
			val.SetFloat("_InvFade", 0f);
			val.SetInt("_ZTest", 4);
			val.EnableKeyword("DISABLEREMAP");
			val.DisableKeyword("USE_CLOUDS");
			val.DisableKeyword("CALCTEXTUREALPHA");
			val.renderQueue = 3001;
			return val;
		}

		public static void PrepareAssets()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			if (prepared)
			{
				return;
			}
			Stopwatch stopwatch = Stopwatch.StartNew();
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(SasukeVisual.Assets, "Sharingan.png")));
			eyeTexture = new Texture2D(256, 256, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[65536];
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					Color pixelBilinear = val.GetPixelBilinear((float)j / 255f, (float)i / 255f);
					float num = ((float)j - 127.5f) / 119.5f;
					float num2 = ((float)i - 127.5f) / 119.5f;
					pixelBilinear.a = ((!(num * num + num2 * num2 > 1f)) ? 1 : 0);
					array[i * 256 + j] = pixelBilinear;
				}
			}
			eyeTexture.SetPixels(array);
			eyeTexture.Apply();
			Object.Destroy((Object)(object)val);
			val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(SasukeVisual.Assets, "Curse.jpg")));
			Color[] array2 = (Color[])(object)new Color[32768];
			for (int k = 0; k < 256; k++)
			{
				for (int l = 0; l < 128; l++)
				{
					Color pixelBilinear2 = val.GetPixelBilinear(0.12f + (float)l / 128f * 0.76f, 0.12f + (float)k / 256f * 0.76f);
					float num3 = 1f - Mathf.Clamp01((((Color)(ref pixelBilinear2)).grayscale - 0.12f) / 0.65f);
					array2[k * 128 + l] = new Color(0.85f, 0.28f, 1f, num3);
				}
			}
			Object.Destroy((Object)(object)val);
			reveals = (Texture2D[])(object)new Texture2D[17];
			for (int m = 0; m < 17; m++)
			{
				Color[] array3 = (Color[])array2.Clone();
				for (int n = 0; n < 256; n++)
				{
					for (int num4 = 0; num4 < 128; num4++)
					{
						array3[n * 128 + num4].a *= Mathf.Clamp01(((float)m / 16f * 1.08f - (1f - (float)n / 256f)) / 0.08f);
					}
				}
				Texture2D val2 = new Texture2D(128, 256, (TextureFormat)4, false);
				((Texture)val2).wrapMode = (TextureWrapMode)1;
				val2.SetPixels(array3);
				val2.Apply(false, true);
				reveals[m] = val2;
			}
			glow = Glow(Color.white);
			blueGlow = Glow(new Color(0.2f, 0.65f, 1f));
			purpleGlow = Glow(new Color(0.75f, 0.15f, 1f));
			transparent = Transparent();
			Texture2D val3 = new Texture2D(32, 32, (TextureFormat)4, false);
			Color[] array4 = (Color[])(object)new Color[1024];
			for (int num5 = 0; num5 < 32; num5++)
			{
				for (int num6 = 0; num6 < 32; num6++)
				{
					float num7 = ((float)num6 - 15.5f) / 15.5f;
					float num8 = ((float)num5 - 15.5f) / 15.5f;
					float num9 = Mathf.Clamp01(1f - num7 * num7 - num8 * num8);
					array4[num5 * 32 + num6] = new Color(1f, 1f, 1f, num9 * num9);
				}
			}
			val3.SetPixels(array4);
			val3.Apply(false, true);
			transparent.mainTexture = (Texture)(object)val3;
			prepared = true;
			Log.Info("FX_PREPARE_STATIC_MS=" + stopwatch.Elapsed.TotalMilliseconds.ToString("F2"));
		}

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			PrepareAssets();
			PrepareBody();
		}

		public void PrepareBody()
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_018c: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Expected O, but got Unknown
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Expected O, but got Unknown
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			if (ready)
			{
				return;
			}
			visual = SasukeVisual.Find(body);
			if (!Object.op_Implicit((Object)(object)visual))
			{
				return;
			}
			Stopwatch stopwatch = Stopwatch.StartNew();
			hand = visual.Bone("hand.L");
			core = GameObject.CreatePrimitive((PrimitiveType)0);
			Object.Destroy((Object)(object)core.GetComponent<Collider>());
			((Object)core).name = "Chidori pooled core";
			core.transform.SetParent(((Component)this).transform);
			core.GetComponent<Renderer>().sharedMaterial = glow;
			light = core.AddComponent<Light>();
			for (int i = 0; i < 12; i++)
			{
				GameObject val = new GameObject("Chidori branch");
				val.transform.SetParent(core.transform);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				((Renderer)val2).sharedMaterial = glow;
				val2.positionCount = 7;
				val2.useWorldSpace = true;
				arcs.Add(val2);
			}
			core.SetActive(false);
			eye = GameObject.CreatePrimitive((PrimitiveType)5);
			Object.Destroy((Object)(object)eye.GetComponent<Collider>());
			((Object)eye).name = "Sharingan pooled flash";
			eye.transform.SetParent(((Component)this).transform);
			eye.transform.localScale = Vector3.one * 2.7f;
			eyeMaterial = new Material(transparent);
			eyeMaterial.mainTexture = (Texture)(object)eyeTexture;
			eyeMaterial.SetFloat("_Boost", 1.5f);
			eye.GetComponent<Renderer>().sharedMaterial = eyeMaterial;
			eye.SetActive(false);
			markMaterial = new Material(transparent);
			markMaterial.mainTexture = (Texture)(object)reveals[0];
			markMaterial.SetFloat("_Boost", 1.8f);
			foreach (SkinnedMeshRenderer item in from r in ((Component)visual).GetComponentsInChildren<SkinnedMeshRenderer>(true)
				where ((Object)r).name.Contains("shirt and sleeves") || ((Object)r).name.StartsWith("Arm ")
				select r)
			{
				bool flag = ((Object)item).name.StartsWith("Arm ");
				Mesh val3 = Object.Instantiate<Mesh>(item.sharedMesh);
				Vector3[] vertices = val3.vertices;
				Vector3[] normals = val3.normals;
				Vector2[] array = (Vector2[])(object)new Vector2[vertices.Length];
				int[] triangles = val3.triangles;
				List<int> list = new List<int>();
				for (int num = 0; num < triangles.Length / 2; num += 3)
				{
					Vector3 val4 = (vertices[triangles[num]] + vertices[triangles[num + 1]] + vertices[triangles[num + 2]]) / 3f;
					Vector3 val5 = (normals[triangles[num]] + normals[triangles[num + 1]] + normals[triangles[num + 2]]) / 3f;
					if ((flag ? (val4.y > 0.57f) : (val4.y > 0.81f)) && (flag || val4.z < -0.015f) && (flag || val5.z < -0.1f))
					{
						list.Add(triangles[num]);
						list.Add(triangles[num + 1]);
						list.Add(triangles[num + 2]);
					}
				}
				if (list.Count == 0)
				{
					Object.Destroy((Object)(object)val3);
					continue;
				}
				for (int num2 = 0; num2 < vertices.Length; num2++)
				{
					array[num2] = new Vector2(flag ? ((vertices[num2].z + 0.09f) / 0.2f) : (vertices[num2].x / 0.58f + 0.5f), (vertices[num2].y - (flag ? 0.56f : 0.81f)) / (flag ? 0.45f : 0.27f));
					ref Vector3 reference = ref vertices[num2];
					reference += (flag ? (normals[num2] * 0.006f) : (Vector3.back * 0.006f));
				}
				val3.vertices = vertices;
				val3.uv = array;
				val3.triangles = list.ToArray();
				GameObject val6 = new GameObject("Curse cached surface");
				val6.transform.SetParent(((Component)item).transform, false);
				SkinnedMeshRenderer val7 = val6.AddComponent<SkinnedMeshRenderer>();
				val7.sharedMesh = val3;
				val7.bones = item.bones;
				val7.rootBone = item.rootBone;
				val7.updateWhenOffscreen = true;
				((Renderer)val7).sharedMaterial = markMaterial;
				((Renderer)val7).enabled = false;
				marks.Add(val7);
			}
			for (int num3 = 0; num3 < 8; num3++)
			{
				GameObject val8 = new GameObject("Pooled terrain dust");
				ParticleSystem val9 = val8.AddComponent<ParticleSystem>();
				val9.Stop();
				MainModule main = val9.main;
				((MainModule)(ref main)).loop = false;
				((MainModule)(ref main)).duration = 0.2f;
				((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.45f, 0.9f);
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.9f);
				ShapeModule shape = val9.shape;
				((ShapeModule)(ref shape)).radius = ((ShapeModule)(ref shape)).radius * 1.2f;
				((ShapeModule)(ref shape)).angle = Mathf.Min(60f, ((ShapeModule)(ref shape)).angle + 7f);
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.5f, 0.45f, 0.35f, 0.5f));
				((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
				EmissionModule emission = val9.emission;
				((EmissionModule)(ref emission)).enabled = false;
				((Renderer)((Component)val9).GetComponent<ParticleSystemRenderer>()).sharedMaterial = transparent;
				dust.Add(val9);
			}
			ready = true;
			Log.Info("FX_PREPARE_BODY_MS=" + stopwatch.Elapsed.TotalMilliseconds.ToString("F2") + " overlays=" + marks.Count);
		}

		public void SetCharge(float level, bool active)
		{
			charge = Mathf.Clamp01(level);
			until = (active ? (Time.time + 0.15f) : 0f);
		}

		public void ActivateVisual()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!ready)
			{
				return;
			}
			Stopwatch stopwatch = Stopwatch.StartNew();
			buffStart = Time.time;
			eyeStart = Time.time;
			revealIndex = -1;
			foreach (SkinnedMeshRenderer mark in marks)
			{
				((Renderer)mark).enabled = true;
			}
			eye.transform.position = body.corePosition + body.inputBank.aimDirection * 0.7f;
			eye.SetActive(true);
			((Component)body).GetComponent<SasukeAudio>()?.Sharingan();
			LastActivationMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
			Log.Info("CURSE_ACTIVATE_CPU_MS=" + LastActivationMilliseconds.ToString("F3"));
		}

		public void Reveal(float t)
		{
			if (Object.op_Implicit((Object)(object)markMaterial))
			{
				int num = Mathf.Clamp(Mathf.RoundToInt(t * 16f), 0, 16);
				if (num != revealIndex)
				{
					markMaterial.mainTexture = (Texture)(object)reveals[num];
					revealIndex = num;
				}
			}
		}

		private void Update()
		{
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
			{
				Deactivate();
				return;
			}
			if (!ready)
			{
				PrepareBody();
				if (!ready)
				{
					return;
				}
			}
			bool flag = body.HasBuff(SasukeKit.curse);
			if (flag && !wasBuff)
			{
				ActivateVisual();
			}
			if (!flag && wasBuff)
			{
				foreach (SkinnedMeshRenderer mark in marks)
				{
					((Renderer)mark).enabled = false;
				}
				eye.SetActive(false);
			}
			wasBuff = flag;
			if (flag)
			{
				Reveal(Mathf.Clamp01((Time.time - buffStart) / SasukeTuning.CurseReveal.Value));
			}
			if (eye.activeSelf)
			{
				float num = Time.time - eyeStart;
				eyeMaterial.SetColor("_TintColor", new Color(1f, 1f, 1f, (num < 0.22f) ? 1f : Mathf.Clamp01(1f - (num - 0.22f) / 0.65f)));
				if (Object.op_Implicit((Object)(object)Camera.main))
				{
					eye.transform.rotation = ((Component)Camera.main).transform.rotation;
				}
				if (num > 0.87f)
				{
					eye.SetActive(false);
				}
			}
			bool flag2 = Time.time < until && Object.op_Implicit((Object)(object)hand);
			core.SetActive(flag2);
			if (!flag2)
			{
				full = false;
				return;
			}
			core.transform.position = hand.position;
			core.transform.localScale = Vector3.one * Mathf.Lerp(0.13f, 0.25f, charge);
			Color val = (flag ? new Color(0.75f, 0.15f, 1f) : new Color(0.2f, 0.65f, 1f));
			light.color = val;
			light.intensity = 2f + charge * 4f;
			light.range = 3f + charge * 3f;
			if (charge >= 0.999f && !full)
			{
				full = true;
				Util.PlaySound("Play_mage_m2_charge", ((Component)this).gameObject);
				light.intensity = 8f;
			}
			if (Time.time >= nextArc)
			{
				nextArc = Time.time + 0.045f;
				for (int i = 0; i < arcs.Count; i++)
				{
					LineRenderer val2 = arcs[i];
					((Renderer)val2).sharedMaterial = ((i % 3 == 0) ? glow : (flag ? purpleGlow : blueGlow));
					((Renderer)val2).enabled = i < 4 + Mathf.RoundToInt(charge * 8f);
					val2.startColor = Color.Lerp(val, Color.white, (i % 3 == 0) ? 0.7f : 0.1f);
					val2.endColor = val;
					val2.startWidth = 0.015f + charge * 0.03f;
					val2.endWidth = 0.002f;
					Vector3 position = hand.position;
					float num2 = Mathf.Lerp(0.4f, SasukeTuning.LightningReach.Value, charge);
					if (charge > 0.98f && i % 4 == 0)
					{
						num2 *= 1.45f;
					}
					Vector3 val3 = position + Random.onUnitSphere * num2 * Random.Range(0.45f, 1f);
					if (i >= 8)
					{
						position = arcs[i - 8].GetPosition(3);
					}
					for (int j = 0; j < 7; j++)
					{
						val2.SetPosition(j, Vector3.Lerp(position, val3, (float)j / 6f) + ((j == 0) ? Vector3.zero : (Random.insideUnitSphere * 0.14f)));
					}
				}
			}
			if (charge >= 0.999f && body.HasBuff(SasukeKit.carry) && body.characterMotor.isGrounded && ((Vector3)(ref body.characterMotor.velocity)).sqrMagnitude > 1f && Time.time > nextDust)
			{
				nextDust = Time.time + Mathf.Clamp(1.8f / ((Vector3)(ref body.characterMotor.velocity)).magnitude, 0.035f, 0.16f);
				RaycastHit val4 = default(RaycastHit);
				if (Physics.Raycast(hand.position + Vector3.up * 0.1f, Vector3.down, ref val4, SasukeTuning.DustDistance.Value, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) || Physics.Raycast(body.footPosition + Vector3.up * 0.35f, Vector3.down, ref val4, 0.65f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					ParticleSystem val5 = dust[dustIndex++ % dust.Count];
					((Component)val5).transform.position = ((RaycastHit)(ref val4)).point + ((RaycastHit)(ref val4)).normal * 0.03f;
					val5.Play();
					val5.Emit(5);
					DustPuffs++;
				}
			}
		}

		public void SaveDiagnosticMask()
		{
		}

		private void Deactivate()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			until = 0f;
			if (Object.op_Implicit((Object)(object)core))
			{
				core.SetActive(false);
			}
			if (Object.op_Implicit((Object)(object)eye))
			{
				eye.SetActive(false);
			}
			foreach (SkinnedMeshRenderer mark in marks)
			{
				if (Object.op_Implicit((Object)(object)mark))
				{
					((Renderer)mark).enabled = false;
				}
			}
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive && NetworkServer.active)
			{
				body.ClearTimedBuffs(SasukeKit.curse);
				body.SetBuffCount(SasukeKit.carry.buffIndex, 0);
			}
		}

		private void OnDestroy()
		{
			Deactivate();
			if (Object.op_Implicit((Object)(object)core))
			{
				Object.Destroy((Object)(object)core);
			}
			if (Object.op_Implicit((Object)(object)eye))
			{
				Object.Destroy((Object)(object)eye);
			}
			foreach (SkinnedMeshRenderer mark in marks)
			{
				if (Object.op_Implicit((Object)(object)mark))
				{
					Object.Destroy((Object)(object)mark.sharedMesh);
					Object.Destroy((Object)(object)((Component)mark).gameObject);
				}
			}
			if (Object.op_Implicit((Object)(object)markMaterial))
			{
				Object.Destroy((Object)(object)markMaterial);
			}
			if (Object.op_Implicit((Object)(object)eyeMaterial))
			{
				Object.Destroy((Object)(object)eyeMaterial);
			}
			foreach (ParticleSystem item in dust)
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}
		}
	}
	public static class SasukeHeadTest
	{
		private static string prefix;

		public static void Init()
		{
			string path = Path.Combine(SasukeVisual.Assets, "RUN_HEAD_TEST");
			if (File.Exists(path))
			{
				prefix = File.ReadAllText(path).Trim();
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
				{
					((MonoBehaviour)HenryPlugin.instance).StartCoroutine(Run());
				});
			}
		}

		private static IEnumerator Run()
		{
			yield return (object)new WaitForSeconds(12f);
			if (!LocalUserManager.isAnyUserSignedIn)
			{
				typeof(UserProfile).GetMethod("LoadDefaultProfile", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Invoke(null, null);
				UserProfile original = (UserProfile)typeof(UserProfile).GetField("defaultProfile", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null);
				UserProfile guest = (UserProfile)Activator.CreateInstance(typeof(UserProfile), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new object[1] { original }, null);
				guest.canSave = false;
				guest.name = "Head review guest";
				LocalUserManager.AddMainUser(guest);
			}
			Console.instance.SubmitCmd((NetworkUser)null, "host 1", false);
			for (int i = 0; i < 60; i++)
			{
				if (Object.op_Implicit((Object)(object)PreGameController.instance))
				{
					break;
				}
				yield return (object)new WaitForSeconds(1f);
			}
			if (!Object.op_Implicit((Object)(object)PreGameController.instance))
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(3f);
			NetworkUser[] array = Object.FindObjectsOfType<NetworkUser>();
			foreach (NetworkUser user in array)
			{
				if (((NetworkBehaviour)user).isLocalPlayer)
				{
					user.SetBodyPreference(BodyCatalog.FindBodyIndex("YoungSasukeBody"));
				}
			}
			yield return (object)new WaitForSeconds(1f);
			PreGameController.instance.StartRun();
			for (int k = 0; k < 60; k++)
			{
				if (Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance))
				{
					break;
				}
				yield return (object)new WaitForSeconds(1f);
			}
			yield return (object)new WaitForSeconds(5f);
			List<NodeIndex> nodes = SceneInfo.instance.groundNodes.GetActiveNodesForHullMask((HullMask)1);
			Vector3 point = default(Vector3);
			SceneInfo.instance.groundNodes.GetNodePosition(nodes[nodes.Count / 2], ref point);
			point += Vector3.up * 2f;
			CharacterMaster master = Object.Instantiate<GameObject>(MasterCatalog.FindMasterPrefab("YoungSasukeMonsterMaster")).GetComponent<CharacterMaster>();
			master.teamIndex = (TeamIndex)1;
			NetworkServer.Spawn(((Component)master).gameObject);
			BaseAI[] components = ((Component)master).GetComponents<BaseAI>();
			foreach (BaseAI ai in components)
			{
				((Behaviour)ai).enabled = false;
			}
			EntityStateMachine[] components2 = ((Component)master).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine sm in components2)
			{
				((Behaviour)sm).enabled = false;
			}
			CharacterBody b = master.SpawnBody(point, Quaternion.identity);
			yield return (object)new WaitForSeconds(12f);
			b.baseMaxHealth = 100000f;
			b.RecalculateStats();
			b.healthComponent.health = 100000f;
			SasukeVisual v = SasukeVisual.Find(b);
			EntityStateMachine[] components3 = ((Component)b).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine sm2 in components3)
			{
				((Behaviour)sm2).enabled = false;
			}
			((Behaviour)b.characterMotor).enabled = false;
			((Behaviour)v).enabled = false;
			string[] array2 = new string[2] { "Before", "After" };
			for (int num = 0; num < array2.Length; num++)
			{
				string version = (prefix = array2[num]);
				GameObject model = ((Component)((Component)v).transform.parent).gameObject;
				Object.DestroyImmediate((Object)(object)((Component)v).gameObject);
				BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic;
				string[] array3 = new string[2] { "Original", "Chunin" };
				foreach (string costume in array3)
				{
					object data = typeof(SasukeVisual).GetMethod("ReadModel", flags).Invoke(null, new object[1] { ((version == "Before") ? "Baseline-" : "") + costume + ".json" });
					typeof(SasukeVisual).GetField(costume.ToLower(), flags).SetValue(null, data);
				}
				((IDictionary)typeof(SasukeVisual).GetField("clips", flags).GetValue(null)).Clear();
				v = SasukeVisual.Build(model);
				yield return null;
				((Behaviour)v).enabled = false;
				int[] array4 = new int[2] { 0, 1 };
				for (int num3 = 0; num3 < array4.Length; num3++)
				{
					int skin = array4[num3];
					((Component)((Component)v).transform.Find("OriginalCostume")).gameObject.SetActive(skin == 0);
					((Component)((Component)v).transform.Find("ChuninCostume")).gameObject.SetActive(skin == 1);
					string[] array5 = new string[6] { "Selection_Idle", "Ninja_Run", "HandSigns", "Combat_Idle", "Fireball_Cast", "Chidori_ChargedRun" };
					foreach (string clip in array5)
					{
						v.player.Stop();
						v.player.Play(clip, (PlayMode)4);
						v.player[clip].weight = 1f;
						v.player[clip].time = ((clip == "Fireball_Cast") ? 1.3333334f : ((clip == "HandSigns") ? 0.6f : 0.2f));
						v.player[clip].speed = 0f;
						v.player.Sample();
						yield return null;
						string[] array6 = new string[3] { "Front", "Side", "ThreeQuarter" };
						foreach (string view in array6)
						{
							Capture(v, skin + "_" + clip + "_" + view, full: false);
						}
						if (clip == "Selection_Idle")
						{
							Capture(v, skin + "_Full", full: true);
							Capture(v, skin + "_Hair_Rear", full: false);
						}
					}
					string[] array7 = new string[3] { "Fireball_Cast", "Chidori_ChargedRun", "Chidori_HoldToRun" };
					foreach (string clip2 in array7)
					{
						v.player.Stop();
						v.player.Play(clip2, (PlayMode)4);
						v.player[clip2].weight = 1f;
						v.player[clip2].speed = 0f;
						int count = ((clip2 == "Fireball_Cast") ? 55 : ((clip2 == "Chidori_HoldToRun") ? 10 : 25));
						for (int f = 0; f < count; f++)
						{
							v.player[clip2].time = (float)f / 30f;
							v.player.Sample();
							yield return null;
							Capture(v, "Motion_" + skin + "_" + clip2 + "_" + f.ToString("D3"), full: false);
							if (clip2 == "Chidori_ChargedRun")
							{
								Capture(v, "MotionSide_" + skin + "_" + clip2 + "_" + f.ToString("D3") + "_Side", full: false);
							}
						}
					}
				}
			}
			Log.Info("HEAD_REVIEW_DONE " + prefix);
		}

		private static IEnumerator ActualCasts()
		{
			NetworkUser user = ((IEnumerable<NetworkUser>)Object.FindObjectsOfType<NetworkUser>()).FirstOrDefault((Func<NetworkUser, bool>)((NetworkUser x) => ((NetworkBehaviour)x).isLocalPlayer));
			CharacterBody b = ((Object.op_Implicit((Object)(object)user) && Object.op_Implicit((Object)(object)user.master)) ? user.master.GetBody() : null);
			if (!Object.op_Implicit((Object)(object)b))
			{
				Log.Info("HEAD_CAST_UNAVAILABLE no local body");
				yield break;
			}
			VehicleSeat seat = ((IEnumerable<VehicleSeat>)Object.FindObjectsOfType<VehicleSeat>()).FirstOrDefault((Func<VehicleSeat, bool>)((VehicleSeat x) => (Object)(object)x.currentPassengerBody == (Object)(object)b));
			if (Object.op_Implicit((Object)(object)seat))
			{
				seat.EjectPassenger();
				yield return (object)new WaitForSeconds(3f);
			}
			Log.Info("HEAD_CAST_BODY " + ((Object)b).name + " player=" + b.isPlayerControlled + " inVehicle=" + Object.FindObjectsOfType<VehicleSeat>().Any((VehicleSeat x) => (Object)(object)x.currentPassengerBody == (Object)(object)b));
			EntityStateMachine weapon = ((IEnumerable<EntityStateMachine>)((Component)b).GetComponents<EntityStateMachine>()).FirstOrDefault((Func<EntityStateMachine, bool>)((EntityStateMachine x) => x.customName == "Weapon"));
			if (!Object.op_Implicit((Object)(object)weapon))
			{
				yield break;
			}
			b.baseMaxHealth = 100000f;
			b.RecalculateStats();
			b.healthComponent.health = 100000f;
			bool[] array = new bool[2] { false, true };
			foreach (bool combat in array)
			{
				string label = (combat ? "Cast-WithCombatCues" : "Cast-Quiet");
				Log.Info("HEAD_ACTUAL_CAPTURE " + label + " " + ((object)AkSoundEngine.StartOutputCapture(Path.Combine(SasukeVisual.Assets, label + ".wav"))/*cast due to .constrained prefix*/).ToString());
				weapon.SetNextState((EntityState)(object)new Fireball());
				yield return (object)new WaitForSeconds(0.4f);
				if (combat)
				{
					Util.PlaySound("Play_commando_M1", ((Component)b).gameObject);
				}
				yield return (object)new WaitForSeconds(1f);
				ScreenCapture.CaptureScreenshot(Path.Combine(SasukeVisual.Assets, label + "-Gameplay.png"));
				if (combat)
				{
					Util.PlaySound("Play_mage_m2_impact", ((Component)b).gameObject);
				}
				yield return (object)new WaitForSeconds(2.3f);
				Log.Info("HEAD_ACTUAL_STOP " + ((object)AkSoundEngine.StopOutputCapture()/*cast due to .constrained prefix*/).ToString());
				yield return (object)new WaitForSeconds(1f);
			}
		}

		private static IEnumerator AudioProbe()
		{
			Log.Info("HEAD_AUDIO_NETWORK client=" + NetworkClient.active + " server=" + NetworkServer.active);
			GameObject go = new GameObject("Fireball diagnostic source");
			AkAudioListener listener = Object.FindObjectOfType<AkAudioListener>();
			if (Object.op_Implicit((Object)(object)listener))
			{
				go.transform.position = ((Component)listener).transform.position;
			}
			go.AddComponent<AkGameObj>();
			if (!Object.op_Implicit((Object)(object)listener))
			{
				go.AddComponent<AkAudioListener>();
			}
			bool[] array = new bool[2] { false, true };
			foreach (bool combat in array)
			{
				string label = (combat ? "SimulatedCombat" : "QuietStage");
				Log.Info("HEAD_AUDIO_CAPTURE " + label + " " + ((object)AkSoundEngine.StartOutputCapture(Path.Combine(SasukeVisual.Assets, "Fireball-" + label + ".wav"))/*cast due to .constrained prefix*/).ToString());
				AkSoundEngine.SetRTPCValue("YS04_FirePitch", 0f, go);
				uint id = AkSoundEngine.PostEvent("Play_YS04_fire_prep_local", go);
				Log.Info("HEAD_AUDIO_PREP " + id);
				if (combat)
				{
					Util.PlaySound("Play_commando_M1", go);
				}
				yield return (object)new WaitForSeconds(1.3333334f);
				AkSoundEngine.StopPlayingID(id, 20);
				Log.Info("HEAD_AUDIO_RELEASE " + AkSoundEngine.PostEvent("Play_YS04_fire_release_local", go));
				if (combat)
				{
					Util.PlaySound("Play_mage_m2_impact", go);
				}
				yield return (object)new WaitForSeconds(2.3f);
				Log.Info("HEAD_AUDIO_STOP " + ((object)AkSoundEngine.StopOutputCapture()/*cast due to .constrained prefix*/).ToString());
				yield return (object)new WaitForSeconds(0.4f);
			}
			Object.Destroy((Object)(object)go);
		}

		private static void Capture(SasukeVisual v, string name, bool full)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Expected O, but got Unknown
			//IL_02d2: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			CharacterModel componentInParent = ((Component)v).GetComponentInParent<CharacterModel>();
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			GameObject val = new GameObject("Observer");
			val.SetActive(false);
			CameraRigController val2 = val.AddComponent<CameraRigController>();
			typeof(CameraRigController).GetField("<targetTeamIndex>k__BackingField", bindingAttr).SetValue(val2, (object)(TeamIndex)1);
			typeof(CharacterModel).GetField("disableFade", bindingAttr).SetValue(componentInParent, true);
			typeof(CharacterModel).GetMethod("UpdateForCamera", bindingAttr).Invoke(componentInParent, new object[1] { val2 });
			Object.Destroy((Object)(object)val);
			Transform value = v.Bone("head");
			SkinnedMeshRenderer val3 = ((Component)v).GetComponentsInChildren<SkinnedMeshRenderer>().First((SkinnedMeshRenderer r) => ((Object)r).name.StartsWith("Face"));
			int num = Array.IndexOf(v.bones, value);
			Vector3 val4 = (full ? v.body.corePosition : (v.Bone("neck").position + ((Component)v).transform.up * 0.2f));
			Camera val5 = new GameObject("Head review camera").AddComponent<Camera>();
			val5.renderingPath = (RenderingPath)3;
			Vector3 val6 = (full ? new Vector3(2f, 1f, 3f) : (name.EndsWith("_Side") ? new Vector3(0.98f, 0.05f, 0f) : (name.EndsWith("_Rear") ? new Vector3(0f, 0.05f, -0.98f) : (name.EndsWith("_Front") ? new Vector3(0f, 0.05f, 0.98f) : new Vector3(0.4f, 0.05f, 0.92f)))));
			((Component)val5).transform.position = val4 + ((Component)v).transform.TransformDirection(val6);
			((Component)val5).transform.LookAt(val4);
			val5.fieldOfView = 40f;
			val5.nearClipPlane = 0.02f;
			Light val7 = new GameObject("Review fill").AddComponent<Light>();
			val7.type = (LightType)1;
			((Component)val7).transform.rotation = ((Component)val5).transform.rotation;
			((Component)val7).transform.position = ((Component)val5).transform.position;
			val7.intensity = 1.8f;
			val7.range = 6f;
			RenderTexture val8 = (val5.targetTexture = new RenderTexture(720, 720, 24));
			val5.Render();
			RenderTexture.active = val8;
			Texture2D val10 = new Texture2D(720, 720, (TextureFormat)3, false);
			val10.ReadPixels(new Rect(0f, 0f, 720f, 720f), 0, 0);
			val10.Apply();
			File.WriteAllBytes(Path.Combine(SasukeVisual.Assets, "Head_" + prefix + "_" + name + ".png"), ImageConversion.EncodeToPNG(val10));
			RenderTexture.active = null;
			Object.Destroy((Object)(object)val8);
			Object.Destroy((Object)(object)val10);
			Object.Destroy((Object)(object)((Component)val5).gameObject);
			Object.Destroy((Object)(object)((Component)val7).gameObject);
		}
	}
	public static class SasukeIcons
	{
		private static readonly Dictionary<string, Sprite> cache = new Dictionary<string, Sprite>();

		public static Sprite Get(string name)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0084: 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)
			if (cache.TryGetValue(name, out var value))
			{
				return value;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(SasukeVisual.Assets, "Icons", name + ".png")));
			((Object)val).name = "YoungSasuke_" + name;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			((Object)value).name = ((Object)val).name;
			cache[name] = value;
			return value;
		}
	}
	public static class SasukeKit
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static StatHookEventHandler <>9__4_0;

			internal void <Setup>b__4_0(CharacterBody b, StatHookEventArgs args)
			{
				if (b.HasBuff(curse))
				{
					args.damageMultAdd += SasukeTuning.CurseDamage.Value;
					args.moveSpeedMultAdd += SasukeTuning.CurseSpeed.Value;
				}
				if (b.HasBuff(carry))
				{
					args.moveSpeedMultAdd += SasukeTuning.ChidoriSpeed.Value;
				}
			}
		}

		public static BuffDef curse;

		public static BuffDef carry;

		public static GameObject fire;

		public static GameObject largeFire;

		public static void Setup(GameObject body, Sprite icon)
		{
			//IL_008c: 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_00c8: 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_00d3: Expected O, but got Unknown
			Type[] array = new Type[7]
			{
				typeof(SasukeDeath),
				typeof(Fireball),
				typeof(ChidoriCharge),
				typeof(ChidoriCarry),
				typeof(ChidoriStrike),
				typeof(ChidoriRecovery),
				typeof(CurseActivate)
			};
			foreach (Type entityState in array)
			{
				Content.AddEntityState(entityState);
			}
			curse = Content.CreateAndAddBuff("SasukeCurseMark1", SasukeIcons.Get("special"), Color.white, canStack: false, isDebuff: false);
			carry = Content.CreateAndAddBuff("SasukeChidoriCarry", icon, Color.cyan, canStack: false, isDebuff: false);
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				StatHookEventHandler val = delegate(CharacterBody b, StatHookEventArgs args)
				{
					if (b.HasBuff(curse))
					{
						args.damageMultAdd += SasukeTuning.CurseDamage.Value;
						args.moveSpeedMultAdd += SasukeTuning.CurseSpeed.Value;
					}
					if (b.HasBuff(carry))
					{
						args.moveSpeedMultAdd += SasukeTuning.ChidoriSpeed.Value;
					}
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			Add(body, (SkillSlot)1, "Fire Style: Fireball Jutsu", SasukeText.Secondary, typeof(Fireball), SasukeTuning.FireCooldown.Value, icon);
			Add(body, (SkillSlot)2, "Chidori", SasukeText.Utility, typeof(ChidoriCharge), SasukeTuning.ChidoriCooldown.Value, SasukeIcons.Get("utility"));
			Add(body, (SkillSlot)3, "Curse Mark: Sharingan", SasukeText.Special, typeof(CurseActivate), SasukeTuning.CurseCooldown.Value, SasukeIcons.Get("special"), "Weapon2");
			SasukeText.Refresh();
			SasukeEffects.PrepareAssets();
			SasukeVfx.Prepare();
			fire = Projectile(empowered: false);
			largeFire = Projectile(empowered: true);
			body.AddComponent<SasukeEffects>();
			body.AddComponent<SasukeAudio>();
			body.AddComponent<SasukeCurseTimer>();
		}

		private unsafe static void Add(GameObject b, SkillSlot slot, string name, string desc, Type state, float cooldown, Sprite icon, string machine = "Weapon")
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			//IL_00b5: 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)
			SkillDef val = (SkillDef)(object)(((int)slot == 3) ? ((SasukeAttackSkillDef)(object)ScriptableObject.CreateInstance<SkillDef>()) : ScriptableObject.CreateInstance<SasukeAttackSkillDef>());
			val.skillName = "Sasuke" + ((object)(*(SkillSlot*)(&slot))/*cast due to .constrained prefix*/).ToString();
			val.skillNameToken = val.skillName + "_NAME";
			val.skillDescriptionToken = val.skillName + "_DESC";
			val.icon = icon;
			val.activationState = new SerializableEntityStateType(state);
			val.activationStateMachineName = machine;
			val.baseMaxStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			val.rechargeStock = 1;
			val.baseRechargeInterval = cooldown;
			val.beginSkillCooldownOnSkillEnd = (int)slot == 2 && SasukeTuning.CooldownAtEnd.Value;
			val.interruptPriority = (InterruptPriority)2;
			val.mustKeyPress = true;
			val.isCombatSkill = true;
			val.cancelSprintingOnActivation = false;
			val.canceledFromSprinting = false;
			((Object)val).name = val.skillName;
			Content.AddSkillDef(val);
			LanguageAPI.Add(val.skillNameToken, name);
			LanguageAPI.Add(val.skillDescriptionToken, desc);
			Skills.AddSkillToFamily(b.GetComponent<SkillLocator>().GetSkill(slot).skillFamily, val);
		}

		private static GameObject Projectile(bool empowered)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_0109: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Asset.CloneProjectilePrefab("CommandoGrenadeProjectile", empowered ? "SasukeCurseFireball" : "SasukeFireball");
			Rigidbody component = val.GetComponent<Rigidbody>();
			component.useGravity = false;
			ProjectileSimple val2 = val.GetComponent<ProjectileSimple>() ?? val.AddComponent<ProjectileSimple>();
			val2.desiredForwardSpeed = SasukeTuning.FireSpeed.Value;
			val2.lifetime = SasukeTuning.FireLifetime.Value;
			ProjectileImpactExplosion component2 = val.GetComponent<ProjectileImpactExplosion>();
			component2.impactEffect = null;
			((ProjectileExplosion)component2).explosionEffect = SasukeVfx.fireImpact;
			((ProjectileExplosion)component2).blastRadius = SasukeTuning.FireRadius.Value * (empowered ? SasukeTuning.CurseFireRadius.Value : 1f);
			((ProjectileExplosion)component2).blastDamageCoefficient = 1f;
			((ProjectileExplosion)component2).blastProcCoefficient = 1f;
			((ProjectileExplosion)component2).blastAttackerFiltering = (AttackerFiltering)2;
			((ProjectileExplosion)component2).bonusBlastForce = Vector3.zero;
			((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
			component2.destroyOnEnemy = true;
			component2.destroyOnWorld = true;
			component2.timerAfterImpact = false;
			component2.lifetime = SasukeTuning.FireLifetime.Value;
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
			Object.DestroyImmediate((Object)(object)val3.GetComponent<Collider>());
			val3.transform.localScale = Vector3.one * 1.32f * (empowered ? SasukeTuning.CurseFireSize.Value : 1f);
			val3.GetComponent<Renderer>().material = SasukeEffects.Glow(new Color(1f, 0.8f, 0.35f));
			SasukeVfx.AddFireEnvelope(val3);
			val3.AddComponent<ProjectileGhostController>();
			Light val4 = val3.AddComponent<Light>();
			val4.color = new Color(1f, 0.3f, 0.05f);
			val4.range = 5f;
			val4.intensity = 2f;
			GameObject ghostPrefab = PrefabAPI.InstantiateClone(val3, empowered ? "CurseFireballGhost" : "FireballGhost", false);
			Object.Destroy((Object)(object)val3);
			val.GetComponent<ProjectileController>().ghostPrefab = ghostPrefab;
			typeof(ProjectileController).GetField("ghostPrefabAddress", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val.GetComponent<ProjectileController>(), null);
			Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val5 in componentsInChildren)
			{
				val5.enabled = false;
			}
			val.GetComponent<ProjectileController>().procCoefficient = SasukeTuning.FireProc.Value;
			ProjectileSingleTargetImpact component3 = val.GetComponent<ProjectileSingleTargetImpact>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				Object.DestroyImmediate((Object)(object)component3);
			}
			SphereCollider component4 = val.GetComponent<SphereCollider>();
			if (Object.op_Implicit((Object)(object)component4))
			{
				component4.radius = 0.55f * (empowered ? SasukeTuning.CurseFireSize.Value : 1f);
			}
			Content.AddProjectilePrefab(val);
			return val;
		}
	}
	public abstract class SasukeState : BaseSkillState
	{
		protected SasukeVisual visual;

		protected SasukeEffects fx;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			visual = SasukeVisual.Find(((EntityState)this).characterBody);
			fx = ((EntityState)this).GetComponent<SasukeEffects>();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (SasukeTuning.CooldownAtEnd.Value && !(this is Fireball) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility))
			{
				((EntityState)this).skillLocator.utility.rechargeStopwatch = 0f;
			}
		}

		protected void Pose(string name, float duration, float speed = 1f, bool restart = false)
		{
			if (Object.op_Implicit((Object)(object)visual))
			{
				visual.Play(name, speed, duration, restart);
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)visual))
			{
				visual.lockUntil = 0f;
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class Fireball : SasukeState
	{
		private float speed;

		private float duration;

		private bool fired;

		public override void OnExit()
		{
			((EntityState)this).GetComponent<SasukeAudio>()?.StopFire();
			base.OnExit();
		}

		public override void OnEnter()
		{
			base.OnEnter();
			speed = Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
			duration = 1.8f / speed;
			Pose("Fireball_Cast", duration, speed, restart: true);
			((EntityState)this).characterBody.SetAimTimer(duration + 1f);
			((EntityState)this).GetComponent<SasukeAudio>()?.StartFire(speed);
		}

		public override void FixedUpdate()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			if (!fired && ((EntityState)this).fixedAge >= 1.3333334f / speed)
			{
				fired = true;
				((EntityState)this).GetComponent<SasukeAudio>()?.ReleaseFire(speed);
				if (NetworkServer.active)
				{
					Ray aimRay = ((BaseState)this).GetAimRay();
					Transform val = (Object.op_Implicit((Object)(object)visual) ? visual.Bone("head") : null);
					Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? (val.position + ((Ray)(ref aimRay)).direction * 0.12f) : ((Ray)(ref aimRay)).origin);
					Vector3 val3 = val2;
					RaycastHit val4 = default(RaycastHit);
					if (Physics.Linecast(((Ray)(ref aimRay)).origin, val2, ref val4, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						val3 = ((RaycastHit)(ref val4)).point - ((Ray)(ref aimRay)).direction * 0.12f;
					}
					if (Physics.SphereCast(val3, 0.15f, ((Ray)(ref aimRay)).direction, ref val4, 0.4f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						val3 = ((RaycastHit)(ref val4)).point - ((Ray)(ref aimRay)).direction * 0.18f;
					}
					bool flag = ((EntityState)this).characterBody.HasBuff(SasukeKit.curse);
					ProjectileManager.instance.FireProjectile(flag ? SasukeKit.largeFire : SasukeKit.fire, val3, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((EntityState)this).characterBody.damage * SasukeTuning.FireDamage.Value * (flag ? SasukeTuning.CurseFireDamage.Value : 1f), 0f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
					Log.Info("Sasuke Fireball release");
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class ChidoriCharge : SasukeState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			Pose("Chidori_SignsCharge", 1.4f, 1f, restart: true);
			((EntityState)this).GetComponent<SasukeAudio>()?.BeginCharge();
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			float num = Mathf.Clamp01(((EntityState)this).fixedAge / SasukeTuning.ChargeSeconds.Value);
			if (Object.op_Implicit((Object)(object)fx))
			{
				fx.SetCharge(num, active: true);
			}
			((EntityState)this).GetComponent<SasukeAudio>()?.Sustain();
			if (((EntityState)this).fixedAge >= 1.4f)
			{
				Pose("Chidori_ChargedHold", 0.1f);
			}
			if (((EntityState)this).isAuthority && !((EntityState)this).inputBank.skill3.down)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ChidoriCarry
				{
					charge = num
				});
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)fx))
			{
				fx.SetCharge(0f, active: false);
			}
			base.OnExit();
		}
	}
	public class ChidoriCarry : SasukeState
	{
		public float charge;

		private bool released;

		private Vector3 previous;

		public override void OnEnter()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			charge = Mathf.Clamp01(charge);
			released = !((EntityState)this).inputBank.skill3.down;
			previous = ((EntityState)this).characterBody.corePosition;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(SasukeKit.carry);
			}
			Pose("Chidori_HoldToRun", 0.3f, 1f, restart: true);
		}

		public static HurtBox Sweep(CharacterBody body, Vector3 from, Vector3 to, float radius)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapCapsule(from, to, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2);
			HurtBox result = null;
			float num = float.MaxValue;
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				HurtBox component = ((Component)val).GetComponent<HurtBox>();
				if (!SasukeCombat.Enemy(component, body))
				{
					continue;
				}
				Vector3 val2 = from;
				Vector3 val3 = to - from;
				if (((Vector3)(ref val3)).sqrMagnitude > 0.0001f)
				{
					val2 += val3 * Mathf.Clamp01(Vector3.Dot(((Component)component).transform.position - from, val3) / ((Vector3)(ref val3)).sqrMagnitude);
				}
				if (!Physics.Linecast(val2, ((Component)component).transform.position, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && !Physics.Linecast(body.corePosition, ((Component)component).transform.position, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					Vector3 val4 = ((Component)component).transform.position - from;
					float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						result = component;
						num = sqrMagnitude;
					}
				}
			}
			return result;
		}

		public override void FixedUpdate()
		{
			//IL_00a6: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			if (Object.op_Implicit((Object)(object)fx))
			{
				fx.SetCharge(charge, active: true);
			}
			((EntityState)this).GetComponent<SasukeAudio>()?.Sustain();
			if (((EntityState)this).fixedAge > 0.3f)
			{
				Pose((((Vector3)(ref ((EntityState)this).characterMotor.velocity)).sqrMagnitude > 1f) ? "Chidori_ChargedRun" : "Chidori_ChargedHold", 0.1f);
			}
			if (!((EntityState)this).inputBank.skill3.down)
			{
				released = true;
			}
			Vector3 to = ((EntityState)this).characterBody.corePosition + ((EntityState)this).inputBank.aimDirection * 0.35f;
			if (((EntityState)this).isAuthority)
			{
				if (released && ((ButtonState)(ref ((EntityState)this).inputBank.skill3)).justPressed)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new ChidoriRecovery());
					return;
				}
				HurtBox val = Sweep(((EntityState)this).characterBody, previous, to, SasukeTuning.ChidoriRadius.Value);
				if (Object.op_Implicit((Object)(object)val))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new ChidoriStrike
					{
						charge = charge,
						point = ((Component)val).transform.position,
						hasPoint = true
					});
				}
			}
			previous = to;
		}

		public override void OnExit()
		{
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(SasukeKit.carry);
			}
			if (Object.op_Implicit((Object)(object)fx))
			{
				fx.SetCharge(0f, active: false);
			}
			base.OnExit();
		}

		public override void OnSerialize(NetworkWriter w)
		{
			((BaseSkillState)this).OnSerialize(w);
			w.Write(charge);
		}

		public override void OnDeserialize(NetworkReader r)
		{
			((BaseSkillState)this).OnDeserialize(r);
			charge = Mathf.Clamp01(r.ReadSingle());
		}
	}
	public class ChidoriStrike : SasukeState
	{
		public float charge;

		public Vector3 point;

		public bool hasPoint;

		private bool fired;

		private readonly HashSet<HealthComponent> seen = new HashSet<HealthComponent>();

		public static float ImpactRadius(float charge, bool curse)
		{
			return (curse && charge >= 0.999f) ? SasukeTuning.EmpoweredChidoriBlast.Value : SasukeTuning.ChidoriBlast.Value;
		}

		public static float Damage(float c)
		{
			return Mathf.Lerp(SasukeTuning.ChidoriMin.Value, SasukeTuning.ChidoriMax.Value, Mathf.Pow(Mathf.Clamp01(c), SasukeTuning.ChargePower.Value));
		}

		public override void OnEnter()
		{
			//IL_0056: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Pose("Chidori_LeftStrike", 0.8f, 1f, restart: true);
			((EntityState)this).GetComponent<SasukeAudio>()?.EndCharge();
			((EntityState)this).characterBody.SetAimTimer(1f);
			if (!hasPoint)
			{
				point = ((EntityState)this).characterBody.corePosition + ((EntityState)this).inputBank.aimDirection;
			}
		}

		public override void FixedUpdate()
		{
			//IL_0072: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			base.FixedUpdate();
			if (Object.op_Implicit((Object)(object)fx))
			{
				fx.SetCharge(charge, active: true);
			}
			if (!fired)
			{
				fired = true;
				if (NetworkServer.active)
				{
					float num = ImpactRadius(charge, ((EntityState)this).characterBody.HasBuff(SasukeKit.curse));
					SasukeCombat.Hit(((EntityState)this).characterBody, point, num, Damage(charge), SasukeTuning.ChidoriProc.Value, seen);
					EffectManager.SpawnEffect(((EntityState)this).characterBody.HasBuff(SasukeKit.curse) ? SasukeVfx.purpleImpact : SasukeVfx.blueImpact, new EffectData
					{
						origin = point,
						scale = num
					}, true);
					Log.Info("CHIDORI_IMPACT targets=" + seen.Count + " charge=" + charge + " radius=" + num);
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.8f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new ChidoriRecovery());
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)fx))
			{
				fx.SetCharge(0f, active: false);
			}
			base.OnExit();
		}

		public override void OnSerialize(NetworkWriter w)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(w);
			w.Write(charge);
			w.Write(point);
			w.Write(hasPoint);
		}

		public override void OnDeserialize(NetworkReader r)
		{
			//IL_001c: 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)
			((BaseSkillState)this).OnDeserialize(r);
			charge = Mathf.Clamp01(r.ReadSingle());
			point = r.ReadVector3();
			hasPoint = r.ReadBoolean();
		}
	}
	public class ChidoriRecovery : SasukeState
	{
		public override void OnEnter()
		{
			base.OnEnter();
			Pose("Chidori_Recovery", 0.6f, 1f, restart: true);
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.6f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public class CurseActivate : BaseSkillState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			if (NetworkServer.active && !((EntityState)this).characterBody.HasBuff(SasukeKit.curse))
			{
				((EntityState)this).characterBody.AddTimedBuff(SasukeKit.curse, SasukeTuning.CurseDuration.Value);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.15f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public class SasukeOldEffects : MonoBehaviour
	{
		private CharacterBody body;

		private SasukeVisual visual;

		private Transform hand;

		private GameObject core;

		private GameObject eye;

		private Light light;

		private readonly List<LineRenderer> arcs = new List<LineRenderer>();

		private readonly List<SkinnedMeshRenderer> marks = new List<SkinnedMeshRenderer>