Decompiled source of AcridSlam v1.0.0

AcridSlam.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using EntityStates;
using EntityStates.Croco;
using R2API;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;

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

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Quibibly.acridslam", "AcridSlam", "1.0.0")]
public class AcridSlamPlugin : BaseUnityPlugin
{
	private const string BodyKey = "RoR2/Base/Croco/CrocoBody.prefab";

	public static GameObject CrackEffect;

	public static bool CrackRegistered;

	private static GameObject effectHolder;

	private void Awake()
	{
		try
		{
			Register();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"AcridSlam 1.0.0 loaded");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Setup failed: " + ex));
		}
	}

	private void BuildCrackEffect()
	{
		//IL_00e9: 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_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Expected O, but got Unknown
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!AcridSlamState.groundCrackEffect)
			{
				return;
			}
			string text = null;
			foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators)
			{
				foreach (object key in resourceLocator.Keys)
				{
					if (key is string text2 && text2.EndsWith(AcridSlamState.groundCrackAssetName + ".prefab", StringComparison.OrdinalIgnoreCase))
					{
						text = text2;
						break;
					}
				}
				if (text != null)
				{
					break;
				}
			}
			if (text == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Ground crack effect not found: " + AcridSlamState.groundCrackAssetName));
				return;
			}
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)text).WaitForCompletion();
			if (!Object.op_Implicit((Object)(object)val))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not load " + text));
				return;
			}
			effectHolder = new GameObject("AcridSlamEffectHolder");
			effectHolder.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)effectHolder);
			GameObject val2 = Object.Instantiate<GameObject>(val, effectHolder.transform);
			((Object)val2).name = "AcridSlamGroundCrack";
			val2.transform.localScale = val.transform.localScale * AcridSlamState.groundCrackScale;
			ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem val3 in componentsInChildren)
			{
				MainModule main = val3.main;
				((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0;
			}
			CrackRegistered = ContentAddition.AddEffect(val2);
			CrackEffect = val2;
			if (!CrackRegistered)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not register the ground crack effect; it will only show locally.");
			}
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Ground crack setup failed: " + ex.Message));
		}
	}

	private void Register()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: 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_0150: 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_017a: Expected O, but got Unknown
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		LanguageAPI.Add("ACRIDSLAM_PRIMARY_NAME", "Crushing Slam");
		LanguageAPI.Add("ACRIDSLAM_PRIMARY_DESC", "Claw an enemy for <style=cIsDamage>200% damage</style>. Every 3rd hit does <style=cIsDamage>" + Mathf.RoundToInt(AcridSlamState.damageCoefficient * 100f) + "% damage</style> in an area, and applies the opposite of your selected passive effect to enemies.");
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoBody.prefab").WaitForCompletion();
		if (!Object.op_Implicit((Object)(object)val))
		{
			throw new Exception("Could not load RoR2/Base/Croco/CrocoBody.prefab");
		}
		SkillFamily skillFamily = val.GetComponent<SkillLocator>().primary.skillFamily;
		SkillDef skillDef = skillFamily.variants[skillFamily.defaultVariantIndex].skillDef;
		SteppedSkillDef val2 = (SteppedSkillDef)(object)((skillDef is SteppedSkillDef) ? skillDef : null);
		if (!Object.op_Implicit((Object)(object)val2))
		{
			throw new Exception("Default primary is not a stepped skill.");
		}
		SteppedSkillDef val3 = Object.Instantiate<SteppedSkillDef>(val2);
		((Object)val3).name = "AcridSlamPrimary";
		((SkillDef)val3).skillName = "AcridSlamPrimary";
		((SkillDef)val3).skillNameToken = "ACRIDSLAM_PRIMARY_NAME";
		((SkillDef)val3).skillDescriptionToken = "ACRIDSLAM_PRIMARY_DESC";
		((SkillDef)val3).keywordTokens = new string[0];
		((SkillDef)val3).activationState = new SerializableEntityStateType(typeof(AcridComboState));
		bool flag = default(bool);
		ContentAddition.AddEntityState<AcridComboState>(ref flag);
		ContentAddition.AddEntityState<AcridSlamState>(ref flag);
		ContentAddition.AddSkillDef((SkillDef)(object)val3);
		BuildCrackEffect();
		int num = skillFamily.variants.Length;
		Array.Resize(ref skillFamily.variants, num + 1);
		Variant[] variants = skillFamily.variants;
		Variant val4 = new Variant
		{
			skillDef = (SkillDef)(object)val3,
			unlockableDef = null
		};
		((Variant)(ref val4)).viewableNode = new Node(((SkillDef)val3).skillNameToken, false, (Node)null);
		variants[num] = val4;
	}
}
public class AcridComboState : BaseSkillState, IStepSetter
{
	private int step;

	public void SetStep(int i)
	{
		step = i;
	}

	public override void OnEnter()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		((BaseState)this).OnEnter();
		if (((EntityState)this).isAuthority)
		{
			if (step >= 2)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new AcridSlamState());
				return;
			}
			Slash val = new Slash();
			((IStepSetter)val).SetStep(step);
			((EntityState)this).outer.SetNextState((EntityState)(object)val);
		}
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
[DefaultExecutionOrder(10000)]
public class AcridSlamPose : MonoBehaviour
{
	private class Arm
	{
		public Transform upper;

		public Transform lower;

		public Transform hand;

		public Transform finger;

		public Transform thumb;

		public Transform[] curl;

		public float side;
	}

	public bool active;

	public static float handRoll = 0f;

	public static float fistAmount = 1f;

	public float weight;

	public float slamT;

	public float chestAngle;

	public Vector3 facing;

	public static Vector3 raisedUpper = new Vector3(0.35f, 0.75f, 0.3f);

	public static Vector3 raisedHint = new Vector3(0.1f, 0.95f, -0.1f);

	public static Vector3 slamHint = new Vector3(0.3f, -0.8f, -0.3f);

	public static float raisedBend = 70f;

	public static float slamBend = 35f;

	public static Vector3 riseUpper = new Vector3(0.85f, 0.45f, 0.15f);

	public static Vector3 midUpper = new Vector3(0.9f, 0.35f, 0.15f);

	public static Vector3 slamUpper = new Vector3(0.7f, -0.55f, 0.35f);

	private Arm left;

	private Arm right;

	private Transform chest;

	private Transform hip;

	private Transform head;

	private bool searched;

	public Transform FindChild(string name)
	{
		return FindDeep(((Component)this).transform, name);
	}

	private static Transform FindDeep(Transform root, string name)
	{
		if (((Object)root).name == name)
		{
			return root;
		}
		for (int i = 0; i < root.childCount; i++)
		{
			Transform val = FindDeep(root.GetChild(i), name);
			if (Object.op_Implicit((Object)(object)val))
			{
				return val;
			}
		}
		return null;
	}

	private Arm MakeArm(string suffix)
	{
		Arm arm = new Arm();
		arm.upper = FindDeep(((Component)this).transform, "upper_arm." + suffix);
		arm.lower = FindDeep(((Component)this).transform, "lower_arm." + suffix);
		arm.hand = FindDeep(((Component)this).transform, "hand." + suffix);
		arm.finger = FindDeep(((Component)this).transform, "finger2.1." + suffix);
		arm.thumb = FindDeep(((Component)this).transform, "thumb.1." + suffix);
		string[] array = new string[11]
		{
			"finger1.1.", "finger1.2.", "finger1.3.", "finger2.1.", "finger2.2.", "finger2.3.", "finger3.1.", "finger3.2.", "finger3.3.", "thumb.1.",
			"thumb.2."
		};
		arm.curl = (Transform[])(object)new Transform[array.Length];
		for (int i = 0; i < array.Length; i++)
		{
			arm.curl[i] = FindDeep(((Component)this).transform, array[i] + suffix);
		}
		if (!Object.op_Implicit((Object)(object)arm.upper) || !Object.op_Implicit((Object)(object)arm.lower) || !Object.op_Implicit((Object)(object)arm.hand))
		{
			return null;
		}
		return arm;
	}

	private void LateUpdate()
	{
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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_013c: 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_013e: 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_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_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: 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_0176: 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_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: 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_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		if (!active || weight <= 0.0001f)
		{
			return;
		}
		if (!searched)
		{
			searched = true;
			chest = FindDeep(((Component)this).transform, "chest");
			hip = FindDeep(((Component)this).transform, "hip");
			head = FindDeep(((Component)this).transform, "head");
			left = MakeArm("l");
			right = MakeArm("r");
		}
		Vector3 val = ((((Vector3)(ref facing)).sqrMagnitude > 0.01f) ? ((Vector3)(ref facing)).normalized : ((Component)this).transform.forward);
		if (Object.op_Implicit((Object)(object)hip) && Object.op_Implicit((Object)(object)head))
		{
			Vector3 val2 = head.position - hip.position;
			val2.y = 0f;
			if (((Vector3)(ref val2)).magnitude > 0.2f)
			{
				val = ((Vector3)(ref val2)).normalized;
			}
		}
		Vector3 up = Vector3.up;
		Vector3 val3 = Vector3.Cross(up, val);
		Vector3 normalized = ((Vector3)(ref val3)).normalized;
		if (Object.op_Implicit((Object)(object)chest))
		{
			chest.rotation = Quaternion.AngleAxis(chestAngle, normalized) * chest.rotation;
		}
		Vector3 val4 = (Object.op_Implicit((Object)(object)chest) ? chest.position : ((Component)this).transform.position);
		if (left != null)
		{
			left.side = Mathf.Sign(Vector3.Dot(left.upper.position - val4, normalized));
		}
		if (right != null)
		{
			right.side = Mathf.Sign(Vector3.Dot(right.upper.position - val4, normalized));
		}
		Aim(left, val, up, normalized);
		Aim(right, val, up, normalized);
	}

	private Vector3 ToWorld(Vector3 d, Vector3 fwd, Vector3 up, Vector3 rt, float side)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references)
		//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_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_003e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = fwd * d.x + up * d.y + rt * (d.z * side);
		return ((Vector3)(ref val)).normalized;
	}

	private static void Turn(Transform bone, Vector3 from, Vector3 to)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		bone.rotation = Quaternion.FromToRotation(from, to) * bone.rotation;
	}

	private void Aim(Arm a, Vector3 fwd, Vector3 up, Vector3 rt)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_010d: 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_011b: 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_00f3: 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_00cb: 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_00da: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: 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_013a: 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_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: 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_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: 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_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: 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_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0374: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0411: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0415: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0504: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0498: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_054b: Unknown result type (might be due to invalid IL or missing references)
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		//IL_055b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0560: Unknown result type (might be due to invalid IL or missing references)
		if (a == null)
		{
			return;
		}
		Vector3 val = a.lower.position - a.upper.position;
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		Vector3 val2 = ToWorld(raisedUpper, fwd, up, rt, a.side);
		Vector3 val3 = ToWorld(midUpper, fwd, up, rt, a.side);
		Vector3 val4 = ToWorld(slamUpper, fwd, up, rt, a.side);
		Vector3 val6;
		if (slamT < 0.001f)
		{
			Vector3 val5 = ToWorld(riseUpper, fwd, up, rt, a.side);
			val6 = ((weight < 0.5f) ? Vector3.Slerp(normalized, val5, weight * 2f) : Vector3.Slerp(val5, val2, weight * 2f - 1f));
		}
		else
		{
			Vector3 val7 = ((slamT < 0.5f) ? Vector3.Slerp(val2, val3, slamT * 2f) : Vector3.Slerp(val3, val4, slamT * 2f - 1f));
			val6 = Vector3.Slerp(normalized, val7, weight);
		}
		Turn(a.upper, normalized, val6);
		Vector3 val8 = Vector3.Slerp(ToWorld(raisedHint, fwd, up, rt, a.side), ToWorld(slamHint, fwd, up, rt, a.side), slamT);
		Vector3 val9 = val8 - val6 * Vector3.Dot(val8, val6);
		if (((Vector3)(ref val9)).sqrMagnitude < 0.0001f)
		{
			val9 = fwd;
		}
		((Vector3)(ref val9)).Normalize();
		float num = Mathf.Lerp(raisedBend, slamBend, slamT) * (MathF.PI / 180f);
		val = val6 * Mathf.Cos(num) + val9 * Mathf.Sin(num);
		Vector3 normalized2 = ((Vector3)(ref val)).normalized;
		val = a.hand.position - a.lower.position;
		normalized = ((Vector3)(ref val)).normalized;
		Vector3 to = Vector3.Slerp(normalized, normalized2, weight);
		Turn(a.lower, normalized, to);
		float num2 = weight;
		if (!Object.op_Implicit((Object)(object)a.finger) || !Object.op_Implicit((Object)(object)a.thumb))
		{
			return;
		}
		val = a.finger.position - a.hand.position;
		Vector3 normalized3 = ((Vector3)(ref val)).normalized;
		Vector3 val10 = a.thumb.position - a.hand.position;
		Vector3 val11 = val10 - normalized3 * Vector3.Dot(val10, normalized3);
		if (!(((Vector3)(ref val11)).sqrMagnitude > 1E-06f))
		{
			return;
		}
		((Vector3)(ref val11)).Normalize();
		val = fwd * 0.85f + up * 0.25f;
		Vector3 normalized4 = ((Vector3)(ref val)).normalized;
		val = fwd * 0.5f - up * 0.85f;
		Vector3 val12 = Vector3.Slerp(normalized4, ((Vector3)(ref val)).normalized, slamT);
		Vector3 val13 = up - val12 * Vector3.Dot(up, val12);
		((Vector3)(ref val13)).Normalize();
		val13 = Quaternion.AngleAxis(handRoll, val12) * val13;
		Quaternion val14 = Quaternion.LookRotation(val12, val13) * Quaternion.Inverse(Quaternion.LookRotation(normalized3, val11));
		a.hand.rotation = Quaternion.Slerp(Quaternion.identity, val14, num2) * a.hand.rotation;
		Vector3 val15 = -rt * a.side;
		val15 -= val12 * Vector3.Dot(val15, val12);
		if (!(((Vector3)(ref val15)).sqrMagnitude > 1E-06f) || a.curl == null)
		{
			return;
		}
		((Vector3)(ref val15)).Normalize();
		Vector3 val16 = Vector3.Cross(val12, val15);
		Vector3 val17 = Vector3.zero;
		for (int i = 0; i + 2 < 9; i += 3)
		{
			if (Object.op_Implicit((Object)(object)a.curl[i]) && Object.op_Implicit((Object)(object)a.curl[i + 1]) && Object.op_Implicit((Object)(object)a.curl[i + 2]))
			{
				Vector3 val18 = a.curl[i + 1].position - a.curl[i].position;
				Vector3 val19 = a.curl[i + 2].position - a.curl[i + 1].position;
				val17 += Vector3.Cross(((Vector3)(ref val18)).normalized, ((Vector3)(ref val19)).normalized);
			}
		}
		if (((Vector3)(ref val17)).magnitude > 0.05f)
		{
			val16 = ((Vector3)(ref val17)).normalized;
		}
		float[] array = new float[11]
		{
			80f, 90f, 60f, 80f, 90f, 60f, 80f, 90f, 60f, 25f,
			35f
		};
		for (int j = 0; j < a.curl.Length; j++)
		{
			if (Object.op_Implicit((Object)(object)a.curl[j]))
			{
				a.curl[j].rotation = Quaternion.AngleAxis(array[j] * fistAmount * num2, val16) * a.curl[j].rotation;
			}
		}
	}
}
public class AcridSlamState : BaseSkillState
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static ModifyBlastInfoCallback <>9__49_0;

		internal void <Slam>b__49_0(ref BlastAttackDamageInfo info, HitPoint hit)
		{
			//IL_004f: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			HealthComponent hitHealthComponent = info.hitHealthComponent;
			CharacterBody val = (Object.op_Implicit((Object)(object)hitHealthComponent) ? hitHealthComponent.body : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				if (val.isChampion || val.isBoss)
				{
					info.force = Vector3.zero;
					return;
				}
				info.force = Vector3.up * launchSpeed;
				info.physForceFlags = (PhysForceFlags)5;
				info.canRejectForce = false;
			}
		}
	}

	public static float damageCoefficient = 3.6f;

	public static float radius = 8f;

	public static float forwardOffset = 4f;

	public static float launchSpeed = 14f;

	public static float baseDuration = 0.9f;

	public static float raiseEnd = 0.3f;

	public static float slamStart = 0.38f;

	public static float fireFraction = 0.56f;

	public static float releaseStart = 0.72f;

	public static float raisedChest = -12f;

	public static float slamChest = 28f;

	public static bool useImpactAnim = true;

	public static float blendOutPrevious = 0.34f;

	public static float trailWidth = 0.45f;

	public static float trailLifetime = 0.18f;

	public static Color trailColor = new Color(0.75f, 1f, 0.25f, 1f);

	public static string slamSoundEvent = "Play_loader_R_variant_slam";

	public static string slamSoundBank = "char_loader";

	public static float impactRecoil = 1.6f;

	public static bool groundCrackEffect = true;

	public static string groundCrackAssetName = "EnforcerLeapImpact";

	public static float groundCrackScale = 0.4f;

	private float duration;

	private bool fired;

	private bool cancelled;

	private bool trailsSpawned;

	private Animator animator;

	private AcridSlamPose pose;

	private EntityStateMachine bodyMachine;

	private static Material trailMaterial;

	private static bool trailMaterialSearched;

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

	private static readonly string[] trailMaterialKeys = new string[4] { "RoR2/Base/Common/VFX/matTracerBright.mat", "RoR2/Base/Common/VFX/matTracer.mat", "RoR2/Base/Common/VFX/matOmniHitspark1.mat", "RoR2/Base/Common/VFX/matLoaderTrail.mat" };

	private static bool bankLoaded;

	private bool IsLeaping()
	{
		if (!Object.op_Implicit((Object)(object)bodyMachine))
		{
			bodyMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Body");
		}
		return Object.op_Implicit((Object)(object)bodyMachine) && bodyMachine.state is BaseLeap;
	}

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		((BaseState)this).StartAimMode(0.8f, false);
		animator = ((EntityState)this).GetModelAnimator();
		((EntityState)this).PlayCrossfade("Gesture, Override", "BufferEmpty", blendOutPrevious);
		((EntityState)this).PlayCrossfade("Gesture, AdditiveHigh", "BufferEmpty", blendOutPrevious);
		((EntityState)this).PlayCrossfade("Gesture, Additive", "BufferEmpty", blendOutPrevious);
		Transform modelTransform = ((EntityState)this).GetModelTransform();
		if (Object.op_Implicit((Object)(object)modelTransform))
		{
			pose = ((Component)modelTransform).GetComponent<AcridSlamPose>();
			if (!Object.op_Implicit((Object)(object)pose))
			{
				pose = ((Component)modelTransform).gameObject.AddComponent<AcridSlamPose>();
			}
			pose.weight = 0f;
			pose.slamT = 0f;
			pose.chestAngle = 0f;
			pose.active = true;
		}
		UpdateFacing(turnBody: true);
	}

	private void ApplyPose(float p)
	{
		if (Object.op_Implicit((Object)(object)pose))
		{
			float num;
			float num2;
			float chestAngle;
			if (p < raiseEnd)
			{
				num = Mathf.SmoothStep(0f, 1f, p / raiseEnd);
				num2 = 0f;
				chestAngle = Mathf.Lerp(0f, raisedChest, num);
			}
			else if (p < slamStart)
			{
				num = 1f;
				num2 = 0f;
				chestAngle = raisedChest;
			}
			else if (p < fireFraction)
			{
				float num3 = (p - slamStart) / Mathf.Max(0.001f, fireFraction - slamStart);
				num = 1f;
				num2 = num3 * num3;
				chestAngle = Mathf.Lerp(raisedChest, slamChest, num2);
			}
			else if (p < releaseStart)
			{
				num = 1f;
				num2 = 1f;
				chestAngle = slamChest;
			}
			else
			{
				float num4 = Mathf.SmoothStep(0f, 1f, (p - releaseStart) / Mathf.Max(0.001f, 1f - releaseStart));
				num = 1f - num4;
				num2 = 1f;
				chestAngle = slamChest * num;
			}
			pose.weight = num;
			pose.slamT = num2;
			pose.chestAngle = chestAngle;
		}
	}

	private static bool IsUsable(Material m)
	{
		return Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)m.shader) && m.shader.isSupported && ((Object)m.shader).name != "Hidden/InternalErrorShader";
	}

	private static Material FindTrailMaterial()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		if (trailMaterialSearched)
		{
			return trailMaterial;
		}
		trailMaterialSearched = true;
		string[] array = trailMaterialKeys;
		foreach (string text in array)
		{
			try
			{
				Material m = Addressables.LoadAssetAsync<Material>((object)text).WaitForCompletion();
				if (IsUsable(m))
				{
					trailMaterial = m;
					return trailMaterial;
				}
			}
			catch (Exception)
			{
			}
		}
		Material[] array2 = Resources.FindObjectsOfTypeAll<Material>();
		foreach (Material val in array2)
		{
			if (IsUsable(val) && (((Object)val.shader).name == "Sprites/Default" || ((Object)val.shader).name == "Unlit/Color"))
			{
				trailMaterial = val;
				break;
			}
		}
		return trailMaterial;
	}

	private static Material MakeTrailMaterial()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		Material val = FindTrailMaterial();
		if (!Object.op_Implicit((Object)(object)val))
		{
			return null;
		}
		Material val2 = new Material(val);
		string[] array = new string[5] { "_TintColor", "_Color", "_BaseColor", "_EmissionColor", "_MainColor" };
		string[] array2 = array;
		foreach (string text in array2)
		{
			if (val2.HasProperty(text))
			{
				val2.SetColor(text, trailColor);
			}
		}
		return val2;
	}

	private void SpawnClawTrails()
	{
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_00e5: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Expected O, but got Unknown
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!Object.op_Implicit((Object)(object)pose))
			{
				return;
			}
			Material val = MakeTrailMaterial();
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			string[] array = new string[2] { "MuzzleHandL", "MuzzleHandR" };
			string[] array2 = array;
			foreach (string name in array2)
			{
				Transform val2 = pose.FindChild(name);
				if (Object.op_Implicit((Object)(object)val2))
				{
					GameObject val3 = new GameObject("AcridSlamTrail");
					val3.transform.SetParent(val2, false);
					TrailRenderer val4 = val3.AddComponent<TrailRenderer>();
					((Renderer)val4).sharedMaterial = val;
					val4.time = trailLifetime;
					val4.minVertexDistance = 0.04f;
					val4.alignment = (LineAlignment)0;
					val4.widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, trailWidth),
						new Keyframe(1f, 0f)
					});
					Gradient val5 = new Gradient();
					val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
					{
						new GradientColorKey(trailColor, 0f),
						new GradientColorKey(trailColor, 1f)
					}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
					{
						new GradientAlphaKey(1f, 0f),
						new GradientAlphaKey(0f, 1f)
					});
					val4.colorGradient = val5;
					val4.emitting = true;
					trailObjects.Add(val3);
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("AcridSlam: claw trail failed: " + ex.Message));
		}
	}

	private void StopClawTrails()
	{
		foreach (GameObject trailObject in trailObjects)
		{
			if (Object.op_Implicit((Object)(object)trailObject))
			{
				TrailRenderer component = trailObject.GetComponent<TrailRenderer>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.emitting = false;
				}
				Object.Destroy((Object)(object)trailObject, trailLifetime + 0.2f);
			}
		}
		trailObjects.Clear();
	}

	private void UpdateFacing(bool turnBody)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
		Ray aimRay = ((BaseState)this).GetAimRay();
		Vector3 direction = ((Ray)(ref aimRay)).direction;
		direction.y = 0f;
		if (!(((Vector3)(ref direction)).sqrMagnitude < 0.001f))
		{
			((Vector3)(ref direction)).Normalize();
			if (Object.op_Implicit((Object)(object)pose))
			{
				pose.facing = ((((Vector3)(ref pose.facing)).sqrMagnitude > 0.01f) ? Vector3.Slerp(pose.facing, direction, 0.3f) : direction);
			}
			if (turnBody && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.moveVector = direction;
			}
		}
	}

	public override void Update()
	{
		((EntityState)this).Update();
		if (cancelled)
		{
			return;
		}
		if (IsLeaping())
		{
			cancelled = true;
			if (Object.op_Implicit((Object)(object)pose))
			{
				pose.active = false;
			}
			return;
		}
		float num = Mathf.Clamp01(((EntityState)this).age / duration);
		if (num < slamStart)
		{
			UpdateFacing(turnBody: false);
		}
		ApplyPose(num);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (!cancelled && IsLeaping())
		{
			cancelled = true;
			if (Object.op_Implicit((Object)(object)pose))
			{
				pose.active = false;
			}
		}
		if (cancelled)
		{
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			return;
		}
		float num = ((EntityState)this).fixedAge / duration;
		if (num < slamStart)
		{
			UpdateFacing(turnBody: true);
		}
		if (!trailsSpawned && num >= slamStart)
		{
			trailsSpawned = true;
			SpawnClawTrails();
		}
		if (!fired && num >= fireFraction)
		{
			fired = true;
			StopClawTrails();
			if (useImpactAnim && Object.op_Implicit((Object)(object)animator))
			{
				int layerIndex = animator.GetLayerIndex("Impact");
				if (layerIndex >= 0)
				{
					animator.SetLayerWeight(layerIndex, 1f);
				}
				((EntityState)this).PlayAnimation("Impact", "LightImpact");
			}
			if (((EntityState)this).isAuthority)
			{
				Slam();
			}
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		StopClawTrails();
		if (Object.op_Implicit((Object)(object)pose))
		{
			pose.active = false;
			pose.weight = 0f;
			pose.chestAngle = 0f;
		}
		((EntityState)this).OnExit();
	}

	private static void LoadSoundBank()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		if (!bankLoaded)
		{
			bankLoaded = true;
			uint num = default(uint);
			AkSoundEngine.LoadBank(slamSoundBank, ref num);
		}
	}

	private void SpawnGroundCrack()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_003b: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		if (groundCrackEffect && Object.op_Implicit((Object)(object)AcridSlamPlugin.CrackEffect))
		{
			Vector3 footPosition = ((EntityState)this).characterBody.footPosition;
			if (AcridSlamPlugin.CrackRegistered)
			{
				EffectData val = new EffectData();
				val.origin = footPosition;
				val.rotation = Quaternion.identity;
				EffectManager.SpawnEffect(AcridSlamPlugin.CrackEffect, val, true);
			}
			else
			{
				Object.Destroy((Object)(object)Object.Instantiate<GameObject>(AcridSlamPlugin.CrackEffect, footPosition, Quaternion.identity), 8f);
			}
		}
	}

	private DamageTypeCombo GetOppositeDebuff()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Invalid comparison between Unknown and I4
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Invalid comparison between Unknown and I4
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		DamageType val = (DamageType)4096;
		try
		{
			CrocoDamageTypeController val2 = (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((Component)((EntityState)this).characterBody).GetComponent<CrocoDamageTypeController>() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				DamageTypeCombo damageType = val2.GetDamageType();
				if ((damageType.damageType & 0x1000) > 0)
				{
					val = (DamageType)1048576;
				}
				else if ((damageType.damageType & 0x100000) > 0)
				{
					val = (DamageType)4096;
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("AcridSlam: could not read the passive: " + ex.Message));
		}
		return new DamageTypeCombo(DamageTypeCombo.op_Implicit(val), (DamageTypeExtended)0, (DamageSource)1);
	}

	private void Slam()
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Expected O, but got Unknown
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Expected O, but got Unknown
		bool flag = Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).characterMotor.isGrounded;
		if (flag)
		{
			LoadSoundBank();
			Util.PlaySound(slamSoundEvent, ((EntityState)this).gameObject);
		}
		((BaseState)this).AddRecoil(-2f * impactRecoil, -3f * impactRecoil, -1f * impactRecoil, 1f * impactRecoil);
		Ray aimRay = ((BaseState)this).GetAimRay();
		Vector3 val = ((Ray)(ref aimRay)).direction;
		val.y = 0f;
		if (((Vector3)(ref val)).sqrMagnitude < 0.001f)
		{
			val = ((EntityState)this).transform.forward;
		}
		((Vector3)(ref val)).Normalize();
		BlastAttack val2 = new BlastAttack();
		val2.attacker = ((EntityState)this).gameObject;
		val2.inflictor = ((EntityState)this).gameObject;
		val2.teamIndex = ((EntityState)this).characterBody.teamComponent.teamIndex;
		val2.position = ((EntityState)this).transform.position + val * forwardOffset;
		val2.radius = radius;
		val2.baseDamage = ((BaseState)this).damageStat * damageCoefficient;
		val2.baseForce = 0f;
		val2.bonusForce = Vector3.up;
		val2.crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
		val2.procCoefficient = 1f;
		val2.falloffModel = (FalloffModel)0;
		val2.losType = (LoSType)0;
		val2.attackerFiltering = (AttackerFiltering)2;
		val2.damageType = GetOppositeDebuff();
		object obj = <>c.<>9__49_0;
		if (obj == null)
		{
			ModifyBlastInfoCallback val3 = delegate(ref BlastAttackDamageInfo info, HitPoint hit)
			{
				//IL_004f: 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_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				HealthComponent hitHealthComponent = info.hitHealthComponent;
				CharacterBody val4 = (Object.op_Implicit((Object)(object)hitHealthComponent) ? hitHealthComponent.body : null);
				if (Object.op_Implicit((Object)(object)val4))
				{
					if (val4.isChampion || val4.isBoss)
					{
						info.force = Vector3.zero;
					}
					else
					{
						info.force = Vector3.up * launchSpeed;
						info.physForceFlags = (PhysForceFlags)5;
						info.canRejectForce = false;
					}
				}
			};
			<>c.<>9__49_0 = val3;
			obj = (object)val3;
		}
		val2.modifyOutgoingBlastInfoCallback = (ModifyBlastInfoCallback)obj;
		val2.Fire();
		if (flag)
		{
			SpawnGroundCrack();
		}
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)((!(((EntityState)this).fixedAge < duration * 0.6f)) ? 1 : 2);
	}
}