Decompiled source of Diavolo v2.5.4

plugins/Diavolo/Diavolo.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using HarmonyLib;
using KinematicCharacterController;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyFileVersion("2.5.4.0")]
[assembly: AssemblyVersion("2.5.4.0")]
namespace Diavolo;

public sealed class AudioCueMessage : INetMessage, ISerializableObject
{
	private GameObject owner;

	private string cue;

	private byte operation;

	public AudioCueMessage()
	{
	}

	public AudioCueMessage(GameObject owner, string cue, byte operation)
	{
		this.owner = owner;
		this.cue = cue;
		this.operation = operation;
	}

	public void Serialize(NetworkWriter w)
	{
		w.Write(owner);
		w.Write(cue);
		w.Write(operation);
	}

	public void Deserialize(NetworkReader r)
	{
		owner = r.ReadGameObject();
		cue = r.ReadString();
		operation = r.ReadByte();
	}

	public void OnReceived()
	{
		if (!NetworkServer.active && Object.op_Implicit((Object)(object)owner) && operation <= 5 && cue.Length < 80 && cue.IndexOfAny(new char[3] { '/', '\\', ':' }) < 0)
		{
			DiavoloAudio.Receive(owner.GetComponent<CharacterBody>(), cue, operation);
		}
	}
}
public sealed class BarrageTorsoPose
{
	private readonly Transform[] bones;

	private readonly Quaternion[] neutral;

	public BarrageTorsoPose(GameObject model)
	{
		List<Transform> list = new List<Transform>();
		Transform[] componentsInChildren = model.GetComponentsInChildren<Transform>();
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name.EndsWith(" body") || ((Object)val).name.EndsWith(" spine") || ((Object)val).name.EndsWith(" spine1") || ((Object)val).name.EndsWith(" spine2") || ((Object)val).name.EndsWith(" neck") || ((Object)val).name.EndsWith(" head"))
			{
				list.Add(val);
			}
		}
		bones = list.ToArray();
		neutral = (Quaternion[])(object)new Quaternion[bones.Length];
	}

	public void Capture()
	{
		//IL_0018: 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)
		for (int i = 0; i < bones.Length; i++)
		{
			ref Quaternion reference = ref neutral[i];
			reference = bones[i].localRotation;
		}
	}

	public void Apply()
	{
		//IL_0018: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < bones.Length; i++)
		{
			bones[i].localRotation = Quaternion.Slerp(neutral[i], bones[i].localRotation, 0.15f);
		}
	}
}
public sealed class BloodBlind : MonoBehaviour
{
	private CharacterBody body;

	private float until;

	private Vector3 position;

	private Quaternion rotation;

	private bool oldSkills;

	private readonly List<Behaviour> suspended = new List<Behaviour>();

	private Rigidbody rigid;

	private bool wasKinematic;

	private bool initialized;

	private bool restored;

	public static void Lock(CharacterBody body, float duration, Vector3 position, Quaternion rotation)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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 (NetworkServer.active && Object.op_Implicit((Object)(object)body) && !body.isPlayerControlled)
		{
			BloodBlind bloodBlind = ((Component)body).GetComponent<BloodBlind>();
			if (!Object.op_Implicit((Object)(object)bloodBlind))
			{
				bloodBlind = ((Component)body).gameObject.AddComponent<BloodBlind>();
			}
			bloodBlind.body = body;
			bloodBlind.position = position;
			bloodBlind.rotation = rotation;
			bloodBlind.until = Mathf.Max(bloodBlind.until, Time.time + duration);
			if (!bloodBlind.initialized)
			{
				bloodBlind.Suspend();
			}
		}
	}

	private void Pause(Behaviour component)
	{
		if (Object.op_Implicit((Object)(object)component) && component.enabled)
		{
			suspended.Add(component);
			component.enabled = false;
		}
	}

	private void Suspend()
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		initialized = true;
		oldSkills = body.allSkillsDisabled;
		body.allSkillsDisabled = true;
		if (Object.op_Implicit((Object)(object)body.master))
		{
			BaseAI[] components = ((Component)body.master).GetComponents<BaseAI>();
			foreach (BaseAI val in components)
			{
				val.currentEnemy.Reset();
				val.customTarget.Reset();
				Pause((Behaviour)(object)val);
			}
		}
		EntityStateMachine[] components2 = ((Component)body).GetComponents<EntityStateMachine>();
		foreach (EntityStateMachine val2 in components2)
		{
			val2.SetInterruptState((EntityState)new Idle(), (InterruptPriority)9);
		}
		if (Object.op_Implicit((Object)(object)body.characterMotor))
		{
			body.characterMotor.velocity = Vector3.zero;
			Pause((Behaviour)(object)body.characterMotor);
		}
		Behaviour[] components3 = ((Component)body).GetComponents<Behaviour>();
		foreach (Behaviour val3 in components3)
		{
			if (val3 is RigidbodyMotor || ((object)val3).GetType().Namespace == "KinematicCharacterController")
			{
				Pause(val3);
			}
		}
		Pause((Behaviour)(object)body.characterDirection);
		rigid = ((Component)body).GetComponent<Rigidbody>();
		if (Object.op_Implicit((Object)(object)rigid))
		{
			wasKinematic = rigid.isKinematic;
			rigid.isKinematic = true;
		}
	}

	private void FixedUpdate()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || Time.time >= until)
		{
			Object.Destroy((Object)(object)this);
			return;
		}
		((Component)body).transform.SetPositionAndRotation(position, rotation);
		if (Object.op_Implicit((Object)(object)body.characterMotor) && Object.op_Implicit((Object)(object)((BaseCharacterController)body.characterMotor).Motor))
		{
			((BaseCharacterController)body.characterMotor).Motor.SetPositionAndRotation(position, rotation, true);
		}
		if (Object.op_Implicit((Object)(object)body.characterMotor))
		{
			body.characterMotor.velocity = Vector3.zero;
		}
		if (Object.op_Implicit((Object)(object)body.inputBank))
		{
			body.inputBank.moveVector = Vector3.zero;
			((ButtonState)(ref body.inputBank.skill1)).PushState(false);
			((ButtonState)(ref body.inputBank.skill2)).PushState(false);
			((ButtonState)(ref body.inputBank.skill3)).PushState(false);
			((ButtonState)(ref body.inputBank.skill4)).PushState(false);
		}
	}

	public void Release(Vector3 launchVelocity)
	{
		//IL_0030: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		Restore();
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.characterMotor))
		{
			body.characterMotor.velocity = launchVelocity;
		}
		else if (Object.op_Implicit((Object)(object)rigid) && !rigid.isKinematic)
		{
			rigid.velocity = launchVelocity;
		}
		Object.Destroy((Object)(object)this);
	}

	private void OnDestroy()
	{
		Restore();
	}

	private void Restore()
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		if (!initialized || restored)
		{
			return;
		}
		restored = true;
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.characterMotor) && Object.op_Implicit((Object)(object)((BaseCharacterController)body.characterMotor).Motor))
		{
			((BaseCharacterController)body.characterMotor).Motor.SetPositionAndRotation(position, rotation, true);
		}
		foreach (Behaviour item in suspended)
		{
			if (Object.op_Implicit((Object)(object)item))
			{
				item.enabled = true;
			}
		}
		if (Object.op_Implicit((Object)(object)rigid))
		{
			rigid.isKinematic = wasKinematic;
		}
		if (!Object.op_Implicit((Object)(object)body))
		{
			return;
		}
		body.allSkillsDisabled = oldSkills;
		if (Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive)
		{
			EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				val.SetNextStateToMain();
			}
		}
	}
}
public static class BloodFx
{
	private static Material material;

	private static int emissionFrame;

	private static int emissions;

	private static readonly Queue<GameObject> pool = new Queue<GameObject>();

	internal static void Recycle(GameObject obj)
	{
		obj.SetActive(false);
		if (pool.Count < 24)
		{
			pool.Enqueue(obj);
		}
		else
		{
			Object.Destroy((Object)(object)obj);
		}
	}

	public static void Impact(Vector3 position, Vector3 direction, bool heavy)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		if (NetworkServer.active)
		{
			if (NetworkClient.active)
			{
				Spray(position, direction, heavy ? 230 : 12, thrown: false, heavy);
			}
			NetMessageExtensions.Send((INetMessage)(object)new BloodFxMessage(position, direction, heavy), (NetworkDestination)1);
		}
	}

	public static void Throw(Ray aim)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		Spray(((Ray)(ref aim)).origin + ((Ray)(ref aim)).direction * 0.7f, ((Ray)(ref aim)).direction, 85, thrown: true, heavy: false);
	}

	public static void Spray(Vector3 position, Vector3 direction, int count, bool thrown, bool heavy)
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Expected O, but got Unknown
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_010f: 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_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: 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_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_0354: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0376: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		if (emissionFrame != Time.frameCount)
		{
			emissionFrame = Time.frameCount;
			emissions = 0;
		}
		if (!thrown && emissions++ >= 12)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)material))
		{
			Shader val = DiavoloPresentation.Asset<Shader>("Assets/CrimsonFX.shader");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Texture2D val2 = new Texture2D(32, 32, (TextureFormat)4, false);
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					Vector2 val3 = new Vector2(((float)j - 15.5f) / 15f, ((float)i - 15.5f) / 15f);
					float magnitude = ((Vector2)(ref val3)).magnitude;
					val2.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01((1f - magnitude) * 6f)));
				}
			}
			val2.Apply();
			material = new Material(val);
			material.mainTexture = (Texture)(object)val2;
			material.SetColor("_Color", new Color(0.32f, 0.008f, 0.016f, 0.92f));
		}
		GameObject val4 = null;
		while (pool.Count > 0 && !Object.op_Implicit((Object)(object)val4))
		{
			val4 = pool.Dequeue();
		}
		if (!Object.op_Implicit((Object)(object)val4))
		{
			val4 = new GameObject("Crimson blood droplets");
			val4.AddComponent<ParticleSystem>();
			val4.AddComponent<BloodLifetime>();
		}
		val4.SetActive(true);
		val4.transform.SetPositionAndRotation(position, Quaternion.LookRotation((((Vector3)(ref direction)).sqrMagnitude > 0.001f) ? ((Vector3)(ref direction)).normalized : Vector3.up));
		ParticleSystem component = val4.GetComponent<ParticleSystem>();
		component.Stop(true, (ParticleSystemStopBehavior)0);
		MainModule main = component.main;
		((MainModule)(ref main)).loop = false;
		((MainModule)(ref main)).duration = 0.12f;
		((MainModule)(ref main)).maxParticles = count;
		((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
		((MainModule)(ref main)).startLifetime = new MinMaxCurve(thrown ? 0.78f : 0.2f, thrown ? 0.85f : (heavy ? 0.65f : 0.4f));
		((MainModule)(ref main)).startSpeed = new MinMaxCurve(thrown ? 60f : 3f, thrown ? 62f : (heavy ? 18f : 6f));
		((MainModule)(ref main)).startSize = new MinMaxCurve(thrown ? 0.055f : 0.04f, heavy ? 0.26f : 0.11f);
		((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(thrown ? 0.08f : 1.2f);
		EmissionModule emission = component.emission;
		((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
		((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
		{
			new Burst(0f, (short)count)
		});
		ShapeModule shape = component.shape;
		((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
		((ShapeModule)(ref shape)).angle = (thrown ? 6f : (heavy ? 48f : 30f));
		((ShapeModule)(ref shape)).radius = (thrown ? 0.06f : 0.12f);
		SizeOverLifetimeModule sizeOverLifetime = component.sizeOverLifetime;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, 0f));
		CollisionModule collision = component.collision;
		((CollisionModule)(ref collision)).enabled = false;
		((CollisionModule)(ref collision)).type = (ParticleSystemCollisionType)1;
		LayerIndex world = LayerIndex.world;
		((CollisionModule)(ref collision)).collidesWith = ((LayerIndex)(ref world)).mask;
		((CollisionModule)(ref collision)).lifetimeLoss = MinMaxCurve.op_Implicit(1f);
		((Renderer)((Component)component).GetComponent<ParticleSystemRenderer>()).sharedMaterial = material;
		component.Play();
		val4.GetComponent<BloodLifetime>().Expires = Time.time + 1.2f;
	}
}
public sealed class BloodLifetime : MonoBehaviour
{
	public float Expires;

	private void Update()
	{
		if (Time.time >= Expires)
		{
			BloodFx.Recycle(((Component)this).gameObject);
		}
	}
}
public sealed class BloodFxMessage : INetMessage, ISerializableObject
{
	private Vector3 position;

	private Vector3 direction;

	private bool heavy;

	public BloodFxMessage()
	{
	}

	public BloodFxMessage(Vector3 position, Vector3 direction, bool heavy)
	{
		//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_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		this.position = position;
		this.direction = direction;
		this.heavy = heavy;
	}

	public void Serialize(NetworkWriter writer)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		writer.Write(position);
		writer.Write(direction);
		writer.Write(heavy);
	}

	public void Deserialize(NetworkReader reader)
	{
		//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_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		position = reader.ReadVector3();
		direction = reader.ReadVector3();
		heavy = reader.ReadBoolean();
	}

	public void OnReceived()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			BloodFx.Spray(position, direction, heavy ? 230 : 12, thrown: false, heavy);
		}
	}
}
public enum TemporalAttack
{
	Ordinary,
	Blood,
	Impale
}
public enum AttackMoment
{
	Start,
	PreContact,
	Contact
}
public static class CombatRules
{
	public static bool EndsErasure(TemporalAttack attack, AttackMoment moment)
	{
		switch (attack)
		{
		case TemporalAttack.Blood:
			return false;
		case TemporalAttack.Impale:
			if (moment != AttackMoment.PreContact)
			{
				return moment == AttackMoment.Contact;
			}
			return true;
		default:
			return true;
		}
	}

	public static bool FullyCharged(float seconds)
	{
		return seconds >= 1.8f;
	}

	public static bool CounterUsesChop(float ownerHeight, float targetHeight)
	{
		return targetHeight > ownerHeight * 1.5f;
	}
}
public sealed class ComboSequence
{
	private int next;

	private float expires;

	public int Take(float now)
	{
		if (now > expires)
		{
			next = 0;
		}
		int result = next;
		next = (next + 1) % 5;
		expires = now + 10f;
		return result;
	}

	public void Finish(float now, bool landedSwing)
	{
		if (!landedSwing)
		{
			next = 0;
		}
		expires = now + 0.85f;
	}
}
public enum ControllerBinding
{
	Off = 0,
	DPad_Up = 1,
	DPad_Down = 2,
	DPad_Left = 4,
	DPad_Right = 8,
	L3 = 64,
	R3 = 128,
	LB = 256,
	RB = 512,
	LT = 1024,
	RT = 2048,
	A = 4096,
	B = 8192,
	X = 16384,
	Y = 32768,
	R3_DPad_Up = 129,
	R3_DPad_Down = 130,
	R3_DPad_Left = 132,
	R3_DPad_Right = 136,
	R3_A = 4224,
	R3_B = 8320,
	R3_X = 16512,
	R3_Y = 32896,
	R3_LB = 384,
	R3_RB = 640,
	R3_LT = 1152,
	R3_RT = 2176,
	L3_DPad_Up = 65,
	L3_DPad_Down = 66,
	L3_DPad_Left = 68,
	L3_DPad_Right = 72,
	L3_R3 = 192,
	Custom_config_mask = 65535
}
internal static class ControllerBindings
{
	internal static readonly List<ConfigEntry<ControllerBinding>> Choices = new List<ConfigEntry<ControllerBinding>>();

	internal static void Initialize(ConfigFile config)
	{
		int[] array = new int[8] { 0, 1, 2, 3, 5, 6, 7, 8 };
		string[] array2 = new string[8] { "Epitaph", "Blood Throw", "Barrage (hold)", "Counter", "Puttsun Cancel", "Downward Chop", "Ground Smash", "Final Verdict" };
		for (int i = 0; i < array.Length; i++)
		{
			Bind(config, array2[i], Plugin.GamepadMoves[array[i]]);
		}
		Bind(config, "Block (hold)", Plugin.BlockPad);
		Bind(config, "Directional Stand Jump", Plugin.JumpPad);
	}

	private static ControllerBinding FromMask(ushort mask)
	{
		if (!Enum.IsDefined(typeof(ControllerBinding), (int)mask))
		{
			return ControllerBinding.Custom_config_mask;
		}
		return (ControllerBinding)mask;
	}

	private static void Bind(ConfigFile config, string name, ConfigEntry<ushort> legacy)
	{
		ConfigEntry<ControllerBinding> entry = config.Bind<ControllerBinding>("Controller Bindings", name, FromMask(legacy.Value), "Choose a button or chord. R3 = right stick click; L3 = left stick click. Hold R3 before pressing the trigger/button. While R3 is held, normal skills and bindings without R3 are blocked. Release the trigger/button before using it normally again. Custom_config_mask preserves your numeric Gamepad binding.");
		bool syncing = false;
		entry.SettingChanged += delegate
		{
			if (!syncing && entry.Value != ControllerBinding.Custom_config_mask)
			{
				syncing = true;
				legacy.Value = (ushort)entry.Value;
				syncing = false;
			}
		};
		legacy.SettingChanged += delegate
		{
			if (!syncing)
			{
				syncing = true;
				entry.Value = FromMask(legacy.Value);
				syncing = false;
			}
		};
		if (entry.Value != ControllerBinding.Custom_config_mask)
		{
			legacy.Value = (ushort)entry.Value;
		}
		Choices.Add(entry);
	}
}
public sealed class ErasureVisible : MonoBehaviour
{
}
public sealed class CosmicErasure : MonoBehaviour
{
	private CharacterBody owner;

	private TemporalController time;

	private GroundHologram ground;

	private PostProcessLayer cameraPostProcess;

	private bool postProcessWasEnabled;

	private GameObject sky;

	private Material skyMaterial;

	private Material rockMaterial;

	private Renderer[] scenery = (Renderer[])(object)new Renderer[0];

	private Terrain[] terrains = (Terrain[])(object)new Terrain[0];

	private float began;

	private float nextFloorProbe;

	private Vector3 groundCenter;

	private bool active;

	private bool caching;

	private bool cached;

	private Camera alteredCamera;

	private CameraClearFlags originalClear;

	private Color originalBackground;

	private readonly Dictionary<Renderer, bool> restore = new Dictionary<Renderer, bool>();

	private readonly Dictionary<Terrain, bool> restoreTerrain = new Dictionary<Terrain, bool>();

	private readonly Dictionary<Terrain, bool> restoreFoliage = new Dictionary<Terrain, bool>();

	private readonly List<GameObject> rocks = new List<GameObject>();

	public bool Active => active;

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

	private IEnumerator CacheScenery()
	{
		caching = true;
		yield return null;
		Renderer[] all = Object.FindObjectsOfType<Renderer>();
		List<Renderer> world = new List<Renderer>(all.Length);
		for (int i = 0; i < all.Length; i++)
		{
			if (Plugin.LowVfx.Value)
			{
				caching = false;
				yield break;
			}
			Renderer r = all[i];
			if (Object.op_Implicit((Object)(object)r) && !(r is ParticleSystemRenderer) && !Object.op_Implicit((Object)(object)((Component)r).GetComponentInParent<ErasureVisible>()) && !Object.op_Implicit((Object)(object)((Component)r).GetComponentInParent<CharacterBody>()) && !Object.op_Implicit((Object)(object)((Component)r).GetComponentInParent<CharacterModel>()))
			{
				world.Add(r);
			}
			if (i % 128 == 127)
			{
				yield return null;
			}
		}
		scenery = world.ToArray();
		terrains = Object.FindObjectsOfType<Terrain>();
		cached = true;
		caching = false;
	}

	private void OnEnable()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		SceneCamera.onSceneCameraPreCull += new SceneCameraDelegate(BeforeCamera);
		SceneCamera.onSceneCameraPostRender += new SceneCameraDelegate(AfterCamera);
	}

	private bool IsLocal()
	{
		foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
		{
			if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)owner)
			{
				return true;
			}
		}
		return false;
	}

	private void Update()
	{
		bool flag = !Plugin.LowVfx.Value && Plugin.CosmicWorld.Value && Object.op_Implicit((Object)(object)time) && time.Erasing && Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)owner.healthComponent) && owner.healthComponent.alive && IsLocal();
		if (flag && !cached && !caching)
		{
			((MonoBehaviour)this).StartCoroutine(CacheScenery());
		}
		if (flag && cached && !active)
		{
			Begin();
		}
		else if (!flag && active)
		{
			End();
		}
		if (!active)
		{
			return;
		}
		foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
		{
			if (!((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)owner) || !Object.op_Implicit((Object)(object)readOnlyLocalUsers.cameraRigController) || !Object.op_Implicit((Object)(object)readOnlyLocalUsers.cameraRigController.sceneCam))
			{
				continue;
			}
			PostProcessLayer component = ((Component)readOnlyLocalUsers.cameraRigController.sceneCam).GetComponent<PostProcessLayer>();
			if ((Object)(object)cameraPostProcess != (Object)(object)component)
			{
				RestorePostProcess();
				cameraPostProcess = component;
				if (Object.op_Implicit((Object)(object)component))
				{
					postProcessWasEnabled = ((Behaviour)component).enabled;
				}
			}
			if (Object.op_Implicit((Object)(object)cameraPostProcess))
			{
				((Behaviour)cameraPostProcess).enabled = false;
			}
		}
	}

	private void Begin()
	{
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Expected O, but got Unknown
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		Shader val = DiavoloPresentation.Asset<Shader>("Assets/CosmicVoid.shader");
		if (Object.op_Implicit((Object)(object)val) && val.isSupported)
		{
			active = true;
			began = Time.time;
			Shader val2 = DiavoloPresentation.Asset<Shader>("Assets/GroundHologram.shader");
			if (Object.op_Implicit((Object)(object)val2) && val2.isSupported)
			{
				ground = new GroundHologram(val2);
			}
			sky = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)sky).name = "Erased-time cosmic void";
			Collider component = sky.GetComponent<Collider>();
			component.enabled = false;
			Object.Destroy((Object)(object)component);
			sky.AddComponent<ErasureVisible>();
			skyMaterial = new Material(val);
			sky.GetComponent<Renderer>().sharedMaterial = skyMaterial;
			sky.SetActive(false);
			Shader val3 = DiavoloPresentation.Asset<Shader>("Assets/CrimsonModel.shader");
			if (Object.op_Implicit((Object)(object)val3))
			{
				rockMaterial = new Material(val3);
				rockMaterial.color = new Color(0.18f, 0.13f, 0.17f);
				SpawnFragments();
			}
		}
	}

	private void SpawnFragments()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//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_006d: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f9: 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)
		RaycastHit val3 = default(RaycastHit);
		for (int i = 0; i < 24; i++)
		{
			Vector2 val = Random.insideUnitCircle * 24f;
			Vector3 val2 = owner.corePosition + new Vector3(val.x, 12f, val.y);
			Vector3 down = Vector3.down;
			LayerIndex world = LayerIndex.world;
			if (Physics.Raycast(val2, down, ref val3, 24f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) && !(Mathf.Abs(((RaycastHit)(ref val3)).point.y - owner.footPosition.y) > 6f))
			{
				GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)3);
				((Object)val4).name = "Erased world fragment";
				Collider component = val4.GetComponent<Collider>();
				component.enabled = false;
				Object.Destroy((Object)(object)component);
				val4.AddComponent<ErasureVisible>();
				val4.transform.position = ((RaycastHit)(ref val3)).point - Vector3.up * 0.15f;
				val4.transform.rotation = Random.rotation;
				val4.transform.localScale = new Vector3(Random.Range(0.4f, 1.4f), Random.Range(0.3f, 0.8f), Random.Range(0.4f, 1.4f));
				val4.GetComponent<Renderer>().sharedMaterial = rockMaterial;
				val4.AddComponent<ErasureFragment>();
				rocks.Add(val4);
			}
		}
	}

	private void BeforeCamera(SceneCamera camera)
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0089: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		if (!active || !Object.op_Implicit((Object)(object)camera) || !Object.op_Implicit((Object)(object)camera.cameraRigController) || (Object)(object)camera.cameraRigController.targetBody != (Object)(object)owner || !Object.op_Implicit((Object)(object)sky))
		{
			return;
		}
		Restore();
		alteredCamera = camera.camera;
		originalClear = alteredCamera.clearFlags;
		originalBackground = alteredCamera.backgroundColor;
		alteredCamera.clearFlags = (CameraClearFlags)2;
		alteredCamera.backgroundColor = Color.black;
		sky.transform.position = ((Component)camera.camera).transform.position;
		sky.transform.localScale = Vector3.one * Mathf.Min(1600f, camera.camera.farClipPlane * 1.5f);
		sky.SetActive(true);
		float num = Mathf.Lerp(0f, 3000f, Mathf.Clamp01((Time.time - began) / 0.85f));
		Renderer[] array = scenery;
		foreach (Renderer val in array)
		{
			if (Object.op_Implicit((Object)(object)val))
			{
				Bounds bounds = val.bounds;
				if (!(((Bounds)(ref bounds)).SqrDistance(owner.corePosition) > num * num))
				{
					restore[val] = val.forceRenderingOff;
					val.forceRenderingOff = true;
				}
			}
		}
		if (Time.time - began > 0.35f)
		{
			Terrain[] array2 = terrains;
			foreach (Terrain val2 in array2)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					restoreTerrain[val2] = val2.drawHeightmap;
					val2.drawHeightmap = false;
					restoreFoliage[val2] = val2.drawTreesAndFoliage;
					val2.drawTreesAndFoliage = false;
				}
			}
		}
		if (Time.time >= nextFloorProbe)
		{
			nextFloorProbe = Time.time + 0.2f;
			groundCenter = owner.footPosition;
			Vector3 val3 = groundCenter + Vector3.up * 2f;
			Vector3 down = Vector3.down;
			LayerIndex world = LayerIndex.world;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val3, down, ref val4, 1000f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				groundCenter.y = ((RaycastHit)(ref val4)).point.y;
			}
		}
		groundCenter.x = owner.footPosition.x;
		groundCenter.z = owner.footPosition.z;
		if (ground != null)
		{
			ground.Draw(camera.camera, restore, terrains, groundCenter, Mathf.Clamp01((Time.time - began - 0.25f) / 0.6f));
		}
	}

	private void AfterCamera(SceneCamera camera)
	{
		Restore();
		if (Object.op_Implicit((Object)(object)sky))
		{
			sky.SetActive(false);
		}
	}

	private void Restore()
	{
		//IL_0027: 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)
		if (ground != null)
		{
			ground.Detach();
		}
		if (Object.op_Implicit((Object)(object)alteredCamera))
		{
			alteredCamera.clearFlags = originalClear;
			alteredCamera.backgroundColor = originalBackground;
			alteredCamera = null;
		}
		foreach (KeyValuePair<Renderer, bool> item in restore)
		{
			if (Object.op_Implicit((Object)(object)item.Key))
			{
				item.Key.forceRenderingOff = item.Value;
			}
		}
		restore.Clear();
		foreach (KeyValuePair<Terrain, bool> item2 in restoreTerrain)
		{
			if (Object.op_Implicit((Object)(object)item2.Key))
			{
				item2.Key.drawHeightmap = item2.Value;
			}
		}
		restoreTerrain.Clear();
		foreach (KeyValuePair<Terrain, bool> item3 in restoreFoliage)
		{
			if (Object.op_Implicit((Object)(object)item3.Key))
			{
				item3.Key.drawTreesAndFoliage = item3.Value;
			}
		}
		restoreFoliage.Clear();
	}

	private void RestorePostProcess()
	{
		if (Object.op_Implicit((Object)(object)cameraPostProcess))
		{
			((Behaviour)cameraPostProcess).enabled = postProcessWasEnabled;
		}
		cameraPostProcess = null;
	}

	private void End()
	{
		RestorePostProcess();
		active = false;
		Restore();
		if (ground != null)
		{
			ground.Dispose();
			ground = null;
		}
		if (Object.op_Implicit((Object)(object)sky))
		{
			Object.Destroy((Object)(object)sky);
		}
		if (Object.op_Implicit((Object)(object)skyMaterial))
		{
			Object.Destroy((Object)(object)skyMaterial);
		}
		foreach (GameObject rock in rocks)
		{
			if (Object.op_Implicit((Object)(object)rock))
			{
				Object.Destroy((Object)(object)rock);
			}
		}
		rocks.Clear();
		if (Object.op_Implicit((Object)(object)rockMaterial))
		{
			Object.Destroy((Object)(object)rockMaterial);
		}
	}

	private void OnDisable()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		SceneCamera.onSceneCameraPreCull -= new SceneCameraDelegate(BeforeCamera);
		SceneCamera.onSceneCameraPostRender -= new SceneCameraDelegate(AfterCamera);
		End();
	}
}
public sealed class ErasureFragment : MonoBehaviour
{
	private float born;

	private Vector3 size;

	private Vector3 spin;

	private float speed;

	private void Awake()
	{
		//IL_0012: 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)
		//IL_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references)
		born = Time.time;
		size = ((Component)this).transform.localScale;
		spin = Random.onUnitSphere * 120f;
		speed = Random.Range(2f, 5f);
	}

	private void Update()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		float num = Time.time - born;
		Transform transform = ((Component)this).transform;
		transform.position += Vector3.up * speed * Time.deltaTime;
		((Component)this).transform.Rotate(spin * Time.deltaTime);
		((Component)this).transform.localScale = size * Mathf.Clamp01((1.4f - num) / 0.65f);
		if (num >= 1.4f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public sealed class CounterController : MonoBehaviour
{
	private float expires;

	private CharacterBody body;

	private CharacterBody attacker;

	private float strikeAt;

	private bool chop;

	public bool Posing { get; private set; }

	internal static void Install()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Expected O, but got Unknown
		Harmony val = new Harmony("local.diavolo.damage");
		string[] array = new string[1] { "TakeDamageProcess" };
		foreach (string text in array)
		{
			val.Patch((MethodBase)AccessTools.Method(typeof(HealthComponent), text, new Type[1] { typeof(DamageInfo) }, (Type[])null), new HarmonyMethod(typeof(CounterController), "Intercept", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		MethodInfo methodInfo = AccessTools.Method(typeof(HealthComponent), "TakeDamageProcess", new Type[1] { typeof(DamageInfo) }, (Type[])null);
		HarmonyMethod val2 = new HarmonyMethod(typeof(CounterController), "Ambush", (Type[])null);
		val2.priority = 0;
		val.Patch((MethodBase)methodInfo, val2, new HarmonyMethod(typeof(CounterController), "FinishAmbush", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo[] methods = typeof(HealthComponent).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		foreach (MethodInfo methodInfo2 in methods)
		{
			ParameterInfo[] parameters = methodInfo2.GetParameters();
			if (methodInfo2.Name == "Suicide" && parameters.Length > 0 && parameters[0].ParameterType == typeof(GameObject))
			{
				val.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(CounterController), "InterceptDeath", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
	}

	private static bool InterceptDeath(HealthComponent __instance, GameObject __0)
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Expected O, but got Unknown
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)__instance.body))
		{
			return true;
		}
		if (Object.op_Implicit((Object)(object)((Component)__instance.body).GetComponent<TimeEraseDecoy>()))
		{
			return false;
		}
		TemporalController component = ((Component)__instance.body).GetComponent<TemporalController>();
		if (Object.op_Implicit((Object)(object)component) && component.Dodging)
		{
			component.Dodge();
			return false;
		}
		if (!Object.op_Implicit((Object)(object)__0))
		{
			return true;
		}
		DamageInfo val = new DamageInfo();
		val.attacker = __0;
		return Intercept(__instance, val);
	}

	private static bool Intercept(HealthComponent __instance, DamageInfo damageInfo)
	{
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Invalid comparison between Unknown and I4
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)__instance.body) || damageInfo == null)
		{
			return true;
		}
		if (Object.op_Implicit((Object)(object)((Component)__instance.body).GetComponent<TimeEraseDecoy>()) || (Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<TimeEraseDecoy>())))
		{
			CounterController component = ((Component)__instance.body).GetComponent<CounterController>();
			if (Object.op_Implicit((Object)(object)((Component)__instance.body).GetComponent<TimeEraseDecoy>()) && Object.op_Implicit((Object)(object)component) && component.Posing)
			{
				component.Trigger(damageInfo.attacker);
			}
			damageInfo.damage = 0f;
			damageInfo.procCoefficient = 0f;
			damageInfo.rejected = true;
			return false;
		}
		CharacterBody val = __instance.body;
		TemporalController component2 = ((Component)val).GetComponent<TemporalController>();
		if (Object.op_Implicit((Object)(object)component2) && component2.Dodging)
		{
			damageInfo.rejected = true;
			component2.Dodge();
			return false;
		}
		CounterController component3 = ((Component)val).GetComponent<CounterController>();
		if (Object.op_Implicit((Object)(object)component3) && component3.Posing && Time.time <= component3.expires)
		{
			damageInfo.rejected = true;
			component3.Trigger(damageInfo.attacker);
			return false;
		}
		if (Object.op_Implicit((Object)(object)component2) && component2.Erasing)
		{
			damageInfo.rejected = true;
			return false;
		}
		StandDefense component4 = ((Component)val).GetComponent<StandDefense>();
		if (Object.op_Implicit((Object)(object)component4) && component4.Blocking && (int)damageInfo.dotIndex == -1 && (int)DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)64)) == 0)
		{
			Vector3 val2 = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? (damageInfo.attacker.transform.position - val.corePosition) : (damageInfo.position - val.corePosition));
			if (((Vector3)(ref val2)).sqrMagnitude > 0.01f && Vector3.Dot(val.inputBank.aimDirection, ((Vector3)(ref val2)).normalized) >= 0.25f)
			{
				damageInfo.damage *= 0.15f;
			}
		}
		return true;
	}

	private static void Ambush(HealthComponent __instance, DamageInfo damageInfo, out TemporalController __state)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Invalid comparison between Unknown and I4
		__state = null;
		if (NetworkServer.active && damageInfo != null && !damageInfo.rejected && !(damageInfo.damage <= 0f) && (int)damageInfo.dotIndex == -1 && !(damageInfo.procCoefficient <= 0f) && Object.op_Implicit((Object)(object)damageInfo.attacker))
		{
			TemporalController component = damageInfo.attacker.GetComponent<TemporalController>();
			if (Object.op_Implicit((Object)(object)component) && TemporalController.IsEnemy(damageInfo.attacker.GetComponent<CharacterBody>(), __instance.body) && component.TakeAmbush())
			{
				damageInfo.damage *= 2f;
				__state = component;
			}
		}
	}

	private static void FinishAmbush(DamageInfo damageInfo, TemporalController __state)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Invalid comparison between Unknown and I4
		//IL_00bd: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)__state) && damageInfo.rejected)
		{
			damageInfo.damage *= 0.5f;
			__state.RestoreAmbush();
		}
		if (!NetworkServer.active || damageInfo.rejected || damageInfo.damage <= 0f || (int)damageInfo.dotIndex != -1 || damageInfo.procCoefficient <= 0f || !Object.op_Implicit((Object)(object)damageInfo.attacker))
		{
			return;
		}
		DiavoloPresentation component = damageInfo.attacker.GetComponent<DiavoloPresentation>();
		if (!Object.op_Implicit((Object)(object)component) || Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<TimeEraseDecoy>()))
		{
			return;
		}
		string currentMove = component.CurrentMove;
		if (!string.IsNullOrEmpty(currentMove))
		{
			if (currentMove == "barrage")
			{
				DiavoloAudio.Impact(((Component)component).GetComponent<CharacterBody>(), "barrage_hit");
			}
			BloodFx.Impact(damageInfo.position, damageInfo.position - damageInfo.attacker.transform.position, currentMove == "impale" || currentMove == "chop");
		}
	}

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

	public void Begin()
	{
		Posing = true;
		expires = Time.time + 2.5f;
	}

	public void StopPose()
	{
		Posing = false;
	}

	private void Trigger(GameObject source)
	{
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: 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_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: 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_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		Posing = false;
		CharacterBody val = (Object.op_Implicit((Object)(object)source) ? source.GetComponent<CharacterBody>() : null);
		if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)source))
		{
			CharacterMaster component = source.GetComponent<CharacterMaster>();
			if (Object.op_Implicit((Object)(object)component))
			{
				val = component.GetBody();
			}
		}
		if (!TemporalController.IsEnemy(body, val))
		{
			val = null;
			float num = 60f;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (TemporalController.IsEnemy(body, readOnlyInstances))
				{
					float num2 = Vector3.Distance(body.corePosition, readOnlyInstances.corePosition);
					if (num2 < num)
					{
						num = num2;
						val = readOnlyInstances;
					}
				}
			}
		}
		((Component)this).GetComponent<TemporalController>().BreakForAttack();
		TimeOverlay.Send(body, 2);
		if (Object.op_Implicit((Object)(object)val))
		{
			Vector3 val2 = (Object.op_Implicit((Object)(object)val.characterDirection) ? val.characterDirection.forward : ((Component)val).transform.forward);
			val2.y = 0f;
			((Vector3)(ref val2)).Normalize();
			Vector3 val3 = ((Component)val).transform.position - val2 * (val.radius + body.radius + 1f);
			Vector3 val4 = val3 - val.corePosition;
			Vector3 corePosition = val.corePosition;
			float num3 = Mathf.Max(0.25f, body.radius);
			Vector3 normalized = ((Vector3)(ref val4)).normalized;
			float magnitude = ((Vector3)(ref val4)).magnitude;
			LayerIndex world = LayerIndex.world;
			RaycastHit val5 = default(RaycastHit);
			if (Physics.SphereCast(corePosition, num3, normalized, ref val5, magnitude, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				val3 = val.corePosition + ((Vector3)(ref val4)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - 0.2f);
			}
			TeleportHelper.TeleportGameObject(((Component)this).gameObject, val3);
			Vector3 val6 = val.corePosition - body.corePosition;
			Vector3 normalized2 = ((Vector3)(ref val6)).normalized;
			body.inputBank.aimDirection = normalized2;
			if (Object.op_Implicit((Object)(object)body.characterDirection))
			{
				body.characterDirection.forward = normalized2;
			}
			float ownerHeight = Height(body);
			float targetHeight = Height(val);
			chop = CombatRules.CounterUsesChop(ownerHeight, targetHeight);
			attacker = val;
			strikeAt = Time.time + 0.16f;
			if (!val.isPlayerControlled)
			{
				BloodBlind.Lock(val, 0.35f, ((Component)val).transform.position, ((Component)val).transform.rotation);
			}
			if (NetworkServer.active)
			{
				body.AddTimedBuff(Buffs.HiddenInvincibility, 0.45f);
			}
		}
		ShowCounter(chop);
		NetMessageExtensions.Send((INetMessage)(object)new TemporalMessage(((Component)this).gameObject, (byte)(chop ? 4u : 3u), new List<FateMark>()), (NetworkDestination)1);
	}

	internal void ShowCounter(bool useChop)
	{
		Posing = false;
		DiavoloPresentation component = ((Component)this).GetComponent<DiavoloPresentation>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.Attack(useChop ? "chop" : "impale", 0.6f);
		}
	}

	private static float Height(CharacterBody target)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		CapsuleCollider component = ((Component)target).GetComponent<CapsuleCollider>();
		if (Object.op_Implicit((Object)(object)component))
		{
			return component.height * Mathf.Abs(((Component)component).transform.lossyScale.y);
		}
		if (Object.op_Implicit((Object)(object)target.mainHurtBox))
		{
			Collider component2 = ((Component)target.mainHurtBox).GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				Bounds bounds = component2.bounds;
				return ((Bounds)(ref bounds)).size.y;
			}
		}
		return Mathf.Max(1f, target.radius * 2f);
	}

	private void FixedUpdate()
	{
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		if (Time.time > expires)
		{
			Posing = false;
		}
		if (NetworkServer.active && Object.op_Implicit((Object)(object)attacker) && !(Time.time < strikeAt))
		{
			CharacterBody val = attacker;
			attacker = null;
			if (body.healthComponent.alive && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive)
			{
				DamageInfo val2 = new DamageInfo();
				val2.attacker = ((Component)this).gameObject;
				val2.inflictor = ((Component)this).gameObject;
				val2.damage = body.damage * (chop ? 12f : 18f);
				val2.crit = body.RollCrit();
				val2.procCoefficient = 1f;
				val2.position = val.corePosition;
				val2.damageType = DamageTypeCombo.op_Implicit((DamageType)(chop ? 1024 : 0));
				DamageInfo val3 = val2;
				val.healthComponent.TakeDamage(val3);
				GlobalEventManager.instance.OnHitEnemy(val3, ((Component)val).gameObject);
				GlobalEventManager.instance.OnHitAll(val3, ((Component)val).gameObject);
			}
		}
	}

	private void OnDisable()
	{
		Posing = false;
		attacker = null;
	}
}
public sealed class CounterPose : BaseSkillState
{
	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		((EntityState)this).GetComponent<CounterController>().Begin();
		DiavoloPresentation component = ((EntityState)this).GetComponent<DiavoloPresentation>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.Attack("counter", 2.5f);
		}
	}

	public override void FixedUpdate()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
		{
			Vector3 velocity = ((EntityState)this).characterMotor.velocity;
			velocity.x = 0f;
			velocity.z = 0f;
			((EntityState)this).characterMotor.velocity = velocity;
		}
		if (((EntityState)this).isAuthority && (((EntityState)this).fixedAge >= 2.5f || !((EntityState)this).GetComponent<CounterController>().Posing))
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		((EntityState)this).GetComponent<CounterController>().StopPose();
		((EntityState)this).OnExit();
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)7;
	}
}
public sealed class CrimsonChainTracker : MonoBehaviour
{
	public readonly ComboSequence Sequence = new ComboSequence();
}
public abstract class CrimsonState : BaseSkillState
{
	protected void BeginAttack(string animation, float duration)
	{
		TemporalController component = ((EntityState)this).GetComponent<TemporalController>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.BreakForAttack();
		}
		DiavoloPresentation component2 = ((EntityState)this).GetComponent<DiavoloPresentation>();
		if (Object.op_Implicit((Object)(object)component2))
		{
			component2.Attack(animation, duration);
		}
		((BaseState)this).StartAimMode(duration + 1f, false);
	}

	protected void Strike(float coefficient, float reach, float radius, DamageType type = (DamageType)0u)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//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_003d: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		Ray aimRay = ((BaseState)this).GetAimRay();
		if (NetworkServer.active)
		{
			BulletAttack val = new BulletAttack();
			val.owner = ((EntityState)this).gameObject;
			val.weapon = ((EntityState)this).gameObject;
			val.origin = ((Ray)(ref aimRay)).origin;
			val.aimVector = ((Ray)(ref aimRay)).direction;
			val.minSpread = 0f;
			val.maxSpread = 0f;
			val.bulletCount = 1u;
			val.damage = ((BaseState)this).damageStat * coefficient;
			val.force = 180f;
			val.radius = radius;
			val.maxDistance = reach;
			val.isCrit = ((BaseState)this).RollCrit();
			val.procCoefficient = 1f;
			val.falloffModel = (FalloffModel)0;
			val.damageType = DamageTypeCombo.op_Implicit(type);
			val.smartCollision = true;
			LayerIndex world = LayerIndex.world;
			val.stopperMask = ((LayerIndex)(ref world)).mask;
			val.hitEffectPrefab = null;
			val.Fire();
		}
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)2;
	}
}
public sealed class CrimsonChain : CrimsonState
{
	public int Step;

	private float duration;

	private bool fired;

	private CrimsonChainTracker tracker;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		tracker = ((EntityState)this).GetComponent<CrimsonChainTracker>();
		if (!Object.op_Implicit((Object)(object)tracker) && ((EntityState)this).isAuthority)
		{
			tracker = ((EntityState)this).gameObject.AddComponent<CrimsonChainTracker>();
		}
		if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)tracker))
		{
			Step = tracker.Sequence.Take(Time.time);
		}
		Step = Mathf.Clamp(Step, 0, 4);
		if (Step < 3)
		{
			duration = ((Step == 3) ? 0.48f : ((Step == 2) ? 0.55f : 0.36f)) / (0.85f * ((BaseState)this).attackSpeedStat);
			BeginAttack((Step == 3) ? "chop" : ("chain" + (Step + 1)), duration);
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (Step >= 3)
		{
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)((Step == 3) ? ((CrimsonState)new GrabThrow
				{
					Chain = true
				}) : ((CrimsonState)new GroundSmash
				{
					Chain = true
				})));
			}
			return;
		}
		if (!fired && ((EntityState)this).fixedAge >= duration * ((Step == 3) ? 0.25f : 0.35f))
		{
			fired = true;
			Strike((Step == 0) ? 3f : ((Step == 1) ? 3.5f : 6f), 8f, 1.6f, (DamageType)((Step == 3) ? 1024 : 0));
			DiavoloAudio.Impact(((EntityState)this).characterBody, (Step == 3) ? "impact_chop" : ((Step == 2) ? "impact_heavy" : "impact_light"));
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)tracker) && Step < 3)
		{
			tracker.Sequence.Finish(Time.time, fired);
		}
		((EntityState)this).OnExit();
	}

	public override void OnSerialize(NetworkWriter writer)
	{
		((BaseSkillState)this).OnSerialize(writer);
		writer.Write(Step);
	}

	public override void OnDeserialize(NetworkReader reader)
	{
		((BaseSkillState)this).OnDeserialize(reader);
		Step = reader.ReadInt32();
	}
}
public sealed class CrimsonFx : MonoBehaviour
{
	private Material material;

	private float born;

	private float duration;

	private float size;

	private static Mesh quad;

	public static void Burst(Vector3 position, string texture, float size, float duration)
	{
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//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_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		Shader val = DiavoloPresentation.Asset<Shader>("Assets/CrimsonFX.shader");
		Texture val2 = (Texture)(object)DiavoloPresentation.Asset<Texture2D>("Assets/Textures/" + texture + ".png");
		if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
		{
			if (!Object.op_Implicit((Object)(object)quad))
			{
				Mesh val3 = new Mesh();
				((Object)val3).name = "Crimson effect quad";
				quad = val3;
				quad.vertices = (Vector3[])(object)new Vector3[4]
				{
					new Vector3(-0.5f, -0.5f),
					new Vector3(0.5f, -0.5f),
					new Vector3(0.5f, 0.5f),
					new Vector3(-0.5f, 0.5f)
				};
				quad.uv = (Vector2[])(object)new Vector2[4]
				{
					Vector2.zero,
					Vector2.right,
					Vector2.one,
					Vector2.up
				};
				quad.triangles = new int[6] { 0, 1, 2, 0, 2, 3 };
				quad.RecalculateBounds();
			}
			GameObject val4 = new GameObject("EOH Crimson effect");
			val4.transform.position = position;
			val4.AddComponent<MeshFilter>().sharedMesh = quad;
			CrimsonFx crimsonFx = val4.AddComponent<CrimsonFx>();
			crimsonFx.material = new Material(val);
			crimsonFx.material.mainTexture = val2;
			((Renderer)val4.AddComponent<MeshRenderer>()).sharedMaterial = crimsonFx.material;
			crimsonFx.born = Time.time;
			crimsonFx.duration = duration;
			crimsonFx.size = size;
		}
	}

	private void LateUpdate()
	{
		//IL_0054: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		float num = (Time.time - born) / duration;
		if (num >= 1f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		if (Object.op_Implicit((Object)(object)Camera.main))
		{
			((Component)this).transform.rotation = ((Component)Camera.main).transform.rotation;
		}
		((Component)this).transform.localScale = Vector3.one * size * Mathf.Lerp(0.6f, 1.3f, num);
		material.SetColor("_Color", new Color(1f, 0.08f, 0.18f, (1f - num) * 0.8f));
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)material))
		{
			Object.Destroy((Object)(object)material);
		}
	}
}
public static class CrimsonPose
{
	public static Vector3 VisualPosition(Transform space, Transform bone)
	{
		//IL_0010: 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_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)space))
		{
			return bone.position;
		}
		return space.position + (bone.position - space.position) * Mathf.Abs(space.lossyScale.x);
	}

	public static void Arm(Transform hand, Transform space, Vector3 target, Vector3 bend)
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: 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_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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: 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_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)hand) || !Object.op_Implicit((Object)(object)hand.parent) || !Object.op_Implicit((Object)(object)hand.parent.parent))
		{
			return;
		}
		Transform parent = hand.parent;
		Transform parent2 = parent.parent;
		if (Object.op_Implicit((Object)(object)space))
		{
			target = space.position + (target - space.position) / Mathf.Max(0.0001f, Mathf.Abs(space.lossyScale.x));
		}
		Vector3 position = parent2.position;
		Vector3 val = target - position;
		float num = Vector3.Distance(position, parent.position);
		float num2 = Vector3.Distance(parent.position, hand.position);
		if (!(num < 1E-05f) && !(num2 < 1E-05f) && !(((Vector3)(ref val)).sqrMagnitude < 1E-05f))
		{
			float num3 = Mathf.Clamp(((Vector3)(ref val)).magnitude, Mathf.Abs(num - num2) + 1E-05f, num + num2 - 1E-05f);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			float num4 = (num * num - num2 * num2 + num3 * num3) / (2f * num3);
			Vector3 val2 = Vector3.ProjectOnPlane(bend, normalized);
			Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
			if (((Vector3)(ref normalized2)).sqrMagnitude < 0.01f)
			{
				Vector3 val3 = Vector3.Cross(normalized, Vector3.up);
				normalized2 = ((Vector3)(ref val3)).normalized;
			}
			Vector3 val4 = position + normalized * num4 + normalized2 * Mathf.Sqrt(Mathf.Max(0f, num * num - num4 * num4));
			parent2.rotation = Quaternion.FromToRotation(parent.position - position, val4 - position) * parent2.rotation;
			parent.rotation = Quaternion.FromToRotation(hand.position - parent.position, position + normalized * num3 - parent.position) * parent.rotation;
		}
	}
}
public sealed class CrimsonSpikes : MonoBehaviour
{
	private Mesh mesh;

	private Material material;

	private float born;

	private float height;

	private Vector3 origin;

	public static void Create(Vector3[] ground, float victimHeight, float victimWidth)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Expected O, but got Unknown
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		if (ground == null || ground.Length != 3)
		{
			return;
		}
		Shader val = DiavoloPresentation.Asset<Shader>("Assets/CrimsonModel.shader");
		if (Object.op_Implicit((Object)(object)val))
		{
			for (int i = 0; i < 3; i++)
			{
				GameObject val2 = new GameObject("King Crimson ground spike " + (i + 1));
				CrimsonSpikes crimsonSpikes = val2.AddComponent<CrimsonSpikes>();
				crimsonSpikes.height = Mathf.Max(1.2f, victimHeight * 1.25f);
				crimsonSpikes.born = Time.time;
				crimsonSpikes.origin = ground[i] - Vector3.up * (crimsonSpikes.height * 0.22f);
				val2.transform.position = crimsonSpikes.origin;
				crimsonSpikes.mesh = SpikeMesh.Create(crimsonSpikes.height, Mathf.Max(0.08f, victimWidth * 0.075f));
				val2.AddComponent<MeshFilter>().sharedMesh = crimsonSpikes.mesh;
				crimsonSpikes.material = new Material(val);
				crimsonSpikes.material.SetColor("_Color", new Color(0.19f, 0.12f, 0.14f));
				crimsonSpikes.material.mainTexture = (Texture)(object)Texture2D.whiteTexture;
				((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = crimsonSpikes.material;
			}
		}
	}

	private void Update()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		float num = Time.time - born;
		if (num > 3.2f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		float num2 = ((num > 2.5f) ? ((num - 2.5f) / 0.7f) : 0f);
		((Component)this).transform.position = origin - Vector3.up * height * num2;
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)mesh))
		{
			Object.Destroy((Object)(object)mesh);
		}
		if (Object.op_Implicit((Object)(object)material))
		{
			Object.Destroy((Object)(object)material);
		}
	}
}
public sealed class CrimsonUltimate : CrimsonState
{
	private CharacterBody target;

	private bool grabbed;

	private bool resolved;

	private Vector3 forward;

	public override void OnEnter()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		BeginAttack("ultimate", 1.5f);
		if (!NetworkServer.active)
		{
			return;
		}
		Ray aimRay = ((BaseState)this).GetAimRay();
		double num = double.PositiveInfinity;
		Vector3 val = Vector3.ProjectOnPlane(((Ray)(ref aimRay)).direction, Vector3.up);
		forward = ((Vector3)(ref val)).normalized;
		if (((Vector3)(ref forward)).sqrMagnitude < 0.01f)
		{
			forward = ((EntityState)this).characterDirection.forward;
		}
		float num2 = 40f;
		Ray val2 = aimRay;
		float num3 = num2;
		LayerIndex world = LayerIndex.world;
		RaycastHit val3 = default(RaycastHit);
		if (Physics.Raycast(val2, ref val3, num3, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
		{
			num2 = ((RaycastHit)(ref val3)).distance;
		}
		Ray val4 = aimRay;
		float num4 = num2;
		LayerIndex entityPrecise = LayerIndex.entityPrecise;
		RaycastHit[] array = Physics.RaycastAll(val4, num4, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2);
		for (int i = 0; i < array.Length; i++)
		{
			RaycastHit val5 = array[i];
			HurtBox component = ((Component)((RaycastHit)(ref val5)).collider).GetComponent<HurtBox>();
			CharacterBody val6 = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent)) ? component.healthComponent.body : null);
			if (TemporalController.IsEnemy(((EntityState)this).characterBody, val6) && !val6.isPlayerControlled && !(((RaycastHit)(ref val5)).distance > num2))
			{
				num2 = ((RaycastHit)(ref val5)).distance;
				target = val6;
			}
		}
		if (!Object.op_Implicit((Object)(object)target))
		{
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (!TemporalController.IsEnemy(((EntityState)this).characterBody, readOnlyInstances) || readOnlyInstances.isPlayerControlled)
				{
					continue;
				}
				Vector3 val7 = readOnlyInstances.corePosition - ((Ray)(ref aimRay)).origin;
				double num5 = UltimateAimRules.Score(Vector3.Angle(((Ray)(ref aimRay)).direction, val7), ((Vector3)(ref val7)).magnitude, readOnlyInstances.radius);
				if (!(num5 >= num))
				{
					Vector3 origin = ((Ray)(ref aimRay)).origin;
					Vector3 corePosition = readOnlyInstances.corePosition;
					LayerIndex world2 = LayerIndex.world;
					if (!Physics.Linecast(origin, corePosition, LayerMask.op_Implicit(((LayerIndex)(ref world2)).mask), (QueryTriggerInteraction)1))
					{
						num = num5;
						target = readOnlyInstances;
					}
				}
			}
		}
		if (Object.op_Implicit((Object)(object)target))
		{
			UltimateMessage.Broadcast(((EntityState)this).gameObject, ((Component)target).gameObject, 0, null, 0f, 0f);
		}
	}

	public override void FixedUpdate()
	{
		//IL_0138: 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)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Expected O, but got Unknown
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: 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_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (NetworkServer.active && !resolved && Object.op_Implicit((Object)(object)target) && target.healthComponent.alive && ((EntityState)this).characterBody.healthComponent.alive)
		{
			if (!grabbed && ((EntityState)this).fixedAge >= 0.35f)
			{
				if (!(Vector3.Distance(((EntityState)this).characterBody.corePosition, target.corePosition) > 60f + target.radius))
				{
					Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
					Vector3 corePosition2 = target.corePosition;
					LayerIndex world = LayerIndex.world;
					if (!Physics.Linecast(corePosition, corePosition2, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
					{
						if (!UltimatePlacement.Find(((EntityState)this).characterBody, target, forward, out var _, out var _, out var _))
						{
							target = null;
							return;
						}
						grabbed = true;
						((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.75f);
						goto IL_011a;
					}
				}
				target = null;
				return;
			}
			goto IL_011a;
		}
		goto IL_038d;
		IL_038d:
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 1.5f)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
		return;
		IL_011a:
		if (grabbed)
		{
			BloodBlind.Lock(target, 0.25f, ((Component)target).transform.position, ((Component)target).transform.rotation);
		}
		if (grabbed && ((EntityState)this).fixedAge >= 0.8f)
		{
			resolved = true;
			if (!UltimatePlacement.Find(((EntityState)this).characterBody, target, forward, out var ownerRoot2, out var victimRoot2, out var spikes2))
			{
				return;
			}
			TeleportHelper.TeleportGameObject(((EntityState)this).gameObject, ownerRoot2);
			TeleportHelper.TeleportGameObject(((Component)target).gameObject, victimRoot2);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = forward;
			}
			Quaternion rotation = Quaternion.LookRotation(forward);
			((Component)target).transform.rotation = rotation;
			if (Object.op_Implicit((Object)(object)target.characterDirection))
			{
				target.characterDirection.forward = forward;
			}
			BloodBlind.Lock(target, 2.5f, victimRoot2, rotation);
			Physics.SyncTransforms();
			TimeOverlay.Send(((EntityState)this).characterBody, 2);
			UltimateMessage.Broadcast(((EntityState)this).gameObject, ((Component)target).gameObject, 1, spikes2, UltimatePlacement.Height(target), Mathf.Max(0.8f, target.radius * 2f));
			DamageInfo val = new DamageInfo();
			val.attacker = ((EntityState)this).gameObject;
			val.inflictor = ((EntityState)this).gameObject;
			val.damage = ((BaseState)this).damageStat * 60f;
			val.crit = ((BaseState)this).RollCrit();
			val.procCoefficient = 1f;
			val.position = target.corePosition;
			val.damageType = DamageTypeCombo.op_Implicit((DamageType)1026);
			DamageInfo val2 = val;
			target.healthComponent.TakeDamage(val2);
			GlobalEventManager.instance.OnHitEnemy(val2, ((Component)target).gameObject);
			GlobalEventManager.instance.OnHitAll(val2, ((Component)target).gameObject);
			if (!val2.rejected)
			{
				BloodFx.Impact(target.corePosition, Vector3.up, heavy: true);
				UltimateMessage.Broadcast(((EntityState)this).gameObject, ((Component)target).gameObject, 2, null, 0f, 0f);
			}
		}
		goto IL_038d;
	}

	public override void OnExit()
	{
		DiavoloPresentation component = ((EntityState)this).GetComponent<DiavoloPresentation>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.StopAttack();
		}
		((EntityState)this).OnExit();
	}
}
public sealed class UltimateMessage : INetMessage, ISerializableObject
{
	private GameObject owner;

	private GameObject target;

	private byte phase;

	private Vector3[] points;

	private float height;

	private float width;

	public static void Broadcast(GameObject owner, GameObject target, byte phase, Vector3[] points, float height, float width)
	{
		UltimateMessage ultimateMessage = new UltimateMessage();
		ultimateMessage.owner = owner;
		ultimateMessage.target = target;
		ultimateMessage.phase = phase;
		ultimateMessage.points = points;
		ultimateMessage.height = height;
		ultimateMessage.width = width;
		UltimateMessage ultimateMessage2 = ultimateMessage;
		if (phase == 2)
		{
			DiavoloAudio.Impact(owner.GetComponent<CharacterBody>(), "erase");
			DiavoloAudio.Impact(owner.GetComponent<CharacterBody>(), "ultimate_slice");
		}
		if (phase == 1)
		{
			DiavoloAudio.Impact(owner.GetComponent<CharacterBody>(), "impact_impale");
		}
		if (NetworkClient.active)
		{
			ultimateMessage2.Apply();
		}
		NetMessageExtensions.Send((INetMessage)(object)ultimateMessage2, (NetworkDestination)1);
	}

	public void Serialize(NetworkWriter w)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		w.Write(owner);
		w.Write(target);
		w.Write(phase);
		w.Write(height);
		w.Write(width);
		if (phase == 1)
		{
			for (int i = 0; i < 3; i++)
			{
				w.Write(points[i]);
			}
		}
	}

	public void Deserialize(NetworkReader r)
	{
		//IL_0062: 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)
		owner = r.ReadGameObject();
		target = r.ReadGameObject();
		phase = r.ReadByte();
		height = r.ReadSingle();
		width = r.ReadSingle();
		if (phase == 1)
		{
			points = (Vector3[])(object)new Vector3[3];
			for (int i = 0; i < 3; i++)
			{
				ref Vector3 reference = ref points[i];
				reference = r.ReadVector3();
			}
		}
	}

	public void OnReceived()
	{
		if (!NetworkServer.active)
		{
			Apply();
		}
	}

	private void Apply()
	{
		if (!Object.op_Implicit((Object)(object)owner))
		{
			return;
		}
		DiavoloPresentation component = owner.GetComponent<DiavoloPresentation>();
		if (phase == 0 && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)target))
		{
			component.UltimateLunge(target.GetComponent<CharacterBody>());
		}
		if (phase == 1)
		{
			if (Object.op_Implicit((Object)(object)component))
			{
				component.UltimateFinish();
			}
			CrimsonSpikes.Create(points, height, width);
		}
	}
}
public sealed class CrumpleState : BaseState
{
	public float Duration = 1f;

	private Transform model;

	private Quaternion originalRotation;

	private Vector3 originalPosition;

	private bool authoredAnimation;

	public override void OnEnter()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		model = ((EntityState)this).GetModelTransform();
		if (Object.op_Implicit((Object)(object)model))
		{
			originalRotation = model.localRotation;
			originalPosition = model.localPosition;
		}
		Animator modelAnimator = ((EntityState)this).GetModelAnimator();
		if (!Object.op_Implicit((Object)(object)modelAnimator))
		{
			return;
		}
		string[] array = new string[3] { "Hurt", "Stun", "Stunned" };
		foreach (string text in array)
		{
			int num = Animator.StringToHash(text);
			if (modelAnimator.HasState(0, num))
			{
				modelAnimator.CrossFade(num, 0.05f, 0);
				authoredAnimation = true;
				break;
			}
		}
	}

	public override void Update()
	{
		//IL_0057: 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_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_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).Update();
		if (Object.op_Implicit((Object)(object)model) && !authoredAnimation)
		{
			float num = Mathf.Min(Mathf.Clamp01(((EntityState)this).age / 0.2f), Mathf.Clamp01((Duration - ((EntityState)this).age) / 0.2f));
			model.localRotation = originalRotation * Quaternion.Euler(55f * num, 0f, 0f);
			model.localPosition = originalPosition - Vector3.up * 0.35f * num;
		}
	}

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

	public override void OnExit()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)model) && !authoredAnimation)
		{
			model.localRotation = originalRotation;
			model.localPosition = originalPosition;
		}
		((EntityState)this).OnExit();
	}

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

	public override void OnSerialize(NetworkWriter writer)
	{
		((EntityState)this).OnSerialize(writer);
		writer.Write(Duration);
	}

	public override void OnDeserialize(NetworkReader reader)
	{
		((EntityState)this).OnDeserialize(reader);
		Duration = reader.ReadSingle();
	}
}
public static class CursorSkip
{
	public const float Range = 80f;

	public static bool Destination(CharacterBody body, Ray aim, out Vector3 destination)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: 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_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: 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_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: 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)
		destination = ((Component)body).transform.position;
		CapsuleCollider val = ((Object.op_Implicit((Object)(object)body.characterMotor) && Object.op_Implicit((Object)(object)((BaseCharacterController)body.characterMotor).Motor)) ? ((BaseCharacterController)body.characterMotor).Motor.Capsule : ((Component)body).GetComponent<CapsuleCollider>());
		float num = (Object.op_Implicit((Object)(object)val) ? (val.radius * Mathf.Max(Mathf.Abs(((Component)val).transform.lossyScale.x), Mathf.Abs(((Component)val).tran