Decompiled source of TobiramaSenju v0.12.0

plugins/TobiramaSenju/TobiramaSenju.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

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

public class BalanceFixture : MonoBehaviour
{
	public uint playerLevel = 1u;

	private void FixedUpdate()
	{
		if (Object.op_Implicit((Object)(object)Run.instance))
		{
			Run.instance.SetRunStopwatch(0f);
		}
		TeamManager.instance.SetTeamLevel((TeamIndex)1, playerLevel);
		TeamManager.instance.SetTeamLevel((TeamIndex)2, 1u);
	}
}
public class EnemyPin : MonoBehaviour
{
	public Vector3 position;

	private CharacterBody body;

	private void Awake()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		body = ((Component)this).GetComponent<CharacterBody>();
		position = ((Component)this).transform.position;
		Animator[] componentsInChildren = ((Component)body.modelLocator.modelTransform).GetComponentsInChildren<Animator>();
		foreach (Animator val in componentsInChildren)
		{
			val.cullingMode = (AnimatorCullingMode)0;
		}
		CharacterModel[] componentsInChildren2 = ((Component)body.modelLocator.modelTransform).GetComponentsInChildren<CharacterModel>();
		foreach (CharacterModel obj in componentsInChildren2)
		{
			typeof(CharacterModel).GetField("disableFade", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj, true);
		}
	}

	private void FixedUpdate()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.characterMotor))
		{
			((BaseCharacterController)body.characterMotor).Motor.SetPosition(position, true);
			body.characterMotor.velocity = Vector3.zero;
		}
		else
		{
			((Component)this).transform.position = position;
		}
	}
}
public static class BalancePlaytest
{
	private static int targetId;

	private static readonly List<float> losses = new List<float>();

	public static void Observe(HealthComponent h, float loss, string label)
	{
		if (((Object)h).GetInstanceID() == targetId && label.StartsWith("TAG_PULSE_"))
		{
			losses.Add(loss);
		}
	}

	public static IEnumerator Run(CharacterBody b, Visual v, AnimationProbe d, List<CharacterBody> oldTargets, Vector3 origin)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		BalanceFixture fixture = ((Component)b).gameObject.AddComponent<BalanceFixture>();
		foreach (CharacterBody target in oldTargets)
		{
			PreviewTest.SetFoot(target, origin + Vector3.right * 45f);
		}
		yield return (object)new WaitForSeconds(0.2f);
		b.RecalculateStats();
		b.baseCrit = 0f;
		string[] array = new string[3] { "Wisp", "Golem", "BeetleQueen" };
		foreach (string species in array)
		{
			bool[] array2 = new bool[2] { true, false };
			for (int j = 0; j < array2.Length; j++)
			{
				bool baseline = array2[j];
				Vector3 point = origin + Vector3.forward * 14f;
				CharacterMaster master = new MasterSummon
				{
					masterPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + species + "Master"),
					position = point + Vector3.up * ((species == "Wisp") ? 4f : 0.2f),
					rotation = Quaternion.identity,
					teamIndexOverride = (TeamIndex)2,
					ignoreTeamMemberLimit = true
				}.Perform();
				yield return (object)new WaitForSeconds(0.3f);
				CharacterBody enemy = master.GetBody();
				Transform enemyModel = enemy.modelLocator.modelTransform;
				BaseAI[] components = ((Component)master).GetComponents<BaseAI>();
				foreach (BaseAI ai in components)
				{
					((Behaviour)ai).enabled = false;
				}
				enemy.RecalculateStats();
				((Component)enemy).gameObject.AddComponent<EnemyPin>();
				PreviewTest.SetFoot(enemy, point + Vector3.up * ((species == "Wisp") ? 4f : 0.15f));
				Renderer[] componentsInChildren = ((Component)enemy.modelLocator.modelTransform).GetComponentsInChildren<Renderer>();
				foreach (Renderer r in componentsInChildren)
				{
					((Component)r).gameObject.layer = 31;
				}
				b.RecalculateStats();
				targetId = ((Object)enemy.healthComponent).GetInstanceID();
				losses.Clear();
				float hp = enemy.healthComponent.health;
				Kit.Log("BALANCE_BEGIN species=" + species + " baseline=" + baseline + " playerLevel=" + b.level + " enemyLevel=" + enemy.level + " difficulty=" + ((object)Run.instance.selectedDifficulty/*cast due to .constrained prefix*/).ToString() + " playerDamage=" + b.damage + " enemyHP=" + hp + " armor=" + enemy.armor + " itemCount=" + b.inventory.itemAcquisitionOrder.Count + " target=" + targetId);
				float previous = KitTuning.TagDamage.Value;
				KitTuning.TagDamage.Value = (baseline ? 2.971429f : 4.4571433f);
				TagSequence field = ((Component)b).gameObject.AddComponent<TagSequence>();
				field.Init(b, point);
				yield return PreviewTest.Record("Kit-Balance-" + species + (baseline ? "-Before" : "-After"), 8.6f, b, v, side: false);
				KitTuning.TagDamage.Value = previous;
				Kit.Log("BALANCE_RESULT species=" + species + " baseline=" + baseline + " pulsesHit=" + losses.Count + " losses=" + string.Join(",", losses.Select((float x) => x.ToString("F4"))) + " total=" + losses.Sum() + " alive=" + (Object.op_Implicit((Object)(object)enemy) && enemy.healthComponent.alive));
				if (Object.op_Implicit((Object)(object)enemyModel))
				{
					Object.Destroy((Object)(object)((Component)enemyModel).gameObject);
				}
				if (Object.op_Implicit((Object)(object)enemy))
				{
					NetworkServer.Destroy(((Component)enemy).gameObject);
				}
				if (Object.op_Implicit((Object)(object)master))
				{
					NetworkServer.Destroy(((Component)master).gameObject);
				}
				yield return (object)new WaitForSeconds(0.4f);
			}
		}
		fixture.playerLevel = 3u;
		yield return (object)new WaitForSeconds(0.2f);
		b.RecalculateStats();
		CharacterMaster wispMaster = new MasterSummon
		{
			masterPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/WispMaster"),
			position = origin + Vector3.forward * 14f + Vector3.up * 4f,
			rotation = Quaternion.identity,
			teamIndexOverride = (TeamIndex)2,
			ignoreTeamMemberLimit = true
		}.Perform();
		yield return (object)new WaitForSeconds(0.3f);
		CharacterBody wisp = wispMaster.GetBody();
		BaseAI[] components2 = ((Component)wispMaster).GetComponents<BaseAI>();
		foreach (BaseAI ai2 in components2)
		{
			((Behaviour)ai2).enabled = false;
		}
		((Component)wisp).gameObject.AddComponent<EnemyPin>();
		PreviewTest.SetFoot(wisp, origin + Vector3.forward * 14f + Vector3.up * 4f);
		Renderer[] componentsInChildren2 = ((Component)wisp.modelLocator.modelTransform).GetComponentsInChildren<Renderer>();
		foreach (Renderer r2 in componentsInChildren2)
		{
			((Component)r2).gameObject.layer = 31;
		}
		targetId = ((Object)wisp.healthComponent).GetInstanceID();
		losses.Clear();
		Kit.Log("WISP_LEVEL3 playerLevel=" + b.level + " enemyLevel=" + wisp.level + " playerDamage=" + b.damage + " hp=" + wisp.healthComponent.health + " difficulty=" + ((object)Run.instance.selectedDifficulty/*cast due to .constrained prefix*/).ToString());
		TagSequence sequence = ((Component)b).gameObject.AddComponent<TagSequence>();
		sequence.Init(b, origin + Vector3.forward * 14f);
		yield return PreviewTest.Record("Kit-Wisp-Level3", 2.3f, b, v, side: false);
		Kit.Log("WISP_LEVEL3_RESULT hits=" + losses.Count + " alive=" + (Object.op_Implicit((Object)(object)wisp) && wisp.healthComponent.alive));
		sequence.Cancel();
		if (Object.op_Implicit((Object)(object)wisp))
		{
			NetworkServer.Destroy(((Component)wisp).gameObject);
		}
		if (Object.op_Implicit((Object)(object)wispMaster))
		{
			NetworkServer.Destroy(((Component)wispMaster).gameObject);
		}
		fixture.playerLevel = 1u;
		yield return (object)new WaitForSeconds(0.3f);
		b.RecalculateStats();
		Object.Destroy((Object)(object)fixture);
		CharacterMaster highMaster = new MasterSummon
		{
			masterPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/WispMaster"),
			position = origin + Vector3.forward * 14f + Vector3.up * 12f,
			rotation = Quaternion.identity,
			teamIndexOverride = (TeamIndex)2,
			ignoreTeamMemberLimit = true
		}.Perform();
		yield return (object)new WaitForSeconds(0.3f);
		CharacterBody high = highMaster.GetBody();
		BaseAI[] components3 = ((Component)highMaster).GetComponents<BaseAI>();
		foreach (BaseAI ai3 in components3)
		{
			((Behaviour)ai3).enabled = false;
		}
		high.baseMaxHealth = 10000f;
		high.baseRegen = 0f;
		high.RecalculateStats();
		high.healthComponent.health = 10000f;
		((Component)high).gameObject.AddComponent<EnemyPin>();
		PreviewTest.SetFoot(high, origin + Vector3.forward * 14f + Vector3.up * 12f);
		Renderer[] componentsInChildren3 = ((Component)high.modelLocator.modelTransform).GetComponentsInChildren<Renderer>();
		foreach (Renderer r3 in componentsInChildren3)
		{
			((Component)r3).gameObject.layer = 31;
		}
		targetId = ((Object)high.healthComponent).GetInstanceID();
		losses.Clear();
		Kit.Log("VERTICAL_BEGIN coreHeight=" + (high.corePosition.y - origin.y) + " radius=" + KitTuning.TagRadius.Value + " capsuleSegment=" + KitTuning.TagHeight.Value);
		TagSequence upper = ((Component)b).gameObject.AddComponent<TagSequence>();
		upper.Init(b, origin + Vector3.forward * 14f);
		yield return PreviewTest.Record("Kit-Tandem-Vertical", 8.8f, b, v, side: false);
		Kit.Log("VERTICAL_RESULT pulsesHit=" + losses.Count + " damage=" + losses.Sum());
		NetworkServer.Destroy(((Component)high).gameObject);
		NetworkServer.Destroy(((Component)highMaster).gameObject);
		yield return (object)new WaitForSeconds(2f);
		Kit.Log("FX_CLEANUP fields=" + ((Component)b).GetComponents<TagSequence>().Length + " activeEffects=" + Object.FindObjectsOfType<TobiEffect>().Length + " waterFlights=" + Object.FindObjectsOfType<ReliableWaterFlight>().Length);
		yield return FinalPlaytest.Run(b, v, d, origin);
	}
}
public static class ContactProbe
{
	public unsafe static void Trace(CharacterBody b, Vector3 origin, Vector3 forward, float reach, float dot, HashSet<HealthComponent> victims)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Invalid comparison between Unknown and I4
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		HurtBox[] array = Object.FindObjectsOfType<HurtBox>();
		foreach (HurtBox val in array)
		{
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive || (int)val.teamIndex != 2)
			{
				continue;
			}
			Collider component = ((Component)val).GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component) && component.enabled)
			{
				Vector3 corePosition = val.healthComponent.body.corePosition;
				if (!(Vector3.Distance(corePosition, origin) > 8f))
				{
					Vector3 val2 = component.ClosestPoint(origin);
					Vector3 val3 = val2 - origin;
					Vector3 val4 = Vector3.ProjectOnPlane(val3, Vector3.up);
					bool flag = ((Vector3)(ref val3)).magnitude <= reach;
					bool flag2 = Vector3.Dot(val4, forward) > 0f && Vector3.Dot(((Vector3)(ref val4)).normalized, forward) >= dot;
					bool flag3 = Physics.CheckSphere(origin, 0.035f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) || Physics.Linecast(origin, val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) || Physics.Linecast(origin, corePosition, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
					string[] obj = new string[30]
					{
						"CONTACT_PROBE phase=",
						PreviewTest.Phase,
						" target=",
						((Object)val.healthComponent).GetInstanceID().ToString(),
						" collider=",
						((Object)component).GetInstanceID().ToString(),
						" range=",
						flag.ToString(),
						" direction=",
						flag2.ToString(),
						" inside=",
						(((Vector3)(ref val3)).sqrMagnitude < 1E-06f).ToString(),
						" wall=",
						flag3.ToString(),
						" dedup=",
						victims.Contains(val.healthComponent).ToString(),
						" distance=",
						((Vector3)(ref val3)).magnitude.ToString(),
						" dot=",
						Vector3.Dot(((Vector3)(ref val4)).normalized, forward).ToString(),
						" centerForward=",
						Vector3.Dot(corePosition - origin, forward).ToString(),
						" origin=",
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					Vector3 val5 = origin;
					obj[23] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString();
					obj[24] = " closest=";
					val5 = val2;
					obj[25] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString();
					obj[26] = " bounds=";
					obj[27] = ((object)component.bounds/*cast due to .constrained prefix*/).ToString();
					obj[28] = " frame=";
					obj[29] = Time.frameCount.ToString();
					Kit.Log(string.Concat(obj));
				}
			}
		}
	}
}
public static class DefaultAppearance
{
	public static void Build(GameObject model)
	{
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Expected O, but got Unknown
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		SkinDef[] array = (SkinDef[])(object)new SkinDef[2];
		for (int i = 0; i < 2; i++)
		{
			SkinDef val = ScriptableObject.CreateInstance<SkinDef>();
			((Object)val).name = "HenryTobiramaVoiceSkin" + i;
			val.nameToken = ((i == 0) ? "HENRY_TOBIRAMA_ENGLISH" : "HENRY_TOBIRAMA_JAPANESE");
			LanguageAPI.Add(val.nameToken, (i == 0) ? "2nd Hokage - English Voice" : "2nd Hokage - Japanese Voice");
			Texture2D val2 = new Texture2D(2, 2);
			ImageConversion.LoadImage(val2, File.ReadAllBytes(Path.Combine(Visual.Assets, "Icons", (i == 0) ? "Voice-EN.png" : "Voice-JP.png")));
			val.icon = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
			val.rootObject = model;
			val.baseSkins = Array.Empty<SkinDef>();
			val.rendererInfos = model.GetComponent<CharacterModel>().baseRendererInfos;
			val.gameObjectActivations = Array.Empty<GameObjectActivation>();
			val.meshReplacements = Array.Empty<MeshReplacement>();
			val.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
			val.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
			MethodInfo methodInfo = typeof(SkinDef).Assembly.GetType("RoR2.SkinDefParams")?.GetMethod("FromSkinDef", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			if (methodInfo != null)
			{
				typeof(SkinDef).GetField("skinDefParams").SetValue(val, methodInfo.Invoke(null, new object[1] { val }));
			}
			array[i] = val;
		}
		ModelSkinController val3 = model.GetComponent<ModelSkinController>() ?? model.AddComponent<ModelSkinController>();
		val3.skins = array;
	}
}
public static class FeedbackPlaytest
{
	public static IEnumerator Run(CharacterBody b, Visual v, AnimationProbe d, Vector3 origin)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		bool[] array = new bool[2] { false, true };
		foreach (bool bonus in array)
		{
			if (bonus)
			{
				b.inventory.GiveItem(Items.Hoof, 2);
				b.RecalculateStats();
			}
			string[] array2 = new string[3] { "Side", "Rear", "Gameplay" };
			foreach (string view in array2)
			{
				PreviewTest.SetFoot(b, origin - Vector3.right * 20f - Vector3.forward * 20f);
				b.characterMotor.velocity = Vector3.zero;
				d.move = Vector3.forward;
				d.sprint = true;
				yield return PreviewTest.Record("Sprint-" + (bonus ? "Bonus-" : "Base-") + view, 2.5f, b, v, view == "Side");
				d.move = Vector3.zero;
				d.sprint = false;
				yield return (object)new WaitForSeconds(0.2f);
			}
			if (bonus)
			{
				b.inventory.RemoveItem(Items.Hoof.itemIndex, 2);
				b.RecalculateStats();
			}
		}
		d.move = Vector3.zero;
		d.sprint = false;
		PreviewTest.SetFoot(b, origin);
		yield return (object)new WaitForSeconds(0.3f);
		bool[] array3 = new bool[2] { true, false };
		for (int k = 0; k < array3.Length; k++)
		{
			bool bypass = array3[k];
			ShinobiLanding.TestBypass = bypass;
			b.healthComponent.health = b.maxHealth;
			int previous = ShinobiLanding.Hits;
			PreviewTest.SetFoot(b, origin + Vector3.up * 25f);
			b.characterMotor.velocity = Vector3.zero;
			yield return PreviewTest.Record("Fall-" + (bypass ? "Baseline" : "Passive"), 3.2f, b, v, side: true);
			Kit.Log("FALL_TEST bypass=" + bypass + " packets=" + (ShinobiLanding.Hits - previous) + " input=" + ShinobiLanding.LastInput + " applied=" + ShinobiLanding.LastApplied + " loss=" + ShinobiLanding.LastLoss);
		}
		ShinobiLanding.TestBypass = false;
		BodyFlags flags = b.bodyFlags;
		b.bodyFlags = (BodyFlags)(b.bodyFlags | 1);
		int count = ShinobiLanding.Hits;
		PreviewTest.SetFoot(b, origin + Vector3.up * 25f);
		b.characterMotor.velocity = Vector3.zero;
		yield return PreviewTest.Record("Fall-Immunity", 3.2f, b, v, side: true);
		Kit.Log("FALL_IMMUNITY packets=" + (ShinobiLanding.Hits - count));
		b.bodyFlags = flags;
		bool[] array4 = new bool[2] { true, false };
		for (int l = 0; l < array4.Length; l++)
		{
			bool bypass2 = array4[l];
			ShinobiLanding.TestBypass = bypass2;
			float before = b.healthComponent.health;
			b.healthComponent.TakeDamage(new DamageInfo
			{
				damage = 100f,
				damageType = DamageTypeCombo.op_Implicit((DamageType)0),
				procCoefficient = 0f,
				position = b.corePosition
			});
			Kit.Log("ORDINARY_DAMAGE bypass=" + bypass2 + " loss=" + (before - b.healthComponent.health));
		}
		ShinobiLanding.TestBypass = false;
		PreviewTest.SetFoot(b, origin + Vector3.up * 25f);
		b.characterMotor.velocity = Vector3.zero;
		Vector3 val = new Vector3(0f, 0.1f, 1f);
		d.aim = ((Vector3)(ref val)).normalized;
		d.utilityStart = Time.time;
		d.recastAt = 0.24f;
		yield return PreviewTest.Record("Fall-Raijin-Arrival", 3.8f, b, v, side: true);
		d.utilityStart = -1f;
		d.utility = false;
		d.aim = Vector3.forward;
		PreviewTest.SetFoot(b, origin);
		yield return (object)new WaitForSeconds(0.3f);
	}
}
public static class FinalPlaytest
{
	private static string A => Visual.Assets;

	private static IEnumerator Capture(string name, float seconds, CharacterBody b, Visual v, bool side = false)
	{
		AkSoundEngine.StartOutputCapture(Path.Combine(A, name + ".wav"));
		Kit.Log("AUDIO_CAPTURE_BEGIN " + name + " time=" + Time.time);
		yield return PreviewTest.Record(name, seconds, b, v, side);
		AkSoundEngine.StopOutputCapture();
	}

	public static IEnumerator Run(CharacterBody b, Visual v, AnimationProbe d, Vector3 origin)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		CharacterMaster master = b.master;
		BodyIndex index = b.bodyIndex;
		uint[] array = new uint[2] { 0u, 1u };
		Vector3 val;
		for (int i = 0; i < array.Length; i++)
		{
			uint skin = array[i];
			Object.Destroy((Object)(object)d);
			Loadout load = new Loadout();
			master.loadout.Copy(load);
			load.bodyLoadoutManager.SetSkinIndex(index, skin);
			master.SetLoadoutServer(load);
			NetworkUser user = ((IEnumerable<NetworkUser>)Object.FindObjectsOfType<NetworkUser>()).FirstOrDefault((Func<NetworkUser, bool>)((NetworkUser x) => ((NetworkBehaviour)x).isLocalPlayer));
			if (Object.op_Implicit((Object)(object)user))
			{
				user.CopyLoadoutFromMaster();
			}
			b.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
			yield return (object)new WaitForSeconds(0.3f);
			b = (CharacterBody)typeof(CharacterMaster).GetMethod("Respawn", new Type[3]
			{
				typeof(Vector3),
				typeof(Quaternion),
				typeof(bool)
			}).Invoke(master, new object[3]
			{
				origin,
				Quaternion.identity,
				true
			});
			yield return (object)new WaitForSeconds(2f);
			b.baseMaxHealth = 100000f;
			b.RecalculateStats();
			b.healthComponent.health = b.maxHealth;
			PreviewTest.SetFoot(b, origin);
			v = ((Component)b.modelLocator.modelTransform).GetComponentInChildren<Visual>();
			d = ((Component)b).gameObject.AddComponent<AnimationProbe>();
			d.body = b;
			AnimationProbe animationProbe = d;
			val = new Vector3(0f, -0.12f, 1f);
			animationProbe.aim = ((Vector3)(ref val)).normalized;
			Kit.Log("FINAL_SPAWN skin=" + b.skinIndex + " expected=" + skin + " skins=" + ((Component)b.modelLocator.modelTransform).GetComponent<ModelSkinController>().skins.Length);
			string lang = ((skin == 0) ? "English" : "Japanese");
			float[] array2 = new float[2] { 1f, 2f };
			for (int num = 0; num < array2.Length; num++)
			{
				float speed = array2[num];
				b.baseAttackSpeed = speed;
				b.RecalculateStats();
				PreviewTest.SetFoot(b, origin);
				b.skillLocator.secondary.RestockSteplike();
				d.secondary = true;
				yield return Capture("Kit-" + lang + "-Water-" + speed, 5.3f, b, v);
				d.secondary = false;
				yield return (object)new WaitForSeconds(0.2f);
			}
			b.baseAttackSpeed = 1f;
			b.RecalculateStats();
			PreviewTest.SetFoot(b, origin);
			b.skillLocator.special.RestockSteplike();
			d.special = true;
			yield return Capture("Kit-" + lang + "-Tandem", 9.6f, b, v);
			d.special = false;
			yield return (object)new WaitForSeconds(0.3f);
			PreviewTest.SetFoot(b, origin);
			AnimationProbe animationProbe2 = d;
			val = new Vector3(0f, 0.22f, 1f);
			animationProbe2.aim = ((Vector3)(ref val)).normalized;
			while (b.skillLocator.utility.stock < 2)
			{
				b.skillLocator.utility.RestockSteplike();
			}
			ScreenCapture.CaptureScreenshot(Path.Combine(A, lang + "-HUD-Two.png"));
			d.utilityStart = Time.time;
			d.recastAt = 0.25f;
			yield return Capture("Kit-" + lang + "-Raijin-First", 0.9f, b, v);
			d.utilityStart = -1f;
			d.utility = false;
			yield return (object)new WaitForSeconds(0.15f);
			b.baseAttackSpeed = 2f;
			b.RecalculateStats();
			d.utilityStart = Time.time;
			d.recastAt = 0.25f;
			yield return Capture("Kit-" + lang + "-Raijin-Second", 3.1f, b, v);
			d.utilityStart = -1f;
			d.utility = false;
			ScreenCapture.CaptureScreenshot(Path.Combine(A, lang + "-HUD-Zero.png"));
			Kit.Log("FINAL_TWO_CHARGES skin=" + b.skinIndex + " stock=" + b.skillLocator.utility.stock);
			b.baseAttackSpeed = 1f;
			b.RecalculateStats();
			PreviewTest.SetFoot(b, origin);
			AnimationProbe animationProbe3 = d;
			val = new Vector3(0f, -0.1f, 1f);
			animationProbe3.aim = ((Vector3)(ref val)).normalized;
			b.skillLocator.utility.RestockSteplike();
			d.utilityStart = Time.time;
			d.recastAt = -1f;
			yield return Capture("Kit-" + lang + "-Raijin-Auto", 3.6f, b, v);
			d.utilityStart = -1f;
			d.utility = false;
			yield return (object)new WaitForSeconds(0.2f);
			d.jumpSequenceStart = Time.time;
			yield return Capture("Jump-" + lang + "-Ascent", 2.4f, b, v, side: true);
			d.jumpSequenceStart = -1f;
			d.jump = false;
			Kit.Log("FINAL_ICONS " + string.Join(",", ((IEnumerable<GenericSkill>)(object)new GenericSkill[4]
			{
				b.skillLocator.primary,
				b.skillLocator.secondary,
				b.skillLocator.utility,
				b.skillLocator.special
			}).Select((GenericSkill s) => Object.op_Implicit((Object)(object)s.skillDef.icon) ? "512px" : "MISSING")));
		}
		Object.Destroy((Object)(object)d);
		Kit.Log("FINAL_STAGE_BEFORE skin=" + b.skinIndex);
		SceneInfo oldScene = SceneInfo.instance;
		Run.instance.PickNextStageSceneFromCurrentSceneDestinations();
		Run.instance.AdvanceStage(Run.instance.nextStageScene);
		for (int i2 = 0; i2 < 90; i2++)
		{
			if (!((Object)(object)SceneInfo.instance == (Object)(object)oldScene) && Object.op_Implicit((Object)(object)master.GetBody()) && !((Object)(object)master.GetBody() == (Object)(object)b))
			{
				break;
			}
			yield return (object)new WaitForSeconds(1f);
		}
		yield return (object)new WaitForSeconds(5f);
		b = master.GetBody();
		if (!Object.op_Implicit((Object)(object)b))
		{
			Kit.Log("FINAL_STAGE_NO_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(2f);
		Kit.Log("FINAL_STAGE_AFTER skin=" + b.skinIndex + " scene=" + SceneInfo.instance.sceneDef.cachedName + " stock=" + b.skillLocator.utility.stock);
		v = ((Component)b.modelLocator.modelTransform).GetComponentInChildren<Visual>();
		d = ((Component)b).gameObject.AddComponent<AnimationProbe>();
		d.body = b;
		AnimationProbe animationProbe4 = d;
		val = new Vector3(0f, -0.1f, 1f);
		animationProbe4.aim = ((Vector3)(ref val)).normalized;
		d.secondary = true;
		yield return Capture("Kit-Japanese-Next-Stage", 5.4f, b, v);
		d.secondary = false;
		Object.Destroy((Object)(object)d);
		Kit.Log("FINAL_PLAYTEST_DONE SOLO_HOST_ONLY");
	}
}
public static class FocusPlaytest
{
	public unsafe static IEnumerator Run(CharacterBody b, Visual v, AnimationProbe d, Vector3 origin)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		BalanceFixture fixture = ((Component)b).gameObject.AddComponent<BalanceFixture>();
		b.baseCrit = 0f;
		b.RecalculateStats();
		d.aim = Vector3.forward;
		bool revised = File.Exists(Path.Combine(Visual.Assets, "FOCUS_REVISED"));
		if (revised)
		{
			string[] array = new string[9] { "Walk-Side", "Walk-Gameplay", "Direction-Left", "Direction-Right", "Direction-Backward", "Sprint-Wrist-Side", "Sprint-Wrist-Rear", "Jump-Effort-Side", "Jump-Effort-Gameplay" };
			foreach (string mode in array)
			{
				PreviewTest.SetFoot(b, origin);
				b.characterMotor.velocity = Vector3.zero;
				d.sprint = mode.StartsWith("Sprint");
				d.move = ((!mode.StartsWith("Direction")) ? (mode.StartsWith("Jump") ? Vector3.zero : Vector3.forward) : (mode.EndsWith("Left") ? Vector3.left : (mode.EndsWith("Right") ? Vector3.right : Vector3.back)));
				if (mode.StartsWith("Jump"))
				{
					d.jumpSequenceStart = Time.time;
				}
				yield return PreviewTest.Record("Focus-" + mode, mode.StartsWith("Direction") ? 1.3f : 3f, b, v, mode.EndsWith("Side"));
				d.jumpSequenceStart = -1f;
				d.jump = false;
				d.move = Vector3.zero;
				d.sprint = false;
				yield return (object)new WaitForSeconds(0.35f);
			}
		}
		EnemyPin pin = ((Component)b).gameObject.AddComponent<EnemyPin>();
		PreviewTest.SetFoot(b, origin);
		bool[] array2 = new bool[2] { false, true };
		for (int j = 0; j < array2.Length; j++)
		{
			bool reactions = array2[j];
			float[] array3 = new float[2] { 1f, 2f };
			for (int k = 0; k < array3.Length; k++)
			{
				float speed = array3[k];
				CharacterMaster master = new MasterSummon
				{
					masterPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/GolemMaster"),
					position = origin + Vector3.forward * 1.15f + Vector3.right * (revised ? 0.65f : 0f),
					rotation = Quaternion.identity,
					teamIndexOverride = (TeamIndex)2,
					ignoreTeamMemberLimit = true
				}.Perform();
				yield return (object)new WaitForSeconds(0.5f);
				CharacterBody enemy = master.GetBody();
				Transform model = enemy.modelLocator.modelTransform;
				BaseAI[] components = ((Component)master).GetComponents<BaseAI>();
				foreach (BaseAI ai in components)
				{
					((Behaviour)ai).enabled = revised && reactions;
				}
				if (!revised || !reactions)
				{
					((Component)enemy).gameObject.AddComponent<EnemyPin>();
				}
				PreviewTest.SetFoot(enemy, origin + Vector3.forward * 1.15f + Vector3.right * (revised ? 0.65f : 0f));
				SetStateOnHurt hurt = ((Component)enemy).GetComponent<SetStateOnHurt>();
				if (Object.op_Implicit((Object)(object)hurt))
				{
					hurt.canBeHitStunned = reactions;
					hurt.canBeStunned = reactions;
				}
				EntityStateMachine[] components2 = ((Component)enemy).GetComponents<EntityStateMachine>();
				foreach (EntityStateMachine state in components2)
				{
					if (state.customName == "Body")
					{
						state.SetNextStateToMain();
					}
				}
				Renderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<Renderer>();
				foreach (Renderer rr in componentsInChildren)
				{
					((Component)rr).gameObject.layer = 31;
				}
				yield return (object)new WaitForSeconds(0.6f);
				b.baseAttackSpeed = speed;
				b.RecalculateStats();
				d.attack = true;
				d.stopAfter = 3;
				yield return PreviewTest.Record("Focus-" + (revised ? "InVolume" : "Repro") + "-" + (reactions ? "Reaction" : "Stable") + "-" + speed, 2.2f / speed + 0.3f, b, v, side: false);
				d.attack = false;
				yield return (object)new WaitForSeconds(0.3f);
				string[] obj = new string[12]
				{
					"FOCUS_RESULT revised=",
					revised.ToString(),
					" reactions=",
					reactions.ToString(),
					" attackSpeed=",
					speed.ToString(),
					" movementSpeed=",
					b.moveSpeed.ToString(),
					" playerVelocity=",
					null,
					null,
					null
				};
				Vector3 velocity = b.characterMotor.velocity;
				obj[9] = ((object)(*(Vector3*)(&velocity))/*cast due to .constrained prefix*/).ToString();
				obj[10] = " loss=";
				obj[11] = (enemy.maxHealth - enemy.healthComponent.health).ToString();
				Kit.Log(string.Concat(obj));
				Object.Destroy((Object)(object)((Component)model).gameObject);
				NetworkServer.Destroy(((Component)enemy).gameObject);
				NetworkServer.Destroy(((Component)master).gameObject);
				yield return (object)new WaitForSeconds(0.3f);
			}
		}
		Object.Destroy((Object)(object)pin);
		Object.Destroy((Object)(object)fixture);
		b.baseAttackSpeed = 1f;
		b.RecalculateStats();
		Kit.Log("FOCUS_DONE");
	}
}
public static class Kit
{
	public static Action<CharacterBody, Vector3> WaterReleased;

	public static Action<CharacterBody, Vector3> WaterImpacted;

	public static GameObject water;

	public static GameObject kunai;

	public static GameObject anchor;

	public static readonly List<GameObject> projectiles = new List<GameObject>();

	public static void Prepare()
	{
		KitVfx.Prepare();
		water = Projectile("TobiramaWaterDragon", 0);
		kunai = Projectile("TobiramaKunai", 1);
		anchor = Projectile("TobiramaRaijinAnchor", 2);
	}

	private static GameObject Projectile(string name, int kind)
	{
		GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile"), name);
		Component[] components = val.GetComponents<Component>();
		foreach (Component val2 in components)
		{
			if (val2 is ProjectileImpactExplosion || val2 is ProjectileSingleTargetImpact || val2 is ProjectileSimple || val2 is ProjectileOverlapAttack)
			{
				Object.DestroyImmediate((Object)(object)val2);
			}
		}
		Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val3 in componentsInChildren)
		{
			val3.enabled = false;
		}
		Collider[] componentsInChildren2 = val.GetComponentsInChildren<Collider>();
		foreach (Collider val4 in componentsInChildren2)
		{
			val4.enabled = false;
		}
		Rigidbody component = val.GetComponent<Rigidbody>();
		component.useGravity = false;
		component.isKinematic = true;
		ProjectileController component2 = val.GetComponent<ProjectileController>();
		component2.ghostPrefab = KitVfx.Ghost(kind);
		typeof(ProjectileController).GetField("ghostPrefabAddress", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(component2, null);
		component2.procCoefficient = ((kind == 0) ? KitTuning.WaterProc.Value : KitTuning.KunaiProc.Value);
		component2.allowPrediction = false;
		if (kind == 0)
		{
			val.AddComponent<ReliableWaterFlight>();
		}
		else
		{
			val.AddComponent<TobiFlight>().kind = kind;
		}
		projectiles.Add(val);
		return val;
	}

	public static TobiBody Runtime(CharacterBody b)
	{
		return ((Component)b).GetComponent<TobiBody>() ?? ((Component)b).gameObject.AddComponent<TobiBody>();
	}

	public static void Log(string s)
	{
		if (PreviewTest.Active)
		{
			Plugin.instance.Log.LogInfo((object)("KIT " + s));
		}
	}

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

	public static void Damage(CharacterBody owner, HealthComponent h, float damage, float proc, Vector3 point, bool crit, string label)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: 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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		if (NetworkServer.active && Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)h))
		{
			float health = h.health;
			DamageInfo val = new DamageInfo
			{
				attacker = ((Component)owner).gameObject,
				inflictor = ((Component)owner).gameObject,
				damage = damage,
				procCoefficient = proc,
				position = point,
				crit = crit,
				force = Vector3.zero,
				damageType = DamageTypeCombo.op_Implicit((DamageType)0)
			};
			h.TakeDamage(val);
			GlobalEventManager.instance.OnHitEnemy(val, ((Component)h).gameObject);
			GlobalEventManager.instance.OnHitAll(val, ((Component)h).gameObject);
			if (PreviewTest.Active)
			{
				BalancePlaytest.Observe(h, health - h.health, label);
			}
			Log(label + " victim=" + ((Object)h).GetInstanceID() + " loss=" + (health - h.health));
		}
	}

	public static void Blast(CharacterBody owner, Vector3 point, float radius, float damage, float proc, bool crit, string label)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner))
		{
			return;
		}
		HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>();
		Collider[] array = Physics.OverlapSphere(point, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2);
		foreach (Collider val in array)
		{
			HurtBox component = ((Component)val).GetComponent<HurtBox>();
			if (Enemy(owner, component) && !hashSet.Contains(component.healthComponent))
			{
				Vector3 corePosition = component.healthComponent.body.corePosition;
				if (!Physics.Linecast(point, corePosition, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					hashSet.Add(component.healthComponent);
					Damage(owner, component.healthComponent, damage, proc, val.ClosestPoint(point), crit, label);
				}
			}
		}
	}

	public static void TagBlast(CharacterBody owner, Vector3 target, float radius, float damage, bool crit, string label)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: 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_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_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner))
		{
			return;
		}
		HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>();
		float num = Mathf.Max(0f, KitTuning.TagHeight.Value);
		Collider[] array = Physics.OverlapCapsule(target, target + Vector3.up * num, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2);
		foreach (Collider val in array)
		{
			HurtBox component = ((Component)val).GetComponent<HurtBox>();
			if (Enemy(owner, component) && !hashSet.Contains(component.healthComponent))
			{
				Vector3 corePosition = component.healthComponent.body.corePosition;
				Vector3 val2 = target + Vector3.up * Mathf.Clamp(corePosition.y - target.y, 0f, num);
				Vector3 val3 = val.ClosestPoint(val2);
				if (!Physics.Linecast(val2, val3, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) || !Physics.Linecast(val2, corePosition, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					hashSet.Add(component.healthComponent);
					Damage(owner, component.healthComponent, damage, KitTuning.TagProc.Value, val3, crit, label);
				}
			}
		}
	}

	public static void Fire(CharacterBody b, GameObject prefab, Vector3 origin, Vector3 aim, float coefficient)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (NetworkServer.active)
		{
			ProjectileManager.instance.FireProjectile(prefab, origin, Util.QuaternionSafeLookRotation(aim), ((Component)b).gameObject, b.damage * coefficient, 0f, b.RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
		}
	}

	public static bool SpawnPoint(CharacterBody b, Ray aim, float distance, out Vector3 pos, float radius = 0.2f)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		Vector3 corePosition = b.corePosition;
		if (Physics.CheckSphere(corePosition, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
		{
			pos = corePosition;
			return false;
		}
		Vector3 val = corePosition + ((Ray)(ref aim)).direction * distance;
		Vector3 val2 = val - corePosition;
		RaycastHit val3 = default(RaycastHit);
		if (Physics.SphereCast(corePosition, radius, ((Vector3)(ref val2)).normalized, ref val3, distance, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
		{
			pos = ((RaycastHit)(ref val3)).point + ((RaycastHit)(ref val3)).normal * 0.23f;
			return false;
		}
		pos = val;
		return !Physics.CheckSphere(pos, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
	}
}
public class TobiBody : MonoBehaviour
{
	public TobiFlight anchor;

	public uint tagId;

	public bool arrival;

	public bool recastArmed;

	public bool utilityPressConsumed;

	public Vector3 arrivalPoint;

	private CharacterBody body;

	public readonly List<TagSequence> tags = new List<TagSequence>();

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

	private void FixedUpdate()
	{
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && Util.HasEffectiveAuthority(((Component)this).gameObject))
		{
			if (!body.inputBank.skill3.down)
			{
				recastArmed = true;
				utilityPressConsumed = false;
			}
			EntityStateMachine val = ((IEnumerable<EntityStateMachine>)((Component)body).GetComponents<EntityStateMachine>()).FirstOrDefault((Func<EntityStateMachine, bool>)((EntityStateMachine x) => x.customName == "Weapon"));
			if (Object.op_Implicit((Object)(object)val) && !(val.state is RaijinBurst) && !(val.state is RaijinResolve) && Object.op_Implicit((Object)(object)anchor) && recastArmed && ((ButtonState)(ref body.inputBank.skill3)).justPressed)
			{
				recastArmed = false;
				utilityPressConsumed = true;
				val.SetNextState((EntityState)(object)new RaijinResolve());
			}
		}
	}

	private void Update()
	{
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
		{
			Clear();
		}
	}

	public void Clear()
	{
		if (NetworkServer.active)
		{
			if (Object.op_Implicit((Object)(object)anchor))
			{
				anchor.Consume(teleport: false);
			}
			TagSequence[] array = tags.ToArray();
			foreach (TagSequence tagSequence in array)
			{
				if (Object.op_Implicit((Object)(object)tagSequence))
				{
					tagSequence.Cancel();
				}
			}
		}
		anchor = null;
	}

	private void OnDestroy()
	{
		Clear();
	}

	public unsafe bool Teleport(Vector3 point, Vector3 direction, HealthComponent enemy)
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: 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_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bb: 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_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_0404: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: 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_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !body.healthComponent.alive)
		{
			return false;
		}
		Vector3 footPosition = body.footPosition;
		float num = ((BaseCharacterController)body.characterMotor).Motor.Capsule.radius + 0.08f;
		float height = ((BaseCharacterController)body.characterMotor).Motor.Capsule.height;
		Vector3 val = -((Vector3)(ref direction)).normalized;
		Vector3 val2 = point + val * (Object.op_Implicit((Object)(object)enemy) ? 1.2f : 0.65f);
		Vector3 val3 = Vector3.zero;
		bool flag = false;
		float[] array = new float[3] { 0f, 0.5f, 1f };
		foreach (float num2 in array)
		{
			for (int j = 0; j < 9; j++)
			{
				if (flag)
				{
					break;
				}
				float num3 = (float)((j != 0) ? ((j + 1) / 2 * ((j % 2 != 0) ? 1 : (-1)) * 30) : 0) * (MathF.PI / 180f);
				Vector3 val4 = Quaternion.AngleAxis(num3 * 57.29578f, Vector3.up) * val;
				Vector3 val5 = val2 + val4 * ((j == 0) ? 0f : Mathf.Min(KitTuning.ArrivalRadius.Value, 0.6f + (float)((j + 1) / 2) * 0.4f)) + Vector3.up * num2;
				Vector3 val6 = val5 + Vector3.up * num;
				Vector3 val7 = val5 + Vector3.up * Mathf.Max(num, height - num);
				if (!Physics.CheckCapsule(val6, val7, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && !Physics.Linecast(footPosition + Vector3.up * 0.8f, val5 + Vector3.up * 0.8f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && !Physics.OverlapCapsule(val6, val7, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2).Any(delegate(Collider c)
				{
					HurtBox component = ((Component)c).GetComponent<HurtBox>();
					return Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent) && (Object)(object)component.healthComponent.body != (Object)(object)body;
				}))
				{
					val3 = val5;
					flag = true;
				}
			}
			if (flag)
			{
				break;
			}
		}
		if (!flag)
		{
			Kit.Log("RAIJIN_REJECT clearance_or_wall");
			return false;
		}
		KitVfx.Emit(KitVfx.teleport, body.corePosition, 1f);
		TeleportHelper.TeleportBody(body, val3 + (body.transform.position - body.footPosition));
		body.characterMotor.velocity = Vector3.zero;
		arrival = true;
		arrivalPoint = val3;
		Visual componentInChildren = ((Component)body.modelLocator.modelTransform).GetComponentInChildren<Visual>();
		if (Object.op_Implicit((Object)(object)componentInChildren) && !componentInChildren.skillOverride)
		{
			componentInChildren.Play(body.characterMotor.isGrounded ? "Raijin_Arrive_Ground" : "Raijin_Arrive_Air", 1f, 0f, restart: true, 0.04f);
			componentInChildren.lockUntil = Time.time + 0.12f;
		}
		KitVfx.Emit(KitVfx.teleport, val3 + Vector3.up, 1f);
		TobiAudio.Send(body, 3, val3 + Vector3.up);
		Vector3 val8 = val3;
		Kit.Log("RAIJIN_TELEPORT " + ((object)(*(Vector3*)(&val8))/*cast due to .constrained prefix*/).ToString());
		return true;
	}
}
public class TobiFlight : MonoBehaviour
{
	public int kind;

	private ProjectileController pc;

	private ProjectileDamage damage;

	private CharacterBody owner;

	private float age;

	private bool consumed;

	private Vector3 direction;

	private void Start()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		pc = ((Component)this).GetComponent<ProjectileController>();
		damage = ((Component)this).GetComponent<ProjectileDamage>();
		direction = ((Component)this).transform.forward;
		Bind();
	}

	private void Bind()
	{
		if (Object.op_Implicit((Object)(object)pc) && Object.op_Implicit((Object)(object)pc.owner))
		{
			owner = pc.owner.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)owner) && kind == 2)
			{
				Kit.Runtime(owner).anchor = this;
			}
		}
	}

	private void FixedUpdate()
	{
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: 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_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)owner))
		{
			Bind();
		}
		if (!NetworkServer.active || consumed)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)owner) || !owner.healthComponent.alive)
		{
			Consume(teleport: false);
			return;
		}
		age += Time.fixedDeltaTime;
		float num = ((kind == 0) ? KitTuning.WaterLife.Value : KitTuning.AnchorLife.Value);
		if (age > num)
		{
			Kit.Log("FLIGHT_EXPIRE kind=" + kind);
			Consume(teleport: false);
			return;
		}
		float num2 = ((kind == 0) ? KitTuning.WaterSpeed.Value : KitTuning.KunaiSpeed.Value);
		float num3 = num2 * Time.fixedDeltaTime;
		float num4 = ((kind == 0) ? 0.45f : 0.11f);
		IOrderedEnumerable<RaycastHit> orderedEnumerable = from h in Physics.SphereCastAll(((Component)this).transform.position, num4, direction, num3, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2)
			orderby ((RaycastHit)(ref h)).distance
			select h;
		foreach (RaycastHit item in orderedEnumerable)
		{
			RaycastHit current = item;
			HurtBox component = ((Component)((RaycastHit)(ref current)).collider).GetComponent<HurtBox>();
			bool flag = (LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) & (1 << ((Component)((RaycastHit)(ref current)).collider).gameObject.layer)) != 0;
			if (!flag && !Kit.Enemy(owner, component))
			{
				continue;
			}
			Vector3 val = ((RaycastHit)(ref current)).point + ((RaycastHit)(ref current)).normal * 0.06f;
			Kit.Log("IMPACT kind=" + kind + " world=" + flag);
			if (kind == 1)
			{
				if (Object.op_Implicit((Object)(object)component))
				{
					Kit.Damage(owner, component.healthComponent, damage.damage, KitTuning.KunaiProc.Value, val, damage.crit, "KUNAI_DAMAGE");
				}
				KitVfx.Emit(KitVfx.teleport, val, 0.25f);
			}
			else
			{
				Kit.Runtime(owner).Teleport(val, direction, Object.op_Implicit((Object)(object)component) ? component.healthComponent : null);
			}
			Consume(teleport: false);
			return;
		}
		Transform transform = ((Component)this).transform;
		transform.position += direction * num3;
	}

	public void Consume(bool teleport)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		if (!consumed)
		{
			consumed = true;
			if (teleport && Object.op_Implicit((Object)(object)owner))
			{
				Kit.Runtime(owner).Teleport(((Component)this).transform.position, direction, null);
			}
			if (Object.op_Implicit((Object)(object)owner) && (Object)(object)Kit.Runtime(owner).anchor == (Object)(object)this)
			{
				Kit.Runtime(owner).anchor = null;
			}
			if (NetworkServer.active)
			{
				NetworkServer.Destroy(((Component)this).gameObject);
			}
		}
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)((Component)owner).GetComponent<TobiBody>()) && (Object)(object)((Component)owner).GetComponent<TobiBody>().anchor == (Object)(object)this)
		{
			((Component)owner).GetComponent<TobiBody>().anchor = null;
		}
	}
}
public abstract class TobiCast : BaseSkillState
{
	protected Visual v;

	protected float speed;

	protected bool completed;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		speed = Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
		v = ((Component)((EntityState)this).characterBody.modelLocator.modelTransform).GetComponentInChildren<Visual>();
		if (Object.op_Implicit((Object)(object)v))
		{
			v.skillOverride = true;
			v.combatUntil = Time.time + 3f;
		}
		((EntityState)this).characterBody.SetAimTimer(3f);
	}

	protected void Play(string clip, float rate = 0f)
	{
		if (Object.op_Implicit((Object)(object)v))
		{
			v.Play(clip, (rate == 0f) ? speed : rate, 0f, restart: true, 0.06f);
		}
	}

	public override void OnExit()
	{
		if (!completed)
		{
			TobiAudio.Send(((EntityState)this).characterBody, 7);
		}
		if (Object.op_Implicit((Object)(object)v))
		{
			v.skillOverride = false;
			v.lockUntil = 0f;
		}
		((EntityState)this).OnExit();
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)2;
	}
}
public class WaterDragonCast : TobiCast
{
	private bool released;

	private bool surged;

	public override void OnEnter()
	{
		base.OnEnter();
		Play("Water_Dragon");
		TobiAudio.Send(((EntityState)this).characterBody, 0);
	}

	public unsafe override void FixedUpdate()
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: 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)
		((EntityState)this).FixedUpdate();
		if (!surged && ((EntityState)this).fixedAge >= 0.48f / speed)
		{
			surged = true;
			if (NetworkServer.active)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector3 val = ((EntityState)this).characterBody.corePosition - ((Ray)(ref aimRay)).direction * 1.8f;
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Linecast(((EntityState)this).characterBody.corePosition, val, ref val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
				{
					val = ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.3f;
				}
				KitVfx.Emit(KitVfx.emerge, val, 1f);
			}
		}
		if (!released && ((EntityState)this).fixedAge >= 0.6f / speed)
		{
			released = true;
			if (NetworkServer.active)
			{
				Ray aimRay2 = ((BaseState)this).GetAimRay();
				Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
				Kit.Fire(((EntityState)this).characterBody, Kit.water, corePosition, ((Ray)(ref aimRay2)).direction, KitTuning.WaterDamage.Value);
				Kit.WaterReleased?.Invoke(((EntityState)this).characterBody, corePosition);
				Vector3 val3 = corePosition;
				Kit.Log("WATER_RELEASE " + ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString());
			}
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 1.2f / speed)
		{
			completed = true;
			((EntityState)this).outer.SetNextStateToMain();
		}
	}
}
public class RaijinBurst : TobiCast
{
	private int fired;

	private bool releasedButton;

	private bool buffered;

	private float bufferTime;

	private TobiBody runtime;

	public override void OnEnter()
	{
		base.OnEnter();
		runtime = Kit.Runtime(((EntityState)this).characterBody);
		if (NetworkServer.active && Object.op_Implicit((Object)(object)runtime.anchor))
		{
			runtime.anchor.Consume(teleport: false);
		}
		runtime.arrival = false;
		runtime.recastArmed = false;
		runtime.utilityPressConsumed = true;
		if (Object.op_Implicit((Object)(object)v))
		{
			v.Play("Raijin_Three_Throws", speed, 0f, restart: true, 0f);
			v.player.Sample();
		}
		TobiAudio.Send(((EntityState)this).characterBody, 2);
		Release();
	}

	private unsafe void Release()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: 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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: 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_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		int num = fired++;
		if (!NetworkServer.active)
		{
			return;
		}
		Ray aimRay = ((BaseState)this).GetAimRay();
		if (Kit.SpawnPoint(((EntityState)this).characterBody, aimRay, 0.65f, out var pos))
		{
			Transform val = (Object.op_Implicit((Object)(object)v) ? ((IEnumerable<Transform>)v.bones).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "hand.R")) : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				Vector3 val2 = val.position + ((Ray)(ref aimRay)).direction * 0.12f;
				Vector3 val3 = val2 - ((EntityState)this).characterBody.corePosition;
				RaycastHit val4 = default(RaycastHit);
				if (!Physics.SphereCast(((EntityState)this).characterBody.corePosition, 0.11f, ((Vector3)(ref val3)).normalized, ref val4, ((Vector3)(ref val3)).magnitude, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && !Physics.CheckSphere(val2, 0.11f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
				{
					pos = val2;
				}
			}
			Kit.Fire(((EntityState)this).characterBody, (num == 2) ? Kit.anchor : Kit.kunai, pos, ((Ray)(ref aimRay)).direction, (num == 2) ? 0f : KitTuning.KunaiDamage.Value);
			string[] obj = new string[8]
			{
				"RAIJIN_RELEASE ",
				(num + 1).ToString(),
				" age=",
				((EntityState)this).fixedAge.ToString(),
				" time=",
				FixedTimeStamp.now.t.ToString(),
				" origin=",
				null
			};
			Vector3 val5 = pos;
			obj[7] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString();
			Kit.Log(string.Concat(obj));
		}
		else
		{
			Kit.Log("RAIJIN_BLOCKED " + (num + 1));
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (!((EntityState)this).inputBank.skill3.down)
		{
			releasedButton = true;
		}
		if (releasedButton && ((ButtonState)(ref ((EntityState)this).inputBank.skill3)).justPressed)
		{
			buffered = true;
			bufferTime = ((EntityState)this).fixedAge;
		}
		while (fired < 3 && ((EntityState)this).fixedAge >= (float)fired * 0.06f / speed)
		{
			Release();
		}
		if (((EntityState)this).isAuthority && buffered && fired == 3 && Object.op_Implicit((Object)(object)runtime.anchor) && ((EntityState)this).fixedAge - bufferTime < 0.35f)
		{
			runtime.utilityPressConsumed = true;
			completed = true;
			((EntityState)this).outer.SetNextState((EntityState)(object)new RaijinResolve());
		}
		else if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.3666667f / speed)
		{
			completed = true;
			if (runtime.arrival)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new RaijinArrival());
			}
			else
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}

	public override void OnExit()
	{
		if (!completed && NetworkServer.active && (Object)(object)runtime != (Object)null && Object.op_Implicit((Object)(object)runtime.anchor))
		{
			runtime.anchor.Consume(teleport: false);
		}
		base.OnExit();
	}
}
public class RaijinResolve : TobiCast
{
	public override void OnEnter()
	{
		base.OnEnter();
		Play("Raijin_Depart", 1f);
		if (NetworkServer.active)
		{
			TobiBody tobiBody = Kit.Runtime(((EntityState)this).characterBody);
			if (Object.op_Implicit((Object)(object)tobiBody.anchor))
			{
				tobiBody.anchor.Consume(teleport: true);
			}
			Kit.Log("RAIJIN_EARLY_RECAST");
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > 0.1f)
		{
			completed = true;
			((EntityState)this).outer.SetNextState((EntityState)(object)new RaijinArrival());
		}
	}
}
public class RaijinArrival : TobiCast
{
	public override void OnEnter()
	{
		base.OnEnter();
		Play(((EntityState)this).characterMotor.isGrounded ? "Raijin_Arrive_Ground" : "Raijin_Arrive_Air", 1f);
	}

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

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)0;
	}
}
public class TandemCast : TobiCast
{
	private bool released;

	private bool valid;

	private Vector3 target;

	private TagSequence field;

	public override void OnEnter()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: 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_0130: Unknown result type (might be due to invalid IL or missing references)
		base.OnEnter();
		Play("Tandem_Paper_Bombs");
		TobiAudio.Send(((EntityState)this).characterBody, 1);
		Ray aimRay = ((BaseState)this).GetAimRay();
		RaycastHit val = default(RaycastHit);
		valid = Physics.Raycast(aimRay, ref val, KitTuning.TagRange.Value, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
		if (!valid)
		{
			Vector3 point = ((Ray)(ref aimRay)).GetPoint(Mathf.Min(25f, KitTuning.TagRange.Value));
			valid = Physics.Raycast(point + Vector3.up * 4f, Vector3.down, ref val, 30f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && Vector3.Distance(((Ray)(ref aimRay)).origin, ((RaycastHit)(ref val)).point) <= KitTuning.TagRange.Value;
		}
		target = ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.1f;
		if (valid && NetworkServer.active)
		{
			KitVfx.Emit(KitVfx.indicator, target, KitTuning.TagRadius.Value);
		}
	}

	public unsafe override void FixedUpdate()
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (!released && ((EntityState)this).fixedAge >= 0.6f / speed)
		{
			released = true;
			if (NetworkServer.active && valid)
			{
				field = ((EntityState)this).gameObject.AddComponent<TagSequence>();
				field.Init(((EntityState)this).characterBody, target);
				Vector3 val = target;
				Kit.Log("TAGS_RELEASE " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString());
			}
			else if (((EntityState)this).isAuthority && !valid)
			{
				((EntityState)this).skillLocator.special.AddOneStock();
				Kit.Log("TAGS_INVALID_SURFACE");
			}
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 1.3f / speed)
		{
			completed = true;
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		if (!completed && Object.op_Implicit((Object)(object)field))
		{
			field.Cancel();
		}
		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(valid);
		w.Write(target);
	}

	public override void OnDeserialize(NetworkReader r)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		((BaseSkillState)this).OnDeserialize(r);
		valid = r.ReadBoolean();
		target = r.ReadVector3();
	}
}
public class TagSequence : MonoBehaviour
{
	private CharacterBody owner;

	private Vector3 target;

	private float start;

	private int pulse;

	private uint id;

	private bool active;

	public void Init(CharacterBody b, Vector3 p)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		owner = b;
		target = p;
		start = FixedTimeStamp.now.t;
		id = ++Kit.Runtime(b).tagId;
		while (Kit.Runtime(b).tags.Count >= 3)
		{
			Kit.Runtime(b).tags[0].Cancel();
		}
		Kit.Runtime(b).tags.Add(this);
		active = true;
		KitVfx.Field(b, target, id, start);
	}

	private void FixedUpdate()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !active)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)owner) || !owner.healthComponent.alive)
		{
			Cancel();
			return;
		}
		float num = FixedTimeStamp.now.t - start;
		int num2 = Mathf.Clamp(KitTuning.TagPulses.Value, 1, 32);
		float num3 = Mathf.Max(0.1f, KitTuning.TagInterval.Value);
		while (pulse < num2 && num >= KitTuning.TagDelay.Value + (float)pulse * num3)
		{
			float num4 = KitTuning.TagRadius.Value * Mathf.Lerp(0.65f, 1f, ((float)pulse + 1f) / (float)num2);
			Kit.TagBlast(owner, target, num4, owner.damage * KitTuning.TagDamage.Value, owner.RollCrit(), "TAG_PULSE_" + pulse);
			KitVfx.Emit(KitVfx.explosion, target + Vector3.up * (0.6f + (float)(pulse % 3) * 3.6f), num4 * ((pulse == num2 - 1) ? 1f : 0.68f));
			TobiAudio.Send(owner, 6, target + Vector3.up * (0.6f + (float)(pulse % 3) * 3.6f));
			Kit.Log("TAG_PULSE " + pulse + " age=" + num + " totalCoefficient=" + (float)num2 * KitTuning.TagDamage.Value);
			pulse++;
		}
		if (pulse >= num2 && num > KitTuning.TagDelay.Value + (float)(num2 - 1) * num3 + 0.85f)
		{
			Cancel();
		}
	}

	public void Cancel()
	{
		if (active)
		{
			active = false;
			if (Object.op_Implicit((Object)(object)owner))
			{
				KitVfx.StopField(owner, id);
				Kit.Runtime(owner).tags.Remove(this);
			}
			Object.Destroy((Object)(object)this);
			Kit.Log("TAG_CLEANUP");
		}
	}
}
public static class KitPlaytest
{
	private static GameObject Wall(Vector3 p, Vector3 size)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
		((Object)val).name = "Isolated kit test wall";
		val.layer = LayerIndex.world.intVal;
		val.transform.position = p;
		val.transform.localScale = size;
		val.GetComponent<Renderer>().enabled = false;
		GameObject val2 = Object.Instantiate<GameObject>(val);
		Object.Destroy((Object)(object)val2.GetComponent<Collider>());
		val2.layer = 31;
		val2.GetComponent<Renderer>().enabled = true;
		val2.transform.SetParent(val.transform, true);
		return val;
	}

	private static void Place(CharacterBody b, List<CharacterBody> targets, Vector3 origin, float z)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		PreviewTest.SetFoot(b, origin);
		b.characterMotor.velocity = Vector3.zero;
		for (int i = 0; i < targets.Count; i++)
		{
			PreviewTest.SetFoot(targets[i], origin + new Vector3((float)(i - 1) * 1.3f, 0f, (i == 3) ? (-4f) : z));
			targets[i].characterMotor.velocity = Vector3.zero;
			targets[i].healthComponent.health = 10000f;
		}
		Physics.SyncTransforms();
	}

	private static void Ready(CharacterBody b, AnimationProbe d)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		d.attack = (d.secondary = (d.utility = (d.special = false)));
		d.utilityStart = -1f;
		d.recastAt = -1f;
		d.aim = Vector3.forward;
		b.skillLocator.secondary.RestockSteplike();
		while (b.skillLocator.utility.stock < b.skillLocator.utility.maxStock)
		{
			b.skillLocator.utility.RestockSteplike();
		}
		b.skillLocator.special.RestockSteplike();
	}

	public unsafe static IEnumerator Run(CharacterBody b, Visual v, AnimationProbe d, List<CharacterBody> targets, Vector3 origin)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		Ready(b, d);
		Place(b, targets, origin, 12f);
		yield return (object)new WaitForSeconds(0.5f);
		d.move = Vector3.back * 0.6f;
		yield return PreviewTest.Record("Kit-Evasion-Back", 1.2f, b, v, side: true);
		d.move = Vector3.left * 0.6f;
		yield return PreviewTest.Record("Kit-Evasion-Left", 1.2f, b, v, side: false);
		d.move = Vector3.right * 0.6f;
		yield return PreviewTest.Record("Kit-Evasion-Right", 1.2f, b, v, side: false);
		d.move = Vector3.zero;
		yield return (object)new WaitForSeconds(0.3f);
		float[] array = new float[2] { 1f, 2f };
		for (int i = 0; i < array.Length; i++)
		{
			float speed = array[i];
			Ready(b, d);
			Place(b, targets, origin, 12f);
			b.baseAttackSpeed = speed;
			b.RecalculateStats();
			yield return (object)new WaitForSeconds(0.2f);
			d.secondary = true;
			yield return PreviewTest.Record("Kit-Water-" + speed, 2.3f, b, v, side: false);
			d.secondary = false;
			yield return (object)new WaitForSeconds(0.3f);
		}
		b.baseAttackSpeed = 1f;
		b.RecalculateStats();
		Ready(b, d);
		Place(b, targets, origin, 12f);
		GameObject wall = Wall(origin + new Vector3(0f, 1.5f, 5f), new Vector3(8f, 4f, 0.4f));
		yield return (object)new WaitForSeconds(0.2f);
		d.secondary = true;
		yield return PreviewTest.Record("Kit-Water-Wall", 2f, b, v, side: false);
		d.secondary = false;
		Object.Destroy((Object)(object)wall);
		yield return (object)new WaitForSeconds(0.3f);
		Ready(b, d);
		Place(b, targets, origin, 12f);
		wall = Wall(b.corePosition + Vector3.forward * 0.45f, new Vector3(5f, 4f, 0.2f));
		yield return (object)new WaitForSeconds(0.2f);
		d.secondary = true;
		yield return PreviewTest.Record("Kit-Water-CloseWall", 1.5f, b, v, side: false);
		d.secondary = false;
		Object.Destroy((Object)(object)wall);
		yield return (object)new WaitForSeconds(0.3f);
		Ready(b, d);
		Place(b, targets, origin, 12f);
		b.baseAttackSpeed = 2f;
		b.RecalculateStats();
		yield return (object)new WaitForSeconds(0.3f);
		d.utility = true;
		yield return PreviewTest.Record("Raijin-DoubleSpeed", 1.2f, b, v, side: false);
		d.utility = false;
		b.baseAttackSpeed = 1f;
		b.RecalculateStats();
		yield return (object)new WaitForSeconds(0.3f);
		Ready(b, d);
		Place(b, targets, origin, 12f);
		yield return (object)new WaitForSeconds(0.3f);
		d.utility = true;
		yield return PreviewTest.Record("Raijin-Swipe-Auto-Held", 2f, b, v, side: false);
		d.utility = false;
		Vector3 val = b.footPosition - origin;
		Kit.Log("TEST auto held position=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString() + " stock=" + b.skillLocator.utility.stock);
		yield return (object)new WaitForSeconds(0.4f);
		Ready(b, d);
		Place(b, targets, origin, 45f);
		yield return (object)new WaitForSeconds(0.3f);
		d.utilityStart = Time.time;
		d.recastAt = 0.35f;
		yield return PreviewTest.Record("Kit-Raijin-Early", 1.7f, b, v, side: false);
		d.utilityStart = -1f;
		d.utility = false;
		val = b.footPosition - origin;
		Kit.Log("TEST early position=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString() + " stock=" + b.skillLocator.utility.stock);
		yield return (object)new WaitForSeconds(0.4f);
		Ready(b, d);
		Place(b, targets, origin, 60f);
		yield return (object)new WaitForSeconds(0.3f);
		d.utilityStart = Time.time;
		d.recastAt = 0.75f;
		yield return PreviewTest.Record("Kit-Raijin-Late-Recast", 1.8f, b, v, side: false);
		d.utilityStart = -1f;
		d.utility = false;
		val = b.footPosition - origin;
		Kit.Log("TEST late recast position=" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString() + " stock=" + b.skillLocator.utility.stock);
		yield return (object)new WaitForSeconds(0.4f);
		Ready(b, d);
		Place(b, targets, origin, 45f);
		PreviewTest.SetFoot(b, origin + Vector3.up * 5f);
		yield return (object)new WaitForSeconds(0.1f);
		val = new Vector3(0f, 0.2f, 1f);
		d.aim = ((Vector3)(ref val)).normalized;
		d.utilityStart = Time.time;
		d.recastAt = 0.24f;
		yield return PreviewTest.Record("Kit-Raijin-Buffered-Air", 1.7f, b, v, side: false);
		d.utilityStart = -1f;
		d.utility = false;
		yield return (object)new WaitForSeconds(0.4f);
		Ready(b, d);
		Place(b, targets, origin, 12f);
		wall = Wall(origin + new Vector3(0f, 2f, 4f), new Vector3(30f, 12f, 1f));
		yield return (object)new WaitForSeconds(0.2f);
		Kit.Log("TEST forbidden wall arrival accepted=" + Kit.Runtime(b).Teleport(origin + Vector3.forward * 8f, Vector3.forward, null));
		Object.Destroy((Object)(object)wall);
		yield return (object)new WaitForSeconds(0.3f);
		Ready(b, d);
		Place(b, targets, origin, 45f);
		val = new Vector3(0f, 0.8f, 1f);
		d.aim = ((Vector3)(ref val)).normalized;
		d.utility = true;
		yield return PreviewTest.Record("Kit-Raijin-Expiry", 4.1f, b, v, side: false);
		d.utility = false;
		Kit.Log("TEST expiry anchor=" + Object.op_Implicit((Object)(object)Kit.Runtime(b).anchor));
		yield return (object)new WaitForSeconds(0.4f);
		Ready(b, d);
		Place(b, targets, origin, 65f);
		yield return (object)new WaitForSeconds(0.4f);
		Kit.Log("CHARGE_TEST begin stock=" + b.skillLocator.utility.stock + " max=" + b.skillLocator.utility.maxStock);
		ScreenCapture.CaptureScreenshot(Path.Combine(Visual.Assets, "HUD-TwoCharges.png"));
		val = new Vector3(0f, 0.25f, 1f);
		d.aim = ((Vector3)(ref val)).normalized;
		d.utilityStart = Time.time;
		d.recastAt = 0.7f;
		yield return PreviewTest.Record("Kit-Charges-First-Recast", 1.6f, b, v, side: false);
		d.utilityStart = -1f;
		d.utility = false;
		Kit.Log("CHARGE_TEST after_recast stock=" + b.skillLocator.utility.stock);
		yield return (object)new WaitForSeconds(0.3f);
		PreviewTest.SetFoot(b, b.footPosition + Vector3.up * 5f);
		b.characterMotor.velocity = Vector3.zero;
		d.utilityStart = Time.time;
		d.recastAt = 0.65f;
		yield return PreviewTest.Record("Kit-Charges-Second-Air", 1.5f, b, v, side: false);
		d.utilityStart = -1f;
		d.utility = false;
		Kit.Log("CHARGE_TEST second_air stock=" + b.skillLocator.utility.stock + " anchor=" + Object.op_Implicit((Object)(object)Kit.Runtime(b).anchor));
		ScreenCapture.CaptureScreenshot(Path.Combine(Visual.Assets, "HUD-ZeroCharges.png"));
		yield return PreviewTest.Record("Kit-Charges-Recharge", 19f, b, v, side: false);
		Kit.Log("CHARGE_TEST recharged stock=" + b.skillLocator.utility.stock);
		b.inventory.GiveItem(Items.UtilitySkillMagazine, 1);
		b.RecalculateStats();
		yield return (object)new WaitForSeconds(0.3f);
		Kit.Log("CHARGE_ITEM max=" + b.skillLocator.utility.maxStock + " interval=" + b.skillLocator.utility.finalRechargeInterval);
		b.inventory.RemoveItem(Items.UtilitySkillMagazine.itemIndex, 1);
		b.RecalculateStats();
		yield return (object)new WaitForSeconds(0.3f);
		float[] array2 = new float[2] { 1f, 2f };
		for (int j = 0; j < array2.Length; j++)
		{
			float speed2 = array2[j];
			Ready(b, d);
			Place(b, targets, origin, 14f);
			b.baseAttackSpeed = speed2;
			b.RecalculateStats();
			val = origin + Vector3.forward * 14f - b.inputBank.aimOrigin;
			d.aim = ((Vector3)(ref val)).normalized;
			yield return (object)new WaitForSeconds(0.3f);
			d.special = true;
			yield return PreviewTest.Record("Kit-Tags-" + speed2, 8.7f, b, v, side: false);
			d.special = false;
			Kit.Log("TEST tags active=" + Kit.Runtime(b).tags.Count + " stock=" + b.skillLocator.special.stock);
			yield return (object)new WaitForSeconds(0.4f);
		}
		b.baseAttackSpeed = 1f;
		b.RecalculateStats();
		Ready(b, d);
		Place(b, targets, origin, 14f);
		val = origin + Vector3.forward * 14f - b.inputBank.aimOrigin;
		d.aim = ((Vector3)(ref val)).normalized;
		d.special = true;
		yield return (object)new WaitForSeconds(0.85f);
		((Component)b).GetComponents<EntityStateMachine>().First((EntityStateMachine x) => x.customName == "Weapon").SetNextStateToMain();
		d.special = false;
		yield return (object)new WaitForSeconds(0.3f);
		Kit.Log("TEST tag interruption active=" + Kit.Runtime(b).tags.Count);
		Ready(b, d);
		Place(b, targets, origin, 45f);
		d.utility = true;
		yield return (object)new WaitForSeconds(0.08f);
		((Component)b).GetComponents<EntityStateMachine>().First((EntityStateMachine x) => x.customName == "Weapon").SetNextStateToMain();
		d.utility = false;
		yield return (object)new WaitForSeconds(0.3f);
		Kit.Log("TEST anchor interruption anchor=" + Object.op_Implicit((Object)(object)Kit.Runtime(b).anchor));
		Ready(b, d);
		d.utility = true;
		yield return (object)new WaitForSeconds(0.36f);
		TagSequence field = ((Component)b).gameObject.AddComponent<TagSequence>();
		field.Init(b, origin + Vector3.forward * 14f);
		b.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
		yield return (object)new WaitForSeconds(0.5f);
		Kit.Log("TEST death fields=" + TobiEffect.ActiveFields + " flights=" + NetworkServer.objects.Values.Count((NetworkIdentity x) => Object.op_Implicit((Object)(object)x) && Object.op_Implicit((Object)(object)((Component)x).GetComponent<TobiFlight>())) + " tags=" + ((Component)b).GetComponents<TagSequence>().Length);
		yield return PreviewTest.Record("Kit-Death-Cleanup", 1f, b, v, side: false);
		Kit.Log("EFFECT_BUDGET peakExplosionInstances=" + TobiEffect.PeakBursts);
		Kit.Log("TEST COMPLETE SOLO_HOST_ONLY");
	}
}
public static class KitTuning
{
	public static ConfigEntry<float> WaterDamage;

	public static ConfigEntry<float> WaterRadius;

	public static ConfigEntry<float> WaterSpeed;

	public static ConfigEntry<float> WaterLife;

	public static ConfigEntry<float> WaterCooldown;

	public static ConfigEntry<float> WaterProc;

	public static ConfigEntry<float> KunaiDamage;

	public static ConfigEntry<float> KunaiSpeed;

	public static ConfigEntry<float> AnchorLife;

	public static ConfigEntry<float> RaijinCooldown;

	public static ConfigEntry<float> KunaiProc;

	public static ConfigEntry<float> ArrivalRadius;

	public static ConfigEntry<float> TagDamage;

	public static ConfigEntry<float> TagRadius;

	public static ConfigEntry<float> TagCooldown;

	public static ConfigEntry<float> TagInterval;

	public static ConfigEntry<float> TagDelay;

	public static ConfigEntry<float> TagRange;

	public static ConfigEntry<float> TagProc;

	public static ConfigEntry<float> TagHeight;

	public static ConfigEntry<int> TagPulses;

	public static void Init(ConfigFile c)
	{
		WaterDamage = c.Bind<float>("Water Dragon", "Damage", 18f, "Playtest coefficient, one splash per projectile.");
		WaterRadius = c.Bind<float>("Water Dragon", "Playable03Radius", 7.5f, "Splash metres.");
		WaterSpeed = c.Bind<float>("Water Dragon", "Speed", 38f, "Metres per second.");
		WaterLife = c.Bind<float>("Water Dragon", "Lifetime", 4f, "Seconds, long range capped by lifetime.");
		WaterCooldown = c.Bind<float>("Water Dragon", "Cooldown", 7f, "Seconds; starts on cast completion/interruption.");
		WaterProc = c.Bind<float>("Water Dragon", "Proc", 1f, "Per target splash coefficient.");
		KunaiDamage = c.Bind<float>("Flying Raijin", "KunaiDamage", 4f, "Each of the first two projectiles.");
		KunaiSpeed = c.Bind<float>("Flying Raijin", "Speed", 48f, "Projectile m/s.");
		AnchorLife = c.Bind<float>("Flying Raijin", "AnchorLifetime", 3f, "Expires without teleport.");
		RaijinCooldown = c.Bind<float>("Flying Raijin", "Cooldown", 9f, "Two base charges. One consumed per burst; free recast. Sequential recharge begins on state end.");
		KunaiProc = c.Bind<float>("Flying Raijin", "Proc", 0.8f, "First two kunai.");
		ArrivalRadius = c.Bind<float>("Flying Raijin", "ArrivalSearchRadius", 3f, "Maximum clearance search around impact, never through a wall.");
		TagHeight = c.Bind<float>("Tandem Tags", "FinalPlaytestVerticalSpan", 7f, "Vertical center segment of the damage capsule; horizontal radius is unchanged.");
		TagDamage = c.Bind<float>("Tandem Tags", "FinalPlaytestDamagePerPulse", 4.457143f, "Coefficient per pulse; repeated pulses intentional.");
		TagRadius = c.Bind<float>("Tandem Tags", "Playable03Radius", 11.25f, "Final area radius.");
		TagCooldown = c.Bind<float>("Tandem Tags", "Cooldown", 28f, "Seconds.");
		TagPulses = c.Bind<int>("Tandem Tags", "Playable03Pulses", 21, "Bounded to 1..32 authoritative damage pulses.");
		TagInterval = c.Bind<float>("Tandem Tags", "Playable03PulseInterval", 0.3f, "Seconds between authoritative pulses; default first-to-last detonation span is six seconds.");
		TagDelay = c.Bind<float>("Tandem Tags", "FirstPulseDelay", 1f, "Seconds after initial throw; includes travel/multiplication.");
		TagRange = c.Bind<float>("Tandem Tags", "MaxRange", 30f, "Aimed valid surface search range.");
		TagProc = c.Bind<float>("Tandem Tags", "Playable03ProcPerPulse", 0.06666666f, "Each deduplicated victim per pulse.");
	}
}
[Serializable]
public class DragonData
{
	public DragonMesh[] meshes;
}
[Serializable]
public class DragonMesh
{
	public string name;

	public float[] v;

	public float[] uv;

	public int[] tri;
}
public static class KitVfx
{
	public static GameObject splash;

	public static GameObject explosion;

	public static GameObject teleport;

	public static GameObject emerge;

	public static GameObject indicator;

	public static GameObject tagField;

	public static GameObject tagStop;

	public static readonly List<EffectDef> effects = new List<EffectDef>();

	public static Material water;

	public static Material foam;

	public static Material paper;

	public static Material metal;

	public static Material gold;

	public static Material glow;

	private static Mesh[] dragonMeshes;

	public static Material Material(Color color)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		Material val = new Material(Shader.Find("Hopoo Games/Deferred/Standard") ?? Shader.Find("Standard"));
		val.color = color;
		if (val.HasPrope