Decompiled source of JJBA Diavolo v1.0.2

plugins/JJBADiavolo.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using JJBAMod.Modules;
using JJBAMod.Modules.BaseStates;
using JJBAMod.Modules.Characters;
using JJBAMod.Modules.Stands;
using JJBAMod.Survivors.Diavolo.Components;
using JJBAMod.Survivors.Diavolo.SkillStates;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.WwiseUtils;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JJBADiavolo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JJBADiavolo")]
[assembly: AssemblyTitle("JJBADiavolo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace JJBAMod.Survivors.Diavolo
{
	public static class DiavoloAI
	{
		public static void Init(GameObject bodyPrefab, string masterName)
		{
			//IL_0035: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Prefabs.CreateBlankMasterPrefab(bodyPrefab, masterName);
			BaseAI component = obj.GetComponent<BaseAI>();
			component.aimVectorDampTime = 0.1f;
			component.aimVectorMaxSpeed = 360f;
			AISkillDriver obj2 = obj.AddComponent<AISkillDriver>();
			obj2.customName = "Use Primary Swing";
			obj2.skillSlot = (SkillSlot)0;
			obj2.requiredSkill = null;
			obj2.requireSkillReady = false;
			obj2.requireEquipmentReady = false;
			obj2.minUserHealthFraction = float.NegativeInfinity;
			obj2.maxUserHealthFraction = float.PositiveInfinity;
			obj2.minTargetHealthFraction = float.NegativeInfinity;
			obj2.maxTargetHealthFraction = float.PositiveInfinity;
			obj2.minDistance = 0f;
			obj2.maxDistance = 8f;
			obj2.selectionRequiresTargetLoS = false;
			obj2.selectionRequiresOnGround = false;
			obj2.selectionRequiresAimTarget = false;
			obj2.maxTimesSelected = -1;
			obj2.moveTargetType = (TargetType)0;
			obj2.activationRequiresTargetLoS = false;
			obj2.activationRequiresAimTargetLoS = false;
			obj2.activationRequiresAimConfirmation = false;
			obj2.movementType = (MovementType)1;
			obj2.moveInputScale = 1f;
			obj2.aimType = (AimType)1;
			obj2.ignoreNodeGraph = false;
			obj2.shouldSprint = false;
			obj2.shouldFireEquipment = false;
			obj2.buttonPressType = (ButtonPressType)0;
			obj2.driverUpdateTimerOverride = -1f;
			obj2.resetCurrentEnemyOnNextDriverSelection = false;
			obj2.noRepeat = false;
			obj2.nextHighPriorityOverride = null;
			AISkillDriver obj3 = obj.AddComponent<AISkillDriver>();
			obj3.customName = "Use Secondary Smash";
			obj3.skillSlot = (SkillSlot)1;
			obj3.requireSkillReady = true;
			obj3.minDistance = 0f;
			obj3.maxDistance = 8f;
			obj3.selectionRequiresTargetLoS = false;
			obj3.selectionRequiresOnGround = false;
			obj3.selectionRequiresAimTarget = false;
			obj3.maxTimesSelected = -1;
			obj3.moveTargetType = (TargetType)0;
			obj3.activationRequiresTargetLoS = false;
			obj3.activationRequiresAimTargetLoS = false;
			obj3.activationRequiresAimConfirmation = true;
			obj3.movementType = (MovementType)1;
			obj3.moveInputScale = 1f;
			obj3.aimType = (AimType)1;
			obj3.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj4 = obj.AddComponent<AISkillDriver>();
			obj4.customName = "Use Utility Time Erase";
			obj4.skillSlot = (SkillSlot)2;
			obj4.requireSkillReady = true;
			obj4.minDistance = 8f;
			obj4.maxDistance = 20f;
			obj4.selectionRequiresTargetLoS = true;
			obj4.selectionRequiresOnGround = false;
			obj4.selectionRequiresAimTarget = false;
			obj4.maxTimesSelected = -1;
			obj4.moveTargetType = (TargetType)0;
			obj4.activationRequiresTargetLoS = false;
			obj4.activationRequiresAimTargetLoS = false;
			obj4.activationRequiresAimConfirmation = false;
			obj4.movementType = (MovementType)2;
			obj4.moveInputScale = 1f;
			obj4.aimType = (AimType)1;
			obj4.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj5 = obj.AddComponent<AISkillDriver>();
			obj5.customName = "Use Special Donut";
			obj5.skillSlot = (SkillSlot)3;
			obj5.requireSkillReady = true;
			obj5.minDistance = 0f;
			obj5.maxDistance = 20f;
			obj5.selectionRequiresTargetLoS = false;
			obj5.selectionRequiresOnGround = false;
			obj5.selectionRequiresAimTarget = false;
			obj5.maxTimesSelected = -1;
			obj5.moveTargetType = (TargetType)0;
			obj5.activationRequiresTargetLoS = false;
			obj5.activationRequiresAimTargetLoS = false;
			obj5.activationRequiresAimConfirmation = false;
			obj5.movementType = (MovementType)1;
			obj5.moveInputScale = 1f;
			obj5.aimType = (AimType)1;
			obj5.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj6 = obj.AddComponent<AISkillDriver>();
			obj6.customName = "Chase";
			obj6.skillSlot = (SkillSlot)(-1);
			obj6.requireSkillReady = false;
			obj6.minDistance = 0f;
			obj6.maxDistance = float.PositiveInfinity;
			obj6.moveTargetType = (TargetType)0;
			obj6.activationRequiresTargetLoS = false;
			obj6.activationRequiresAimTargetLoS = false;
			obj6.activationRequiresAimConfirmation = false;
			obj6.movementType = (MovementType)1;
			obj6.moveInputScale = 1f;
			obj6.aimType = (AimType)1;
			obj6.buttonPressType = (ButtonPressType)0;
		}
	}
	public static class DiavoloAssets
	{
		public static GameObject kingCrimsonModel;

		public static GameObject kingCrimsonAltModel;

		public static Texture cutInTexture;

		public static NetworkSoundEventDef[] standPunchHitSoundEvents;

		public static NetworkSoundEventDef diavoloPunchHitSoundEvent;

		public static NetworkSoundEventDef donutHitSoundEvent;

		public static NetworkSoundEventDef smashHitSoundEvent;

		public static BuffDef epitaphBuff;

		public static BuffDef epitaphTriggeredBuff;

		public static BuffDef timeErasedBuff;

		public static BuffDef resultBuff;

		private static AssetBundle _assetBundle;

		public static void Init(AssetBundle assetBundle)
		{
			//IL_008e: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			_assetBundle = assetBundle;
			standPunchHitSoundEvents = (NetworkSoundEventDef[])(object)new NetworkSoundEventDef[DiavoloSounds.standPunchHits.Length];
			for (int i = 0; i < standPunchHitSoundEvents.Length; i++)
			{
				standPunchHitSoundEvents[i] = Content.CreateAndAddNetworkSoundEventDef(DiavoloSounds.standPunchHits[i]);
			}
			diavoloPunchHitSoundEvent = Content.CreateAndAddNetworkSoundEventDef("Play_bandit2_m2_impact");
			donutHitSoundEvent = Content.CreateAndAddNetworkSoundEventDef("Play_Diavolo_DonutHit");
			smashHitSoundEvent = Content.CreateAndAddNetworkSoundEventDef("Play_Diavolo_SmashHit");
			Color val = default(Color);
			((Color)(ref val))..ctor(0.85f, 0.15f, 0.3f);
			epitaphBuff = Content.CreateAndAddBuff("bdDiavoloEpitaph", Icon("texDiavoloStandSpecial"), val, false, false);
			epitaphTriggeredBuff = Content.CreateAndAddBuff("bdDiavoloEpitaphTriggered", Icon("texDiavoloStandSpecial"), Color.white, false, false);
			timeErasedBuff = Content.CreateAndAddBuff("bdDiavoloTimeErased", Icon("texDiavoloUtility"), val, false, false);
			resultBuff = Content.CreateAndAddBuff("bdDiavoloResult", Icon("texDiavoloUltimate"), new Color(1f, 0.55f, 0.65f), false, false);
			kingCrimsonModel = _assetBundle.LoadAsset<GameObject>("mdlKingCrimson");
			kingCrimsonAltModel = _assetBundle.LoadAsset<GameObject>("mdlKingCrimson1");
			cutInTexture = (Texture)(object)_assetBundle.LoadAsset<Texture2D>("texDiavoloCutIn");
			KingCrimsonCutscene.track = StandCinematic.LoadTrack(_assetBundle.LoadAsset<TextAsset>("DiavoloUltimateCamera"));
			Asset.ConvertAllRenderersToHopooShader(kingCrimsonModel);
			if (Object.op_Implicit((Object)(object)kingCrimsonAltModel))
			{
				Asset.ConvertAllRenderersToHopooShader(kingCrimsonAltModel);
			}
			DiavoloHooks.Init();
		}

		private static Sprite Icon(string name)
		{
			Sprite val = _assetBundle.LoadAsset<Sprite>(name);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return _assetBundle.LoadAsset<Sprite>("texDiavoloIcon");
			}
			return val;
		}
	}
	public static class DiavoloSounds
	{
		public static readonly string[] standPunchSwings = new string[3] { "Play_JJBA_StandSwing1", "Play_JJBA_StandSwing2", "Play_JJBA_StandSwing3" };

		public static readonly string[] standPunchHits = new string[3] { "Play_JJBA_StandHit1", "Play_JJBA_StandHit2", "Play_JJBA_StandHit3" };

		public static readonly string[] diavoloSwings = new string[3] { "Play_Kira_Swing1", "Play_Kira_Swing2", "Play_Kira_Swing3" };

		public const string diavoloPunchHit = "Play_bandit2_m2_impact";

		private static readonly string[] punchShouts = new string[3] { "Play_Diavolo_Shout1", "Play_Diavolo_Shout2", "Play_Diavolo_Shout3" };

		public const string smash = "Play_Diavolo_Smash";

		public const string smashHit = "Play_Diavolo_SmashHit";

		public const string donut = "Play_Diavolo_Donut";

		public const string donutHit = "Play_Diavolo_DonutHit";

		public const string epitaph = "Play_Diavolo_Epitaph";

		public const string epitaphCounter = "Play_Diavolo_EpitaphCounter";

		public const string timeErase = "Play_Diavolo_TimeErase";

		public const string timeEraseEnd = "Play_Diavolo_TimeEraseEnd";

		public const string ultimateStart = "Play_Diavolo_HHA1";

		public const string ultimateFinish = "Play_Diavolo_HHA3";

		public static string PunchShout(int step)
		{
			return punchShouts[step % punchShouts.Length];
		}
	}
	public static class DiavoloStates
	{
		public static void Init()
		{
			Content.AddEntityState(typeof(KingCrimsonPunch));
			Content.AddEntityState(typeof(KingCrimsonSmash));
			Content.AddEntityState(typeof(TimeErase));
			Content.AddEntityState(typeof(Donut));
			Content.AddEntityState(typeof(Epitaph));
			Content.AddEntityState(typeof(EpitaphCounter));
			Content.AddEntityState(typeof(KingCrimsonUltimate));
			Content.AddEntityState(typeof(KingCrimsonCutscene));
		}
	}
	public static class DiavoloStaticValues
	{
		public const float punchDamageCoefficient = 2.8f;

		public const float diavoloPunchDamageCoefficient = 1.2f;

		public const float punchLockOnRange = 15f;

		public const float punchStandCost = 4f;

		public const float smashDamageCoefficient = 4.5f;

		public const float smashRadius = 7f;

		public const float smashReach = 3f;

		public const float smashStandCost = 14f;

		public const float timeEraseDuration = 2.5f;

		public const float timeEraseSpeedBonus = 0.6f;

		public const float resultDuration = 2f;

		public const float timeEraseStandCost = 22f;

		public const float timeEraseCooldown = 9f;

		public const float eraseProjectileRadius = 10f;

		public const float eraseStrikeDamageCoefficient = 6f;

		public const float eraseStrikeRange = 16f;

		public const int eraseStrikeTargets = 3;

		public const float donutDamageCoefficient = 9f;

		public const float donutStandCost = 28f;

		public const float donutCooldown = 8f;

		public const float epitaphWindow = 1.2f;

		public const float epitaphDamageCoefficient = 8f;

		public const float epitaphStandCost = 12f;

		public const float epitaphCooldown = 7f;

		public const float epitaphCounterRange = 40f;

		public const float ultimateRadius = 30f;

		public const float ultimateDamageCoefficient = 18f;

		public const float ultimateHitInterval = 0.07f;

		public const float ultimateEraseDuration = 5f;

		public const float ultimateStandCost = 50f;

		public const float ultimateCooldown = 45f;
	}
	public static class DiavoloTokens
	{
		public static void Init()
		{
			string text = "KAVAHN_DIAVOLO_";
			string text2 = "Diavolo, boss of Passione, and his stand King Crimson.<color=#CCD3E0>\n\n< ! > King Crimson's punches lock on and fly to the enemy, so keep moving while it fights.\n\n< ! > Erase time to slip out of a fight unseen, then strike as it comes back: your hits always crit for a moment.\n\n< ! > Epitaph shows the next moment. Time it as a hit is coming and King Crimson answers from behind the attacker.</color>";
			Language.Add(text + "NAME", "Diavolo");
			Language.Add(text + "DESCRIPTION", text2);
			Language.Add(text + "SUBTITLE", "Boss of Passione");
			Language.Add(text + "LORE", "\"In this world, only the result remains!\"");
			Language.Add(text + "OUTRO_FLAVOR", "...and so he left, the eternal climax still his.");
			Language.Add(text + "OUTRO_FAILURE", "...and so he died, again, and will die again, forever.");
			Language.Add(text + "STAND_NAME", "KING CRIMSON");
			Language.Add(text + "DEFAULT_SKIN_NAME", "Default");
			Language.Add(text + "COLOR1_SKIN_NAME", "Colour 2");
			Language.Add(text + "COLOR2_SKIN_NAME", "Colour 3");
			Language.Add(text + "COLOR3_SKIN_NAME", "Colour 4");
			Language.Add(text + "PASSIVE_NAME", "Stand: King Crimson");
			Language.Add(text + "PASSIVE_DESCRIPTION", "King Crimson's attacks spend its <style=cIsUtility>stand meter</style>. While it's out, it takes <style=cIsHealing>half the damage</style> aimed at Diavolo. If the meter runs dry, the stand <style=cDeath>breaks</style>.");
			Language.Add(text + "PRIMARY_PUNCH_NAME", "King Crimson");
			Language.Add(text + "PRIMARY_PUNCH_DESCRIPTION", "<style=cIsUtility>Agile.</style>" + $"<style=cIsUtility>Lock on</style> to an enemy within {15f}m. King Crimson <style=cIsUtility>dashes</style> to it and strikes for <style=cIsDamage>{280f}% damage</style>. Without his stand, Diavolo punches for <style=cIsDamage>{120.00001f}% damage</style>.");
			Language.Add(text + "SECONDARY_SMASH_NAME", "Crimson Smash");
			Language.Add(text + "SECONDARY_SMASH_DESCRIPTION", $"King Crimson smashes the ground in front of you, hitting everything within {7f}m for <style=cIsDamage>{450f}% damage</style> and throwing it into the air.");
			Language.Add(text + "UTILITY_ERASE_NAME", "Time Erase");
			Language.Add(text + "UTILITY_ERASE_DESCRIPTION", $"<style=cIsUtility>Erase time</style> for {2.5f} seconds. You are <style=cIsUtility>invisible</style>, <style=cIsUtility>untouchable</style> and <style=cIsUtility>{60.000004f}% faster</style>, enemies lose track of you and their projectiles near you are <style=cIsUtility>erased</style>. When time resumes, King Crimson strikes the {3} nearest enemies for <style=cIsDamage>{600f}% damage</style>, and for {2f} seconds every hit is <style=cIsDamage>critical</style>.");
			Language.Add(text + "SPECIAL_DONUT_NAME", "Fist Through the Heart");
			Language.Add(text + "SPECIAL_DONUT_DESCRIPTION", $"King Crimson drives its arm through the locked-on enemy for <style=cIsDamage>{900f}% damage</style>, <style=cIsDamage>stunning</style> it and leaving it <style=cIsHealth>bleeding</style>.");
			Language.Add(text + "STANDSPECIAL_NAME", "Epitaph");
			Language.Add(text + "STANDSPECIAL_DESCRIPTION", $"<style=cIsUtility>Stand special.</style> See the next {1.2f} seconds. The first hit that would land on you is <style=cIsUtility>erased</style>, and you appear <style=cIsUtility>behind</style> the attacker as King Crimson strikes for <style=cIsDamage>{800f}% damage</style> and <style=cIsDamage>stuns</style>.");
			Language.Add(text + "ULTIMATE_NAME", "KING CRIMSON");
			Language.Add(text + "ULTIMATE_DESCRIPTION", $"<style=cIsUtility>Ultimate.</style> Time is erased. Everything within {30f}m is held still, then King Crimson strikes each of them for <style=cIsDamage>{1800f}% damage</style>, leaving them <style=cIsHealth>bleeding</style>. Time then stays erased around you for {5f} seconds. Costs {50f} stand meter.");
			Language.Add(text + "ULTIMATE_TITLE", "KING CRIMSON");
			Language.Add(text + "ERASED_LABEL", "TIME ERASED");
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.kavahn.JJBADiavolo", "JJBADiavolo", "1.0.2")]
	public class DiavoloPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			string? directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			Asset.AddBundleFolder(directoryName);
			SoundBanks.Add(directoryName, "JJBADiavolo.bnk");
			JJBAPlugin.Safely((Action)delegate
			{
				((CharacterBase<DiavoloSurvivor>)(object)new DiavoloSurvivor()).Initialize();
			});
		}
	}
	public class DiavoloSurvivor : SurvivorBase<DiavoloSurvivor>
	{
		public const string DIAVOLO_PREFIX = "KAVAHN_DIAVOLO_";

		public const float modelScale = 1.3f;

		public override string assetBundleName => "jjbadiavolo";

		public override string bodyName => "KavahnDiavoloBody";

		public override string masterName => "KavahnDiavoloMonsterMaster";

		public override string modelPrefabName => "mdlDiavolo";

		public override string displayPrefabName => "DiavoloDisplay";

		public override string survivorTokenPrefix => "KAVAHN_DIAVOLO_";

		public bool Available
		{
			get
			{
				if (Object.op_Implicit((Object)(object)((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle))
				{
					return ((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle.Contains(((CharacterBase<DiavoloSurvivor>)(object)this).modelPrefabName);
				}
				return false;
			}
		}

		public override BodyInfo bodyInfo => new BodyInfo
		{
			bodyName = ((CharacterBase<DiavoloSurvivor>)(object)this).bodyName,
			bodyNameToken = "KAVAHN_DIAVOLO_NAME",
			subtitleNameToken = "KAVAHN_DIAVOLO_SUBTITLE",
			characterPortrait = Icon<Texture>("texDiavoloIcon", "texHenryIcon"),
			bodyColor = new Color(0.9f, 0.3f, 0.5f),
			sortPosition = 103f,
			crosshair = Asset.LoadCrosshair("Standard"),
			podPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/SurvivorPod"),
			maxHealth = 110f,
			healthRegen = 1.5f,
			armor = 0f,
			moveSpeed = 7.5f,
			jumpCount = 1,
			cameraParamsVerticalOffset = 1.7f,
			cameraParamsDepth = -12f
		};

		public override CustomRendererInfo[] customRendererInfos
		{
			get
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: 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_0070: Expected O, but got Unknown
				ChildLocator val = (Object.op_Implicit((Object)(object)((CharacterBase<DiavoloSurvivor>)(object)this).characterModelObject) ? ((CharacterBase<DiavoloSurvivor>)(object)this).characterModelObject.GetComponent<ChildLocator>() : null);
				if (!Object.op_Implicit((Object)(object)val))
				{
					return (CustomRendererInfo[])(object)new CustomRendererInfo[0];
				}
				List<CustomRendererInfo> list = new List<CustomRendererInfo>();
				NameTransformPair[] transformPairs = val.transformPairs;
				foreach (NameTransformPair val2 in transformPairs)
				{
					if (val2.name.StartsWith("Mesh"))
					{
						list.Add(new CustomRendererInfo
						{
							childName = val2.name
						});
					}
				}
				return list.ToArray();
			}
		}

		public override UnlockableDef characterUnlockableDef => null;

		public override ItemDisplaysBase itemDisplays => null;

		public override AssetBundle assetBundle { get; protected set; }

		public override GameObject bodyPrefab { get; protected set; }

		public override CharacterBody prefabCharacterBody { get; protected set; }

		public override GameObject characterModelObject { get; protected set; }

		public override CharacterModel prefabCharacterModel { get; protected set; }

		public override GameObject displayPrefab { get; protected set; }

		private T Icon<T>(string name, string fallback) where T : Object
		{
			T val = ((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle.LoadAsset<T>(name);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return ((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle.LoadAsset<T>(fallback);
			}
			return val;
		}

		public override void Initialize()
		{
			((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle = Asset.LoadAssetBundle(((CharacterBase<DiavoloSurvivor>)(object)this).assetBundleName);
			if (!Available)
			{
				Log.Warning((object)"the asset bundle has no diavolo in it yet, skipping him (rebuild it with Tools/build_bundle.sh)");
			}
			else
			{
				((CharacterBase<DiavoloSurvivor>)(object)this).Initialize();
			}
		}

		public override void InitializeCharacter()
		{
			base.InitializeCharacter();
			DiavoloStates.Init();
			DiavoloTokens.Init();
			DiavoloAssets.Init(((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle);
			((CharacterBase<DiavoloSurvivor>)(object)this).InitializeEntityStateMachines();
			((CharacterBase<DiavoloSurvivor>)(object)this).InitializeSkills();
			((CharacterBase<DiavoloSurvivor>)(object)this).InitializeSkins();
			((CharacterBase<DiavoloSurvivor>)(object)this).InitializeCharacterMaster();
			AdditionalBodySetup();
		}

		private void AdditionalBodySetup()
		{
			//IL_000c: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			Transform transform = ((CharacterBase<DiavoloSurvivor>)(object)this).characterModelObject.transform;
			transform.localScale *= 1.3f;
			if (Object.op_Implicit((Object)(object)((SurvivorBase<DiavoloSurvivor>)this).displayPrefab))
			{
				Transform transform2 = ((SurvivorBase<DiavoloSurvivor>)this).displayPrefab.transform;
				transform2.localScale *= 1.3f;
			}
			Prefabs.SetupHitBoxGroup(((CharacterBase<DiavoloSurvivor>)(object)this).characterModelObject, "SwordGroup", new string[1] { "SwordHitbox" });
			if (!Object.op_Implicit((Object)(object)((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab.GetComponent<AkGameObj>()))
			{
				((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab.AddComponent<AkGameObj>();
			}
			((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab.AddComponent<TimeEraseController>();
			((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab.AddComponent<KingCrimsonColor>();
			Stands.AddStandUser(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, ((CharacterBase<DiavoloSurvivor>)(object)this).bodyName, new StandDefinition
			{
				standNameToken = "KAVAHN_DIAVOLO_STAND_NAME",
				color = new Color(0.95f, 0.3f, 0.45f),
				standModelPrefab = DiavoloAssets.kingCrimsonModel,
				modelScale = 1.29f,
				actionModelScale = 1.5f,
				standOffset = new Vector3(0.7f, 0f, -1f),
				standoffFromTarget = 1.3f,
				hitboxCenter = new Vector3(0f, 0f, 1.2f),
				hitboxSize = new Vector3(3.3f, 3.3f, 3.5f),
				maxGauge = 120f
			});
			((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab.AddComponent<StandTracker>().maxTrackingDistance = 15f;
			GameObject[] array = (GameObject[])(object)new GameObject[2]
			{
				((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab,
				((SurvivorBase<DiavoloSurvivor>)this).displayPrefab
			};
			foreach (GameObject val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.AddComponent<SoundbankLoader>().soundbankStrings = SharedEffects.vanillaSoundbanks;
				}
			}
		}

		public override void InitializeEntityStateMachines()
		{
			Prefabs.ClearEntityStateMachines(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab);
			Prefabs.AddMainEntityStateMachine(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, "Body", typeof(GenericCharacterMain), typeof(SpawnTeleporterState));
			Prefabs.AddEntityStateMachine(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, "Weapon", (Type)null, (Type)null, true, true);
			Prefabs.AddEntityStateMachine(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, "Weapon2", (Type)null, (Type)null, true, true);
		}

		public override void InitializeSkills()
		{
			//IL_0018: 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_0063: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_014d: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Expected O, but got Unknown
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Expected O, but got Unknown
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Expected O, but got Unknown
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			Skills.ClearGenericSkills(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab);
			((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab.GetComponent<SkillLocator>().passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "KAVAHN_DIAVOLO_PASSIVE_NAME",
				skillDescriptionToken = "KAVAHN_DIAVOLO_PASSIVE_DESCRIPTION",
				keywordToken = "KEYWORD_JJBA_STAND",
				icon = Icon<Sprite>("texDiavoloPassive", "texPassiveIcon")
			};
			Skills.CreateGenericSkillWithSkillFamily(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillSlot)0, false);
			SteppedSkillDef val = Skills.CreateSkillDef<SteppedSkillDef>(new SkillDefInfo("DiavoloKingCrimson", "KAVAHN_DIAVOLO_PRIMARY_PUNCH_NAME", "KAVAHN_DIAVOLO_PRIMARY_PUNCH_DESCRIPTION", Icon<Sprite>("texDiavoloPrimary", "texPrimaryIcon"), new SerializableEntityStateType(typeof(KingCrimsonPunch)), "Weapon", true));
			val.stepCount = 3;
			val.stepGraceDuration = 0.5f;
			Skills.AddPrimarySkills(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillDef[])(object)new SkillDef[1] { (SkillDef)val });
			Skills.CreateGenericSkillWithSkillFamily(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillSlot)1, false);
			SkillDefInfo val2 = new SkillDefInfo();
			val2.skillName = "DiavoloSmash";
			val2.skillNameToken = "KAVAHN_DIAVOLO_SECONDARY_SMASH_NAME";
			val2.skillDescriptionToken = "KAVAHN_DIAVOLO_SECONDARY_SMASH_DESCRIPTION";
			val2.keywordTokens = new string[1] { "KEYWORD_JJBA_STAND" };
			val2.skillIcon = Icon<Sprite>("texDiavoloSecondary", "texSecondaryIcon");
			val2.activationState = new SerializableEntityStateType(typeof(KingCrimsonSmash));
			val2.activationStateMachineName = "Weapon2";
			val2.interruptPriority = (InterruptPriority)1;
			val2.baseRechargeInterval = 5f;
			val2.baseMaxStock = 1;
			val2.fullRestockOnAssign = true;
			val2.isCombatSkill = true;
			val2.cancelSprintingOnActivation = false;
			StandSkillDef val3 = Skills.CreateSkillDef<StandSkillDef>(val2);
			val3.standCost = 14f;
			Skills.AddSecondarySkills(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillDef[])(object)new SkillDef[1] { (SkillDef)val3 });
			Skills.CreateGenericSkillWithSkillFamily(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillSlot)2, false);
			val2 = new SkillDefInfo();
			val2.skillName = "DiavoloTimeErase";
			val2.skillNameToken = "KAVAHN_DIAVOLO_UTILITY_ERASE_NAME";
			val2.skillDescriptionToken = "KAVAHN_DIAVOLO_UTILITY_ERASE_DESCRIPTION";
			val2.keywordTokens = new string[1] { "KEYWORD_JJBA_STAND" };
			val2.skillIcon = Icon<Sprite>("texDiavoloUtility", "texUtilityIcon");
			val2.activationState = new SerializableEntityStateType(typeof(TimeErase));
			val2.activationStateMachineName = "Weapon2";
			val2.interruptPriority = (InterruptPriority)2;
			val2.baseRechargeInterval = 9f;
			val2.baseMaxStock = 1;
			val2.fullRestockOnAssign = true;
			val2.mustKeyPress = true;
			val2.isCombatSkill = false;
			val2.cancelSprintingOnActivation = false;
			StandSkillDef val4 = Skills.CreateSkillDef<StandSkillDef>(val2);
			val4.standCost = 22f;
			Skills.AddUtilitySkills(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillDef[])(object)new SkillDef[1] { (SkillDef)val4 });
			Skills.CreateGenericSkillWithSkillFamily(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillSlot)3, false);
			val2 = new SkillDefInfo();
			val2.skillName = "DiavoloDonut";
			val2.skillNameToken = "KAVAHN_DIAVOLO_SPECIAL_DONUT_NAME";
			val2.skillDescriptionToken = "KAVAHN_DIAVOLO_SPECIAL_DONUT_DESCRIPTION";
			val2.keywordTokens = new string[1] { "KEYWORD_JJBA_STAND" };
			val2.skillIcon = Icon<Sprite>("texDiavoloSpecial", "texSpecialIcon");
			val2.activationState = new SerializableEntityStateType(typeof(Donut));
			val2.activationStateMachineName = "Weapon2";
			val2.interruptPriority = (InterruptPriority)1;
			val2.baseRechargeInterval = 8f;
			val2.baseMaxStock = 1;
			val2.fullRestockOnAssign = true;
			val2.isCombatSkill = true;
			val2.cancelSprintingOnActivation = true;
			StandSkillDef val5 = Skills.CreateSkillDef<StandSkillDef>(val2);
			val5.standCost = 28f;
			Skills.AddSpecialSkills(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillDef[])(object)new SkillDef[1] { (SkillDef)val5 });
			val2 = new SkillDefInfo();
			val2.skillName = "DiavoloEpitaph";
			val2.skillNameToken = "KAVAHN_DIAVOLO_STANDSPECIAL_NAME";
			val2.skillDescriptionToken = "KAVAHN_DIAVOLO_STANDSPECIAL_DESCRIPTION";
			val2.keywordTokens = new string[1] { "KEYWORD_JJBA_STAND" };
			val2.skillIcon = Icon<Sprite>("texDiavoloStandSpecial", "texDiavoloUtility");
			val2.activationState = new SerializableEntityStateType(typeof(Epitaph));
			val2.activationStateMachineName = "Weapon2";
			val2.interruptPriority = (InterruptPriority)1;
			val2.baseRechargeInterval = 7f;
			val2.baseMaxStock = 1;
			val2.fullRestockOnAssign = true;
			val2.mustKeyPress = true;
			val2.isCombatSkill = true;
			val2.cancelSprintingOnActivation = false;
			StandSkillDef val6 = Skills.CreateSkillDef<StandSkillDef>(val2);
			val6.standCost = 12f;
			ExtraSkills.AddStandSpecial(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, (SkillDef)(object)val6);
			val2 = new SkillDefInfo();
			val2.skillName = "DiavoloKingCrimsonUltimate";
			val2.skillNameToken = "KAVAHN_DIAVOLO_ULTIMATE_NAME";
			val2.skillDescriptionToken = "KAVAHN_DIAVOLO_ULTIMATE_DESCRIPTION";
			val2.keywordTokens = new string[1] { "KEYWORD_JJBA_STAND" };
			val2.skillIcon = Icon<Sprite>("texDiavoloUltimate", "texSpecialIcon");
			val2.activationState = new SerializableEntityStateType(typeof(KingCrimsonUltimate));
			val2.activationStateMachineName = "Weapon2";
			val2.interruptPriority = (InterruptPriority)1;
			val2.baseRechargeInterval = 45f;
			val2.baseMaxStock = 1;
			val2.fullRestockOnAssign = true;
			val2.mustKeyPress = true;
			val2.isCombatSkill = true;
			val2.cancelSprintingOnActivation = true;
			StandSkillDef val7 = Skills.CreateSkillDef<StandSkillDef>(val2);
			val7.standCost = 50f;
			GenericSkill val8 = Skills.CreateGenericSkillWithSkillFamily(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, "KingCrimson", "Ultimate", false);
			Skills.AddSkillToFamily(val8.skillFamily, (SkillDef)(object)val7, (UnlockableDef)null);
			ExtraSkills.Slots(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab).skill = val8;
		}

		public override void InitializeSkins()
		{
			ModelSkinController val = ((Component)((CharacterBase<DiavoloSurvivor>)(object)this).prefabCharacterModel).gameObject.AddComponent<ModelSkinController>();
			RendererInfo[] baseRendererInfos = ((CharacterBase<DiavoloSurvivor>)(object)this).prefabCharacterModel.baseRendererInfos;
			List<SkinDef> list = new List<SkinDef> { Skins.CreateSkinDef("KAVAHN_DIAVOLO_DEFAULT_SKIN_NAME", Icon<Sprite>("texDiavoloSkin", "texMainSkin"), baseRendererInfos, ((Component)((CharacterBase<DiavoloSurvivor>)(object)this).prefabCharacterModel).gameObject, (UnlockableDef)null) };
			for (int i = 1; i <= 3; i++)
			{
				RendererInfo[] array = (RendererInfo[])baseRendererInfos.Clone();
				bool flag = false;
				for (int j = 0; j < array.Length; j++)
				{
					Material val2 = (Object.op_Implicit((Object)(object)array[j].defaultMaterial) ? ((CharacterBase<DiavoloSurvivor>)(object)this).assetBundle.LoadAsset<Material>(((Object)array[j].defaultMaterial).name + "_c" + i) : null);
					if (Object.op_Implicit((Object)(object)val2))
					{
						array[j].defaultMaterial = val2;
						flag = true;
					}
				}
				if (flag)
				{
					list.Add(Skins.CreateSkinDef("KAVAHN_DIAVOLO_COLOR" + i + "_SKIN_NAME", Icon<Sprite>("texDiavoloSkin", "texMainSkin"), array, ((Component)((CharacterBase<DiavoloSurvivor>)(object)this).prefabCharacterModel).gameObject, (UnlockableDef)null));
				}
			}
			val.skins = list.ToArray();
		}

		public override void InitializeCharacterMaster()
		{
			DiavoloAI.Init(((CharacterBase<DiavoloSurvivor>)(object)this).bodyPrefab, ((SurvivorBase<DiavoloSurvivor>)this).masterName);
		}
	}
}
namespace JJBAMod.Survivors.Diavolo.SkillStates
{
	public class Donut : BaseSkillState
	{
		public static float baseDuration = 1.1f;

		public static float hitPercentTime = 0.4f;

		private float duration;

		private bool hit;

		private Vector3 thrustDirection;

		private HurtBoxReference lockedTarget;

		private StandUser standUser;

		public override void OnEnter()
		{
			//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_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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			standUser = ((EntityState)this).GetComponent<StandUser>();
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				thrustDirection = ((Ray)(ref aimRay)).direction;
				StandTracker val = StandTracker.Of(((EntityState)this).gameObject);
				lockedTarget = HurtBoxReference.FromHurtBox(Object.op_Implicit((Object)(object)val) ? val.GetTrackingTarget() : null);
			}
			Util.PlaySound("Play_Diavolo_Donut", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)standUser))
			{
				standUser.UseStand(28f);
				HurtBox val2 = ((HurtBoxReference)(ref lockedTarget)).ResolveHurtBox();
				if (Object.op_Implicit((Object)(object)val2))
				{
					standUser.BeginTargetedAction(val2, duration, hitPercentTime * duration * 0.8f);
				}
				else
				{
					standUser.BeginAction(thrustDirection, 2f, duration);
				}
				standUser.PlayStandAnimation("DonutStart", 0.05f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_0147: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((EntityState)this).FixedUpdate();
			if (!hit && ((EntityState)this).fixedAge >= duration * hitPercentTime)
			{
				hit = true;
				if (Object.op_Implicit((Object)(object)standUser))
				{
					standUser.PlayStandAnimation("DonutHit", 0.03f);
				}
				((EntityState)this).PlayAnimation("Gesture, Override", "DonutHit", "ThrowBomb.playbackRate", duration * (1f - hitPercentTime), 0f);
				if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)standUser) && Object.op_Implicit((Object)(object)standUser.hitBoxGroup))
				{
					new OverlapAttack
					{
						attacker = ((EntityState)this).gameObject,
						inflictor = ((EntityState)this).gameObject,
						teamIndex = ((BaseState)this).GetTeam(),
						damage = 9f * ((BaseState)this).damageStat,
						procCoefficient = 1f,
						hitEffectPrefab = SharedEffects.punchHitImpactEffect,
						forceVector = standUser.ActionDirection * 3000f,
						pushAwayForce = 0f,
						hitBoxGroup = standUser.hitBoxGroup,
						isCrit = ((BaseState)this).RollCrit(),
						damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)1056), (DamageTypeExtended)0, (DamageSource)8),
						impactSound = DiavoloAssets.donutHitSoundEvent.index
					}.Fire((List<HurtBox>)null);
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(thrustDirection);
			NetworkExtensions.Write(writer, lockedTarget);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			thrustDirection = reader.ReadVector3();
			lockedTarget = NetworkExtensions.ReadHurtBoxReference(reader);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class Epitaph : BaseSkillState
	{
		private StandUser standUser;

		public override void OnEnter()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			standUser = ((EntityState)this).GetComponent<StandUser>();
			Util.PlaySound("Play_Diavolo_Epitaph", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)standUser))
			{
				standUser.UseStand(12f);
				standUser.BeginAction(Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).transform.forward, 1.2f, 1.2f);
				standUser.PlayStandAnimation("EpitaphStance", 0.05f);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddTimedBuff(DiavoloAssets.epitaphBuff, 1.2f);
			}
		}

		public override void FixedUpdate()
		{
			//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)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				if (((EntityState)this).characterBody.HasBuff(DiavoloAssets.epitaphTriggeredBuff))
				{
					HurtBox val = FindAttacker();
					((EntityState)this).outer.SetNextState((EntityState)(object)new EpitaphCounter
					{
						target = HurtBoxReference.FromHurtBox(val)
					});
				}
				else if (((EntityState)this).fixedAge >= 1.2f)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private HurtBox FindAttacker()
		{
			//IL_0031: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			StandTracker val = StandTracker.Of(((EntityState)this).gameObject);
			HurtBox val2 = (Object.op_Implicit((Object)(object)val) ? val.GetTrackingTarget() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				return val2;
			}
			HurtBox result = null;
			float num = 1600f;
			TeamIndex team = ((BaseState)this).GetTeam();
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) && readOnlyInstances.healthComponent.alive && Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) && readOnlyInstances.teamComponent.teamIndex != team && Object.op_Implicit((Object)(object)readOnlyInstances.mainHurtBox))
				{
					Vector3 val3 = readOnlyInstances.corePosition - ((EntityState)this).characterBody.corePosition;
					float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						result = readOnlyInstances.mainHurtBox;
					}
				}
			}
			return result;
		}

		public override void OnExit()
		{
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.ClearTimedBuffs(DiavoloAssets.epitaphBuff);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class EpitaphCounter : BaseSkillState
	{
		public static float baseDuration = 0.7f;

		public static float hitPercentTime = 0.35f;

		public HurtBoxReference target;

		private bool hit;

		private StandUser standUser;

		public override void OnEnter()
		{
			//IL_0187: 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_00ce: 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)
			//IL_0102: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0143: 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)
			((BaseState)this).OnEnter();
			standUser = ((EntityState)this).GetComponent<StandUser>();
			HurtBox val = ((HurtBoxReference)(ref target)).ResolveHurtBox();
			Util.PlaySound("Play_Diavolo_EpitaphCounter", ((EntityState)this).gameObject);
			Util.PlaySound("Play_Diavolo_TimeErase", ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Gesture, Override", "EpitaphHit", "ThrowBomb.playbackRate", baseDuration, 0f);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, baseDuration);
			}
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && Object.op_Implicit((Object)(object)val.healthComponent.body))
			{
				CharacterBody body = val.healthComponent.body;
				Vector3 val2 = body.footPosition - ((EntityState)this).characterBody.footPosition;
				val2.y = 0f;
				val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : ((EntityState)this).characterDirection.forward);
				TeleportHelper.TeleportBody(((EntityState)this).characterBody, body.footPosition + val2 * (body.radius + 2f));
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
				{
					((EntityState)this).characterDirection.forward = -val2;
				}
			}
			if (Object.op_Implicit((Object)(object)standUser))
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					standUser.BeginTargetedAction(val, baseDuration, 0.08f);
				}
				else
				{
					standUser.BeginAction(((EntityState)this).characterDirection.forward, 1.5f, baseDuration);
				}
				standUser.PlayStandAnimation("EpitaphHit", 0.02f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!hit && ((EntityState)this).fixedAge >= baseDuration * hitPercentTime)
			{
				hit = true;
				if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)standUser) && Object.op_Implicit((Object)(object)standUser.hitBoxGroup))
				{
					new OverlapAttack
					{
						attacker = ((EntityState)this).gameObject,
						inflictor = ((EntityState)this).gameObject,
						teamIndex = ((BaseState)this).GetTeam(),
						damage = 8f * ((BaseState)this).damageStat,
						procCoefficient = 1f,
						hitEffectPrefab = SharedEffects.punchHitImpactEffect,
						forceVector = standUser.ActionDirection * 2500f,
						hitBoxGroup = standUser.hitBoxGroup,
						isCrit = ((BaseState)this).RollCrit(),
						damageType = (DamageTypeCombo.GenericSpecial | DamageTypeCombo.op_Implicit((DamageType)32)),
						impactSound = DiavoloAssets.standPunchHitSoundEvents[2].index
					}.Fire((List<HurtBox>)null);
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= baseDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: 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)
			((BaseSkillState)this).OnDeserialize(reader);
			target = NetworkExtensions.ReadHurtBoxReference(reader);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}
	}
	public class KingCrimsonCutscene : StandCutscene
	{
		public static Track track;

		private static readonly Segment[] segments = (Segment[])(object)new Segment[4]
		{
			new Segment
			{
				userState = "Ult1",
				standState = "UltStart",
				cameraSegment = "h1",
				frames = 46f,
				sound = "Play_Diavolo_HHA1"
			},
			new Segment
			{
				userState = "Ult2",
				frames = 81f,
				sound = "Play_Diavolo_TimeErase"
			},
			new Segment
			{
				userState = "Ult3",
				frames = 13f
			},
			new Segment
			{
				userState = "Ult4",
				standState = "UltEnd",
				cameraSegment = "h3",
				frames = 41f,
				sound = "Play_Diavolo_HHA3"
			}
		};

		private const float finishTime = 4.866667f;

		private List<CharacterBody> victims;

		private int nextVictim;

		private float nextHit;

		protected override Segment[] Segments => segments;

		protected override Track Track => track;

		protected override string TitleToken => "KAVAHN_DIAVOLO_ULTIMATE_TITLE";

		protected override Color TitleColor => new Color(0.95f, 0.25f, 0.4f);

		protected override Color TintColor => new Color(0.6f, 0f, 0.15f, 0.12f);

		protected override void OnCutsceneStart()
		{
			if (Object.op_Implicit((Object)(object)base.standUser))
			{
				base.standUser.UseStand(50f);
			}
			StandCutIn.Show(((EntityState)this).characterBody, DiavoloAssets.cutInTexture, 3);
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (CharacterBody item in Enemies())
			{
				SetStateOnHurt component = ((Component)item).GetComponent<SetStateOnHurt>();
				if (Object.op_Implicit((Object)(object)component) && component.canBeStunned)
				{
					component.SetStun(((StandCutscene)this).Duration + 0.8f);
				}
			}
		}

		private List<CharacterBody> Enemies()
		{
			//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_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)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			List<CharacterBody> list = new List<CharacterBody>();
			TeamIndex team = ((BaseState)this).GetTeam();
			float num = 900f;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) && readOnlyInstances.healthComponent.alive && Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) && readOnlyInstances.teamComponent.teamIndex != team)
				{
					Vector3 val = readOnlyInstances.corePosition - ((EntityState)this).characterBody.corePosition;
					if (((Vector3)(ref val)).sqrMagnitude <= num)
					{
						list.Add(readOnlyInstances);
					}
				}
			}
			list.Sort(delegate(CharacterBody a, CharacterBody b)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				Vector3 val2 = a.corePosition - ((EntityState)this).characterBody.corePosition;
				float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
				val2 = b.corePosition - ((EntityState)this).characterBody.corePosition;
				return sqrMagnitude.CompareTo(((Vector3)(ref val2)).sqrMagnitude);
			});
			return list;
		}

		protected override void OnCutsceneUpdate(float time)
		{
			//IL_0034: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && !(time < 4.866667f))
			{
				if (victims == null)
				{
					victims = Enemies();
					nextHit = time;
					ShakeEmitter.CreateSimpleShakeEmitter(((EntityState)this).characterBody.corePosition, new Wave
					{
						amplitude = 3f,
						frequency = 25f
					}, 1.2f, 60f, true);
				}
				while (nextVictim < victims.Count && time >= nextHit)
				{
					Strike(victims[nextVictim++]);
					nextHit += 0.07f;
				}
			}
		}

		private void Strike(CharacterBody enemy)
		{
			//IL_0029: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)enemy.healthComponent) && enemy.healthComponent.alive)
			{
				EffectManager.SimpleImpactEffect(SharedEffects.punchHitImpactEffect, enemy.corePosition, Vector3.up, true);
				GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/BloodSplatterImpactEffect");
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OmniEffect/OmniExplosionVFXQuick");
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					EffectManager.SpawnEffect(val, new EffectData
					{
						origin = enemy.corePosition,
						scale = enemy.radius * 2f
					}, true);
				}
				EffectManager.SimpleSoundEffect(DiavoloAssets.donutHitSoundEvent.index, enemy.corePosition, true);
				HealthComponent healthComponent = enemy.healthComponent;
				DamageInfo val2 = new DamageInfo
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					damage = 18f * ((BaseState)this).damageStat,
					crit = ((BaseState)this).RollCrit(),
					position = enemy.corePosition
				};
				Vector3 val3 = enemy.corePosition - ((EntityState)this).characterBody.corePosition;
				val2.force = ((Vector3)(ref val3)).normalized * 2500f + Vector3.up * 1000f;
				val2.procCoefficient = 1f;
				val2.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)1056), (DamageTypeExtended)0, (DamageSource)8);
				healthComponent.TakeDamage(val2);
			}
		}

		protected override void OnCutsceneEnd()
		{
			if (NetworkServer.active && victims != null)
			{
				while (nextVictim < victims.Count)
				{
					Strike(victims[nextVictim++]);
				}
			}
			if (((EntityState)this).isAuthority)
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Weapon2");
				if (Object.op_Implicit((Object)(object)val))
				{
					val.SetInterruptState((EntityState)(object)new TimeErase
					{
						eraseDuration = 5f,
						silent = true
					}, (InterruptPriority)7);
				}
			}
		}
	}
	public class KingCrimsonUltimate : BaseSkillState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			if (((EntityState)this).isAuthority)
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Body");
				if (Object.op_Implicit((Object)(object)val))
				{
					val.SetInterruptState((EntityState)(object)new KingCrimsonCutscene(), (InterruptPriority)7);
				}
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class KingCrimsonPunch : BaseMeleeAttack
	{
		private bool useStand;

		private Vector3 punchDirection;

		private HurtBoxReference lockedTarget;

		private StandUser standUser;

		public override void OnEnter()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			standUser = ((EntityState)this).GetComponent<StandUser>();
			float num = 4f / Mathf.Max(((EntityState)this).characterBody.attackSpeed, 0.1f);
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				punchDirection = ((Ray)(ref aimRay)).direction;
				StandTracker val = ((Object.op_Implicit((Object)(object)standUser) && standUser.CanUseStand(num)) ? StandTracker.Of(((EntityState)this).gameObject) : null);
				HurtBox val2 = (Object.op_Implicit((Object)(object)val) ? val.GetTrackingTarget() : null);
				useStand = Object.op_Implicit((Object)(object)val2);
				lockedTarget = HurtBoxReference.FromHurtBox(val2);
			}
			base.hitboxGroupName = "SwordGroup";
			base.damageType = DamageTypeCombo.GenericPrimary;
			base.procCoefficient = 1f;
			base.bonusForce = Vector3.zero;
			base.attackStartPercentTime = 0.2f;
			base.attackEndPercentTime = 0.4f;
			base.earlyExitPercentTime = 0.55f;
			base.attackRecoil = 0.5f;
			base.hitSoundString = "";
			base.muzzleString = ((base.swingIndex % 2 == 0) ? "SwingLeft" : "SwingRight");
			base.playbackRateParam = "Slash.playbackRate";
			base.swingEffectPrefab = SharedEffects.punchSwingEffect;
			base.hitEffectPrefab = SharedEffects.punchHitImpactEffect;
			if (useStand)
			{
				base.damageCoefficient = 2.8f;
				base.hitStopDuration = 0f;
				base.aimUser = false;
				base.pushForce = 300f;
				base.baseDuration = 0.75f;
				base.hitHopVelocity = 0f;
				base.swingSoundString = DiavoloSounds.standPunchSwings[base.swingIndex % DiavoloSounds.standPunchSwings.Length];
				base.swingSoundSource = standUser.StandObject;
				base.impactSound = DiavoloAssets.standPunchHitSoundEvents[base.swingIndex % DiavoloAssets.standPunchHitSoundEvents.Length].index;
				standUser.UseStand(num);
			}
			else
			{
				base.damageCoefficient = 1.2f;
				base.hitStopDuration = 0.012f;
				base.pushForce = 150f;
				base.baseDuration = 0.9f;
				base.hitHopVelocity = 4f;
				base.swingSoundString = DiavoloSounds.diavoloSwings[base.swingIndex % DiavoloSounds.diavoloSwings.Length];
				base.impactSound = DiavoloAssets.diavoloPunchHitSoundEvent.index;
			}
			((BaseMeleeAttack)this).OnEnter();
			Util.PlaySound(DiavoloSounds.PunchShout(base.swingIndex), ((EntityState)this).gameObject);
			if (useStand)
			{
				HurtBox val3 = ((HurtBoxReference)(ref lockedTarget)).ResolveHurtBox();
				if (Object.op_Implicit((Object)(object)val3))
				{
					standUser.BeginTargetedAction(val3, base.duration, base.attackStartPercentTime * base.duration);
				}
				else
				{
					standUser.BeginAction(punchDirection, 1.6f, base.duration);
				}
				standUser.PlayStandAnimation("Punch" + (1 + base.swingIndex), 0.05f);
			}
		}

		protected override void ModifyOverlapAttack(OverlapAttack attack)
		{
			((BaseMeleeAttack)this).ModifyOverlapAttack(attack);
			if (useStand && Object.op_Implicit((Object)(object)standUser) && Object.op_Implicit((Object)(object)standUser.hitBoxGroup))
			{
				attack.hitBoxGroup = standUser.hitBoxGroup;
			}
		}

		protected override void PlaySwingEffect()
		{
			if (!useStand)
			{
				((BaseMeleeAttack)this).PlaySwingEffect();
			}
		}

		protected override void PlayAttackAnimation()
		{
			if (useStand)
			{
				((EntityState)this).PlayCrossfade("Gesture, Override", "StandPunch" + (1 + base.swingIndex), base.playbackRateParam, base.duration, 0.1f * base.duration);
			}
			else
			{
				((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + base.swingIndex), base.playbackRateParam, base.duration, 0.1f * base.duration);
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0015: 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)
			((BaseMeleeAttack)this).OnSerialize(writer);
			writer.Write(useStand);
			writer.Write(punchDirection);
			NetworkExtensions.Write(writer, lockedTarget);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((BaseMeleeAttack)this).OnDeserialize(reader);
			useStand = reader.ReadBoolean();
			punchDirection = reader.ReadVector3();
			lockedTarget = NetworkExtensions.ReadHurtBoxReference(reader);
		}
	}
	public class KingCrimsonSmash : BaseSkillState
	{
		public static float baseDuration = 0.8f;

		public static float hitPercentTime = 0.48f;

		private float duration;

		private bool hit;

		private Vector3 smashDirection;

		private HurtBoxReference lockedTarget;

		private StandUser standUser;

		public override void OnEnter()
		{
			//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_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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			standUser = ((EntityState)this).GetComponent<StandUser>();
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				smashDirection = ((Ray)(ref aimRay)).direction;
				StandTracker val = StandTracker.Of(((EntityState)this).gameObject);
				lockedTarget = HurtBoxReference.FromHurtBox(Object.op_Implicit((Object)(object)val) ? val.GetTrackingTarget() : null);
			}
			((EntityState)this).PlayAnimation("Gesture, Override", "Smash", "ThrowBomb.playbackRate", duration, 0f);
			Util.PlaySound("Play_Diavolo_Smash", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)standUser))
			{
				standUser.UseStand(14f);
				HurtBox val2 = ((HurtBoxReference)(ref lockedTarget)).ResolveHurtBox();
				if (Object.op_Implicit((Object)(object)val2))
				{
					standUser.BeginTargetedAction(val2, duration, hitPercentTime * duration * 0.8f);
				}
				else
				{
					standUser.BeginAction(smashDirection, 3f, duration);
				}
				standUser.PlayStandAnimation("Smash", 0.05f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!hit && ((EntityState)this).fixedAge >= duration * hitPercentTime)
			{
				hit = true;
				Smash();
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Smash()
		{
			//IL_003a: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00ab: 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_00c2: Expected O, but got Unknown
			Vector3 val = (Object.op_Implicit((Object)(object)standUser) ? standUser.StandPosition : (((EntityState)this).characterBody.corePosition + ((EntityState)this).characterDirection.forward * 3f));
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val + Vector3.up, Vector3.down, ref val2, 8f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				val = ((RaycastHit)(ref val2)).point;
			}
			if (NetworkServer.active)
			{
				GameObject val3 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/PodGroundImpact");
				if (!Object.op_Implicit((Object)(object)val3))
				{
					val3 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OmniEffect/OmniExplosionVFXQuick");
				}
				if (Object.op_Implicit((Object)(object)val3))
				{
					EffectManager.SpawnEffect(val3, new EffectData
					{
						origin = val,
						scale = 7f
					}, true);
				}
				EffectManager.SimpleSoundEffect(DiavoloAssets.smashHitSoundEvent.index, val, true);
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = ((BaseState)this).GetTeam(),
					position = val,
					radius = 7f,
					baseDamage = 4.5f * ((BaseState)this).damageStat,
					baseForce = 400f,
					bonusForce = Vector3.up * 2200f,
					procCoefficient = 1f,
					crit = ((BaseState)this).RollCrit(),
					falloffModel = (FalloffModel)2,
					damageType = DamageTypeCombo.GenericSecondary,
					attackerFiltering = (AttackerFiltering)2
				}.Fire();
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(smashDirection);
			NetworkExtensions.Write(writer, lockedTarget);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			smashDirection = reader.ReadVector3();
			lockedTarget = NetworkExtensions.ReadHurtBoxReference(reader);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class TimeErase : BaseSkillState
	{
		public static float baseDuration = 0.3f;

		public float eraseDuration = 2.5f;

		public bool silent;

		public override void OnEnter()
		{
			//IL_009c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			if (!silent)
			{
				Util.PlaySound("Play_Diavolo_TimeErase", ((EntityState)this).gameObject);
				((EntityState)this).PlayAnimation("Gesture, Override", "TimeErase", "ThrowBomb.playbackRate", 0.7f, 0f);
			}
			if (!NetworkServer.active)
			{
				return;
			}
			((EntityState)this).characterBody.AddTimedBuff(DiavoloAssets.timeErasedBuff, eraseDuration);
			((EntityState)this).characterBody.AddTimedBuff(Buffs.Cloak, eraseDuration);
			((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, eraseDuration);
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/Bandit2SmokeBomb");
			if (Object.op_Implicit((Object)(object)val))
			{
				EffectManager.SpawnEffect(val, new EffectData
				{
					origin = ((EntityState)this).characterBody.corePosition,
					scale = 6f
				}, true);
			}
			foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
			{
				BaseAI[] array = (Object.op_Implicit((Object)(object)readOnlyInstances) ? readOnlyInstances.aiComponents : Array.Empty<BaseAI>());
				foreach (BaseAI val2 in array)
				{
					if (Object.op_Implicit((Object)(object)val2) && val2.currentEnemy != null && (Object)(object)val2.currentEnemy.gameObject == (Object)(object)((EntityState)this).gameObject)
					{
						val2.currentEnemy.Reset();
					}
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
}
namespace JJBAMod.Survivors.Diavolo.Components
{
	public static class DiavoloHooks
	{
		public static void Init()
		{
			//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
			HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(TakeDamageProcess);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients);
		}

		private static void TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_006e: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && damageInfo != null && !damageInfo.rejected && damageInfo.damage > 0f && self.body.HasBuff(DiavoloAssets.epitaphBuff) && (Object)(object)damageInfo.attacker != (Object)(object)((Component)self).gameObject && (damageInfo.damageType.damageType & 0x200000) == 0)
			{
				damageInfo.rejected = true;
				self.body.RemoveBuff(DiavoloAssets.epitaphBuff);
				self.body.AddTimedBuff(DiavoloAssets.epitaphTriggeredBuff, 0.5f);
				EffectManager.SimpleImpactEffect(SharedEffects.punchHitImpactEffect, damageInfo.position, damageInfo.force, true);
			}
			orig.Invoke(self, damageInfo);
		}

		private static void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender))
			{
				if (sender.HasBuff(DiavoloAssets.timeErasedBuff))
				{
					args.moveSpeedMultAdd += 0.6f;
				}
				if (sender.HasBuff(DiavoloAssets.resultBuff))
				{
					args.critAdd += 100f;
				}
			}
		}
	}
	public class TimeEraseController : MonoBehaviour
	{
		private class FadingAfterimage : MonoBehaviour
		{
			public Mesh mesh;

			private float age;

			private const float life = 0.45f;

			private MaterialPropertyBlock block;

			private MeshRenderer meshRenderer;

			private void Start()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Expected O, but got Unknown
				block = new MaterialPropertyBlock();
				meshRenderer = ((Component)this).GetComponent<MeshRenderer>();
			}

			private void Update()
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				age += Time.deltaTime;
				if (age >= 0.45f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				block.SetColor("_Color", new Color(0.95f, 0.15f, 0.35f, 0.45f * (1f - age / 0.45f)));
				((Renderer)meshRenderer).SetPropertyBlock(block);
			}

			private void OnDestroy()
			{
				if (Object.op_Implicit((Object)(object)mesh))
				{
					Object.Destroy((Object)(object)mesh);
				}
			}
		}

		private CharacterBody body;

		private StandUser standUser;

		private bool wasErased;

		private float ghostTimer;

		private float projectileTimer;

		private float weight;

		private static Material ghostMaterial;

		private static PostProcessVolume volume;

		private static ColorGrading grading;

		private bool Erased
		{
			get
			{
				if (Object.op_Implicit((Object)(object)body))
				{
					return body.HasBuff(DiavoloAssets.timeErasedBuff);
				}
				return false;
			}
		}

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

		private void Update()
		{
			bool erased = Erased;
			if (!erased && wasErased)
			{
				OnTimeResumes();
			}
			wasErased = erased;
			if (erased)
			{
				ghostTimer -= Time.deltaTime;
				if (ghostTimer <= 0f)
				{
					ghostTimer = 0.07f;
					SpawnAfterimage();
				}
			}
			UpdateGrading(erased && body.hasEffectiveAuthority);
		}

		private void FixedUpdate()
		{
			if (NetworkServer.active && Erased)
			{
				projectileTimer -= Time.fixedDeltaTime;
				if (!(projectileTimer > 0f))
				{
					projectileTimer = 0.1f;
					EraseProjectiles();
				}
			}
		}

		private void EraseProjectiles()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)body.teamComponent)) ? (-1) : ((int)body.teamComponent.teamIndex));
			HashSet<GameObject> hashSet = new HashSet<GameObject>();
			Collider[] array = Physics.OverlapSphere(body.corePosition, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.projectile)).mask), (QueryTriggerInteraction)2);
			foreach (Collider val2 in array)
			{
				ProjectileController val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponentInParent<ProjectileController>() : null);
				if (Object.op_Implicit((Object)(object)val3) && !hashSet.Contains(((Component)val3).gameObject))
				{
					TeamFilter component = ((Component)val3).GetComponent<TeamFilter>();
					if (!Object.op_Implicit((Object)(object)component) || component.teamIndex != val)
					{
						hashSet.Add(((Component)val3).gameObject);
						EffectManager.SimpleEffect(SharedEffects.punchHitImpactEffect, ((Component)val3).transform.position, Quaternion.identity, true);
						Object.Destroy((Object)(object)((Component)val3).gameObject);
					}
				}
			}
		}

		private void OnTimeResumes()
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			Util.PlaySound("Play_Diavolo_TimeEraseEnd", ((Component)this).gameObject);
			List<CharacterBody> list = NearestEnemies();
			if (Object.op_Implicit((Object)(object)standUser) && list.Count > 0 && Object.op_Implicit((Object)(object)list[0].mainHurtBox))
			{
				standUser.UseStand(0f);
				standUser.BeginTargetedAction(list[0].mainHurtBox, 0.6f, 0.05f);
				standUser.PlayStandAnimation("Punch3", 0.02f);
			}
			if (!NetworkServer.active)
			{
				return;
			}
			body.AddTimedBuff(DiavoloAssets.resultBuff, 2f);
			Util.PlaySound("Play_Diavolo_EpitaphCounter", ((Component)this).gameObject);
			foreach (CharacterBody item in list)
			{
				EffectManager.SimpleImpactEffect(SharedEffects.punchHitImpactEffect, item.corePosition, Vector3.up, true);
				EffectManager.SimpleSoundEffect(DiavoloAssets.donutHitSoundEvent.index, item.corePosition, true);
				HealthComponent healthComponent = item.healthComponent;
				DamageInfo val = new DamageInfo
				{
					attacker = ((Component)this).gameObject,
					inflictor = ((Component)this).gameObject,
					damage = 6f * body.damage,
					crit = true,
					position = item.corePosition
				};
				Vector3 val2 = item.corePosition - body.corePosition;
				val.force = ((Vector3)(ref val2)).normalized * 1500f;
				val.procCoefficient = 1f;
				val.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)0, (DamageSource)4);
				healthComponent.TakeDamage(val);
			}
		}

		private List<CharacterBody> NearestEnemies()
		{
			//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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			List<CharacterBody> list = new List<CharacterBody>();
			TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)body.teamComponent)) ? (-1) : ((int)body.teamComponent.teamIndex));
			float num = 256f;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) && readOnlyInstances.healthComponent.alive && Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) && readOnlyInstances.teamComponent.teamIndex != val)
				{
					Vector3 val2 = readOnlyInstances.corePosition - body.corePosition;
					if (((Vector3)(ref val2)).sqrMagnitude <= num)
					{
						list.Add(readOnlyInstances);
					}
				}
			}
			list.Sort(delegate(CharacterBody a, CharacterBody b)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				Vector3 val3 = a.corePosition - body.corePosition;
				float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
				val3 = b.corePosition - body.corePosition;
				return sqrMagnitude.CompareTo(((Vector3)(ref val3)).sqrMagnitude);
			});
			if (list.Count > 3)
			{
				list.RemoveRange(3, list.Count - 3);
			}
			return list;
		}

		private void SpawnAfterimage()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			Transform val = (Object.op_Implicit((Object)(object)body.modelLocator) ? body.modelLocator.modelTransform : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)ghostMaterial))
			{
				ghostMaterial = new Material(FX.SpriteMaterial);
			}
			SkinnedMeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val2 in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.sharedMesh))
				{
					Mesh val3 = new Mesh();
					val2.BakeMesh(val3, true);
					GameObject val4 = new GameObject("KingCrimsonAfterimage");
					val4.transform.SetPositionAndRotation(((Component)val2).transform.position, ((Component)val2).transform.rotation);
					val4.AddComponent<MeshFilter>().sharedMesh = val3;
					MeshRenderer obj = val4.AddComponent<MeshRenderer>();
					((Renderer)obj).sharedMaterial = ghostMaterial;
					((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)obj).receiveShadows = false;
					val4.AddComponent<FadingAfterimage>().mesh = val3;
				}
			}
		}

		private void UpdateGrading(bool show)
		{
			if (show || !(weight <= 0f))
			{
				CreateGrading();
				float num = weight;
				weight = Mathf.MoveTowards(weight, show ? 1f : 0f, Time.unscaledDeltaTime / (show ? 0.1f : 0.35f));
				bool flag = show && num < 1f;
				((ParameterOverride<float>)(object)grading.hueShift).Override(flag ? 180f : 0f);
				volume.weight = weight;
			}
		}

		private void OnDisable()
		{
			if (weight > 0f && Object.op_Implicit((Object)(object)volume))
			{
				volume.weight = 0f;
			}
			weight = 0f;
		}

		private static void CreateGrading()
		{
			//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: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)volume))
			{
				GameObject val = new GameObject("KingCrimsonEraseGrading");
				Object.DontDestroyOnLoad((Object)val);
				val.layer = LayerIndex.postProcess.intVal;
				volume = val.AddComponent<PostProcessVolume>();
				volume.isGlobal = true;
				volume.priority = 199f;
				volume.weight = 0f;
				PostProcessProfile val2 = ScriptableObject.CreateInstance<PostProcessProfile>();
				grading = val2.AddSettings<ColorGrading>();
				((ParameterOverride<bool>)(object)((PostProcessEffectSettings)grading).enabled).Override(true);
				((ParameterOverride<float>)(object)grading.saturation).Override(-70f);
				((ParameterOverride<float>)(object)grading.contrast).Override(40f);
				((ParameterOverride<Color>)(object)grading.colorFilter).Override(new Color(1f, 0.35f, 0.5f));
				((ParameterOverride<float>)(object)grading.postExposure).Override(-0.4f);
				((ParameterOverride<float>)(object)grading.hueShift).Override(0f);
				Vignette obj = val2.AddSettings<Vignette>();
				((ParameterOverride<bool>)(object)((PostProcessEffectSettings)obj).enabled).Override(true);
				((ParameterOverride<Color>)(object)obj.color).Override(new Color(0.4f, 0f, 0.1f));
				((ParameterOverride<float>)(object)obj.intensity).Override(0.55f);
				((ParameterOverride<float>)(object)obj.smoothness).Override(0.6f);
				ChromaticAberration obj2 = val2.AddSettings<ChromaticAberration>();
				((ParameterOverride<bool>)(object)((PostProcessEffectSettings)obj2).enabled).Override(true);
				((ParameterOverride<float>)(object)obj2.intensity).Override(0.6f);
				volume.sharedProfile = val2;
			}
		}
	}
	public class KingCrimsonColor : MonoBehaviour
	{
		private void Start()
		{
			CharacterBody component = ((Component)this).GetComponent<CharacterBody>();
			StandUser component2 = ((Component)this).GetComponent<StandUser>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component.skinIndex % 2 == 1 && Object.op_Implicit((Object)(object)DiavoloAssets.kingCrimsonAltModel))
			{
				component2.SetStandModel(DiavoloAssets.kingCrimsonAltModel);
			}
		}
	}
}