Decompiled source of Mordekaiser v1.0.2

Mordekaiser.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.Merc;
using JetBrains.Annotations;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;

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

internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name) where T : Object
	{
		return MainAssetBundle.LoadAsset<T>(name);
	}

	public static void PopulateAssets()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using Stream stream = executingAssembly.GetManifestResourceStream("Mordekaiser.AssetBundle." + "Mordekaiser".ToLower() + "assets");
			MainAssetBundle = AssetBundle.LoadFromStream(stream);
		}
		using Stream stream2 = executingAssembly.GetManifestResourceStream("Mordekaiser.Mordekaiser.bnk");
		byte[] array = new byte[stream2.Length];
		stream2.Read(array, 0, array.Length);
		SoundBanks.Add(array);
	}
}
internal class AimIndicator : HuntressTracker
{
	private void OnEnable()
	{
		base.maxTrackingDistance = 30f;
		((HuntressTracker)this).OnEnable();
	}

	private void Update()
	{
		base.indicator.active = base.characterBody.skillLocator.special.stock >= 1;
	}
}
internal class DelayedCurse : MonoBehaviour
{
	public CharacterMaster master;

	public CharacterBody body;

	private void Start()
	{
		master = ((Component)this).GetComponent<CharacterMaster>();
	}

	private void FixedUpdate()
	{
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: 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_017e: 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_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Expected O, but got Unknown
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)master))
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)body))
		{
			body = master.GetBody();
			return;
		}
		body.baseNameToken = Language.GetString(body.baseNameToken) + " (Dominated)";
		if (Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			float num = 0f;
			SkinnedMeshRenderer[] componentsInChildren = ((Component)body.modelLocator.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				float num2 = num;
				Bounds bounds = ((Renderer)val).bounds;
				Vector3 size = ((Bounds)(ref bounds)).size;
				num = num2 + ((Vector3)(ref size)).magnitude;
			}
			GameObject val2 = Object.Instantiate<GameObject>(Prefabs.crownMark, body.modelLocator.modelTransform.position + Vector3.up * num / 2f, Quaternion.Euler(-90f, 0f, 0f), body.modelLocator.modelTransform);
			Vector3 localScale = body.modelLocator.modelTransform.localScale;
			Transform transform = val2.transform;
			transform.localScale /= (localScale.x + localScale.y + localScale.z) / 3f;
			bool flag = ((Object)body).name.Contains("Wisp");
			CharacterModel component = ((Component)body.modelLocator.modelTransform).GetComponent<CharacterModel>();
			if (Object.op_Implicit((Object)(object)component))
			{
				for (int j = 0; j < component.baseRendererInfos.Length; j++)
				{
					component.baseRendererInfos[j].defaultMaterial = Prefabs.ghostEffectMat;
				}
				for (int k = 0; k < component.baseRendererInfos.Length; k++)
				{
					RendererInfo val3 = component.baseRendererInfos[k];
					if (((object)val3.renderer).GetType() != typeof(ParticleSystemRenderer))
					{
						val3.defaultMaterial = Prefabs.ghostEffectMat;
					}
					else if (flag)
					{
						val3.defaultMaterial = new Material(component.baseRendererInfos[k].defaultMaterial);
						val3.defaultMaterial.DisableKeyword("VERTEXCOLOR");
						val3.defaultMaterial.SetTexture("_RemapTex", (Texture)(object)Prefabs.ghostRamp);
					}
				}
			}
		}
		Object.Destroy((Object)(object)this);
	}
}
internal class MordBehaviour : NetworkBehaviour
{
	public bool canExecute = true;

	public float pushForce = 25f;

	public float airbornePushMult = 0.85f;

	public float bonkDownwardForceMult = 15f;

	public Animator animator;

	public CharacterBody body;

	public SkillLocator skillLocator;

	public GameObject shieldBar;

	public TextMeshProUGUI currentShield;

	public TextMeshProUGUI fullShield;

	public Image barImage;

	public float stepMult = 6f;

	[SyncVar]
	public float shieldValue = 0f;

	public int maxShieldValue;

	public float shieldHealthMult = 0.3f;

	public bool barSetupDone;

	public bool canShield = true;

	public float passiveShieldTime = 12f;

	public float shieldAdded;

	public CharacterMaster minion;

	private NetworkedBodyAttachment darknessAttachment;

	public Renderer[] helmets = (Renderer[])(object)new Renderer[13];

	public Renderer[] crowns = (Renderer[])(object)new Renderer[13];

	public float barrierDecayStopwatch = 3f;

	public TemporaryOverlay shieldOverlay;

	private static int kRpcRpcCurseTarget;

	private static int kCmdCmdAddDarkness;

	private static int kCmdCmdDamageTarget;

	internal bool maxShield => shieldValue >= (float)maxShieldValue;

	public float NetworkshieldValue
	{
		get
		{
			return shieldValue;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<float>(value, ref shieldValue, 1u);
		}
	}

	[ClientRpc]
	public void RpcCurseTarget(GameObject masterObject)
	{
		if (Object.op_Implicit((Object)(object)masterObject))
		{
			minion = masterObject.GetComponent<CharacterMaster>();
			((Component)minion).gameObject.AddComponent<DelayedCurse>();
		}
	}

	[Server]
	public void RemoveUltBuff()
	{
		if (!NetworkServer.active)
		{
			Debug.LogWarning((object)"[Server] function 'System.Void Mordekaiser.MordBehaviour::RemoveUltBuff()' called on client");
		}
		else if (Object.op_Implicit((Object)(object)body))
		{
			body.RemoveBuff(Prefabs.ultBuff);
		}
	}

	[Server]
	public void AddShield(float value)
	{
		if (!NetworkServer.active)
		{
			Debug.LogWarning((object)"[Server] function 'System.Void Mordekaiser.MordBehaviour::AddShield(System.Single)' called on client");
		}
		else if (!(shieldValue >= (float)maxShieldValue))
		{
			NetworkshieldValue = shieldValue + value;
		}
	}

	[Server]
	public void Heal()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogWarning((object)"[Server] function 'System.Void Mordekaiser.MordBehaviour::Heal()' called on client");
			return;
		}
		float barrier = shieldAdded;
		if (body.healthComponent.barrier < shieldAdded)
		{
			barrier = body.healthComponent.barrier;
		}
		HealthComponent healthComponent = body.healthComponent;
		healthComponent.Networkbarrier -= barrier;
		body.healthComponent.Heal(barrier, default(ProcChainMask), true);
	}

	[Server]
	public void ConsumeShieldBar()
	{
		if (!NetworkServer.active)
		{
			Debug.LogWarning((object)"[Server] function 'System.Void Mordekaiser.MordBehaviour::ConsumeShieldBar()' called on client");
			return;
		}
		barrierDecayStopwatch = 0f;
		body.healthComponent.AddBarrier(shieldValue);
		shieldAdded = shieldValue;
		NetworkshieldValue = 0f;
	}

	[Command]
	public void CmdAddDarkness()
	{
		AddDarknessServer();
	}

	[Server]
	public void AddDarknessServer()
	{
		if (!NetworkServer.active)
		{
			Debug.LogWarning((object)"[Server] function 'System.Void Mordekaiser.MordBehaviour::AddDarknessServer()' called on client");
		}
		else if (Object.op_Implicit((Object)(object)body))
		{
			body.AddTimedBuff(Prefabs.darkness, 6f);
			if (body.GetBuffCount(Prefabs.darkness) >= 4 && !Object.op_Implicit((Object)(object)darknessAttachment))
			{
				darknessAttachment = Object.Instantiate<GameObject>(Prefabs.darknessAttachment).GetComponent<NetworkedBodyAttachment>();
				darknessAttachment.AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
			}
		}
	}

	[Command]
	public void CmdDamageTarget(GameObject target, float damage, bool isCrit)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody component = target.GetComponent<CharacterBody>();
		HealthComponent healthComponent = component.healthComponent;
		DamageInfo val = new DamageInfo();
		val.attacker = ((Component)this).gameObject;
		val.inflictor = ((Component)this).gameObject;
		val.force = Vector3.zero;
		val.damage = damage;
		val.crit = isCrit;
		val.position = component.corePosition;
		val.procChainMask = default(ProcChainMask);
		val.procCoefficient = 0f;
		val.damageColorIndex = (DamageColorIndex)5;
		val.damageType = (DamageType)0;
		healthComponent.TakeDamage(val);
	}

	private void OnEnable()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		body = ((Component)this).GetComponent<CharacterBody>();
		skillLocator = body.skillLocator;
		if (Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			animator = ((Component)body.modelLocator.modelTransform).GetComponent<Animator>();
		}
		HUD.Update += new hook_Update(HUD_Update);
	}

	private void FixedUpdate()
	{
		//IL_010b: 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_0104: 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_0153: 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)
		if (Object.op_Implicit((Object)(object)body))
		{
			if (Object.op_Implicit((Object)(object)shieldOverlay) && body.healthComponent.barrier <= 0f)
			{
				Object.Destroy((Object)(object)shieldOverlay);
			}
			if (Object.op_Implicit((Object)(object)crowns[body.skinIndex]))
			{
				((Component)crowns[body.skinIndex]).gameObject.SetActive(Object.op_Implicit((Object)(object)minion));
			}
			if (Object.op_Implicit((Object)(object)helmets[body.skinIndex]))
			{
				((Component)helmets[body.skinIndex]).gameObject.SetActive(!Object.op_Implicit((Object)(object)minion));
			}
			body.modelLocator.modelTransform.localScale = (body.HasBuff(Prefabs.ultBuff) ? (Vector3.one * 1.25f) : Vector3.one);
			body.modelLocator.modelBaseTransform.localScale = (body.HasBuff(Prefabs.ultBuff) ? (Vector3.one * 1.25f) : Vector3.one);
			if (Util.HasEffectiveAuthority(((Component)this).gameObject))
			{
				skillLocator.secondary.skillDef.icon = (body.characterMotor.isGrounded ? Prefabs.slam : Prefabs.pull);
			}
		}
	}

	private void HUD_Update(orig_Update orig, HUD self)
	{
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self);
		if (NetworkServer.active)
		{
			barrierDecayStopwatch += Time.deltaTime;
			if (Object.op_Implicit((Object)(object)body) && barrierDecayStopwatch < 3f)
			{
				body.barrierDecayRate = 0f;
			}
		}
		maxShieldValue = Mathf.CeilToInt(body.healthComponent.fullCombinedHealth * shieldHealthMult);
		NetworkshieldValue = Mathf.FloorToInt(Mathf.Clamp(shieldValue, 0f, (float)maxShieldValue));
		if (Object.op_Implicit((Object)(object)barImage))
		{
			barImage.fillAmount = shieldValue / (float)maxShieldValue;
		}
		if (Object.op_Implicit((Object)(object)currentShield))
		{
			((TMP_Text)currentShield).text = shieldValue.ToString();
		}
		if (Object.op_Implicit((Object)(object)fullShield))
		{
			((TMP_Text)fullShield).text = maxShieldValue.ToString();
		}
		if (!Object.op_Implicit((Object)(object)self.targetBodyObject) || !((Object)(object)self.targetBodyObject == (Object)(object)((Component)this).gameObject) || !Object.op_Implicit((Object)(object)self.mainUIPanel) || !Util.HasEffectiveAuthority(self.targetBodyObject.GetComponent<NetworkIdentity>()) || Object.op_Implicit((Object)(object)shieldBar))
		{
			return;
		}
		HealthBar componentInChildren = self.mainUIPanel.GetComponentInChildren<HealthBar>();
		if (!Object.op_Implicit((Object)(object)componentInChildren) || !Object.op_Implicit((Object)(object)((Component)componentInChildren).gameObject))
		{
			return;
		}
		Image[] componentsInChildren = ((Component)componentInChildren).gameObject.GetComponentsInChildren<Image>();
		if (!barSetupDone)
		{
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (componentsInChildren.Length == 5)
				{
					barSetupDone = true;
				}
			}
		}
		if (!barSetupDone)
		{
			return;
		}
		shieldBar = Object.Instantiate<GameObject>(((Component)componentInChildren).gameObject, ((Component)componentInChildren).gameObject.transform.parent);
		((Object)shieldBar).name = "ShieldBar";
		Object.Destroy((Object)(object)shieldBar.GetComponent<HealthBar>());
		TextMeshProUGUI[] componentsInChildren2 = shieldBar.GetComponentsInChildren<TextMeshProUGUI>();
		for (int j = 0; j < componentsInChildren2.Length; j++)
		{
			if (Object.op_Implicit((Object)(object)componentsInChildren2[j]) && Object.op_Implicit((Object)(object)((Component)componentsInChildren2[j]).gameObject))
			{
				if (((Object)((Component)componentsInChildren2[j]).gameObject).name == "CurrentHealthText")
				{
					currentShield = componentsInChildren2[j];
					((TMP_Text)currentShield).text = "0";
				}
				if (((Object)((Component)componentsInChildren2[j]).gameObject).name == "FullHealthText")
				{
					fullShield = componentsInChildren2[j];
				}
			}
		}
		Image[] componentsInChildren3 = shieldBar.GetComponentsInChildren<Image>();
		for (int k = 0; k < componentsInChildren3.Length; k++)
		{
			if (Object.op_Implicit((Object)(object)componentsInChildren3[k]) && Object.op_Implicit((Object)(object)((Component)componentsInChildren3[k]).gameObject))
			{
				if ((Object)(object)componentsInChildren3[k] != (Object)(object)componentsInChildren3[3] && (Object)(object)componentsInChildren3[k] != (Object)(object)componentsInChildren3[0])
				{
					Object.Destroy((Object)(object)((Component)componentsInChildren3[k]).gameObject);
				}
				if ((Object)(object)componentsInChildren3[k] == (Object)(object)componentsInChildren3[3])
				{
					barImage = componentsInChildren3[k];
					((Graphic)barImage).color = new Color(0.8156863f, 0.6313726f, 0.972549f);
					barImage.type = (Type)3;
					barImage.fillMethod = (FillMethod)0;
					barImage.fillCenter = false;
				}
			}
		}
	}

	private void OnDisable()
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		if (Util.HasEffectiveAuthority(((Component)this).gameObject))
		{
			skillLocator.primary.skillDef.icon = Prefabs.q1;
			skillLocator.secondary.skillDef.icon = Prefabs.slam;
			skillLocator.utility.skillDef.icon = Prefabs.shield;
			skillLocator.special.skillDef.icon = Prefabs.ult;
		}
		HUD.Update -= new hook_Update(HUD_Update);
		if (Object.op_Implicit((Object)(object)shieldBar))
		{
			Object.Destroy((Object)(object)shieldBar);
		}
	}

	private void UNetVersion()
	{
	}

	protected static void InvokeCmdCmdAddDarkness(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"Command CmdAddDarkness called on client.");
		}
		else
		{
			((MordBehaviour)(object)obj).CmdAddDarkness();
		}
	}

	protected static void InvokeCmdCmdDamageTarget(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"Command CmdDamageTarget called on client.");
		}
		else
		{
			((MordBehaviour)(object)obj).CmdDamageTarget(reader.ReadGameObject(), reader.ReadSingle(), reader.ReadBoolean());
		}
	}

	public void CallCmdAddDarkness()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"Command function CmdAddDarkness called on server.");
			return;
		}
		if (((NetworkBehaviour)this).isServer)
		{
			CmdAddDarkness();
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)5);
		val.WritePackedUInt32((uint)kCmdCmdAddDarkness);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdAddDarkness");
	}

	public void CallCmdDamageTarget(GameObject target, float damage, bool isCrit)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"Command function CmdDamageTarget called on server.");
			return;
		}
		if (((NetworkBehaviour)this).isServer)
		{
			CmdDamageTarget(target, damage, isCrit);
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)5);
		val.WritePackedUInt32((uint)kCmdCmdDamageTarget);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(target);
		val.Write(damage);
		val.Write(isCrit);
		((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdDamageTarget");
	}

	protected static void InvokeRpcRpcCurseTarget(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcCurseTarget called on server.");
		}
		else
		{
			((MordBehaviour)(object)obj).RpcCurseTarget(reader.ReadGameObject());
		}
	}

	public void CallRpcCurseTarget(GameObject masterObject)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcCurseTarget called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcCurseTarget);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(masterObject);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcCurseTarget");
	}

	static MordBehaviour()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		kCmdCmdAddDarkness = -315140379;
		NetworkBehaviour.RegisterCommandDelegate(typeof(MordBehaviour), kCmdCmdAddDarkness, new CmdDelegate(InvokeCmdCmdAddDarkness));
		kCmdCmdDamageTarget = 202705001;
		NetworkBehaviour.RegisterCommandDelegate(typeof(MordBehaviour), kCmdCmdDamageTarget, new CmdDelegate(InvokeCmdCmdDamageTarget));
		kRpcRpcCurseTarget = -1298055292;
		NetworkBehaviour.RegisterRpcDelegate(typeof(MordBehaviour), kRpcRpcCurseTarget, new CmdDelegate(InvokeRpcRpcCurseTarget));
		NetworkCRC.RegisterBehaviour("MordBehaviour", 0);
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		if (forceAll)
		{
			writer.Write(shieldValue);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(shieldValue);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		if (initialState)
		{
			shieldValue = reader.ReadSingle();
			return;
		}
		int num = (int)reader.ReadPackedUInt32();
		if (((uint)num & (true ? 1u : 0u)) != 0)
		{
			shieldValue = reader.ReadSingle();
		}
	}
}
internal class MordCurseDotBehaviour : MonoBehaviour
{
	private float stopwatch;

	private float damageFrequency = 0.1f;

	private float damageCoefficient = 0.2f;

	public CharacterBody attackerBody;

	private CharacterBody body;

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

	private void FixedUpdate()
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)attackerBody))
		{
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= damageFrequency)
			{
				stopwatch = 0f;
				DamageInfo val = new DamageInfo();
				val.attacker = ((Component)attackerBody).gameObject;
				val.inflictor = ((Component)attackerBody).gameObject;
				val.force = Vector3.zero;
				val.damage = attackerBody.damage * damageCoefficient;
				val.crit = attackerBody.RollCrit();
				val.position = body.corePosition;
				val.procChainMask = default(ProcChainMask);
				val.procCoefficient = 0f;
				val.damageColorIndex = (DamageColorIndex)7;
				val.damageType = (DamageType)262210;
				body.healthComponent.TakeDamage(val);
			}
		}
	}
}
internal class MordekaiserDarknessBehaviour : MonoBehaviour
{
	public float baseRadius = 2f;

	public float additionalRadiusPerStack = 2f;

	public float radius;

	public float stopwatch;

	public float fireFrequency = 0.25f;

	public float damageCoefficient = 0.55f;

	public float scaleVelocity = 0f;

	public CharacterBody body;

	public int buffCount;

	public NetworkedBodyAttachment attachment;

	private void Start()
	{
		attachment = ((Component)this).GetComponent<NetworkedBodyAttachment>();
	}

	private void FixedUpdate()
	{
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: 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_00b6: 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_00d3: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: 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)
		//IL_00fa: 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_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_0135: 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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		if (!Object.op_Implicit((Object)(object)body))
		{
			if (Object.op_Implicit((Object)(object)attachment))
			{
				body = attachment.attachedBody;
			}
			return;
		}
		buffCount = body.GetBuffCount(Prefabs.darkness);
		radius = baseRadius + additionalRadiusPerStack * (float)buffCount;
		if (NetworkServer.active)
		{
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= fireFrequency)
			{
				stopwatch = 0f;
				new BlastAttack
				{
					attacker = ((Component)body).gameObject,
					inflictor = ((Component)this).gameObject,
					teamIndex = body.teamComponent.teamIndex,
					position = ((Component)this).transform.position,
					procCoefficient = fireFrequency,
					radius = radius,
					baseForce = 0f,
					baseDamage = body.damage * damageCoefficient,
					bonusForce = Vector3.zero,
					crit = false,
					damageType = (DamageType)0,
					falloffModel = (FalloffModel)0,
					damageColorIndex = (DamageColorIndex)3,
					attackerFiltering = (AttackerFiltering)2
				}.Fire();
			}
		}
		float num = Mathf.SmoothDamp(((Component)this).transform.localScale.x, radius, ref scaleVelocity, 0.5f);
		((Component)this).transform.localScale = new Vector3(num, num, num);
		if (buffCount == 0)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
	}

	private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
	{
		if (sender.HasBuff(Prefabs.ultBuff))
		{
			args.damageMultAdd += 0.5f;
			args.healthMultAdd += 0.5f;
			args.moveSpeedMultAdd += 0.25f;
			args.armorAdd += 5f;
		}
		int buffCount = sender.GetBuffCount(Prefabs.darkness);
		if (buffCount >= 4)
		{
			args.moveSpeedMultAdd += 0.05f * (float)buffCount;
		}
	}

	private static void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport)
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: 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_0101: 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_0138: Expected O, but got Unknown
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Expected O, but got Unknown
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Expected O, but got Unknown
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Expected O, but got Unknown
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !damageReport.victimBody.HasBuff(Prefabs.ultMark) || !Object.op_Implicit((Object)(object)damageReport.victimBody.master))
		{
			return;
		}
		MordCurseDotBehaviour[] components = ((Component)damageReport.victimBody).GetComponents<MordCurseDotBehaviour>();
		MordCurseDotBehaviour[] array = components;
		foreach (MordCurseDotBehaviour mordCurseDotBehaviour in array)
		{
			CharacterBody attackerBody = mordCurseDotBehaviour.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody))
			{
				EffectManager.SimpleEffect(Prefabs.curseSpawnEffect, damageReport.victimBody.transform.position, Quaternion.identity, true);
				MasterSummon val = new MasterSummon
				{
					masterPrefab = MasterCatalog.GetMasterPrefab(damageReport.victimBody.master.masterIndex),
					position = damageReport.victimBody.transform.position,
					rotation = damageReport.victimBody.transform.rotation,
					summonerBodyObject = ((Component)attackerBody).gameObject,
					ignoreTeamMemberLimit = true,
					teamIndexOverride = attackerBody.teamComponent.teamIndex,
					inventoryToCopy = (Object.op_Implicit((Object)(object)damageReport.victimBody.inventory) ? damageReport.victimBody.inventory : null)
				};
				CharacterMaster val2 = val.Perform();
				val2.inventory.GiveItem(Items.BoostDamage, 5);
				val2.inventory.GiveItem(Items.BoostHp, 5);
				val2.inventory.GiveItem(Items.HealthDecay, 90);
				Deployable val3 = ((Component)val2).gameObject.AddComponent<Deployable>();
				val3.onUndeploy = new UnityEvent();
				val3.onUndeploy.AddListener(new UnityAction(val2.TrueKill));
				attackerBody.master.AddDeployable(val3, Prefabs.cursed);
				MordBehaviour component = ((Component)attackerBody).GetComponent<MordBehaviour>();
				component.minion = val2;
				component.CallRpcCurseTarget(((Component)val2).gameObject);
				val2.onBodyDeath.AddListener(new UnityAction(component.RemoveUltBuff));
			}
		}
	}

	private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
	{
		//IL_0074: 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_0066: Invalid comparison between Unknown and I4
		MordBehaviour component = ((Component)self).GetComponent<MordBehaviour>();
		if (Object.op_Implicit((Object)(object)component) && component.canShield)
		{
			component.AddShield(damageInfo.damage * 0.075f);
		}
		if (Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<MordBehaviour>()) && (int)damageInfo.damageType == 1)
		{
			damageInfo.damageType = (DamageType)0;
			self.body.AddTimedBuff(Buffs.Slow60, 2f);
		}
		orig.Invoke(self, damageInfo);
		MordBehaviour mordBehaviour = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent<MordBehaviour>() : null);
		if (Object.op_Implicit((Object)(object)mordBehaviour) && mordBehaviour.canShield)
		{
			mordBehaviour.AddShield(damageInfo.damage * 0.045f);
		}
	}
}
[BepInPlugin("com.Dragonyck.Mordekaiser", "Mordekaiser", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.Mordekaiser";

	public const string MODNAME = "Mordekaiser";

	public const string VERSION = "1.0.0";

	public const string SURVIVORNAME = "Mordekaiser";

	public const string SURVIVORNAMEKEY = "MORDEKAISER";

	public static GameObject characterPrefab;

	private static readonly Color characterColor = new Color(0.7f, 0.7f, 0.7f);

	private void Awake()
	{
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		CreatePrefab();
		RegisterStates();
		RegisterCharacter();
		Hook.Hooks();
	}

	internal static void CreatePrefab()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		//IL_0101: 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_0132: 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_0149: Expected O, but got Unknown
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_0446: 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_0478: Unknown result type (might be due to invalid IL or missing references)
		//IL_0705: Unknown result type (might be due to invalid IL or missing references)
		//IL_0723: Unknown result type (might be due to invalid IL or missing references)
		//IL_0741: Unknown result type (might be due to invalid IL or missing references)
		//IL_075f: Unknown result type (might be due to invalid IL or missing references)
		//IL_077d: Unknown result type (might be due to invalid IL or missing references)
		//IL_079b: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0814: Unknown result type (might be due to invalid IL or missing references)
		//IL_0833: Unknown result type (might be due to invalid IL or missing references)
		//IL_0852: Unknown result type (might be due to invalid IL or missing references)
		//IL_0871: Unknown result type (might be due to invalid IL or missing references)
		//IL_0991: Unknown result type (might be due to invalid IL or missing references)
		//IL_09fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a8a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ac6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0acb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b20: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b25: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b48: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b4d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b80: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/CommandoBody.prefab").WaitForCompletion();
		characterPrefab = PrefabAPI.InstantiateClone(val, "MordekaiserBody", true);
		MordBehaviour behaviour = characterPrefab.AddComponent<MordBehaviour>();
		characterPrefab.AddComponent<AimIndicator>();
		characterPrefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		Object.Destroy((Object)(object)((Component)characterPrefab.transform.Find("ModelBase")).gameObject);
		Object.Destroy((Object)(object)((Component)characterPrefab.transform.Find("CameraPivot")).gameObject);
		Object.Destroy((Object)(object)((Component)characterPrefab.transform.Find("AimOrigin")).gameObject);
		GameObject val2 = Assets.MainAssetBundle.LoadAsset<GameObject>("Assets/MordekaiserAssets/mordekaiser.prefab");
		val2.AddComponent<AnimationEvents>().soundCenter = val2.gameObject;
		GameObject val3 = new GameObject("ModelBase");
		val3.transform.parent = characterPrefab.transform;
		val3.transform.localPosition = new Vector3(0f, -0.94f, 0f);
		val3.transform.localRotation = Quaternion.identity;
		val3.transform.localScale = new Vector3(1f, 1f, 1f);
		GameObject val4 = new GameObject("AimOrigin");
		val4.transform.parent = val3.transform;
		val4.transform.localPosition = new Vector3(0f, 1.4f, 0f);
		val4.transform.localRotation = Quaternion.identity;
		val4.transform.localScale = Vector3.one;
		Transform transform = val2.transform;
		transform.parent = val3.transform;
		transform.localPosition = Vector3.zero;
		transform.localScale = Vector3.one;
		transform.localRotation = Quaternion.identity;
		CharacterDirection component = characterPrefab.GetComponent<CharacterDirection>();
		component.targetTransform = val3.transform;
		component.modelAnimator = val2.GetComponentInChildren<Animator>();
		component.turnSpeed = 720f;
		CharacterBody component2 = characterPrefab.GetComponent<CharacterBody>();
		((Object)component2).name = "MordekaiserBody";
		component2.baseNameToken = "MORDEKAISER_NAME";
		component2.subtitleNameToken = "MORDEKAISER_SUBTITLE";
		component2.bodyFlags = (BodyFlags)16;
		component2.rootMotionInMainState = false;
		component2.mainRootSpeed = 0f;
		component2.baseMaxHealth = 150f;
		component2.levelMaxHealth = 40f;
		component2.baseRegen = 1.5f;
		component2.levelRegen = 0.5f;
		component2.baseMaxShield = 0f;
		component2.levelMaxShield = 0f;
		component2.baseMoveSpeed = 7f;
		component2.levelMoveSpeed = 0f;
		component2.baseAcceleration = 110f;
		component2.baseJumpPower = 15f;
		component2.levelJumpPower = 0f;
		component2.baseDamage = 15f;
		component2.levelDamage = 3f;
		component2.baseAttackSpeed = 1f;
		component2.levelAttackSpeed = 0f;
		component2.baseCrit = 1f;
		component2.levelCrit = 0f;
		component2.baseArmor = 20f;
		component2.levelArmor = 0f;
		component2.baseJumpCount = 1;
		component2.sprintingSpeedMultiplier = 1.45f;
		component2.wasLucky = false;
		component2.hideCrosshair = false;
		component2.aimOriginTransform = val4.transform;
		component2.hullClassification = (HullClassification)0;
		component2.portraitIcon = (Texture)(object)Assets.MainAssetBundle.LoadAsset<Sprite>("portrait2").texture;
		component2._defaultCrosshairPrefab = Prefabs.Load<GameObject>("RoR2/Base/UI/SimpleDotCrosshair.prefab");
		component2.isChampion = false;
		component2.currentVehicle = null;
		component2.skinIndex = 0u;
		component2.bodyColor = characterColor;
		characterPrefab.GetComponent<HealthComponent>().health = component2.baseMaxHealth;
		CharacterMotor component3 = characterPrefab.GetComponent<CharacterMotor>();
		component3.walkSpeedPenaltyCoefficient = 1f;
		component3.characterDirection = component;
		component3.muteWalkMotion = false;
		component3.mass = 160f;
		component3.airControl = 0.25f;
		component3.disableAirControlUntilCollision = false;
		component3.generateParametersOnAwake = true;
		InputBankTest component4 = characterPrefab.GetComponent<InputBankTest>();
		component4.moveVector = Vector3.zero;
		CameraTargetParams component5 = characterPrefab.GetComponent<CameraTargetParams>();
		component5.cameraParams = val.GetComponent<CameraTargetParams>().cameraParams;
		component5.cameraPivotTransform = null;
		component5.recoil = Vector2.zero;
		component5.dontRaycastToPivot = false;
		ModelLocator component6 = characterPrefab.GetComponent<ModelLocator>();
		component6.modelTransform = transform;
		component6.modelBaseTransform = val3.transform;
		component6.dontReleaseModelOnDeath = false;
		component6.autoUpdateModelTransform = true;
		component6.dontDetatchFromParent = false;
		component6.noCorpse = false;
		component6.normalizeToFloor = false;
		component6.preserveModel = false;
		CharacterModel val5 = val2.AddComponent<CharacterModel>();
		Shader val6 = null;
		SkinnedMeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<SkinnedMeshRenderer>();
		List<RendererInfo> list = new List<RendererInfo>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if (!Object.op_Implicit((Object)(object)val6))
			{
				val6 = ((Renderer)componentsInChildren[i]).material.shader;
			}
			if (((Renderer)componentsInChildren[i]).sharedMaterials.Length == 1 && !((Object)componentsInChildren[i]).name.Contains("FX") && (Object)(object)((Renderer)componentsInChildren[i]).material.shader == (Object)(object)val6)
			{
				list.Add(new RendererInfo
				{
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultMaterial = Utils.InstantiateMaterial(((Renderer)componentsInChildren[i]).material.mainTexture),
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				});
			}
		}
		RendererInfo[] array = list.ToArray();
		val5.body = component2;
		val5.baseRendererInfos = array;
		val5.autoPopulateLightInfos = true;
		val5.invisibilityCount = 0;
		val5.temporaryOverlays = new List<TemporaryOverlay>();
		val5.mainSkinnedMeshRenderer = componentsInChildren[0];
		GameObject gameObject = ((Component)transform).gameObject;
		ModelSkinController val7 = gameObject.AddComponent<ModelSkinController>();
		LanguageAPI.Add("MORDEKAISERBODY_DEFAULT_SKIN_NAME", "Iron Revenant");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN00_NAME", "Default");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN01_NAME", "Dragon Knight");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN02_NAME", "Infernal");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN03_NAME", "Pentakill");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN04_NAME", "Lord");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN05_NAME", "King of Clubs");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN06_NAME", "Dark Star");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN13_NAME", "PROJECT");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN23_NAME", "Pentakill III: Lost Chapter");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN32_NAME", "High Noon");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN42_NAME", "Ashen Graveknight");
		LanguageAPI.Add("MORDEKAISERBODY_SKIN44_NAME", "Old God");
		val7.skins = (SkinDef[])(object)new SkinDef[13]
		{
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN00_NAME", "skin00", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_DEFAULT_SKIN_NAME", "base", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN01_NAME", "skin01", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN02_NAME", "skin02", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN03_NAME", "skin03", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN04_NAME", "skin04", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN05_NAME", "skin05", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN06_NAME", "skin06", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN13_NAME", "skin13", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN23_NAME", "skin23", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN32_NAME", "skin32", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN42_NAME", "skin42", array, behaviour)),
			LoadoutAPI.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "MORDEKAISERBODY_SKIN44_NAME", "skin44", array, behaviour))
		};
		HealthComponent component7 = characterPrefab.GetComponent<HealthComponent>();
		component7.health = component2.baseMaxHealth;
		component7.shield = 0f;
		component7.barrier = 0f;
		component7.magnetiCharge = 0f;
		component7.body = null;
		component7.dontShowHealthbar = false;
		SfxLocator component8 = characterPrefab.GetComponent<SfxLocator>();
		component8.deathSound = "Play_ui_player_death";
		component8.barkSound = "";
		component8.openSound = "";
		component8.landingSound = "Play_char_land";
		component8.fallDamageSound = "Play_char_land_fall_damage";
		component8.aliveLoopStart = "";
		component8.aliveLoopStop = "";
		Collider[] componentsInChildren2 = val2.GetComponentsInChildren<Collider>();
		HurtBoxGroup val8 = val2.AddComponent<HurtBoxGroup>();
		List<HurtBox> list2 = new List<HurtBox>();
		Collider[] array2 = componentsInChildren2;
		foreach (Collider val9 in array2)
		{
			HurtBox val10 = ((Component)val9).gameObject.AddComponent<HurtBox>();
			((Component)val10).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val10.healthComponent = component7;
			val10.isBullseye = true;
			val10.damageModifier = (DamageModifier)0;
			val10.hurtBoxGroup = val8;
			val10.indexInGroup = 0;
			val8.mainHurtBox = val10;
			val8.bullseyeCount = 1;
			list2.Add(val10);
		}
		val8.hurtBoxes = list2.ToArray();
		Utils.CreateHitbox("Swing", val2.transform, new Vector3(4.5f, 4.5f, 5.2f)).transform.localPosition = new Vector3(0f, 1f, 0.7f);
		Utils.CreateHitbox("Bonk", val2.transform, new Vector3(5f, 6f, 8f)).transform.localPosition = new Vector3(0f, 1f, 4f);
		Utils.CreateHitboxes("BigBonk", val2.transform, (Vector3[])(object)new Vector3[2]
		{
			new Vector3(5f, 6f, 8f),
			new Vector3(10f, 6f, 8f)
		}, (Vector3[])(object)new Vector3[2]
		{
			new Vector3(0f, 1f, 4f),
			new Vector3(0f, 1f, 8f)
		});
		FootstepHandler val11 = val2.AddComponent<FootstepHandler>();
		val11.baseFootstepString = "Play_player_footstep";
		val11.sprintFootstepOverrideString = "";
		val11.enableFootstepDust = true;
		val11.footstepDustPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/GenericFootstepDust.prefab").WaitForCompletion();
		EntityStateMachine component9 = ((Component)component2).GetComponent<EntityStateMachine>();
		component9.mainStateType = new SerializableEntityStateType(typeof(CharacterMain));
		CharacterDeathBehavior component10 = characterPrefab.GetComponent<CharacterDeathBehavior>();
		component10.deathStateMachine = characterPrefab.GetComponent<EntityStateMachine>();
		component10.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath));
		Utils.NewStateMachine<Idle>(characterPrefab, "Ult");
		Utils.NewStateMachine<Idle>(characterPrefab, "Shield");
		NetworkStateMachine component11 = ((Component)component2).GetComponent<NetworkStateMachine>();
		component11.stateMachines = ((Component)component2).GetComponents<EntityStateMachine>();
		ContentAddition.AddBody(characterPrefab);
	}

	private void RegisterCharacter()
	{
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		string text = "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > ";
		string text2 = "..and so he left, returning to Runeterra once more.";
		string text3 = "..and so he vanished, to Dominate the unknown.";
		LanguageAPI.Add("MORDEKAISER_NAME", "Mordekaiser");
		LanguageAPI.Add("MORDEKAISER_DESCRIPTION", text);
		LanguageAPI.Add("MORDEKAISER_SUBTITLE", "THE IRON REVENANT");
		LanguageAPI.Add("MORDEKAISER_OUTRO", text2);
		LanguageAPI.Add("MORDEKAISER_FAIL", text3);
		SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>();
		val.cachedName = "MORDEKAISER_NAME";
		val.unlockableDef = null;
		val.descriptionToken = "MORDEKAISER_DESCRIPTION";
		val.primaryColor = characterColor;
		val.bodyPrefab = characterPrefab;
		val.displayPrefab = Utils.NewDisplayModel(((Component)characterPrefab.GetComponent<ModelLocator>().modelBaseTransform).gameObject, "MordekaiserDisplay");
		val.outroFlavorToken = "MORDEKAISER_OUTRO";
		val.desiredSortPosition = 16.2f;
		val.mainEndingEscapeFailureFlavorToken = "MORDEKAISER_FAIL";
		ContentAddition.AddSurvivorDef(val);
		SkillSetup();
		GameObject val2 = PrefabAPI.InstantiateClone(Prefabs.Load<GameObject>("RoR2/Base/Commando/CommandoMonsterMaster.prefab"), "MordekaiserMaster", true);
		ContentAddition.AddMaster(val2);
		CharacterMaster component = val2.GetComponent<CharacterMaster>();
		component.bodyPrefab = characterPrefab;
	}

	private void RegisterStates()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: 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_0033: 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)
		bool flag = default(bool);
		ContentAddition.AddEntityState<Primary>(ref flag);
		ContentAddition.AddEntityState<Secondary>(ref flag);
		ContentAddition.AddEntityState<SecondaryAir>(ref flag);
		ContentAddition.AddEntityState<SecondaryGround>(ref flag);
		ContentAddition.AddEntityState<Utility>(ref flag);
		ContentAddition.AddEntityState<Special>(ref flag);
		ContentAddition.AddEntityState<CharacterMain>(ref flag);
		ContentAddition.AddEntityState<BaseMordState>(ref flag);
	}

	private void SkillSetup()
	{
		GenericSkill[] componentsInChildren = characterPrefab.GetComponentsInChildren<GenericSkill>();
		foreach (GenericSkill val in componentsInChildren)
		{
			Object.DestroyImmediate((Object)(object)val);
		}
		PassiveSetup();
		PrimarySetup();
		SecondarySetup();
		UtilitySetup();
		SpecialSetup();
	}

	private void PassiveSetup()
	{
		//IL_00a3: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("MORDEKAISER_PASSIVE_NAME", "Iron Man");
		LanguageAPI.Add("MORDEKAISER_PASSIVE_DESCRIPTION", "Store <style=cIsDamage>4.5%</style> of the post-mitigation damage dealt and <style=cIsDamage>7.5%</style> pre-mitigation damage taken as <style=cIsUtility>Potential Shield</style>. It is capped to <style=cIsHealth>30% Max HP</style>.");
		component.passiveSkill.enabled = true;
		component.passiveSkill.skillNameToken = "MORDEKAISER_PASSIVE_NAME";
		component.passiveSkill.skillDescriptionToken = "MORDEKAISER_PASSIVE_DESCRIPTION";
		component.passiveSkill.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("Iron_Man");
		LanguageAPI.Add("MORDEKAISER_DARKNESS", "Creeping Death");
		LanguageAPI.Add("MORDEKAISER_DARKNESS_DESCRIPTION", "Generate a stack of <style=cIsDamage>Creeping Death</style> for each enemy hit by your abilities, at 4 stacks summon a cloud of metal shards around you granting <style=cIsDamage>5% movement speed</style> for each stack and deals <style=cIsDamage>220% damage</style> per second.");
		SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
		val.activationState = new SerializableEntityStateType(typeof(Primary));
		val.activationStateMachineName = "Weapon";
		val.baseMaxStock = 0;
		val.baseRechargeInterval = 0f;
		val.beginSkillCooldownOnSkillEnd = true;
		val.canceledFromSprinting = false;
		val.fullRestockOnAssign = true;
		val.interruptPriority = (InterruptPriority)0;
		val.isCombatSkill = true;
		val.mustKeyPress = false;
		val.cancelSprintingOnActivation = true;
		val.rechargeStock = 0;
		val.requiredStock = 0;
		val.stockToConsume = 0;
		val.icon = Prefabs.darknessRise;
		val.skillDescriptionToken = "MORDEKAISER_DARKNESS_DESCRIPTION";
		val.skillName = "MORDEKAISER_DARKNESS";
		val.skillNameToken = "MORDEKAISER_DARKNESS";
		ContentAddition.AddSkillDef(val);
		Utils.NewGenericSkill(characterPrefab, val);
	}

	private void PrimarySetup()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("MORDEKAISER_M1", "Mace of Spades");
		LanguageAPI.Add("MORDEKAISER_M1_DESCRIPTION", "Swing in the aim direction for <style=cIsDamage>345% damage</style>. Every third hit slams farther, <style=cIsDamage>crits</style> and <style=cIsUtility>slows</style> enemies.");
		MordSkillDef mordSkillDef = ScriptableObject.CreateInstance<MordSkillDef>();
		((SkillDef)mordSkillDef).activationState = new SerializableEntityStateType(typeof(Primary));
		((SkillDef)mordSkillDef).activationStateMachineName = "Body";
		((SkillDef)mordSkillDef).baseMaxStock = 0;
		((SkillDef)mordSkillDef).baseRechargeInterval = 0f;
		((SkillDef)mordSkillDef).beginSkillCooldownOnSkillEnd = true;
		((SkillDef)mordSkillDef).canceledFromSprinting = false;
		((SkillDef)mordSkillDef).fullRestockOnAssign = true;
		((SkillDef)mordSkillDef).interruptPriority = (InterruptPriority)0;
		((SkillDef)mordSkillDef).isCombatSkill = true;
		((SkillDef)mordSkillDef).mustKeyPress = false;
		((SkillDef)mordSkillDef).cancelSprintingOnActivation = true;
		((SkillDef)mordSkillDef).rechargeStock = 0;
		((SkillDef)mordSkillDef).requiredStock = 0;
		((SkillDef)mordSkillDef).stockToConsume = 0;
		((SkillDef)mordSkillDef).icon = Prefabs.q1;
		((SkillDef)mordSkillDef).skillDescriptionToken = "MORDEKAISER_M1_DESCRIPTION";
		((SkillDef)mordSkillDef).skillName = "MORDEKAISER_M1";
		((SkillDef)mordSkillDef).skillNameToken = "MORDEKAISER_M1";
		ContentAddition.AddSkillDef((SkillDef)(object)mordSkillDef);
		component.primary = Utils.NewGenericSkill(characterPrefab, (SkillDef)(object)mordSkillDef);
	}

	private void SecondarySetup()
	{
		//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_008a: Unknown result type (might be due to invalid IL or missing references)
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("MORDEKAISER_M2", "Obliterate/Siphon of Destruction");
		LanguageAPI.Add("MORDEKAISER_M2_DESCRIPTION", "While grounded casts Obliterate, striking down in the aim direction, dealing <style=cIsDamage>580% damage</style>, additionally deals the same damage again if only one enemy is hit." + Environment.NewLine + "While airborne, casts Siphon of Destruction, deals <style=cIsDamage>320% damage</style> in a cone in the aim direction, enemies hit are pulled towards you.");
		MordSkillDef mordSkillDef = ScriptableObject.CreateInstance<MordSkillDef>();
		((SkillDef)mordSkillDef).activationState = new SerializableEntityStateType(typeof(Secondary));
		((SkillDef)mordSkillDef).activationStateMachineName = "Slide";
		((SkillDef)mordSkillDef).baseMaxStock = 1;
		((SkillDef)mordSkillDef).baseRechargeInterval = 5f;
		((SkillDef)mordSkillDef).beginSkillCooldownOnSkillEnd = true;
		((SkillDef)mordSkillDef).canceledFromSprinting = false;
		((SkillDef)mordSkillDef).fullRestockOnAssign = false;
		((SkillDef)mordSkillDef).interruptPriority = (InterruptPriority)1;
		((SkillDef)mordSkillDef).isCombatSkill = true;
		((SkillDef)mordSkillDef).mustKeyPress = true;
		((SkillDef)mordSkillDef).cancelSprintingOnActivation = false;
		((SkillDef)mordSkillDef).rechargeStock = 1;
		((SkillDef)mordSkillDef).requiredStock = 1;
		((SkillDef)mordSkillDef).stockToConsume = 1;
		((SkillDef)mordSkillDef).icon = Prefabs.slam;
		((SkillDef)mordSkillDef).skillDescriptionToken = "MORDEKAISER_M2_DESCRIPTION";
		((SkillDef)mordSkillDef).skillName = "MORDEKAISER_M2";
		((SkillDef)mordSkillDef).skillNameToken = "MORDEKAISER_M2";
		ContentAddition.AddSkillDef((SkillDef)(object)mordSkillDef);
		component.secondary = Utils.NewGenericSkill(characterPrefab, (SkillDef)(object)mordSkillDef);
	}

	private void UtilitySetup()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("MORDEKAISER_UTIL", "Indestructible");
		LanguageAPI.Add("MORDEKAISER_UTIL_DESCRIPTION", "Consume all your <style=cIsUtility>Potential Shield</style> to gain a <style=cIsHealing>temporary barrier</style> for the same amount, decaying after <style=cIsUtility>3s</style>. Recast to consume the remaining barrier, <style=cIsHealing>healing</style> for the same amount.");
		MordSkillDef mordSkillDef = ScriptableObject.CreateInstance<MordSkillDef>();
		((SkillDef)mordSkillDef).activationState = new SerializableEntityStateType(typeof(Utility));
		((SkillDef)mordSkillDef).activationStateMachineName = "Shield";
		((SkillDef)mordSkillDef).baseMaxStock = 1;
		((SkillDef)mordSkillDef).baseRechargeInterval = 5f;
		((SkillDef)mordSkillDef).beginSkillCooldownOnSkillEnd = true;
		((SkillDef)mordSkillDef).canceledFromSprinting = false;
		((SkillDef)mordSkillDef).fullRestockOnAssign = false;
		((SkillDef)mordSkillDef).interruptPriority = (InterruptPriority)1;
		((SkillDef)mordSkillDef).isCombatSkill = false;
		((SkillDef)mordSkillDef).mustKeyPress = true;
		((SkillDef)mordSkillDef).cancelSprintingOnActivation = false;
		((SkillDef)mordSkillDef).rechargeStock = 1;
		((SkillDef)mordSkillDef).requiredStock = 1;
		((SkillDef)mordSkillDef).stockToConsume = 1;
		((SkillDef)mordSkillDef).icon = Prefabs.shield;
		((SkillDef)mordSkillDef).skillDescriptionToken = "MORDEKAISER_UTIL_DESCRIPTION";
		((SkillDef)mordSkillDef).skillName = "MORDEKAISER_UTIL";
		((SkillDef)mordSkillDef).skillNameToken = "MORDEKAISER_UTIL";
		ContentAddition.AddSkillDef((SkillDef)(object)mordSkillDef);
		component.utility = Utils.NewGenericSkill(characterPrefab, (SkillDef)(object)mordSkillDef);
	}

	private void SpecialSetup()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("MORDEKAISER_SPEC_KEYWORD", "<style=cKeywordName>Harvester of Sorrow</style><style=cSub>While you have a <style=cIsDamage>Dominated</style> minion, you are granted <style=cIsDamage>50% damage</style>, <style=cIsHealth>50% Max HP</style>, <style=cIsDamage>50% damage</style>, <style=cIsDamage>25% movement speed</style> and <style=cIsDamage>5 armor</style>.");
		LanguageAPI.Add("MORDEKAISER_SPEC", "Children of the Grave");
		LanguageAPI.Add("MORDEKAISER_SPEC_DESCRIPTION", "Curse the target enemy indefinitely, dealing <style=cIsDamage>200% damage</style> per second, granting <style=cKeywordName>Harvester of Sorrow</style><style=cSub>. When the target dies, their soul is enslaved as an ally ghost, with bonus <style=cIsDamage>damage</style> and <style=cIsHealth>health</style>, lasting <style=cIsUtility>90s</style>.");
		MordSkillDef mordSkillDef = ScriptableObject.CreateInstance<MordSkillDef>();
		((SkillDef)mordSkillDef).activationState = new SerializableEntityStateType(typeof(Special));
		((SkillDef)mordSkillDef).activationStateMachineName = "Ult";
		((SkillDef)mordSkillDef).baseMaxStock = 1;
		((SkillDef)mordSkillDef).baseRechargeInterval = 30f;
		((SkillDef)mordSkillDef).beginSkillCooldownOnSkillEnd = true;
		((SkillDef)mordSkillDef).canceledFromSprinting = false;
		((SkillDef)mordSkillDef).fullRestockOnAssign = false;
		((SkillDef)mordSkillDef).interruptPriority = (InterruptPriority)0;
		((SkillDef)mordSkillDef).isCombatSkill = true;
		((SkillDef)mordSkillDef).mustKeyPress = true;
		((SkillDef)mordSkillDef).cancelSprintingOnActivation = false;
		((SkillDef)mordSkillDef).rechargeStock = 1;
		((SkillDef)mordSkillDef).requiredStock = 1;
		((SkillDef)mordSkillDef).stockToConsume = 1;
		((SkillDef)mordSkillDef).icon = Prefabs.ult;
		((SkillDef)mordSkillDef).skillDescriptionToken = "MORDEKAISER_SPEC_DESCRIPTION";
		((SkillDef)mordSkillDef).skillName = "MORDEKAISER_SPEC";
		((SkillDef)mordSkillDef).skillNameToken = "MORDEKAISER_SPEC";
		((SkillDef)mordSkillDef).keywordTokens = new string[1] { "MORDEKAISER_SPEC_KEYWORD" };
		ContentAddition.AddSkillDef((SkillDef)(object)mordSkillDef);
		component.special = Utils.NewGenericSkill(characterPrefab, (SkillDef)(object)mordSkillDef);
	}
}
internal class MordSkillDef : SkillDef
{
	private class InstanceData : BaseSkillInstanceData
	{
		public AimIndicator aimBehaviour;

		public MordBehaviour behaviour;

		public SkillLocator skillLocator;
	}

	public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
	{
		return (BaseSkillInstanceData)(object)new InstanceData
		{
			aimBehaviour = ((Component)skillSlot).GetComponent<AimIndicator>(),
			behaviour = ((Component)skillSlot).GetComponent<MordBehaviour>(),
			skillLocator = ((Component)skillSlot).GetComponent<SkillLocator>()
		};
	}

	internal static bool IsExecutable([NotNull] GenericSkill skillSlot)
	{
		InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData;
		AimIndicator aimBehaviour = instanceData.aimBehaviour;
		MordBehaviour behaviour = instanceData.behaviour;
		SkillLocator skillLocator = instanceData.skillLocator;
		if ((Object)(object)skillSlot == (Object)(object)skillLocator.special)
		{
			return Object.op_Implicit((Object)(object)((HuntressTracker)aimBehaviour).trackingTarget);
		}
		if ((Object)(object)skillSlot == (Object)(object)skillLocator.utility)
		{
			return behaviour.canExecute && behaviour.shieldValue > 0f;
		}
		return behaviour.canExecute;
	}

	public override bool CanExecute([NotNull] GenericSkill skillSlot)
	{
		return IsExecutable(skillSlot) && ((SkillDef)this).CanExecute(skillSlot);
	}

	public override bool IsReady([NotNull] GenericSkill skillSlot)
	{
		return ((SkillDef)this).IsReady(skillSlot) && IsExecutable(skillSlot);
	}
}
internal class Prefabs
{
	internal static GameObject autoHitEffect;

	internal static GameObject autoHitLightEffect;

	internal static GameObject autoCritHitEffect;

	internal static GameObject slamImpactEffect;

	internal static GameObject swingEffect;

	internal static GameObject pullHitEffect;

	internal static GameObject darknessAttachment;

	internal static GameObject helmMark;

	internal static GameObject crownMark;

	internal static GameObject curseDebuffEffect;

	internal static GameObject curseSpawnEffect;

	internal static GameObject pullEffect;

	internal static Material shieldOverlayMat;

	internal static BuffDef ultMark;

	internal static BuffDef ultBuff;

	internal static BuffDef darkness;

	internal static Material ghostEffectMat;

	internal static Material curseOverlayMat;

	internal static Texture2D ghostRamp;

	internal static Sprite q1;

	internal static Sprite q2;

	internal static Sprite q3;

	internal static Sprite slam;

	internal static Sprite pull;

	internal static Sprite w;

	internal static Sprite shield;

	internal static Sprite heal;

	internal static Sprite ult;

	internal static Sprite control;

	internal static Sprite darknessRise;

	internal static DeployableSlot cursed;

	internal static int DeployableCount(CharacterMaster master, int count)
	{
		return 1;
	}

	internal static T Load<T>(string path)
	{
		//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)
		return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
	}

	internal static void CreatePrefabs()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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_00d0: Expected O, but got Unknown
		//IL_00da: 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_015d: 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_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Expected O, but got Unknown
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03da: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e4: Expected O, but got Unknown
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0653: Unknown result type (might be due to invalid IL or missing references)
		//IL_065a: Expected O, but got Unknown
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Expected O, but got Unknown
		//IL_052c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0536: Expected O, but got Unknown
		//IL_089b: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a5: Expected O, but got Unknown
		//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f1: Expected O, but got Unknown
		//IL_0826: Unknown result type (might be due to invalid IL or missing references)
		cursed = DeployableAPI.RegisterDeployableSlot(new GetDeployableSameSlotLimit(DeployableCount));
		q1 = Assets.Load<Sprite>("mordekaiserq1");
		q2 = Assets.Load<Sprite>("mordekaiserq2");
		q3 = Assets.Load<Sprite>("mordekaiserq3");
		slam = Assets.Load<Sprite>("mordekaiserq");
		pull = Assets.Load<Sprite>("Siphon_of_Destruction");
		w = Assets.Load<Sprite>("Siphon_of_Destruction");
		shield = Assets.Load<Sprite>("mordekaiserw");
		heal = Assets.Load<Sprite>("mordekaiserw2");
		ult = Assets.Load<Sprite>("Children_of_the_Grave");
		control = Assets.Load<Sprite>("Dragon_Force");
		darknessRise = Assets.Load<Sprite>("Creeping_Death");
		shieldOverlayMat = new Material(Load<Material>("RoR2/DLC1/StrengthenBurn/matStrongerBurn.mat"));
		shieldOverlayMat.SetColor("_TintColor", Color.white);
		shieldOverlayMat.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampLightning.png"));
		shieldOverlayMat.SetTexture("_Cloud1Tex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/texCloudLightning1.png"));
		shieldOverlayMat.SetVector("_CutoffScroll", new Vector4(10f, -5f, 9f, 9f));
		ghostRamp = Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampGhost.png");
		ultMark = Utils.NewBuffDef("Children of the Grave", stack: false, hidden: false, ult, Color.white);
		ultBuff = Utils.NewBuffDef("Harvester of Sorrow", stack: false, hidden: false, ult, Color.white);
		darkness = Utils.NewBuffDef("Creeping Death", stack: true, hidden: false, darknessRise, Color.white);
		curseOverlayMat = new Material(Load<Material>("RoR2/Base/ElitePoison/matElitePoisonDarkTrail.mat"));
		curseOverlayMat.SetTexture("_MainTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Croco/texCrocoDecalMask.png"));
		curseOverlayMat.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampMysterySpacePortal.png"));
		autoHitEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Common/VFX/OmniImpactVFXMedium.prefab"), "MordekaiserAutoHitEffect", false);
		Utils.RegisterEffect(autoHitEffect, 1f, "Play_Mordekaiser_Auto_Hit_Heavy");
		autoHitLightEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Common/VFX/OmniImpactVFXMedium.prefab"), "MordekaiserAutoHitEffect", false);
		Utils.RegisterEffect(autoHitLightEffect, 1f, "Play_Mordekaiser_Auto_Hit_Light");
		autoCritHitEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Captain/HitsparkCaptainShotgun.prefab"), "MordekaiserAutoCritHitEffect", false);
		Utils.RegisterEffect(autoCritHitEffect, 1f, "Play_Mordekaiser_Q3_Auto_Hit");
		ParticleSystem[] componentsInChildren = Load<GameObject>("RoR2/Base/Brother/BrotherSlamImpact.prefab").GetComponentsInChildren<ParticleSystem>(true);
		slamImpactEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Parent/ParentSlamEffect.prefab"), "MordekaiserSlamImpactEffect", false);
		Transform child = slamImpactEffect.transform.GetChild(0);
		((Renderer)((Component)Object.Instantiate<ParticleSystem>(componentsInChildren[2], child.position, Quaternion.Euler(-90f, 0f, 0f), child)).GetComponent<ParticleSystemRenderer>()).material = Load<Material>("RoR2/Base/Huntress/matOmniHitspark3Huntress.mat");
		((Renderer)((Component)Object.Instantiate<ParticleSystem>(componentsInChildren[2], child.position, Quaternion.Euler(-90f, 0f, 0f), child)).GetComponent<ParticleSystemRenderer>()).material = Load<Material>("RoR2/Base/Loader/matOmniHitspark1Loader.mat");
		Object.Instantiate<ParticleSystem>(componentsInChildren[12], child.position, Quaternion.Euler(-90f, 0f, 0f), child);
		((Component)child).transform.localScale = new Vector3(1f, 1f, 1f);
		Texture2D val = Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampWispSoul.png");
		ParticleSystemRenderer[] componentsInChildren2 = slamImpactEffect.GetComponentsInChildren<ParticleSystemRenderer>(true);
		foreach (ParticleSystemRenderer val2 in componentsInChildren2)
		{
			ParticleSystem component = ((Component)val2).GetComponent<ParticleSystem>();
			component.scalingMode = (ParticleSystemScalingMode)0;
			MainModule main = component.main;
			string name = ((Object)val2).name;
			if (name == "Dust, Directional")
			{
				((Renderer)val2).material = new Material(Load<Material>("RoR2/DLC1/snowyforest/matSFFireStaticYellowLarge.mat"));
				((Renderer)val2).material.SetTexture("_MainTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/VFX/texFluffyCloud3Mask.png"));
				((Renderer)val2).material.SetTexture("_RemapTex", (Texture)(object)val);
				((Renderer)val2).material.SetFloat("_Boost", 5f);
				((Component)val2).transform.localScale = Vector3.one * 1.4f;
			}
			if (name == "FoamSplash(Clone)")
			{
				((Renderer)val2).material = Load<Material>("RoR2/Base/Common/VFX/matOpaqueDustSpeckledUnlit.mat");
			}
			if (name == "Flames, Radial")
			{
				((Component)val2).transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
				ShapeModule shape = component.shape;
				((ShapeModule)(ref shape)).enabled = false;
				((Renderer)val2).material = new Material(((Renderer)val2).material);
				((Renderer)val2).material.SetTexture("_RemapTex", (Texture)(object)val);
				((Renderer)val2).material.SetFloat("_Boost", 5f);
				((Renderer)val2).material.SetFloat("_AlphaBoost", 3.8f);
			}
			if (name == "Nova Sphere")
			{
				((Renderer)val2).material = new Material(Load<Material>("RoR2/Base/BleedOnHitAndExplode/matBleedOnHitAndExplodeAreaIndicator.mat"));
				((Renderer)val2).material.SetTexture("_RemapTex", (Texture)(object)val);
			}
		}
		Utils.RegisterEffect(slamImpactEffect, 1f, "Play_Mordekaiser_Q1_Hit");
		pullHitEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Merc/OmniImpactVFXSlashMercEvis.prefab"), "MordekaiserPullHitEffect", false);
		Utils.RegisterEffect(pullHitEffect, 1f, "Play_Mordekaiser_Pull_Hit");
		darknessAttachment = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Icicle/IcicleAura.prefab"), "MordekaiserDarknessAttachment", true);
		darknessAttachment.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		IcicleAuraController component2 = darknessAttachment.GetComponent<IcicleAuraController>();
		ParticleSystem[] auraParticles = component2.auraParticles;
		foreach (ParticleSystem val3 in auraParticles)
		{
			MainModule main2 = val3.main;
			((MainModule)(ref main2)).loop = true;
			((MainModule)(ref main2)).playOnAwake = true;
		}
		Object.Destroy((Object)(object)component2);
		darknessAttachment.AddComponent<NetworkedBodyAttachment>().shouldParentToAttachedBody = true;
		darknessAttachment.AddComponent<MordekaiserDarknessBehaviour>();
		Texture2D val4 = Load<Texture2D>("RoR2/DLC1/VendingMachine/texRampVendingMachine.png");
		Material val5 = new Material(Load<Material>("RoR2/Base/Icicle/matIceAura.mat"));
		val5.SetTexture("_RemapTex", (Texture)(object)val4);
		val5.SetTexture("_Cloud1Tex", (Texture)(object)Assets.Load<Texture2D>("mordekaiser_skin42_rwing_tx_mask"));
		ParticleSystemRenderer[] componentsInChildren3 = darknessAttachment.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val6 in componentsInChildren3)
		{
			string name2 = ((Object)val6).name;
			if (name2 == "Chunks" || name2 == "SpinningSharpChunks")
			{
				ParticleSystem component3 = ((Component)val6).GetComponent<ParticleSystem>();
				component3.startSize = 0.2f;
				SizeOverLifetimeModule sizeOverLifetime = component3.sizeOverLifetime;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = false;
				EmissionModule emission = component3.emission;
				((EmissionModule)(ref emission)).rateOverTimeMultiplier = 5f;
				((Renderer)val6).material = Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetMetal.mat");
				Utils.AddRotationComponent(((Component)val6).gameObject, 75f, (RotationAxis)2);
				if (name2 == "SpinningSharpChunks")
				{
					((EmissionModule)(ref emission)).rateOverTimeMultiplier = 8f;
					val6.mesh = Load<GameObject>("RoR2/DLC1/BossHunter/mdlBlunderbussShard.fbx").GetComponentInChildren<MeshFilter>().mesh;
				}
				else
				{
					Object.Instantiate<GameObject>(((Component)val6).gameObject, ((Component)val6).transform.parent);
				}
			}
			if (name2 == "Ring, Core" || name2 == "Ring, Outer" || name2 == "Ring, Procced")
			{
				((Renderer)val6).material = val5;
			}
			if (name2 == "Area")
			{
				((Renderer)val6).material = new Material(Load<Material>("RoR2/DLC1/VoidMegaCrab/matVoidCrabAntiMatterAreaIndicator.mat"));
				((Renderer)val6).material.SetTexture("_RemapTex", (Texture)(object)val4);
				((Renderer)val6).material.SetColor("_TintColor", new Color(0.69803f, 0.69803f, 0.69803f, 0.71764f));
				((Renderer)val6).material.SetFloat("_RimStrength", 0.45f);
			}
		}
		swingEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Brother/BrotherSwing1.prefab"), "MordekaiserSwingEffect", false);
		((Behaviour)swingEffect.GetComponentInChildren<PostProcessVolume>()).enabled = false;
		ParticleSystemRenderer componentInChildren = swingEffect.GetComponentInChildren<ParticleSystemRenderer>();
		((Renderer)componentInChildren).material = new Material(((Renderer)componentInChildren).material);
		((Renderer)componentInChildren).material.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampTwotone.jpg"));
		((Renderer)componentInChildren).material.SetFloat("_AlphaBoost", 5f);
		Object.Destroy((Object)(object)swingEffect.GetComponent<EffectComponent>());
		Object.Destroy((Object)(object)swingEffect.GetComponent<VFXAttributes>());
		ghostEffectMat = Load<Material>("RoR2/Base/Common/VFX/matGhostEffect.mat");
		helmMark = Assets.Load<GameObject>("helm");
		Utils.AddRotationComponent(helmMark, 140f, (RotationAxis)2);
		((Renderer)helmMark.GetComponent<MeshRenderer>()).material = ghostEffectMat;
		crownMark = Assets.Load<GameObject>("crown");
		((Renderer)crownMark.GetComponent<MeshRenderer>()).material = ghostEffectMat;
		curseDebuffEffect = Assets.Load<GameObject>("CurseDebuffEffect");
		Utils.RegisterEffect(curseDebuffEffect, 1f);
		curseSpawnEffect = Assets.Load<GameObject>("CurseSpawnEffect");
		Utils.RegisterEffect(curseSpawnEffect, 1f, "Play_Mordekaiser_R_Spawn");
		pullEffect = Assets.Load<GameObject>("PullEffect");
		Utils.RegisterEffect(pullEffect, 1.2f);
	}
}
internal class BaseMordState : BaseSkillState
{
	public Animator animator;

	public MordBehaviour behaviour;

	public AimIndicator aimIndicator;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		animator = ((EntityState)this).GetModelAnimator();
		behaviour = ((EntityState)this).GetComponent<MordBehaviour>();
		aimIndicator = ((EntityState)this).GetComponent<AimIndicator>();
	}
}
internal class CharacterMain : GenericCharacterMain
{
}
internal class MeleeSkillState : BaseSkillState
{
	internal float hitPauseDuration;

	internal float hopVelocity = Assaulter.smallHopVelocity;

	internal string animParameter = "";

	internal float hitPauseTimer;

	internal bool isInHitPause;

	internal HitStopCachedState hitStopCachedState;

	internal Animator animator;

	internal float stopwatch;

	internal OverlapAttack attack;

	internal bool hitCallback;

	internal float damage;

	internal GameObject hitEffectPrefab;

	internal HitBoxGroup hitBoxGroup;

	internal DamageType damageType = (DamageType)0;

	internal DamageColorIndex damageColor = (DamageColorIndex)0;

	internal Vector3 forceVector = Vector3.back * 100f;

	internal float attackStopwatch;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		animator = ((EntityState)this).GetModelAnimator();
		isInHitPause = false;
		hitPauseDuration = GroundLight.hitPauseDuration / ((BaseState)this).attackSpeedStat;
	}

	internal OverlapAttack NewOverlapAttack()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: 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_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)
		OverlapAttack val = new OverlapAttack();
		val.procChainMask = default(ProcChainMask);
		val.procCoefficient = 1f;
		val.attacker = ((EntityState)this).gameObject;
		val.inflictor = ((EntityState)this).gameObject;
		val.teamIndex = ((EntityState)this).characterBody.teamComponent.teamIndex;
		val.damage = ((EntityState)this).characterBody.damage * damage;
		val.forceVector = forceVector;
		val.hitEffectPrefab = hitEffectPrefab;
		val.isCrit = ((EntityState)this).characterBody.RollCrit();
		val.damageColorIndex = damageColor;
		val.damageType = damageType;
		val.maximumOverlapTargets = 100;
		val.hitBoxGroup = hitBoxGroup;
		return val;
	}

	public override void FixedUpdate()
	{
		//IL_00cf: 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)
		((EntityState)this).FixedUpdate();
		hitPauseTimer -= Time.fixedDeltaTime;
		if (hitCallback && !isInHitPause)
		{
			if (!((BaseState)this).isGrounded)
			{
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, hopVelocity);
			}
			if (!Utility.IsNullOrWhiteSpace(animParameter))
			{
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, animParameter);
			}
			hitPauseTimer = hitPauseDuration / ((BaseState)this).attackSpeedStat;
			isInHitPause = true;
		}
		if (!Utility.IsNullOrWhiteSpace(animParameter) && hitPauseTimer <= 0f && isInHitPause)
		{
			((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
			isInHitPause = false;
		}
		if (!isInHitPause)
		{
			attackStopwatch += Time.fixedDeltaTime;
			stopwatch += Time.fixedDeltaTime;
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.speed = 1f;
			}
		}
		else if (Object.op_Implicit((Object)(object)animator))
		{
			animator.speed = 0f;
		}
	}
}
internal class Primary : BaseMordState
{
	internal float hitPauseDuration = GroundLight.hitPauseDuration;

	private float stopwatch;

	private float attackDuration;

	private float earlyExitDuration;

	public OverlapAttack overlapAttack;

	private float hitPauseTimer;

	private bool isInHitPause;

	private bool hasSwung;

	public bool hasHit;

	public int comboState = 1;

	public int maxComboState = 3;

	private HitStopCachedState hitStopCachedState;

	public GameObject hitEffectPrefab;

	public string animCurve = "Curve";

	private bool hop;

	private float stepMult;

	private float pushAwayForce = 550f;

	private float attackSpeedScaling;

	private Vector3 direction;

	private bool addedDarknessStack;

	public virtual bool finisher => comboState == maxComboState;

	public virtual bool changePrimaryIcon => true;

	public virtual float comboDamageCoefficient => 3.45f;

	public virtual GameObject baseHitEffectPrefab => Prefabs.autoHitEffect;

	public virtual GameObject finisherHitEffectPrefab => Prefabs.autoCritHitEffect;

	public virtual string baseComboHitGroup => "Swing";

	public virtual string finisherComboHitGroup => "Bonk";

	public override void OnEnter()
	{
		//IL_014d: 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_0168: 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_016d: 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_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		base.OnEnter();
		attackSpeedScaling = Mathf.Clamp(((BaseState)this).attackSpeedStat, 1f, 10f);
		stepMult = behaviour.stepMult / attackSpeedScaling;
		attackDuration = (finisher ? 0.75f : 0.55f) / attackSpeedScaling;
		earlyExitDuration = 0.1f / attackSpeedScaling;
		animator.SetFloat(animCurve, 0f);
		hitEffectPrefab = (finisher ? finisherHitEffectPrefab : baseHitEffectPrefab);
		((EntityState)this).PlayAnimation("FullBody, Override", "Attack" + comboState, "M1", attackDuration);
		overlapAttack = ((BaseState)this).InitMeleeOverlap(comboDamageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), finisher ? finisherComboHitGroup : baseComboHitGroup);
		SetCrit();
		((BaseState)this).StartAimMode(attackDuration, false);
		overlapAttack.hitEffectPrefab = hitEffectPrefab;
		overlapAttack.pushAwayForce = pushAwayForce;
		overlapAttack.forceVector = (finisher ? (Vector3.down * pushAwayForce * behaviour.bonkDownwardForceMult) : Vector3.one);
		if (changePrimaryIcon && finisher)
		{
			overlapAttack.damageType = (DamageType)1;
		}
		Ray aimRay = ((BaseState)this).GetAimRay();
		direction = ((Ray)(ref aimRay)).direction;
		AkSoundEngine.PostEvent(Sounds.Play_Mordekaiser_Auto_Cast, ((EntityState)this).gameObject);
	}

	public virtual void SetCrit()
	{
		overlapAttack.isCrit = finisher;
	}

	public override void OnExit()
	{
		((EntityState)this).OnExit();
	}

	public override void Update()
	{
		((EntityState)this).Update();
		if (finisher && !((BaseState)this).isGrounded)
		{
			((BaseState)this).SmallHop(((EntityState)this).characterMotor, 0f);
		}
		((EntityState)this).characterBody.isSprinting = false;
		animator.SetBool("isMoving", false);
	}

	public override void FixedUpdate()
	{
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_016d: 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_0191: 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_0208: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		hitPauseTimer -= Time.fixedDeltaTime;
		if (((EntityState)this).isAuthority)
		{
			bool flag = Fire();
			hasHit |= flag;
			if (flag)
			{
				if (!addedDarknessStack)
				{
					addedDarknessStack = true;
					behaviour.CallCmdAddDarkness();
				}
				if (!hop && !((EntityState)this).characterMotor.isGrounded)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, 5f);
					hop = true;
				}
				if (!isInHitPause)
				{
					hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "M1");
					hitPauseTimer = hitPauseDuration / ((BaseState)this).attackSpeedStat;
					isInHitPause = true;
				}
			}
			if (!hasHit && animator.GetFloat(animCurve) > 0.1f)
			{
				if (!hasSwung)
				{
					hasSwung = true;
					Transform val = ((BaseState)this).FindModelChild("swingMuzzle" + comboState);
					GameObject val2 = Object.Instantiate<GameObject>(Prefabs.swingEffect, val.position, Quaternion.identity, val);
					val2.transform.localPosition = Vector3.one;
					val2.transform.localRotation = Quaternion.identity;
					val2.transform.localScale = Vector3.one;
				}
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.rootMotion += direction * stepMult * Mathf.Clamp(((BaseState)this).moveSpeedStat, 1f, 15f) * Time.fixedDeltaTime;
			}
			if (hitPauseTimer <= 0f && isInHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				isInHitPause = false;
			}
		}
		if (!isInHitPause)
		{
			stopwatch += Time.fixedDeltaTime;
		}
		else
		{
			((EntityState)this).characterMotor.velocity = Vector3.zero;
			animator.SetFloat("M1", 0f);
		}
		if (!((EntityState)this).isAuthority || !(stopwatch >= attackDuration - earlyExitDuration))
		{
			return;
		}
		if (((EntityState)this).inputBank.skill1.down && !finisher)
		{
			Primary primary = new Primary();
			primary.comboState = comboState + 1;
			if (primary.comboState == 2)
			{
				((EntityState)this).skillLocator.primary.skillDef.icon = Prefabs.q2;
			}
			else
			{
				((EntityState)this).skillLocator.primary.skillDef.icon = Prefabs.q3;
			}
			((EntityState)this).outer.SetNextState((EntityState)(object)primary);
		}
		else if (stopwatch >= attackDuration)
		{
			((EntityState)this).skillLocator.primary.skillDef.icon = Prefabs.q1;
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public virtual bool Fire()
	{
		return ((BaseState)this).FireMeleeOverlap(overlapAttack, animator, animCurve, 0f, false);
	}

	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)2;
	}

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

	public override void OnDeserialize(NetworkReader reader)
	{
		((BaseSkillState)this).OnDeserialize(reader);
		comboState = reader.ReadByte();
	}
}
internal class Secondary : BaseMordState
{
	public override void OnEnter()
	{
		base.OnEnter();
		if (((EntityState)this).isAuthority)
		{
			if (((BaseState)this).isGrounded)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new SecondaryGround());
			}
			else
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new SecondaryAir());
			}
		}
	}

	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;
	}
}
internal class SecondaryAir : BaseMordState
{
	private float duration = 0.65f;

	private float damageCoefficient = 3.2f;

	public override void OnEnter()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: 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_0030: 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_0047: 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_004f: 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_0057: 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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Expected O, but got Unknown
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: 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_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Expected O, but got Unknown
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: 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_022